}else if(is_file($mobile_path)){ @unlink($mobile_path); } } } } } public function singleDeleteCache($comment_id = false, $post_id = false, $to_clear_parents = true){ if($varnish_datas = get_option("WpFastestCacheVarnish")){ include_once('inc/varnish.php'); VarnishWPFC::purge_cache($varnish_datas); } include_once('inc/cdn.php'); CdnWPFC::cloudflare_clear_cache(); $to_clear_feed = true; // not to clear cache of homepage/cats/tags after ajax request by other plugins if(isset($_POST) && isset($_POST["action"])){ // kk Star Rating if($_POST["action"] == "kksr_ajax"){ $to_clear_parents = false; } // All In One Schema.org Rich Snippets if(preg_match("/bsf_(update|submit)_rating/i", $_POST["action"])){ $to_clear_parents = false; } // Yet Another Stars Rating if($_POST["action"] == "yasr_send_visitor_rating"){ $to_clear_parents = false; $post_id = sanitize_text_field($_POST["post_id"]); } // All In One Schema.org Rich Snippets if(preg_match("/bsf_(update|submit)_rating/i", $_POST["action"])){ $to_clear_feed = false; } } if($comment_id){ $comment_id = intval($comment_id); $comment = get_comment($comment_id); if($comment && $comment->comment_post_ID){ $post_id = $comment->comment_post_ID; } } if($post_id){ $post_id = intval($post_id); $permalink = get_permalink($post_id); $permalink = urldecode(get_permalink($post_id)); //for trash contents if(preg_match("/\/\?(p|page_id)\=\d+/i", $permalink)){ $post = get_post($post_id); $clone_post = clone $post; $clone_post->post_status = 'publish'; $permalink = get_permalink($clone_post); $permalink = rtrim($permalink, "/"); $permalink = preg_replace("/__trashed$/", "", $permalink); //for /%postname%/%post_id% : sample-url__trashed/57595 $permalink = preg_replace("/__trashed\/(\d+)$/", "/$1", $permalink); } if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){ $path = $this->getWpContentDir("/cache/all/").$out[1]; $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1]; if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){ include_once $this->get_premium_path("logs.php"); $log = new WpFastestCacheLogs("delete"); $log->action(); } $files = array(); if(is_dir($path)){ array_push($files, $path); } if(is_dir($mobile_path)){ array_push($files, $mobile_path); } if(defined('WPFC_CACHE_QUERYSTRING') && WPFC_CACHE_QUERYSTRING){ $files_with_query_string = glob($path."\?*"); $mobile_files_with_query_string = glob($mobile_path."\?*"); if(is_array($files_with_query_string) && (count($files_with_query_string) > 0)){ $files = array_merge($files, $files_with_query_string); } if(is_array($mobile_files_with_query_string) && (count($mobile_files_with_query_string) > 0)){ $files = array_merge($files, $mobile_files_with_query_string); } } if($to_clear_feed){ // to clear cache of /feed if(preg_match("/https?:\/\/[^\/]+\/(.+)/", get_feed_link(), $feed_out)){ array_push($files, $this->getWpContentDir("/cache/all/").$feed_out[1]); } // to clear cache of /comments/feed/ if(preg_match("/https?:\/\/[^\/]+\/(.+)/", get_feed_link("comments_"), $comment_feed_out)){ array_push($files, $this->getWpContentDir("/cache/all/").$comment_feed_out[1]); } } foreach((array)$files as $file){ $this->rm_folder_recursively($file); } } if($to_clear_parents){ // to clear cache of homepage $this->deleteHomePageCache(); // to clear cache of author page $this->delete_author_page_cache($post_id); // to clear sitemap cache $this->delete_sitemap_cache(); // to clear cache of next post and cache of prev post $this->delete_next_prev_cache($post_id); // to clear cache of cats and tags which contains the post (only first page) global $wpdb; $terms = $wpdb->get_results("SELECT * FROM `".$wpdb->prefix."term_relationships` WHERE `object_id`=".$post_id, ARRAY_A); foreach ($terms as $term_key => $term_val){ $this->delete_cache_of_term($term_val["term_taxonomy_id"]); } } $this->delete_multiple_domain_mapping_cache(); } } public function delete_next_prev_cache($post_id){ global $wpdb; $post = get_post($post_id); $next_post_query = "SELECT * FROM `".$wpdb->prefix."posts` WHERE ID = (SELECT min(ID) FROM `".$wpdb->prefix."posts` where ID > ".$post_id." AND `post_type` = '".$post->post_type."' AND `post_status` = 'publish')"; $prev_post_query = "SELECT * FROM `".$wpdb->prefix."posts` WHERE ID = (SELECT max(ID) FROM `".$wpdb->prefix."posts` where ID < ".$post_id." AND `post_type` = '".$post->post_type."' AND `post_status` = 'publish')"; $res = $wpdb->get_results($next_post_query." UNION ".$prev_post_query); if(isset($res[0])){ foreach ($res as $key => $value) { $permalink = urldecode(get_permalink($value->ID)); if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){ $path = $this->getWpContentDir("/cache/all/").$out[1]; $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1]; if(is_dir($path)){ $this->rm_folder_recursively($path); } if(is_dir($mobile_path)){ $this->rm_folder_recursively($mobile_path); } } } } } public function delete_sitemap_cache(){ //to clear sitemap.xml and sitemap-(.+).xml $files = array_merge(glob($this->getWpContentDir("/cache/all/")."sitemap*.xml"), glob($this->getWpContentDir("/cache/wpfc-mobile-cache/")."sitemap*.xml")); foreach((array)$files as $file){ $this->rm_folder_recursively($file); } } public function delete_multiple_domain_mapping_cache($minified = false){ //https://wordpress.org/plugins/multiple-domain-mapping-on-single-site/ if($this->isPluginActive("multiple-domain-mapping-on-single-site/multidomainmapping.php")){ $multiple_arr = get_option('falke_mdm_mappings'); if(isset($multiple_arr) && isset($multiple_arr["mappings"]) && isset($multiple_arr["mappings"][0])){ foreach($multiple_arr["mappings"] as $mapping_key => $mapping_value){ if($minified){ $mapping_domain_path = preg_replace("/(\/cache\/[^\/]+\/all\/)/", "/cache/".$mapping_value["domain"]."/", $this->getWpContentDir("/cache/all/")); if(is_dir($mapping_domain_path)){ if(@rename($mapping_domain_path, $this->getWpContentDir("/cache/tmpWpfc/").$mapping_value["domain"]."_".time())){ } } }else{ $mapping_domain_path = preg_replace("/(\/cache\/[^\/]+\/all)/", "/cache/".$mapping_value["domain"]."/all", $this->getWpContentDir("/cache/all/index.html")); @unlink($mapping_domain_path); } } } } } public function delete_author_page_cache($post_id){ $author_id = get_post_field ('post_author', $post_id); $permalink = get_author_posts_url($author_id); if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){ $path = $this->getWpContentDir("/cache/all/").$out[1]; $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1]; $this->move_folder_to_tmpWpfc($path); $this->move_folder_to_tmpWpfc($mobile_path); } } public function move_folder_to_tmpWpfc($path = false){ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){ @mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true); } if(!$path){ return false; } if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){ return false; } if(is_dir($path)){ preg_match("/\/([^\/]+)\/?$/", $path, $type); if(isset($type[1])){ if(preg_match("/\/cache\/wpfc-mobile-cache\//", $path)){ $type[1] = "m_".$type[1]; } $move_to = $this->getWpContentDir("/cache/tmpWpfc/").$type[1]."_".time(); rename($path, $move_to); } } } public function delete_cache_of_term($term_taxonomy_id){ $term = get_term_by("term_taxonomy_id", $term_taxonomy_id); if(!$term || is_wp_error($term)){ return false; } //if(preg_match("/cat|tag|store|listing/", $term->taxonomy)){} $url = get_term_link($term->term_id, $term->taxonomy); if(preg_match("/^http/", $url)){ $path = preg_replace("/https?\:\/\/[^\/]+/i", "", $url); $path = trim($path, "/"); $path = urldecode($path); // to remove the cache of tag/cat if(file_exists($this->getWpContentDir("/cache/all/").$path."/index.html")){ @unlink($this->getWpContentDir("/cache/all/").$path."/index.html"); } if(file_exists($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/index.html")){ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/index.html"); } // to remove the cache of the pages $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$path."/page"); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/page"); // to remove the cache of the feeds $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$path."/feed"); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/feed"); } if($term->parent > 0){ $parent = get_term_by("id", $term->parent, $term->taxonomy); if(isset($parent->term_taxonomy_id)){ $this->delete_cache_of_term($parent->term_taxonomy_id); } } } public function unlink($path){ if(file_exists($path)){ unlink($path); } } public function deleteHomePageCache($log = true){ if($varnish_datas = get_option("WpFastestCacheVarnish")){ include_once('inc/varnish.php'); VarnishWPFC::purge_cache($varnish_datas); } include_once('inc/cdn.php'); CdnWPFC::cloudflare_clear_cache(); $site_url_path = preg_replace("/https?\:\/\/[^\/]+/i", "", site_url()); $home_url_path = preg_replace("/https?\:\/\/[^\/]+/i", "", home_url()); if($site_url_path){ $site_url_path = trim($site_url_path, "/"); if($site_url_path){ $this->unlink($this->getWpContentDir("/cache/all/").$site_url_path."/index.html"); $this->unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$site_url_path."/index.html"); //to clear pagination of homepage cache $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$site_url_path."/page"); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$site_url_path."/page"); } } if($home_url_path){ $home_url_path = trim($home_url_path, "/"); if($home_url_path){ $this->unlink($this->getWpContentDir("/cache/all/").$home_url_path."/index.html"); $this->unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$home_url_path."/index.html"); //to clear pagination of homepage cache $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$home_url_path."/page"); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$home_url_path."/page"); } } if(function_exists("wc_get_page_id")){ if($shop_id = wc_get_page_id('shop')){ $store_url_path = preg_replace("/https?\:\/\/[^\/]+/i", "", get_permalink($shop_id)); if($store_url_path){ $store_url_path = trim($store_url_path, "/"); if($store_url_path){ if(file_exists($this->getWpContentDir("/cache/all/").$store_url_path."/index.html")){ @unlink($this->getWpContentDir("/cache/all/").$store_url_path."/index.html"); } if(file_exists($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html")){ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html"); } //to clear pagination of store homepage cache $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$store_url_path."/page"); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/page"); } } } } $this->unlink($this->getWpContentDir("/cache/all/index.html")); $this->unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/index.html")); //to clear pagination of homepage cache $this->rm_folder_recursively($this->getWpContentDir("/cache/all/page")); $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/page")); // options-reading.php - static posts page if($page_for_posts_id = get_option('page_for_posts')){ $page_for_posts_permalink = urldecode(get_permalink($page_for_posts_id)); $page_for_posts_permalink = rtrim($page_for_posts_permalink, "/"); $page_for_posts_permalink = preg_replace("/__trashed$/", "", $page_for_posts_permalink); //for /%postname%/%post_id% : sample-url__trashed/57595 $page_for_posts_permalink = preg_replace("/__trashed\/(\d+)$/", "/$1", $page_for_posts_permalink); if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $page_for_posts_permalink, $out)){ $page_for_posts_path = $this->getWpContentDir("/cache/all/").$out[1]; $page_for_posts_mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1]; $this->rm_folder_recursively($page_for_posts_path); $this->rm_folder_recursively($page_for_posts_mobile_path); } } if($log){ if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){ include_once $this->get_premium_path("logs.php"); $log = new WpFastestCacheLogs("delete"); $log->action(); } } } public function deleteCache($minified = false){ if($varnish_datas = get_option("WpFastestCacheVarnish")){ include_once('inc/varnish.php'); VarnishWPFC::purge_cache($varnish_datas); } include_once('inc/cdn.php'); CdnWPFC::cloudflare_clear_cache(); $this->set_preload(); $created_tmpWpfc = false; $cache_deleted = false; $minifed_deleted = false; $cache_path = $this->getWpContentDir("/cache/all"); $minified_cache_path = $this->getWpContentDir("/cache/wpfc-minified"); if(class_exists("WpFcMobileCache")){ if(is_dir($this->getWpContentDir("/cache/wpfc-mobile-cache"))){ if(is_dir($this->getWpContentDir("/cache/tmpWpfc"))){ rename($this->getWpContentDir("/cache/wpfc-mobile-cache"), $this->getWpContentDir("/cache/tmpWpfc/mobile_").time()); }else if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){ rename($this->getWpContentDir("/cache/wpfc-mobile-cache"), $this->getWpContentDir("/cache/tmpWpfc/mobile_").time()); } } } if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){ if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){ $created_tmpWpfc = true; }else{ $created_tmpWpfc = false; //$this->systemMessage = array("Permission of /wp-content/cache must be 755", "error"); } }else{ $created_tmpWpfc = true; } //to clear widget cache path $this->deleteWidgetCache(); $this->delete_multiple_domain_mapping_cache($minified); if(is_dir($cache_path)){ if(@rename($cache_path, $this->getWpContentDir("/cache/tmpWpfc/").time())){ delete_option("WpFastestCacheHTML"); delete_option("WpFastestCacheHTMLSIZE"); delete_option("WpFastestCacheMOBILE"); delete_option("WpFastestCacheMOBILESIZE"); $cache_deleted = true; } }else{ $cache_deleted = true; } if($minified){ if(is_dir($minified_cache_path)){ if(@rename($minified_cache_path, $this->getWpContentDir("/cache/tmpWpfc/m").time())){ delete_option("WpFastestCacheCSS"); delete_option("WpFastestCacheCSSSIZE"); delete_option("WpFastestCacheJS"); delete_option("WpFastestCacheJSSIZE"); $minifed_deleted = true; } }else{ $minifed_deleted = true; } }else{ $minifed_deleted = true; } if($created_tmpWpfc && $cache_deleted && $minifed_deleted){ do_action('wpfc_delete_cache'); $this->notify(array("All cache files have been deleted", "updated")); if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){ include_once $this->get_premium_path("logs.php"); $log = new WpFastestCacheLogs("delete"); $log->action(); } }else{ $this->notify(array("Permissions Problem: Read More", "error")); } // for ajax request if(isset($_GET["action"]) && in_array($_GET["action"], array("wpfc_delete_cache", "wpfc_delete_cache_and_minified"))){ die(json_encode($this->systemMessage)); } } public function checkCronTime(){ $crons = _get_cron_array(); foreach ((array)$crons as $cron_key => $cron_value) { foreach ( (array) $cron_value as $hook => $events ) { if(preg_match("/^wp\_fastest\_cache(.*)/", $hook, $id)){ if(!$id[1] || preg_match("/^\_(\d+)$/", $id[1])){ foreach ( (array) $events as $event_key => $event ) { add_action("wp_fastest_cache".$id[1], array($this, 'setSchedule')); } } } } } add_action($this->slug()."_Preload", array($this, 'create_preload_cache'), 11); } public function set_preload(){ include_once('inc/preload.php'); PreloadWPFC::set_preload($this->slug()); } public function create_preload_cache(){ $this->options = $this->getOptions(); include_once('inc/preload.php'); PreloadWPFC::create_preload_cache($this->options); } public function wpfc_remote_get($url, $user_agent, $return_content = false){ //$response = wp_remote_get($url, array('timeout' => 10, 'sslverify' => false, 'headers' => array("cache-control" => array("no-store, no-cache, must-revalidate", "post-check=0, pre-check=0"),'user-agent' => $user_agent))); $response = wp_remote_get($url, array('user-agent' => $user_agent, 'timeout' => 10, 'sslverify' => false, 'headers' => array("cache-control" => "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"))); if (!$response || is_wp_error($response)){ echo $response->get_error_message()." - "; return false; }else{ if(wp_remote_retrieve_response_code($response) != 200){ return false; } if($return_content){ if(wp_remote_retrieve_response_code($response) == 200){ $data = wp_remote_retrieve_body($response); return $data; } } } return true; } public function setSchedule($args = ""){ if($args){ $rule = json_decode($args); if($rule->prefix == "all"){ $this->deleteCache(); }else if($rule->prefix == "homepage"){ $this->deleteHomePageCache(); if(isset($this->options->wpFastestCachePreload_homepage) && $this->options->wpFastestCachePreload_homepage){ $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload Bot - After Cache Timeout"); $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload iPhone Mobile Bot - After Cache Timeout"); } }else if($rule->prefix == "startwith"){ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){ if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){} } $rule->content = trim($rule->content, "/"); $files = glob($this->getWpContentDir("/cache/all/").$rule->content."*"); foreach ((array)$files as $file) { $mobile_file = str_replace("/cache/all/", "/cache/wpfc-mobile-cache/", $file); @rename($file, $this->getWpContentDir("/cache/tmpWpfc/").time()); @rename($mobile_file, $this->getWpContentDir("/cache/tmpWpfc/mobile_").time()); } }else if($rule->prefix == "exact"){ $rule->content = trim($rule->content, "/"); @unlink($this->getWpContentDir("/cache/all/").$rule->content."/index.html"); @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$rule->content."/index.html"); } if($rule->prefix != "all"){ if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){ include_once $this->get_premium_path("logs.php"); $log = new WpFastestCacheLogs("delete"); $log->action($rule); } } }else{ //for old cron job $this->deleteCache(); } } public function modify_htaccess_for_new_user($user_id){ $path = ABSPATH; if($this->is_subdirectory_install()){ $path = $this->getABSPATH(); } $htaccess = @file_get_contents($path.".htaccess"); if(preg_match("/\#\s?Start_WPFC_Exclude_Admin_Cookie/", $htaccess)){ $rules = $this->excludeAdminCookie(); $htaccess = preg_replace("/\#\s?Start_WPFC_Exclude_Admin_Cookie[^\#]*\#\s?End_WPFC_Exclude_Admin_Cookie\s+/", $rules, $htaccess); } @file_put_contents($path.".htaccess", $htaccess); } public function excludeAdminCookie(){ $usernames = array(); $users_groups = array_chunk(get_users(array("role" => "administrator", "fields" => array("user_login"))), 5); foreach ($users_groups as $group_key => $group) { $tmp_user = ""; $tmp_rule = ""; foreach ($group as $key => $value) { $tmp_user = sanitize_user(wp_unslash($value->user_login), true); /* to replace spaces with %20 1. Empty space character causes 500 internal server error 2. "\s" is not detected by htaccess so we added "%20" */ $tmp_user = preg_replace("/\s/", "%20", $tmp_user); array_push($usernames, $tmp_user); } } $rule = "# Start_WPFC_Exclude_Admin_Cookie\n"; $rule = $rule."RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=".implode("|", $usernames); $rule = $rule."\n# End_WPFC_Exclude_Admin_Cookie\n"; return $rule; } public function excludeRules(){ $htaccess_page_rules = ""; $htaccess_page_useragent = ""; $htaccess_page_cookie = ""; $rules_json = get_option("WpFastestCacheExclude"); if(!empty($rules_json) && $rules_json !== "null"){ $rules_std = json_decode($rules_json); // JSON hatalıysa çık if (json_last_error() !== JSON_ERROR_NONE || !is_array($rules_std)) { return ""; } foreach ($rules_std as $value) { // default type $value->type = isset($value->type) ? $value->type : "page"; // content yoksa skip if(empty($value->content)){ continue; } // HTML entity decode (örn: < >) $content = html_entity_decode($value->content, ENT_QUOTES, 'UTF-8'); // ---------- PAGE RULES ---------- if($value->type == "page"){ // REGEX (escape yok!) if(isset($value->prefix) && $value->prefix == "regex"){ // basit regex validation (çok kırılmayı önler) if(@preg_match("/".$content."/", null) === false){ continue; // hatalı regex skip } $htaccess_page_rules .= "RewriteCond %{REQUEST_URI} !".$content." [NC]\n"; } // NORMAL RULES (escape var) else{ // regex injection önleme $safe_content = preg_quote($content, "/"); if($value->prefix == "startwith"){ $safe_content = ltrim($safe_content, "/"); $htaccess_page_rules .= "RewriteCond %{REQUEST_URI} !^/".$safe_content." [NC]\n"; } if($value->prefix == "contain"){ $htaccess_page_rules .= "RewriteCond %{REQUEST_URI} !".$safe_content." [NC]\n"; } if($value->prefix == "exact"){ $safe_content = trim($safe_content, "/"); $htaccess_page_rules .= "RewriteCond %{REQUEST_URI} !^/".$safe_content."$ [NC]\n"; } } } // ---------- USER AGENT ---------- else if($value->type == "useragent"){ $safe_content = preg_quote($content, "/"); $htaccess_page_useragent .= "RewriteCond %{HTTP_USER_AGENT} !".$safe_content." [NC]\n"; } // ---------- COOKIE ---------- else if($value->type == "cookie"){ if($value->prefix == "contain"){ $safe_content = preg_quote($content, "/"); $htaccess_page_cookie .= "RewriteCond %{HTTP:Cookie} !".$safe_content." [NC]\n"; }else if($value->prefix == "regex"){ // basit regex validation (çok kırılmayı önler) if(@preg_match("/".$content."/", null) === false){ continue; // hatalı regex skip } $htaccess_page_cookie .= "RewriteCond %{HTTP:Cookie} !".$content." [NC]\n"; } } } } return "# Start WPFC Exclude\n" .$htaccess_page_rules .$htaccess_page_useragent .$htaccess_page_cookie ."# End WPFC Exclude\n"; } public function getABSPATH(){ if(function_exists("get_home_path")){ return get_home_path(); }else{ $path = ABSPATH; $siteUrl = site_url(); $homeUrl = home_url(); $diff = str_replace($homeUrl, "", $siteUrl); $diff = trim($diff,"/"); $pos = strrpos($path, $diff); if($pos !== false){ $path = substr_replace($path, "", $pos, strlen($diff)); $path = trim($path,"/"); $path = "/".$path."/"; } return $path; } } public function rm_folder_recursively($dir, &$i = 1) { if (!is_dir($dir)) { return true; } $files = @scandir($dir); if ($files === false) { return true; } foreach ($files as $file) { if ($file === '.' || $file === '..') { continue; } if ($i > 100 && !preg_match("/wp-fastest-cache-premium/i", $dir)) { return true; } $path = $dir . '/' . $file; if (is_dir($path)) { $this->rm_folder_recursively($path, $i); } else { if (file_exists($path)) { @unlink($path); $i++; } } } if (is_dir($dir)) { $files_tmp = @scandir($dir); if ($files_tmp !== false && count($files_tmp) <= 2) { @rmdir($dir); } } return true; } public function is_subdirectory_install(){ if(strlen(site_url()) > strlen(home_url())){ return true; } return false; } protected function getMobileUserAgents(){ return implode("|", $this->get_mobile_browsers())."|".implode("|", $this->get_operating_systems()); } public function get_premium_path($name){ return WPFC_WP_PLUGIN_DIR."/wp-fastest-cache-premium/pro/library/".$name; } public function cron_add_minute( $schedules ) { $schedules['everyminute'] = array( 'interval' => 60*1, 'display' => __( 'Once Every 1 Minute' ), 'wpfc' => true ); $schedules['everyfiveminute'] = array( 'interval' => 60*5, 'display' => __( 'Once Every 5 Minutes' ), 'wpfc' => true ); $schedules['everyfifteenminute'] = array( 'interval' => 60*15, 'display' => __( 'Once Every 15 Minutes' ), 'wpfc' => true ); $schedules['twiceanhour'] = array( 'interval' => 60*30, 'display' => __( 'Twice an Hour' ), 'wpfc' => true ); $schedules['onceanhour'] = array( 'interval' => 60*60, 'display' => __( 'Once an Hour' ), 'wpfc' => true ); $schedules['everytwohours'] = array( 'interval' => 60*60*2, 'display' => __( 'Once Every 2 Hours' ), 'wpfc' => true ); $schedules['everythreehours'] = array( 'interval' => 60*60*3, 'display' => __( 'Once Every 3 Hours' ), 'wpfc' => true ); $schedules['everyfourhours'] = array( 'interval' => 60*60*4, 'display' => __( 'Once Every 4 Hours' ), 'wpfc' => true ); $schedules['everyfivehours'] = array( 'interval' => 60*60*5, 'display' => __( 'Once Every 5 Hours' ), 'wpfc' => true ); $schedules['everysixhours'] = array( 'interval' => 60*60*6, 'display' => __( 'Once Every 6 Hours' ), 'wpfc' => true ); $schedules['everysevenhours'] = array( 'interval' => 60*60*7, 'display' => __( 'Once Every 7 Hours' ), 'wpfc' => true ); $schedules['everyeighthours'] = array( 'interval' => 60*60*8, 'display' => __( 'Once Every 8 Hours' ), 'wpfc' => true ); $schedules['everyninehours'] = array( 'interval' => 60*60*9, 'display' => __( 'Once Every 9 Hours' ), 'wpfc' => true ); $schedules['everytenhours'] = array( 'interval' => 60*60*10, 'display' => __( 'Once Every 10 Hours' ), 'wpfc' => true ); $schedules['onceaday'] = array( 'interval' => 60*60*24, 'display' => __( 'Once a Day' ), 'wpfc' => true ); $schedules['everythreedays'] = array( 'interval' => 60*60*24*3, 'display' => __( 'Once Every 3 Days' ), 'wpfc' => true ); $schedules['everysevendays'] = array( 'interval' => 60*60*24*7, 'display' => __( 'Once Every 7 Days' ), 'wpfc' => true ); $schedules['everytendays'] = array( 'interval' => 60*60*24*10, 'display' => __( 'Once Every 10 Days' ), 'wpfc' => true ); $schedules['everyfifteendays'] = array( 'interval' => 60*60*24*15, 'display' => __( 'Once Every 15 Days' ), 'wpfc' => true ); $schedules['montly'] = array( 'interval' => 60*60*24*30, 'display' => __( 'Once a Month' ), 'wpfc' => true ); $schedules['yearly'] = array( 'interval' => 60*60*24*30*12, 'display' => __( 'Once a Year' ), 'wpfc' => true ); return $schedules; } public function setCustomInterval(){ add_filter( 'cron_schedules', array($this, 'cron_add_minute')); } public function isPluginActive( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || $this->isPluginActiveForNetwork( $plugin ); } public function isPluginActiveForNetwork( $plugin ) { if ( !is_multisite() ) return false; $plugins = get_site_option( 'active_sitewide_plugins'); if ( isset($plugins[$plugin]) ) return true; return false; } public function current_url(){ global $wp; $current_url = home_url($_SERVER['REQUEST_URI']); return $current_url; // if(defined('WP_CLI')){ // $_SERVER["SERVER_NAME"] = isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : ""; // $_SERVER["SERVER_PORT"] = isset($_SERVER["SERVER_PORT"]) ? $_SERVER["SERVER_PORT"] : 80; // } // $pageURL = 'http'; // if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){ // $pageURL .= 's'; // } // $pageURL .= '://'; // if($_SERVER['SERVER_PORT'] != '80'){ // $pageURL .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI']; // }else{ // $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; // } // return $pageURL; } public function wpfc_load_plugin_textdomain(){ load_plugin_textdomain('wp-fastest-cache', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } public function cdn_replace_urls($matches){ if(count($this->cdn) > 0){ foreach ($this->cdn as $key => $cdn) { if($cdn->id == "cloudflare"){ continue; } if(isset($cdn->status) && $cdn->status == "pause"){ continue; } if(preg_match("/manifest\.json\.php/i", $matches[0])){ return $matches[0]; } //https://site.com?brizy_media=AttachmentName.jpg&brizy_crop=CropSizes&brizy_post=TheCurrentPost if(preg_match("/brizy_media\=/i", $matches[0])){ return $matches[0]; } //https://cdn.shortpixel.ai/client/q_glossy,ret_img,w_736/http://wpfc.com/stories.png if(preg_match("/cdn\.shortpixel\.ai\/client/i", $matches[0])){ return $matches[0]; } if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){ // Photon will no longer be supported continue; } $cdnurl = $cdn->cdnurl; $cdn->file_types = str_replace(",", "|", $cdn->file_types); if(preg_match("/\.(".$cdn->file_types.")(\"|\'|\?|\)|\s|\"\;)/i", $matches[0])){ //nothing }else{ if(preg_match("/js/", $cdn->file_types)){ if(!preg_match("/\/revslider\/public\/assets\/js/", $matches[0])){ continue; } }else{ continue; } } if($cdn->keywords){ $cdn->keywords = str_replace(",", "|", $cdn->keywords); if(!preg_match("/".preg_quote($cdn->keywords, "/")."/i", $matches[0])){ continue; } } if(isset($cdn->excludekeywords) && $cdn->excludekeywords){ $cdn->excludekeywords = str_replace(",", "|", $cdn->excludekeywords); if(preg_match("/".preg_quote($cdn->excludekeywords, "/")."/i", $matches[0])){ continue; } } if(preg_match("/(data-product_variations|data-siteorigin-parallax)\=[\"\'][^\"\']+[\"\']/i", $matches[0])){ $cdnurl = preg_replace("/(https?\:)?(\/\/)(www\.)?/", "", $cdnurl); // if(preg_match("/i\d\.wp\.com/i", $cdnurl)){ // $matches[0] = preg_replace("/(quot\;|\s)(https?\:)?(\\\\\/\\\\\/|\/\/)(www\.)?".$cdn->originurl."/i", "$1$2$3".$cdnurl, $matches[0]); // }else{ // $matches[0] = preg_replace("/(quot\;|\s)(https?\:)?(\\\\\/\\\\\/|\/\/)(www\.)?".$cdn->originurl."/i", "$1$2$3$4".$cdnurl, $matches[0]); // } $matches[0] = preg_replace("/(quot\;|\s)(https?\:)?(\\\\\/\\\\\/|\/\/)(www\.)?".$cdn->originurl."/i", '${1}${2}${3}'.$cdnurl, $matches[0]); }else if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){ $matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]); $matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]); }else if(isset($matches[2]) && preg_match("/".preg_quote($cdn->originurl, "/")."/", $matches[2])){ $matches[0] = preg_replace("/(http(s?)\:)?\/\/(www\.)?".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]); }else if(isset($matches[2]) && preg_match("/^(\/?)(wp-includes|wp-content)/", $matches[2])){ $matches[0] = preg_replace("/(\/?)(wp-includes|wp-content)/i", $cdnurl."/"."$2", $matches[0]); }else if(preg_match("/[\"\']https?\:\\\\\/\\\\\/[^\"\']+[\"\']/i", $matches[0])){ if(preg_match("/^(logo|url|image)$/i", $matches[1])){ //If the url is called with "//", it causes an error on https://search.google.com/structured-data/testing-tool/u/0/ // // // }else{ // $matches[0] = preg_replace("/\\\\\//", "/", $matches[0]); if(preg_match("/".preg_quote($cdn->originurl, "/")."/", $matches[0])){ $matches[0] = preg_replace("/(http(s?)\:)?\/\/(www\.)?".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]); $matches[0] = preg_replace("/\//", "\/", $matches[0]); } } } } } return $matches[0]; } public function read_file($url){ if(!preg_match("/\.php/", $url)){ $url = preg_replace("/\?.*/", "", $url); if(preg_match("/wp-content/", $url)){ $path = preg_replace("/.+\/wp-content\/(.+)/", WPFC_WP_CONTENT_DIR."/"."$1", $url); }else if(preg_match("/wp-includes/", $url)){ $path = preg_replace("/.+\/wp-includes\/(.+)/", ABSPATH."wp-includes/"."$1", $url); } if(isset($path)){ if(@file_exists($path)){ $filesize = filesize($path); if($filesize > 0){ $myfile = fopen($path, "r") or die("Unable to open file!"); $data = fread($myfile, $filesize); fclose($myfile); return $data; }else{ return false; } } } } return false; } public function get_operating_systems(){ $operating_systems = array( 'Android', 'blackberry|\bBB10\b|rim\stablet\sos', 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino', 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b', 'Windows\sCE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window\sMobile|Windows\sPhone\s[0-9.]+|WCE;', 'Windows\sPhone\s10.0|Windows\sPhone\s8.1|Windows\sPhone\s8.0|Windows\sPhone\sOS|XBLWP7|ZuneWP7|Windows\sNT\s6\.[23]\;\sARM\;', '\biPhone.*Mobile|\biPod|\biPad', 'Apple-iPhone7C2', 'MeeGo', 'Maemo', 'J2ME\/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135 'webOS|hpwOS', '\bBada\b', 'BREW' ); return $operating_systems; } public function get_mobile_browsers(){ $mobile_browsers = array( '\bCrMo\b|CriOS|Android.*Chrome\/[.0-9]*\s(Mobile)?', '\bDolfin\b', 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\/[0-9.]+|Coast\/[0-9.]+', 'Skyfire', 'Mobile\sSafari\/[.0-9]*\sEdge', 'IEMobile|MSIEMobile', // |Trident/[.0-9]+ 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS', 'bolt', 'teashark', 'Blazer', 'Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari', 'Tizen', 'UC.*Browser|UCWEB', 'baiduboxapp', 'baidubrowser', 'DiigoBrowser', 'Puffin', '\bMercury\b', 'Obigo', 'NF-Browser', 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger', 'Android.*PaleMoon|Mobile.*PaleMoon' ); return $mobile_browsers; } } // Load WP CLI command(s) on demand. if ( defined( 'WP_CLI' ) && WP_CLI ) { require_once "inc/cli.php"; } function wpfc_clear_all_site_cache(){ if(defined('WPFC_DISABLE_HOOK_CLEAR_ALL_CACHE') && WPFC_DISABLE_HOOK_CLEAR_ALL_CACHE){ return array("success" => false, "message" => "Clearing Cache Hook system has been disabled"); } do_action("wpfc_clear_all_cache"); } function wpfc_clear_all_cache($minified = false){ if(defined('WPFC_DISABLE_HOOK_CLEAR_ALL_CACHE') && WPFC_DISABLE_HOOK_CLEAR_ALL_CACHE){ return array("success" => false, "message" => "Clearing Cache Hook system has been disabled"); } do_action("wpfc_clear_all_cache", $minified); } function wpfc_exclude_current_page(){ do_action("wpfc_exclude_current_page"); } function wpfc_clear_post_cache_by_id($post_id = false){ if($post_id){ do_action("wpfc_clear_post_cache_by_id", false, $post_id); } } function wpfc_create_post_cache_by_id($post_id = false){ if($post_id){ do_action("wpfc_create_post_cache_by_id", $post_id); } } $GLOBALS["wp_fastest_cache"] = new WpFastestCache(); ?> Dockton Kitchen Faucet: Perfect for Tight Spaces

French Creek Designs Kitchen and Bath Design Center selling cabinets, countertops, flooring, and tile.

Single-Handle Pull-Down Sprayer

Dockton Kitchen Faucet is perfect for those tight spaces. Dockton Pull Down Sprayer, includes a single lever handle with a sophisticated design. As well as a single hole installation and a maximum of 1.75″ deck thickness. Easy installation is in order. As well as being ADA compliant. This single lever handle control is simple. Stop into French Creek Designs to discover Karran Kitchen Faucets.

Shop countertops at French Creek Designs in Casper, WY Kitchen Countertops, Bathroom Countertops, Granite, Quartz, Soapstone, Marble, Wood

Kitchen Faucet Features

Therefore, this vertical handle design to main body, rotates 90° forward. This allows for operation in tight spaces. Such as areas with backsplash. Which includes a dual function spray head. Perfect for powerful scrubbing. As well as gentle rinsing and pot filling. The durable brass construction is lead-free and includes a multi-platted corrosion resistant finish that won’t tarnish and fade over time.

  • Single hole installation – 1.75” maximum deck thickness
  • ADA compliant – Single lever handle makes control simple
  • Vertical handle design to main body, rotates 90° forward allowing for operation in tight spaces with backsplashes
  • Dual function spray head – 1.8 GPM water flow alternates between powerful spray and aerated flow: Perfect for powerful scrubbing, gentle rinsing and pot filling

Two finishes complete the Dockton Kitchen Faucet include a striking Matte Black or Chrome.

Planning Kitchen Remodels

Planning a functional and beautiful kitchen should not be rushed. Therefore, French Creek Designs offers you a FREE design consultation and job site measure. One of our kitchen designers will work with you through the design and material selection process. Such as selecting beautiful kitchen cabinets, countertops, flooring, and wall tile. Not to mention all the kitchen accessories to finalize the beauty in your kitchen. Such as cabinet hardware, cabinet lighting, kitchen sinks, and kitchen faucets.

As well as we have streamlined kitchen planning and design by combining the design process and material selection all in one place. For a complete ONE STOP shopping experience. Our designers will work with you to develop the kitchen design you love.

Casper’s Remodel Store

Casper’s French Creek Design Kitchen Remodel Store is ready to help you to bring your kitchen a fresh new look. You bring your style to us and we will make your kitchen into a beauty that your family, friends, and guests will enjoy for years to come. As well as not sure about your style our Kitchen Designers will assist in helping you to put together a beautiful cohesive design for your kitchen.

Kitchen Trends & Beautiful Ideas

Empowering you with great ideas and designs for your kitchen!

Cabinets On Sale Now Shop Fabuwood Cabinets at French Creek Designs in Casper, WY Kitchen Cabinets
Cabinets

Fabuwood Illume Cabinets

Clean And Timeless Cabinets Fabuwood Illume Cabinets bring a contemporary sleek, clean, and timeless sense…
Cambria Design Videos with Cambria Quartz Countertop options found at French Creek Designs in Casper, WY
Bathroom Design

Cambria Quartz Design Videos

JTNDJTIxLS1TVEFSVCUyMENBTUJSSUElMjBXRUJTSVRFJTIwQ09OVEVOVC0tJTNFJTIwJTNDaWZyYW1lJTIwc3JjJTNEJTIyaHR0cHMlM0ElMkYlMkZ3d3cuY2FtYnJpYXVzYS5jb20lMkZ3ZWJzaXRlLWNvbnRlbnQlMkZ2aWRlb3MlMjIlMjB3aWR0aCUzRCUyMjEwMCUyNSUyMiUyMGhlaWdodCUzRCUyMjEwMDBweCUyMiUyMHN0eWxlJTNEJTIyYmFja2dyb3VuZCUzQSUyMCUyM0ZGRkZGRiUzQiUyMiUyMGZyYW1lYm9yZGVyJTNEJTIyMCUyMiUzRSUzQyUyRmlmcmFtZSUzRSUyMCUzQyUyMS0tRU5EJTIwQ0FNQlJJQSUyMFdFQlNJVEUlMjBDT05URU5ULS0lM0U= Review the Cambria Videos above for more inspiration and ideas. Cambria Designing Countertop For…
Dockton Kitchen Faucet | Dockton Pull Down Sprayer

Dockton Kitchen Faucet

Selections of kitchen faucets can be found in French Creek Designs Kitchen Design Center showroom. Along with this beautiful Dockton Kitchen Faucet made for those tight spaces in the kitchen. Stop in and enjoy the benefits of shopping with French Creek Designs personable staff ready to address your kitchen remodel needs. With everything under one roof we make it easy for your contractor to get going.

Karran Kitchen Faucets

In addition, to the Dockton Kitchen Faucet, compare some of our favorites for a kitchen that works for you. Chef’s of the house will welcome the any one of the robust and hearty kitchen faucets. As well as aide the quick clean up and washing in the kitchen.

Karran Kitchen Faucet Ideas:

Kitchen Sinks Made To Work

Also, stop in and check out several sink selections to enhance the Dockton Kitchen Faucet or any other Karran Faucet.  Apron or Farmhouse Sinks are popular and add class to the kitchen. Here are a few to take a look at.  Along with we have undermount kitchen sinks, and top mount kitchen sinks.

Stainless Steel Kitchen Sinks | Farmhouse Quartz Sinks | Fireclay Farmhouse Sinks | Retrofit Farmhouse Sinks |

One of our favorite kitchen sinks is the ALL In One Workstation Sink. These beautiful quartz workstation kitchen sinks or stainless steel include accessories to make cooking and prep fun and easy. Such as some accessories included with sink: basket strainer, bottom grid, colander, drying rack and cutting board. Options are based on style chosen.

French Creek Designs 
“Making Your Home Beautiful One Room at a Time with your local Kitchen & Bath Experts.”

Kitchen and Bath Designers Available.
  • We Welcome Walk-Ins
  • Design Video Conferencing Available
  • FREE Kitchen Designer
  • FREE Measures & Quotes

Casper’s Favorite Stores in one location:

Also, French Creek Designs can be found on MeWe or Facebook, follow us!

In A Click Start Your Kitchen Renovation!

We work to make homes to be designed for comfort, which includes the kitchen the heart of home. The place where all gather to work, play, or eat. Therefore, we create kitchens that are not only beautiful, as well as functional. Our Designers start with Kitchen Inspiration to kick off the project.

Whether you are doing a full kitchen renovation, or simply updating your kitchen French Creek Designs makes it easy. We walk you through the process with an easy consultation, measure, and drawings for cabinets. Providing you a qualified quote to get started in your kitchen remodel.

So simply, click the button below and schedule an appointment with one of our designers. Rather talk with someone just call our Designers at 307-337-4500 and we will walk you through the process.

Book A FREE Measure, Consultation. and Quote today at 307-337-4500.

Design Your Kitchen Free Now! Start Design Services | Casper's Kitchen Design Center Purchase cabinets, countertops, kitchen sinks, kitchen faucets, and flooring at French Creek Designs.