From 4cfb3d0ab7163d9f907775434385801e4856f3e3 Mon Sep 17 00:00:00 2001 From: Vasyl Sokolyk Date: Thu, 16 May 2019 18:24:31 +0300 Subject: [PATCH] added advanced-cache.php --- include/advanced-cache.php | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 include/advanced-cache.php diff --git a/include/advanced-cache.php b/include/advanced-cache.php new file mode 100644 index 0000000..922a8f8 --- /dev/null +++ b/include/advanced-cache.php @@ -0,0 +1,80 @@ +host !== $home_url_info->host) { +// return $result; +// } +// +// if (!empty($url_info->query)) { +// parse_str($url_info->query, $query); +// +// $query = array_filter($query, static function ($value, $key) { +// return in_array($key, ['p', 'page_id', 'attachment_id'], true); +// }, ARRAY_FILTER_USE_BOTH); +// +// if (!empty($query)) { +// return get_post((int) $query[key($query)]); +// } +// } +// +// $url_info->scheme = $home_url_info->scheme; +// +// if (false !== strpos($home_url_info->host, 'www.') && false === strpos($url_info->host, 'www.')) { +// $url_info->host = "www.{$url_info->host}"; +// } elseif (false === strpos($home_url_info->host, 'www.')) { +// $url_info->host = ltrim($url_info->host, 'www.'); +// } +// +// if (trim($url, '/') === $home_url && 'page' === get_option('show_on_front')) { +// $page_on_front = get_option('page_on_front'); +// +// if ($page_on_front) { +// return get_post($page_on_front); +// } +// } +// +// $url = trailingslashit("{$url_info->scheme}://{$url_info->host}{$url_info->path}"); +// +// $sql = $wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS ID FROM $wpdb->posts p WHERE p.guid = %s LIMIT 1", [ +// $url, +// ]); +// +// $results = $wpdb->get_var($sql); +// +// if (!empty($results)) { +// return get_post((int) $results); +// } +// +// return $result; +// } +// +// return $result; +//}