From e09fd30195cc9c7cd33ca09c1e73f8a2d486226e Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 27 May 2017 14:05:13 -0400 Subject: [PATCH 1/4] Preparing pull request. See: websharks/comet-cache#893 --- .gitchange | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitchange b/.gitchange index 089b7e8c..a0d806dd 100644 --- a/.gitchange +++ b/.gitchange @@ -1,2 +1,3 @@ 1491589996 2ea258a033ce686450ef6bccbc0f66efdba74ac1:58ffb9673670b6.69941207 +d0e05c36184f81b133761b71ca6ee0136be67409:5929bfd91e18f9.45059581 From 6f99eefa1d36ced8eebb2063fecc1a1f58c015aa Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 27 May 2017 14:24:34 -0400 Subject: [PATCH 2/4] Replace applyWpFilters() with apply_filters() Now that WordPress is exposing the standard WP hook/filter library in the early phase, we don't need our own method for this. This also drops backwards compatibility with ZenCache filters. ZenCache has not been supported for more than a year now. See websharks/comet-cache#893 --- src/includes/classes/Actions.php | 4 +-- src/includes/classes/AutoCache.php | 4 +-- .../MenuPage/Options/HostExclusions.php | 2 +- .../MenuPage/Options/StaticCdnFilters.php | 2 +- .../classes/MenuPage/Options/UserRequests.php | 2 +- src/includes/classes/Plugin.php | 16 ++++++------ src/includes/traits/Ac/PostloadUtils.php | 2 +- src/includes/traits/Plugin/InstallUtils.php | 2 +- src/includes/traits/Plugin/OptionUtils.php | 2 +- src/includes/traits/Plugin/StatsUtils.php | 2 +- src/includes/traits/Plugin/WcpFeedUtils.php | 2 +- src/includes/traits/Plugin/WcpPluginUtils.php | 2 +- src/includes/traits/Plugin/WcpUserUtils.php | 2 +- src/includes/traits/Plugin/WcpUtils.php | 6 ++--- src/includes/traits/Shared/CacheLockUtils.php | 8 +++--- src/includes/traits/Shared/HookUtils.php | 25 ------------------- 16 files changed, 29 insertions(+), 54 deletions(-) diff --git a/src/includes/classes/Actions.php b/src/includes/classes/Actions.php index 3ebcb877..88664ea8 100644 --- a/src/includes/classes/Actions.php +++ b/src/includes/classes/Actions.php @@ -596,7 +596,7 @@ protected function saveOptions($args) if ($this->plugin->isApache() && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_add_failure'] = '1'; } - if ($this->plugin->isNginx() && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) + if ($this->plugin->isNginx() && apply_filters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { $query_args[GLOBAL_NS.'_wp_htaccess_nginx_notice'] = '1'; } @@ -669,7 +669,7 @@ protected function restoreDefaultOptions($args) if ($this->plugin->isApache() && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_add_failure'] = '1'; } - if ($this->plugin->isNginx() && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) + if ($this->plugin->isNginx() && apply_filters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { $query_args[GLOBAL_NS.'_wp_htaccess_nginx_notice'] = '1'; } diff --git a/src/includes/classes/AutoCache.php b/src/includes/classes/AutoCache.php index 19e20fbe..3858cc45 100644 --- a/src/includes/classes/AutoCache.php +++ b/src/includes/classes/AutoCache.php @@ -262,7 +262,7 @@ protected function getSitemapUrlsDeep($sitemap, $___recursive = false) if (!$this->plugin->autoCacheCheckXmlSitemap($sitemap, $___recursive, $this->is_child_blog)) { goto finale; // Nothing we can do. } - if (!$allow_url_fopen || $this->plugin->applyWpFilters(GLOBAL_NS.'_auto_cache_sitemap_force_wp_http_api', false)) { // Try the WP HTTP API instead. + if (!$allow_url_fopen || apply_filters(GLOBAL_NS.'_auto_cache_sitemap_force_wp_http_api', false)) { // Try the WP HTTP API instead. $sitemap = $this->plugin->autoCacheWpRemoteGetXmlSitemap($sitemap); } @@ -289,7 +289,7 @@ protected function getSitemapUrlsDeep($sitemap, $___recursive = false) unset($_sitemapindex_urls, $_urlset_urls); } - if (!$allow_url_fopen || $this->plugin->applyWpFilters(GLOBAL_NS.'_auto_cache_sitemap_force_wp_http_api', false)) { + if (!$allow_url_fopen || apply_filters(GLOBAL_NS.'_auto_cache_sitemap_force_wp_http_api', false)) { unlink($sitemap); // Delete temp file downloaded by cURL } diff --git a/src/includes/classes/MenuPage/Options/HostExclusions.php b/src/includes/classes/MenuPage/Options/HostExclusions.php index 72d288b4..753b259d 100644 --- a/src/includes/classes/MenuPage/Options/HostExclusions.php +++ b/src/includes/classes/MenuPage/Options/HostExclusions.php @@ -22,7 +22,7 @@ public function __construct() $exclude_hosts_option_enable = is_multisite() && ((defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL) || $this->plugin->canConsiderDomainMapping()); - if ($this->plugin->applyWpFilters(GLOBAL_NS.'_exclude_hosts_option_enable', $exclude_hosts_option_enable)) { + if (apply_filters(GLOBAL_NS.'_exclude_hosts_option_enable', $exclude_hosts_option_enable)) { echo '
'."\n"; echo ' '."\n"; diff --git a/src/includes/classes/MenuPage/Options/StaticCdnFilters.php b/src/includes/classes/MenuPage/Options/StaticCdnFilters.php index c1d990ff..c0ab5b04 100644 --- a/src/includes/classes/MenuPage/Options/StaticCdnFilters.php +++ b/src/includes/classes/MenuPage/Options/StaticCdnFilters.php @@ -31,7 +31,7 @@ public function __construct() echo '

'.__('Enable Static CDN Filters (e.g., MaxCDN/CloudFront)?', SLUG_TD).'

'."\n"; echo '

'.sprintf(__('This feature allows you to serve some and/or ALL static files on your site from a CDN of your choosing. This is made possible through content/URL filters exposed by WordPress and implemented by %1$s. All it requires is that you setup a CDN hostname sourced by your WordPress installation domain. You enter that CDN hostname below and %1$s will do the rest! Super easy, and it doesn\'t require any DNS changes either. :-) Please click here for a general set of instructions.', SLUG_TD), esc_html(NAME)).'

'."\n"; echo '

'.__('What\'s a CDN? It\'s a Content Delivery Network (i.e., a network of optimized servers) designed to cache static resources served from your site (e.g., JS/CSS/images and other static files) onto it\'s own servers, which are located strategically in various geographic areas around the world. Integrating a CDN for static files can dramatically improve the speed and performance of your site, lower the burden on your own server, and reduce latency associated with visitors attempting to access your site from geographic areas of the world that might be very far away from the primary location of your own web servers.', SLUG_TD).'

'."\n"; - if ($this->plugin->isNginx() && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { + if ($this->plugin->isNginx() && apply_filters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { echo '
'."\n"; echo ' '.__('It appears that your server is running NGINX and does not support .htaccess rules. Please update your server configuration manually. Note that updating your NGINX server configuration before enabling Static CDN Filters is recommended to prevent any CORS errors with your CDN. If you\'ve already updated your NGINX configuration, you can safely ignore this message.', SLUG_TD)."\n"; echo '
'."\n"; diff --git a/src/includes/classes/MenuPage/Options/UserRequests.php b/src/includes/classes/MenuPage/Options/UserRequests.php index 1aa4e15c..8f25b68d 100644 --- a/src/includes/classes/MenuPage/Options/UserRequests.php +++ b/src/includes/classes/MenuPage/Options/UserRequests.php @@ -40,7 +40,7 @@ public function __construct() echo ' '."\n"; } echo '

'."\n"; - if ($this->plugin->options['when_logged_in'] === '1' && $this->plugin->applyWpFilters(GLOBAL_NS.'_when_logged_in_no_admin_bar', true)) { + if ($this->plugin->options['when_logged_in'] === '1' && apply_filters(GLOBAL_NS.'_when_logged_in_no_admin_bar', true)) { echo '

'.sprintf(__('Warning: Whenever you enable caching for logged-in users (without a separate cache for each user), the WordPress Admin Bar must be disabled to prevent one user from seeing another user\'s details in the Admin Bar. Given your current configuration, %1$s will automatically hide the WordPress Admin Bar on the front-end of your site.', SLUG_TD), esc_html(NAME)).'

'."\n"; } echo '

'.sprintf(__('Note: %1$s includes comment authors as part of it\'s logged-in user check. This way comment authors will be able to see updates to comment threads immediately. And, so that any dynamically-generated messages displayed by your theme will work as intended. In short, %1$s thinks of a comment author as a logged-in user, even though technically they are not. Users who gain access to password-protected Posts/Pages are also considered by the logged-in user check.', SLUG_TD), esc_html(NAME)).'

'."\n"; diff --git a/src/includes/classes/Plugin.php b/src/includes/classes/Plugin.php index 27a08753..3525c56c 100644 --- a/src/includes/classes/Plugin.php +++ b/src/includes/classes/Plugin.php @@ -523,16 +523,16 @@ public function setup() 'uninstall_on_deletion' => '0', // `0|1`. ]; - $this->default_options = $this->applyWpFilters(GLOBAL_NS.'_default_options', $this->default_options); + $this->default_options = apply_filters(GLOBAL_NS.'_default_options', $this->default_options); $this->options = $this->getOptions(); // Filters, validates, and returns plugin options. - $this->cap = $this->applyWpFilters(GLOBAL_NS.'_cap', $this->cap); - $this->update_cap = $this->applyWpFilters(GLOBAL_NS.'_update_cap', $this->update_cap); - $this->network_cap = $this->applyWpFilters(GLOBAL_NS.'_network_cap', $this->network_cap); - $this->uninstall_cap = $this->applyWpFilters(GLOBAL_NS.'_uninstall_cap', $this->uninstall_cap); + $this->cap = apply_filters(GLOBAL_NS.'_cap', $this->cap); + $this->update_cap = apply_filters(GLOBAL_NS.'_update_cap', $this->update_cap); + $this->network_cap = apply_filters(GLOBAL_NS.'_network_cap', $this->network_cap); + $this->uninstall_cap = apply_filters(GLOBAL_NS.'_uninstall_cap', $this->uninstall_cap); /*[pro strip-from="lite"]*/ - $this->clear_min_cap = $this->applyWpFilters(GLOBAL_NS.'_clear_min_cap', $this->clear_min_cap); - $this->stats_min_cap = $this->applyWpFilters(GLOBAL_NS.'_stats_min_cap', $this->stats_min_cap); + $this->clear_min_cap = apply_filters(GLOBAL_NS.'_clear_min_cap', $this->clear_min_cap); + $this->stats_min_cap = apply_filters(GLOBAL_NS.'_stats_min_cap', $this->stats_min_cap); /*[/pro]*/ /* -------------------------------------------------------------- */ @@ -641,7 +641,7 @@ public function setup() add_action('delete_user', [$this, 'autoClearAuthorPageCacheOnUserDeletion'], 10, 2); add_action('remove_user_from_blog', [$this, 'autoClearAuthorPageCacheOnUserDeletion'], 10, 1); - if ($this->options['enable'] && $this->applyWpFilters(GLOBAL_NS.'_disable_akismet_comment_nonce', true)) { + if ($this->options['enable'] && apply_filters(GLOBAL_NS.'_disable_akismet_comment_nonce', true)) { add_filter('akismet_comment_nonce', function () { return 'disabled-by-'.SLUG_TD; // MUST return a string literal that is not 'true' or '' (an empty string). See }); // See also why the Akismet nonce should be disabled: diff --git a/src/includes/traits/Ac/PostloadUtils.php b/src/includes/traits/Ac/PostloadUtils.php index a4a61d5f..2f4254de 100644 --- a/src/includes/traits/Ac/PostloadUtils.php +++ b/src/includes/traits/Ac/PostloadUtils.php @@ -158,7 +158,7 @@ public function maybeInvalidateWhenLoggedInPostload() if (!($this->user_token = $this->userToken())) { return; // Nothing to do in this case. } - if ($this->applyWpFilters(GLOBAL_NS.'_invalidate_when_logged_in_postload', true) === false) { + if (apply_filters(GLOBAL_NS.'_invalidate_when_logged_in_postload', true) === false) { return; // Nothing to do in this case (disabled via filter). } $regex = $this->assembleCachePathRegex('', '.*?\.u\/'.preg_quote($this->user_token, '/').'[.\/]'); diff --git a/src/includes/traits/Plugin/InstallUtils.php b/src/includes/traits/Plugin/InstallUtils.php index 832cebc2..b1308e52 100644 --- a/src/includes/traits/Plugin/InstallUtils.php +++ b/src/includes/traits/Plugin/InstallUtils.php @@ -307,7 +307,7 @@ public function addAdvancedCache() 'ac_file_version' => VERSION, // Version when AC file was built. ] ); - if ($this->applyWpFilters(GLOBAL_NS.'_exclude_uris_client_side_too', true)) { + if (apply_filters(GLOBAL_NS.'_exclude_uris_client_side_too', true)) { $possible_advanced_cache_constant_key_values['exclude_client_side_uris'] .= "\n".$this->options['exclude_uris']; } foreach ($possible_advanced_cache_constant_key_values as $_option => $_value) { diff --git a/src/includes/traits/Plugin/OptionUtils.php b/src/includes/traits/Plugin/OptionUtils.php index e4696bb5..4ed77f3c 100644 --- a/src/includes/traits/Plugin/OptionUtils.php +++ b/src/includes/traits/Plugin/OptionUtils.php @@ -46,7 +46,7 @@ public function getOptions($intersect = true, $refresh = false) } // End the collection of all plugin options. $this->options = array_merge($this->default_options, $options); - $this->options = $this->applyWpFilters(GLOBAL_NS.'_options', $this->options); + $this->options = apply_filters(GLOBAL_NS.'_options', $this->options); $this->options = $intersect ? array_intersect_key($this->options, $this->default_options) : $this->options; $this->options = array_map('trim', array_map('strval', $this->options)); diff --git a/src/includes/traits/Plugin/StatsUtils.php b/src/includes/traits/Plugin/StatsUtils.php index 1a4d2692..200dc70c 100644 --- a/src/includes/traits/Plugin/StatsUtils.php +++ b/src/includes/traits/Plugin/StatsUtils.php @@ -18,7 +18,7 @@ trait StatsUtils */ public function statsLogPinger() { - if (!$this->applyWpFilters(GLOBAL_NS.'_statsLogPinger_enable', IS_PRO)) { + if (!apply_filters(GLOBAL_NS.'_statsLogPinger_enable', IS_PRO)) { return; // Stats collection disabled by site. } elseif ($this->options['last_pro_stats_log'] >= strtotime('-1 week')) { return; // No reason to keep pinging. diff --git a/src/includes/traits/Plugin/WcpFeedUtils.php b/src/includes/traits/Plugin/WcpFeedUtils.php index 206c6adb..69c5c847 100644 --- a/src/includes/traits/Plugin/WcpFeedUtils.php +++ b/src/includes/traits/Plugin/WcpFeedUtils.php @@ -102,7 +102,7 @@ public function autoClearXmlFeedsCache($type, $post_id = 0) if (!($variation_regex_frags = $utils->convertVariationsToHostCachePathRegexFrags($variations))) { return $counter; // Nothing to do here. } - $in_sets_of = $this->applyWpFilters(GLOBAL_NS.'_autoClearXmlFeedsCache_in_sets_of', 10, get_defined_vars()); + $in_sets_of = apply_filters(GLOBAL_NS.'_autoClearXmlFeedsCache_in_sets_of', 10, get_defined_vars()); for ($_i = 0; $_i < count($variation_regex_frags); $_i = $_i + $in_sets_of) { $_variation_regex_frags = array_slice($variation_regex_frags, $_i, $in_sets_of); diff --git a/src/includes/traits/Plugin/WcpPluginUtils.php b/src/includes/traits/Plugin/WcpPluginUtils.php index 4a374fe0..7b240780 100644 --- a/src/includes/traits/Plugin/WcpPluginUtils.php +++ b/src/includes/traits/Plugin/WcpPluginUtils.php @@ -22,7 +22,7 @@ trait WcpPluginUtils */ public function autoClearOnPluginActivationDeactivation($plugin, $network_wide = false) { - if (!$this->applyWpFilters(GLOBAL_NS.'_auto_clear_on_plugin_activation_deactivation', true)) { + if (!apply_filters(GLOBAL_NS.'_auto_clear_on_plugin_activation_deactivation', true)) { return 0; // Nothing to do here. } diff --git a/src/includes/traits/Plugin/WcpUserUtils.php b/src/includes/traits/Plugin/WcpUserUtils.php index becf5ca6..471296c7 100644 --- a/src/includes/traits/Plugin/WcpUserUtils.php +++ b/src/includes/traits/Plugin/WcpUserUtils.php @@ -41,7 +41,7 @@ public function autoClearUserCache($user_id) if ($this->options['when_logged_in'] !== 'postload') { return $counter; // Nothing to do. } - if ($this->applyWpFilters(GLOBAL_NS.'_invalidate_when_logged_in_postload', true) === false) { + if (apply_filters(GLOBAL_NS.'_invalidate_when_logged_in_postload', true) === false) { return $counter; // Nothing to do in this case (disabled via filter). } $regex = $this->assembleCachePathRegex('', '.*?\.u\/'.preg_quote($user_id, '/').'[.\/]'); diff --git a/src/includes/traits/Plugin/WcpUtils.php b/src/includes/traits/Plugin/WcpUtils.php index 6161d18b..7d7b4065 100644 --- a/src/includes/traits/Plugin/WcpUtils.php +++ b/src/includes/traits/Plugin/WcpUtils.php @@ -360,7 +360,7 @@ public function autoWurgeCache() */ public function disableAutoWipeCacheRoutines() { - $is_disabled = (boolean) $this->applyWpFilters(GLOBAL_NS.'_disable_auto_wipe_cache_routines', false); + $is_disabled = (boolean) apply_filters(GLOBAL_NS.'_disable_auto_wipe_cache_routines', false); if ($is_disabled && is_admin() && (!IS_PRO || $this->options['change_notifications_enable'])) { $this->enqueueMainNotice( @@ -383,7 +383,7 @@ public function disableAutoWipeCacheRoutines() */ public function disableAutoClearCacheRoutines() { - $is_disabled = (boolean) $this->applyWpFilters(GLOBAL_NS.'_disable_auto_clear_cache_routines', false); + $is_disabled = (boolean) apply_filters(GLOBAL_NS.'_disable_auto_clear_cache_routines', false); if ($is_disabled && is_admin() && (!IS_PRO || $this->options['change_notifications_enable'])) { $this->enqueueMainNotice( @@ -406,7 +406,7 @@ public function disableAutoClearCacheRoutines() */ public function disableAutoPurgeCacheRoutines() { - $is_disabled = (boolean) $this->applyWpFilters(GLOBAL_NS.'_disable_auto_purge_cache_routines', false); + $is_disabled = (boolean) apply_filters(GLOBAL_NS.'_disable_auto_purge_cache_routines', false); if ($is_disabled && is_admin() && (!IS_PRO || $this->options['change_notifications_enable'])) { $this->enqueueMainNotice( diff --git a/src/includes/traits/Shared/CacheLockUtils.php b/src/includes/traits/Shared/CacheLockUtils.php index b380e250..120df705 100644 --- a/src/includes/traits/Shared/CacheLockUtils.php +++ b/src/includes/traits/Shared/CacheLockUtils.php @@ -21,8 +21,8 @@ trait CacheLockUtils */ public function cacheLock() { - if ($this->applyWpFilters(GLOBAL_NS.'\\share::disable_cache_locking', false) - || $this->applyWpFilters(GLOBAL_NS.'_disable_cache_locking', false) + if (apply_filters(GLOBAL_NS.'\\share::disable_cache_locking', false) + || apply_filters(GLOBAL_NS.'_disable_cache_locking', false) ) { return false; // Disabled cache locking. } @@ -30,8 +30,8 @@ public function cacheLock() throw new \Exception(__('Unable to find the wp-config.php file.', SLUG_TD)); } $lock_type = 'flock'; // Default lock type. - $lock_type = $this->applyWpFilters(GLOBAL_NS.'\\share::cache_lock_lock_type', $lock_type); - $lock_type = $this->applyWpFilters(GLOBAL_NS.'_cache_lock_type', $lock_type); + $lock_type = apply_filters(GLOBAL_NS.'\\share::cache_lock_lock_type', $lock_type); + $lock_type = apply_filters(GLOBAL_NS.'_cache_lock_type', $lock_type); if (!in_array($lock_type, ['flock', 'sem'], true)) { $lock_type = 'flock'; // Default lock type. diff --git a/src/includes/traits/Shared/HookUtils.php b/src/includes/traits/Shared/HookUtils.php index 3c0a1270..93afd62d 100644 --- a/src/includes/traits/Shared/HookUtils.php +++ b/src/includes/traits/Shared/HookUtils.php @@ -253,29 +253,4 @@ public function doWpAction($hook) call_user_func_array('do_action', $zencache_args); } } - - /** - * Applies filters w/ back compat. for ZenCache. - * - * @since 150422 Rewrite. - * - * @param string $hook The hook to apply. - * - * @return mixed The filtered value. - */ - public function applyWpFilters($hook) - { - $hook = (string) $hook; - $args = func_get_args(); - $value = call_user_func_array('apply_filters', $args); - - if (mb_stripos($hook, GLOBAL_NS) === 0) { - $zencache_hook = 'zencache'.mb_substr($hook, mb_strlen(GLOBAL_NS)); - $zencache_args = $args; // Use a copy of the args. - $zencache_args[0] = $zencache_hook; - $zencache_args[1] = $value; // Filtered value. - $value = call_user_func_array('apply_filters', $zencache_args); - } - return $value; // Filtered value. - } } From 0036143999527c4027ccd3af887879e4b754cb22 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 27 May 2017 14:30:16 -0400 Subject: [PATCH 3/4] Replace doWpAction() with do_action() Now that WordPress is exposing the standard WP hook/filter library in the early phase, we don't need our own method for this. This also drops backwards compatibility with ZenCache actions. ZenCache has not been supported for more than a year now. See websharks/comet-cache#893 --- src/includes/classes/Plugin.php | 6 +++--- src/includes/functions/wp-cache-postload.php | 6 +++--- src/includes/traits/Shared/HookUtils.php | 21 -------------------- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/includes/classes/Plugin.php b/src/includes/classes/Plugin.php index 3525c56c..b036ffaa 100644 --- a/src/includes/classes/Plugin.php +++ b/src/includes/classes/Plugin.php @@ -229,7 +229,7 @@ public function setup() $setup = -1; // Flag as having been setup. if ($this->enable_hooks) { - $this->doWpAction('before_'.GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); + do_action('before_'.GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); } /* -------------------------------------------------------------- */ @@ -677,7 +677,7 @@ public function setup() } /* -------------------------------------------------------------- */ - $this->doWpAction('after_'.GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); - $this->doWpAction(GLOBAL_NS.'_'.__FUNCTION__.'_complete', get_defined_vars()); + do_action('after_'.GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); + do_action(GLOBAL_NS.'_'.__FUNCTION__.'_complete', get_defined_vars()); } } diff --git a/src/includes/functions/wp-cache-postload.php b/src/includes/functions/wp-cache-postload.php index 661d7108..caf18aae 100644 --- a/src/includes/functions/wp-cache-postload.php +++ b/src/includes/functions/wp-cache-postload.php @@ -16,7 +16,7 @@ function wp_cache_postload() if (!$advanced_cache->is_running) { return; // Not applicable. } - $advanced_cache->doWpAction('before_'.$GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); + do_action('before_'.$GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); /*[pro strip-from="lite"]*/ if (!empty($advanced_cache->postload['invalidate_when_logged_in'])) { @@ -34,6 +34,6 @@ function wp_cache_postload() if (!empty($advanced_cache->postload['wp_main_query'])) { add_action('wp', [$advanced_cache, 'wpMainQueryPostload'], PHP_INT_MAX); } - $advanced_cache->doWpAction('after_'.$GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); - $advanced_cache->doWpAction($GLOBAL_NS.'_'.__FUNCTION__.'_complete', get_defined_vars()); + do_action('after_'.$GLOBAL_NS.'_'.__FUNCTION__, get_defined_vars()); + do_action($GLOBAL_NS.'_'.__FUNCTION__.'_complete', get_defined_vars()); } diff --git a/src/includes/traits/Shared/HookUtils.php b/src/includes/traits/Shared/HookUtils.php index 93afd62d..a01cb9f3 100644 --- a/src/includes/traits/Shared/HookUtils.php +++ b/src/includes/traits/Shared/HookUtils.php @@ -232,25 +232,4 @@ public function applyFilters($hook, $value) return $value; // With applied filters. } - - /** - * Does an action w/ back compat. for ZenCache. - * - * @since 150422 Rewrite. - * - * @param string $hook The hook to apply. - */ - public function doWpAction($hook) - { - $hook = (string) $hook; - $args = func_get_args(); - call_user_func_array('do_action', $args); - - if (mb_stripos($hook, GLOBAL_NS) === 0) { - $zencache_filter = 'zencache'.mb_substr($hook, mb_strlen(GLOBAL_NS)); - $zencache_args = $args; // Use a copy of the args. - $zencache_args[0] = $zencache_filter; - call_user_func_array('do_action', $zencache_args); - } - } } From dd0ad0c08f749d5d258f38b94f97bc1401535970 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 9 Sep 2017 20:03:37 -0400 Subject: [PATCH 4/4] Force change --- .gitchange | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitchange b/.gitchange index bde0fff9..5ac1da7d 100644 --- a/.gitchange +++ b/.gitchange @@ -1 +1 @@ -1491589996 +1505001797