PageRenderTime 70ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCacheAdmin.php

https://bitbucket.org/broderboy/nycendurance-wordpress
PHP | 5766 lines | 3630 code | 933 blank | 1203 comment | 819 complexity | 095cd23987932df7138737a51680e544 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-3.0, Apache-2.0, GPL-2.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * W3 Total Cache Admin plugin
  4. */
  5. if (!defined('W3TC')) {
  6. die();
  7. }
  8. define('W3TC_PLUGIN_TOTALCACHE_REGEXP_COOKIEDOMAIN', '~define\s*\(\s*[\'"]COOKIE_DOMAIN[\'"]\s*,.*?\)~is');
  9. require_once W3TC_INC_DIR . '/functions/rule.php';
  10. require_once W3TC_INC_DIR . '/functions/http.php';
  11. require_once W3TC_LIB_W3_DIR . '/Plugin.php';
  12. /**
  13. * Class W3_Plugin_TotalCacheAdmin
  14. */
  15. class W3_Plugin_TotalCacheAdmin extends W3_Plugin {
  16. /**
  17. * Current page
  18. *
  19. * @var string
  20. */
  21. var $_page = 'w3tc_general';
  22. /**
  23. * Notes
  24. *
  25. * @var array
  26. */
  27. var $_notes = array();
  28. /**
  29. * Errors
  30. *
  31. * @var array
  32. */
  33. var $_errors = array();
  34. /**
  35. * Show support reminder flag
  36. *
  37. * @var boolean
  38. */
  39. var $_support_reminder = false;
  40. /**
  41. * Used in PHPMailer init function
  42. *
  43. * @var string
  44. */
  45. var $_phpmailer_sender = '';
  46. /**
  47. * Array of request types
  48. *
  49. * @var array
  50. */
  51. var $_request_types = array(
  52. 'bug_report' => 'Submit a Bug Report',
  53. 'new_feature' => 'Suggest a New Feature',
  54. 'email_support' => 'Less than 15 Minute Email Support Response (M-F 9AM - 5PM EDT): $75 USD',
  55. 'phone_support' => 'Less than 15 Minute Phone Support Response (M-F 9AM - 5PM EDT): $150 USD',
  56. 'plugin_config' => 'Professional Plugin Configuration: Starting @ $100 USD',
  57. 'theme_config' => 'Theme Performance Optimization & Plugin Configuration: Starting @ $150 USD',
  58. 'linux_config' => 'Linux Server Optimization & Plugin Configuration: Starting @ $200 USD'
  59. );
  60. /**
  61. * Array of request groups
  62. *
  63. * @var array
  64. */
  65. var $_request_groups = array(
  66. 'General Support' => array(
  67. 'bug_report',
  68. 'new_feature'
  69. ),
  70. 'Professional Services (per site pricing)' => array(
  71. 'email_support',
  72. 'phone_support',
  73. 'plugin_config',
  74. 'theme_config',
  75. 'linux_config'
  76. )
  77. );
  78. /**
  79. * Request price list
  80. *
  81. * @var array
  82. */
  83. var $_request_prices = array(
  84. 'email_support' => 75,
  85. 'phone_support' => 150,
  86. 'plugin_config' => 100,
  87. 'theme_config' => 150,
  88. 'linux_config' => 200
  89. );
  90. /**
  91. * Runs plugin
  92. *
  93. * @return void
  94. */
  95. function run() {
  96. register_activation_hook(W3TC_FILE, array(
  97. &$this,
  98. 'activate'
  99. ));
  100. register_deactivation_hook(W3TC_FILE, array(
  101. &$this,
  102. 'deactivate'
  103. ));
  104. add_action('admin_init', array(
  105. &$this,
  106. 'admin_init'
  107. ));
  108. add_action('admin_menu', array(
  109. &$this,
  110. 'admin_menu'
  111. ));
  112. add_filter('contextual_help_list', array(
  113. &$this,
  114. 'contextual_help_list'
  115. ));
  116. add_filter('plugin_action_links_' . W3TC_FILE, array(
  117. &$this,
  118. 'plugin_action_links'
  119. ));
  120. add_filter('favorite_actions', array(
  121. &$this,
  122. 'favorite_actions'
  123. ));
  124. add_action('in_plugin_update_message-' . W3TC_FILE, array(
  125. &$this,
  126. 'in_plugin_update_message'
  127. ));
  128. if ($this->_config->get_boolean('widget.latest.enabled') || $this->_config->get_boolean('widget.pagespeed.enabled')) {
  129. add_action('wp_dashboard_setup', array(
  130. &$this,
  131. 'wp_dashboard_setup'
  132. ));
  133. }
  134. if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) {
  135. add_filter('pre_update_option_active_plugins', array(
  136. &$this,
  137. 'pre_update_option_active_plugins'
  138. ));
  139. }
  140. if ($this->_config->get_boolean('cdn.enabled') && w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) {
  141. add_filter('media_row_actions', array(
  142. &$this,
  143. 'media_row_actions'
  144. ), 0, 2);
  145. }
  146. if ($this->_config->get_boolean('pgcache.enabled')) {
  147. add_filter('post_row_actions', array(
  148. &$this,
  149. 'post_row_actions'
  150. ), 0, 2);
  151. add_filter('page_row_actions', array(
  152. &$this,
  153. 'page_row_actions'
  154. ), 0, 2);
  155. }
  156. }
  157. /**
  158. * Activate plugin action
  159. *
  160. * @return void
  161. */
  162. function activate() {
  163. $this->link_update();
  164. }
  165. /**
  166. * Deactivate plugin action
  167. *
  168. * @return void
  169. */
  170. function deactivate() {
  171. $this->link_delete();
  172. }
  173. /**
  174. * Load action
  175. *
  176. * @return void
  177. */
  178. function load() {
  179. require_once W3TC_LIB_W3_DIR . '/Request.php';
  180. $this->_page = W3_Request::get_string('page');
  181. switch (true) {
  182. case ($this->_page == 'w3tc_general'):
  183. case ($this->_page == 'w3tc_pgcache'):
  184. case ($this->_page == 'w3tc_minify' && W3TC_PHP5):
  185. case ($this->_page == 'w3tc_dbcache'):
  186. case ($this->_page == 'w3tc_objectcache'):
  187. case ($this->_page == 'w3tc_browsercache'):
  188. case ($this->_page == 'w3tc_mobile'):
  189. case ($this->_page == 'w3tc_referrer'):
  190. case ($this->_page == 'w3tc_cdn'):
  191. case ($this->_page == 'w3tc_install'):
  192. case ($this->_page == 'w3tc_faq'):
  193. case ($this->_page == 'w3tc_about'):
  194. case ($this->_page == 'w3tc_support'):
  195. break;
  196. default:
  197. $this->_page = 'w3tc_general';
  198. }
  199. $this->_support_reminder = ($this->_config->get_boolean('notes.support_us') && $this->_config->get_integer('common.install') < (time() - W3TC_SUPPORT_US_TIMEOUT) && $this->_config->get_string('common.support') == '' && !$this->_config->get_boolean('common.tweeted'));
  200. /**
  201. * Run plugin action
  202. */
  203. $action = false;
  204. foreach ($_REQUEST as $key => $value) {
  205. if (strpos($key, 'w3tc_') === 0) {
  206. $action = 'action_' . substr($key, 5);
  207. break;
  208. }
  209. }
  210. if ($action && method_exists($this, $action)) {
  211. check_admin_referer('w3tc');
  212. call_user_func(array(
  213. &$this,
  214. $action
  215. ));
  216. exit();
  217. }
  218. }
  219. /**
  220. * Admin init
  221. *
  222. * @return void
  223. */
  224. function admin_init() {
  225. wp_register_style('w3tc-options', plugins_url('pub/css/options.css', W3TC_FILE));
  226. wp_register_style('w3tc-lightbox', plugins_url('pub/css/lightbox.css', W3TC_FILE));
  227. wp_register_style('w3tc-widget', plugins_url('pub/css/widget.css', W3TC_FILE));
  228. wp_register_script('w3tc-metadata', plugins_url('pub/js/metadata.js', W3TC_FILE));
  229. wp_register_script('w3tc-options', plugins_url('pub/js/options.js', W3TC_FILE));
  230. wp_register_script('w3tc-lightbox', plugins_url('pub/js/lightbox.js', W3TC_FILE));
  231. wp_register_script('w3tc-widget', plugins_url('pub/js/widget.js', W3TC_FILE));
  232. }
  233. /**
  234. * Admin menu
  235. *
  236. * @return void
  237. */
  238. function admin_menu() {
  239. $pages = array(
  240. 'w3tc_general' => array(
  241. 'General Settings',
  242. 'General Settings'
  243. ),
  244. 'w3tc_pgcache' => array(
  245. 'Page Cache',
  246. 'Page Cache'
  247. ),
  248. 'w3tc_minify' => array(
  249. 'Minify',
  250. 'Minify'
  251. ),
  252. 'w3tc_dbcache' => array(
  253. 'Database Cache',
  254. 'Database Cache'
  255. ),
  256. 'w3tc_objectcache' => array(
  257. 'Object Cache',
  258. 'Object Cache'
  259. ),
  260. 'w3tc_browsercache' => array(
  261. 'Browser Cache',
  262. 'Browser Cache'
  263. ),
  264. 'w3tc_mobile' => array(
  265. 'User Agent Groups',
  266. 'User Agent Groups'
  267. ),
  268. 'w3tc_referrer' => array(
  269. 'Referrer Groups',
  270. 'Referrer Groups'
  271. ),
  272. 'w3tc_cdn' => array(
  273. 'Content Delivery Network',
  274. '<acronym title="Content Delivery Network">CDN</acronym>'
  275. ),
  276. 'w3tc_faq' => array(
  277. 'FAQ',
  278. 'FAQ'
  279. ),
  280. 'w3tc_support' => array(
  281. 'Support',
  282. '<span style="color: red;">Support</span>'
  283. ),
  284. 'w3tc_install' => array(
  285. 'Install',
  286. 'Install'
  287. ),
  288. 'w3tc_about' => array(
  289. 'About',
  290. 'About'
  291. )
  292. );
  293. if (!W3TC_PHP5) {
  294. unset($pages['w3tc_minify']);
  295. }
  296. add_menu_page('Performance', 'Performance', 'manage_options', 'w3tc_general', '', plugins_url('w3-total-cache/pub/img/logo_small.png'));
  297. $submenu_pages = array();
  298. foreach ($pages as $slug => $titles) {
  299. $submenu_pages[] = add_submenu_page('w3tc_general', $titles[0] . ' | W3 Total Cache', $titles[1], 'manage_options', $slug, array(
  300. &$this,
  301. 'options'
  302. ));
  303. }
  304. if (current_user_can('manage_options')) {
  305. /**
  306. * Only admin can modify W3TC settings
  307. */
  308. foreach ($submenu_pages as $submenu_page) {
  309. add_action('load-' . $submenu_page, array(
  310. &$this,
  311. 'load'
  312. ));
  313. add_action('admin_print_styles-' . $submenu_page, array(
  314. &$this,
  315. 'admin_print_styles'
  316. ));
  317. add_action('admin_print_scripts-' . $submenu_page, array(
  318. &$this,
  319. 'admin_print_scripts'
  320. ));
  321. }
  322. /**
  323. * Only admin can see W3TC notices and errors
  324. */
  325. add_action('admin_notices', array(
  326. &$this,
  327. 'admin_notices'
  328. ));
  329. }
  330. }
  331. /**
  332. * Print styles
  333. *
  334. * @return void
  335. */
  336. function admin_print_styles() {
  337. wp_enqueue_style('w3tc-options');
  338. wp_enqueue_style('w3tc-lightbox');
  339. }
  340. /**
  341. * Print scripts
  342. *
  343. * @return void
  344. */
  345. function admin_print_scripts() {
  346. wp_enqueue_script('w3tc-metadata');
  347. wp_enqueue_script('w3tc-options');
  348. wp_enqueue_script('w3tc-lightbox');
  349. switch ($this->_page) {
  350. case 'w3tc_minify':
  351. case 'w3tc_mobile':
  352. case 'w3tc_referrer':
  353. case 'w3tc_cdn':
  354. wp_enqueue_script('jquery-ui-sortable');
  355. break;
  356. }
  357. }
  358. /**
  359. * Contextual help list filter
  360. *
  361. * @param string $list
  362. * @return string
  363. */
  364. function contextual_help_list($list) {
  365. $faq = $this->parse_faq();
  366. if (isset($faq['Usage'])) {
  367. $columns = array_chunk($faq['Usage'], ceil(count($faq['Usage']) / 3));
  368. ob_start();
  369. include W3TC_INC_DIR . '/options/common/help.php';
  370. $help = ob_get_contents();
  371. ob_end_clean();
  372. $hook = get_plugin_page_hookname($this->_page, 'w3tc_general');
  373. $list[$hook] = $help;
  374. }
  375. return $list;
  376. }
  377. /**
  378. * Plugin action links filter
  379. *
  380. * @param array $links
  381. * @return array
  382. */
  383. function plugin_action_links($links) {
  384. array_unshift($links, '<a class="edit" href="admin.php?page=w3tc_general">Settings</a>');
  385. return $links;
  386. }
  387. /**
  388. * favorite_actions filter
  389. *
  390. * @param array $actions
  391. * @return void
  392. */
  393. function favorite_actions($actions) {
  394. $actions[wp_nonce_url(admin_url('admin.php?page=w3tc_general&amp;w3tc_flush_all'), 'w3tc')] = array(
  395. 'Empty Caches',
  396. 'manage_options'
  397. );
  398. return $actions;
  399. }
  400. /**
  401. * Active plugins pre update option filter
  402. *
  403. * @param string $new_value
  404. * @return string
  405. */
  406. function pre_update_option_active_plugins($new_value) {
  407. $old_value = (array) get_option('active_plugins');
  408. if ($new_value !== $old_value && in_array(W3TC_FILE, (array) $new_value) && in_array(W3TC_FILE, (array) $old_value)) {
  409. $this->_config->set('notes.plugins_updated', true);
  410. $this->_config->save();
  411. }
  412. return $new_value;
  413. }
  414. /**
  415. * Show plugin changes
  416. *
  417. * @return void
  418. */
  419. function in_plugin_update_message() {
  420. $response = w3_http_get(W3TC_README_URL);
  421. if (!is_wp_error($response) && $response['response']['code'] == 200) {
  422. $matches = null;
  423. $regexp = '~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*' . preg_quote(W3TC_VERSION) . '\s*=|$)~Uis';
  424. if (preg_match($regexp, $response['body'], $matches)) {
  425. $changelog = (array) preg_split('~[\r\n]+~', trim($matches[1]));
  426. echo '<div style="color: #f00;">Take a minute to update, here\'s why:</div><div style="font-weight: normal;">';
  427. $ul = false;
  428. foreach ($changelog as $index => $line) {
  429. if (preg_match('~^\s*\*\s*~', $line)) {
  430. if (!$ul) {
  431. echo '<ul style="list-style: disc; margin-left: 20px;">';
  432. $ul = true;
  433. }
  434. $line = preg_replace('~^\s*\*\s*~', '', htmlspecialchars($line));
  435. echo '<li style="width: 50%; margin: 0; float: left; ' . ($index % 2 == 0 ? 'clear: left;' : '') . '">' . $line . '</li>';
  436. } else {
  437. if ($ul) {
  438. echo '</ul><div style="clear: left;"></div>';
  439. $ul = false;
  440. }
  441. echo '<p style="margin: 5px 0;">' . htmlspecialchars($line) . '</p>';
  442. }
  443. }
  444. if ($ul) {
  445. echo '</ul><div style="clear: left;"></div>';
  446. }
  447. echo '</div>';
  448. }
  449. }
  450. }
  451. /**
  452. * media_row_actions filter
  453. *
  454. * @param array $actions
  455. * @param object $post
  456. * @return array
  457. */
  458. function media_row_actions($actions, $post) {
  459. $actions = array_merge($actions, array(
  460. 'cdn_purge' => sprintf('<a href="%s">Purge from CDN</a>', wp_nonce_url(sprintf('admin.php?page=w3tc_general&w3tc_cdn_purge_attachment&attachment_id=%d', $post->ID), 'w3tc'))
  461. ));
  462. return $actions;
  463. }
  464. /**
  465. * post_row_actions filter
  466. *
  467. * @param array $actions
  468. * @param object $post
  469. * @return array
  470. */
  471. function post_row_actions($actions, $post) {
  472. $actions = array_merge($actions, array(
  473. 'pgcache_purge' => sprintf('<a href="%s">Purge from Page Cache</a>', wp_nonce_url(sprintf('admin.php?page=w3tc_general&w3tc_pgcache_purge_post&post_id=%d', $post->ID), 'w3tc'))
  474. ));
  475. return $actions;
  476. }
  477. /**
  478. * page_row_actions filter
  479. *
  480. * @param array $actions
  481. * @param object $post
  482. * @return array
  483. */
  484. function page_row_actions($actions, $post) {
  485. $actions = array_merge($actions, array(
  486. 'pgcache_purge' => sprintf('<a href="%s">Purge from Page Cache</a>', wp_nonce_url(sprintf('admin.php?page=w3tc_general&w3tc_pgcache_purge_page&post_id=%d', $post->ID), 'w3tc'))
  487. ));
  488. return $actions;
  489. }
  490. /**
  491. * Dashboard setup action
  492. *
  493. * @return void
  494. */
  495. function wp_dashboard_setup() {
  496. wp_enqueue_style('w3tc-widget');
  497. wp_enqueue_script('w3tc-metadata');
  498. wp_enqueue_script('w3tc-widget');
  499. if ($this->_config->get_boolean('widget.latest.enabled')) {
  500. wp_add_dashboard_widget('w3tc_latest', 'The Latest from W3 EDGE', array(
  501. &$this,
  502. 'widget_latest'
  503. ), array(
  504. &$this,
  505. 'widget_latest_control'
  506. ));
  507. }
  508. if ($this->_config->get_boolean('widget.pagespeed.enabled')) {
  509. wp_add_dashboard_widget('w3tc_pagespeed', 'W3 Total Cache: Google Page Speed Report', array(
  510. &$this,
  511. 'widget_pagespeed'
  512. ), array(
  513. &$this,
  514. 'widget_pagespeed_control'
  515. ));
  516. }
  517. }
  518. /**
  519. * Admin notices action
  520. *
  521. * @return void
  522. */
  523. function admin_notices() {
  524. $config_path = (w3_is_preview_config() ? W3TC_CONFIG_PREVIEW_PATH : W3TC_CONFIG_PATH);
  525. $pgcache_rules_core_path = w3_get_pgcache_rules_core_path();
  526. $pgcache_rules_cache_path = w3_get_pgcache_rules_cache_path();
  527. $browsercache_rules_cache_path = w3_get_browsercache_rules_cache_path();
  528. $browsercache_rules_no404wp_path = w3_get_browsercache_rules_no404wp_path();
  529. $minify_rules_core_path = w3_get_minify_rules_core_path();
  530. $minify_rules_cache_path = w3_get_minify_rules_cache_path();
  531. $cookie_domain = $this->get_cookie_domain();
  532. $error_messages = array(
  533. 'config_save' => sprintf('The settings could not be saved because the configuration file is not write-able. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($config_path) ? $config_path : dirname($config_path))),
  534. 'fancy_permalinks_disabled_pgcache' => sprintf('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling enhanced disk mode.', $this->button_link('enable', 'options-permalink.php')),
  535. '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\'.', $this->button_link('enable', 'options-permalink.php')),
  536. 'pgcache_write_rules_core' => sprintf('The page cache rules could not be modified. Please %srun <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($pgcache_rules_core_path) ? '' : sprintf('create an empty file in <strong>%s</strong> and ', $pgcache_rules_core_path)), $pgcache_rules_core_path),
  537. 'pgcache_write_rules_cache' => sprintf('The page cache rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($pgcache_rules_cache_path) ? $pgcache_rules_cache_path : dirname($pgcache_rules_cache_path))),
  538. 'pgcache_remove_rules_legacy' => sprintf('The legacy page cache rules could not be removed. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($pgcache_rules_cache_path) ? $pgcache_rules_cache_path : dirname($pgcache_rules_cache_path))),
  539. 'pgcache_remove_rules_wpsc' => sprintf('The WP Super Cache rules could not be removed. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($pgcache_rules_cache_path) ? $pgcache_rules_cache_path : dirname($pgcache_rules_cache_path))),
  540. 'browsercache_write_rules_cache' => sprintf('The browser cache rules could not be modified. Please %srun <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($browsercache_rules_cache_path) ? '' : sprintf('create an empty file in <strong>%s</strong> and ', $browsercache_rules_cache_path)), $browsercache_rules_cache_path),
  541. 'browsercache_write_rules_no404wp' => sprintf('The browser cache rules could not be modified. Please %srun <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($browsercache_rules_no404wp_path) ? '' : sprintf('create an empty file in <strong>%s</strong> and ', $browsercache_rules_no404wp_path)), $browsercache_rules_no404wp_path),
  542. 'browsercache_write_rules_cdn' => sprintf('The browser cache rules for <acronym title="Content Delivery Network">CDN</acronym> could not be modified. Please check <acronym title="Content Delivery Network">CDN</acronym> settings.'),
  543. 'minify_write_rules_core' => sprintf('The minify rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($minify_rules_core_path) ? $minify_rules_core_path : dirname($minify_rules_core_path))),
  544. 'minify_write_rules_cache' => sprintf('The minify rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($minify_rules_cache_path) ? $minify_rules_cache_path : dirname($minify_rules_cache_path))),
  545. 'minify_remove_rules_legacy' => sprintf('The legacy minify rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', (file_exists($minify_rules_cache_path) ? $minify_rules_cache_path : dirname($minify_rules_cache_path))),
  546. 'support_request_type' => 'Please select request type.',
  547. 'support_request_url' => 'Please enter the address of the site in the site <acronym title="Uniform Resource Locator">URL</acronym> field.',
  548. 'support_request_name' => 'Please enter your name in the Name field',
  549. 'support_request_email' => 'Please enter valid email address in the E-Mail field.',
  550. 'support_request_phone' => 'Please enter your phone in the phone field.',
  551. 'support_request_subject' => 'Please enter subject in the subject field.',
  552. 'support_request_description' => 'Please describe the issue in the issue description field.',
  553. 'support_request_wp_login' => 'Please enter an administrator login. Create a temporary one just for this support case if needed.',
  554. 'support_request_wp_password' => 'Please enter WP Admin password, be sure it\'s spelled correctly.',
  555. 'support_request_ftp_host' => 'Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> host for the site.',
  556. '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.',
  557. '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.',
  558. 'support_request' => 'Unable to send the support request.',
  559. 'config_import_no_file' => 'Please select config file.',
  560. 'config_import_upload' => 'Unable to upload config file.',
  561. 'config_import_import' => 'Configuration file could not be imported.',
  562. '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.', (file_exists(W3TC_CONFIG_PREVIEW_PATH) ? W3TC_CONFIG_PREVIEW_PATH : W3TC_CONFIG_PREVIEW_PATH)),
  563. 'preview_enable' => sprintf('Preview mode could not be enabled. Please run <strong>chmod 777 %s</strong> to make the configuration file write-able, then try again.', (file_exists(W3TC_CONFIG_PREVIEW_PATH) ? W3TC_CONFIG_PREVIEW_PATH : dirname(W3TC_CONFIG_PREVIEW_PATH))),
  564. 'preview_disable' => sprintf('Preview mode could not be disabled. Please run <strong>chmod 777 %s</strong> to make the configuration file write-able, then try again.', (file_exists($config_path) ? $config_path : dirname($config_path))),
  565. 'preview_deploy' => sprintf('Preview settings could not be deployed. Please run <strong>chmod 777 %s</strong> to make the configuration file write-able, then try again.', (file_exists(W3TC_CONFIG_PATH) ? W3TC_CONFIG_PATH : dirname(W3TC_CONFIG_PATH))),
  566. 'cdn_purge_attachment' => 'Unable to purge attachment.',
  567. 'pgcache_purge_post' => 'Unable to purge post.',
  568. 'pgcache_purge_page' => 'Unable to purge page.',
  569. '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>.', ABSPATH, addslashes($cookie_domain)),
  570. '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>.', ABSPATH),
  571. 'cloudflare_api_request' => 'Unable to make CloudFlare API request.'
  572. );
  573. $note_messages = array(
  574. 'config_save' => 'Plugin configuration successfully updated.',
  575. 'flush_all' => 'All caches successfully emptied.',
  576. 'flush_memcached' => 'Memcached cache(s) successfully emptied.',
  577. 'flush_opcode' => 'Opcode cache(s) successfully emptied.',
  578. 'flush_file' => 'Disk cache(s) successfully emptied.',
  579. 'flush_pgcache' => 'Page cache successfully emptied.',
  580. 'flush_dbcache' => 'Database cache successfully emptied.',
  581. 'flush_objectcache' => 'Object cache successfully emptied.',
  582. 'flush_minify' => 'Minify cache successfully emptied.',
  583. 'pgcache_write_rules_core' => 'Page cache rewrite rules have been successfully written.',
  584. 'pgcache_write_rules_cache' => 'Page cache rewrite rules have been successfully written.',
  585. 'pgcache_remove_rules_legacy' => 'Legacy page cache configuration settings have been successfully removed.',
  586. 'pgcache_remove_rules_wpsc' => 'WP Super Cache configuration settings have been successfully removed.',
  587. 'browsercache_write_rules_cache' => 'Browser cache directives have been successfully written.',
  588. 'browsercache_write_rules_no404wp' => 'Browser cache directives have been successfully written.',
  589. 'minify_write_rules_core' => 'Minify rewrite rules have been successfully written.',
  590. 'minify_write_rules_cache' => 'Minify rewrite rules have been successfully written.',
  591. 'minify_remove_rules_legacy' => 'Legacy minify configuration settings have been successfuly removed.',
  592. 'support_request' => 'The support request has been successfully sent.',
  593. 'config_import' => 'Settings successfully imported.',
  594. 'config_reset' => 'Settings successfully restored.',
  595. 'preview_enable' => 'Preview mode was successfully enabled',
  596. 'preview_disable' => 'Preview mode was successfully disabled',
  597. 'preview_deploy' => 'Preview settings successfully deployed.',
  598. 'cdn_purge_attachment' => 'Attachment successfully purged.',
  599. 'pgcache_purge_post' => 'Post successfully purged.',
  600. 'pgcache_purge_page' => 'Page successfully purged.'
  601. );
  602. $errors = array();
  603. $notes = array();
  604. require_once W3TC_LIB_W3_DIR . '/Request.php';
  605. $error = W3_Request::get_string('w3tc_error');
  606. $note = W3_Request::get_string('w3tc_note');
  607. /**
  608. * Handle messages from reqeust
  609. */
  610. if (isset($error_messages[$error])) {
  611. $errors[] = $error_messages[$error];
  612. }
  613. if (isset($note_messages[$note])) {
  614. $notes[] = $note_messages[$note];
  615. }
  616. /**
  617. * Check config file
  618. */
  619. if (!w3_is_preview_config() && !file_exists(W3TC_CONFIG_PATH)) {
  620. $errors[] = sprintf('<strong>W3 Total Cache Error:</strong> Default settings are in use. The configuration file could not be read or doesn\'t exist. Please %s to create the file.', $this->button_link('save the settings', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_save_config', $this->_page), 'w3tc')));
  621. }
  622. /**
  623. * CDN notifications
  624. */
  625. if ($this->_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
  626. /**
  627. * Show notification after theme change
  628. */
  629. if ($this->_config->get_boolean('notes.theme_changed')) {
  630. $notes[] = sprintf('The active theme has changed, please %s now to ensure proper operation. %s', $this->button_popup('upload active theme files', 'cdn_export', 'cdn_export_type=theme'), $this->button_hide_note('Hide this message', 'theme_changed'));
  631. }
  632. /**
  633. * Show notification after WP upgrade
  634. */
  635. if ($this->_config->get_boolean('notes.wp_upgraded')) {
  636. $notes[] = sprintf('Upgraded WordPress? Please %s files now to ensure proper operation. %s', $this->button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), $this->button_hide_note('Hide this message', 'wp_upgraded'));
  637. }
  638. /**
  639. * Show notification after CDN enable
  640. */
  641. if ($this->_config->get_boolean('notes.cdn_upload') || $this->_config->get_boolean('notes.cdn_reupload')) {
  642. $cdn_upload_buttons = array();
  643. if ($this->_config->get_boolean('cdn.includes.enable')) {
  644. $cdn_upload_buttons[] = $this->button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
  645. }
  646. if ($this->_config->get_boolean('cdn.theme.enable')) {
  647. $cdn_upload_buttons[] = $this->button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
  648. }
  649. if ($this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('cdn.minify.enable')) {
  650. $cdn_upload_buttons[] = $this->button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
  651. }
  652. if ($this->_config->get_boolean('cdn.custom.enable')) {
  653. $cdn_upload_buttons[] = $this->button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
  654. }
  655. if ($this->_config->get_boolean('notes.cdn_upload')) {
  656. $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', $this->button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), $this->button_hide_note('Hide this message', 'cdn_upload'));
  657. }
  658. if ($this->_config->get_boolean('notes.cdn_reupload')) {
  659. $notes[] = sprintf('Settings that effect Browser Cache settings for files hosted by the CDN have been changed. To apply the new settings %s and %s. %s', $this->button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), $this->button_hide_note('Hide this message', 'cdn_reupload'));
  660. }
  661. }
  662. /**
  663. * Show notification if upload queue is not empty
  664. */
  665. if (!$this->is_queue_empty()) {
  666. $errors[] = sprintf('The %s has unresolved errors. Empty the queue to restore normal operation.', $this->button_popup('unsuccessful transfer queue', 'cdn_queue'));
  667. }
  668. }
  669. /**
  670. * Show notification after plugin activate/deactivate
  671. */
  672. if ($this->_config->get_boolean('notes.plugins_updated')) {
  673. $texts = array();
  674. if ($this->_config->get_boolean('pgcache.enabled')) {
  675. $texts[] = $this->button_link('empty the page cache', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_pgcache', $this->_page), 'w3tc'));
  676. }
  677. if ($this->_config->get_boolean('minify.enabled')) {
  678. $texts[] = sprintf('check the %s to maintain the desired user experience', $this->button_hide_note('minify settings', 'plugins_updated', 'admin.php?page=w3tc_minify'));
  679. }
  680. if (count($texts)) {
  681. $notes[] = sprintf('One or more plugins have been activated or deactivated, please %s. %s', implode(' and ', $texts), $this->button_hide_note('Hide this message', 'plugins_updated'));
  682. }
  683. }
  684. /**
  685. * Show notification when page cache needs to be emptied
  686. */
  687. if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get('notes.need_empty_pgcache') && !w3_is_preview_config()) {
  688. $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.', $this->button_link('Empty the page cache', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_pgcache', $this->_page), 'w3tc')));
  689. }
  690. /**
  691. * Show notification when object cache needs to be emptied
  692. */
  693. if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get('notes.need_empty_objectcache') && !w3_is_preview_config()) {
  694. $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.', $this->button_link('Empty the object cache', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_objectcache', $this->_page), 'w3tc')));
  695. }
  696. /**
  697. * Minify notifications
  698. */
  699. if ($this->_config->get_boolean('minify.enabled')) {
  700. /**
  701. * Minify error occured
  702. */
  703. if ($this->_config->get('notes.minify_error')) {
  704. $errors[] = sprintf('Recently an error occurred while creating the CSS / JS minify cache: %s. %s', $this->_config->get_string('minify.error.last'), $this->button_hide_note('Hide this message', 'minify_error'));
  705. }
  706. /**
  707. * Show notification when minify needs to be emptied
  708. */
  709. if ($this->_config->get('notes.need_empty_minify') && !w3_is_preview_config()) {
  710. $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.', $this->button_link('Empty the minify cache', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_flush_minify', $this->_page), 'w3tc')));
  711. }
  712. }
  713. /**
  714. * Show messages
  715. */
  716. foreach ($errors as $error) {
  717. echo sprintf('<div class="error"><p>%s</p></div>', $error);
  718. }
  719. foreach ($notes as $note) {
  720. echo sprintf('<div class="updated fade"><p>%s</p></div>', $note);
  721. }
  722. }
  723. /**
  724. * Options page
  725. *
  726. * @return void
  727. */
  728. function options() {
  729. /**
  730. * Check for page cache availability
  731. */
  732. if ($this->_config->get_boolean('pgcache.enabled')) {
  733. if (!$this->advanced_cache_installed()) {
  734. $this->_errors[] = sprintf('Page caching is not available: %s is not installed. Either the <strong>%s</strong> directory is not write-able or another caching plugin installed. This error message will automatically disappear once the change is successfully made.', W3TC_ADDIN_FILE_ADVANCED_CACHE, WP_CONTENT_DIR);
  735. } elseif (!$this->advanced_cache_check()) {
  736. $this->_errors[] = sprintf('Page caching is not available. The current add-in %s is either an incorrect file or an old version. De-activate the plugin, remove the file, then activate the plugin again.', W3TC_ADDIN_FILE_ADVANCED_CACHE);
  737. } elseif (!defined('WP_CACHE') || !WP_CACHE) {
  738. $this->_errors[] = sprintf('Page caching is not available: please add: <strong>define(\'WP_CACHE\', true);</strong> to <strong>%swp-config.php</strong>. This error message will automatically disappear once the change is successfully made.', ABSPATH);
  739. } elseif ($this->_config->get_string('pgcache.engine') == 'file_generic' && $this->_config->get_boolean('config.check') && w3_can_check_rules()) {
  740. $w3_plugin_pgcache = & w3_instance('W3_Plugin_PgCacheAdmin');
  741. if ($w3_plugin_pgcache->check_rules_core()) {
  742. if (!$this->test_rewrite_pgcache()) {
  743. $this->_errors[] = 'It appears Page Cache <acronym title="Uniform Resource Locator">URL</acronym> rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration.';
  744. }
  745. } elseif ($this->_config->get_boolean('notes.pgcache_rules_core')) {
  746. $this->_errors[] = sprintf('Disk enhanced page caching is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site above the WordPress directives %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_pgcache_rules_core_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_pgcache->generate_rules_core()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_pgcache_write_rules_core', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'pgcache_rules_core'));
  747. }
  748. if ($this->_config->get_boolean('notes.pgcache_rules_legacy') && $w3_plugin_pgcache->check_rules_legacy()) {
  749. $this->_errors[] = sprintf('Legacy Page Cache rewrite rules have been found. To remove them manually, edit the configuration file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_LEGACY, W3TC_MARKER_END_PGCACHE_LEGACY, $this->button_link('auto-remove', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_pgcache_remove_rules_legacy', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'pgcache_rules_legacy'));
  750. }
  751. if ($this->_config->get_boolean('notes.pgcache_rules_wpsc') && $w3_plugin_pgcache->check_rules_wpsc()) {
  752. $this->_errors[] = sprintf('WP Super Cache rewrite rules have been found. To remove them manually, edit the configuration file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_WPSC, W3TC_MARKER_END_PGCACHE_WPSC, $this->button_link('auto-remove', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_pgcache_remove_rules_wpsc', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'pgcache_rules_wpsc'));
  753. }
  754. if ($this->_config->get_boolean('notes.pgcache_rules_cache') && !$w3_plugin_pgcache->check_rules_cache()) {
  755. $this->_errors[] = sprintf('Disk enhanced page caching is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. This can be done automatically, by clicking here: %s. %s', w3_get_pgcache_rules_cache_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_pgcache->generate_rules_cache()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_pgcache_write_rules_cache', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'pgcache_rules_cache'));
  756. }
  757. }
  758. }
  759. /**
  760. * Check for browser cache availability
  761. */
  762. if ($this->_config->get_boolean('browsercache.enabled') && $this->_config->get_boolean('config.check') && w3_can_check_rules()) {
  763. $w3_plugin_browsercache = & w3_instance('W3_Plugin_BrowserCacheAdmin');
  764. if ($this->_config->get_boolean('notes.browsercache_rules_cache') && !$w3_plugin_browsercache->check_rules_cache()) {
  765. $this->_errors[] = sprintf('Browser caching is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_browsercache_rules_cache_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_browsercache->generate_rules_cache()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_browsercache_write_rules_cache', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'browsercache_rules_cache'));
  766. }
  767. if ($this->_config->get_boolean('notes.browsercache_rules_no404wp') && $this->_config->get_boolean('browsercache.no404wp') && !$w3_plugin_browsercache->check_rules_no404wp()) {
  768. $this->_errors[] = sprintf('"Do not process 404 errors for static objects with WordPress" feature is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_browsercache_rules_no404wp_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_browsercache->generate_rules_no404wp()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_browsercache_write_rules_no404wp', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'browsercache_rules_no404wp'));
  769. }
  770. }
  771. /**
  772. * Check for minify availability
  773. */
  774. if ($this->_config->get_boolean('minify.enabled')) {
  775. if ($this->_config->get_boolean('minify.rewrite') && $this->_config->get_boolean('config.check') && w3_can_check_rules()) {
  776. $w3_plugin_minify = & w3_instance('W3_Plugin_MinifyAdmin');
  777. if ($w3_plugin_minify->check_rules_core()) {
  778. if (!$this->test_rewrite_minify()) {
  779. $this->_errors[] = 'It appears Minify <acronym title="Uniform Resource Locator">URL</acronym> rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration.';
  780. }
  781. } elseif ($this->_config->get_boolean('notes.minify_rules_core')) {
  782. $this->_errors[] = sprintf('Minify is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. This can be done automatically, by clicking here: %s. %s', w3_get_minify_rules_core_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_minify->generate_rules_core()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_minify_write_rules_core', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'minify_rules_core'));
  783. }
  784. if ($this->_config->get_boolean('notes.minify_rules_legacy') && $w3_plugin_minify->check_rules_legacy()) {
  785. $this->_errors[] = sprintf('Legacy Minify rewrite rules have been found. To remove them manually, edit the configuration file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive. Or if permission allow this can be done automatically, by clicking here: %s. %s', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY, $this->button_link('auto-remove', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_minify_remove_rules_legacy', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'minify_rules_legacy'));
  786. }
  787. if ($this->_config->get_string('minify.engine') == 'file' && $this->_config->get_boolean('notes.minify_rules_cache') && !$w3_plugin_minify->check_rules_cache()) {
  788. $this->_errors[] = sprintf('Minify is not active. To enable it, add the following rules into the server configuration file (<strong>%s</strong>) of the site %s <textarea class="w3tc-rules" cols="120" rows="10" readonly="readonly">%s</textarea>. This can be done automatically, by clicking here: %s. %s', w3_get_minify_rules_cache_path(), $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($w3_plugin_minify->generate_rules_cache()), $this->button_link('auto-install', wp_nonce_url(sprintf('admin.php?page=%s&w3tc_minify_write_rules_cache', $this->_page), 'w3tc')), $this->button_hide_note('Hide this message', 'minify_rules_cache'));
  789. }
  790. }
  791. /**
  792. * Minifiers availability error handling
  793. */
  794. $minifiers_errors = array();
  795. if ($this->_config->get_string('minify.js.engine') == 'yuijs') {
  796. $path_java = $this->_config->get_string('minify.yuijs.path.java');
  797. $path_jar = $this->_config->get_string('minify.yuijs.path.jar');
  798. if (!file_exists($path_java)) {
  799. $minifiers_errors[] = sprintf('YUI Compressor (JS): JAVA executable path was not found. The default minifier JSMin will be used instead.');
  800. } elseif (!file_exists($path_jar)) {
  801. $minifiers_errors[] = sprintf('YUI Compressor (JS): JAR file path was not found. The default minifier JSMin will be used instead.');
  802. }
  803. }
  804. if ($this->_config->get_string('minify.css.engine') == 'yuicss') {
  805. $path_java = $this->_config->get_string('minify.yuicss.path.java');
  806. $path_jar = $this->_config->get_string('minify.yuicss.path.jar');
  807. if (!file_exists($path_java)) {
  808. $minifiers_errors[] = sprintf('YUI Compressor (CSS): JAVA executable path was not found. The default CSS minifier will be used instead.');
  809. } elseif (!file_exists($path_jar)) {
  810. $minifiers_errors[] = sprintf('YUI Compressor (CSS): JAR file path was not found. The default CSS minifier will be used instead.');
  811. }
  812. }
  813. if ($this->_config->get_string('minify.js.engine') == 'ccjs') {
  814. $path_java = $this->_config->get_string('minify.ccjs.path.java');
  815. $path_jar = $this->_config->get_string('minify.ccjs.path.jar');
  816. if (!file_exists($path_java)) {
  817. $minifiers_errors[] = sprintf('Closure Compiler: JAVA executable path was not found. The default minifier JSMin will be used instead.');
  818. } elseif (!file_exists($path_jar)) {
  819. $minifiers_errors[] = sprintf('Closure Compiler: JAR file path was not found. The default minifier JSMin will be used instead.');
  820. }
  821. }
  822. if (count($minifiers_errors)) {
  823. $minify_error = 'The following minifiers cannot be found or are no longer working:</p><ul>';
  824. foreach ($minifiers_errors as $minifiers_error) {
  825. $minify_error .= '<li>' . $minifiers_error . '</li>';
  826. }
  827. $minify_error .= '</ul><p>This message will automatically disappear once the issue is resolved.';
  828. $this->_errors[] = $minify_error;
  829. }
  830. }
  831. /**
  832. * Check for database cache availability
  833. */
  834. if ($this->_config->get_boolean('dbcache.enabled')) {
  835. if (!$this->db_installed()) {
  836. $this->_errors[] = sprintf('Database caching is not available: %s is not installed. Either the <strong>%s</strong> directory is not write-able or another caching plugin is installed. This error message will automatically disappear once the change is successfully made.', W3TC_ADDIN_FILE_DB, WP_CONTENT_DIR);
  837. } elseif (!$this->db_check()) {
  838. $this->_errors[] = sprintf('Database caching is not avail…

Large files files are truncated, but you can click here to view the full file