This commit is contained in:
Default
2025-04-01 10:52:55 +08:00
parent c7978968f3
commit 85d1d8b6c7
5 changed files with 79 additions and 208 deletions

View File

@@ -7,116 +7,13 @@ use think\template\TagLib;
class Site extends TagLib
{
protected $tags = [
'cfg' => ['attr' => 'code,encode', 'close' => 0],
'adcfg' => ['attr' => 'code,encode', 'close' => 0],
'seotdk' => ['attr' => 'code,encode,valcode', 'close' => 0],
'site' => ['attr' => 'code,encode,valcode', 'close' => 0],
'wz' => ['attr' => 'wz', 'close' => 0],
'nurl' => ['attr' => 'n_id', 'close' => 0],
'grm' => ['attr' => 'domain,code,line,diff', 'close' => 0],
];
/**
* site 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagSite($tag)
{
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$valcode = isset($tag['valcode']) ? $tag['valcode'] : '';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SiteModel::getValBySiteIdByValCode("{$valcode}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal ;
}
?>
EOD;
return $parse;
}
/**
* cfg 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagCfg($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SystemConfigModel::getValByCode("{$code}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal;
}
?>
EOD;
return $parse;
}
/**
* adcfg标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagAdcfg($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\GuangGaoPeiZhiModel::getValByCode("{$code}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal;
}
?>
EOD;
return $parse;
}
/**
* seotdk 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagSeotdk($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$valcode = isset($tag['valcode']) ? $tag['valcode'] : '';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SeoTdkConfigModel::getValByCodeByValCode("{$code}", "{$valcode}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
var_dump( \$strCfgVal);
}
?>
EOD;
return $parse;
}