1][0]{0} == "'" || $_match[1][0]{0} == '"') {
$_result = $this->_parse_variables($_match[1], $_match[2]);
return "<?php echo $_result; ?>\n";
}
// process a function
$tag_command = $_match[1][0];
$tag_modifiers = !empty($_match[2][0]) ? $_match[2][0] : null;
$tag_arguments = !empty($_match[3][0]) ? $_match[3][0] : null;
$_result = $this->_parse_function($tag_command, $tag_modifiers, $tag_arguments);
return $_result;
}
function _parse_function($function, $modifiers, $arguments) {
switch ($function) {
case 'include':
$_args = $this->_parse_arguments($arguments);
if (!isset($_args['file']))
$this->trigger_error("missing 'file' attribute in 'include'", E_USER_ERROR, __FILE__, __LINE__);
if (!isset($_args['assign']))
return '<?php echo $this->_fetch_compile(' . $_args['file'] . '); ?>';
else
return '<?php $this->assign("' . $this->_dequote($_args['assign']) . '", $this->_fetch_compile(' . $_args['file'] . ')); ?>';
break;
case 'insert':
$_args = $this->_parse_arguments($arguments);
if (!isset($_args['name']))
$this->trigger_error("missing 'name' attribute in 'insert'", E_USER_ERROR, __FILE__, __LINE__);
foreach ($_args as $key => $value) {
if (is_bool($value))
$value = $value ? 'true' : 'false';
$arg_list[] = "'$key' => $value";
}
return '<?php echo $this->_run_insert(array(' . implode(', ', (array)$arg_list) . ')); ?>';
break;
case 'ldelim':
return $this->left_tag;
break;
cas
上一篇:
class.BlogUser.php
下一篇:
扛起年轻化大旗,哈弗F系玩转行业新风潮