wordpress/wp-content/themes/basic/themify/cache/class-themify-cache.php
/**
     * will be called in advanced-cache.php before wp full core load,a lot of functions from wp api and FW functions are't available in in this function be carefull!
     */
will be called in advanced-cache.php before wp full core load,a lot of functions from wp api and FW functions are't available in in this function be carefull!
will be called in advanced - cache . php before wp full core load a lot of functions from wp api and FW functions are ' t available in in this function be carefull!
public static function run(){
		if(self::$stopCache===true){
		    return;
		}
		self::$cache_dir=self::get_cache_main_dir();
		if(is_dir(self::$cache_dir) || mkdir(self::$cache_dir)){
			$isMulti=is_multisite();
			if($isMulti!==false){
				self::$cache_dir=self::get_cache_blog_dir();
			}	
			if($isMulti===false || is_dir(self::$cache_dir) || mkdir(self::$cache_dir,0777, true)){
				if(defined('TF_CACHE_RULES') && TF_CACHE_RULES){
					$ignore=explode('|TF|',TF_CACHE_RULES);
					if(!empty($ignore)){
						$request=$_SERVER['REQUEST_URI'];
						$server=is_ssl() ? 'https://' : 'http://';
						$server.=$_SERVER['HTTP_HOST'];
						$del='~';
						foreach($ignore as $r){
							$r=str_replace($server,'',$r);
							$p=$del.$r.$del;
							if(preg_match($p,$request)){
								self::$cache_dir=null;
								return;
							}
						}
						$request=$server=$ignore=null;
					}
				}
				$dir=null;
				self::$cache_dir=self::get_current_cache('',true);
				if(self::is_safari()){
					self::$cache_dir.='_safari';
				}
				self::$cache_dir.='.html';
				if(is_file(self::$cache_dir)){
					$ftime=filemtime(self::$cache_dir);
					$expire=defined('TF_CACHE_TIME') && TF_CACHE_TIME?(TF_CACHE_TIME*60):WEEK_IN_SECONDS;
					$liveTime=$expire+$ftime;	
					if($liveTime>time()){
						clearstatcache();
						if(is_file(self::$cache_dir)){							$type = self::get_available_gzip();
							if($type!==false && is_file(self::$cache_dir.'.gz')){
								$type=key($type);
								if(isset( $_SERVER['HTTP_ACCEPT_ENCODING']) && strpos( $_SERVER['HTTP_ACCEPT_ENCODING'],$type)!==false){
									self::$cache_dir.='.gz';
									header('Content-Encoding:'.$type);
								}
							}
							header('Cache-Control:no-cache, must-revalidate, max-age=0');
							header('Content-Type:text/html;charset=UTF-8');
							header('Content-Length: '.filesize(self::$cache_dir));
							header('Last-Modified:' . gmdate('D, d M Y H:i:s', $ftime) . ' GMT' );
							header('Expires:'.gmdate('D, d M Y H:i:s', $liveTime).'GMT');
							readfile (self::$cache_dir);
							die;
						}
					}
					else{
						unlink(self::$cache_dir);
						if(is_file(self::$cache_dir.'.gz')){
							unlink(self::$cache_dir.'.gz');
						}
					}
				}
				add_filter( 'template_include', array( __CLASS__, 'template_include' ), -9999999 );
			}
			else{
				self::$cache_dir=null;
			}
		}
		else{
			self::$cache_dir=null;
		}
    }
public static function run ( ) { if ( self :: $ stopCache === true ) { return ; } self :: $ cache_dir = self :: get_cache_main_dir ( ) ; if ( is_dir ( self :: $ cache_dir ) || mkdir ( self :: $ cache_dir ) ) { $ isMulti = is_multisite ( ) ; if ( $ isMulti !== false ) { self :: $ cache_dir = self :: get_cache_blog_dir ( ) ; } if ( $ isMulti === false || is_dir ( self :: $ cache_dir ) || mkdir ( self :: $ cache_dir , 0777 , true ) ) { if ( defined ( 'TF_CACHE_RULES' ) && TF_CACHE_RULES ) { $ ignore = explode ( '|TF|' , TF_CACHE_RULES ) ; if ( ! empty ( $ ignore ) ) { $ request = $ _SERVER [ 'REQUEST_URI' ] ; $ server = is_ssl ( ) ? 'https://' : 'http://' ; $ server .= $ _SERVER [ 'HTTP_HOST' ] ; $ del = '~' ; foreach ( $ ignore as $ r ) { $ r = str_replace ( $ server , '' , $ r ) ; $ p = $ del . $ r . $ del ; if ( preg_match ( $ p , $ request ) ) { self :: $ cache_dir = null ; return ; } } $ request = $ server = $ ignore = null ; } } $ dir = null ; self :: $ cache_dir = self :: get_current_cache ( '' , true ) ; if ( self :: is_safari ( ) ) { self :: $ cache_dir .= '_safari' ; } self :: $ cache_dir .= '.html' ; if ( is_file ( self :: $ cache_dir ) ) { $ ftime = filemtime ( self :: $ cache_dir ) ; $ expire = defined ( 'TF_CACHE_TIME' ) && TF_CACHE_TIME ? ( TF_CACHE_TIME * 60 ) : WEEK_IN_SECONDS ; $ liveTime = $ expire + $ ftime ; if ( $ liveTime > time ( ) ) { clearstatcache ( ) ; if ( is_file ( self :: $ cache_dir ) ) { $ type = self :: get_available_gzip ( ) ; if ( $ type !== false && is_file ( self :: $ cache_dir . '.gz' ) ) { $ type = key ( $ type ) ; if ( isset ( $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] ) && strpos ( $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] , $ type ) !== false ) { self :: $ cache_dir .= '.gz' ; header ( 'Content-Encoding:' . $ type ) ; } } header ( 'Cache-Control:no-cache, must-revalidate, max-age=0' ) ; header ( 'Content-Type:text/html;charset=UTF-8' ) ; header ( 'Content-Length: ' . filesize ( self :: $ cache_dir ) ) ; header ( 'Last-Modified:' . gmdate ( 'D, d M Y H:i:s' , $ ftime ) . ' GMT' ) ; header ( 'Expires:' . gmdate ( 'D, d M Y H:i:s' , $ liveTime ) . 'GMT' ) ; readfile ( self :: $ cache_dir ) ; die ; } } else { unlink ( self :: $ cache_dir ) ; if ( is_file ( self :: $ cache_dir . '.gz' ) ) { unlink ( self :: $ cache_dir . '.gz' ) ; } } } add_filter ( 'template_include' , array ( __CLASS__ , 'template_include' ) , - 9999999 ) ; } else { self :: $ cache_dir = null ; } } else { self :: $ cache_dir = null ; } }
will be called in advanced-cache.php before wp full core load,a lot of functions from wp api and FW functions are't available in in this function be carefull!
will be called in advanced - cache . php before wp full core load a lot of functions from wp api and FW functions are ' t available in in this function be carefull!
//maybe another proccess has already removed it?
