Changeset 1248032
- Timestamp:
- 09/18/2015 12:24:25 AM (11 years ago)
- File:
-
- 1 edited
-
super-static-cache/trunk/super-static-cache.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-static-cache/trunk/super-static-cache.php
r1247197 r1248032 4 4 Plugin URI: https://www.hitoy.org/super-static-cache-for-wordperss.html 5 5 Description: Super Static Cache is an efficient WordPress caching engine which provides three cache mode. It can reduce the pressure of the database significantly that makes your website faster than ever. 6 Version: 3.2. 56 Version: 3.2.6 7 7 Author: Hito 8 8 Author URI: https://www.hitoy.org/ … … 81 81 82 82 83 $fh = opendir($uri); 84 while(($row = readdir($fh)) !== false){ 85 if($row == '.' || $row == '..' || $row == 'rewrite_ok.txt'){ 86 continue; 87 } 88 if(!is_dir($uri.'/'.$row)){ 89 unlink($uri.'/'.$row); 90 } 91 delete_uri($uri.'/'.$row); 92 } 93 closedir($fh); 94 //删除文件之后再删除自身 95 @rmdir($uri); 83 $fh = opendir($uri); 84 while(($row = readdir($fh)) !== false){ 85 if($row == '.' || $row == '..' || $row == 'rewrite_ok.txt'){ 86 continue; 87 } 88 if(!is_dir($uri.'/'.$row)){ 89 unlink($uri.'/'.$row); 90 } 91 delete_uri($uri.'/'.$row); 92 } 93 closedir($fh); 94 //删除文件之后再删除自身 95 @rmdir($uri); 96 96 } 97 97 … … 101 101 if(function_exists("curl_init")){ 102 102 $ch = curl_init(); 103 curl_setopt($ch, CURLOPT_URL, $url); 103 curl_setopt($ch, CURLOPT_URL, $url); 104 104 curl_setopt($ch, CURLOPT_REFERER,$url); 105 105 curl_setopt($ch, CURLOPT_TIMEOUT,10); 106 106 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 107 107 curl_setopt($ch, CURLOPT_USERAGENT,'SSCS/3 (Super Static Cache Spider/3; +https://www.hitoy.org/super-static-cache-for-wordperss.html#Spider)'); 108 curl_exec($ch); 109 curl_close($ch); 108 curl_exec($ch); 109 curl_close($ch); 110 110 }else{ 111 111 file_get_contents($url); … … 147 147 //是否是严格模式缓存,默认开启 148 148 //开启严格模式将不缓存既没有后缀,又没有以"/"结尾的uri 149 private $isstrict; 149 private $isstrict; 150 150 151 151 //siteurl … … 269 269 //含有后置的请求 270 270 $cachename = $this->wppath.$cachedir.$realname; 271 }else if($this->cachemod != 'direct'){ 271 }else if($this->cachemod != 'direct'){ 272 272 //不管是否严格模式,只要缓存模式不为direct时,都给于缓存 273 273 $cachename = $this->wppath.$cachedir.$realname."/index.html"; … … 381 381 382 382 $wpssc = new WPStaticCache(); 383 add_action(" wp_loaded",array($wpssc,"init"),1);383 add_action("template_redirect",array($wpssc,"init"),0); 384 384 385 385 //更新缓存的动作 … … 394 394 $wpssc->build_post_cache($comment); 395 395 } 396 } 396 } 397 397 //发布评论的钩子 398 398 add_action('comment_post','comment_post_hook');
Note: See TracChangeset
for help on using the changeset viewer.