Version Description
- Update WP_CACHE constant handling (#102)
- Add cache bypass method for WP_CACHE constant (#102)
- Add translation descriptions (#102)
- Fix cache handling for default redirects (#102)
Download this release
Release Info
| Developer | keycdn |
| Plugin | |
| Version | 1.4.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.4 to 1.4.5
- advanced-cache.php +1 -1
- cache-enabler.php +1 -1
- inc/cache_enabler.class.php +75 -38
- inc/cache_enabler_disk.class.php +3 -3
- readme.txt +10 -4
advanced-cache.php
CHANGED
|
@@ -164,7 +164,7 @@ function _ce_file_path( $path = null ) {
|
|
| 164 |
PHP_URL_HOST
|
| 165 |
),
|
| 166 |
parse_url(
|
| 167 |
-
( $path ? $path : $_SERVER['REQUEST_URI']
|
| 168 |
PHP_URL_PATH
|
| 169 |
)
|
| 170 |
);
|
| 164 |
PHP_URL_HOST
|
| 165 |
),
|
| 166 |
parse_url(
|
| 167 |
+
( $path ) ? $path : $_SERVER['REQUEST_URI'],
|
| 168 |
PHP_URL_PATH
|
| 169 |
)
|
| 170 |
);
|
cache-enabler.php
CHANGED
|
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress disk caching plugin.
|
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
-
Version: 1.4.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
+
Version: 1.4.5
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
inc/cache_enabler.class.php
CHANGED
|
@@ -135,7 +135,7 @@ final class Cache_Enabler {
|
|
| 135 |
* activation hook
|
| 136 |
*
|
| 137 |
* @since 1.0.0
|
| 138 |
-
* @change 1.4.
|
| 139 |
*
|
| 140 |
* @param boolean $network_wide network activated
|
| 141 |
*/
|
|
@@ -145,8 +145,8 @@ final class Cache_Enabler {
|
|
| 145 |
// activation requirements
|
| 146 |
self::on_ce_activation_deactivation( 'activated', $network_wide );
|
| 147 |
|
| 148 |
-
// set WP_CACHE
|
| 149 |
-
if (
|
| 150 |
self::_set_wp_cache();
|
| 151 |
}
|
| 152 |
|
|
@@ -289,7 +289,7 @@ final class Cache_Enabler {
|
|
| 289 |
* Cache Enabler update actions
|
| 290 |
*
|
| 291 |
* @since 1.4.0
|
| 292 |
-
* @change 1.4.
|
| 293 |
*
|
| 294 |
* @param boolean $network_wide network activated
|
| 295 |
*/
|
|
@@ -300,6 +300,8 @@ final class Cache_Enabler {
|
|
| 300 |
self::on_ce_activation_deactivation( 'deactivated', $network_wide );
|
| 301 |
// decom: delete old advanced cache settings file(s) (1.4.0)
|
| 302 |
array_map( 'unlink', glob( WP_CONTENT_DIR . '/cache/cache-enabler-advcache-*.json' ) );
|
|
|
|
|
|
|
| 303 |
|
| 304 |
// create advanced cache settings file(s)
|
| 305 |
self::on_ce_activation_deactivation( 'activated', $network_wide );
|
|
@@ -440,34 +442,43 @@ final class Cache_Enabler {
|
|
| 440 |
|
| 441 |
|
| 442 |
/**
|
| 443 |
-
* set or unset WP_CACHE
|
| 444 |
*
|
| 445 |
* @since 1.1.1
|
| 446 |
-
* @change 1.
|
| 447 |
*
|
| 448 |
* @param boolean $wp_cache_value true to set WP_CACHE constant in wp-config.php, false to unset
|
| 449 |
*/
|
| 450 |
|
| 451 |
private static function _set_wp_cache( $wp_cache_value = true ) {
|
| 452 |
|
|
|
|
| 453 |
$wp_config_file = ABSPATH . 'wp-config.php';
|
| 454 |
|
|
|
|
| 455 |
if ( file_exists( $wp_config_file ) && is_writable( $wp_config_file ) ) {
|
| 456 |
// get wp-config.php as array
|
| 457 |
$wp_config = file( $wp_config_file );
|
| 458 |
|
|
|
|
| 459 |
if ( $wp_cache_value ) {
|
| 460 |
-
$wp_cache_ce_line = "define('WP_CACHE', true); // Added by Cache Enabler" . "\r\n";
|
| 461 |
} else {
|
| 462 |
$wp_cache_ce_line = '';
|
| 463 |
}
|
| 464 |
|
|
|
|
| 465 |
$found_wp_cache = false;
|
| 466 |
-
|
| 467 |
foreach ( $wp_config as &$line ) {
|
| 468 |
-
if ( preg_match( '/^\s*define\s*\(\s*[\'\"]WP_CACHE[\'\"]\s*,\s*(.*)\s*\)
|
| 469 |
-
|
| 470 |
$found_wp_cache = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
break;
|
| 472 |
}
|
| 473 |
}
|
|
@@ -602,7 +613,7 @@ final class Cache_Enabler {
|
|
| 602 |
* warning if no custom permlink structure
|
| 603 |
*
|
| 604 |
* @since 1.0.0
|
| 605 |
-
* @change 1.4.
|
| 606 |
*/
|
| 607 |
|
| 608 |
public static function warning_is_permalink() {
|
|
@@ -611,9 +622,10 @@ final class Cache_Enabler {
|
|
| 611 |
|
| 612 |
show_message(
|
| 613 |
sprintf(
|
| 614 |
-
'<div class="error"><p>%s</p></div>',
|
| 615 |
sprintf(
|
| 616 |
-
|
|
|
|
| 617 |
'<strong>Cache Enabler</strong>',
|
| 618 |
sprintf(
|
| 619 |
'<a href="%s">%s</a>',
|
|
@@ -655,7 +667,7 @@ final class Cache_Enabler {
|
|
| 655 |
),
|
| 656 |
admin_url( 'options-general.php' )
|
| 657 |
),
|
| 658 |
-
esc_html__( 'Settings' )
|
| 659 |
)
|
| 660 |
)
|
| 661 |
);
|
|
@@ -808,7 +820,7 @@ final class Cache_Enabler {
|
|
| 808 |
'_cache' => 'cache-enabler',
|
| 809 |
'_action' => 'clear',
|
| 810 |
'_cid' => time(),
|
| 811 |
-
) ) ),
|
| 812 |
'parent' => 'top-secondary',
|
| 813 |
'title' => '<span class="ab-item">' . $title . '</span>',
|
| 814 |
'meta' => array(
|
|
@@ -826,7 +838,7 @@ final class Cache_Enabler {
|
|
| 826 |
'_cache' => 'cache-enabler',
|
| 827 |
'_action' => 'clearurl',
|
| 828 |
'_cid' => time(),
|
| 829 |
-
) ) ),
|
| 830 |
'parent' => 'top-secondary',
|
| 831 |
'title' => '<span class="ab-item">' . esc_html__( 'Clear URL Cache', 'cache-enabler' ) . '</span>',
|
| 832 |
'meta' => array(
|
|
@@ -860,7 +872,7 @@ final class Cache_Enabler {
|
|
| 860 |
}
|
| 861 |
|
| 862 |
// validate nonce
|
| 863 |
-
if ( empty( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'] ) ) {
|
| 864 |
return;
|
| 865 |
}
|
| 866 |
|
|
@@ -1364,6 +1376,25 @@ final class Cache_Enabler {
|
|
| 1364 |
}
|
| 1365 |
|
| 1366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1367 |
/**
|
| 1368 |
* check if mobile
|
| 1369 |
*
|
|
@@ -1409,7 +1440,7 @@ final class Cache_Enabler {
|
|
| 1409 |
* check to bypass the cache
|
| 1410 |
*
|
| 1411 |
* @since 1.0.0
|
| 1412 |
-
* @change 1.4.
|
| 1413 |
*
|
| 1414 |
* @return boolean true if exception, false otherwise
|
| 1415 |
*
|
|
@@ -1434,7 +1465,7 @@ final class Cache_Enabler {
|
|
| 1434 |
}
|
| 1435 |
|
| 1436 |
// check conditional tags
|
| 1437 |
-
if ( self::_is_index() || is_search() || is_feed() || is_trackback() || is_robots() || is_preview() || post_password_required() ) {
|
| 1438 |
return true;
|
| 1439 |
}
|
| 1440 |
|
|
@@ -1706,13 +1737,15 @@ final class Cache_Enabler {
|
|
| 1706 |
* add clear option dropdown on post publish widget
|
| 1707 |
*
|
| 1708 |
* @since 1.0.0
|
| 1709 |
-
* @change 1.4.
|
|
|
|
|
|
|
| 1710 |
*/
|
| 1711 |
|
| 1712 |
-
public static function add_clear_dropdown() {
|
| 1713 |
|
| 1714 |
// on published post/page only
|
| 1715 |
-
if ( empty( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'post.php' || empty( $
|
| 1716 |
return;
|
| 1717 |
}
|
| 1718 |
|
|
@@ -1722,7 +1755,7 @@ final class Cache_Enabler {
|
|
| 1722 |
}
|
| 1723 |
|
| 1724 |
// validate nonce
|
| 1725 |
-
wp_nonce_field( CE_BASE, '_cache__status_nonce_' . $
|
| 1726 |
|
| 1727 |
// get current publishing action
|
| 1728 |
$current_action = (int) get_user_meta(
|
|
@@ -1767,10 +1800,10 @@ final class Cache_Enabler {
|
|
| 1767 |
</div>',
|
| 1768 |
esc_html__( 'Clear cache', 'cache-enabler' ),
|
| 1769 |
$available_options[ $current_action ],
|
| 1770 |
-
esc_html__( 'Edit' ),
|
| 1771 |
$dropdown_options,
|
| 1772 |
-
esc_html__( 'OK' ),
|
| 1773 |
-
esc_html__( 'Cancel' )
|
| 1774 |
);
|
| 1775 |
}
|
| 1776 |
|
|
@@ -1856,7 +1889,7 @@ final class Cache_Enabler {
|
|
| 1856 |
* check plugin requirements
|
| 1857 |
*
|
| 1858 |
* @since 1.1.0
|
| 1859 |
-
* @change 1.4.
|
| 1860 |
*/
|
| 1861 |
|
| 1862 |
public static function requirements_check() {
|
|
@@ -1865,9 +1898,10 @@ final class Cache_Enabler {
|
|
| 1865 |
if ( version_compare( $GLOBALS['wp_version'], CE_MIN_WP . 'alpha', '<' ) ) {
|
| 1866 |
show_message(
|
| 1867 |
sprintf(
|
| 1868 |
-
'<div class="error"><p>%s</p></div>',
|
| 1869 |
sprintf(
|
| 1870 |
-
|
|
|
|
| 1871 |
'<strong>Cache Enabler</strong>',
|
| 1872 |
CE_MIN_WP
|
| 1873 |
)
|
|
@@ -1879,9 +1913,10 @@ final class Cache_Enabler {
|
|
| 1879 |
if ( file_exists( CE_CACHE_DIR ) && ! is_writable( CE_CACHE_DIR ) ) {
|
| 1880 |
show_message(
|
| 1881 |
sprintf(
|
| 1882 |
-
'<div class="error"><p>%s</p></div>',
|
| 1883 |
sprintf(
|
| 1884 |
-
|
|
|
|
| 1885 |
'<strong>Cache Enabler</strong>',
|
| 1886 |
'<code>755</code>',
|
| 1887 |
'<code>wp-content/cache</code>',
|
|
@@ -1899,9 +1934,10 @@ final class Cache_Enabler {
|
|
| 1899 |
if ( defined( 'AUTOPTIMIZE_PLUGIN_DIR' ) && self::$options['minify_html'] && get_option( 'autoptimize_html', '' ) !== '' ) {
|
| 1900 |
show_message(
|
| 1901 |
sprintf(
|
| 1902 |
-
'<div class="error"><p>%s</p></div>',
|
| 1903 |
sprintf(
|
| 1904 |
-
|
|
|
|
| 1905 |
'<strong>Autoptimize</strong>',
|
| 1906 |
esc_html__( 'Cache Minification', 'cache-enabler' ),
|
| 1907 |
sprintf(
|
|
@@ -2091,19 +2127,20 @@ final class Cache_Enabler {
|
|
| 2091 |
* settings page
|
| 2092 |
*
|
| 2093 |
* @since 1.0.0
|
| 2094 |
-
* @change 1.4.
|
| 2095 |
*/
|
| 2096 |
|
| 2097 |
public static function settings_page() {
|
| 2098 |
|
| 2099 |
-
// WP_CACHE
|
| 2100 |
-
if (
|
| 2101 |
show_message(
|
| 2102 |
sprintf(
|
| 2103 |
'<div class="notice notice-warning"><p>%s</p></div>',
|
| 2104 |
sprintf(
|
| 2105 |
-
|
| 2106 |
-
|
|
|
|
| 2107 |
'<code>wp-config.php</code>'
|
| 2108 |
)
|
| 2109 |
)
|
| 135 |
* activation hook
|
| 136 |
*
|
| 137 |
* @since 1.0.0
|
| 138 |
+
* @change 1.4.5
|
| 139 |
*
|
| 140 |
* @param boolean $network_wide network activated
|
| 141 |
*/
|
| 145 |
// activation requirements
|
| 146 |
self::on_ce_activation_deactivation( 'activated', $network_wide );
|
| 147 |
|
| 148 |
+
// set WP_CACHE if not already set
|
| 149 |
+
if ( defined( 'WP_CACHE' ) && ! WP_CACHE ) {
|
| 150 |
self::_set_wp_cache();
|
| 151 |
}
|
| 152 |
|
| 289 |
* Cache Enabler update actions
|
| 290 |
*
|
| 291 |
* @since 1.4.0
|
| 292 |
+
* @change 1.4.5
|
| 293 |
*
|
| 294 |
* @param boolean $network_wide network activated
|
| 295 |
*/
|
| 300 |
self::on_ce_activation_deactivation( 'deactivated', $network_wide );
|
| 301 |
// decom: delete old advanced cache settings file(s) (1.4.0)
|
| 302 |
array_map( 'unlink', glob( WP_CONTENT_DIR . '/cache/cache-enabler-advcache-*.json' ) );
|
| 303 |
+
// clean: delete incorrect advanced cache settings file(s) that may have been created (1.4.5)
|
| 304 |
+
array_map( 'unlink', glob( ABSPATH . '/CE_SETTINGS_PATH-*.json' ) );
|
| 305 |
|
| 306 |
// create advanced cache settings file(s)
|
| 307 |
self::on_ce_activation_deactivation( 'activated', $network_wide );
|
| 442 |
|
| 443 |
|
| 444 |
/**
|
| 445 |
+
* set or unset WP_CACHE constant
|
| 446 |
*
|
| 447 |
* @since 1.1.1
|
| 448 |
+
* @change 1.4.5
|
| 449 |
*
|
| 450 |
* @param boolean $wp_cache_value true to set WP_CACHE constant in wp-config.php, false to unset
|
| 451 |
*/
|
| 452 |
|
| 453 |
private static function _set_wp_cache( $wp_cache_value = true ) {
|
| 454 |
|
| 455 |
+
// get wp-config.php file
|
| 456 |
$wp_config_file = ABSPATH . 'wp-config.php';
|
| 457 |
|
| 458 |
+
// check if wp-config.php file exists
|
| 459 |
if ( file_exists( $wp_config_file ) && is_writable( $wp_config_file ) ) {
|
| 460 |
// get wp-config.php as array
|
| 461 |
$wp_config = file( $wp_config_file );
|
| 462 |
|
| 463 |
+
// set Cache Enabler line
|
| 464 |
if ( $wp_cache_value ) {
|
| 465 |
+
$wp_cache_ce_line = "define( 'WP_CACHE', true ); // Added by Cache Enabler" . "\r\n";
|
| 466 |
} else {
|
| 467 |
$wp_cache_ce_line = '';
|
| 468 |
}
|
| 469 |
|
| 470 |
+
// search for WP_CACHE constant
|
| 471 |
$found_wp_cache = false;
|
|
|
|
| 472 |
foreach ( $wp_config as &$line ) {
|
| 473 |
+
if ( preg_match( '/^\s*define\s*\(\s*[\'\"]WP_CACHE[\'\"]\s*,\s*(.*)\s*\);/', $line ) ) {
|
| 474 |
+
// found WP_CACHE constant
|
| 475 |
$found_wp_cache = true;
|
| 476 |
+
// check if constant was set by Cache Enabler
|
| 477 |
+
if ( preg_match( '/\/\/\sAdded\sby\sCache\sEnabler/', $line ) ) {
|
| 478 |
+
// update Cache Enabler line
|
| 479 |
+
$line = $wp_cache_ce_line;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
break;
|
| 483 |
}
|
| 484 |
}
|
| 613 |
* warning if no custom permlink structure
|
| 614 |
*
|
| 615 |
* @since 1.0.0
|
| 616 |
+
* @change 1.4.5
|
| 617 |
*/
|
| 618 |
|
| 619 |
public static function warning_is_permalink() {
|
| 622 |
|
| 623 |
show_message(
|
| 624 |
sprintf(
|
| 625 |
+
'<div class="notice notice-error"><p>%s</p></div>',
|
| 626 |
sprintf(
|
| 627 |
+
// translators: 1. Cache Enabler 2. Permalink Settings
|
| 628 |
+
esc_html__( 'The %1$s plugin requires a custom permalink structure to start caching properly. Please enable a custom structure in the %2$s.', 'cache-enabler' ),
|
| 629 |
'<strong>Cache Enabler</strong>',
|
| 630 |
sprintf(
|
| 631 |
'<a href="%s">%s</a>',
|
| 667 |
),
|
| 668 |
admin_url( 'options-general.php' )
|
| 669 |
),
|
| 670 |
+
esc_html__( 'Settings', 'cache-enabler' )
|
| 671 |
)
|
| 672 |
)
|
| 673 |
);
|
| 820 |
'_cache' => 'cache-enabler',
|
| 821 |
'_action' => 'clear',
|
| 822 |
'_cid' => time(),
|
| 823 |
+
) ), '_cache__clear_nonce' ),
|
| 824 |
'parent' => 'top-secondary',
|
| 825 |
'title' => '<span class="ab-item">' . $title . '</span>',
|
| 826 |
'meta' => array(
|
| 838 |
'_cache' => 'cache-enabler',
|
| 839 |
'_action' => 'clearurl',
|
| 840 |
'_cid' => time(),
|
| 841 |
+
) ), '_cache__clear_nonce' ),
|
| 842 |
'parent' => 'top-secondary',
|
| 843 |
'title' => '<span class="ab-item">' . esc_html__( 'Clear URL Cache', 'cache-enabler' ) . '</span>',
|
| 844 |
'meta' => array(
|
| 872 |
}
|
| 873 |
|
| 874 |
// validate nonce
|
| 875 |
+
if ( empty( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], '_cache__clear_nonce' ) ) {
|
| 876 |
return;
|
| 877 |
}
|
| 878 |
|
| 1376 |
}
|
| 1377 |
|
| 1378 |
|
| 1379 |
+
/**
|
| 1380 |
+
* check if caching is disabled
|
| 1381 |
+
*
|
| 1382 |
+
* @since 1.4.5
|
| 1383 |
+
* @change 1.4.5
|
| 1384 |
+
*
|
| 1385 |
+
* @return boolean true if WP_CACHE is set to disable caching, false otherwise
|
| 1386 |
+
*/
|
| 1387 |
+
|
| 1388 |
+
private static function _is_wp_cache_disabled() {
|
| 1389 |
+
|
| 1390 |
+
if ( defined( 'WP_CACHE' ) && ! WP_CACHE ) {
|
| 1391 |
+
return true;
|
| 1392 |
+
}
|
| 1393 |
+
|
| 1394 |
+
return false;
|
| 1395 |
+
}
|
| 1396 |
+
|
| 1397 |
+
|
| 1398 |
/**
|
| 1399 |
* check if mobile
|
| 1400 |
*
|
| 1440 |
* check to bypass the cache
|
| 1441 |
*
|
| 1442 |
* @since 1.0.0
|
| 1443 |
+
* @change 1.4.5
|
| 1444 |
*
|
| 1445 |
* @return boolean true if exception, false otherwise
|
| 1446 |
*
|
| 1465 |
}
|
| 1466 |
|
| 1467 |
// check conditional tags
|
| 1468 |
+
if ( self::_is_wp_cache_disabled() || self::_is_index() || is_search() || is_feed() || is_trackback() || is_robots() || is_preview() || post_password_required() ) {
|
| 1469 |
return true;
|
| 1470 |
}
|
| 1471 |
|
| 1737 |
* add clear option dropdown on post publish widget
|
| 1738 |
*
|
| 1739 |
* @since 1.0.0
|
| 1740 |
+
* @change 1.4.5
|
| 1741 |
+
*
|
| 1742 |
+
* @param WP_Post $post post instance
|
| 1743 |
*/
|
| 1744 |
|
| 1745 |
+
public static function add_clear_dropdown( $post ) {
|
| 1746 |
|
| 1747 |
// on published post/page only
|
| 1748 |
+
if ( empty( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'post.php' || empty( $post ) || ! is_object( $post ) || $post->post_status !== 'publish' ) {
|
| 1749 |
return;
|
| 1750 |
}
|
| 1751 |
|
| 1755 |
}
|
| 1756 |
|
| 1757 |
// validate nonce
|
| 1758 |
+
wp_nonce_field( CE_BASE, '_cache__status_nonce_' . $post->ID );
|
| 1759 |
|
| 1760 |
// get current publishing action
|
| 1761 |
$current_action = (int) get_user_meta(
|
| 1800 |
</div>',
|
| 1801 |
esc_html__( 'Clear cache', 'cache-enabler' ),
|
| 1802 |
$available_options[ $current_action ],
|
| 1803 |
+
esc_html__( 'Edit', 'cache-enabler' ),
|
| 1804 |
$dropdown_options,
|
| 1805 |
+
esc_html__( 'OK', 'cache-enabler' ),
|
| 1806 |
+
esc_html__( 'Cancel', 'cache-enabler' )
|
| 1807 |
);
|
| 1808 |
}
|
| 1809 |
|
| 1889 |
* check plugin requirements
|
| 1890 |
*
|
| 1891 |
* @since 1.1.0
|
| 1892 |
+
* @change 1.4.5
|
| 1893 |
*/
|
| 1894 |
|
| 1895 |
public static function requirements_check() {
|
| 1898 |
if ( version_compare( $GLOBALS['wp_version'], CE_MIN_WP . 'alpha', '<' ) ) {
|
| 1899 |
show_message(
|
| 1900 |
sprintf(
|
| 1901 |
+
'<div class="notice notice-error"><p>%s</p></div>',
|
| 1902 |
sprintf(
|
| 1903 |
+
// translators: 1. Cache Enabler 2. WordPress version (e.g. 5.1)
|
| 1904 |
+
esc_html__( 'The %1$s plugin is optimized for WordPress %2$s. Please disable the plugin or upgrade your WordPress installation (recommended).', 'cache-enabler' ),
|
| 1905 |
'<strong>Cache Enabler</strong>',
|
| 1906 |
CE_MIN_WP
|
| 1907 |
)
|
| 1913 |
if ( file_exists( CE_CACHE_DIR ) && ! is_writable( CE_CACHE_DIR ) ) {
|
| 1914 |
show_message(
|
| 1915 |
sprintf(
|
| 1916 |
+
'<div class="notice notice-error"><p>%s</p></div>',
|
| 1917 |
sprintf(
|
| 1918 |
+
// translators: 1. Cache Enabler 2. 755 3. wp-content/cache 4. file permissions
|
| 1919 |
+
esc_html__( 'The %1$s plugin requires write permissions %2$s in %3$s. Please change the %4$s.', 'cache-enabler' ),
|
| 1920 |
'<strong>Cache Enabler</strong>',
|
| 1921 |
'<code>755</code>',
|
| 1922 |
'<code>wp-content/cache</code>',
|
| 1934 |
if ( defined( 'AUTOPTIMIZE_PLUGIN_DIR' ) && self::$options['minify_html'] && get_option( 'autoptimize_html', '' ) !== '' ) {
|
| 1935 |
show_message(
|
| 1936 |
sprintf(
|
| 1937 |
+
'<div class="notice notice-error"><p>%s</p></div>',
|
| 1938 |
sprintf(
|
| 1939 |
+
// translators: 1. Autoptimize 2. Cache Minification 3. Cache Enabler Settings
|
| 1940 |
+
esc_html__( 'The %1$s plugin is already active. Please disable %2$s in the %3$s.', 'cache-enabler' ),
|
| 1941 |
'<strong>Autoptimize</strong>',
|
| 1942 |
esc_html__( 'Cache Minification', 'cache-enabler' ),
|
| 1943 |
sprintf(
|
| 2127 |
* settings page
|
| 2128 |
*
|
| 2129 |
* @since 1.0.0
|
| 2130 |
+
* @change 1.4.5
|
| 2131 |
*/
|
| 2132 |
|
| 2133 |
public static function settings_page() {
|
| 2134 |
|
| 2135 |
+
// check WP_CACHE constant
|
| 2136 |
+
if ( self::_is_wp_cache_disabled() ) {
|
| 2137 |
show_message(
|
| 2138 |
sprintf(
|
| 2139 |
'<div class="notice notice-warning"><p>%s</p></div>',
|
| 2140 |
sprintf(
|
| 2141 |
+
// translators: 1. define( 'WP_CACHE', true ); 2. wp-config.php
|
| 2142 |
+
esc_html__( 'Caching is disabled because %1$s is not set in the %2$s file.', 'cache-enabler' ),
|
| 2143 |
+
"<code>define( 'WP_CACHE', true );</code>",
|
| 2144 |
'<code>wp-config.php</code>'
|
| 2145 |
)
|
| 2146 |
)
|
inc/cache_enabler_disk.class.php
CHANGED
|
@@ -426,7 +426,7 @@ final class Cache_Enabler_Disk {
|
|
| 426 |
* cache path
|
| 427 |
*
|
| 428 |
* @since 1.0.0
|
| 429 |
-
* @change 1.4.
|
| 430 |
*
|
| 431 |
* @param string $path URI or permalink
|
| 432 |
* @return string $diff path to cached file
|
|
@@ -439,11 +439,11 @@ final class Cache_Enabler_Disk {
|
|
| 439 |
CE_CACHE_DIR,
|
| 440 |
DIRECTORY_SEPARATOR,
|
| 441 |
parse_url(
|
| 442 |
-
get_site_url(),
|
| 443 |
PHP_URL_HOST
|
| 444 |
),
|
| 445 |
parse_url(
|
| 446 |
-
( $path ? $path : $_SERVER['REQUEST_URI']
|
| 447 |
PHP_URL_PATH
|
| 448 |
)
|
| 449 |
);
|
| 426 |
* cache path
|
| 427 |
*
|
| 428 |
* @since 1.0.0
|
| 429 |
+
* @change 1.4.5
|
| 430 |
*
|
| 431 |
* @param string $path URI or permalink
|
| 432 |
* @return string $diff path to cached file
|
| 439 |
CE_CACHE_DIR,
|
| 440 |
DIRECTORY_SEPARATOR,
|
| 441 |
parse_url(
|
| 442 |
+
( $path ) ? get_site_url() : 'http://' . strtolower( $_SERVER['HTTP_HOST'] ),
|
| 443 |
PHP_URL_HOST
|
| 444 |
),
|
| 445 |
parse_url(
|
| 446 |
+
( $path ) ? $path : $_SERVER['REQUEST_URI'],
|
| 447 |
PHP_URL_PATH
|
| 448 |
)
|
| 449 |
);
|
readme.txt
CHANGED
|
@@ -81,17 +81,23 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
|
|
| 81 |
|
| 82 |
== Changelog ==
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
= 1.4.4 =
|
| 85 |
-
* Update cache handling (#100)
|
| 86 |
|
| 87 |
= 1.4.3 =
|
| 88 |
* Update cache clearing by URL (#99)
|
| 89 |
-
*
|
| 90 |
|
| 91 |
= 1.4.2 =
|
| 92 |
* Update cache clearing for the Clear URL Cache admin bar button (#98)
|
| 93 |
* Update scheme-based caching (#98)
|
| 94 |
-
* Fix advanced cache (#98)
|
| 95 |
|
| 96 |
= 1.4.1 =
|
| 97 |
* Fix undefined constant
|
|
@@ -108,7 +114,7 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
|
|
| 108 |
* Add Cache Behavior setting for WooCommerce stock update (#88)
|
| 109 |
* Add fbclid as default URL query parameter to bypass cache (#84)
|
| 110 |
* Add scheme-based caching (#94)
|
| 111 |
-
* Fix advanced cache for multisite networks (#92)
|
| 112 |
|
| 113 |
= 1.3.5 =
|
| 114 |
* WP-CLI cache clearing (Thanks to Steve Grunwell)
|
| 81 |
|
| 82 |
== Changelog ==
|
| 83 |
|
| 84 |
+
= 1.4.5 =
|
| 85 |
+
* Update WP_CACHE constant handling (#102)
|
| 86 |
+
* Add cache bypass method for WP_CACHE constant (#102)
|
| 87 |
+
* Add translation descriptions (#102)
|
| 88 |
+
* Fix cache handling for default redirects (#102)
|
| 89 |
+
|
| 90 |
= 1.4.4 =
|
| 91 |
+
* Update cache handling for HTTP status codes (#100)
|
| 92 |
|
| 93 |
= 1.4.3 =
|
| 94 |
* Update cache clearing by URL (#99)
|
| 95 |
+
* Fix advanced cache settings updating unnecessarily (#99)
|
| 96 |
|
| 97 |
= 1.4.2 =
|
| 98 |
* Update cache clearing for the Clear URL Cache admin bar button (#98)
|
| 99 |
* Update scheme-based caching (#98)
|
| 100 |
+
* Fix advanced cache path variants (#98)
|
| 101 |
|
| 102 |
= 1.4.1 =
|
| 103 |
* Fix undefined constant
|
| 114 |
* Add Cache Behavior setting for WooCommerce stock update (#88)
|
| 115 |
* Add fbclid as default URL query parameter to bypass cache (#84)
|
| 116 |
* Add scheme-based caching (#94)
|
| 117 |
+
* Fix advanced cache settings recognition for multisite networks (#92)
|
| 118 |
|
| 119 |
= 1.3.5 =
|
| 120 |
* WP-CLI cache clearing (Thanks to Steve Grunwell)
|
