コード例 #1
0
ファイル: TagLibPin.class.php プロジェクト: dlpc/weixin_shop
 public function __call($method, $args)
 {
     $tag = substr($method, 1);
     if (!isset($this->tags[$tag])) {
         return false;
     }
     //解析标签属性
     $_tag = parent::parseXmlAttr($args[0], $tag);
     $_tag['cache'] = isset($_tag['cache']) ? intval($_tag['cache']) : 0;
     $_tag['return'] = isset($_tag['return']) ? trim($_tag['return']) : 'data';
     $_tag['type'] = isset($_tag['type']) ? trim($_tag['type']) : '';
     if (!$_tag['type']) {
         return false;
     }
     $parse_str = '<?php ';
     if ($_tag['cache']) {
         //标签名-属性-属性值 组合标识
         ksort($_tag);
         $tag_id = md5($tag . '&' . implode('&', array_keys($_tag)) . '&' . implode('&', array_values($_tag)));
         //缓存代码开始
         $parse_str .= '$' . $_tag['return'] . ' = S(\'' . $tag_id . '\');';
         $parse_str .= 'if (false === $' . $_tag['return'] . ') { ';
     }
     $action = $_tag['type'];
     $class = '$tag_' . $tag . '_class';
     $parse_str .= $class . ' = new ' . $tag . 'Tag;';
     $parse_str .= '$' . $_tag['return'] . ' = ' . $class . '->' . $action . '(' . self::arr_to_html($_tag) . ');';
     if ($_tag['cache']) {
         //缓存代码结束
         $parse_str .= 'S(\'' . $tag_id . '\', $' . $_tag['return'] . ', ' . $_tag['cache'] . ');';
         $parse_str .= ' }';
     }
     $parse_str .= '?>';
     $parse_str .= $args[1];
     return $parse_str;
 }
コード例 #2
0
 /**
 +----------------------------------------------------------
 * 架构函数
 * 
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @param object $template  当前模板对象
 +----------------------------------------------------------
 */
 function __construct(&$template)
 {
     $this->tpl = $template;
     parent::__construct('ajax');
 }
コード例 #3
0
ファイル: WidgetTagLib.php プロジェクト: hofmeister/Pimple
 public function __construct()
 {
     parent::__construct(false);
 }
コード例 #4
0
ファイル: CoreTagLib.php プロジェクト: hofmeister/Pimple
 public function __construct()
 {
     parent::__construct(true);
 }
コード例 #5
0
 public function __construct()
 {
     parent::__construct(false, true);
     self::$JS_WRAPPER_TAG = $this->uid();
 }
コード例 #6
0
 /**
 +----------------------------------------------------------
 * TagLib库解析
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @param string $tagLib 要解析的标签库
 * @param string $content 要解析的模板内容
 * @param boolen $hide 是否隐藏标签库前缀
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 public function parseTagLib($tagLib, &$content, $hide = false)
 {
     $tLib = new TagLib($tagLib);
     if ($tLib->valid()) {
         //如果标签库有效则取出支持标签列表
         $tagList = $tLib->getTagList();
         //遍历标签列表进行模板标签解析
         foreach ($tagList as $tag) {
             if (!$hide) {
                 $startTag = $tagLib . ':' . $tag['name'];
             } else {
                 $startTag = $tag['name'];
             }
             $endTag = $startTag;
             if (empty($tag['attribute'])) {
                 // 无属性标签
                 if ($tag['content'] != 'empty') {
                     $content = preg_replace('/' . C('TAGLIB_BEGIN') . $startTag . '(\\s*?)' . C('TAGLIB_END') . '(.*?)' . C('TAGLIB_BEGIN') . '\\/' . $endTag . C('TAGLIB_END') . '/eis', "\$this->parseXmlTag('" . $tagLib . "','" . $tag['name'] . "','\\1','\\2')", $content);
                 } else {
                     $content = preg_replace('/' . C('TAGLIB_BEGIN') . $startTag . '(\\s*?)\\/' . C('TAGLIB_END') . '/eis', "\$this->parseXmlTag('" . $tagLib . "','" . $tag['name'] . "','\\1','')", $content);
                 }
             } elseif ($tag['content'] != 'empty') {
                 //闭合标签解析
                 $content = preg_replace('/' . C('TAGLIB_BEGIN') . $startTag . '\\s(.*?)' . C('TAGLIB_END') . '(.+?)' . C('TAGLIB_BEGIN') . '\\/' . $endTag . C('TAGLIB_END') . '/eis', "\$this->parseXmlTag('" . $tagLib . "','" . $tag['name'] . "','\\1','\\2')", $content);
             } else {
                 //开放标签解析
                 //$content = preg_replace('/'.C('TAGLIB_BEGIN').$startTag.'\s(.*?)'.C('TAGLIB_END').'(.*?)'.C('TAGLIB_BEGIN').'\/'.$endTag.C('TAGLIB_END').'/eis',"\$this->parseXmlTag('".$tagLib."','".$tag['name']."','\\1','\\2')",$content);
                 // 开始标签必须有一个空格
                 $content = preg_replace('/' . C('TAGLIB_BEGIN') . $startTag . '\\s(.*?)\\/' . C('TAGLIB_END') . '/eis', "\$this->parseXmlTag('" . $tagLib . "','" . $tag['name'] . "','\\1','')", $content);
             }
         }
     }
 }
コード例 #7
0
 /**
 +----------------------------------------------------------
 * 架构函数
 * 
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @param object $template  当前模板对象
 +----------------------------------------------------------
 */
 public function __construct(&$template)
 {
     $this->tpl = $template;
     parent::__construct('html');
 }
コード例 #8
0
ファイル: ValueTagLib.php プロジェクト: hofmeister/Pimple
 public function __construct($preprocess = false)
 {
     parent::__construct($preprocess);
 }