Beispiel #1
0
 /**
  * @param W3_Config $config
  * @param W3_ConfigAdmin|null $config_admin
  * @return array
  */
 function notifications($config, $config_admin)
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $page = W3_Request::get_string('page');
     $notes = array();
     if (!w3_is_cdn_mirror($config->get_string('cdn.engine'))) {
         /**
          * Show notification after theme change
          */
         if ($config->get_boolean('notes.theme_changed')) {
             $notes[] = sprintf(__('The active theme has changed, please %s now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup(__('upload active theme files', 'w3-total-cache'), 'cdn_export', 'cdn_export_type=theme'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'theme_changed'));
         }
         /**
          * Show notification after WP upgrade
          */
         if ($config->get_boolean('notes.wp_upgraded')) {
             $notes[] = sprintf(__('Upgraded WordPress? Please %s files now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_upgraded'));
         }
         /**
          * Show notification after CDN enable
          */
         if ($config->get_boolean('notes.cdn_upload') || $config->get_boolean('notes.cdn_reupload')) {
             $cdn_upload_buttons = array();
             if ($config->get_boolean('cdn.includes.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
             }
             if ($config->get_boolean('cdn.theme.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
             }
             if ($config->get_boolean('minify.enabled') && $config->get_boolean('cdn.minify.enable') && !$config->get_boolean('minify.auto')) {
                 $cdn_upload_buttons[] = w3_button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
             }
             if ($config->get_boolean('cdn.custom.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
             }
             if ($config->get_boolean('notes.cdn_upload')) {
                 $notes[] = sprintf(__('Make sure to %s and upload the %s, files to the <acronym title="Content Delivery Network">CDN</acronym> to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note('Hide this message', 'cdn_upload'));
             }
             if ($config->get_boolean('notes.cdn_reupload')) {
                 $notes[] = sprintf(__('Settings that affect Browser Cache settings for files hosted by the CDN have been changed. To apply the new settings %s and %s. %s', 'w3-total-cache'), w3_button_popup(__('export the media library', 'w3-total-cache'), 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'cdn_reupload'));
             }
         }
     }
     if (in_array($config->get_string('cdn.engine'), array('netdna', 'maxcdn')) && $config_admin->get_boolean('notes.maxcdn_whitelist_ip') && $config_admin->get_integer('track.maxcdn_authorize') == 0 && $config->get_string('cdn.' . $config->get_string('cdn.engine') . '.authorization_key')) {
         $notes[] = sprintf(__('Make sure to whitelist your servers IPs. Follow the instructions on %s. The IP for this server is %s. %s', 'w3-total-cache'), '<a href="http://support.maxcdn.com/tutorials/how-to-whitelist-your-server-ip-to-use-the-api/">MaxCDN</a>', $_SERVER['SERVER_ADDR'], w3_button_hide_note('Hide this message', 'maxcdn_whitelist_ip', '', true));
     }
     return $notes;
 }
Beispiel #2
0
 /**
  * Returns true if config section is sealed
  * @param string $section
  * @return boolean
  */
 protected function is_sealed($section)
 {
     if ($this->_config->is_master()) {
         return false;
     }
     if (w3_is_network() && !$this->_config->is_master() && w3_force_master()) {
         return true;
     }
     // browsercache settings change rules, so not available in child settings
     if ($section == 'browsercache') {
         return true;
     }
     if ($section == 'minify' && !$this->_config_master->get_boolean('minify.enabled')) {
         return true;
     }
     return $this->_config_admin->get_boolean($section . '.configuration_sealed');
 }
Beispiel #3
0
 /**
  * Prints checkbox with admin config option value
  *
  * @param string $option_id
  * @param boolean $disabled
  */
 protected function checkbox_admin($option_id, $disabled = false)
 {
     if (!$disabled) {
         $disabled = $this->_config->get_boolean('common.force_master');
     }
     $checked = $this->_config_admin->get_boolean($option_id) || $disabled;
     if (!$disabled) {
         echo '<input type="hidden" name="' . $option_id . '" value="0" />';
     }
     echo '<label>';
     $id = str_replace('.', '_', $option_id);
     $class = $disabled ? 'disabled' : 'enabled';
     echo '<input id="' . $id . '" class="' . $class . '" type="checkbox" name="' . $option_id . '" value="1"';
     checked($checked, true);
     if ($disabled) {
         echo ' disabled="disabled"';
     }
     echo ' />';
 }
Beispiel #4
0
 /**
  * Runs minify
  *
  * @param string|null $file
  *
  * @return void
  */
 function process($file = NULL)
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     /**
      * Check for rewrite test request
      */
     $rewrite_test = W3_Request::get_boolean('w3tc_rewrite_test');
     if ($rewrite_test) {
         echo 'OK';
         exit;
     }
     $rewrite_test = W3_Request::get_string('test_file');
     if ($rewrite_test) {
         $cache = $this->_get_cache();
         header('Content-type: text/css');
         if ($cache->store(basename($rewrite_test), 'content ok')) {
             if (function_exists('gzencode') && $this->_config->get_boolean('browsercache.enabled') && $this->_config->get_boolean('browsercache.cssjs.compression')) {
                 if (!$cache->store(basename($rewrite_test) . '.gzip', gzencode('content ok'))) {
                     echo 'error storing';
                     exit;
                 }
             }
             if ($this->_config->get_string('minify.engine') != 'file') {
                 if ($cache->fetch(basename($rewrite_test)) == 'content ok') {
                     echo 'content ok';
                 } else {
                     echo 'error storing';
                 }
             } else {
                 echo 'retry';
             }
         } else {
             echo 'error storing';
         }
         exit;
     }
     if (is_null($file)) {
         $file = W3_Request::get_string('file');
     }
     if (!$file) {
         $this->error('File param is missing', false);
         return;
     }
     // remove blog_id
     $levels = '';
     if (defined('W3TC_BLOG_LEVELS')) {
         for ($n = 0; $n < W3TC_BLOG_LEVELS; $n++) {
             $levels .= '[0-9]+\\/';
         }
     }
     if (preg_match('~^(' . $levels . '[0-9]+)\\/(.+)$~', $file, $matches)) {
         $file = $matches[2];
     }
     // parse file
     $hash = '';
     $matches = null;
     $location = '';
     $type = '';
     if (preg_match('~^' . MINIFY_AUTO_FILENAME_REGEX . '$~', $file, $matches)) {
         list(, $hash, $type) = $matches;
     } elseif (preg_match('~^' . MINIFY_MANUAL_FILENAME_REGEX . '$~', $file, $matches)) {
         list(, $theme, $template, $location, , , $type) = $matches;
     } else {
         $this->error(sprintf('Bad file param format: "%s"', $file), false);
         return;
     }
     w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify.php');
     w3_require_once(W3TC_LIB_MINIFY_DIR . '/HTTP/Encoder.php');
     /**
      * Fix DOCUMENT_ROOT
      */
     $_SERVER['DOCUMENT_ROOT'] = w3_get_document_root();
     /**
      * Set cache engine
      */
     Minify::setCache($this->_get_cache());
     /**
      * Set cache ID
      */
     $cache_id = $this->get_cache_id($file);
     Minify::setCacheId($cache_id);
     /**
      * Set logger
      */
     w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/Logger.php');
     Minify_Logger::setLogger(array(&$this, 'error'));
     /**
      * Set options
      */
     $browsercache = $this->_config->get_boolean('browsercache.enabled');
     $serve_options = array_merge($this->_config->get_array('minify.options'), array('debug' => $this->_config->get_boolean('minify.debug'), 'maxAge' => $this->_config->get_integer('browsercache.cssjs.lifetime'), 'encodeOutput' => $browsercache && $this->_config->get_boolean('browsercache.cssjs.compression'), 'bubbleCssImports' => $this->_config->get_string('minify.css.imports') == 'bubble', 'processCssImports' => $this->_config->get_string('minify.css.imports') == 'process', 'cacheHeaders' => array('use_etag' => $browsercache && $this->_config->get_boolean('browsercache.cssjs.etag'), 'expires_enabled' => $browsercache && $this->_config->get_boolean('browsercache.cssjs.expires'), 'cacheheaders_enabled' => $browsercache && $this->_config->get_boolean('browsercache.cssjs.cache.control'), 'cacheheaders' => $this->_config->get_string('browsercache.cssjs.cache.policy'))));
     /**
      * Set sources
      */
     if ($hash) {
         $_GET['f'] = $this->get_custom_files($hash, $type);
     } else {
         $_GET['g'] = $location;
         $serve_options['minApp']['groups'] = $this->get_groups($theme, $template, $type);
     }
     /**
      * Set minifier
      */
     $w3_minifier = w3_instance('W3_Minifier');
     if ($type == 'js') {
         $minifier_type = 'application/x-javascript';
         switch (true) {
             case ($hash || $location == 'include') && $this->_config->get_boolean('minify.js.combine.header'):
             case $location == 'include-body' && $this->_config->get_boolean('minify.js.combine.body'):
             case $location == 'include-footer' && $this->_config->get_boolean('minify.js.combine.footer'):
                 $engine = 'combinejs';
                 break;
             default:
                 $engine = $this->_config->get_string('minify.js.engine');
                 if (!$w3_minifier->exists($engine) || !$w3_minifier->available($engine)) {
                     $engine = 'js';
                 }
                 break;
         }
     } elseif ($type == 'css') {
         $minifier_type = 'text/css';
         if (($hash || $location == 'include') && $this->_config->get_boolean('minify.css.combine')) {
             $engine = 'combinecss';
         } else {
             $engine = $this->_config->get_string('minify.css.engine');
             if (!$w3_minifier->exists($engine) || !$w3_minifier->available($engine)) {
                 $engine = 'css';
             }
         }
     }
     /**
      * Initialize minifier
      */
     $w3_minifier->init($engine);
     $serve_options['minifiers'][$minifier_type] = $w3_minifier->get_minifier($engine);
     $serve_options['minifierOptions'][$minifier_type] = $w3_minifier->get_options($engine);
     /**
      * Send X-Powered-By header
      */
     if ($browsercache && $this->_config->get_boolean('browsercache.cssjs.w3tc')) {
         @header('X-Powered-By: ' . W3TC_POWERED_BY);
     }
     /**
      * Minify!
      */
     try {
         Minify::serve('MinApp', $serve_options);
     } catch (Exception $exception) {
         $this->error($exception->getMessage());
     }
     if (!$this->_error_occurred && $this->_config_admin->get_boolean('notes.minify_error')) {
         $error_file = $this->_config_admin->get_string('minify.error.file');
         if ($error_file == $file) {
             $this->_config_admin->set('notes.minify_error', false);
             $this->_config_admin->save();
         }
     }
 }
 /**
  * Admin notices action
  *
  * @return void
  */
 function admin_notices()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
     $cookie_domain = w3_get_cookie_domain();
     $error_messages = array('fancy_permalinks_disabled_pgcache' => sprintf(__('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling enhanced disk mode.', 'w3-total-cache'), w3_button_link('enable', 'options-permalink.php')), 'fancy_permalinks_disabled_browsercache' => sprintf(__('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling the \'Do not process 404 errors for static objects with WordPress\'.', 'w3-total-cache'), w3_button_link('enable', 'options-permalink.php')), 'support_request_type' => __('Please select request type.', 'w3-total-cache'), 'support_request_url' => __('Please enter the address of the site in the site <acronym title="Uniform Resource Locator">URL</acronym> field.', 'w3-total-cache'), 'support_request_name' => __('Please enter your name in the Name field', 'w3-total-cache'), 'support_request_email' => __('Please enter valid email address in the E-Mail field.', 'w3-total-cache'), 'support_request_phone' => __('Please enter your phone in the phone field.', 'w3-total-cache'), 'support_request_subject' => __('Please enter subject in the subject field.', 'w3-total-cache'), 'support_request_description' => __('Please describe the issue in the issue description field.', 'w3-total-cache'), 'support_request_wp_login' => __('Please enter an administrator login. Create a temporary one just for this support case if needed.', 'w3-total-cache'), 'support_request_wp_password' => __('Please enter WP Admin password, be sure it\'s spelled correctly.', 'w3-total-cache'), 'support_request_ftp_host' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> host for the site.', 'w3-total-cache'), 'support_request_ftp_login' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> login for the server. Create a temporary one just for this support case if needed.', 'w3-total-cache'), 'support_request_ftp_password' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> password for the <acronym title="File Transfer Protocol">FTP</acronym> account.', 'w3-total-cache'), 'support_request' => __('Unable to send the support request.', 'w3-total-cache'), 'config_import_no_file' => __('Please select config file.', 'w3-total-cache'), 'config_import_upload' => __('Unable to upload config file.', 'w3-total-cache'), 'config_import_import' => __('Configuration file could not be imported.', 'w3-total-cache'), 'config_reset' => sprintf(__('Default settings could not be restored. Please run <strong>chmod 777 %s</strong> to make the configuration file write-able, then try again.', 'w3-total-cache'), W3TC_CONFIG_DIR), 'cdn_purge_attachment' => __('Unable to purge attachment.', 'w3-total-cache'), 'pgcache_purge_post' => __('Unable to purge post.', 'w3-total-cache'), 'pgcache_purge_page' => __('Unable to purge page.', 'w3-total-cache'), 'enable_cookie_domain' => sprintf(__('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'COOKIE_DOMAIN\', \'%s\');</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong>.', 'w3-total-cache'), ABSPATH, addslashes($cookie_domain)), 'disable_cookie_domain' => sprintf(__('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'COOKIE_DOMAIN\', false);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong>.', 'w3-total-cache'), ABSPATH), 'cloudflare_api_request' => __('Unable to make CloudFlare API request.', 'w3-total-cache'));
     $note_messages = array('config_save' => __('Plugin configuration successfully updated.', 'w3-total-cache'), 'flush_all' => __('All caches successfully emptied.', 'w3-total-cache'), 'flush_all_except_cf' => __('All caches except CloudFlare successfully emptied.', 'w3-total-cache'), 'flush_memcached' => __('Memcached cache(s) successfully emptied.', 'w3-total-cache'), 'flush_opcode' => __('Opcode cache(s) successfully emptied.', 'w3-total-cache'), 'flush_apc_system' => __('APC system cache successfully emptied', 'w3-total-cache'), 'flush_file' => __('Disk cache(s) successfully emptied.', 'w3-total-cache'), 'flush_pgcache' => __('Page cache successfully emptied.', 'w3-total-cache'), 'flush_dbcache' => __('Database cache successfully emptied.', 'w3-total-cache'), 'flush_objectcache' => __('Object cache successfully emptied.', 'w3-total-cache'), 'flush_fragmentcache' => __('Fragment cache successfully emptied.', 'w3-total-cache'), 'flush_minify' => __('Minify cache successfully emptied.', 'w3-total-cache'), 'flush_browser_cache' => __('Media Query string has been successfully updated.', 'w3-total-cache'), 'flush_varnish' => __('Varnish servers successfully purged.', 'w3-total-cache'), 'flush_cdn' => __('CDN was successfully purged.', 'w3-total-cache'), 'support_request' => __('The support request has been successfully sent.', 'w3-total-cache'), 'config_import' => __('Settings successfully imported.', 'w3-total-cache'), 'config_reset' => __('Settings successfully restored.', 'w3-total-cache'), 'preview_enable' => __('Preview mode was successfully enabled', 'w3-total-cache'), 'preview_disable' => __('Preview mode was successfully disabled', 'w3-total-cache'), 'preview_deploy' => __('Preview settings successfully deployed. Preview mode remains enabled until it\'s disabled. Continue testing new settings or disable preview mode if done.', 'w3-total-cache'), 'cdn_purge_attachment' => __('Attachment successfully purged.', 'w3-total-cache'), 'pgcache_purge_post' => __('Post successfully purged.', 'w3-total-cache'), 'pgcache_purge_page' => __('Page successfully purged.', 'w3-total-cache'), 'new_relic_save' => __('New relic settings have been updated.', 'w3-total-cache'), 'add_in_removed' => __('The add-in has been removed.', 'w3-total-cache'));
     $errors = array();
     $notes = array();
     $environment_error_present = false;
     // print errors happened during last request execution,
     // when we decided to redirect with error message instead of
     // printing it directly (to avoid reexecution on refresh)
     $message_id = W3_Request::get_string('w3tc_message');
     if ($message_id) {
         $v = get_transient('w3tc_message.' . $message_id);
         set_transient('w3tc_message.' . $message_id, null);
         if (isset($v['errors']) && is_array($v['errors'])) {
             foreach ($v['errors'] as $error) {
                 if (isset($error_messages[$error])) {
                     $errors[] = $error_messages[$error];
                 } else {
                     $errors[] = $error;
                 }
             }
         }
         if (isset($v['notes']) && is_array($v['notes'])) {
             foreach ($v['notes'] as $note) {
                 if (isset($note_messages[$note])) {
                     $notes[] = $note_messages[$note];
                 } else {
                     $notes[] = $note;
                 }
             }
         }
     }
     /*
      * Filesystem environment fix, if needed
      */
     try {
         global $pagenow;
         if ($pagenow == 'plugins.php' || substr(W3_Request::get_string('page'), 0, 5) == 'w3tc_') {
             $environment = w3_instance('W3_AdminEnvironment');
             $environment->fix_in_wpadmin($this->_config);
             if (isset($_REQUEST['upgrade'])) {
                 $notes[] = __('Required files and directories have been automatically created', 'w3-total-cache');
             }
         }
     } catch (SelfTestExceptions $exs) {
         $r = w3_parse_selftest_exceptions($exs);
         foreach ($r['before_errors'] as $e) {
             $errors[] = $e;
         }
         if (strlen($r['required_changes']) > 0) {
             $changes_style = 'border: 1px solid black; ' . 'background: white; ' . 'margin: 10px 30px 10px 30px; ' . 'padding: 10px; display: none';
             $ftp_style = 'border: 1px solid black; background: white; ' . 'margin: 10px 30px 10px 30px; ' . 'padding: 10px; display: none';
             $ftp_form = str_replace('class="wrap"', '', $exs->credentials_form());
             $ftp_form = str_replace('<form ', '<form name="w3tc_ftp_form" ', $ftp_form);
             $ftp_form = str_replace('<fieldset>', '', $ftp_form);
             $ftp_form = str_replace('</fieldset>', '', $ftp_form);
             $ftp_form = str_replace('id="upgrade" class="button"', 'id="upgrade" class="button w3tc-button-save"', $ftp_form);
             $error = '<strong>W3 Total Cache Error:</strong> ' . 'Files and directories could not be automatically ' . 'created to complete the installation. ' . '<table>' . '<tr>' . '<td>Please execute commands manually</td>' . '<td>' . w3_button('View required changes', '', 'w3tc-show-required-changes') . '</td>' . '</tr>' . '<tr>' . '<td>or use FTP form to allow ' . '<strong>W3 Total Cache</strong> make it automatically.' . '</td>' . '<td>' . w3_button('Update via FTP', '', 'w3tc-show-ftp-form') . '</td>' . '</tr></table>' . '<div class="w3tc-required-changes" style="' . $changes_style . '">' . $r['required_changes'] . '</div>' . '<div class="w3tc-ftp-form" style="' . $ftp_style . '">' . $ftp_form . '</div>';
             $environment_error_present = true;
             $errors[] = $error;
         }
         foreach ($r['later_errors'] as $e) {
             $errors[] = $e;
         }
     }
     /**
      * CloudFlare notifications
      * @var $w3_cloudflare W3_CloudFlare
      */
     $w3_cloudflare = w3_instance('W3_CloudFlare');
     if ($error = $w3_cloudflare->check_lasterror()) {
         $this->_errors[] = $error;
     }
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $error = W3_Request::get_string('w3tc_error');
     $note = W3_Request::get_string('w3tc_note');
     /**
      * Handle messages from reqeust
      */
     if ($error == 'cloudflare_api_request' && $w3_cloudflare->get_fault_signaled()) {
         // dont complain twice on cloudflare
     } elseif (isset($error_messages[$error])) {
         $errors[] = $error_messages[$error];
     }
     if (isset($note_messages[$note])) {
         $notes[] = $note_messages[$note];
     }
     /**
      * CDN notifications
      */
     if ($this->_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
         /**
          * @var $ui_cdn_notes W3_UI_CdnNotes
          */
         $cdn_notes = w3_instance('W3_UI_CdnNotes');
         $this->_notes = array_merge($this->_notes, $cdn_notes->notifications($this->_config));
         $this->_errors = array_merge($this->_errors, $cdn_notes->errors());
     }
     /**
      * Show notification after plugin activate/deactivate
      */
     if ($this->_config->get_boolean('notes.plugins_updated')) {
         $texts = array();
         if ($this->_config->get_boolean('pgcache.enabled')) {
             $texts[] = w3_button_link(__('empty the page cache', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_pgcache', $this->_page), 'w3tc'));
         }
         if ($this->_config->get_boolean('minify.enabled')) {
             $texts[] = sprintf(__('check the %s to maintain the desired user experience', 'w3-total-cache'), w3_button_hide_note(__('minify settings', 'w3-total-cache'), 'plugins_updated', 'admin.php?page=w3tc_minify'));
         }
         if (count($texts)) {
             $notes[] = sprintf(__('One or more plugins have been activated or deactivated, please %s. %s', 'w3-total-cache'), implode(__(' and ', 'w3-total-cache'), $texts), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'plugins_updated'));
         }
     }
     /**
      * Show notification when page cache needs to be emptied
      */
     if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get('notes.need_empty_pgcache') && !$this->_config->is_preview()) {
         $notes[] = sprintf('The setting change(s) made either invalidate the cached data or modify the behavior of the site. %s now to provide a consistent user experience.', w3_button_link('Empty the page cache', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_pgcache', $this->_page), 'w3tc')));
     }
     /**
      * Show notification when object cache needs to be emptied
      */
     if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get('notes.need_empty_objectcache') && !$this->_config->is_preview()) {
         $notes[] = sprintf(__('The setting change(s) made either invalidate the cached data or modify the behavior of the site. %s now to provide a consistent user experience.', 'w3-total-cache'), w3_button_link(__('Empty the object cache', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_objectcache', $this->_page), 'w3tc')));
     }
     /**
      * Minify notifications
      */
     if ($this->_config->get_boolean('minify.enabled')) {
         /**
          * Minify error occured
          */
         if ($this->_config_admin->get_boolean('notes.minify_error')) {
             $errors[] = sprintf(__('Recently an error occurred while creating the CSS / JS minify cache: %s. %s', 'w3-total-cache'), $this->_config_admin->get_string('minify.error.last'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'minify_error', '', true));
         }
         /**
          * Show notification when minify needs to be emptied
          */
         if ($this->_config->get_boolean('notes.need_empty_minify') && !$this->_config->is_preview()) {
             $notes[] = sprintf(__('The setting change(s) made either invalidate the cached data or modify the behavior of the site. %s now to provide a consistent user experience.', 'w3-total-cache'), w3_button_link(__('Empty the minify cache', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_minify', $this->_page), 'w3tc')));
         }
     }
     if ($this->_config->get_boolean('newrelic.enabled') && $this->_config_admin->get_boolean('notes.new_relic_page_load_notification')) {
         /**
          * @var W3_UI_NewRelicNotes $newrelic_notes
          */
         $newrelic_notes = w3_instance('W3_UI_NewRelicNotes');
         $this->_notes = array_merge($this->_notes, $newrelic_notes->notifications($this->_config));
     }
     /**
      * Show notification if user can remove old w3tc folders
      */
     if ($this->_config_admin->get_boolean('notes.remove_w3tc')) {
         w3_require_once(W3TC_INC_DIR . '/functions/update.php');
         $folders = w3_find_old_folders();
         $folders = array_map('basename', $folders);
         $notes[] = sprintf(__('The directory w3tc can be deleted. %s: %s. However, <em>do not remove the w3tc-config directory</em>. %s', 'w3-total-cache'), WP_CONTENT_DIR, implode(', ', $folders), w3_button_hide_note('Hide this message', 'remove_w3tc', '', true));
     }
     // print errors which happened during current request execution
     foreach ($this->_errors as $error) {
         $errors[] = $error;
     }
     // print notes which happened during current request execution
     foreach ($this->_notes as $note) {
         $notes[] = $note;
     }
     /**
      * Show messages
      */
     foreach ($notes as $note) {
         echo sprintf('<div class="updated fade"><p>%s</p></div>', $note);
     }
     foreach ($errors as $error) {
         echo sprintf('<div class="error"><p>%s</p></div>', $error);
     }
 }
 /**
  * Returns true if config section is sealed
  * @param string $section
  * @param W3_Config $config_master
  * @param W3_ConfigAdmin $config_admin
  * @return boolean
  */
 private function is_sealed($section, $config_master, $config_admin)
 {
     if (w3_get_blog_id() == 0) {
         return false;
     }
     if (w3_is_network() && w3_get_blog_id() != 0 && w3_force_master()) {
         return true;
     }
     // browsercache settings change rules, so not available in child settings
     if ($section == 'browsercache') {
         return true;
     }
     if ($section == 'minify' && !$config_master->get_boolean('minify.enabled')) {
         return true;
     }
     return $config_admin->get_boolean($section . '.configuration_sealed');
 }