Version Description
*Removed Clef and tested against WordPress 4.8
Download this release
Release Info
Developer | a2hosting |
Plugin | A2 Optimized WP |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- A2_Optimized_Optimizations.php +599 -652
- a2-optimized.php +1 -1
- readme.txt +5 -2
A2_Optimized_Optimizations.php
CHANGED
@@ -1,384 +1,378 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
*/
|
8 |
|
9 |
-
class A2_Optimized_Optimizations
|
10 |
-
|
11 |
|
12 |
-
|
|
|
|
|
13 |
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
$this->thisclass = $thisclass;
|
18 |
-
}
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
$public_opts = $this->get_public_optimizations();
|
23 |
-
$private_opts = $this->get_private_optimizations();
|
24 |
-
return array_merge($public_opts, $private_opts);
|
25 |
-
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
'name' => 'Page Caching with W3 Total Cache',
|
35 |
-
'plugin' => 'W3 Total Cache',
|
36 |
-
'configured' => false,
|
37 |
-
'description' => 'Utilize W3 Total Cache to make the site faster by caching pages as static content. Cache: a copy of rendered dynamic pages will be saved by the server so that the next user does not need to wait for the server to generate another copy.',
|
38 |
-
'is_configured' => function (&$item) use (&$thisclass) {
|
39 |
-
$w3tc = $thisclass->get_w3tc_config();
|
40 |
-
if ($w3tc['pgcache.enabled']) {
|
41 |
-
$item['configured'] = true;
|
42 |
-
$permalink_structure = get_option('permalink_structure');
|
43 |
-
$vars = array();
|
44 |
-
if ($w3tc['pgcache.engine'] == 'apc') {
|
45 |
-
if ($permalink_structure == '') {
|
46 |
-
$vars['pgcache.engine'] = 'file';
|
47 |
-
} else {
|
48 |
-
$vars['pgcache.engine'] = 'file_generic';
|
49 |
-
}
|
50 |
-
} else {
|
51 |
-
if ($permalink_structure == '' && $w3tc['pgcache.engine'] != 'file') {
|
52 |
-
$vars['pgcache.engine'] = 'file';
|
53 |
-
} elseif ($permalink_structure != '' && $w3tc['pgcache.engine'] == 'file') {
|
54 |
-
$vars['pgcache.engine'] = 'file_generic';
|
55 |
-
}
|
56 |
-
}
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
'db_cache' => array(
|
76 |
-
'slug' => 'db_cache',
|
77 |
-
'name' => 'DB Caching with W3 Total Cache',
|
78 |
-
'plugin' => 'W3 Total Cache',
|
79 |
-
'configured' => false,
|
80 |
-
'description' => 'Speed up the site by storing the responses of common database queries in a cache.',
|
81 |
-
'is_configured' => function (&$item) use (&$thisclass) {
|
82 |
-
$w3tc = $thisclass->get_w3tc_config();
|
83 |
-
if ($w3tc['dbcache.enabled']) {
|
84 |
-
$vars = array();
|
85 |
-
$item['configured'] = true;
|
86 |
-
if (class_exists('W3_Config')) {
|
87 |
-
if (class_exists('WooCommerce')) {
|
88 |
-
if (array_search('_wc_session_', $w3tc['dbcache.reject.sql']) === false) {
|
89 |
-
$vars['dbcache.reject.sql'] = $w3tc['dbcache.reject.sql'];
|
90 |
-
$vars['dbcache.reject.sql'][] = '_wc_session_';
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
if (count($vars) != 0) {
|
95 |
-
$thisclass->update_w3tc($vars);
|
96 |
-
}
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
} else {
|
324 |
-
if ($thisclass->get_lockdown() == false) {
|
325 |
-
$thisclass->set_lockdown(true);
|
326 |
-
}
|
327 |
-
$item['configured'] = true;
|
328 |
-
$thisclass->set_install_status('lock-editing', true);
|
329 |
-
}
|
330 |
-
},
|
331 |
-
'enable' => function () use (&$thisclass) {
|
332 |
-
$thisclass->set_lockdown(true);
|
333 |
-
$thisclass->write_wp_config();
|
334 |
-
},
|
335 |
-
'disable' => function () use (&$thisclass) {
|
336 |
-
$thisclass->set_lockdown(false);
|
337 |
-
$thisclass->write_wp_config();
|
338 |
-
}
|
339 |
-
),
|
340 |
-
'wp-login' => array(
|
341 |
-
'name' => 'Login URL Change',
|
342 |
-
'slug' => 'wp-login',
|
343 |
-
'premium' => true,
|
344 |
-
'plugin' => 'Rename wp-login.php',
|
345 |
-
'configured' => false,
|
346 |
-
'kb' => 'http://www.a2hosting.com/kb/security/application-security/wordpress-security#a-namemethodRenameLoginPageaMethod-3.3A-Change-the-WordPress-login-URL',
|
347 |
-
'description' => '
|
348 |
<p>Change the URL of your login page to make it harder for bots to find it to brute force attack.</p>
|
349 |
',
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
<ul>
|
383 |
<li>Turbo Web Hosting servers compile .htaccess files to make speed improvements. Any changes to .htaccess files are immediately re-compiled.</li>
|
384 |
<li>Turbo Web Hosting servers have their own PHP API that provides speed improvements over FastCGI and PHP-FPM (FastCGI Process Manager). </li>
|
@@ -387,16 +381,16 @@ class A2_Optimized_Optimizations
|
|
387 |
<li>Turbo Web Hosting servers have a built-in caching engine for Full Page Cache and Edge Side Includes.</li>
|
388 |
</ul>
|
389 |
',
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
<ul>
|
401 |
<li>Extremely fast and powerful caching system.</li>
|
402 |
<li>Store frequently used database queries and WordPress objects in Memcached.</li>
|
@@ -404,46 +398,44 @@ class A2_Optimized_Optimizations
|
|
404 |
<li>Take advantage of A2 Hosting's one-click memcached configuration for WordPress.</li>
|
405 |
</ul>
|
406 |
',
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
-
|
413 |
-
|
|
|
|
|
|
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
419 |
-
return $a2opt_priv->get_optimizations($this->thisclass);
|
420 |
-
} else {
|
421 |
-
return array();
|
422 |
-
}
|
423 |
-
}
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
$public_opts = $this->get_public_advanced();
|
428 |
-
$private_opts = $this->get_private_advanced();
|
429 |
-
return array_merge($public_opts, $private_opts);
|
430 |
-
}
|
431 |
|
432 |
-
|
433 |
-
|
434 |
-
$thisclass = $this->thisclass;
|
435 |
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
<p>
|
448 |
Plugin that actively keeps track of your WP install and sends you alerts if your site falls below certain criteria.
|
449 |
The GTMetrix plugin requires an account with <a href="http://gtmetrix.com/" >gtmetrix.com</a>
|
@@ -452,135 +444,91 @@ class A2_Optimized_Optimizations
|
|
452 |
<b>Use this plugin only if your site is experiencing issues with slow load times.</b><br><b style="color:red">The GTMetrix plugin will slow down your site.</b>
|
453 |
</p>
|
454 |
',
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
<p>See which plugins are slowing down your site.
|
498 |
This plugin creates a performance report for your site.</p>
|
499 |
<p>
|
500 |
<b>Use this plugin only if your site is experiencing issues with slow load times.</b><br><b style="color:red">The P3 plugin will slow down your site.</b>
|
501 |
</p>
|
502 |
',
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
'plugin_slug' => 'wpclef',
|
541 |
-
'file' => 'wpclef/wpclef.php',
|
542 |
-
'configured' => false,
|
543 |
-
'not_configured_links' => array(),
|
544 |
-
'configured_links' => array(
|
545 |
-
'Configure Clef' => 'admin.php?page=clef'
|
546 |
-
),
|
547 |
-
'partially_configured_links' => array(
|
548 |
-
'Configure Clef' => 'admin.php?page=clef'
|
549 |
-
),
|
550 |
-
'partially_configured_message' => 'Click "Configure Clef" to complete the configuration of Clef.',
|
551 |
-
//'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/adding-two-factor-authentication-with-clef',
|
552 |
-
'is_configured' => function (&$item) use (&$thisclass) {
|
553 |
-
$clef_options = get_option('wpclef');
|
554 |
-
if (is_plugin_active($item['file']) && isset($clef_options['clef_settings_app_id']) && isset($clef_options['clef_settings_app_secret'])) {
|
555 |
-
$item['configured'] = true;
|
556 |
-
$thisclass->set_install_status('clef', true);
|
557 |
-
} elseif (is_plugin_active($item['file'])) {
|
558 |
-
$item['partially_configured'] = true;
|
559 |
-
} else {
|
560 |
-
$thisclass->set_install_status('clef', false);
|
561 |
-
}
|
562 |
-
},
|
563 |
-
'enable' => function ($slug) use (&$thisclass) {
|
564 |
-
$item = $thisclass->get_advanced_optimizations();
|
565 |
-
$item = $item[$slug];
|
566 |
-
if (!isset($thisclass->plugin_list[$item['file']])) {
|
567 |
-
$thisclass->install_plugin($item['plugin_slug']);
|
568 |
-
}
|
569 |
-
if (!is_plugin_active($item['file'])) {
|
570 |
-
$thisclass->activate_plugin($item['file']);
|
571 |
-
}
|
572 |
-
},
|
573 |
-
'disable' => function ($slug) use (&$thisclass) {
|
574 |
-
$item = $thisclass->get_advanced_optimizations();
|
575 |
-
$item = $item[$slug];
|
576 |
-
$thisclass->deactivate_plugin($item['file']);
|
577 |
-
}
|
578 |
-
),
|
579 |
-
'cloudflare' => array(
|
580 |
-
'slug' => 'cloudflare',
|
581 |
-
'name' => 'CloudFlare',
|
582 |
-
'premium'=>true,
|
583 |
-
'description' => '
|
584 |
<p>
|
585 |
CloudFlare is a free global CDN and DNS provider that can speed up and protect any site online.
|
586 |
</p>
|
@@ -599,131 +547,130 @@ class A2_Optimized_Optimizations
|
|
599 |
Host with A2 Hosting to take advantage of one click CloudFlare configuration.
|
600 |
</div>
|
601 |
',
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
|
609 |
-
|
610 |
-
|
|
|
611 |
|
612 |
-
|
613 |
-
|
614 |
-
if (class_exists("A2_Optimized_Private_Optimizations")) {
|
615 |
-
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
616 |
-
return $a2opt_priv->get_advanced($this->thisclass);
|
617 |
-
} else {
|
618 |
-
return array();
|
619 |
-
}
|
620 |
-
}
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
'title' => 'RSS Post Limit',
|
643 |
-
'description' => 'The number of posts from external feeds is set greater than 5. This could be slowing down page loads.',
|
644 |
-
'type' => 'numeric',
|
645 |
-
'threshold_type' => '>',
|
646 |
-
'threshold' => 5,
|
647 |
-
'config_url' => admin_url() . 'options-reading.php'
|
648 |
-
),
|
649 |
-
'show_on_front' => array(
|
650 |
-
'title' => 'Recent Posts showing on home page',
|
651 |
-
'description' => 'Speed up your home page by selecting a static page to display.',
|
652 |
-
'type' => 'text',
|
653 |
-
'threshold_type' => '=',
|
654 |
-
'threshold' => 'posts',
|
655 |
-
'config_url' => admin_url() . 'options-reading.php'
|
656 |
-
),
|
657 |
-
'permalink_structure' => array(
|
658 |
-
'title' => 'Permalink Structure',
|
659 |
-
'description' => 'To fully optimize page caching with "Disk Enhanced" mode:<br>you must set a permalink structure other than "Default".',
|
660 |
-
'type' => 'text',
|
661 |
-
'threshold_type' => '=',
|
662 |
-
'threshold' => '',
|
663 |
-
'config_url' => admin_url() . 'options-permalink.php'
|
664 |
-
)
|
665 |
-
),
|
666 |
-
'Advanced Warnings' => array(
|
667 |
-
'themes' => array(
|
668 |
-
'is_warning' => function () {
|
669 |
-
$themes = wp_get_themes();
|
670 |
-
switch (count($themes)) {
|
671 |
-
case 1:
|
672 |
-
return false;
|
673 |
-
case 2:
|
674 |
-
$theme = wp_get_theme();
|
675 |
-
if ($theme->get('Template') != '') {
|
676 |
-
return false;
|
677 |
-
}
|
678 |
-
}
|
679 |
-
return true;
|
680 |
-
},
|
681 |
-
'title' => 'Unused Themes',
|
682 |
-
'description' => 'One or more unused themes are installed. Unused themes should be deleted. For more information read the Wordpress.org Codex on <a target="_blank" href="http://codex.wordpress.org/WordPress_Housekeeping#Theme_Housekeeping">WordPress Housekeeping</a>',
|
683 |
-
'config_url' => admin_url() . 'themes.php'
|
684 |
-
),
|
685 |
-
'a2_hosting' => array(
|
686 |
-
'title' => 'Not Hosted with A2 Hosting',
|
687 |
-
'description' => 'Get faster page load times and more optimizations when you <a href="https://www.a2hosting.com/wordpress-hosting?utm_source=A2%20Optimized&utm_medium=Referral&utm_campaign=A2%20Optimized" target="_blank">host with A2 Hosting</a>.',
|
688 |
-
'is_warning' => function () {
|
689 |
-
if(is_dir("/opt/a2-optimized"))
|
690 |
-
return false;
|
691 |
-
return true;
|
692 |
-
},
|
693 |
-
'config_url' => "https://www.a2hosting.com/wordpress-hosting?utm_source=A2%20Optimized&utm_medium=Referral&utm_campaign=A2%20Optimized"
|
694 |
-
)
|
695 |
-
),
|
696 |
-
'Bad Plugins' => array(
|
697 |
-
'wp-super-cache',
|
698 |
-
'wp-file-cache',
|
699 |
-
'wordfence',
|
700 |
-
'wp-db-backup',
|
701 |
-
//'WP DB Manager',
|
702 |
-
//'BackupWordPress',
|
703 |
-
//'Broken Link Checker',
|
704 |
-
//'MyReviewPlugin',
|
705 |
-
//'LinkMan',
|
706 |
-
//'Google XML Sitemaps',
|
707 |
-
//'Fuzzy SEO Booster',
|
708 |
-
//'Tweet Blender',
|
709 |
-
//'Dynamic Related Posts',
|
710 |
-
//'SEO Auto Links & Related Posts',
|
711 |
-
//'Yet Another Related Posts Plugin',
|
712 |
-
//'Similar Posts',
|
713 |
-
//'Contextual Related Posts',
|
714 |
|
715 |
-
|
716 |
-
|
717 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
723 |
-
return $a2opt_priv->get_warnings($this->thisclass);
|
724 |
-
} else {
|
725 |
-
return array();
|
726 |
-
}
|
727 |
-
}
|
728 |
|
729 |
-
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Author: Benjamin Cool
|
5 |
+
Author URI: https://www.a2hosting.com/
|
6 |
+
License: GPLv2 or Later
|
7 |
*/
|
8 |
|
9 |
+
class A2_Optimized_Optimizations {
|
10 |
+
private $thisclass;
|
11 |
|
12 |
+
public function __construct($thisclass) {
|
13 |
+
$this->thisclass = $thisclass;
|
14 |
+
}
|
15 |
|
16 |
+
public function get_optimizations() {
|
17 |
+
$public_opts = $this->get_public_optimizations();
|
18 |
+
$private_opts = $this->get_private_optimizations();
|
19 |
|
20 |
+
return array_merge($public_opts, $private_opts);
|
21 |
+
}
|
|
|
|
|
22 |
|
23 |
+
protected function get_public_optimizations() {
|
24 |
+
$thisclass = $this->thisclass;
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
return [
|
27 |
+
'page_cache' => [
|
28 |
+
'slug' => 'page_cache',
|
29 |
+
'name' => 'Page Caching with W3 Total Cache',
|
30 |
+
'plugin' => 'W3 Total Cache',
|
31 |
+
'configured' => false,
|
32 |
+
'description' => 'Utilize W3 Total Cache to make the site faster by caching pages as static content. Cache: a copy of rendered dynamic pages will be saved by the server so that the next user does not need to wait for the server to generate another copy.',
|
33 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
34 |
+
$w3tc = $thisclass->get_w3tc_config();
|
35 |
+
if ($w3tc['pgcache.enabled']) {
|
36 |
+
$item['configured'] = true;
|
37 |
+
$permalink_structure = get_option('permalink_structure');
|
38 |
+
$vars = [];
|
39 |
+
if ($w3tc['pgcache.engine'] == 'apc') {
|
40 |
+
if ($permalink_structure == '') {
|
41 |
+
$vars['pgcache.engine'] = 'file';
|
42 |
+
} else {
|
43 |
+
$vars['pgcache.engine'] = 'file_generic';
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
if ($permalink_structure == '' && $w3tc['pgcache.engine'] != 'file') {
|
47 |
+
$vars['pgcache.engine'] = 'file';
|
48 |
+
} elseif ($permalink_structure != '' && $w3tc['pgcache.engine'] == 'file') {
|
49 |
+
$vars['pgcache.engine'] = 'file_generic';
|
50 |
+
}
|
51 |
+
}
|
52 |
|
53 |
+
if (count($vars) != 0) {
|
54 |
+
$thisclass->update_w3tc($vars);
|
55 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
$thisclass->set_install_status('page_cache', true);
|
58 |
+
} else {
|
59 |
+
$thisclass->set_install_status('page_cache', false);
|
60 |
+
}
|
61 |
+
},
|
62 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
63 |
+
'disable' => function () use (&$thisclass) {
|
64 |
+
$thisclass->disable_w3tc_page_cache();
|
65 |
+
},
|
66 |
+
'enable' => function () use (&$thisclass) {
|
67 |
+
$thisclass->enable_w3tc_page_cache();
|
68 |
+
}
|
69 |
+
],
|
70 |
+
'db_cache' => [
|
71 |
+
'slug' => 'db_cache',
|
72 |
+
'name' => 'DB Caching with W3 Total Cache',
|
73 |
+
'plugin' => 'W3 Total Cache',
|
74 |
+
'configured' => false,
|
75 |
+
'description' => 'Speed up the site by storing the responses of common database queries in a cache.',
|
76 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
77 |
+
$w3tc = $thisclass->get_w3tc_config();
|
78 |
+
if ($w3tc['dbcache.enabled']) {
|
79 |
+
$vars = [];
|
80 |
+
$item['configured'] = true;
|
81 |
+
if (class_exists('W3_Config')) {
|
82 |
+
if (class_exists('WooCommerce')) {
|
83 |
+
if (array_search('_wc_session_', $w3tc['dbcache.reject.sql']) === false) {
|
84 |
+
$vars['dbcache.reject.sql'] = $w3tc['dbcache.reject.sql'];
|
85 |
+
$vars['dbcache.reject.sql'][] = '_wc_session_';
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
if (count($vars) != 0) {
|
90 |
+
$thisclass->update_w3tc($vars);
|
91 |
+
}
|
92 |
|
93 |
+
$thisclass->set_install_status('db_cache', true);
|
94 |
+
} else {
|
95 |
+
$thisclass->set_install_status('db_cache', false);
|
96 |
+
}
|
97 |
+
},
|
98 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
99 |
+
'disable' => function () use (&$thisclass) {
|
100 |
+
$thisclass->disable_w3tc_db_cache();
|
101 |
+
},
|
102 |
+
'enable' => function () use (&$thisclass) {
|
103 |
+
$thisclass->enable_w3tc_db_cache();
|
104 |
+
}
|
105 |
+
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
'object_cache' => [
|
108 |
+
'slug' => 'object_cache',
|
109 |
+
'name' => 'Object Caching with W3 Total Cache',
|
110 |
+
'plugin' => 'W3 Total Cache',
|
111 |
+
'configured' => false,
|
112 |
+
'description' => 'Store a copy of widgets and menu bars in cache to reduce the time it takes to render pages.',
|
113 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
114 |
+
$w3tc = $thisclass->get_w3tc_config();
|
115 |
+
if ($w3tc['objectcache.enabled']) {
|
116 |
+
$item['configured'] = true;
|
117 |
+
$thisclass->set_install_status('object_cache', true);
|
118 |
+
} else {
|
119 |
+
$thisclass->set_install_status('object_cache', false);
|
120 |
+
}
|
121 |
+
},
|
122 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
123 |
+
'disable' => function () use (&$thisclass) {
|
124 |
+
$thisclass->disable_w3tc_object_cache();
|
125 |
+
},
|
126 |
+
'enable' => function () use (&$thisclass) {
|
127 |
+
$thisclass->enable_w3tc_object_cache();
|
128 |
+
}
|
129 |
+
],
|
130 |
|
131 |
+
'browser_cache' => [
|
132 |
+
'slug' => 'browser_cache',
|
133 |
+
'name' => 'Browser Caching with W3 Total Cache',
|
134 |
+
'plugin' => 'W3 Total Cache',
|
135 |
+
'configured' => false,
|
136 |
+
'description' => 'Add Rules to the web server to tell the visitor's browser to store a copy of static files to reduce the load time pages requested after the first page is loaded.',
|
137 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
138 |
+
$w3tc = $thisclass->get_w3tc_config();
|
139 |
+
if ($w3tc['browsercache.enabled']) {
|
140 |
+
$item['configured'] = true;
|
141 |
+
$thisclass->set_install_status('browser_cache', true);
|
142 |
+
} else {
|
143 |
+
$thisclass->set_install_status('browser_cache', false);
|
144 |
+
}
|
145 |
+
},
|
146 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
147 |
+
'disable' => function () use (&$thisclass) {
|
148 |
+
$thisclass->disable_w3tc_browser_cache();
|
149 |
+
},
|
150 |
+
'enable' => function () use (&$thisclass) {
|
151 |
+
$thisclass->enable_w3tc_browser_cache();
|
152 |
+
}
|
153 |
+
],
|
154 |
|
155 |
+
'minify' => [
|
156 |
+
'name' => 'Minify HTML Pages',
|
157 |
+
'slug' => 'minify',
|
158 |
+
'plugin' => 'W3 Total Cache',
|
159 |
+
'configured' => false,
|
160 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
161 |
+
'description' => 'Removes extra spaces,tabs and line breaks in the HTML to reduce the size of the files sent to the user.',
|
162 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
163 |
+
$w3tc = $thisclass->get_w3tc_config();
|
164 |
+
if ($w3tc['minify.enabled'] && $w3tc['minify.html.enable']) {
|
165 |
+
$item['configured'] = true;
|
166 |
+
$thisclass->set_install_status('minify-html', true);
|
167 |
+
} else {
|
168 |
+
$thisclass->set_install_status('minify-html', false);
|
169 |
+
}
|
170 |
+
},
|
171 |
+
'enable' => function () use (&$thisclass) {
|
172 |
+
$thisclass->enable_html_minify();
|
173 |
+
},
|
174 |
+
'disable' => function () use (&$thisclass) {
|
175 |
+
$thisclass->disable_html_minify();
|
176 |
+
}
|
177 |
+
],
|
178 |
+
'css_minify' => [
|
179 |
+
'name' => 'Minify CSS Files',
|
180 |
+
'slug' => 'css_minify',
|
181 |
+
'plugin' => 'W3 Total Cache',
|
182 |
+
'configured' => false,
|
183 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
184 |
+
'description' => 'Makes your site faster by condensing css files into a single downloadable file and by removing extra space in CSS files to make them smaller.',
|
185 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
186 |
+
$w3tc = $thisclass->get_w3tc_config();
|
187 |
+
if ($w3tc['minify.css.enable']) {
|
188 |
+
$item['configured'] = true;
|
189 |
+
$thisclass->set_install_status('minify-css', true);
|
190 |
+
} else {
|
191 |
+
$thisclass->set_install_status('minify-css', false);
|
192 |
+
}
|
193 |
+
},
|
194 |
+
'enable' => function () use (&$thisclass) {
|
195 |
+
$thisclass->update_w3tc([
|
196 |
+
'minify.css.enable' => true,
|
197 |
+
'minify.enabled' => true,
|
198 |
+
'minify.auto' => 0,
|
199 |
+
'minify.engine' => 'file'
|
200 |
+
]);
|
201 |
+
},
|
202 |
+
'disable' => function () use (&$thisclass) {
|
203 |
+
$thisclass->update_w3tc([
|
204 |
+
'minify.css.enable' => false,
|
205 |
+
'minify.auto' => 0
|
206 |
+
]);
|
207 |
+
}
|
208 |
+
],
|
209 |
+
'js_minify' => [
|
210 |
+
'name' => 'Minify JS Files',
|
211 |
+
'slug' => 'js_minify',
|
212 |
+
'plugin' => 'W3 Total Cache',
|
213 |
+
'configured' => false,
|
214 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
215 |
+
'description' => 'Makes your site faster by condensing JavaScript files into a single downloadable file and by removing extra space in JavaScript files to make them smaller.',
|
216 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
217 |
+
$w3tc = $thisclass->get_w3tc_config();
|
218 |
+
if ($w3tc['minify.js.enable']) {
|
219 |
+
$item['configured'] = true;
|
220 |
+
$thisclass->set_install_status('minify-js', true);
|
221 |
+
} else {
|
222 |
+
$thisclass->set_install_status('minify-js', false);
|
223 |
+
}
|
224 |
+
},
|
225 |
+
'enable' => function () use (&$thisclass) {
|
226 |
+
$thisclass->update_w3tc([
|
227 |
+
'minify.js.enable' => true,
|
228 |
+
'minify.enabled' => true,
|
229 |
+
'minify.auto' => 0,
|
230 |
+
'minify.engine' => 'file'
|
231 |
+
]);
|
232 |
+
},
|
233 |
+
'disable' => function () use (&$thisclass) {
|
234 |
+
$thisclass->update_w3tc([
|
235 |
+
'minify.js.enable' => false,
|
236 |
+
'minify.auto' => 0
|
237 |
+
]);
|
238 |
+
}
|
239 |
+
],
|
240 |
+
'gzip' => [
|
241 |
+
'name' => 'Gzip Compression Enabled',
|
242 |
+
'slug' => 'gzip',
|
243 |
+
'plugin' => 'W3 Total Cache',
|
244 |
+
'configured' => false,
|
245 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
246 |
+
'description' => 'Makes your site significantly faster by compressing all text files to make them smaller.',
|
247 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
248 |
+
$w3tc = $thisclass->get_w3tc_config();
|
249 |
+
if ($w3tc['browsercache.other.compression']) {
|
250 |
+
$item['configured'] = true;
|
251 |
+
$thisclass->set_install_status('gzip', true);
|
252 |
+
} else {
|
253 |
+
$thisclass->set_install_status('gzip', false);
|
254 |
+
}
|
255 |
+
},
|
256 |
+
'enable' => function () use (&$thisclass) {
|
257 |
+
$thisclass->update_w3tc([
|
258 |
+
'browsercache.other.compression' => true,
|
259 |
+
'browsercache.html.compression' => true,
|
260 |
+
'browsercache.cssjs.compression' => true
|
261 |
+
]);
|
262 |
+
},
|
263 |
+
'disable' => function () use (&$thisclass) {
|
264 |
+
$thisclass->update_w3tc([
|
265 |
+
'browsercache.other.compression' => false,
|
266 |
+
'browsercache.html.compression' => false,
|
267 |
+
'browsercache.cssjs.compression' => false
|
268 |
+
]);
|
269 |
+
}
|
270 |
+
],
|
271 |
+
'htaccess' => [
|
272 |
+
'name' => 'Deny Direct Access to Configuration Files and Comment Form',
|
273 |
+
'slug' => 'htaccess',
|
274 |
+
'plugin' => 'A2 Optimized',
|
275 |
+
'configured' => false,
|
276 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-the-a2-optimized-plugin',
|
277 |
+
'description' => 'Protects your configuration files by generating a Forbidden error to web users and bots when trying to access WordPress configuration files. <br> Also prevents POST requests to the site not originating from a user on the site. <br> <span class="danger" >note</span>: if you are using a plugin to allow remote posts and comments, disable this option.',
|
278 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
279 |
+
$htaccess = file_get_contents(ABSPATH . '.htaccess');
|
280 |
+
if (strpos($htaccess, '# BEGIN WordPress Hardening') === false) {
|
281 |
+
if ($thisclass->get_deny_direct() == true) {
|
282 |
+
$thisclass->set_deny_direct(false);
|
283 |
+
}
|
284 |
+
//make sure the basic a2-optimized rules are present
|
285 |
+
$thisclass->set_install_status('htaccess-deny-direct-access', false);
|
286 |
+
} else {
|
287 |
+
if ($thisclass->get_deny_direct() == false) {
|
288 |
+
$thisclass->set_deny_direct(true);
|
289 |
+
}
|
290 |
+
$item['configured'] = true;
|
291 |
+
$thisclass->set_install_status('htaccess-deny-direct-access', true);
|
292 |
+
}
|
293 |
+
},
|
294 |
+
'enable' => function () use (&$thisclass) {
|
295 |
+
$thisclass->set_deny_direct(true);
|
296 |
+
$thisclass->write_htaccess();
|
297 |
+
},
|
298 |
+
'disable' => function () use (&$thisclass) {
|
299 |
+
$thisclass->set_deny_direct(false);
|
300 |
+
$thisclass->write_htaccess();
|
301 |
+
}
|
302 |
+
],
|
303 |
+
'lock' => [
|
304 |
+
'name' => 'Lock Editing of Plugins and Themes from the WP Admin',
|
305 |
+
'slug' => 'lock',
|
306 |
+
'plugin' => 'A2 Optimized',
|
307 |
+
'configured' => false,
|
308 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-the-a2-optimized-plugin',
|
309 |
+
'description' => 'Prevents exploits that use the built in editing capabilities of the WP Admin',
|
310 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
311 |
+
$wpconfig = file_get_contents(ABSPATH . 'wp-config.php');
|
312 |
+
if (strpos($wpconfig, '// BEGIN A2 CONFIG') === false) {
|
313 |
+
if ($thisclass->get_lockdown() == true) {
|
314 |
+
$thisclass->get_lockdown(false);
|
315 |
+
}
|
316 |
+
$thisclass->set_install_status('lock-editing', false);
|
317 |
+
} else {
|
318 |
+
if ($thisclass->get_lockdown() == false) {
|
319 |
+
$thisclass->set_lockdown(true);
|
320 |
+
}
|
321 |
+
$item['configured'] = true;
|
322 |
+
$thisclass->set_install_status('lock-editing', true);
|
323 |
+
}
|
324 |
+
},
|
325 |
+
'enable' => function () use (&$thisclass) {
|
326 |
+
$thisclass->set_lockdown(true);
|
327 |
+
$thisclass->write_wp_config();
|
328 |
+
},
|
329 |
+
'disable' => function () use (&$thisclass) {
|
330 |
+
$thisclass->set_lockdown(false);
|
331 |
+
$thisclass->write_wp_config();
|
332 |
+
}
|
333 |
+
],
|
334 |
+
'wp-login' => [
|
335 |
+
'name' => 'Login URL Change',
|
336 |
+
'slug' => 'wp-login',
|
337 |
+
'premium' => true,
|
338 |
+
'plugin' => 'Rename wp-login.php',
|
339 |
+
'configured' => false,
|
340 |
+
'kb' => 'http://www.a2hosting.com/kb/security/application-security/wordpress-security#a-namemethodRenameLoginPageaMethod-3.3A-Change-the-WordPress-login-URL',
|
341 |
+
'description' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
<p>Change the URL of your login page to make it harder for bots to find it to brute force attack.</p>
|
343 |
',
|
344 |
+
'is_configured' => function () {
|
345 |
+
return false;
|
346 |
+
}
|
347 |
+
],
|
348 |
+
'captcha' => [
|
349 |
+
'name' => 'reCAPTCHA on comments and login',
|
350 |
+
'plugin' => 'reCAPTCHA',
|
351 |
+
'slug' => 'captcha',
|
352 |
+
'premium' => true,
|
353 |
+
'configured' => false,
|
354 |
+
'description' => 'Decreases spam and increases site security by adding a CAPTCHA to comment forms and the login screen. Without a CAPTCHA, bots will easily be able to post comments to you blog or brute force login to your admin panel.',
|
355 |
+
'is_configured' => function () {
|
356 |
+
return false;
|
357 |
+
}
|
358 |
+
],
|
359 |
+
'images' => [
|
360 |
+
'name' => 'Compress Images on Upload',
|
361 |
+
'plugin' => 'EWWW Image Optimizer',
|
362 |
+
'slug' => 'images',
|
363 |
+
'premium' => true,
|
364 |
+
'configured' => false,
|
365 |
+
'description' => 'Makes your site faster by compressing images to make them smaller.',
|
366 |
+
'is_configured' => function () {
|
367 |
+
return false;
|
368 |
+
}
|
369 |
+
],
|
370 |
+
'turbo' => [
|
371 |
+
'name' => 'Turbo Web Hosting',
|
372 |
+
'slug' => 'turbo',
|
373 |
+
'configured' => false,
|
374 |
+
'premium'=>true,
|
375 |
+
'description' => '
|
376 |
<ul>
|
377 |
<li>Turbo Web Hosting servers compile .htaccess files to make speed improvements. Any changes to .htaccess files are immediately re-compiled.</li>
|
378 |
<li>Turbo Web Hosting servers have their own PHP API that provides speed improvements over FastCGI and PHP-FPM (FastCGI Process Manager). </li>
|
381 |
<li>Turbo Web Hosting servers have a built-in caching engine for Full Page Cache and Edge Side Includes.</li>
|
382 |
</ul>
|
383 |
',
|
384 |
+
'is_configured' => function () {
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
],
|
388 |
+
'memcached' => [
|
389 |
+
'name' => 'Memcached Database and Object Cache',
|
390 |
+
'slug' => 'memcached',
|
391 |
+
'configured' => false,
|
392 |
+
'premium'=>true,
|
393 |
+
'description' => '
|
394 |
<ul>
|
395 |
<li>Extremely fast and powerful caching system.</li>
|
396 |
<li>Store frequently used database queries and WordPress objects in Memcached.</li>
|
398 |
<li>Take advantage of A2 Hosting's one-click memcached configuration for WordPress.</li>
|
399 |
</ul>
|
400 |
',
|
401 |
+
'is_configured' => function () {
|
402 |
+
return false;
|
403 |
+
}
|
404 |
+
]
|
405 |
+
];
|
406 |
+
}
|
407 |
+
|
408 |
+
protected function get_private_optimizations() {
|
409 |
+
if (class_exists('A2_Optimized_Private_Optimizations')) {
|
410 |
+
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
411 |
|
412 |
+
return $a2opt_priv->get_optimizations($this->thisclass);
|
413 |
+
} else {
|
414 |
+
return [];
|
415 |
+
}
|
416 |
+
}
|
417 |
|
418 |
+
public function get_advanced() {
|
419 |
+
$public_opts = $this->get_public_advanced();
|
420 |
+
$private_opts = $this->get_private_advanced();
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
|
422 |
+
return array_merge($public_opts, $private_opts);
|
423 |
+
}
|
|
|
|
|
|
|
|
|
424 |
|
425 |
+
protected function get_public_advanced() {
|
426 |
+
$thisclass = $this->thisclass;
|
|
|
427 |
|
428 |
+
return [
|
429 |
+
'gtmetrix' => [
|
430 |
+
'slug' => 'gtmetrix',
|
431 |
+
'name' => 'GTmetrix',
|
432 |
+
'plugin' => 'GTmetrix',
|
433 |
+
'plugin_slug' => 'gtmetrix-for-wordpress',
|
434 |
+
'file' => 'gtmetrix-for-wordpress/gtmetrix-for-wordpress.php',
|
435 |
+
'configured' => false,
|
436 |
+
'partially_configured' => false,
|
437 |
+
'required_options' => ['gfw_options' => ['authorized']],
|
438 |
+
'description' => '
|
439 |
<p>
|
440 |
Plugin that actively keeps track of your WP install and sends you alerts if your site falls below certain criteria.
|
441 |
The GTMetrix plugin requires an account with <a href="http://gtmetrix.com/" >gtmetrix.com</a>
|
444 |
<b>Use this plugin only if your site is experiencing issues with slow load times.</b><br><b style="color:red">The GTMetrix plugin will slow down your site.</b>
|
445 |
</p>
|
446 |
',
|
447 |
+
'not_configured_links' => [],
|
448 |
+
'configured_links' => [
|
449 |
+
'Configure GTmetrix' => 'admin.php?page=gfw_settings',
|
450 |
+
'GTmetrix Tests' => 'admin.php?page=gfw_tests',
|
451 |
+
],
|
452 |
+
'partially_configured_links' => [
|
453 |
+
'Configure GTmetrix' => 'admin.php?page=gfw_settings',
|
454 |
+
'GTmetrix Tests' => 'admin.php?page=gfw_tests',
|
455 |
+
],
|
456 |
+
'partially_configured_message' => 'Click "Configure GTmetrix" to enter your GTmetrix Account Email and GTmetrix API Key.',
|
457 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/optimizing-wordpress-with-w3-total-cache-and-gtmetrix',
|
458 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
459 |
+
$gfw_options = get_option('gfw_options');
|
460 |
+
if (is_plugin_active($item['file']) && isset($gfw_options['authorized']) && $gfw_options['authorized'] == 1) {
|
461 |
+
$item['configured'] = true;
|
462 |
+
$thisclass->set_install_status('gtmetrix', true);
|
463 |
+
} elseif (is_plugin_active($item['file'])) {
|
464 |
+
$item['partially_configured'] = true;
|
465 |
+
} else {
|
466 |
+
$thisclass->set_install_status('gtmetrix', false);
|
467 |
+
}
|
468 |
+
},
|
469 |
+
'enable' => function ($slug) use (&$thisclass) {
|
470 |
+
$item = $thisclass->get_advanced_optimizations();
|
471 |
+
$item = $item[$slug];
|
472 |
+
if (!isset($thisclass->plugin_list[$item['file']])) {
|
473 |
+
$thisclass->install_plugin($item['plugin_slug']);
|
474 |
+
}
|
475 |
+
if (!is_plugin_active($item['file'])) {
|
476 |
+
$thisclass->activate_plugin($item['file']);
|
477 |
+
}
|
478 |
+
},
|
479 |
+
'disable' => function ($slug) use (&$thisclass) {
|
480 |
+
$item = $thisclass->get_advanced_optimizations();
|
481 |
+
$item = $item[$slug];
|
482 |
+
$thisclass->deactivate_plugin($item['file']);
|
483 |
+
}
|
484 |
+
],
|
485 |
+
'P3' => [
|
486 |
+
'slug' => 'P3',
|
487 |
+
'name' => 'P3 (Plugin Performance Profiler)',
|
488 |
+
'description' => '
|
489 |
<p>See which plugins are slowing down your site.
|
490 |
This plugin creates a performance report for your site.</p>
|
491 |
<p>
|
492 |
<b>Use this plugin only if your site is experiencing issues with slow load times.</b><br><b style="color:red">The P3 plugin will slow down your site.</b>
|
493 |
</p>
|
494 |
',
|
495 |
+
'plugin' => 'P3 Profiler',
|
496 |
+
'plugin_slug' => 'p3-profiler',
|
497 |
+
'file' => 'p3-profiler/p3-profiler.php',
|
498 |
+
'configured' => false,
|
499 |
+
'configured_links' => [
|
500 |
+
'Test Performance' => 'tools.php?page=p3-profiler',
|
501 |
+
],
|
502 |
+
'kb' => 'http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/debugging-wordpress-with-p3-profiler',
|
503 |
+
'is_configured' => function (&$item) use (&$thisclass) {
|
504 |
+
if (is_plugin_active($item['file'])) {
|
505 |
+
$item['configured'] = true;
|
506 |
+
$thisclass->set_install_status('P3', true);
|
507 |
+
} else {
|
508 |
+
$thisclass->set_install_status('P3', false);
|
509 |
+
}
|
510 |
+
},
|
511 |
+
'enable' => function ($slug) use (&$thisclass) {
|
512 |
+
$item = $thisclass->get_advanced_optimizations();
|
513 |
+
$item = $item[$slug];
|
514 |
+
if (!isset($thisclass->plugin_list[$item['file']])) {
|
515 |
+
$thisclass->install_plugin($item['plugin_slug']);
|
516 |
+
}
|
517 |
+
if (!is_plugin_active($item['file'])) {
|
518 |
+
$thisclass->activate_plugin($item['file']);
|
519 |
+
}
|
520 |
+
},
|
521 |
+
'disable' => function ($slug) use (&$thisclass) {
|
522 |
+
$item = $thisclass->get_advanced_optimizations();
|
523 |
+
$item = $item[$slug];
|
524 |
+
$thisclass->deactivate_plugin($item['file']);
|
525 |
+
}
|
526 |
+
],
|
527 |
+
'cloudflare' => [
|
528 |
+
'slug' => 'cloudflare',
|
529 |
+
'name' => 'CloudFlare',
|
530 |
+
'premium'=>true,
|
531 |
+
'description' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
<p>
|
533 |
CloudFlare is a free global CDN and DNS provider that can speed up and protect any site online.
|
534 |
</p>
|
547 |
Host with A2 Hosting to take advantage of one click CloudFlare configuration.
|
548 |
</div>
|
549 |
',
|
550 |
+
'configured' => false,
|
551 |
+
'is_configured' => function () {
|
552 |
+
return false;
|
553 |
+
},
|
554 |
+
'not_configured_links' => ['Host with A2'=>'https://www.a2hosting.com/wordpress-hosting?utm_source=A2%20Optimized&utm_medium=Referral&utm_campaign=A2%20Optimized']
|
555 |
+
]
|
556 |
+
];
|
557 |
+
}
|
558 |
+
|
559 |
+
protected function get_private_advanced() {
|
560 |
+
if (class_exists('A2_Optimized_Private_Optimizations')) {
|
561 |
+
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
562 |
+
|
563 |
+
return $a2opt_priv->get_advanced($this->thisclass);
|
564 |
+
} else {
|
565 |
+
return [];
|
566 |
+
}
|
567 |
+
}
|
568 |
|
569 |
+
public function get_warnings() {
|
570 |
+
$public_opts = $this->get_public_warnings();
|
571 |
+
$private_opts = $this->get_private_warnings();
|
572 |
|
573 |
+
return array_merge($public_opts, $private_opts);
|
574 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
|
576 |
+
protected function get_public_warnings() {
|
577 |
+
return [
|
578 |
+
'Bad WP Options' => [
|
579 |
+
'posts_per_page' => [
|
580 |
+
'title' => 'Recent Post Limit',
|
581 |
+
'description' => 'The number of recent posts per page is set greater than five. This could be slowing down page loads.',
|
582 |
+
'type' => 'numeric',
|
583 |
+
'threshold_type' => '>',
|
584 |
+
'threshold' => 5,
|
585 |
+
'config_url' => admin_url() . 'options-reading.php'
|
586 |
+
],
|
587 |
+
'posts_per_rss' => [
|
588 |
+
'title' => 'RSS Post Limit',
|
589 |
+
'description' => 'The number of posts from external feeds is set greater than 5. This could be slowing down page loads.',
|
590 |
+
'type' => 'numeric',
|
591 |
+
'threshold_type' => '>',
|
592 |
+
'threshold' => 5,
|
593 |
+
'config_url' => admin_url() . 'options-reading.php'
|
594 |
+
],
|
595 |
+
'show_on_front' => [
|
596 |
+
'title' => 'Recent Posts showing on home page',
|
597 |
+
'description' => 'Speed up your home page by selecting a static page to display.',
|
598 |
+
'type' => 'text',
|
599 |
+
'threshold_type' => '=',
|
600 |
+
'threshold' => 'posts',
|
601 |
+
'config_url' => admin_url() . 'options-reading.php'
|
602 |
+
],
|
603 |
+
'permalink_structure' => [
|
604 |
+
'title' => 'Permalink Structure',
|
605 |
+
'description' => 'To fully optimize page caching with "Disk Enhanced" mode:<br>you must set a permalink structure other than "Default".',
|
606 |
+
'type' => 'text',
|
607 |
+
'threshold_type' => '=',
|
608 |
+
'threshold' => '',
|
609 |
+
'config_url' => admin_url() . 'options-permalink.php'
|
610 |
+
]
|
611 |
+
],
|
612 |
+
'Advanced Warnings' => [
|
613 |
+
'themes' => [
|
614 |
+
'is_warning' => function () {
|
615 |
+
$themes = wp_get_themes();
|
616 |
+
switch (count($themes)) {
|
617 |
+
case 1:
|
618 |
+
return false;
|
619 |
+
case 2:
|
620 |
+
$theme = wp_get_theme();
|
621 |
+
if ($theme->get('Template') != '') {
|
622 |
+
return false;
|
623 |
+
}
|
624 |
+
}
|
625 |
|
626 |
+
return true;
|
627 |
+
},
|
628 |
+
'title' => 'Unused Themes',
|
629 |
+
'description' => 'One or more unused themes are installed. Unused themes should be deleted. For more information read the Wordpress.org Codex on <a target="_blank" href="http://codex.wordpress.org/WordPress_Housekeeping#Theme_Housekeeping">WordPress Housekeeping</a>',
|
630 |
+
'config_url' => admin_url() . 'themes.php'
|
631 |
+
],
|
632 |
+
'a2_hosting' => [
|
633 |
+
'title' => 'Not Hosted with A2 Hosting',
|
634 |
+
'description' => 'Get faster page load times and more optimizations when you <a href="https://www.a2hosting.com/wordpress-hosting?utm_source=A2%20Optimized&utm_medium=Referral&utm_campaign=A2%20Optimized" target="_blank">host with A2 Hosting</a>.',
|
635 |
+
'is_warning' => function () {
|
636 |
+
if (is_dir('/opt/a2-optimized')) {
|
637 |
+
return false;
|
638 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
639 |
|
640 |
+
return true;
|
641 |
+
},
|
642 |
+
'config_url' => 'https://www.a2hosting.com/wordpress-hosting?utm_source=A2%20Optimized&utm_medium=Referral&utm_campaign=A2%20Optimized'
|
643 |
+
]
|
644 |
+
],
|
645 |
+
'Bad Plugins' => [
|
646 |
+
'wp-super-cache',
|
647 |
+
'wp-file-cache',
|
648 |
+
'wordfence',
|
649 |
+
'wp-db-backup',
|
650 |
+
//'WP DB Manager',
|
651 |
+
//'BackupWordPress',
|
652 |
+
//'Broken Link Checker',
|
653 |
+
//'MyReviewPlugin',
|
654 |
+
//'LinkMan',
|
655 |
+
//'Google XML Sitemaps',
|
656 |
+
//'Fuzzy SEO Booster',
|
657 |
+
//'Tweet Blender',
|
658 |
+
//'Dynamic Related Posts',
|
659 |
+
//'SEO Auto Links & Related Posts',
|
660 |
+
//'Yet Another Related Posts Plugin',
|
661 |
+
//'Similar Posts',
|
662 |
+
//'Contextual Related Posts',
|
663 |
+
]
|
664 |
+
];
|
665 |
+
}
|
666 |
|
667 |
+
protected function get_private_warnings() {
|
668 |
+
if (class_exists('A2_Optimized_Private_Optimizations')) {
|
669 |
+
$a2opt_priv = new A2_Optimized_Private_Optimizations();
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
|
671 |
+
return $a2opt_priv->get_warnings($this->thisclass);
|
672 |
+
} else {
|
673 |
+
return [];
|
674 |
+
}
|
675 |
+
}
|
676 |
+
}
|
a2-optimized.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: A2 Optimized WP
|
4 |
Plugin URI: https://wordpress.org/plugins/a2-optimized/
|
5 |
-
Version: 2.0.
|
6 |
Author: A2 Hosting
|
7 |
Author URI: https://www.a2hosting.com/
|
8 |
Description: A2 Optimized - WordPress Optimization Plugin
|
2 |
/*
|
3 |
Plugin Name: A2 Optimized WP
|
4 |
Plugin URI: https://wordpress.org/plugins/a2-optimized/
|
5 |
+
Version: 2.0.6
|
6 |
Author: A2 Hosting
|
7 |
Author URI: https://www.a2hosting.com/
|
8 |
Description: A2 Optimized - WordPress Optimization Plugin
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: A2BCool, a2hosting, dmatteson, sputala
|
3 |
Tags: Speed, Optimize, Secure, Fast, W3 Total Cache, W3TC, Hosting
|
4 |
Requires at least: 3.8
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -140,6 +140,9 @@ Yes. A2 Optimized works on any host that supports WordPress. Yes. A2 Optimize
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
143 |
= 2.0.3 =
|
144 |
*Added dmatteson as a plugin author
|
145 |
|
2 |
Contributors: A2BCool, a2hosting, dmatteson, sputala
|
3 |
Tags: Speed, Optimize, Secure, Fast, W3 Total Cache, W3TC, Hosting
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 2.0.6
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 2.0.6 =
|
144 |
+
*Removed Clef and tested against WordPress 4.8
|
145 |
+
|
146 |
= 2.0.3 =
|
147 |
*Added dmatteson as a plugin author
|
148 |
|