W3 Total Cache - Version 0.9.3

Version Description

  • Added support for extensions
  • Added support for WordPress SEO image filter and CDN
  • Added file exclusions for media query string logic
  • Added user agents to user agents groups
  • Added CDN FTP path / host test
  • Fixed object cache and database cache for localization plugins
  • Fixed chinese filenames when using CDN
  • Fixed removal of stale cached files
  • Fixed missing slashes in inline HTML, JS and CSS files when using CDN
  • Fixed auto mode of minify filename length test
  • Fixed NetDNA / MaxCDN testing when domain does not match domain zone settings
  • Fixed CurlException and NetDNA / MaxCDN
  • Fixed pull zone dropdown not showing or showing wrong zone
  • Fixed trailing slash and redirect with apache
  • Fixed false notification for page cache rules verification
  • Fixed duplicate notifications for FTP
  • Fixed empty FTP form
  • Fixed add-in file validation
  • Fixed browser cache headers for proxy cases
  • Fixed wrong slash in Minify filepaths on windows based sites
  • Fixed settings link in minify test failure and multisite
  • Fixed missing param in canonical link generation
  • Fixed PHP 5.2 compatibility
  • Fixed handling of minify in preview mode
  • Fixed order of operation issue on install tab for nginx
  • Fixed translatable strings handling
  • Fixed page cache debug mode issues
  • Fixed home URL handling in multisite
  • Fixed manual minify mode and path based file source for sub-directory installations
  • Fixed path not set in disk enhanced caching
  • Fixed page cache rewrite rule detection
  • Improved security with esc_* usage
  • Improved backend performance with extensive refactoring
Download this release

Release Info

Developer fredericktownes
Plugin Icon 128x128 W3 Total Cache
Version 0.9.3
Comparing to
See all releases

Code changes from version 0.9.2.11 to 0.9.3

Files changed (158) hide show
  1. extensions/Genesis.php +263 -0
  2. extensions/GenesisAdmin.php +299 -0
  3. inc/define.php +44 -16
  4. inc/email/index.html +0 -0
  5. inc/email/minify_error_notification.html +0 -0
  6. inc/email/minify_error_notification.php +0 -0
  7. inc/email/support_request.php +5 -5
  8. inc/error.php +0 -0
  9. inc/functions/activation.php +118 -49
  10. inc/functions/admin.php +678 -0
  11. inc/functions/admin_ui.php +139 -0
  12. inc/functions/compat.php +0 -0
  13. inc/functions/extensions.php +242 -0
  14. inc/functions/extract.php +0 -0
  15. inc/functions/file.php +0 -0
  16. inc/functions/http.php +0 -0
  17. inc/functions/ip_in_range.php +0 -0
  18. inc/functions/mime.php +0 -0
  19. inc/functions/multisite.php +0 -0
  20. inc/functions/other.php +0 -0
  21. inc/functions/plugin.php +162 -5
  22. inc/functions/rule.php +0 -0
  23. inc/functions/rule_cut.php +0 -0
  24. inc/functions/themes.php +107 -0
  25. inc/functions/ui.php +97 -1
  26. inc/functions/update.php +0 -0
  27. inc/functions/url.php +0 -0
  28. inc/functions/widgets.php +0 -0
  29. inc/index.html +0 -0
  30. inc/lightbox/cdn_s3_bucket_location.php +1 -1
  31. inc/lightbox/create_netdna_maxcdn_pull_zone.php +2 -2
  32. inc/lightbox/index.html +0 -0
  33. inc/lightbox/minify_recommendations.php +4 -4
  34. inc/lightbox/purchase.php +4 -0
  35. inc/lightbox/self_test.php +0 -0
  36. inc/lightbox/support_us.php +6 -6
  37. inc/mime/all.php +0 -0
  38. inc/mime/cssjs.php +0 -0
  39. inc/mime/html.php +0 -0
  40. inc/mime/index.html +0 -0
  41. inc/mime/other.php +0 -0
  42. inc/options/about.php +1 -1
  43. inc/options/browsercache.php +13 -4
  44. inc/options/cdn.php +10 -10
  45. inc/options/cdn/akamai.php +3 -3
  46. inc/options/cdn/att.php +2 -2
  47. inc/options/cdn/azure.php +4 -4
  48. inc/options/cdn/cf.php +4 -4
  49. inc/options/cdn/cf2.php +3 -3
  50. inc/options/cdn/common/cnames.php +1 -1
  51. inc/options/cdn/common/index.html +0 -0
  52. inc/options/cdn/cotendo.php +3 -3
  53. inc/options/cdn/edgecast.php +2 -2
  54. inc/options/cdn/ftp.php +4 -4
  55. inc/options/cdn/index.html +0 -0
  56. inc/options/cdn/maxcdn.php +17 -1
  57. inc/options/cdn/mirror.php +0 -0
  58. inc/options/cdn/netdna.php +18 -1
  59. inc/options/cdn/rscf.php +3 -3
  60. inc/options/cdn/s3.php +3 -3
  61. inc/options/common/footer.php +0 -0
  62. inc/options/common/header.php +91 -63
  63. inc/options/common/help.php +0 -0
  64. inc/options/common/index.html +0 -0
  65. inc/options/dashboard.php +2 -3
  66. inc/options/dbcache.php +6 -6
  67. inc/options/edd/buy.php +10 -0
  68. inc/options/enterprise/dbcluster-config.php +2 -2
  69. inc/options/enterprise/dbcluster_general_section.php +0 -0
  70. inc/options/extensions.php +19 -0
  71. inc/options/extensions/list.php +139 -0
  72. inc/options/extensions/settings.php +20 -0
  73. inc/options/faq.php +0 -0
  74. inc/options/general.php +57 -42
  75. inc/options/index.html +0 -0
  76. inc/options/install.php +10 -1
  77. inc/options/minify.php +23 -30
  78. inc/options/minify/ccjs.php +0 -0
  79. inc/options/minify/ccjs2.php +3 -3
  80. inc/options/minify/css.php +0 -0
  81. inc/options/minify/csstidy.php +1 -1
  82. inc/options/minify/csstidy2.php +4 -4
  83. inc/options/minify/html.php +0 -0
  84. inc/options/minify/htmltidy.php +0 -0
  85. inc/options/minify/htmltidy2.php +1 -1
  86. inc/options/minify/index.html +0 -0
  87. inc/options/minify/js.php +0 -0
  88. inc/options/minify/yuicss2.php +3 -3
  89. inc/options/minify/yuijs.php +0 -0
  90. inc/options/minify/yuijs2.php +3 -3
  91. inc/options/mobile.php +11 -11
  92. inc/options/new_relic.php +4 -4
  93. inc/options/objectcache.php +5 -5
  94. inc/options/pgcache.php +41 -33
  95. inc/options/pro/fragmentcache.php +18 -12
  96. inc/options/pro/fragmentcache_general_section.php +2 -2
  97. inc/options/referrer.php +11 -11
  98. inc/options/support.php +0 -0
  99. inc/options/support/form.php +0 -0
  100. inc/options/support/form/bug_report.php +15 -15
  101. inc/options/support/form/email_support.php +15 -15
  102. inc/options/support/form/index.html +0 -0
  103. inc/options/support/form/linux_config.php +13 -13
  104. inc/options/support/form/new_feature.php +9 -9
  105. inc/options/support/form/phone_support.php +15 -15
  106. inc/options/support/form/plugin_config.php +14 -14
  107. inc/options/support/form/theme_config.php +14 -14
  108. inc/options/support/index.html +0 -0
  109. inc/options/support/payment.php +3 -3
  110. inc/options/support/select.php +2 -2
  111. inc/popup/cdn_export_file.php +0 -0
  112. inc/popup/cdn_export_library.php +0 -0
  113. inc/popup/cdn_import_library.php +0 -0
  114. inc/popup/cdn_purge.php +10 -10
  115. inc/popup/cdn_queue.php +0 -0
  116. inc/popup/cdn_rename_domain.php +0 -0
  117. inc/popup/common/footer.php +0 -0
  118. inc/popup/common/header.php +0 -0
  119. inc/popup/common/index.html +0 -0
  120. inc/popup/index.html +0 -0
  121. inc/popup/pagespeed_results.php +0 -0
  122. inc/widget/index.html +0 -0
  123. inc/widget/latest.php +0 -0
  124. inc/widget/latest_ajax.php +0 -0
  125. inc/widget/latest_control.php +1 -1
  126. inc/widget/latest_news.php +0 -0
  127. inc/widget/latest_news_ajax.php +0 -0
  128. inc/widget/latest_news_control.php +1 -1
  129. inc/widget/maxcdn.php +0 -0
  130. inc/widget/maxcdn_signup.php +9 -7
  131. inc/widget/netdna.php +0 -0
  132. inc/widget/netdna_signup.php +4 -1
  133. inc/widget/new_relic.php +1 -1
  134. inc/widget/pagespeed.php +0 -0
  135. inc/widget/pagespeed_control.php +1 -1
  136. inc/widget/services.php +3 -2
  137. inc/widget/spreadtheword.php +2 -2
  138. index.html +0 -0
  139. ini/apc.ini +0 -0
  140. ini/dbcluster-config-sample.php +0 -0
  141. ini/eaccelerator.ini +0 -0
  142. ini/index.html +0 -0
  143. ini/memcache.ini +0 -0
  144. ini/nginx-network-sample-config.conf +0 -0
  145. ini/nginx-standalone-sample-config.conf +0 -0
  146. ini/php.append.ini +0 -0
  147. ini/s3-sample-policy.txt +0 -0
  148. ini/varnish-sample-config.vcl +0 -0
  149. ini/xcache.ini +0 -0
  150. languages/ar.mo +76 -0
  151. languages/faq-en_US.xml +40 -14
  152. languages/faq-premium-en_US.xml +38 -2
  153. languages/w3-total-cache-ar_AR.po +6639 -0
  154. languages/w3-total-cache-nl_NL.mo +0 -0
  155. languages/w3-total-cache-nl_NL.po +1100 -874
  156. languages/w3-total-cache-pl_PL.po +5124 -2304
  157. languages/w3-total-cache-sr_RS.mo +0 -0
  158. languages/w3-total-cache-sr_RS.po +2618 -0
extensions/Genesis.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class W3_Genesis {
4
+ /**
5
+ * Request URI
6
+ * @var string
7
+ */
8
+ private $_request_uri = '';
9
+ /**
10
+ * @var W3_Config $_config
11
+ */
12
+ private $_config;
13
+
14
+ function run() {
15
+ add_action('w3tc_register_fragment_groups', array($this, 'register_groups'));
16
+ $this->_config = w3_instance('W3_Config');
17
+ if ($this->_config->get_boolean('fragmentcache.enabled')) {
18
+ if (!is_admin()) {
19
+ /**
20
+ * Register the caching of content to specific hooks
21
+ */
22
+ foreach(array('genesis_header', 'genesis_footer', 'genesis_sidebar', 'genesis_loop', 'wp_head', 'wp_footer', 'genesis_comments', 'genesis_pings') as $hook) {
23
+ add_action($hook, array($this, 'cache_genesis_start'),-999999999);
24
+ add_action($hook, array($this, 'cache_genesis_end'), 999999999);
25
+ }
26
+ foreach(array('genesis_do_subnav', 'genesis_do_nav') as $filter) {
27
+ add_filter($filter, array($this, 'cache_genesis_filter_start'),-999999999);
28
+ add_filter($filter, array($this, 'cache_genesis_filter_end'), 999999999);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Since posts pages etc are cached individually need to be able to flush just those and not all fragment
34
+ */
35
+ add_action('clean_post_cache', array($this, 'flush_post_fragment'), 1);
36
+
37
+ $this->_request_uri = $_SERVER['REQUEST_URI'];
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Start outputbuffering or return fragment on a per page/hook basis
43
+ */
44
+ function cache_genesis_start() {
45
+ $hook = current_filter();
46
+ $keys = $this->_get_id_group($hook);
47
+ if (is_null($keys))
48
+ return;
49
+ list($id, $group) = $keys;
50
+ w3tc_fragmentcache_start($id, $group, $hook);
51
+ }
52
+
53
+ /**
54
+ * Store the output buffer per page/post hook basis.
55
+ */
56
+ function cache_genesis_end() {
57
+ $keys = $this->_get_id_group(current_filter());
58
+ if (is_null($keys))
59
+ return;
60
+ list($id, $group) = $keys;
61
+ w3tc_fragmentcache_end($id, $group, $this->_config->get_boolean('fragmentcache.debug'));
62
+ }
63
+
64
+ /**
65
+ * Start filter buffering and return filter result
66
+ */
67
+ function cache_genesis_filter_start($data) {
68
+ $hook = current_filter();
69
+ $keys = $this->_get_id_group($hook, strpos($data,'current')!==false);
70
+ if (is_null($keys))
71
+ return $data;
72
+ list($id, $group) = $keys;
73
+ return w3tc_fragmentcache_filter_start($id, $group, $hook, $data);
74
+ }
75
+
76
+ /**
77
+ * Store the filter result and return filter result.
78
+ */
79
+ function cache_genesis_filter_end($data) {
80
+ $keys = $this->_get_id_group(current_filter(), strpos($data,'current')!==false);
81
+ if (is_null($keys))
82
+ return $data;
83
+ list($id, $group) = $keys;
84
+ return w3tc_fragmentcache_filter_end($id, $group, $data);
85
+ }
86
+
87
+ /**
88
+ * Constructs the fragment grouping for a subgroup
89
+ * @param $subgroup
90
+ * @param $state
91
+ * @return string
92
+ */
93
+ private function _genesis_group($subgroup, $state = false) {
94
+ $postfix = '';
95
+ if ($state && is_user_logged_in())
96
+ $postfix = 'logged_in_';
97
+ return ($subgroup ? "genesis_fragment_{$subgroup}_" : 'genesis_fragment_') . $postfix;
98
+ }
99
+
100
+ /**
101
+ * Constructs the correct fragment group and id for the hook
102
+ * @param $hook
103
+ * @param bool $current_menu
104
+ * @return array|null
105
+ */
106
+ private function _get_id_group($hook, $current_menu = false) {
107
+ if (is_user_logged_in() && w3tc_get_extension_config('genesis.theme', 'fragment_reject_logged_roles')) {
108
+
109
+ $current_user = wp_get_current_user();
110
+ $roles = w3tc_get_extension_config('genesis.theme', 'fragment_reject_roles');
111
+ if (empty($roles))
112
+ return true;
113
+
114
+ $hooks = w3tc_get_extension_config('genesis.theme', 'fragment_reject_logged_roles_on_actions');
115
+
116
+ foreach($roles as $role) {
117
+ if ($hooks && current_user_can($role) && in_array($hook, $hooks)) {
118
+ return null ;
119
+ }
120
+ }
121
+ }
122
+
123
+ $group = $hook;
124
+ if (strpos($hook, 'sidebar')) {
125
+ $genesis_id = $hook;
126
+ $group = 'sidebar';
127
+ } elseif ($hook == 'genesis_loop') {
128
+ if (is_front_page()) {
129
+ $group = 'loop_front_page';
130
+ if (is_paged()) {
131
+ global $wp_query;
132
+ $page = $wp_query->query_vars['paged'];
133
+ $genesis_id = "{$page}_$hook";
134
+ } else
135
+ $genesis_id = $hook;
136
+ } else {
137
+ $group = 'loop_single';
138
+
139
+ if (is_paged()) {
140
+ global $wp_query;
141
+ $page = $wp_query->query_vars['paged'];
142
+ $genesis_id = get_the_ID(). "_{$page}_$hook";
143
+ } else
144
+ $genesis_id = get_the_ID(). "_$hook";
145
+ }
146
+ } elseif ($hook == 'genesis_comments' || $hook == 'genesis_pings'){
147
+ if ($hook == 'genesis_comments' && is_user_logged_in())
148
+ return null;
149
+
150
+ $group = 'loop_single_' . $hook;
151
+ if (is_paged()) {
152
+ global $wp_query;
153
+ $page = $wp_query->query_vars['paged'];
154
+ $genesis_id = get_the_ID(). "_{$page}_$hook";
155
+ } else
156
+ $genesis_id = get_the_ID()."_$hook";
157
+ } elseif (strpos($hook, '_nav') && $current_menu) {
158
+ if (is_front_page()) {
159
+ $genesis_id = 0;
160
+ } else {
161
+ $genesis_id = get_the_ID();
162
+ }
163
+ } else
164
+ $genesis_id = $hook;
165
+
166
+ if ($this->_cache_group($group) && !$this->_exclude_page($group)) {
167
+ return array($genesis_id, $this->_genesis_group($group, true));
168
+ }
169
+ return null;
170
+ }
171
+
172
+ /**
173
+ * Checks if the fragment group should be cached
174
+ *
175
+ * @param $group
176
+ * @return array|bool|int|null|string
177
+ */
178
+ private function _cache_group($group) {
179
+ return w3tc_get_extension_config('genesis.theme', $group);
180
+ }
181
+
182
+ /**
183
+ * Checks if current page is excluded from caching
184
+ *
185
+ * @param $group
186
+ * @return bool
187
+ */
188
+ private function _exclude_page($group) {
189
+ $reject_uri = w3tc_get_extension_config('genesis.theme', "{$group}_excluded");
190
+ if ($reject_uri)
191
+ $reject_uri = explode("\n", $reject_uri);
192
+
193
+ if (is_null($reject_uri) || !is_array($reject_uri) || empty($reject_uri)) {
194
+ return false;
195
+ }
196
+
197
+ $auto_reject_uri = array(
198
+ 'wp-login',
199
+ 'wp-register'
200
+ );
201
+ foreach ($auto_reject_uri as $uri) {
202
+ if (strstr($this->_request_uri, $uri) !== false) {
203
+ return true;
204
+ }
205
+ }
206
+
207
+ $reject_uri = array_map('w3_parse_path', $reject_uri);
208
+
209
+ foreach ($reject_uri as $expr) {
210
+ $expr = trim($expr);
211
+ if ($expr != '' && preg_match('~' . $expr . '~i', $this->_request_uri)) {
212
+ return true;
213
+ }
214
+ }
215
+
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * Register the various fragments groups to be used. no_action is used since fragments requires actions.
221
+ */
222
+ function register_groups() {
223
+ //blog specific group and an array of actions that will trigger a flush of the group
224
+ $groups = array (
225
+ $this->_genesis_group('') => array(
226
+ 'clean_post_cache',
227
+ 'update_option_sidebars_widgets',
228
+ 'wp_update_nav_menu_item'),
229
+ $this->_genesis_group('sidebar') => array(
230
+ 'update_option_sidebars_widgets'),
231
+ $this->_genesis_group('loop_single') => array(
232
+ 'no_action'),
233
+ $this->_genesis_group('loop_front_page') => array(
234
+ 'clean_post_cache')
235
+ );
236
+ foreach($groups as $group => $actions)
237
+ w3tc_register_fragment_group($group, $actions, 3600);
238
+ }
239
+
240
+ /**
241
+ * Flush the fragments connected to a post id
242
+ * @param $post_ID
243
+ */
244
+ function flush_post_fragment($post_ID) {
245
+ /**
246
+ * @var W3_SharedPageUrls $W3_SharedPageUrls
247
+ */
248
+ $W3_SharedPageUrls = w3_instance('W3_SharedPageUrls');
249
+ $urls = $W3_SharedPageUrls->get_post_urls($post_ID);
250
+ $hooks = array('genesis_loop', 'genesis_comments', 'genesis_pings');
251
+ foreach($hooks as $hook) {
252
+ w3tc_fragmentcache_flush_fragment("{$post_ID}_$hook", $this->_genesis_group('loop_single_logged_in'));
253
+ w3tc_fragmentcache_flush_fragment("{$post_ID}_$hook", $this->_genesis_group('loop_single'));
254
+ for($page = 0; $page<=sizeof($urls); $page++) {
255
+ w3tc_fragmentcache_flush_fragment("{$post_ID}_$hook", $this->_genesis_group('loop_single_logged_in'));
256
+ w3tc_fragmentcache_flush_fragment("{$post_ID}_$hook", $this->_genesis_group('loop_single'));
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+ $ext = new W3_Genesis();
263
+ $ext->run();
extensions/GenesisAdmin.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * W3 GenesisExtension module
4
+ */
5
+ if (!defined('W3TC')) {
6
+ die();
7
+ }
8
+
9
+ class W3_GenesisAdmin {
10
+
11
+ function run() {
12
+ add_action('admin_init', array($this, 'admin_init'));
13
+ add_filter('w3tc_extensions', array($this, 'extension'), 10, 2);
14
+ add_action('w3tc_extensions_page-genesis.theme', array($this, 'extension_header'));
15
+ }
16
+
17
+ /**
18
+ * Display if caching or not.
19
+ */
20
+ function extension_header() {
21
+ $config = w3_instance('W3_Config');
22
+ $settings = w3tc_get_extension_config('genesis.theme');
23
+ $caching = false;
24
+ foreach($settings as $setting => $value) {
25
+ if (strpos($setting, 'reject') === false && $value == '1') {
26
+ $caching = true;
27
+ break;
28
+ }
29
+ }
30
+ echo '<p>';
31
+ printf(__('The Genesis Framework extension is currently %s ', 'w3-total-cache'),
32
+ ($caching ? '<span class="w3tc-enabled">' . __('enabled', 'w3-total-cache') . '</span>' :
33
+ '<span class="w3tc-disabled">' . __('disabled', 'w3-total-cache') . '</span>'));
34
+ if ($caching)
35
+ printf(__('and caching via <strong>%s</strong>', 'w3-total-cahe'),$config->get_string('fragmentcache.engine'));
36
+ echo '.</p>';
37
+ }
38
+
39
+ /**
40
+ * Setups sections
41
+ */
42
+ function admin_init() {
43
+ w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/extensions.php');
44
+ // Register our settings field group
45
+ w3tc_add_settings_section(
46
+ 'header', // Unique identifier for the settings section
47
+ 'Header', // Section title
48
+ '__return_false', // Section callback (we don't want anything)
49
+ 'genesis.theme' // extension id, used to uniquely identify the extension;
50
+ );
51
+ w3tc_add_settings_section(
52
+ 'content',
53
+ 'Content',
54
+ '__return_false',
55
+ 'genesis.theme'
56
+ );
57
+
58
+ w3tc_add_settings_section(
59
+ 'sidebar',
60
+ 'Sidebar',
61
+ '__return_false',
62
+ 'genesis.theme'
63
+ );
64
+
65
+
66
+ w3tc_add_settings_section(
67
+ 'footer',
68
+ 'Footer',
69
+ '__return_false',
70
+ 'genesis.theme'
71
+ );
72
+
73
+ w3tc_add_settings_section(
74
+ 'exclusions',
75
+ 'Disable fragment cache',
76
+ '__return_false',
77
+ 'genesis.theme'
78
+ );
79
+
80
+ $settings = $this->settings();
81
+ foreach($settings as $setting => $meta) {
82
+ /**
83
+ * @var $label
84
+ * @var $description
85
+ * @var $section
86
+ * @var $type
87
+ */
88
+ extract($meta);
89
+ w3tc_add_settings_field($setting, $label,
90
+ array($this, 'print_setting'), 'genesis.theme', $section,
91
+ array('label_for'=>$setting, 'type'=>$type,
92
+ 'description' => $description));
93
+ }
94
+ }
95
+
96
+ /**
97
+ *
98
+ * @param $setting
99
+ * @param $args
100
+ */
101
+ function print_setting($setting, $args) {
102
+ w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/extensions.php');
103
+ list($name, $id) = w3tc_get_name_and_id('genesis.theme', $setting);
104
+ if ($args['type'] != 'custom')
105
+ w3_ui_element($args['type'], $setting, $name, w3tc_get_extension_config('genesis.theme', $setting), w3_extension_is_sealed('genesis.theme'));
106
+ else {
107
+ if ($setting == 'fragment_reject_roles'):
108
+ $saved_roles = w3tc_get_extension_config('genesis.theme', $setting);
109
+ if (!is_array($saved_roles))
110
+ $saved_roles = array();
111
+ ?>
112
+ <div id="<?php echo esc_attr($id)?>">
113
+ <input type="hidden" name="<?php echo esc_attr($name)?>" value="" />
114
+ <?php foreach( get_editable_roles() as $role_name => $role_data ) : ?>
115
+ <input <?php disabled(w3_extension_is_sealed('genesis.theme')) ?> type="checkbox" name="<?php echo esc_attr($name)?>[]" value="<?php echo $role_name ?>" <?php checked( in_array( $role_name, $saved_roles ) ) ?> id="role_<?php echo $role_name ?>" />
116
+ <label for="role_<?php echo $role_name ?>"><?php echo $role_data['name'] ?></label>
117
+ <?php endforeach; ?>
118
+ </div>
119
+ <?php
120
+ else:
121
+ $saved_hooks = w3tc_get_extension_config('genesis.theme', $setting);
122
+ if (!is_array($saved_hooks))
123
+ $saved_hooks = array();
124
+ $hooks = array('genesis_header' => 'Header', 'genesis_footer' => 'Footer', 'genesis_sidebar' => 'Sidebar', 'genesis_loop' =>'The Loop', 'wp_head' => 'wp_head', 'wp_footer' => 'wp_footer', 'genesis_comments' => 'Comments', 'genesis_pings' => 'Pings', 'genesis_do_nav'=>'Primary navigation', 'genesis_do_subnav' => 'Secondary navigation');?>
125
+ <div id="<?php echo esc_attr($id)?>">
126
+ <input <?php disabled(w3_extension_is_sealed('genesis.theme')) ?> type="hidden" name="<?php echo esc_attr($name)?>" value="" />
127
+ <?php foreach( $hooks as $hook => $hook_label ) : ?>
128
+ <input <?php disabled(w3_extension_is_sealed('genesis.theme')) ?> type="checkbox" name="<?php echo esc_attr($name)?>[]" value="<?php echo $hook ?>" <?php checked( in_array( $hook, $saved_hooks ) ) ?> id="role_<?php echo $hook ?>" />
129
+ <label for="role_<?php echo $hook ?>"><?php echo $hook_label ?></label><br />
130
+ <?php endforeach; ?>
131
+ </div>
132
+ <?php
133
+ endif;
134
+ }
135
+ }
136
+
137
+ /**
138
+ * @param $extensions
139
+ * @return mixed
140
+ */
141
+ function extension($extensions, $config) {
142
+ $activation_enabled = $config->get_boolean('fragmentcache.enabled');
143
+ $activation_enabled = $activation_enabled && defined('PARENT_THEME_NAME') && PARENT_THEME_NAME == 'Genesis' &&
144
+ defined('PARENT_THEME_VERSION') && version_compare(PARENT_THEME_VERSION, '1.9.0') >= 0;
145
+ $message = array();
146
+
147
+ if (is_network_admin()) {
148
+ w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/themes.php');
149
+ $themes = w3tc_get_themes();
150
+ $exists = false;
151
+ foreach ($themes as $theme) {
152
+ if (strtolower($theme->Template) == 'genesis')
153
+ $exists = true;
154
+ }
155
+ if (!$exists)
156
+ $message[] = 'Genesis Framework';
157
+ }elseif (!(defined('PARENT_THEME_NAME') && PARENT_THEME_NAME == 'Genesis'))
158
+ $message[] = 'Genesis Framework version >= 1.9.0';
159
+ if (!$config->get_boolean('fragmentcache.enabled'))
160
+ $message[] = 'Fragment Cache (W3 Total Cache Pro)';
161
+
162
+ $extensions['genesis.theme'] = array (
163
+ 'name' => 'Genesis Framework',
164
+ 'author' => 'W3 EDGE',
165
+ 'description' => 'Provides 30-60% improvement in page generation time for the Genesis Framework by Copyblogger Media.',
166
+ 'author uri' => 'http://www.w3-edge.com/',
167
+ 'extension uri' => 'http://www.w3-edge.com/',
168
+ 'extension id' => 'genesis.theme',
169
+ 'version' => '0.1',
170
+ 'enabled' => $activation_enabled,
171
+ 'requirements' => implode(', ', $message),
172
+ 'path' => 'w3-total-cache/extensions/Genesis.php'
173
+ );
174
+
175
+ return $extensions;
176
+ }
177
+
178
+ /**
179
+ * @return array
180
+ */
181
+ function settings() {
182
+ return
183
+ array(
184
+ 'wp_head' =>
185
+ array(
186
+ 'type' => 'checkbox',
187
+ 'section' => 'header',
188
+ 'label' => __('Cache wp_head loop:', 'w3-total-cache'),
189
+ 'description' =>__('Cache wp_head. This includes the embedded CSS, JS etc.', 'w3-total-cache')
190
+ ),
191
+ 'genesis_header' =>
192
+ array(
193
+ 'type' => 'checkbox',
194
+ 'section' => 'header',
195
+ 'label' => __('Cache header:', 'w3-total-cache'),
196
+ 'description' => __('Cache header loop. This is the area where the logo is located.', 'w3-total-cache')
197
+ ),
198
+ 'genesis_do_nav' =>
199
+ array(
200
+ 'type' => 'checkbox',
201
+ 'section' => 'header',
202
+ 'label' => __('Cache primary navigation:', 'w3-total-cache'),
203
+ 'description' => __('Caches the navigation filter; per page.', 'w3-total-cache')
204
+ ),
205
+ 'genesis_do_subnav' =>
206
+ array(
207
+ 'type' => 'checkbox',
208
+ 'section' => 'header',
209
+ 'label' => __('Cache secondary navigation:', 'w3-total-cache'),
210
+ 'description' => __('Caches secondary navigation filter; per page.', 'w3-total-cache'),
211
+ ),
212
+ 'loop_front_page' =>
213
+ array(
214
+ 'type' => 'checkbox',
215
+ 'section' => 'content',
216
+ 'label' => __('Cache front page post loop:', 'w3-total-cache'),
217
+ 'description' => __('Caches the front page post loop, pagination is supported.', 'w3-total-cache')
218
+ ),
219
+ 'loop_single' =>
220
+ array(
221
+ 'type' => 'checkbox',
222
+ 'section' => 'content',
223
+ 'label' => __('Cache single post / page:', 'w3-total-cache'),
224
+ 'description' => __('Caches the single post / page loop, pagination is supported.', 'w3-total-cache')
225
+ ),
226
+ 'loop_single_excluded' =>
227
+ array(
228
+ 'type' => 'textarea',
229
+ 'section' => 'content',
230
+ 'label' => __('Excluded single pages / posts:', 'w3-total-cache'),
231
+ 'description' => __('List of pages / posts that should not have the single post / post loop cached. Specify one page / post per line.', 'w3-total-cache')
232
+ ),
233
+ 'loop_single_genesis_comments' =>
234
+ array(
235
+ 'type' => 'checkbox',
236
+ 'section' => 'content',
237
+ 'label' => __('Cache comments:', 'w3-total-cache'),
238
+ 'description' => __('Caches the comments loop, pagination is supported.', 'w3-total-cache')
239
+ ),
240
+ 'loop_single_genesis_pings' =>
241
+ array(
242
+ 'type' => 'checkbox',
243
+ 'section' => 'content',
244
+ 'label' => __('Cache pings:', 'w3-total-cache'),
245
+ 'description' => __('Caches the ping loop, pagination is supported. One per line.', 'w3-total-cache')
246
+ ),
247
+ 'sidebar' =>
248
+ array(
249
+ 'type' => 'checkbox',
250
+ 'section' => 'sidebar',
251
+ 'label' => __('Cache sidebar:', 'w3-total-cache'),
252
+ 'description' => __('Caches sidebar loop, the widget area.', 'w3-total-cache')
253
+ ),
254
+ 'sidebar_excluded' =>
255
+ array(
256
+ 'type' => 'textarea',
257
+ 'section' => 'sidebar',
258
+ 'label' => __('Exclude pages:', 'w3-total-cache'),
259
+ 'description' => __('List of pages that should not have sidebar cached. Specify one page / post per line.', 'w3-total-cache')
260
+ ),
261
+ 'genesis_footer' =>
262
+ array(
263
+ 'type' => 'checkbox',
264
+ 'section' => 'footer',
265
+ 'label' => __('Cache footer:', 'w3-total-cache'),
266
+ 'description' => __('Caches footer loop.', 'w3-total-cache')
267
+ ),
268
+ 'wp_footer' =>
269
+ array(
270
+ 'type' => 'checkbox',
271
+ 'section' => 'footer',
272
+ 'label' => __('Cache footer:', 'w3-total-cache'),
273
+ 'description' => __('Caches wp_footer loop.', 'w3-total-cache')
274
+ ),
275
+ 'fragment_reject_logged_roles' =>
276
+ array('type' => 'checkbox',
277
+ 'section' => 'exclusions',
278
+ 'label' => __('Disable fragment cache:', 'w3-total-cache'),
279
+ 'description' => 'Don\'t use fragment cache with the following hooks and for the specified user roles.'
280
+ ),
281
+ 'fragment_reject_logged_roles_on_actions' =>
282
+ array('type' => 'custom',
283
+ 'section' => 'exclusions',
284
+ 'label' => __('Select hooks:', 'w3-total-cache'),
285
+ 'description' => __('Select hooks from the list that should not be cached if user belongs to any of the roles selected below.', 'w3-total-cache')
286
+ ),
287
+ 'fragment_reject_roles' =>
288
+ array('type' => 'custom',
289
+ 'section' => 'exclusions',
290
+ 'label' => __('Select roles:', 'w3-total-cache'),
291
+ 'description' => __('Select user roles that should not use the fragment cache.', 'w3-total-cache')
292
+
293
+ )
294
+ );
295
+ }
296
+ }
297
+
298
+ $ext = new W3_GenesisAdmin();
299
+ $ext->run();
inc/define.php CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) {
5
  }
6
 
7
  define('W3TC', true);
8
- define('W3TC_VERSION', '0.9.2.11');
9
  define('W3TC_POWERED_BY', 'W3 Total Cache/' . W3TC_VERSION);
10
  define('W3TC_EMAIL', 'w3tc@w3-edge.com');
11
  define('W3TC_TEXT_DOMAIN', 'w3-total-cache');
@@ -14,12 +14,18 @@ define('W3TC_PAYPAL_BUSINESS', 'w3tc-team@w3-edge.com');
14
  define('W3TC_LINK_URL', 'http://www.w3-edge.com/wordpress-plugins/');
15
  define('W3TC_LINK_NAME', 'WordPress Plugins');
16
  define('W3TC_FEED_URL', 'http://feeds.feedburner.com/W3TOTALCACHE');
17
- define('W3TC_NEWS_FEED_URL', 'http://feeds.w3-edge.com/W3EDGE');
18
  define('W3TC_README_URL', 'http://plugins.svn.wordpress.org/w3-total-cache/trunk/readme.txt');
19
  define('W3TC_SUPPORT_US_TIMEOUT', 2592000);
20
  define('W3TC_SUPPORT_REQUEST_URL', 'http://www.w3-edge.com/?w3tc_support_request=1');
21
- define('NEWRELIC_SIGNUP_URL', 'https://rpm.newrelic.com/signup?product%5Blevel%5D=Standard&product%5Bcommitment%5D=Monthly&subscription%5Bnumber_of_hosts%5D=1&partnership_id=295');
22
- define('MAXCDN_SIGNUP_URL', 'http://bit.ly/pXZ4t1');
 
 
 
 
 
 
23
 
24
  define('W3TC_WIN', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'));
25
 
@@ -29,6 +35,8 @@ define('W3TC_INC_DIR', W3TC_DIR . '/inc');
29
  define('W3TC_INC_WIDGET_DIR', W3TC_INC_DIR. '/widget');
30
  define('W3TC_INC_FUNCTIONS_DIR', W3TC_INC_DIR . '/functions');
31
  define('W3TC_INC_OPTIONS_DIR', W3TC_INC_DIR . '/options');
 
 
32
  define('W3TC_LIB_DIR', W3TC_DIR . '/lib');
33
  define('W3TC_LIB_W3_DIR', W3TC_LIB_DIR . '/W3');
34
  define('W3TC_LIB_MINIFY_DIR', W3TC_LIB_DIR . '/Minify');
@@ -70,6 +78,8 @@ define('W3TC_ADDIN_FILE_OBJECT_CACHE', WP_CONTENT_DIR . '/object-cache.php');
70
 
71
 
72
  define('W3TC_WP_LOADER', (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/plugins') . '/w3tc-wp-loader.php');
 
 
73
 
74
  w3_require_once(W3TC_INC_DIR . '/functions/compat.php');
75
  w3_require_once(W3TC_INC_DIR . '/functions/plugin.php');
@@ -116,7 +126,9 @@ function w3_is_xml($content) {
116
  * @return bool
117
  */
118
  function w3_can_print_comment(&$buffer) {
119
- return apply_filters('w3tc_can_print_comment', w3_is_xml($buffer) && !defined('DOING_AJAX'));
 
 
120
  }
121
 
122
  /*
@@ -136,13 +148,13 @@ function w3_filename_to_url($filename) {
136
  $dir = '';
137
  if (substr(WP_CONTENT_DIR, 0, strlen(w3_get_site_root())) == w3_get_site_root()) {
138
  $dir = str_replace($site_url_ssl, '', w3_get_url_ssl(w3_get_site_url()));
139
- $dir = trim($dir, '/');
140
  if ($dir)
141
  $dir = '/' . $dir;
142
- $content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_site_root())), '/');
143
  }
144
  else
145
- $content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_document_root())), '/');
146
 
147
  $url = $site_url_ssl . $dir . '/' . $content_path . $uri_from_wp_content;
148
 
@@ -626,7 +638,7 @@ function w3_get_home_url() {
626
 
627
  if ($home_url === null) {
628
  $config = w3_instance('W3_Config');
629
- if ($config->get_boolean('common.force_master')) {
630
  $home_url = get_home_url();
631
  } else {
632
  // get_option is unusable here, it can cause problem when objCache isn't yet initialized
@@ -1221,6 +1233,8 @@ function w3_redirect_temp( $url = '', $params = array() ) {
1221
  * Returns caching engine name
1222
  *
1223
  * @param $engine
 
 
1224
  * @return string
1225
  */
1226
  function w3_get_engine_name($engine, $module = '') {
@@ -1533,18 +1547,32 @@ function w3_convert_secs_to_time($input, $string = true) {
1533
  /**
1534
  * @return string
1535
  */
1536
- function w3_w3tc_release_version() {
1537
- if (defined('W3TC_ENTERPRISE') && W3TC_ENTERPRISE)
1538
  return 'enterprise';
1539
- if (defined('W3TC_PRO') && W3TC_PRO)
1540
  return 'pro';
1541
  return 'community';
1542
  }
1543
 
1544
- function w3_is_pro() {
1545
- return defined('W3TC_PRO') && W3TC_PRO;
 
 
 
 
 
 
 
1546
  }
1547
 
1548
- function w3_is_enterprise() {
1549
- return defined('W3TC_ENTERPRISE') && W3TC_ENTERPRISE;
 
 
 
 
 
 
 
1550
  }
5
  }
6
 
7
  define('W3TC', true);
8
+ define('W3TC_VERSION', '0.9.3');
9
  define('W3TC_POWERED_BY', 'W3 Total Cache/' . W3TC_VERSION);
10
  define('W3TC_EMAIL', 'w3tc@w3-edge.com');
11
  define('W3TC_TEXT_DOMAIN', 'w3-total-cache');
14
  define('W3TC_LINK_URL', 'http://www.w3-edge.com/wordpress-plugins/');
15
  define('W3TC_LINK_NAME', 'WordPress Plugins');
16
  define('W3TC_FEED_URL', 'http://feeds.feedburner.com/W3TOTALCACHE');
17
+ define('W3TC_NEWS_FEED_URL', 'http://feeds.feedburner.com/W3EDGE');
18
  define('W3TC_README_URL', 'http://plugins.svn.wordpress.org/w3-total-cache/trunk/readme.txt');
19
  define('W3TC_SUPPORT_US_TIMEOUT', 2592000);
20
  define('W3TC_SUPPORT_REQUEST_URL', 'http://www.w3-edge.com/?w3tc_support_request=1');
21
+ define('NEWRELIC_SIGNUP_URL', 'http://newrelic.com/w3edge');
22
+ define('MAXCDN_SIGNUP_URL', 'http://tracking.maxcdn.com/c/15753/3982/378?u=https%3A%2F%2Fsecure.maxcdn.com%2F%3Fpackage%3Dstarter%26coupon%3Dw3tc');
23
+ // this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
24
+ if (!defined('EDD_W3EDGE_STORE_URL')) define('EDD_W3EDGE_STORE_URL', 'http://www.w3-edge.com/' );
25
+ if (!defined('EDD_W3EDGE_STORE_URL_PLUGIN')) define('EDD_W3EDGE_STORE_URL_PLUGIN', 'http://www.w3-edge.com/?w3tc_buy_pro_plugin' );
26
+
27
+ // the name of your product. This should match the download name in EDD exactly
28
+ define('EDD_W3EDGE_W3TC_NAME', 'W3 Total Cache Pro: Annual Subscription');
29
 
30
  define('W3TC_WIN', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'));
31
 
35
  define('W3TC_INC_WIDGET_DIR', W3TC_INC_DIR. '/widget');
36
  define('W3TC_INC_FUNCTIONS_DIR', W3TC_INC_DIR . '/functions');
37
  define('W3TC_INC_OPTIONS_DIR', W3TC_INC_DIR . '/options');
38
+ define('W3TC_INC_LIGHTBOX_DIR', W3TC_INC_DIR . '/lightbox');
39
+ define('W3TC_INC_POPUP_DIR', W3TC_INC_DIR . '/popup');
40
  define('W3TC_LIB_DIR', W3TC_DIR . '/lib');
41
  define('W3TC_LIB_W3_DIR', W3TC_LIB_DIR . '/W3');
42
  define('W3TC_LIB_MINIFY_DIR', W3TC_LIB_DIR . '/Minify');
78
 
79
 
80
  define('W3TC_WP_LOADER', (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/plugins') . '/w3tc-wp-loader.php');
81
+ if (!defined('W3TC_EXTENSION_DIR'))
82
+ define('W3TC_EXTENSION_DIR', (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/plugins'));
83
 
84
  w3_require_once(W3TC_INC_DIR . '/functions/compat.php');
85
  w3_require_once(W3TC_INC_DIR . '/functions/plugin.php');
126
  * @return bool
127
  */
128
  function w3_can_print_comment(&$buffer) {
129
+ if (function_exists('apply_filters'))
130
+ return apply_filters('w3tc_can_print_comment', w3_is_xml($buffer) && !defined('DOING_AJAX'));
131
+ return w3_is_xml($buffer) && !defined('DOING_AJAX');
132
  }
133
 
134
  /*
148
  $dir = '';
149
  if (substr(WP_CONTENT_DIR, 0, strlen(w3_get_site_root())) == w3_get_site_root()) {
150
  $dir = str_replace($site_url_ssl, '', w3_get_url_ssl(w3_get_site_url()));
151
+ $dir = trim($dir, '/\\');
152
  if ($dir)
153
  $dir = '/' . $dir;
154
+ $content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_site_root())), '/\\');
155
  }
156
  else
157
+ $content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_document_root())), '/\\');
158
 
159
  $url = $site_url_ssl . $dir . '/' . $content_path . $uri_from_wp_content;
160
 
638
 
639
  if ($home_url === null) {
640
  $config = w3_instance('W3_Config');
641
+ if (w3_is_multisite() && $config->get_boolean('common.force_master')) {
642
  $home_url = get_home_url();
643
  } else {
644
  // get_option is unusable here, it can cause problem when objCache isn't yet initialized
1233
  * Returns caching engine name
1234
  *
1235
  * @param $engine
1236
+ * @param $module
1237
+ *
1238
  * @return string
1239
  */
1240
  function w3_get_engine_name($engine, $module = '') {
1547
  /**
1548
  * @return string
1549
  */
1550
+ function w3_w3tc_release_version($config = null) {
1551
+ if (w3_is_enterprise($config))
1552
  return 'enterprise';
1553
+ if (w3_is_pro($config))
1554
  return 'pro';
1555
  return 'community';
1556
  }
1557
 
1558
+ /**
1559
+ * @param W3_Config $config
1560
+ * @return bool
1561
+ */
1562
+ function w3_is_pro($config = null) {
1563
+ $result = false;
1564
+ if ($config)
1565
+ $result = $config->get_string('plugin.type') == 'pro';
1566
+ return $result || defined('W3TC_PRO') && W3TC_PRO;
1567
  }
1568
 
1569
+ /**
1570
+ * @param W3_Config $config
1571
+ * @return bool
1572
+ */
1573
+ function w3_is_enterprise($config = null) {
1574
+ $result = false;
1575
+ if ($config)
1576
+ $result = $config->get_string('plugin.type') == 'enterprise';
1577
+ return $result || defined('W3TC_ENTERPRISE') && W3TC_ENTERPRISE;
1578
  }
inc/email/index.html CHANGED
File without changes
inc/email/minify_error_notification.html CHANGED
File without changes
inc/email/minify_error_notification.php CHANGED
File without changes
inc/email/support_request.php CHANGED
@@ -5,12 +5,12 @@
5
  <p>
6
  Date: <?php echo date('m/d/Y H:i:s'); ?><br />
7
  Version: <?php echo W3TC_VERSION; ?><br />
8
- URL: <a href="<?php echo htmlspecialchars($url); ?>"><?php echo htmlspecialchars($url); ?></a><br />
9
  Name: <?php echo htmlspecialchars($name); ?><br />
10
- E-Mail: <a href="mailto:<?php echo htmlspecialchars($email); ?>"><?php echo htmlspecialchars($email); ?></a><br />
11
 
12
  <?php if ($twitter): ?>
13
- Twitter: <a href="http://twitter.com/<?php echo htmlspecialchars($twitter); ?>"><?php echo htmlspecialchars($twitter); ?></a><br />
14
  <?php endif; ?>
15
 
16
  <?php if ($phone): ?>
@@ -18,11 +18,11 @@
18
  <?php endif; ?>
19
 
20
  <?php if ($forum_url): ?>
21
- Forum Topic URL: <a href="<?php echo htmlspecialchars($forum_url); ?>"><?php echo htmlspecialchars($forum_url); ?></a><br />
22
  <?php endif; ?>
23
 
24
  <?php if ($request_data_url): ?>
25
- Request data: <a href="<?php echo htmlspecialchars($request_data_url); ?>"><?php echo htmlspecialchars($request_data_url); ?></a><br />
26
  <?php endif; ?>
27
 
28
  Subject: <?php echo htmlspecialchars($subject); ?>
5
  <p>
6
  Date: <?php echo date('m/d/Y H:i:s'); ?><br />
7
  Version: <?php echo W3TC_VERSION; ?><br />
8
+ URL: <a href="<?php echo esc_attr($url); ?>"><?php echo htmlspecialchars($url); ?></a><br />
9
  Name: <?php echo htmlspecialchars($name); ?><br />
10
+ E-Mail: <a href="mailto:<?php echo esc_attr($email); ?>"><?php echo htmlspecialchars($email); ?></a><br />
11
 
12
  <?php if ($twitter): ?>
13
+ Twitter: <a href="http://twitter.com/<?php echo esc_attr($twitter); ?>"><?php echo htmlspecialchars($twitter); ?></a><br />
14
  <?php endif; ?>
15
 
16
  <?php if ($phone): ?>
18
  <?php endif; ?>
19
 
20
  <?php if ($forum_url): ?>
21
+ Forum Topic URL: <a href="<?php echo esc_attr($forum_url); ?>"><?php echo htmlspecialchars($forum_url); ?></a><br />
22
  <?php endif; ?>
23
 
24
  <?php if ($request_data_url): ?>
25
+ Request data: <a href="<?php echo esc_attr($request_data_url); ?>"><?php echo htmlspecialchars($request_data_url); ?></a><br />
26
  <?php endif; ?>
27
 
28
  Subject: <?php echo htmlspecialchars($subject); ?>
inc/error.php CHANGED
File without changes
inc/functions/activation.php CHANGED
@@ -51,7 +51,8 @@ function w3_activate_error($error) {
51
  */
52
  function w3_activation_error_on_exception($e) {
53
  $reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
54
- $reactivate_button = sprintf('%1$sre-activate plugin', '<input type="button" value="') . sprintf('" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
 
55
 
56
  w3_activate_error(sprintf(__('%s<br />then %s.', 'w3-total-cache'), $e->getMessage(), $reactivate_button));
57
  }
@@ -66,10 +67,13 @@ function w3_throw_on_read_error($path) {
66
  w3_require_once(W3TC_INC_DIR . '/functions/file.php');
67
 
68
  if (w3_check_open_basedir($path)) {
69
- $error = sprintf(__('<strong>%s</strong> could not be read, please run following command:<br /><strong style="color: #f00;">chmod 777 %s</strong>', 'w3-total-cache'), $path,
 
70
  (file_exists($path) ? $path : dirname($path)));
71
  } else {
72
- $error = sprintf(__('<strong>%s</strong> could not be read, <strong>open_basedir</strong> restriction in effect, please check your php.ini settings:<br /><strong style="color: #f00;">open_basedir = "%s"</strong>', 'w3-total-cache'), $path,
 
 
73
  ini_get('open_basedir'));
74
  }
75
 
@@ -96,7 +100,8 @@ function w3_throw_on_write_error($path, $chmod_dirs = array()) {
96
  (file_exists($path) ? $path : dirname($path)));
97
  }
98
  if (w3_check_open_basedir($path)) {
99
- $error = sprintf(__('<strong>%s</strong> could not be created, please run following command:<br />%s', 'w3-total-cache'), $path,
 
100
  $chmods);
101
  } else {
102
  $error = sprintf(__('<strong>%s</strong> could not be created, <strong>open_basedir
@@ -349,7 +354,8 @@ function w3_wp_delete_file($filename) {
349
  * Get WordPress filesystems credentials. Required for WP filesystem usage.
350
  * @param string $method Which method to use when creating
351
  * @param string $url Where to redirect after creation
352
- * @param bool|string $context path to folder that should be have filesystem credentials. If false WP_CONTENT_DIR is assumed
 
353
  * @throws FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
354
  */
355
  function w3_wp_request_filesystem_credentials($method = '', $url = '', $context = false) {
@@ -429,7 +435,7 @@ function w3_disable_maintenance_mode() {
429
 
430
  /**
431
  * Used to display SelfTestExceptions in UI
432
- * @param SelfTestExceptions
433
  * @return array(before_errors = [], required_changes =>, later_errors => [])
434
  **/
435
  function w3_parse_selftest_exceptions($exs) {
@@ -442,56 +448,56 @@ function w3_parse_selftest_exceptions($exs) {
442
  $operation_error_already_shown = false;
443
 
444
  foreach ($exceptions as $ex) {
445
- if (!$operation_error_already_shown &&
446
- $ex instanceof FilesystemOperationException) {
447
- $m = $ex->getMessage();
448
- if (strlen($m) > 0) {
449
- $before_errors[] = $m;
450
- // if multiple operations failed when
451
- // they tried to fix environment - show only first
452
- // otherwise can duplication information about
453
- // absense of permissions
454
- $operation_error_already_shown = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  }
456
- }
457
-
458
- if ($ex instanceof FilesystemWriteException) {
459
- $required_changes .=
460
- sprintf(__('Create the <strong>%s</strong> file and paste the following text into it: <textarea>%s</textarea> <br />', 'w3-total-cache'), $ex->filename(), $ex->file_contents());
461
- } else if ($ex instanceof FilesystemModifyException) {
462
- $modification_content = $ex->file_contents();
463
- if (strlen($modification_content) > 0)
464
- $modification_content =
465
- '<textarea style="height: 100px; width: 100%;">' .
466
- $modification_content . '</textarea>';
467
- $required_changes .=
468
- $ex->modification_description() .
469
- $modification_content .
470
- '<br />';
471
- } else if ($ex instanceof FilesystemCopyException) {
472
- $commands .= 'cp ' . $ex->source_filename() . ' ' .
473
- $ex->destination_filename() . '<br />';
474
- } else if ($ex instanceof FilesystemMkdirException) {
475
- $commands .= 'mkdir ' . $ex->folder() . '<br />';
476
- $commands .= 'chmod 777 ' . $ex->folder() . '<br />';
477
- } else if ($ex instanceof FilesystemRmException) {
478
- $commands .= 'rm ' . $ex->filename() . '<br />';
479
- } else if ($ex instanceof FilesystemRmdirException) {
480
- $commands .= 'rm -rf ' . $ex->folder() . '<br />';
481
- } else if ($ex instanceof FilesystemChmodException) {
482
- $commands .= 'chmod 777 ' . $ex->filename() . '<br />';
483
  } else if ($ex instanceof SelfTestFailedException) {
484
  $t = $ex->technical_message();
485
  if (strlen($t) > 0) {
486
- $t = '<br />' .
487
- '<a class="w3tc_read_technical_info" href="#">' .
488
- __('Technical info', 'w3-total-cache').'</a>' .
489
- '<div class="w3tc_technical_info" style="display: none">' .
490
  $t . '</div>';
491
  }
492
 
493
- $later_errors[] =
494
- $ex->getMessage() . $t;
495
  } else {
496
  // unknown command
497
  $later_errors[] = $ex->getMessage();
@@ -696,6 +702,9 @@ class SelfTestExceptions extends Exception {
696
  }
697
  }
698
 
 
 
 
699
  public function exceptions() {
700
  return $this->exceptions;
701
  }
@@ -733,4 +742,64 @@ class FileOperationException extends Exception {
733
  {
734
  return $this->operation;
735
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
  }
51
  */
52
  function w3_activation_error_on_exception($e) {
53
  $reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
54
+ $reactivate_button = sprintf('%1$sre-activate plugin', '<input type="button" value="') .
55
+ sprintf('" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
56
 
57
  w3_activate_error(sprintf(__('%s<br />then %s.', 'w3-total-cache'), $e->getMessage(), $reactivate_button));
58
  }
67
  w3_require_once(W3TC_INC_DIR . '/functions/file.php');
68
 
69
  if (w3_check_open_basedir($path)) {
70
+ $error = sprintf(__('<strong>%s</strong> could not be read, please run following command:<br />
71
+ <strong style="color: #f00;">chmod 777 %s</strong>', 'w3-total-cache'), $path,
72
  (file_exists($path) ? $path : dirname($path)));
73
  } else {
74
+ $error = sprintf(__('<strong>%s</strong> could not be read, <strong>open_basedir</strong> restriction in effect,
75
+ please check your php.ini settings:<br /><strong style="color: #f00;">open_basedir = "%s"</strong>',
76
+ 'w3-total-cache'), $path,
77
  ini_get('open_basedir'));
78
  }
79
 
100
  (file_exists($path) ? $path : dirname($path)));
101
  }
102
  if (w3_check_open_basedir($path)) {
103
+ $error = sprintf(__('<strong>%s</strong> could not be created, please run following command:<br />%s',
104
+ 'w3-total-cache'), $path,
105
  $chmods);
106
  } else {
107
  $error = sprintf(__('<strong>%s</strong> could not be created, <strong>open_basedir
354
  * Get WordPress filesystems credentials. Required for WP filesystem usage.
355
  * @param string $method Which method to use when creating
356
  * @param string $url Where to redirect after creation
357
+ * @param bool|string $context path to folder that should be have filesystem credentials.
358
+ * If false WP_CONTENT_DIR is assumed
359
  * @throws FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
360
  */
361
  function w3_wp_request_filesystem_credentials($method = '', $url = '', $context = false) {
435
 
436
  /**
437
  * Used to display SelfTestExceptions in UI
438
+ * @param SelfTestExceptions $exs
439
  * @return array(before_errors = [], required_changes =>, later_errors => [])
440
  **/
441
  function w3_parse_selftest_exceptions($exs) {
448
  $operation_error_already_shown = false;
449
 
450
  foreach ($exceptions as $ex) {
451
+ if ($ex instanceof FilesystemOperationException) {
452
+ if (!$operation_error_already_shown) {
453
+ $m = $ex->getMessage();
454
+ if (strlen($m) > 0) {
455
+ $before_errors[] = $m;
456
+ // if multiple operations failed when
457
+ // they tried to fix environment - show only first
458
+ // otherwise can duplication information about
459
+ // absense of permissions
460
+ $operation_error_already_shown = true;
461
+ }
462
+ if ($ex instanceof FilesystemWriteException) {
463
+ $required_changes .=
464
+ sprintf(__('Create the <strong>%s</strong> file and paste the following text into it:
465
+ <textarea>%s</textarea> <br />', 'w3-total-cache'), $ex->filename(), esc_textarea($ex->file_contents()));
466
+ } else if ($ex instanceof FilesystemModifyException) {
467
+ $modification_content = $ex->file_contents();
468
+ if (strlen($modification_content) > 0)
469
+ $modification_content =
470
+ '<textarea style="height: 100px; width: 100%;">' .
471
+ esc_textarea($modification_content) . '</textarea>';
472
+ $required_changes .=
473
+ $ex->modification_description() .
474
+ $modification_content .
475
+ '<br />';
476
+ } else if ($ex instanceof FilesystemCopyException) {
477
+ $commands .= 'cp ' . $ex->source_filename() . ' ' .
478
+ $ex->destination_filename() . '<br />';
479
+ } else if ($ex instanceof FilesystemMkdirException) {
480
+ $commands .= 'mkdir ' . $ex->folder() . '<br />';
481
+ $commands .= 'chmod 777 ' . $ex->folder() . '<br />';
482
+ } else if ($ex instanceof FilesystemRmException) {
483
+ $commands .= 'rm ' . $ex->filename() . '<br />';
484
+ } else if ($ex instanceof FilesystemRmdirException) {
485
+ $commands .= 'rm -rf ' . $ex->folder() . '<br />';
486
+ } else if ($ex instanceof FilesystemChmodException) {
487
+ $commands .= 'chmod 777 ' . $ex->filename() . '<br />';
488
+ }
489
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  } else if ($ex instanceof SelfTestFailedException) {
491
  $t = $ex->technical_message();
492
  if (strlen($t) > 0) {
493
+ $t = '<br />' .
494
+ '<a class="w3tc_read_technical_info" href="#">' .
495
+ __('Technical info', 'w3-total-cache').'</a>' .
496
+ '<div class="w3tc_technical_info" style="display: none">' .
497
  $t . '</div>';
498
  }
499
 
500
+ $later_errors[] = $ex->getMessage() . $t;
 
501
  } else {
502
  // unknown command
503
  $later_errors[] = $ex->getMessage();
702
  }
703
  }
704
 
705
+ /**
706
+ * @return Exception[]
707
+ */
708
  public function exceptions() {
709
  return $this->exceptions;
710
  }
742
  {
743
  return $this->operation;
744
  }
745
+ }
746
+
747
+ /**
748
+ * @return string[] error messages
749
+ */
750
+ function w3_deactivate_plugin() {
751
+ $errors = array();
752
+ try {
753
+ $environment = w3_instance('W3_AdminEnvironment');
754
+ $environment->fix_after_deactivation();
755
+ deactivate_plugins(plugin_basename(W3TC_FILE));
756
+ } catch (SelfTestExceptions $exs) {
757
+ $r = w3_parse_selftest_exceptions($exs);
758
+
759
+ foreach ($r['before_errors'] as $e)
760
+ $errors[] = $e;
761
+
762
+ if (strlen($r['required_changes']) > 0) {
763
+ $changes_style = 'border: 1px solid black; ' .
764
+ 'background: white; ' .
765
+ 'margin: 10px 30px 10px 30px; ' .
766
+ 'padding: 10px; display: none';
767
+ $ftp_style = 'border: 1px solid black; background: white; ' .
768
+ 'margin: 10px 30px 10px 30px; ' .
769
+ 'padding: 10px; display: none';
770
+ $ftp_form = str_replace('class="wrap"', '',
771
+ $exs->credentials_form());
772
+ $ftp_form = str_replace('<fieldset>', '', $ftp_form);
773
+ $ftp_form = str_replace('</fieldset>', '', $ftp_form);
774
+ $ftp_form = str_replace('id="upgrade" class="button"',
775
+ 'id="upgrade" class="button w3tc-button-save"', $ftp_form);
776
+ $error = sprintf( __('<strong>W3 Total Cache Error:</strong>
777
+ Files and directories could not be automatically
778
+ deleted.
779
+ <table>
780
+ <tr>
781
+ <td>Please execute commands manually</td>
782
+ <td>
783
+ %s
784
+ </td>
785
+ </tr>
786
+ <tr>
787
+ <td>or use FTP form to allow
788
+ <strong>W3 Total Cache</strong> make it automatically.
789
+ </td>
790
+ <td>
791
+ %s
792
+ </td>
793
+ </tr></table>', 'w3-total-cache'),
794
+ w3_button(__('View required changes', 'w3-total-cache'), '', 'w3tc-show-required-changes'),
795
+ w3_button(__('Update via FTP', 'w3-total-cache'), '', 'w3tc-show-ftp-form')
796
+ ) . '<div class="w3tc-required-changes" style="' .
797
+ $changes_style . '">' . $r['required_changes'] . '</div>' .
798
+ '<div class="w3tc-ftp-form" style="' . $ftp_style . '">' .
799
+ $ftp_form . '</div>';
800
+
801
+ $errors[] = $error;
802
+ }
803
+ return $errors;
804
+ }
805
  }
inc/functions/admin.php ADDED
@@ -0,0 +1,678 @@