From f05e709a52fe8b9d47d98da8653fcabc9a68a79e Mon Sep 17 00:00:00 2001 From: JasWSInc Date: Tue, 5 Aug 2014 08:29:30 -0800 Subject: [PATCH] Improve portability of `advanced-cache.php` with respect to `%%QUICK_CACHE_PLUGIN_FILE%%`; see websharks/quick-cache#258 --- quick-cache/quick-cache.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quick-cache/quick-cache.inc.php b/quick-cache/quick-cache.inc.php index 365bf92..40d463f 100644 --- a/quick-cache/quick-cache.inc.php +++ b/quick-cache/quick-cache.inc.php @@ -1814,9 +1814,11 @@ public function add_advanced_cache() } unset($_option, $_value, $_values, $_response); // Housekeeping. + if(strpos($this->file, WP_CONTENT_DIR) === 0) + $plugin_file = "WP_CONTENT_DIR.'".$this->esc_sq(str_replace(WP_CONTENT_DIR, '', $this->file))."'"; + else $plugin_file = "'".$this->esc_sq($this->file)."'"; // Else use full absolute path. // Make it possible for the `advanced-cache.php` handler to find the plugin directory reliably. - $advanced_cache_contents = str_ireplace("'%%".__NAMESPACE__."_PLUGIN_FILE%%'", // e.g. `QUICK_CACHE_PLUGIN_FILE`. - "'".$this->esc_sq($this->file)."'", $advanced_cache_contents); + $advanced_cache_contents = str_ireplace("'%%".__NAMESPACE__."_PLUGIN_FILE%%'", $plugin_file, $advanced_cache_contents); // Ignore; this is created by Quick Cache; and we don't need to obey in this case. #if(defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS)