国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > PhpCMS > 正文

PHPCMS2008tag的解析方法

2024-09-10 07:16:04
字體:
供稿:網(wǎng)友
  1. <?php   
  2. function cachehtml(){   
  3.     $head['title'] = '網(wǎng)站地圖 - '.$PHPCMS['sitename'];   
  4.     $head['keywords'] = $PHPCMS['sitename'];   
  5.     ob_start();   
  6.     include template('phpcms''sitemap');   
  7.     $file = PHPCMS_ROOT.'sitemap.html';   
  8.     createhtml($file);   
  9. }   
  10.    
  11. function template($module = 'phpcms'$template = 'index'$istag = 0)   
  12. {   
  13.     $compiledtplfile = TPL_CACHEPATH.$module.'_'.$template.'.tpl.php';   
  14.     if(TPL_REFRESH &&    
  15.         (!file_exists($compiledtplfile) ||    
  16.         @filemtime(TPL_ROOT.TPL_NAME.'/'.$module.'/'.$template.'.html') > @filemtime($compiledtplfile) ||    
  17.         ))   
  18.     {   
  19.         template_compile($module$template$istag);   
  20.     }   
  21.     return $compiledtplfile;   
  22. }   
  23. function template_compile($module$template$istag = 0)   
  24. {   
  25.     $tplfile = TPL_ROOT.TPL_NAME.'/'.$module.'/'.$template.'.html';   
  26.     $content = @file_get_contents($tplfile);   
  27.     if($content === false) showmessage("$tplfile is not exists!");   
  28.     $compiledtplfile = TPL_CACHEPATH.$module.'_'.$template.'.tpl.php';   
  29.     $content = ($istag || substr($template, 0, 4) == 'tag_') ? '<?php function _tag_'.$module.'_'.$template.'($data$number$rows$count$page$pages$setting){ global $PHPCMS,$MODULE,$M,$CATEGORY,$TYPE,$AREA,$GROUP,$MODEL,$templateid,<pre class="php" name="code">{1}</pre><br>   
  30. userid,<pre class="php" name="code">{1}</pre><br>   
  31. username;@extract($setting);?>'.template_parse($content, 1).'<?php } ?>' : template_parse($content);$strlen = file_put_contents($compiledtplfile$content);@chmod($compiledtplfile, 0777);return $strlen;}function template_parse($str$istag = 0){$str = preg_replace("/([/n/r]+)/t+/s","//1",$str);$str   
  32.  = preg_replace("//</!/-/-/{(.+?)/}/-/-/>/s""{//1}",$str);$str = preg_replace("//{template/s+(.+)/}/","<?php include template(//1); ?>",$str);$str = preg_replace("//{include/s+(.+)/}/","<?php include //1; ?>",$str);$str = preg_replace("//{php/s+(.+)/}/","<?php   
  33.  //1?>",$str);$str = preg_replace("//{if/s+(.+?)/}/","<?php if(//1) { ?>",$str);$str = preg_replace("//{else/}/","<?php } else { ?>",$str);$str = preg_replace("//{elseif/s+(.+?)/}/","<?php } elseif (//1) { ?>",$str);$str = preg_replace("//{//if/}/","<?php }  //開源軟件:Vevb.com 
  34.  ?>",$str);$str = preg_replace("//{loop/s+(/S+)/s+(/S+)/}/","<?php if(is_array(//1)) foreach(//1 AS //2) { ?>",$str);$str = preg_replace("//{loop/s+(/S+)/s+(/S+)/s+(/S+)/}/","<?php if(is_array(//1)) foreach(//1 AS //2 => //3) { ?>",$str);$str = preg_replace("//{//loop/}/","<?php   
  35.  } ?>",$str);$str = preg_replace("//{//get/}/","<?php } unset(/$DATA); ?>",$str);$str = preg_replace("//{tag_([^}]+)/}/e", "get_tag('//1')", $str);$str = preg_replace("//{get/s+([^}]+)/}/e", "get_parse('//1')", $str);$str = preg_replace("//{([a-zA-Z_/x7f-/xff][a-zA-Z0-9_/x7f-/xff:]*/(([^{}]*)/))/}/","<?php   
  36.  echo //1;?>",$str);$str = preg_replace("//{//$([a-zA-Z_/x7f-/xff][a-zA-Z0-9_/x7f-/xff:]*/(([^{}]*)/))/}/","<?php echo //1;?>",$str);$str = preg_replace("//{(//$[a-zA-Z_/x7f-/xff][a-zA-Z0-9_/x7f-/xff]*)/}/","<?php echo //1;?>",$str);$str = preg_replace("//{(//$[a-zA-Z0-9_/[/]/'/"/$/x7f-/xff]+)/}/es",   
  37.  "addquote('<?php echo //1;?>')",$str);$str = preg_replace("//{([A-Z_/x7f-/xff][A-Z0-9_/x7f-/xff]*)/}/s""<?php echo //1;?>",$str);if(!$istag$str = "<?php defined('IN_PHPCMS') or exit('Access Denied'); ?>".$str;return $str;}function createhtml($file){$data   
  38.  = ob_get_contents();ob_clean();dir_create(dirname($file));$strlen = file_put_contents($file$data);@chmod($file,0777);return $strlen;}?>   
  39. <pre></pre>   
  40. <br>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鲜城| 汝州市| 镇巴县| 西和县| 萍乡市| 龙州县| 沂水县| 家居| 滁州市| 枣强县| 屯留县| 即墨市| 四平市| 娱乐| 乌审旗| 新密市| 利辛县| 静乐县| 杭锦旗| 深圳市| 建阳市| 镇坪县| 万宁市| 鄯善县| 鹰潭市| 措勤县| 开封市| 米易县| 温泉县| 北安市| 泉州市| 海口市| 嘉鱼县| 凤山县| 信丰县| 徐汇区| 确山县| 通许县| 潮安县| 兴海县| 海安县|