mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
template单元测试
This commit is contained in:
@@ -324,7 +324,10 @@ class TagLib
|
||||
$_taglibs[$tag][0] = strlen(ltrim($this->tpl->config('taglib_begin'), '\\') . $tag);
|
||||
$_taglibs[$tag][1] = strlen(ltrim($this->tpl->config('taglib_end'), '\\'));
|
||||
}
|
||||
$result['expression'] = trim(substr($str, $_taglibs[$tag][0], -$_taglibs[$tag][1]));
|
||||
$result['expression'] = substr($str, $_taglibs[$tag][0], -$_taglibs[$tag][1]);
|
||||
// 清除自闭合标签尾部/
|
||||
$result['expression'] = rtrim($result['expression'], '/');
|
||||
$result['expression'] = trim($result['expression']);
|
||||
} elseif (empty($this->tags[$tag]) || !empty($this->tags[$tag]['attr'])) {
|
||||
throw new Exception('_XML_TAG_ERROR_:' . $tag);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ class Cx extends Taglib
|
||||
{
|
||||
$name = !empty($tag['expression']) ? $tag['expression'] : $tag['name'];
|
||||
$name = $this->autoBuildVar($name);
|
||||
$parseStr = '<?php switch(' . $name . '): ?>' . $content . '<?php endswitch;?>';
|
||||
$parseStr = '<?php switch(' . $name . '): ?>' . $content . '<?php endswitch; ?>';
|
||||
return $parseStr;
|
||||
}
|
||||
|
||||
@@ -270,20 +270,20 @@ class Cx extends Taglib
|
||||
$flag = substr($value, 0, 1);
|
||||
if ('$' == $flag || ':' == $flag) {
|
||||
$value = $this->autoBuildVar($value);
|
||||
$value = 'case ' . $value . ': ';
|
||||
$value = 'case ' . $value . ':';
|
||||
} elseif (strpos($value, '|')) {
|
||||
$values = explode('|', $value);
|
||||
$value = '';
|
||||
foreach ($values as $val) {
|
||||
$value .= 'case "' . addslashes($val) . '": ';
|
||||
$value .= 'case "' . addslashes($val) . '":';
|
||||
}
|
||||
} else {
|
||||
$value = 'case "' . $value . '": ';
|
||||
$value = 'case "' . $value . '":';
|
||||
}
|
||||
$parseStr = '<?php ' . $value . ' ?>' . $content;
|
||||
$isBreak = isset($tag['break']) ? $tag['break'] : '';
|
||||
if ('' == $isBreak || $isBreak) {
|
||||
$parseStr .= '<?php break;?>';
|
||||
$parseStr .= '<?php break; ?>';
|
||||
}
|
||||
return $parseStr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user