<?php
/**
* 易优CMS
* ============================================================================
* 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
* 网站地址: http://www.eyoucms.com
* ----------------------------------------------------------------------------
* 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
* ============================================================================
* Author: 小虎哥 <1105415366@qq.com>
* Date: 2018-4-3
*/
namespace think\template\taglib;
use think\template\TagLib;
/**
* eyou标签库解析类
* @category Think
* @package Think
* @subpackage Driver.Taglib
* @author 小虎哥 <1105415366@qq.com>
*/
class Eyou extends Taglib
{
// 标签定义
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次
'php' => ['attr' => ''],
'channel' => ['attr' => 'typeid,reid,type,row,currentstyle,id,name,key,empty,mod,titlelen,offset,limit'],
'channelartlist' => ['attr' => 'typeid,type,row,id,key,empty,titlelen,mod'],
'arclist' => ['attr' => 'channelid,typeid,notypeid,row,offset,titlelen,limit,orderby,orderWay,noflag,flag,infolen,empty,mod,name,id,key,addfields,tagid,pagesize'],
'arcpagelist'=> ['attr' => 'tagid,pagesize,id,tips,loading'],
'list' => ['attr' => 'channelid,typeid,notypeid,pagesize,titlelen,orderby,orderWay,noflag,flag,infolen,empty,mod,id,key,addfields'],
'pagelist' => ['attr' => 'listitem,listsize', 'close' => 0],
'position' => ['attr' => 'symbol,style', 'close' => 0],
'type' => ['attr' => 'typeid,type,empty,dirname,id,addfields,addtable'],
'arcview' => ['attr' => 'aid,empty,id,addfields'],
'arcclick' => ['attr' => '', 'close' => 0],
'load' => ['attr' => 'file,href,type,value,basepath', 'close' => 0, 'alias' => ['import,css,js', 'type']],
'guestbookform'=> ['attr' => 'typeid,type,empty,id,mod,key'],
'assign' => ['attr' => 'name,value', 'close' => 0],
'empty' => ['attr' => 'name'],
'notempty' => ['attr' => 'name'],
'foreach' => ['attr' => 'name,id,item,key,offset,length,mod', 'expression' => true],
'volist' => ['attr' => 'name,id,offset,length,key,mod,limit,row', 'alias' => 'iterate'],
'if' => ['attr' => 'condition', 'expression' => true],
'elseif' => ['attr' => 'condition', 'close' => 0, 'expression' => true],
'else' => ['attr' => '', 'close' => 0],
'switch' => ['attr' => 'name', 'expression' => true],
'case' => ['attr' => 'value,break', 'expression' => true],
'default' => ['attr' => '', 'close' => 0],
'compare' => ['attr' => 'name,value,type', 'alias' => ['eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq', 'type']],
'ad' => ['attr' => 'aid,id', 'close'=>1],
'adv' => ['attr' => 'pid,row,order,where,id,empty,key,mod,currentstyle', 'close'=>1],
'global' => ['attr' => 'name', 'close' => 0],
'static' => ['attr' => 'file,lang,href,code', 'close' => 0],
'prenext' => ['attr' => 'get,titlelen,id,empty'],
'field' => ['attr' => 'name,addfields,aid', 'close' => 0],
'searchurl' => ['attr' => '', 'close' => 0],
'searchform' => ['attr' => 'channel,typeid,notypeid,flag,noflag,type,empty,id,mod,key', 'close'=>1],
'tag' => ['attr' => 'aid,name,row,id,key,mod,typeid,getall,sort,empty,style'],
'flink' => ['attr' => 'type,row,id,key,mod,titlelen,empty,limit'],
'language' => ['attr' => 'type,row,id,key,mod,titlelen,empty,limit,currentstyle'],
'lang' => ['attr' => 'name,const', 'close' => 0],
'ui' => ['attr' => 'open', 'close' => 0],
'uitext' => ['attr' => 'e-id,e-page,id'],
'uihtml' => ['attr' => 'e-id,e-page,id'],
'uiupload' => ['attr' => 'e-id,e-page,id'],
'uitype' => ['attr' => 'e-id,e-page,id,typeid'],
'uiarclist' => ['attr' => 'e-id,e-page,id,typeid'],
'uichannel' => ['attr' => 'e-id,e-page,id,typeid'],
// 'sql' => ['attr' => 'sql,key,id,mod,cachetime,empty', 'close'=>1, 'level'=>3], // eyou sql 万能标签
'weapp' => ['attr' => 'type', 'close' => 0], // 网站应用插件
'range' => ['attr' => 'name,value,type', 'alias' => ['in,notin,between,notbetween', 'type']],
'present' => ['attr' => 'name'],
'notpresent' => ['attr' => 'name'],
'defined' => ['attr' => 'name'],
'notdefined' => ['attr' => 'name'],
'define' => ['attr' => 'name,value', 'close' => 0],
'for' => ['attr' => 'start,end,name,comparison,step'],
'url' => ['attr' => 'link,vars,suffix,domain', 'close' => 0, 'expression' => true],
'function' => ['attr' => 'name,vars,use,call'],
'diyfield' => ['attr' => 'name,id,key,mod,type,empty,limit'],
'attribute' => ['attr' => 'aid,type,empty,id,mod,key'],
'attr' => ['attr' => 'aid,name', 'close' => 0],
'user' => ['attr' => 'type,id,key,mod,empty,currentstyle,img,txt,txtid'],
'weapplist' => ['attr' => 'type,id,key,mod,empty,currentstyle'], // 网站应用插件列表
'usermenu' => ['attr' => 'row,id,empty,key,mod,currentstyle,limit'],
// 购物行为标签
'sppurchase' => ['attr' => 'row,id,key,mod,empty'],
// 购物车大标签
'spcart' => ['attr' => 'row,id,key,mod,empty,limit'],
// 订单明细大标签
'sporder' => ['attr' => 'row,id,key,mod,empty,limit'],
// 订单提交大标签
'spsubmitorder'=> ['attr' => 'row,id,key,mod,empty,limit'],
// 订单管理页大标签
'sporderlist'=> ['attr' => 'row,id,key,mod,empty,limit,pagesize'],
// 地址标签
'spaddress' => ['attr' => 'type,row,id,key,mod,empty,limit'],
// 订单产品标签
'spordergoods'=> ['attr' => 'row,id,key,mod,empty,limit,name,titlelen'],
// 订单状态标签
'spstatus' => ['attr' => 'row,id,key,mod,empty,limit'],
// 订单管理页,分页标签
'sppageorder' => ['attr' => 'listitem,listsize', 'close' => 0],
// 订单管理页搜索标签
'spsearch' => ['attr' => 'empty,id,mod,key'],
];
/**
* 自动识别构建变量,传值可以使变量也可以是值
* @access private
* @param string $value 值或变量
* @return string
*/
private function varOrvalue($value)
{
$flag = substr($value, 0, 1);
if ('$' == $flag || ':' == $flag) {
$value = $this->autoBuildVar($value);
} else {
$value = str_replace('"', '\"', $value);
$value = '"' . $value . '"';
}
return $value;
}
/**
* 万能的SQL标签
*/
public function tagSql($tag, $content)
{
$sql = $tag['sql']; // sql 语句
$sql = $this->varOrvalue($sql);
$key = !empty($tag['key']) ? $tag['key'] : 'i';
$mod = isset($tag['mod']) ? $tag['mod'] : '2';
$id = !empty($tag['id']) ? $tag['id'] : 'field';// 返回的变量
$cachetime = !empty($tag['cachetime']) ? $tag['cachetime'] : '';// 缓存时间
$empty = isset($tag['empty']) ? $tag['empty'] : '';
$empty = htmlspecialchars($empty);
$parseStr = '<?php ';
$parseStr .= ' $tagSql = new \think\template\taglib\eyou\TagSql;';
$parseStr .= ' $_result = $tagSql->getS
小徐博客
- 粉丝: 1976
- 资源: 5876
最新资源
- SimpleComTools开发的TCP Test Tool和UDP Test Tool
- PLC小车自动控制往返系统设计与仿真 《可编程控制器原理与应用》综合设计性实验 s7-1200系列,博途V15 基于博途平台小车自动往返控制系统的设计与仿真,包括硬件组态、变量定义、PLC程序设计
- 企业管理-OKR计划表
- Jmeter-01、08
- 改进二进制粒子群算法配电网重构 可以动态生成配电网重构过程,目标函数为功率损耗,算例为IEEE33节点系统 程序简洁明了,注释详细
- 多智能体、一致性、时滞 含通信时滞和输入时滞的多智能体一致性仿真 简单的多智能体一致性性仿真图,包含状态轨迹图和控制输入图 适用于初学者
- 齿轮、行星齿轮、端面齿轮、斜齿轮、非圆齿轮、圆弧齿轮……啮合理论、啮合原理、齿面求解、传动特性、接触分析tca、传动误差等技术matlab程序实现 参照李特文《齿轮几何学与啮合理论》
- 直流无刷电机模型+三闭环-simulink
- Java毕设项目:基于spring+mybatis+maven+mysql实现的养老院老人健康监护平台【含源码+数据库+开题报告+任务书+毕业论文】
- 51单片机开发的光照强度检测程序源码,用滑动变阻器分压代替采集电压信号光敏电阻, 包括程序源码和原理图和protues仿真, 程序源码注释详细,非常适合单片机开发人员,
- 1.Python简介.ipynb
- 基于simulink的永磁同步电机DTC控制系统仿真 基于模糊控制的pmsm的DTC控制系统仿真
- Java毕设项目:基于spring+mybatis+maven+mysql实现的农家乐系统分前后台【含源码+数据库+毕业论文】
- 双向LLC比较新的拓扑结构,双变压器,CDT-LC双向直流变器 只有开环仿真,可实现软开关 送对应参考文县
- Java毕设项目:基于spring+mybatis+maven+mysql实现的药品管理系统【含源码+数据库+毕业论文】
- 光伏发电并网逆变simulink matlab仿真 两级三相 单相系统 前级采用boost升压斩波电路 mppt最大功率点跟踪采用扰动观察法 可接单相或者三相并网逆变
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈