* MAW-863: environment cleanup
* MAW-863: plugin install(vwo) * MAW-869: Disable Auto-Update
This commit is contained in:
@@ -1 +0,0 @@
|
||||
google-site-verification: google2804da411db9e9fe.html
|
||||
39
wp/readme.md
39
wp/readme.md
@@ -1,39 +0,0 @@
|
||||
# WordPress
|
||||
|
||||
This is a WordPress repository configured to run on the [Pantheon platform](https://pantheon.io).
|
||||
|
||||
Pantheon is website platform optimized and configured to run high performance sites with an amazing developer workflow. There is built-in support for features such as Varnish, Redis, Apache Solr, New Relic, Nginx, PHP-FPM, MySQL, PhantomJS and more.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### 1. Spin-up a site
|
||||
|
||||
If you do not yet have a Pantheon account, you can create one for free. Once you've verified your email address, you will be able to add sites from your dashboard. Choose "WordPress" to use this distribution.
|
||||
|
||||
### 2. Load up the site
|
||||
|
||||
When the spin-up process is complete, you will be redirected to the site's dashboard. Click on the link under the site's name to access the Dev environment.
|
||||
|
||||

|
||||
|
||||
### 3. Run the WordPress installer
|
||||
|
||||
How about the WordPress database config screen? No need to worry about database connection information as that is taken care of in the background. The only step that you need to complete is the site information and the installation process will be complete.
|
||||
|
||||
We will post more information about how this works but we recommend developers take a look at `wp-config.php` to get an understanding.
|
||||
|
||||

|
||||
|
||||
If you would like to keep a separate set of configuration for local development, you can use a file called `wp-config-local.php`, which is already in our .gitignore file.
|
||||
|
||||
### 4. Enjoy!
|
||||
|
||||

|
||||
|
||||
## Branches
|
||||
|
||||
The `default` branch of this repository is where PRs are merged, and has [CI](https://github.com/pantheon-systems/WordPress/tree/default/.circleci) that copies `default` to `master` after removing the CI directories. This allows customers to clone from `master` and implement their own CI without needing to worry about potential merge conflicts.
|
||||
|
||||
## Custom Upstreams
|
||||
|
||||
If you are using this repository as a starting point for a custom upstream, be sure to review the [documentation](https://pantheon.io/docs/create-custom-upstream#pull-in-core-from-pantheons-upstream) and pull the core files from the `master` branch.
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
define( 'WP_CACHE', true ); // Added by WP Rocket
|
||||
|
||||
if ( file_exists( dirname( __FILE__ ) . '/wp-config-local.php' ) ) {
|
||||
include( dirname( __FILE__ ) . '/wp-config-local.php' );
|
||||
@@ -30,6 +29,7 @@ define('RT_WP_NGINX_HELPER_CACHE_PATH','/usr/share/nginx/subdomain/www/wp-conten
|
||||
$table_prefix = 'wp_xygy_';
|
||||
}
|
||||
|
||||
define( 'WP_AUTO_UPDATE_CORE', false);
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
define( 'WP_CACHE', false ); // Added by WP Rocket
|
||||
|
||||
/**
|
||||
* This config file is yours to hack on. It will work out of the box on Pantheon
|
||||
* but you may find there are a lot of neat tricks to be used here.
|
||||
*
|
||||
* See our documentation for more details:
|
||||
*
|
||||
* https://pantheon.io/docs
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This block will be executed if you are NOT running on Pantheon and have NO
|
||||
* wp-config-local.php. Insert alternate config here if necessary.
|
||||
*
|
||||
* If you are only running on Pantheon, you can ignore this block.
|
||||
*/
|
||||
|
||||
// ------------------------------------
|
||||
define('DB_NAME', 'pantheon');
|
||||
define('DB_USER', 'pantheon');
|
||||
// --------------------------------------------
|
||||
define('DB_PASSWORD', 'pantheon');
|
||||
define('DB_HOST', '127.0.0.1');
|
||||
define('CACHE_PASSWORD', $_SERVER["CACHE_PASSWORD"]);
|
||||
define('CACHE_HOST', $_SERVER["CACHE_HOST"]);
|
||||
define('CACHE_PORT', '6379');
|
||||
// ---------------------------------------------------
|
||||
define('DB_CHARSET', 'utf8');
|
||||
define('DB_COLLATE', '');
|
||||
define('AUTH_KEY', 'fad5cfeb464e3cb6d2a72bfe290d84e25478753824970a9455f5cb350a9f8183');
|
||||
define('SECURE_AUTH_KEY', '4238b8016c46c6b746e9fba4106c771e2f4b688b9445ad64ba7efff9a8272c9d');
|
||||
define('LOGGED_IN_KEY', '4238b8016c46c6b746e9fba4106c771e2f4b688b9445ad64ba7efff9a8272c9d');
|
||||
define('NONCE_KEY', '4b6f1e1470301e5d979e8d333616eaf556b4d1e980ae5f959e06dd494bb0d995');
|
||||
define('AUTH_SALT', 'bc345fc63882f49dbba21248add8beb61b8e68d20ce5d4623de03022a0666c1b');
|
||||
define('SECURE_AUTH_SALT', '03e361ac295e49d27bd47e6229558724bdf16e3ed9705efd2822c643c20ffdc0');
|
||||
define('LOGGED_IN_SALT', '90d8f33cc74663986e2bbe86b5d11539180ea434974ea2a1e17eca04f4b54abc');
|
||||
define('NONCE_SALT', '6640b7f1a18031eaf01b6e7dc3f445b6f582ab9922674c286c2b527c9c579dea');
|
||||
$table_prefix = 'wp_xygy_';
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*
|
||||
* You may want to examine $_ENV['PANTHEON_ENVIRONMENT'] to set this to be
|
||||
* "true" in dev, but false in test and live.
|
||||
*/
|
||||
if ( ! defined( 'WP_DEBUG' ) ) {
|
||||
define('WP_DEBUG', false);
|
||||
}
|
||||
|
||||
define( 'WPMS_ON', true );
|
||||
define( 'WPMS_SMTP_PASS', 'C#9!Ev-kt$$j' );
|
||||
|
||||
define('FORCE_SSL_ADMIN', true);
|
||||
$_SERVER['HTTPS']='on';
|
||||
|
||||
/* That's all, stop editing! Happy Pressing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( !defined('ABSPATH') )
|
||||
define('ABSPATH', dirname(__FILE__) . '/');
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
||||
8
wp/wp-content/mu-plugins/disable-plugin-updates.php
Normal file
8
wp/wp-content/mu-plugins/disable-plugin-updates.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Disable Plugin Updates
|
||||
Description: Disable automatic updates for plugins.
|
||||
*/
|
||||
|
||||
add_filter('auto_update_plugin', '__return_false');
|
||||
add_filter('auto_update_theme', '__return_false' );
|
||||
132
wp/wp-content/plugins/visual-web-optimizer/readme.txt
Normal file
132
wp/wp-content/plugins/visual-web-optimizer/readme.txt
Normal file
@@ -0,0 +1,132 @@
|
||||
=== Visual Website Optimizer ===
|
||||
Contributors: VWO
|
||||
Plugin Name: VWO
|
||||
Plugin URI: https://vwo.com/
|
||||
Tags: split testing, analytics, stats, visual web optimizer, vwo, cro
|
||||
Requires at least: 2.7
|
||||
Tested up to: 6.4.1
|
||||
Stable tag: 4.1
|
||||
|
||||
VWO is the all-in-one platform that helps you conduct visitor research, build an optimization roadmap, and run continuous experimentation.
|
||||
|
||||
== Description ==
|
||||
This plugin will allow you to automatically insert the VWO tracking code. Just enter your VWO Account ID from https://app.vwo.com/#/settings
|
||||
|
||||
== Installation ==
|
||||
Wordpress : Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
|
||||
|
||||
WordpressMu : Same as above
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
= I can't see any code added to my header or footer when I view my page source =
|
||||
Your theme needs to have the header and footer actions in place before the `</head>` and before the `</body>`
|
||||
|
||||
= If I use this plugin, do I need to enter any other code on my website? =
|
||||
No, this plugin is sufficient by itself
|
||||
|
||||
== Screenshots ==
|
||||
1. Settings page (Asynchronous Code)
|
||||
2. Settings page (Synchronous Code)
|
||||
|
||||
== ChangeLog ==
|
||||
= 4.1 =
|
||||
* Tested with latest version
|
||||
* PHPCS Errors resolved
|
||||
* WP Rocket support added
|
||||
|
||||
= 4.0 =
|
||||
* Tested with latest version
|
||||
* VWO SmartCode updated
|
||||
|
||||
= 3.9 =
|
||||
* Tested with latest version
|
||||
* Code improvement and add Rocket loader handling
|
||||
|
||||
= 3.8 =
|
||||
* Tested with latest version
|
||||
* Fix WP Rocket Issue
|
||||
|
||||
= 3.7 =
|
||||
* Tested with latest version
|
||||
* Fix Divi Frontend Editor Issue
|
||||
|
||||
= 3.6 =
|
||||
* Tested with latest version
|
||||
|
||||
= 3.5 =
|
||||
* Tested with latest version
|
||||
* Rename label "Handle Rocket Loader Issue" to "Skip Deferred Execution"
|
||||
* Set field default value of "Skip Deferred Execution" to "yes"
|
||||
|
||||
= 3.4 =
|
||||
* Tested with latest version
|
||||
* Code improvement and add Rocket loader handling
|
||||
|
||||
= 3.3 =
|
||||
* Tested with latest version
|
||||
* Add new options in settings
|
||||
|
||||
= 3.2 =
|
||||
* Tested with latest version
|
||||
|
||||
= 3.1 =
|
||||
* Add Setting link in plugin listing page
|
||||
|
||||
= 3.0 =
|
||||
* Update Logo and links
|
||||
|
||||
= 2.9 =
|
||||
* Tested with latest version
|
||||
|
||||
= 2.8 =
|
||||
* Tested with latest version
|
||||
|
||||
= 2.7 =
|
||||
* Update Plugin Name, Author and Description
|
||||
|
||||
= 2.6 =
|
||||
* Remove Conflict Errors
|
||||
|
||||
= 2.5 =
|
||||
* Update tested upto version
|
||||
|
||||
= 2.4 =
|
||||
* Update links
|
||||
|
||||
= 2.3 =
|
||||
* Minor bug fix
|
||||
|
||||
= 2.2 =
|
||||
* Bug fix to have default tolerance values when plugin is updated
|
||||
|
||||
= 2.1 =
|
||||
* Better documentation
|
||||
|
||||
= 2.0 =
|
||||
* Option to choose between asynchronous or synchronous code
|
||||
* Updated code snippet
|
||||
* Faster website loading
|
||||
|
||||
= 1.3 =
|
||||
* code snippet updated
|
||||
|
||||
= 1.0.1 =
|
||||
* use Website instead of Web in name of functions and readme (branding)
|
||||
|
||||
= 1.0 =
|
||||
* First Version
|
||||
|
||||
== Upgrade Notice ==
|
||||
Option to choose the new asynchronous code. This will make the website load faster
|
||||
|
||||
== Configuration ==
|
||||
|
||||
Enter your ID in the field marked 'YOUR VWO ACCOUNT ID'
|
||||
|
||||
== Adding to your template ==
|
||||
|
||||
header code :
|
||||
`<?php wp_head();?>`
|
||||
|
||||
footer code :
|
||||
`<?php wp_footer();?>`
|
||||
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Plugin Name: VWO
|
||||
* Plugin URI: https://vwo.com/
|
||||
* Description: VWO is the all-in-one platform that helps you conduct visitor research, build an optimization roadmap, and run continuous experimentation. Simply enable the plugin and start running tests on your WordPress website without doing any other code changes. Visit <a href="https://vwo.com/">VWO</a> for more details.
|
||||
* Author: VWO
|
||||
* Version: 4.1
|
||||
* visual-website-optimizer.php
|
||||
* Author URI: https://vwo.com/
|
||||
*
|
||||
* @package VWO
|
||||
* @author VWO
|
||||
* @version 4.1
|
||||
**/
|
||||
|
||||
/**
|
||||
* Generate Common Code
|
||||
*
|
||||
* @param integer $vwo_clicks integer. Defaults to 10.
|
||||
*/
|
||||
function get_vwo_clhf_script_common_code( $vwo_clicks = 10 ) {
|
||||
ob_start();
|
||||
// @codingStandardsIgnoreStart
|
||||
?>
|
||||
<!-- Start VWO Common Smartcode -->
|
||||
<script <?php echo vwo_clhf_ignore_js_attr(); ?> type='text/javascript'>
|
||||
var _vwo_clicks = <?php echo esc_html( $vwo_clicks ); ?>;
|
||||
</script>
|
||||
<!-- End VWO Common Smartcode -->
|
||||
<?php
|
||||
// @codingStandardsIgnoreEnd
|
||||
$script_code = ob_get_clean();
|
||||
return $script_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ignore js field setting
|
||||
*
|
||||
* @return bool boolean
|
||||
*/
|
||||
function get_vwo_clhf_ignore_js() {
|
||||
$ignore_js = get_option( 'ignore_js' );
|
||||
$ignore_js = ( '1' === $ignore_js ) ? true : false;
|
||||
return $ignore_js;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ignore js script attribute value
|
||||
*
|
||||
* @return string Returns script attribute value
|
||||
*/
|
||||
function vwo_clhf_ignore_js_attr() {
|
||||
$ignore_js = get_vwo_clhf_ignore_js();
|
||||
$js_attr = '';
|
||||
if ( function_exists( 'get_vwo_clhf_ignore_js' ) && $ignore_js ) {
|
||||
$js_attr = 'data-cfasync="false" nowprocket';
|
||||
}
|
||||
return $js_attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Synchronous Code
|
||||
*
|
||||
* @param int $vwo_id integer. Defaults to 0.
|
||||
* @return string string for sync script.
|
||||
*/
|
||||
function get_vwo_clhf_script_sync_code( $vwo_id = 0 ) {
|
||||
ob_start();
|
||||
// @codingStandardsIgnoreStart
|
||||
?>
|
||||
<!-- Start VWO Smartcode -->
|
||||
<script <?php echo vwo_clhf_ignore_js_attr(); ?> src="https://dev.visualwebsiteoptimizer.com/lib/<?php echo esc_html( $vwo_id ); ?>.js"></script>
|
||||
<!-- End VWO Smartcode -->
|
||||
<?php
|
||||
// @codingStandardsIgnoreEnd
|
||||
$sync_script = ob_get_clean();
|
||||
return $sync_script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Asynchronous Code
|
||||
*
|
||||
* @param int $vwo_id integer.
|
||||
* @param int $settings_tolerance integer.
|
||||
* @param int $library_tolerance integer.
|
||||
* @param bool $use_existing_jquery boolean.
|
||||
* @return string String for async script.
|
||||
*/
|
||||
function get_vwo_clhf_script_async_code( $vwo_id, $settings_tolerance, $library_tolerance, $use_existing_jquery ) {
|
||||
ob_start();
|
||||
// @codingStandardsIgnoreStart
|
||||
?>
|
||||
<!-- Start VWO Async SmartCode -->
|
||||
<link rel="preconnect" href="https://dev.visualwebsiteoptimizer.com" />
|
||||
<script <?php echo vwo_clhf_ignore_js_attr(); ?> type='text/javascript' id='vwoCode'>
|
||||
/* Fix: wp-rocket (application/ld+json) */
|
||||
window._vwo_code || (function() {
|
||||
var account_id= <?php echo esc_html( $vwo_id ); ?>,
|
||||
version = 2.0,
|
||||
settings_tolerance= <?php echo esc_html( $settings_tolerance ); ?>,
|
||||
library_tolerance= <?php echo esc_html( $library_tolerance ); ?>,
|
||||
use_existing_jquery= <?php echo ( $use_existing_jquery ) ? 'true' : 'false'; ?>,
|
||||
hide_element='body',
|
||||
hide_element_style = 'opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important',
|
||||
/* DO NOT EDIT BELOW THIS LINE */
|
||||
f=false,w=window,d=document,v=d.querySelector('#vwoCode'),cK='_vwo_'+account_id+'_settings',cc={};try{var c=JSON.parse(localStorage.getItem('_vwo_'+account_id+'_config'));cc=c&&typeof c==='object'?c:{}}catch(e){}var stT=cc.stT==='session'?w.sessionStorage:w.localStorage;code={use_existing_jquery:function(){return typeof use_existing_jquery!=='undefined'?use_existing_jquery:undefined},library_tolerance:function(){return typeof library_tolerance!=='undefined'?library_tolerance:undefined},settings_tolerance:function(){return cc.sT||settings_tolerance},hide_element_style:function(){return'{'+(cc.hES||hide_element_style)+'}'},hide_element:function(){return typeof cc.hE==='string'?cc.hE:hide_element},getVersion:function(){return version},finish:function(){if(!f){f=true;var e=d.getElementById('_vis_opt_path_hides');if(e)e.parentNode.removeChild(e)}},finished:function(){return f},load:function(e){var t=this.getSettings(),n=d.createElement('script'),i=this;if(t){n.textContent=t;d.getElementsByTagName('head')[0].appendChild(n);if(!w.VWO||VWO.caE){stT.removeItem(cK);i.load(e)}}else{n.fetchPriority='high';n.src=e;n.type='text/javascript';n.onerror=function(){_vwo_code.finish()};d.getElementsByTagName('head')[0].appendChild(n)}},getSettings:function(){try{var e=stT.getItem(cK);if(!e){return}e=JSON.parse(e);if(Date.now()>e.e){stT.removeItem(cK);return}return e.s}catch(e){return}},init:function(){if(d.URL.indexOf('__vwo_disable__')>-1)return;var e=this.settings_tolerance();w._vwo_settings_timer=setTimeout(function(){_vwo_code.finish();stT.removeItem(cK)},e);var t=d.currentScript,n=d.createElement('style'),i=this.hide_element(),r=t&&!t.async&&i?i+this.hide_element_style():'',c=d.getElementsByTagName('head')[0];n.setAttribute('id','_vis_opt_path_hides');v&&n.setAttribute('nonce',v.nonce);n.setAttribute('type','text/css');if(n.styleSheet)n.styleSheet.cssText=r;else n.appendChild(d.createTextNode(r));c.appendChild(n);this.load('https://dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&vn='+version)}};w._vwo_code=code;code.init();})();
|
||||
</script>
|
||||
<!-- End VWO Async SmartCode -->
|
||||
<?php
|
||||
// @codingStandardsIgnoreEnd
|
||||
$async_script = ob_get_clean();
|
||||
return $async_script;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------//
|
||||
// ---Hook-----------------------------------------------------------------//
|
||||
// ------------------------------------------------------------------------//
|
||||
add_action( 'wp_head', 'vwo_clhf_headercode', 1 );
|
||||
add_action( 'admin_menu', 'vwo_clhf_plugin_menu' );
|
||||
add_action( 'admin_init', 'vwo_clhf_register_mysettings' );
|
||||
add_action( 'admin_notices', 'vwo_clhf_warn_nosettings' );
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------//
|
||||
// ---Functions------------------------------------------------------------//
|
||||
// ------------------------------------------------------------------------//
|
||||
// options page link
|
||||
|
||||
/**
|
||||
* Generate a function comment for the given function body.
|
||||
*
|
||||
* @throws Exception Description of exception.
|
||||
* @return void
|
||||
*/
|
||||
function vwo_clhf_plugin_menu() {
|
||||
add_options_page( 'Visual Website Optimizer', 'VWO', 'create_users', 'clhf_vwo_options', 'vwo_clhf_plugin_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the settings for the VWO options.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function vwo_clhf_register_mysettings() {
|
||||
register_setting( 'clhf_vwo_options', 'vwo_id', 'intval' );
|
||||
register_setting( 'clhf_vwo_options', 'code_type' );
|
||||
register_setting( 'clhf_vwo_options', 'vwo_clicks' );
|
||||
register_setting( 'clhf_vwo_options', 'ignore_js', 'boolval' );
|
||||
register_setting( 'clhf_vwo_options', 'settings_tolerance', 'intval' );
|
||||
register_setting( 'clhf_vwo_options', 'library_tolerance', 'intval' );
|
||||
register_setting( 'clhf_vwo_options', 'use_existing_jquery', 'boolval' );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------//
|
||||
// ---Output Functions-----------------------------------------------------//
|
||||
// ------------------------------------------------------------------------//
|
||||
|
||||
|
||||
/**
|
||||
* Generates the action vwo_clhf_headercode function.
|
||||
*
|
||||
* @throws Exception Description of exception.
|
||||
* @return void
|
||||
*/
|
||||
function vwo_clhf_headercode() {
|
||||
// Runs in the header.
|
||||
$vwo_id = get_option( 'vwo_id' );
|
||||
$code_type = get_option( 'code_type' );
|
||||
|
||||
if ( $vwo_id ) {
|
||||
if ( empty( get_option( 'vwo_clicks' ) ) ) {
|
||||
update_option( 'vwo_clicks', '10' );
|
||||
}
|
||||
$vwo_clicks = get_option( 'vwo_clicks' );
|
||||
|
||||
// Common script code.
|
||||
// @codingStandardsIgnoreLine
|
||||
echo get_vwo_clhf_script_common_code( $vwo_clicks );
|
||||
|
||||
if ( 'SYNC' === $code_type ) {
|
||||
// Sync script code.
|
||||
// @codingStandardsIgnoreLine
|
||||
echo get_vwo_clhf_script_sync_code( $vwo_id );
|
||||
} else {
|
||||
|
||||
$settings_tolerance = get_option( 'settings_tolerance' );
|
||||
if ( ! is_numeric( $settings_tolerance ) ) {
|
||||
$settings_tolerance = 2000;
|
||||
}
|
||||
|
||||
$library_tolerance = get_option( 'library_tolerance' );
|
||||
if ( ! is_numeric( $library_tolerance ) ) {
|
||||
$library_tolerance = 2500;
|
||||
}
|
||||
|
||||
$use_existing_jquery = get_option( 'use_existing_jquery' );
|
||||
$use_existing_jquery = ( '1' === $use_existing_jquery ) ? true : false;
|
||||
|
||||
// Async script code.
|
||||
// @codingStandardsIgnoreLine
|
||||
echo get_vwo_clhf_script_async_code( $vwo_id, $settings_tolerance, $library_tolerance, $use_existing_jquery );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------//
|
||||
// ---Page Output Functions------------------------------------------------//
|
||||
// ------------------------------------------------------------------------//
|
||||
// options page
|
||||
|
||||
|
||||
/**
|
||||
* Generates the options page for the VWO plugin.
|
||||
*
|
||||
* @throws Exception Description of exception.
|
||||
* @return void
|
||||
*/
|
||||
function vwo_clhf_plugin_options() {
|
||||
// Set value for checkbox by default.
|
||||
$ignore_js_options = get_option( 'ignore_js' );
|
||||
$show_ignore_js = $ignore_js_options;
|
||||
if ( false === $ignore_js_options ) {
|
||||
// Nothing is set, so apply the default here.
|
||||
$show_ignore_js = 1;
|
||||
update_option( 'ignore_js', '1' );
|
||||
}
|
||||
|
||||
echo '<div class="wrap">';
|
||||
?>
|
||||
<h2>VWO</h2>
|
||||
<p>You need to have a <a href="https://vwo.com/">VWO</a> account in order to use this plugin. This plugin inserts the neccessary code into your WordPress site automatically without you having to touch anything. In order to use the plugin, you need to enter your VWO Account ID:</p>
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields( 'clhf_vwo_options' ); ?>
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th scope="row">Your VWO Account ID</th>
|
||||
<td><input type="text" name="vwo_id" value="<?php echo esc_html( get_option( 'vwo_id' ) ); ?>" /></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row">No. of Heatmap Clicks</th>
|
||||
<td><input type="number" name="vwo_clicks" value="<?php echo get_option( 'vwo_clicks' ) ? esc_html( get_option( 'vwo_clicks' ) ) : 10; ?>" min="3"/></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row">Code (default: Asynchronous)</th>
|
||||
<td>
|
||||
<input style="vertical-align: text-top;" type="radio" onclick="selectCodeType();" name="code_type" id="code_type_async" value="ASYNC"
|
||||
<?php
|
||||
if ( get_option( 'code_type' ) !== 'SYNC' ) {
|
||||
echo 'checked';}
|
||||
?>
|
||||
/> Asynchronous
|
||||
<input style="vertical-align: text-top;" type="radio" onclick="selectCodeType();" name="code_type" id="code_type_sync" value="SYNC"
|
||||
<?php
|
||||
if ( get_option( 'code_type' ) === 'SYNC' ) {
|
||||
echo 'checked';}
|
||||
?>
|
||||
/> Synchronous
|
||||
<a href="https://vwo.com/blog/asynchronous-code" target="_blank">[Help]</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" id='asyncOnly1'
|
||||
<?php
|
||||
if ( get_option( 'code_type' ) === 'SYNC' ) {
|
||||
echo "style='display:none;'";}
|
||||
?>
|
||||
>
|
||||
<th scope="row">Settings Timeout</th>
|
||||
<td style="vertical-align: middle;"><input type="text" name="settings_tolerance" value="<?php echo get_option( 'settings_tolerance' ) ? esc_html( get_option( 'settings_tolerance' ) ) : 2000; ?>" />ms (default: 2000)</td>
|
||||
</tr>
|
||||
<tr valign="top" id='asyncOnly2'
|
||||
<?php
|
||||
if ( get_option( 'code_type' ) === 'SYNC' ) {
|
||||
echo "style='display:none;'";}
|
||||
?>
|
||||
>
|
||||
<th scope="row">Library Timeout</th>
|
||||
<td style="vertical-align: middle;"><input type="text" name="library_tolerance" value="<?php echo get_option( 'library_tolerance' ) ? esc_html( get_option( 'library_tolerance' ) ) : 2500; ?>" />ms (default: 2500)</td>
|
||||
</tr>
|
||||
<tr valign="top" id='asyncOnly3'
|
||||
<?php
|
||||
if ( get_option( 'code_type' ) === 'SYNC' ) {
|
||||
echo "style='display:none;'";}
|
||||
?>
|
||||
>
|
||||
<th scope="row">Use Existing jQuery</th>
|
||||
<td style="vertical-align: middle;"><input type="checkbox" name="use_existing_jquery" value="1"
|
||||
<?php
|
||||
if ( get_option( 'use_existing_jquery' ) === '1' ) {
|
||||
echo 'checked';}
|
||||
?>
|
||||
/>Yes</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row">Skip Deferred Execution</th>
|
||||
<td style="vertical-align: middle;"><input type="checkbox" name="ignore_js" value="1"
|
||||
<?php
|
||||
if ( '1' === $show_ignore_js ) {
|
||||
echo 'checked';}
|
||||
?>
|
||||
/>Yes</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
function selectCodeType() {
|
||||
var code_type = 'ASYNC';
|
||||
if(document.getElementById('code_type_sync').checked)
|
||||
code_type = 'SYNC';
|
||||
|
||||
if(code_type == 'ASYNC') {
|
||||
document.getElementById('asyncOnly1').style.display = 'table-row';
|
||||
document.getElementById('asyncOnly2').style.display = 'table-row';
|
||||
document.getElementById('asyncOnly3').style.display = 'table-row';
|
||||
}
|
||||
else {
|
||||
document.getElementById('asyncOnly1').style.display = 'none';
|
||||
document.getElementById('asyncOnly2').style.display = 'none';
|
||||
document.getElementById('asyncOnly3').style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<p class="submit"><input type="submit" class="button-primary" value="<?php echo esc_html( 'Save Changes' ); ?>" /></p>
|
||||
<p>Your Account ID (a number) can be found in <i>Settings</i> area (top-right) after you <a href="https://app.vwo.com">login</a> into your VWO account.</p>
|
||||
<?php
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a warning message if VWO settings are not configured.
|
||||
* This function checks if the user is an admin and if the VWO ID option is set. If the user is not an admin or
|
||||
* the VWO ID option is not set, it displays a warning message.
|
||||
*
|
||||
* @throws Exception Description of exception.
|
||||
* @return void
|
||||
*/
|
||||
function vwo_clhf_warn_nosettings() {
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$clhf_option = get_option( 'vwo_id' );
|
||||
if ( ! $clhf_option || $clhf_option < 1 ) {
|
||||
echo "<div id='vwo-warning' class='updated fade'><p><strong>VWO is almost ready.</strong> You must <a href=\"options-general.php?page=clhf_vwo_options\">enter your Account ID</a> for it to work.</p></div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'vwo_clhf_add_plugin_page_settings_link' );
|
||||
|
||||
/**
|
||||
* Function to add Settings Links on Plugin page
|
||||
*
|
||||
* @param array $links Array of links.
|
||||
* @return array
|
||||
*/
|
||||
function vwo_clhf_add_plugin_page_settings_link( $links ) {
|
||||
$links[] = '<a href="' .
|
||||
admin_url( 'options-general.php?page=clhf_vwo_options' ) .
|
||||
'">' . __( 'Settings' ) . '</a>';
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables VWO in Divi Builder.
|
||||
*
|
||||
* @throws Exception Description of exception.
|
||||
* @return void
|
||||
*/
|
||||
function disable_vwo_in_divi_builder() {
|
||||
if ( has_action( 'wp_head', 'vwo_clhf_headercode' ) && function_exists( 'et_core_is_fb_enabled' ) && et_core_is_fb_enabled() ) {
|
||||
remove_action( 'wp_head', 'vwo_clhf_headercode', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_head', 'disable_vwo_in_divi_builder', 0 );
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user