age_number_max"); foreach (range(1, $page_number_max) as $page_number) { array_push($listofurls, home_url(sprintf('/page/%s/', $page_number))); } // Attachments if ('attachment' == $postType) { $attachmentUrls = array(); foreach (get_intermediate_image_sizes() as $size) { $attachmentSrc = wp_get_attachment_image_src($postId, $size); if (is_array($attachmentSrc) && !empty($attachmentSrc)) { $attachmentUrls[] = $attachmentSrc[0]; } } $listofurls = array_merge( $listofurls, $attachmentUrls ); } // Clean array and get unique values $listofurls = array_values(array_filter(array_unique($listofurls))); // Purge https and http URLs if (function_exists('force_ssl_admin') && force_ssl_admin()) { $listofurls = array_merge($listofurls, str_replace('https://', 'http://', $listofurls)); } elseif (!is_ssl() && function_exists('force_ssl_content') && force_ssl_content()) { $listofurls = array_merge($listofurls, str_replace('http://', 'https://', $listofurls)); } return $listofurls; } protected function isPluginSpecificCacheEnabled() { $cacheSettingObject = $this->dataStore->getPluginSetting(\CF\API\Plugin::SETTING_PLUGIN_SPECIFIC_CACHE); if (!$cacheSettingObject) { return false; } $cacheSettingValue = $cacheSettingObject[\CF\API\Plugin::SETTING_VALUE_KEY]; return $cacheSettingValue !== false && $cacheSettingValue !== 'off'; } protected function isAutomaticPlatformOptimizationEnabled() { $cacheSettingObject = $this->dataStore->getPluginSetting(\CF\API\Plugin::SETTING_AUTOMATIC_PLATFORM_OPTIMIZATION); if (!$cacheSettingObject) { return false; } $cacheSettingValue = $cacheSettingObject[\CF\API\Plugin::SETTING_VALUE_KEY]; return $cacheSettingValue !== false && $cacheSettingValue !== 'off'; } protected function isAutomaticPlatformOptimizationCacheByDeviceTypeEnabled() { $cacheSettingObject = $this->dataStore->getPluginSetting(\CF\API\Plugin::SETTING_AUTOMATIC_PLATFORM_OPTIMIZATION_CACHE_BY_DEVICE_TYPE); if (!$cacheSettingObject) { return false; } $cacheSettingValue = $cacheSettingObject[\CF\API\Plugin::SETTING_VALUE_KEY]; return $cacheSettingValue !== false && $cacheSettingValue !== 'off'; } public function http2ServerPushInit() { HTTP2ServerPush::init(); } /* * php://input can only be read once before PHP 5.6, try to grab it ONLY if the request * is coming from the cloudflare proxy. We store it in a global so \CF\WordPress\Proxy * can act on the request body later on in the script execution. */ public function getCloudflareRequestJSON() { if (isset($_GET['action']) && $_GET['action'] === self::WP_AJAX_ACTION) { $GLOBALS[self::CLOUDFLARE_JSON] = file_get_contents('php://input'); } } public function initAutomaticPlatformOptimization() { // it could be too late to set the headers, // return early without triggering a warning in logs if (headers_sent()) { return; } // add header unconditionally so we can detect plugin is activated $cache = apply_filters('cloudflare_use_cache', !is_user_logged_in()); if ($cache) { header('cf-edge-cache: cache,platform=wordpress'); } else { header('cf-edge-cache: no-cache'); } } public function purgeCacheOnPostStatusChange($new_status, $old_status, $post) { if ('publish' === $new_status || 'publish' === $old_status) { $this->purgeCacheByRelevantURLs($post->ID); } } public function purgeCacheOnCommentStatusChange($new_status, $old_status, $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