【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:TagLib.class.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP
// +----------------------------------------------------------------------
// | Copyright (c) 2008 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id$
/**
+------------------------------------------------------------------------------
* Think
PHP鏍囩搴揟agLib瑙f瀽鍩虹被
*
* 瑕佸湪妯℃澘椤甸潰涓紩鍏ユ爣绛惧簱锛屼娇鐢╰aglib鏍囩锛屼緥濡?
* <taglib name='cs' />
* 濡傛灉瑕佸紩鍏ュ涓爣绛惧簱锛屽彲浠ヤ娇鐢?
* <taglib name='cs,mx,html' />
*
* 濡傛灉瑕佹寚瀹氭爣绛惧簱瑙f瀽绫伙紝鍙互浣跨敤
* <taglib name='cx' class='Think.Template.TagLib.TagLib_cx' />
* 绯荤粺鍐呯疆寮曞叆浜哻x鏍囩搴擄紝鎵浠ワ紝濡傛灉闇瑕佷娇鐢╟x鏍囩搴擄紝鏃犻渶浣跨敤taglib鏍囩寮曞叆
* 浣嗘槸鏃犻渶鍐檆s鍓嶇紑
* 渚嬪 <cx:vo name='user' value='id' />
* 搴旇鍐欐垚 <vo name='user' value='id' />
+------------------------------------------------------------------------------
* @category Think
* @package Think
* @subpackage Template
* @author liu21st <liu21st@gmail.com>
* @version $Id$
+------------------------------------------------------------------------------
*/
class TagLib extends Base
{//绫诲畾涔夊紑濮?
/**
+----------------------------------------------------------
* 鏍囩搴撳畾涔塜ML鏂囦欢
+----------------------------------------------------------
* @var string
* @access protected
+----------------------------------------------------------
*/
protected $xml = '';
/**
+----------------------------------------------------------
* 鏍囩搴撳悕绉?
+----------------------------------------------------------
* @var string
* @access protected
+----------------------------------------------------------
*/
protected $tagLib ='';
/**
+----------------------------------------------------------
* 鏍囩搴撴爣绛惧垪琛?
+----------------------------------------------------------
* @var string
* @access protected
+----------------------------------------------------------
*/
protected $tagList = array();
/**
+----------------------------------------------------------
* 鏍囩搴撳垎鏋愭暟缁?
+----------------------------------------------------------
* @var string
* @access protected
+----------------------------------------------------------
*/
protected $parse = array();
/**
+----------------------------------------------------------
* 鏍囩搴撴槸鍚︽湁鏁?
+----------------------------------------------------------
* @var string
* @access protected
+----------------------------------------------------------
*/
protected $valid = false;
/**
+----------------------------------------------------------
* 褰撳墠妯℃澘瀵硅薄
+----------------------------------------------------------
* @var object
* @access protected
+----------------------------------------------------------
*/
protected $tpl;
protected $comparison = array(' nheq '=>' !== ',' heq '=>' === ',' neq '=>' != ',' eq '=>' == ',' egt '=>' >= ',' gt '=>' > ',' elt '=>' <= ',' lt '=>' < ');
/**
+----------------------------------------------------------
* 鏋舵瀯鍑芥暟
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
*/
public function __construct($tagLib='',$filename='')
{
if(empty($tagLib)) {
$tagLib = strtolower(substr(get_class($this),6));
}
$this->tagLib = $tagLib;
$this->tpl = ThinkTemplate::getInstance();
if(!empty($filename)) {
$this->xml = $filename;
}else {
$this->xml = dirname(__FILE__).'/Tags/'.$tagLib.'.
xml';
}
$this->load();
}
public function load() {
$array = (array)(simplexml_load_file($this->xml));
if($array !== false) {
$this->parse = $array;
$this->valid = true;
}else{
$this->valid = false;
}
}
/**
+-------------------------------------------------------