/** * * * @param Config $config * @return array */ public function w3tc_notes($notes) { $config = Dispatcher::config(); $state = Dispatcher::config_state(); $page = Util_Request::get_string('page'); if (!Cdn_Util::is_engine_mirror($config->get_string('cdn.engine'))) { /** * Show notification after theme change */ if ($state->get_boolean('cdn.show_note_theme_changed')) { $notes['cdn_theme_changed'] = sprintf(__('The active theme has changed, please %s now to ensure proper operation. %s', 'w3-total-cache'), Util_Ui::button_popup(__('upload active theme files', 'w3-total-cache'), 'cdn_export', 'cdn_export_type=theme'), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.show_note_theme_changed', 'value' => 'false'))); } /** * Show notification after WP upgrade */ if ($state->get_boolean('cdn.show_note_wp_upgraded')) { $notes['cdn_wp_upgraded'] = sprintf(__('Upgraded WordPress? Please %s files now to ensure proper operation. %s', 'w3-total-cache'), Util_Ui::button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.show_note_wp_upgraded', 'value' => 'false'))); } /** * Show notification after CDN enable */ if ($state->get_boolean('cdn.show_note_cdn_upload') || $state->get_boolean('cdn.show_note_cdn_reupload')) { $cdn_upload_buttons = array(); if ($config->get_boolean('cdn.includes.enable')) { $cdn_upload_buttons[] = Util_Ui::button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes'); } if ($config->get_boolean('cdn.theme.enable')) { $cdn_upload_buttons[] = Util_Ui::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[] = Util_Ui::button_popup('minify files', 'cdn_export', 'cdn_export_type=minify'); } if ($config->get_boolean('cdn.custom.enable')) { $cdn_upload_buttons[] = Util_Ui::button_popup('custom files', 'cdn_export', 'cdn_export_type=custom'); } if ($state->get_boolean('cdn.show_note_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'), Util_Ui::button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.show_note_cdn_upload', 'value' => 'false'))); } if ($state->get_boolean('cdn.show_note_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'), Util_Ui::button_popup(__('export the media library', 'w3-total-cache'), 'cdn_export_library'), implode(', ', $cdn_upload_buttons), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.show_note_cdn_reupload', 'value' => 'false'))); } } } if (in_array($config->get_string('cdn.engine'), array('netdna', 'maxcdn')) && !$state->get_boolean('cdn.hide_note_maxcdn_whitelist_ip') && $state->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'], Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.hide_note_maxcdn_whitelist_ip', 'value' => 'true'))); } /** * Check CURL extension */ if (!$state->get_boolean('cdn.hide_note_no_curl') && !function_exists('curl_init')) { $notes[] = sprintf(__('The <strong>CURL PHP</strong> extension is not available. Please install it to enable S3 or CloudFront functionality. %s', 'w3-total-cache'), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'cdn.hide_note_no_curl', 'value' => 'true'))); } return $notes; }
function w3tc_notes($notes) { $config = Dispatcher::config(); $settings = get_option('icl_sitepress_settings'); if ($config->get_boolean('pgcache.enabled') && $config->get_string('pgcache.engine') == 'file_generic' && isset($settings['language_negotiation_type']) && $settings['language_negotiation_type'] == 3) { $state = Dispatcher::config_state(); if (!$state->get_boolean('wpml.hide_note_language_negotiation_type')) { $notes[] = sprintf(__('W3 Total Cache\'s Page caching cannot work effectively when WPML Language URL formatis "Language name added as a parameter" used. Please consider another URL format. Visit the WPML -> Languages settings. %s', 'w3-total-cache'), Util_Ui::button_hide_note2(array('w3tc_default_config_state' => 'y', 'key' => 'wpml.hide_note_language_negotiation_type', 'value' => 'true'))); } } return $notes; }
function w3tc_errors($errors) { $c = Dispatcher::config(); $state = Dispatcher::config_state_master(); /** * Minify error occured */ if ($state->get_boolean('minify.show_note_minify_error')) { $errors['minify_error_creating'] = sprintf(__('Recently an error occurred while creating the CSS / JS minify cache: %s. %s', 'w3-total-cache'), $state->get_string('minify.error.last'), Util_Ui::button_hide_note2(array('w3tc_default_config_state_master' => 'y', 'key' => 'minify.show_note_minify_error', 'value' => 'false'))); } if ($c->get_string('minify.engine') == 'memcached') { $memcached_servers = $c->get_array('minify.memcached.servers'); if (!Util_Installed::is_memcache_available($memcached_servers)) { if (!isset($errors['memcache_not_responding.details'])) { $errors['memcache_not_responding.details'] = array(); } $errors['memcache_not_responding.details'][] = sprintf(__('Minify: %s.', 'w3-total-cache'), implode(', ', $memcached_servers)); } } return $errors; }
public function w3tc_errors($errors) { $state = Dispatcher::config_state(); $c = Dispatcher::config(); /** * Check permalinks */ if (!$state->get_boolean('common.hide_note_no_permalink_rules') && ($c->get_boolean('pgcache.enabled') && $c->get_string('pgcache.engine') == 'file_generic' || $c->get_boolean('browsercache.enabled') && $c->get_boolean('browsercache.no404wp')) && !Util_Rule::is_permalink_rules()) { $errors['generic_no_permalinks'] = sprintf(__('The required directives for fancy permalinks could not be detected, please confirm they are available: <a href="http://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29">Creating and editing</a> %s', 'w3-total-cache'), Util_Ui::button_hide_note2(array('w3tc_default_config_state_master' => 'y', 'key' => 'common.hide_note_no_permalink_rules', 'value' => 'true'))); } /** * Check memcached */ if (isset($errors['memcache_not_responding.details'])) { $memcache_error = __('The following memcached servers are not responding or not running:</p><ul>', 'w3-total-cache'); foreach ($errors['memcache_not_responding.details'] as $memcaches_error) { $memcache_error .= '<li>' . $memcaches_error . '</li>'; } $memcache_error .= __('</ul><p>This message will automatically disappear once the issue is resolved.', 'w3-total-cache'); $errors['memcache_not_responding'] = $memcache_error; unset($errors['memcache_not_responding.details']); } return $errors; }