PageRenderTime 59ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/kennethreitz-archive/wordpress-skeleton
PHP | 2875 lines | 1864 code | 486 blank | 525 comment | 439 complexity | 5104b3a9260136b4cc2a289c2b6b5a7b MD5 | raw file

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

  1. <?php
  2. /**
  3. * W3 Total Cache plugin
  4. */
  5. require_once W3TC_LIB_W3_DIR . '/Plugin.php';
  6. /**
  7. * Class W3_Plugin_TotalCache
  8. */
  9. class W3_Plugin_TotalCache extends W3_Plugin
  10. {
  11. /**
  12. * Page tab
  13. * @var string
  14. */
  15. var $_tab = '';
  16. /**
  17. * Notes
  18. * @var array
  19. */
  20. var $_notes = array();
  21. /**
  22. * Errors
  23. * @var array
  24. */
  25. var $_errors = array();
  26. /**
  27. * Show support reminder flag
  28. * @var boolean
  29. */
  30. var $_support_reminder = false;
  31. /**
  32. * Used in PHPMailer init function
  33. * @var string
  34. */
  35. var $_phpmailer_sender = '';
  36. /**
  37. * Runs plugin
  38. */
  39. function run()
  40. {
  41. register_activation_hook(W3TC_FILE, array(
  42. &$this,
  43. 'activate'
  44. ));
  45. register_deactivation_hook(W3TC_FILE, array(
  46. &$this,
  47. 'deactivate'
  48. ));
  49. add_action('admin_menu', array(
  50. &$this,
  51. 'admin_menu'
  52. ));
  53. add_filter('plugin_action_links_' . W3TC_FILE, array(
  54. &$this,
  55. 'plugin_action_links'
  56. ));
  57. add_filter('favorite_actions', array(
  58. &$this,
  59. 'favorite_actions'
  60. ));
  61. add_action('init', array(
  62. &$this,
  63. 'init'
  64. ));
  65. add_action('in_plugin_update_message-' . W3TC_FILE, array(
  66. &$this,
  67. 'in_plugin_update_message'
  68. ));
  69. if ($this->_config->get_boolean('widget.latest.enabled')) {
  70. add_action('wp_dashboard_setup', array(
  71. &$this,
  72. 'wp_dashboard_setup'
  73. ));
  74. }
  75. if ($this->_config->get_boolean('cdn.enabled')) {
  76. add_action('switch_theme', array(
  77. &$this,
  78. 'switch_theme'
  79. ));
  80. add_filter('update_feedback', array(
  81. &$this,
  82. 'update_feedback'
  83. ));
  84. }
  85. if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) {
  86. add_filter('pre_update_option_active_plugins', array(
  87. &$this,
  88. 'pre_update_option_active_plugins'
  89. ));
  90. }
  91. if ($this->_config->get_string('common.support') == 'footer') {
  92. add_action('wp_footer', array(
  93. &$this,
  94. 'footer'
  95. ));
  96. }
  97. if ($this->can_modify_contents()) {
  98. ob_start(array(
  99. &$this,
  100. 'ob_callback'
  101. ));
  102. }
  103. /**
  104. * Run DbCache plugin
  105. */
  106. require_once W3TC_DIR . '/lib/W3/Plugin/DbCache.php';
  107. $w3_plugin_dbcache = & W3_Plugin_DbCache::instance();
  108. $w3_plugin_dbcache->run();
  109. /**
  110. * Run PgCache plugin
  111. */
  112. require_once W3TC_DIR . '/lib/W3/Plugin/PgCache.php';
  113. $w3_plugin_pgcache = & W3_Plugin_PgCache::instance();
  114. $w3_plugin_pgcache->run();
  115. /**
  116. * Run CDN plugin
  117. */
  118. require_once W3TC_DIR . '/lib/W3/Plugin/Cdn.php';
  119. $w3_plugin_cdn = & W3_Plugin_Cdn::instance();
  120. $w3_plugin_cdn->run();
  121. /**
  122. * Run Minify plugin
  123. */
  124. if (W3TC_PHP5) {
  125. require_once W3TC_DIR . '/lib/W3/Plugin/Minify.php';
  126. $w3_plugin_minify = & W3_Plugin_Minify::instance();
  127. $w3_plugin_minify->run();
  128. }
  129. }
  130. /**
  131. * Returns plugin instance
  132. *
  133. * @return W3_Plugin_TotalCache
  134. */
  135. function &instance()
  136. {
  137. static $instances = array();
  138. if (!isset($instances[0])) {
  139. $class = __CLASS__;
  140. $instances[0] = & new $class();
  141. }
  142. return $instances[0];
  143. }
  144. /**
  145. * Check for buggy site-wide activation
  146. */
  147. function wpmu_check()
  148. {
  149. $sitewide_plugins = (array) @unserialize(get_site_option('active_sitewide_plugins'));
  150. $plugins = (array) @unserialize(get_option('active_plugins'));
  151. }
  152. /**
  153. * Activate plugin action
  154. */
  155. function activate()
  156. {
  157. if (!is_dir(W3TC_CONTENT_DIR)) {
  158. if (@mkdir(W3TC_CONTENT_DIR, 0755)) {
  159. @chmod(W3TC_CONTENT_DIR, 0755);
  160. } else {
  161. w3_writable_error(W3TC_CONTENT_DIR);
  162. }
  163. }
  164. if (!is_dir(W3TC_CACHE_FILE_DBCACHE_DIR)) {
  165. if (@mkdir(W3TC_CACHE_FILE_DBCACHE_DIR, 0755)) {
  166. @chmod(W3TC_CACHE_FILE_DBCACHE_DIR, 0755);
  167. } else {
  168. w3_writable_error(W3TC_CACHE_FILE_DBCACHE_DIR);
  169. }
  170. }
  171. if (!is_dir(W3TC_CACHE_FILE_PGCACHE_DIR)) {
  172. if (@mkdir(W3TC_CACHE_FILE_PGCACHE_DIR, 0755)) {
  173. @chmod(W3TC_CACHE_FILE_PGCACHE_DIR, 0755);
  174. } else {
  175. w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR);
  176. }
  177. }
  178. if (!is_dir(W3TC_CACHE_FILE_MINIFY_DIR)) {
  179. if (@mkdir(W3TC_CACHE_FILE_MINIFY_DIR, 0755)) {
  180. @chmod(W3TC_CACHE_FILE_MINIFY_DIR, 0755);
  181. } else {
  182. w3_writable_error(W3TC_CACHE_FILE_MINIFY_DIR);
  183. }
  184. }
  185. if (!is_dir(W3TC_LOG_DIR)) {
  186. if (@mkdir(W3TC_LOG_DIR, 0755)) {
  187. @chmod(W3TC_LOG_DIR, 0755);
  188. } else {
  189. w3_writable_error(W3TC_LOG_DIR);
  190. }
  191. }
  192. if (!is_dir(W3TC_TMP_DIR)) {
  193. if (@mkdir(W3TC_TMP_DIR, 0755)) {
  194. @chmod(W3TC_TMP_DIR, 0755);
  195. } else {
  196. w3_writable_error(W3TC_TMP_DIR);
  197. }
  198. }
  199. if (!$this->_config->get_integer('common.install')) {
  200. $this->_config->set('common.install', time());
  201. }
  202. if (w3_is_wpmu()) {
  203. $this->_config->load_master();
  204. }
  205. if (!$this->_config->save()) {
  206. w3_writable_error(W3TC_CONFIG_PATH);
  207. }
  208. delete_option('w3tc_request_data');
  209. add_option('w3tc_request_data', '', null, 'no');
  210. $this->link_update();
  211. }
  212. /**
  213. * Deactivate plugin action
  214. * @todo Complete plugin uninstall on site wide activation
  215. */
  216. function deactivate()
  217. {
  218. $this->link_delete();
  219. delete_option('w3tc_request_data');
  220. w3_rmdir(W3TC_TMP_DIR);
  221. w3_rmdir(W3TC_LOG_DIR);
  222. w3_rmdir(W3TC_CACHE_FILE_MINIFY_DIR);
  223. w3_rmdir(W3TC_CACHE_FILE_PGCACHE_DIR);
  224. w3_rmdir(W3TC_CACHE_FILE_DBCACHE_DIR);
  225. w3_rmdir(W3TC_CONTENT_DIR);
  226. }
  227. /**
  228. * Init action
  229. */
  230. function init()
  231. {
  232. $this->check_request();
  233. }
  234. /**
  235. * Load action
  236. */
  237. function load()
  238. {
  239. require_once W3TC_LIB_W3_DIR . '/Request.php';
  240. $this->_tab = W3_Request::get_string('tab');
  241. switch (true) {
  242. case ($this->_tab == 'general'):
  243. case ($this->_tab == 'pgcache'):
  244. case ($this->_tab == 'dbcache'):
  245. case ($this->_tab == 'minify' && W3TC_PHP5):
  246. case ($this->_tab == 'cdn'):
  247. case ($this->_tab == 'install'):
  248. case ($this->_tab == 'faq'):
  249. case ($this->_tab == 'about'):
  250. case ($this->_tab == 'support'):
  251. break;
  252. default:
  253. $this->_tab = 'general';
  254. }
  255. /**
  256. * Flush all caches
  257. */
  258. if (isset($_REQUEST['flush_all'])) {
  259. $this->flush_memcached();
  260. $this->flush_opcode();
  261. $this->flush_file();
  262. $this->redirect(array(
  263. 'note' => 'flush_all'
  264. ), true);
  265. }
  266. /**
  267. * Flush memcached cache
  268. */
  269. if (isset($_REQUEST['flush_memcached'])) {
  270. $this->flush_memcached();
  271. $this->redirect(array(
  272. 'note' => 'flush_memcached'
  273. ), true);
  274. }
  275. /**
  276. * Flush APC cache
  277. */
  278. if (isset($_REQUEST['flush_opcode'])) {
  279. $this->flush_opcode();
  280. $this->redirect(array(
  281. 'note' => 'flush_opcode'
  282. ), true);
  283. }
  284. /**
  285. * Flush disk cache
  286. */
  287. if (isset($_REQUEST['flush_file'])) {
  288. $this->flush_file();
  289. $this->redirect(array(
  290. 'note' => 'flush_file'
  291. ), true);
  292. }
  293. /**
  294. * Flush page cache
  295. */
  296. if (isset($_REQUEST['flush_pgcache'])) {
  297. $this->flush_pgcache();
  298. $this->_config->set('notes.need_empty_pgcache', false);
  299. $this->_config->set('notes.plugins_updated', false);
  300. if (!$this->_config->save()) {
  301. $this->redirect(array(
  302. 'error' => 'config_save'
  303. ), true);
  304. }
  305. $this->redirect(array(
  306. 'note' => 'flush_pgcache'
  307. ), true);
  308. }
  309. /**
  310. * Flush db cache
  311. */
  312. if (isset($_REQUEST['flush_dbcache'])) {
  313. $this->flush_dbcache();
  314. $this->redirect(array(
  315. 'note' => 'flush_dbcache'
  316. ), true);
  317. }
  318. /**
  319. * Flush minify cache
  320. */
  321. if (isset($_REQUEST['flush_minify'])) {
  322. $this->flush_minify();
  323. $this->_config->set('notes.need_empty_minify', false);
  324. if (!$this->_config->save()) {
  325. $this->redirect(array(
  326. 'error' => 'config_save'
  327. ), true);
  328. }
  329. $this->redirect(array(
  330. 'note' => 'flush_minify'
  331. ), true);
  332. }
  333. /**
  334. * Hide notes
  335. */
  336. if (isset($_REQUEST['hide_note'])) {
  337. $setting = sprintf('notes.%s', W3_Request::get_string('hide_note'));
  338. $this->_config->set($setting, false);
  339. if (!$this->_config->save()) {
  340. $this->redirect(array(
  341. 'error' => 'config_save'
  342. ), true);
  343. }
  344. $this->redirect(array(), true);
  345. }
  346. /**
  347. * Save config
  348. */
  349. if (isset($_REQUEST['save_config'])) {
  350. if ($this->_config->save()) {
  351. $this->redirect(array(
  352. 'note' => 'config_save'
  353. ), true);
  354. } else {
  355. $this->redirect(array(
  356. 'error' => 'config_save'
  357. ), true);
  358. }
  359. }
  360. /**
  361. * Write page cache rules
  362. */
  363. if (isset($_REQUEST['pgcache_write_rules_core'])) {
  364. require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php';
  365. $w3_plugin_pgcache = & W3_Plugin_PgCache::instance();
  366. if ($w3_plugin_pgcache->write_rules_core()) {
  367. $this->redirect(array(
  368. 'note' => 'pgcache_write_rules_core'
  369. ));
  370. } else {
  371. $this->redirect(array(
  372. 'error' => 'pgcache_write_rules_core'
  373. ));
  374. }
  375. }
  376. if (isset($_REQUEST['pgcache_write_rules_cache'])) {
  377. require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php';
  378. $w3_plugin_pgcache = & W3_Plugin_PgCache::instance();
  379. if ($w3_plugin_pgcache->write_rules_cache()) {
  380. $this->redirect(array(
  381. 'note' => 'pgcache_write_rules_cache'
  382. ));
  383. } else {
  384. $this->redirect(array(
  385. 'error' => 'pgcache_write_rules_cache'
  386. ));
  387. }
  388. }
  389. /**
  390. * Write minify rules
  391. */
  392. if (W3TC_PHP5 && isset($_REQUEST['minify_write_rules'])) {
  393. require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
  394. $w3_plugin_minify = & W3_Plugin_Minify::instance();
  395. if ($w3_plugin_minify->write_rules()) {
  396. $this->redirect(array(
  397. 'note' => 'minify_write_rules'
  398. ));
  399. } else {
  400. $this->redirect(array(
  401. 'error' => 'minify_write_rules'
  402. ));
  403. }
  404. }
  405. /**
  406. * Save support us options
  407. */
  408. if (isset($_REQUEST['save_support_us'])) {
  409. $support = W3_Request::get_string('support');
  410. $this->_config->set('common.support', $support);
  411. if (!$this->_config->save()) {
  412. $this->redirect(array(
  413. 'error' => 'config_save'
  414. ));
  415. }
  416. $this->link_update();
  417. $this->redirect(array(
  418. 'note' => 'config_save'
  419. ));
  420. }
  421. /**
  422. * Run plugin action
  423. */
  424. if (isset($_REQUEST['w3tc_action'])) {
  425. $action = trim($_REQUEST['w3tc_action']);
  426. if (method_exists($this, $action)) {
  427. call_user_func(array(
  428. &$this,
  429. $action
  430. ));
  431. exit();
  432. }
  433. }
  434. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  435. if ($this->_tab == 'support') {
  436. $this->support_request();
  437. } else {
  438. $this->options_save();
  439. }
  440. exit();
  441. }
  442. $this->_support_reminder = ($this->_config->get_boolean('notes.support_us') && $this->_config->get_integer('common.install') < (time() - W3TC_SUPPORT_US_TIMEOUT) && !$this->is_supported());
  443. wp_enqueue_style('w3tc-options', WP_PLUGIN_URL . '/w3-total-cache/inc/css/options.css');
  444. wp_enqueue_style('w3tc-lightbox', WP_PLUGIN_URL . '/w3-total-cache/inc/css/lightbox.css');
  445. }
  446. /**
  447. * Dashboard setup action
  448. */
  449. function wp_dashboard_setup()
  450. {
  451. wp_add_dashboard_widget('w3tc_latest', 'The Latest from W3 EDGE', array(
  452. &$this,
  453. 'widget_latest'
  454. ), array(
  455. &$this,
  456. 'widget_latest_control'
  457. ));
  458. }
  459. /**
  460. * Prints latest widget contents
  461. */
  462. function widget_latest()
  463. {
  464. global $wp_version;
  465. $items = array();
  466. $items_count = $this->_config->get_integer('widget.latest.items');
  467. if ($wp_version >= 2.8) {
  468. include_once (ABSPATH . WPINC . '/feed.php');
  469. $feed = fetch_feed(W3TC_FEED_URL);
  470. if (!is_wp_error($feed)) {
  471. $feed_items = $feed->get_items(0, $items_count);
  472. foreach ($feed_items as $feed_item) {
  473. $items[] = array(
  474. 'link' => $feed_item->get_link(),
  475. 'title' => $feed_item->get_title(),
  476. 'description' => $feed_item->get_description()
  477. );
  478. }
  479. }
  480. } else {
  481. include_once (ABSPATH . WPINC . '/rss.php');
  482. $rss = fetch_rss(W3TC_FEED_URL);
  483. if (is_object($rss)) {
  484. $items = array_slice($rss->items, 0, $items_count);
  485. }
  486. }
  487. include W3TC_DIR . '/inc/widget/latest.phtml';
  488. }
  489. /**
  490. * Latest widget control
  491. */
  492. function widget_latest_control($widget_id, $form_inputs = array())
  493. {
  494. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  495. require_once W3TC_LIB_W3_DIR . '/Request.php';
  496. $this->_config->set('widget.latest.items', W3_Request::get_integer('w3tc_latest_items', 3));
  497. $this->_config->save();
  498. } else {
  499. include W3TC_DIR . '/inc/widget/latest_control.phtml';
  500. }
  501. }
  502. /**
  503. * Admin menu
  504. */
  505. function admin_menu()
  506. {
  507. $page = add_options_page('W3 Total Cache', 'W3 Total Cache', 'manage_options', W3TC_FILE, array(
  508. &$this,
  509. 'options'
  510. ));
  511. if (current_user_can('manage_options')) {
  512. /**
  513. * Only admin can modify W3TC settings
  514. */
  515. add_action('load-' . $page, array(
  516. &$this,
  517. 'load'
  518. ));
  519. /**
  520. * Only admin can see W3TC notices and errors
  521. */
  522. add_action('admin_notices', array(
  523. &$this,
  524. 'admin_notices'
  525. ));
  526. }
  527. }
  528. /**
  529. * Plugin action links filter
  530. *
  531. * @return array
  532. */
  533. function plugin_action_links($links)
  534. {
  535. array_unshift($links, '<a class="edit" href="options-general.php?page=' . W3TC_FILE . '">Settings</a>');
  536. return $links;
  537. }
  538. /**
  539. * favorite_actions filter
  540. */
  541. function favorite_actions($actions)
  542. {
  543. $actions['options-general.php?page=' . W3TC_FILE . '&amp;flush_all'] = array(
  544. 'Empty Caches',
  545. 'manage_options'
  546. );
  547. return $actions;
  548. }
  549. /**
  550. * Check request and handle w3tc_request_data requests
  551. */
  552. function check_request()
  553. {
  554. $pos = strpos($_SERVER['REQUEST_URI'], '/w3tc_request_data/');
  555. if ($pos !== false) {
  556. $hash = substr($_SERVER['REQUEST_URI'], $pos + 19, 32);
  557. if (strlen($hash) == 32) {
  558. $request_data = (array) get_option('w3tc_request_data');
  559. if (isset($request_data[$hash])) {
  560. echo '<pre>';
  561. foreach ($request_data[$hash] as $key => $value) {
  562. printf("%s: %s\n", $key, $value);
  563. }
  564. echo '</pre>';
  565. unset($request_data[$hash]);
  566. update_option('w3tc_request_data', $request_data);
  567. } else {
  568. echo 'Hash is expired or invalid';
  569. }
  570. exit();
  571. }
  572. }
  573. }
  574. /**
  575. * Admin notices action
  576. */
  577. function admin_notices()
  578. {
  579. $error_messages = array(
  580. 'config_save' => sprintf('The settings could not be saved because the config file is not write-able. Please run <strong>chmod 777 %s</strong> to resolve this issue.', file_exists(W3TC_CONFIG_PATH) ? W3TC_CONFIG_PATH : WP_CONTENT_DIR),
  581. 'fancy_permalinks_disabled' => sprintf('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling the enhanced disk mode.', $this->button_link('enable', 'options-permalink.php')),
  582. 'pgcache_write_rules_core' => sprintf('Either your .htaccess file does not exist or cannot be modified (%s.htaccess). Please run <strong>chmod 777 %s.htaccess</strong> to resolve this issue.', ABSPATH, ABSPATH),
  583. 'pgcache_write_rules_cache' => sprintf('The page cache rules (%s/.htaccess) could not be modified. Please run <strong>chmod 777 %s/.htaccess</strong> to resolve this issue.', W3TC_CACHE_FILE_PGCACHE_DIR, W3TC_CACHE_FILE_PGCACHE_DIR),
  584. 'minify_write_rules' => sprintf('The minify cache rules (%s/.htaccess) could not be modified. Please run <strong>chmod 777 %s/.htaccess</strong> to resolve this issue.', W3TC_CACHE_FILE_MINIFY_DIR, W3TC_CACHE_FILE_MINIFY_DIR),
  585. 'support_request_url' => 'Please enter the address of your blog in the Blog <acronym title="Uniform Resource Locator">URL</acronym> field.',
  586. 'support_request_name' => 'Please enter your name in the Name field',
  587. 'support_request_email' => 'Please enter valid email address in the E-Mail field.',
  588. 'support_request_type' => 'Please select request type.',
  589. 'support_request_description' => 'Please describe the issue in the issue description field.',
  590. 'support_request_wp_login' => 'Please enter an administrator login. Remember you can create a temporary one just for this support case.',
  591. 'support_request_wp_password' => 'Please enter WP Admin password, be sure it\'s spelled correctly.',
  592. 'support_request_ftp_host' => 'Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> host for your site.',
  593. 'support_request_ftp_login' => 'Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> login for your server. Remember you can create a temporary one just for this support case.',
  594. 'support_request_ftp_password' => 'Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> password for your <acronym title="File Transfer Protocol">FTP</acronym> account.',
  595. 'support_request' => 'Unable to send your support request.'
  596. );
  597. $note_messages = array(
  598. 'config_save' => 'Plugin configuration successfully updated.',
  599. 'flush_all' => 'All caches successfully emptied.',
  600. 'flush_memcached' => 'Memcached cache(s) successfully emptied.',
  601. 'flush_opcode' => 'Opcode cache(s) successfully emptied.',
  602. 'flush_file' => 'Disk cache successfully emptied.',
  603. 'flush_pgcache' => 'Page cache successfully emptied.',
  604. 'flush_dbcache' => 'Database cache successfully emptied.',
  605. 'flush_minify' => 'Minify cache successfully emptied.',
  606. 'pgcache_write_rules_core' => 'Page cache rewrite rules have been successfully written.',
  607. 'pgcache_write_rules_cache' => 'Page cache rewrite rules have been successfully written.',
  608. 'minify_write_rules' => 'Minify rewrite rules have been successfully written.',
  609. 'support_request' => 'Your support request has been successfully sent.'
  610. );
  611. $errors = array();
  612. $notes = array();
  613. require_once W3TC_LIB_W3_DIR . '/Request.php';
  614. $error = W3_Request::get_string('error');
  615. $note = W3_Request::get_string('note');
  616. /**
  617. * Handle messages from reqeust
  618. */
  619. if (isset($error_messages[$error])) {
  620. $errors[] = $error_messages[$error];
  621. }
  622. if (isset($note_messages[$note])) {
  623. $notes[] = $note_messages[$note];
  624. }
  625. /**
  626. * Check config file
  627. */
  628. if (!file_exists(W3TC_CONFIG_PATH)) {
  629. $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 your settings', sprintf('options-general.php?page=%s&tab=%s&save_config', W3TC_FILE, $this->_tab)));
  630. }
  631. /**
  632. * CDN notifications
  633. */
  634. if ($this->_config->get_boolean('cdn.enabled') && $this->_config->get_string('cdn.engine') != 'mirror') {
  635. /**
  636. * Show notification after theme change
  637. */
  638. if ($this->_config->get_boolean('notes.theme_changed')) {
  639. $notes[] = sprintf('Your 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'));
  640. }
  641. /**
  642. * Show notification after WP upgrade
  643. */
  644. if ($this->_config->get_boolean('notes.wp_upgraded')) {
  645. $notes[] = sprintf('Have you 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'));
  646. }
  647. /**
  648. * Show notification after CDN enable
  649. */
  650. if ($this->_config->get_boolean('notes.cdn_upload')) {
  651. $cdn_upload_buttons = array();
  652. if ($this->_config->get_boolean('cdn.includes.enable')) {
  653. $cdn_upload_buttons[] = $this->button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
  654. }
  655. if ($this->_config->get_boolean('cdn.theme.enable')) {
  656. $cdn_upload_buttons[] = $this->button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
  657. }
  658. if ($this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('cdn.minify.enable')) {
  659. $cdn_upload_buttons[] = $this->button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
  660. }
  661. if ($this->_config->get_boolean('cdn.custom.enable')) {
  662. $cdn_upload_buttons[] = $this->button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
  663. }
  664. $notes[] = sprintf('Make sure to %s and upload your %s, files to the CDN to ensure proper operation. %s', $this->button_popup('export your media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), $this->button_hide_note('Hide this message', 'cdn_upload'));
  665. }
  666. }
  667. /**
  668. * Show notification after plugin activate/deactivate
  669. */
  670. if ($this->_config->get_boolean('notes.plugins_updated')) {
  671. $texts = array();
  672. if ($this->_config->get_boolean('pgcache.enabled')) {
  673. $texts[] = $this->button_link('empty the page cache', sprintf('options-general.php?page=%s&tab=%s&flush_pgcache', W3TC_FILE, $this->_tab));
  674. }
  675. if ($this->_config->get_boolean('minify.enabled')) {
  676. $texts[] = sprintf('check your %s to maintain the desired user experience', $this->button_hide_note('minify settings', 'plugins_updated', sprintf('options-general.php?page=%s&tab=minify', W3TC_FILE)));
  677. }
  678. if (count($texts)) {
  679. $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'));
  680. }
  681. }
  682. /**
  683. * Show notification when page cache needs to be emptied
  684. */
  685. if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get('notes.need_empty_pgcache')) {
  686. $notes[] = sprintf('The setting change(s) made either invalidate your cached data or modify the behavior of your site. %s now to provide a consistent user experience.', $this->button_link('Empty the page cache', sprintf('options-general.php?page=%s&tab=%s&flush_pgcache', W3TC_FILE, $this->_tab)));
  687. }
  688. /**
  689. * Show notification when minify needs to be emptied
  690. */
  691. if ($this->_config->get_boolean('minify.enabled') && $this->_config->get('notes.need_empty_minify')) {
  692. $notes[] = sprintf('The setting change(s) made either invalidate your cached data or modify the behavior of your site. %s now to provide a consistent user experience.', $this->button_link('Empty the minify cache', sprintf('options-general.php?page=%s&tab=%s&flush_minify', W3TC_FILE, $this->_tab)));
  693. }
  694. /**
  695. * Show messages
  696. */
  697. foreach ($errors as $error) {
  698. echo sprintf('<div class="error"><p>%s</p></div>', $error);
  699. }
  700. foreach ($notes as $note) {
  701. echo sprintf('<div class="updated fade"><p>%s</p></div>', $note);
  702. }
  703. }
  704. /**
  705. * Switch theme action
  706. */
  707. function switch_theme()
  708. {
  709. $this->_config->set('notes.theme_changed', true);
  710. $this->_config->save();
  711. }
  712. /**
  713. * WP Upgrade action hack
  714. *
  715. * @param string $message
  716. */
  717. function update_feedback($message)
  718. {
  719. if ($message == __('Upgrading database')) {
  720. $this->_config->set('notes.wp_upgraded', true);
  721. $this->_config->save();
  722. }
  723. }
  724. /**
  725. * Active plugins pre update option filter
  726. */
  727. function pre_update_option_active_plugins($new_value)
  728. {
  729. $old_value = (array) get_option('active_plugins');
  730. if ($new_value !== $old_value && in_array(W3TC_FILE, (array) $new_value) && in_array(W3TC_FILE, (array) $old_value)) {
  731. $this->_config->set('notes.plugins_updated', true);
  732. $this->_config->save();
  733. }
  734. return $new_value;
  735. }
  736. /**
  737. * Show plugin changes
  738. */
  739. function in_plugin_update_message()
  740. {
  741. $data = w3_url_get(W3TC_README_URL);
  742. if ($data) {
  743. $matches = null;
  744. if (preg_match('~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*[0-9.]+\s*=|$)~Uis', $data, $matches)) {
  745. $changelog = (array) preg_split('~[\r\n]+~', trim($matches[1]));
  746. echo '<div style="color: #f00;">Take a minute to update, here\'s why:</div><div style="font-weight: normal;">';
  747. $ul = false;
  748. foreach ($changelog as $index => $line) {
  749. if (preg_match('~^\s*\*\s*~', $line)) {
  750. if (!$ul) {
  751. echo '<ul style="list-style: disc; margin-left: 20px;">';
  752. $ul = true;
  753. }
  754. $line = preg_replace('~^\s*\*\s*~', '', htmlspecialchars($line));
  755. echo '<li style="width: 50%; margin: 0; float: left; ' . ($index % 2 == 0 ? 'clear: left;' : '') . '">' . $line . '</li>';
  756. } else {
  757. if ($ul) {
  758. echo '</ul><div style="clear: left;"></div>';
  759. $ul = false;
  760. }
  761. echo '<p style="margin: 5px 0;">' . htmlspecialchars($line) . '</p>';
  762. }
  763. }
  764. if ($ul) {
  765. echo '</ul><div style="clear: left;"></div>';
  766. }
  767. echo '</div>';
  768. }
  769. }
  770. }
  771. /**
  772. * Footer plugin action
  773. */
  774. function footer()
  775. {
  776. echo '<div style="text-align: center;">Performance Optimization <a href="http://www.w3-edge.com/wordpress-plugins/" rel="external">WordPress Plugins</a> by W3 EDGE</div>';
  777. }
  778. /**
  779. * Options page
  780. */
  781. function options()
  782. {
  783. /**
  784. * Check for page cache availability
  785. */
  786. if ($this->_config->get_boolean('pgcache.enabled')) {
  787. if (!$this->check_advanced_cache()) {
  788. $this->_errors[] = sprintf('Page caching is not available: advanced-cache.php is not installed. Either the <strong>%s</strong> directory is not write-able or you have another caching plugin installed. This error message will automatically disappear once the change is successfully made.', WP_CONTENT_DIR);
  789. } elseif (!defined('WP_CACHE')) {
  790. $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);
  791. } else {
  792. switch ($this->_config->get_string('pgcache.engine')) {
  793. case 'file_pgcache':
  794. require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php';
  795. $w3_plugin_pgcache = & W3_Plugin_PgCache::instance();
  796. if ($this->_config->get_boolean('notes.pgcache_rules_core') && !$w3_plugin_pgcache->check_rules_core()) {
  797. if (w3_is_wpmu()) {
  798. $this->_errors[] = sprintf('Enhanced mode page cache is not operational. Your .htaccess rules could not be modified. Please verify <strong>%s.htaccess</strong> has the following rules: <pre>%s</pre> %s', ABSPATH, htmlspecialchars($w3_plugin_pgcache->generate_rules_core()), $this->button_hide_note('Hide this message', 'pgcache_rules_core'));
  799. } else {
  800. $this->_errors[] = sprintf('You\'ve selected disk caching with enhanced mode however the .htaccess file is not properly configured. Please run <strong>chmod 777 %s.htaccess</strong>, then %s. To manually modify your server configuration for enhanced mode append the following code: <pre>%s</pre> and %s.', ABSPATH, $this->button_link('try again', sprintf('options-general.php?page=%s&tab=%s&pgcache_write_rules_core', W3TC_FILE, $this->_tab)), htmlspecialchars($w3_plugin_pgcache->generate_rules_core()), $this->button_hide_note('hide this message', 'pgcache_rules_core'));
  801. }
  802. }
  803. if ($this->_config->get_boolean('notes.pgcache_rules_cache') && !$w3_plugin_pgcache->check_rules_cache()) {
  804. $this->_errors[] = sprintf('You\'ve selected disk caching with enhanced mode however the .htaccess file is not properly configured. Please run <strong>chmod 777 %s/.htaccess</strong>, then %s. To manually modify your server configuration for enhanced mode append the following code: <pre>%s</pre> and %s.', W3TC_CACHE_FILE_PGCACHE_DIR, $this->button_link('try again', sprintf('options-general.php?page=%s&tab=%s&pgcache_write_rules_cache', W3TC_FILE, $this->_tab)), htmlspecialchars($w3_plugin_pgcache->generate_rules_cache()), $this->button_hide_note('hide this message', 'pgcache_rules_cache'));
  805. }
  806. break;
  807. case 'memcached':
  808. $pgcache_memcached_servers = $this->_config->get_array('pgcache.memcached.servers');
  809. if (!$this->is_memcache_available($pgcache_memcached_servers)) {
  810. $this->_errors[] = sprintf('Page caching is not working properly. Memcached server(s): <strong>%s</strong> may not running or not responding. This error message will automatically disappear once the issue is resolved.', implode(', ', $pgcache_memcached_servers));
  811. }
  812. break;
  813. }
  814. }
  815. }
  816. /**
  817. * Check for minify availability
  818. */
  819. if ($this->_config->get_boolean('minify.enabled')) {
  820. switch ($this->_config->get_string('minify.engine')) {
  821. case 'file':
  822. if (W3TC_PHP5) {
  823. require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
  824. $w3_plugin_minify = & W3_Plugin_Minify::instance();
  825. if ($this->_config->get_boolean('notes.minify_rules') && !$w3_plugin_minify->check_rules()) {
  826. $this->_errors[] = sprintf('The "Rewrite URL Structure" feature, requires rewrite rules be present. Please run <strong>chmod 777 %s/.htaccess</strong>, then %s. To manually modify your server configuration for minify append the following code: <pre>%s</pre> and %s.', W3TC_CACHE_FILE_MINIFY_DIR, $this->button_link('try again', sprintf('options-general.php?page=%s&tab=%s&minify_write_rules', W3TC_FILE, $this->_tab)), htmlspecialchars($w3_plugin_minify->generate_rules()), $this->button_hide_note('hide this message', 'minify_rules'));
  827. }
  828. }
  829. break;
  830. case 'memcached':
  831. $minify_memcached_servers = $this->_config->get_array('minify.memcached.servers');
  832. if (!$this->is_memcache_available($minify_memcached_servers)) {
  833. $this->_errors[] = sprintf('Minify is not working properly. Memcached server(s): <strong>%s</strong> may not running or not responding. This error message will automatically disappear once the issue is resolved.', implode(', ', $minify_memcached_servers));
  834. }
  835. break;
  836. }
  837. }
  838. /**
  839. * Check for database cache availability
  840. */
  841. if ($this->_config->get_boolean('dbcache.enabled')) {
  842. if (!$this->check_db()) {
  843. $this->_errors[] = sprintf('Database caching is not available: db.php is not installed. Either the <strong>%s</strong> directory is not write-able or you have another caching plugin installed. This error message will automatically disappear once the change is successfully made.', WP_CONTENT_DIR);
  844. } elseif ($this->_config->get_string('pgcache.engine') == 'memcached') {
  845. $dbcache_memcached_servers = $this->_config->get_array('dbcache.memcached.servers');
  846. if (!$this->is_memcache_available($dbcache_memcached_servers)) {
  847. $this->_errors[] = sprintf('Database caching is not working properly. Memcached server(s): <strong>%s</strong> may not running or not responding. This error message will automatically disappear once the issue is successfully resolved.', implode(', ', $dbcache_memcached_servers));
  848. }
  849. }
  850. }
  851. /**
  852. * Check PHP version
  853. */
  854. if (!W3TC_PHP5 && $this->_config->get_boolean('notes.php_is_old')) {
  855. $this->_notes[] = sprintf('Unfortunately, <strong>PHP5</strong> is required for full functionality of this plugin; incompatible features are automatically disabled. Please upgrade if possible. %s', $this->button_hide_note('Hide this message', 'php_is_old'));
  856. }
  857. /**
  858. * Check CURL extension
  859. */
  860. if ($this->_config->get_boolean('notes.no_curl') && $this->_config->get_boolean('cdn.enabled') && !function_exists('curl_init')) {
  861. $this->_notes[] = sprintf('The <strong>CURL PHP</strong> extension is not available. Please install it to enable S3 or CloudFront functionality. %s', $this->button_hide_note('Hide this message', 'no_curl'));
  862. }
  863. /**
  864. * Check Zlib extension
  865. */
  866. if ($this->_config->get_boolean('notes.no_zlib') && (!function_exists('gzencode') || !function_exists('gzdeflate'))) {
  867. $this->_notes[] = sprintf('Unfortunately the PHP installation is incomplete, the <strong>zlib module is missing</strong>. This is a core PHP module. Please notify your server administrator and ask for it to be installed. %s', $this->button_hide_note('Hide this message', 'no_zlib'));
  868. }
  869. /**
  870. * Check if Zlib output compression is enabled
  871. */
  872. if ($this->_config->get_boolean('notes.zlib_output_compression') && w3_zlib_output_compression()) {
  873. $this->_notes[] = sprintf('Either the PHP configuration, Web Server configuration or a script somewhere in your WordPress installation is has set <strong>zlib.output_compression</strong> to enabled.<br />Please locate and disable this setting to ensure proper HTTP compression management. %s', $this->button_hide_note('Hide this message', 'zlib_output_compression'));
  874. }
  875. /**
  876. * Show message when defaults are set
  877. */
  878. if ($this->_config->get_boolean('notes.defaults')) {
  879. $this->_notes[] = sprintf('The plugin is in quick setup mode, most recommended defaults are set. Satisfy any warnings customizing any settings. %s', $this->button_hide_note('Hide this message', 'defaults'));
  880. }
  881. /**
  882. * Check wp-content permissions
  883. */
  884. if (!W3TC_WIN && $this->_config->get_boolean('notes.wp_content_perms')) {
  885. $wp_content_stat = stat(WP_CONTENT_DIR);
  886. $wp_content_mode = ($wp_content_stat['mode'] & 0777);
  887. if ($wp_content_mode != 0755) {
  888. $this->_notes[] = sprintf('<strong>%s</strong> is write-able. If you\'ve finished installing the plugin, change the permissions back to the default: <strong>chmod 755 %s</strong>. %s', WP_CONTENT_DIR, WP_CONTENT_DIR, $this->button_hide_note('Hide this message', 'wp_content_perms'));
  889. }
  890. }
  891. /**
  892. * Check CDN settings
  893. */
  894. if ($this->_config->get_boolean('cdn.enabled')) {
  895. $cdn_engine = $this->_config->get_string('cdn.engine');
  896. switch (true) {
  897. case ($cdn_engine == 'mirror' && $this->_config->get_string('cdn.mirror.domain') == ''):
  898. $this->_errors[] = 'The <strong>"Replace default hostname with"</strong> field must be populated.';
  899. break;
  900. case ($cdn_engine == 'ftp' && $this->_config->get_string('cdn.ftp.domain') == ''):
  901. $this->_errors[] = 'The <strong>"Replace default hostname with"</strong> field must be populated. Enter the hostname of your <acronym title="Content Delivery Network">CDN</acronym> provider. <em>This is the hostname you would enter into your address bar in order to view objects in your browser.</em>';
  902. break;
  903. case ($cdn_engine == 's3' && ($this->_config->get_string('cdn.s3.key') == '' || $this->_config->get_string('cdn.s3.bucket') == '' || $this->_config->get_string('cdn.s3.bucket') == '')):
  904. $this->_errors[] = 'The <strong>"Access key", "Secret key" and "Bucket"</strong> fields must be populated.';
  905. break;
  906. case ($cdn_engine == 'cf' && ($this->_config->get_string('cdn.cf.key') == '' || $this->_config->get_string('cdn.cf.secret') == '' || $this->_config->get_string('cdn.cf.bucket') == '' || ($this->_config->get_string('cdn.cf.id') == '' && $this->_config->get_string('cdn.cf.cname') == ''))):
  907. $this->_errors[] = 'The <strong>"Access key", "Secret key", "Bucket" and "Replace default hostname with"</strong> fields must be populated.';
  908. break;
  909. }
  910. }
  911. /**
  912. * Show tab
  913. */
  914. switch ($this->_tab) {
  915. case 'general':
  916. $this->options_general();
  917. break;
  918. case 'pgcache':
  919. $this->options_pgcache();
  920. break;
  921. case 'dbcache':
  922. $this->options_dbcache();
  923. break;
  924. case 'minify':
  925. $this->options_minify();
  926. break;
  927. case 'cdn':
  928. $this->options_cdn();
  929. break;
  930. case 'faq':
  931. $this->options_faq();
  932. break;
  933. case 'support':
  934. $this->options_support();
  935. break;
  936. case 'install':
  937. $this->options_install();
  938. break;
  939. case 'about':
  940. $this->options_about();
  941. break;
  942. }
  943. }
  944. /**
  945. * General tab
  946. */
  947. function options_general()
  948. {
  949. $pgcache_enabled = $this->_config->get_boolean('pgcache.enabled');
  950. $dbcache_enabled = $this->_config->get_boolean('dbcache.enabled');
  951. $minify_enabled = $this->_config->get_boolean('minify.enabled');
  952. $cdn_enabled = $this->_config->get_boolean('cdn.enabled');
  953. $enabled = ($pgcache_enabled || $dbcache_enabled || $minify_enabled || $cdn_enabled);
  954. $check_apc = function_exists('apc_store');
  955. $check_eaccelerator = function_exists('eaccelerator_put');
  956. $check_xcache = function_exists('xcache_set');
  957. $check_curl = function_exists('curl_init');
  958. $check_memcached = class_exists('Memcache');
  959. $pgcache_engine = $this->_config->get_string('pgcache.engine');
  960. $dbcache_engine = $this->_config->get_string('dbcache.engine');
  961. $minify_engine = $this->_config->get_string('minify.engine');
  962. $can_empty_memcache = ($pgcache_engine == 'memcached' || $dbcache_engine == 'memcached' || $minify_engine == 'memcached');
  963. $can_empty_opcode = ($pgcache_engine == 'apc' || $pgcache_engine == 'eaccelerator' || $pgcache_engine == 'xcache');
  964. $can_empty_opcode = $can_empty_opcode || ($dbcache_engine == 'apc' || $dbcache_engine == 'eaccelerator' || $dbcache_engine == 'xcache');
  965. $can_empty_opcode = $can_empty_opcode || ($minify_engine == 'apc' || $minify_engine == 'eaccelerator' || $minify_engine == 'xcache');
  966. $can_empty_file = ($pgcache_engine == 'file' || $pgcache_engine == 'file_pgcache' || $dbcache_engine == 'file' || $minify_engine == 'file');
  967. $debug = ($this->_config->get_boolean('dbcache.debug') || $this->_config->get_boolean('pgcache.debug') || $this->_config->get_boolean('minify.debug') || $this->_config->get_boolean('cdn.debug'));
  968. $support = $this->_config->get_string('common.support');
  969. $supports = $this->get_supports();
  970. include W3TC_DIR . '/inc/options/general.phtml';
  971. }
  972. /**
  973. * Page cache tab
  974. */
  975. function options_pgcache()
  976. {
  977. $pgcache_enabled = $this->_config->get_boolean('pgcache.enabled');
  978. $pgcache_gzip = function_exists('gzencode');
  979. $pgcache_deflate = function_exists('gzdeflate');
  980. include W3TC_DIR . '/inc/options/pgcache.phtml';
  981. }
  982. /**
  983. * Minify tab
  984. */
  985. function options_minify()
  986. {
  987. $minify_enabled = $this->_config->get_boolean('minify.enabled');
  988. $minify_gzip = function_exists('gzencode');
  989. $minify_deflate = function_exists('gzdeflate');
  990. $groups = $this->minify_get_groups();
  991. $js_group = W3_Request::get_string('js_group', 'default');
  992. $js_groups = $this->_config->get_array('minify.js.groups');
  993. $css_group = W3_Request::get_string('css_group', 'default');
  994. $css_groups = $this->_config->get_array('minify.css.groups');
  995. include W3TC_DIR . '/inc/options/minify.phtml';
  996. }
  997. /**
  998. * Database cache tab
  999. */
  1000. function options_dbcache()
  1001. {
  1002. $dbcache_enabled = $this->_config->get_boolean('dbcache.enabled');
  1003. include W3TC_DIR . '/inc/options/dbcache.phtml';
  1004. }
  1005. /**
  1006. * CDN tab
  1007. */
  1008. function options_cdn()
  1009. {
  1010. $cdn_enabled = $this->_config->get_boolean('cdn.enabled');
  1011. $cdn_engine = $this->_config->get_string('cdn.engine');
  1012. $cdn_mirror = ($cdn_engine == 'mirror');
  1013. $minify_enabled = $this->_config->get_boolean('minify.enabled');
  1014. include W3TC_DIR . '/inc/options/cdn.phtml';
  1015. }
  1016. /**
  1017. * FAQ tab
  1018. */
  1019. function options_faq()
  1020. {
  1021. include W3TC_DIR . '/inc/options/faq.phtml';
  1022. }
  1023. /**
  1024. * Support tab
  1025. */
  1026. function options_support()
  1027. {
  1028. $theme = get_theme(get_current_theme());
  1029. $template_files = (isset($theme['Template Files']) ? (array) $theme['Template Files'] : array());
  1030. $request_types = array(
  1031. 'Bug Submission',
  1032. 'Plugin (add-on) Request'
  1033. );
  1034. require_once W3TC_LIB_W3_DIR . '/Request.php';
  1035. $user = get_user_by('login', 'admin');
  1036. $url = W3_Request::get_string('url', w3_get_domain_url());
  1037. $name = W3_Request::get_string('name', ($user ? $user->display_name : ''));
  1038. $email = W3_Request::get_string('email', ($user ? $user->user_email : ''));
  1039. $request_type = W3_Request::get_string('request_type');
  1040. $description = W3_Request::get_string('description');
  1041. $templates = W3_Request::get_array('templates');
  1042. $wp_login = W3_Request::get_string('wp_login');
  1043. $wp_password = W3_Request::get_string('wp_password');
  1044. $ftp_host = W3_Request::get_string('ftp_host');
  1045. $ftp_login = W3_Request::get_string('ftp_login');
  1046. $ftp_password = W3_Request::get_string('ftp_password');
  1047. include W3TC_DIR . '/inc/options/support.phtml';
  1048. }
  1049. /**
  1050. * Install tab
  1051. */
  1052. function options_install()
  1053. {
  1054. include W3TC_DIR . '/inc/options/install.phtml';
  1055. }
  1056. /**
  1057. * About tab
  1058. */
  1059. function options_about()
  1060. {
  1061. include W3TC_DIR . '/inc/options/about.phtml';
  1062. }
  1063. /**
  1064. * Options save action
  1065. */
  1066. function options_save()
  1067. {
  1068. require_once W3TC_LIB_W3_DIR . '/Request.php';
  1069. /**
  1070. * Redirect params
  1071. */
  1072. $params = array();
  1073. /**
  1074. * Read config
  1075. */
  1076. $config = & new W3_Config();
  1077. $config->read_request();
  1078. /**
  1079. * General tab

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