| Last change
                  on this file since 36 was
                  35,
                  checked in by toemon, 17 years ago | 
        
          | 
ブロックのテストの為にXOOPSの基本構成でコメントブロックを作成現状ではブロック側がモジュール複製には対応していない。
 
 | 
        | File size:
            1.3 KB | 
      
      
        
  | Line |  | 
|---|
| 1 | <?php | 
|---|
| 2 |  | 
|---|
| 3 | if(!function_exists("xpress_block_cache_set")): | 
|---|
| 4 | function xpress_block_cache_set($mydirname,$collation_key) | 
|---|
| 5 | { | 
|---|
| 6 | $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 7 | $cache_time = 0; | 
|---|
| 8 | $filename = $cache_dir .$mydirname . '_' . $collation_key; | 
|---|
| 9 | if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { | 
|---|
| 10 | return file_get_contents($filename); | 
|---|
| 11 | } else { | 
|---|
| 12 | return ''; | 
|---|
| 13 | } | 
|---|
| 14 | } | 
|---|
| 15 | endif; | 
|---|
| 16 |  | 
|---|
| 17 | if(!function_exists("xpress_cache_make")): | 
|---|
| 18 | function xpress_cache_make($mydirname,$collation_key,$content) | 
|---|
| 19 | { | 
|---|
| 20 | $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 21 | $cache_time = 0; | 
|---|
| 22 |  | 
|---|
| 23 | $filename = $cache_dir .$mydirname . '_' . $collation_key; | 
|---|
| 24 | if ((time() - @filemtime($filename)) > $cache_time) { | 
|---|
| 25 | $fp = fopen($filename, "w"); | 
|---|
| 26 | flock($fp, 2); | 
|---|
| 27 | fputs($fp, $content); | 
|---|
| 28 | fclose($fp); | 
|---|
| 29 | } | 
|---|
| 30 | } | 
|---|
| 31 | endif; | 
|---|
| 32 |  | 
|---|
| 33 | if(!function_exists("xpress_block_cache_clear")): | 
|---|
| 34 | function xpress_cache_clear($mydirname) | 
|---|
| 35 | { | 
|---|
| 36 | $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 37 | $cache_time = 0; | 
|---|
| 38 | if ($dh = opendir($cache_dir)) { | 
|---|
| 39 | while (($file = readdir($dh)) !== false) { | 
|---|
| 40 | if (preg_match('/^' . preg_quote($mydirname) . '/', $file)) { | 
|---|
| 41 | unlink($cache_dir.$file); | 
|---|
| 42 | } | 
|---|
| 43 | } | 
|---|
| 44 | closedir($dh); | 
|---|
| 45 | } | 
|---|
| 46 | } | 
|---|
| 47 | endif; | 
|---|
| 48 |  | 
|---|
| 49 | ?> | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.