atus, $comment) { if (!isset($comment->comment_post_ID) || empty($comment->comment_post_ID)) { return; // nothing to do } // in case the comment status changed, and either old or new status is "approved", we need to purge cache for the corresponding post if (($old_status != $new_status) && (($old_status === 'approved') || ($new_status === 'approved'))) { $this->purgeCacheByRelevantURLs($comment->comment_post_ID); return; } } public function purgeCacheOnNewComment($comment_id, $comment_status, $comment_data) { if ($comment_status != 1) { return; // if comment is not approved, stop } if (!is_array($comment_data)) { return; // nothing to do } if (!array_key_exists('comment_post_ID', $comment_data)) { return; // nothing to do } // all clear, we ne need to purge cache related to this post id $this->purgeCacheByRelevantURLs($comment_data['comment_post_ID']); } /** * Accepts a page rule key and value to check if it exists in the page rules * provided. * * @param mixed $pagerules * @param mixed $key * @param mixed $value * @return bool */ private function pageRuleContains($pagerules, $key, $value) { if (!is_array($pagerules)) { return false; } foreach ($pagerules as $pagerule) { foreach ($pagerule["actions"] as $action) { // always_use_https can only be toggled on for a URL but doesn't // have a value so we merely check the presence of the key // instead. if ($action["id"] == "always_use_https" && $key == "always_use_https") { return true; } if (!array_key_exists("value", $action)) { continue; } if ($action["id"] == $key && $action["value"] == $value) { return true; } } } return false; } private function zoneSettingAlwaysUseHTTPSEnabled($zoneTag) { $settings = $this->api->getZoneSetting($zoneTag, "always_use_https"); return !empty($settings["value"]) && $settings["value"] == "on"; } /** * pathHasCachableFileExtension takes a string of a URL and evaluates if it * has a file extension that Cloudflare caches by default. * * @param mixed $value * @return bool */ private function pathHasCachableFileExtension($value) { $parsed_url = parse_url($value, PHP_URL_PATH); foreach (self::CLOUDFLARE_CACHABLE_EXTENSIONS as $ext) { if (Utils::strEndsWith($parsed_url, "." . $ext)) { return true; } } return false; } /** * pathIsNotForFeeds accepts a string URL and checks if the path doesn't matches any * known feed paths such as "/feed", "/feed/", "/feed/rdf/", "/feed/rss/", * "/feed/atom/", "/author/foo/feed", "/comments/feed", "/shop/feed", * "/tag/.../feed/", etc. * * @param mixed $value * @return bool */ private function pathIsNotForFeeds($value) { $parsed_url = parse_url($value, PHP_URL_PATH); return (bool) !preg_match('/\/feed(?:\/(?:atom\/?|r(?:df|ss)\/?)?)?$/', $parsed_url); } /** * urlIsHTTPS determines if a scheme used for a URL is HTTPS. * * @param mixed $value * @return bool */ private function urlIsHTTPS($value) { $parsed_scheme = parse_url($value, PHP_URL_SCHEME); if ($parsed_scheme == "https") { return true; } return false; } }
Fatal error: Uncaught Error: Class 'CF\WordPress\Hooks' not found in /home/ocb/public_html/wp-content/plugins/cloudflare/cloudflare.loader.php:36 Stack trace: #0 /home/ocb/public_html/wp-content/plugins/cloudflare/cloudflare.php(49): require_once() #1 /home/ocb/public_html/wp-settings.php(522): include_once('/home/ocb/publi...') #2 /home/ocb/public_html/wp-config.php(77): require_once('/home/ocb/publi...') #3 /home/ocb/public_html/wp-load.php(50): require_once('/home/ocb/publi...') #4 /home/ocb/public_html/wp-blog-header.php(13): require_once('/home/ocb/publi...') #5 /home/ocb/public_html/index.php(17): require('/home/ocb/publi...') #6 {main} thrown in /home/ocb/public_html/wp-content/plugins/cloudflare/cloudflare.loader.php on line 36