mirror of
https://e.coding.net/circlecloud/MinecraftAccount.git
synced 2025-11-25 21:36:08 +00:00
74
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_config.php
vendored
Normal file
74
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_config.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite compile config variables - template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: compile_config
|
||||
*/
|
||||
|
||||
function compile_compile_config($variable, &$object)
|
||||
{
|
||||
$_result = "";
|
||||
|
||||
// remove the beginning and ending #
|
||||
$variable = substr($variable, 1, -1);
|
||||
|
||||
// get [foo] and .foo and (...) pieces
|
||||
preg_match_all('!(?:^\w+)|(?:' . $object->_var_bracket_regexp . ')|\.\$?\w+|\S+!', $variable, $_match);
|
||||
$variable = $_match[0];
|
||||
$var_name = array_shift($variable);
|
||||
|
||||
$_result = "\$this->_confs['$var_name']";
|
||||
foreach ($variable as $var)
|
||||
{
|
||||
if ($var{0} == '[')
|
||||
{
|
||||
$var = substr($var, 1, -1);
|
||||
if (is_numeric($var))
|
||||
{
|
||||
$_result .= "[$var]";
|
||||
}
|
||||
elseif ($var{0} == '$')
|
||||
{
|
||||
$_result .= "[" . $object->_compile_variable($var) . "]";
|
||||
}
|
||||
elseif ($var{0} == '#')
|
||||
{
|
||||
$_result .= "[" . $object->_compile_config($var) . "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$_result .= "['$var']";
|
||||
}
|
||||
}
|
||||
else if ($var{0} == '.')
|
||||
{
|
||||
if ($var{1} == '$')
|
||||
{
|
||||
$_result .= "[\$this->_TPL['" . substr($var, 2) . "']]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$_result .= "['" . substr($var, 1) . "']";
|
||||
}
|
||||
}
|
||||
else if (substr($var,0,2) == '->')
|
||||
{
|
||||
if(substr($var,2,2) == '__')
|
||||
{
|
||||
$object->trigger_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
else if (substr($var, 2, 1) == '$')
|
||||
{
|
||||
$_output .= '->{(($var=$this->_TPL[\''.substr($var,3).'\']) && substr($var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$var\\"")}';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->trigger_error('#' . $var_name.implode('', $variable) . '# is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
return $_result;
|
||||
}
|
||||
|
||||
?>
|
||||
60
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_block.php
vendored
Normal file
60
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_block.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite compile custom block - template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: compile_custom_block
|
||||
*/
|
||||
|
||||
function compile_compile_custom_block($function, $modifiers, $arguments, &$_result, &$object)
|
||||
{
|
||||
if ($function{0} == '/')
|
||||
{
|
||||
$start_tag = false;
|
||||
$function = substr($function, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$start_tag = true;
|
||||
}
|
||||
|
||||
if ($function = $object->_plugin_exists($function, "block"))
|
||||
{
|
||||
if ($start_tag)
|
||||
{
|
||||
$_args = $object->_parse_arguments($arguments);
|
||||
foreach($_args as $key => $value)
|
||||
{
|
||||
if (is_bool($value))
|
||||
{
|
||||
$value = $value ? 'true' : 'false';
|
||||
}
|
||||
if (is_null($value))
|
||||
{
|
||||
$value = 'null';
|
||||
}
|
||||
$_args[$key] = "'$key' => $value";
|
||||
}
|
||||
$_result = "<?php \$this->_tag_stack[] = array('$function', array(".implode(',', (array)$_args).")); ";
|
||||
$_result .= $function . '(array(' . implode(',', (array)$_args) .'), null, $this); ';
|
||||
$_result .= 'ob_start(); ?>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_result .= '<?php $this->_block_content = ob_get_contents(); ob_end_clean(); ';
|
||||
$_result .= '$this->_block_content = ' . $function . '($this->_tag_stack[count($this->_tag_stack) - 1][1], $this->_block_content, $this); ';
|
||||
if (!empty($modifiers))
|
||||
{
|
||||
$_result .= '$this->_block_content = ' . $object->_parse_modifier('$this->_block_content', $modifiers) . '; ';
|
||||
}
|
||||
$_result .= 'echo $this->_block_content; array_pop($this->_tag_stack); ?>';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
44
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_function.php
vendored
Normal file
44
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_function.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite compile custom function - template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: compile_custom_function
|
||||
*/
|
||||
|
||||
function compile_compile_custom_function($function, $modifiers, $arguments, &$_result, &$object)
|
||||
{
|
||||
if ($function = $object->_plugin_exists($function, "function"))
|
||||
{
|
||||
$_args = $object->_parse_arguments($arguments);
|
||||
foreach($_args as $key => $value)
|
||||
{
|
||||
if (is_bool($value))
|
||||
{
|
||||
$value = $value ? 'true' : 'false';
|
||||
}
|
||||
if (is_null($value))
|
||||
{
|
||||
$value = 'null';
|
||||
}
|
||||
$_args[$key] = "'$key' => $value";
|
||||
}
|
||||
$_result = '<?php echo ';
|
||||
if (!empty($modifiers))
|
||||
{
|
||||
$_result .= $object->_parse_modifier($function . '(array(' . implode(',', (array)$_args) . '), $this)', $modifiers) . '; ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_result .= $function . '(array(' . implode(',', (array)$_args) . '), $this);';
|
||||
}
|
||||
$_result .= '?>';
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
154
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_if.php
vendored
Normal file
154
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_if.php
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite compile IF tag - template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: compile_parse_is_expr
|
||||
*/
|
||||
|
||||
function compile_compile_if($arguments, $elseif, $while, &$object)
|
||||
{
|
||||
$_result = "";
|
||||
$_match = array();
|
||||
$_args = array();
|
||||
$_is_arg_stack = array();
|
||||
|
||||
// extract arguments from the equation
|
||||
preg_match_all('/(?>(' . $object->_var_regexp . '|\/?' . $object->_svar_regexp . '|\/?' . $object->_func_regexp . ')(?:' . $object->_mod_regexp . '*)?|\-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\%|\+|\-|\/|\*|\@|\b\w+\b|\S+)/x', $arguments, $_match);
|
||||
$_args = $_match[0];
|
||||
|
||||
// make sure we have balanced parenthesis
|
||||
$_args_count = array_count_values($_args);
|
||||
if(isset($_args_count['(']) && $_args_count['('] != $_args_count[')'])
|
||||
{
|
||||
$object->trigger_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
$count_args = count($_args);
|
||||
for ($i = 0, $for_max = $count_args; $i < $for_max; $i++)
|
||||
{
|
||||
$_arg = &$_args[$i];
|
||||
switch (strtolower($_arg))
|
||||
{
|
||||
case '!':
|
||||
case '%':
|
||||
case '!==':
|
||||
case '==':
|
||||
case '===':
|
||||
case '>':
|
||||
case '<':
|
||||
case '!=':
|
||||
case '<>':
|
||||
case '<<':
|
||||
case '>>':
|
||||
case '<=':
|
||||
case '>=':
|
||||
case '&&':
|
||||
case '||':
|
||||
case '^':
|
||||
case '&':
|
||||
case '~':
|
||||
case ')':
|
||||
case ',':
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
case '/':
|
||||
case '@':
|
||||
break;
|
||||
case 'eq':
|
||||
$_arg = '==';
|
||||
break;
|
||||
case 'ne':
|
||||
case 'neq':
|
||||
$_arg = '!=';
|
||||
break;
|
||||
case 'lt':
|
||||
$_arg = '<';
|
||||
break;
|
||||
case 'le':
|
||||
case 'lte':
|
||||
$_arg = '<=';
|
||||
break;
|
||||
case 'gt':
|
||||
$_arg = '>';
|
||||
break;
|
||||
case 'ge':
|
||||
case 'gte':
|
||||
$_arg = '>=';
|
||||
break;
|
||||
case 'and':
|
||||
$_arg = '&&';
|
||||
break;
|
||||
case 'or':
|
||||
$_arg = '||';
|
||||
break;
|
||||
case 'not':
|
||||
$_arg = '!';
|
||||
break;
|
||||
case 'mod':
|
||||
$_arg = '%';
|
||||
break;
|
||||
case '(':
|
||||
array_push($_is_arg_stack, $i);
|
||||
break;
|
||||
case 'is':
|
||||
if ($_args[$i-1] == ')')
|
||||
{
|
||||
$is_arg_start = array_pop($is_arg_stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_is_arg_count = count($_args);
|
||||
$is_arg = implode(' ', array_slice($_args, $is_arg_start, $i - $is_arg_start));
|
||||
$_arg_tokens = $object->_parse_is_expr($is_arg, array_slice($_args, $i+1));
|
||||
array_splice($_args, $is_arg_start, count($_args), $_arg_tokens);
|
||||
$i = $_is_arg_count - count($_args);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
preg_match('/(?:(' . $object->_var_regexp . '|' . $object->_svar_regexp . '|' . $object->_func_regexp . ')(' . $object->_mod_regexp . '*)(?:\s*[,\.]\s*)?)(?:\s+(.*))?/xs', $_arg, $_match);
|
||||
if (isset($_match[0]{0}) && ($_match[0]{0} == '$' || ($_match[0]{0} == '#' && $_match[0]{strlen($_match[0]) - 1} == '#') || $_match[0]{0} == "'" || $_match[0]{0} == '"' || $_match[0]{0} == '%'))
|
||||
{
|
||||
// process a variable
|
||||
$_arg = $object->_parse_variables(array($_match[1]), array($_match[2]));
|
||||
}
|
||||
elseif (is_numeric($_arg))
|
||||
{
|
||||
// pass the number through
|
||||
}
|
||||
elseif (function_exists($_match[0]) || $_match[0] == "empty" || $_match[0] == "isset" || $_match[0] == "unset" || strtolower($_match[0]) == "true" || strtolower($_match[0]) == "false" || strtolower($_match[0]) == "null")
|
||||
{
|
||||
// pass the function through
|
||||
}
|
||||
elseif (empty($_arg))
|
||||
{
|
||||
// pass the empty argument through
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->trigger_error("unidentified token '$_arg'", E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($while)
|
||||
{
|
||||
return implode(' ', $_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($elseif)
|
||||
{
|
||||
return '<?php elseif ('.implode(' ', $_args).'): ?>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<?php if ('.implode(' ', $_args).'): ?>';
|
||||
}
|
||||
}
|
||||
return $_result;
|
||||
}
|
||||
|
||||
?>
|
||||
35
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.generate_compiler_debug_output.php
vendored
Normal file
35
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.generate_compiler_debug_output.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite generate_debug_output template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: generate_debug_output
|
||||
*/
|
||||
|
||||
function generate_compiler_debug_output(&$object)
|
||||
{
|
||||
$debug_output = "\$assigned_vars = \$this->_vars;\n";
|
||||
$debug_output .= "ksort(\$assigned_vars);\n";
|
||||
$debug_output .= "if (@is_array(\$this->_config[0])) {\n";
|
||||
$debug_output .= " \$config_vars = \$this->_config[0];\n";
|
||||
$debug_output .= " ksort(\$config_vars);\n";
|
||||
$debug_output .= " \$this->assign('_debug_config_keys', array_keys(\$config_vars));\n";
|
||||
$debug_output .= " \$this->assign('_debug_config_vals', array_values(\$config_vars));\n";
|
||||
$debug_output .= "} \n";
|
||||
|
||||
$debug_output .= "\$included_templates = \$this->_templatelite_debug_info;\n";
|
||||
|
||||
$debug_output .= "\$this->assign('_debug_keys', array_keys(\$assigned_vars));\n";
|
||||
$debug_output .= "\$this->assign('_debug_vals', array_values(\$assigned_vars));\n";
|
||||
$debug_output .= "\$this->assign('_debug_tpls', \$included_templates);\n";
|
||||
|
||||
$debug_output .= "\$this->_templatelite_debug_loop = true;\n";
|
||||
$debug_output .= "\$this->_templatelite_debug_dir = \$this->template_dir;\n";
|
||||
$debug_output .= "\$this->template_dir = TEMPLATE_LITE_DIR . 'internal/';\n";
|
||||
$debug_output .= "echo \$this->_fetch_compile('debug.tpl');\n";
|
||||
$debug_output .= "\$this->template_dir = \$this->_templatelite_debug_dir;\n";
|
||||
$debug_output .= "\$this->_templatelite_debug_loop = false; \n";
|
||||
return $debug_output;
|
||||
}
|
||||
|
||||
?>
|
||||
56
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.include.php
vendored
Normal file
56
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.include.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite
|
||||
*
|
||||
* Type: compile
|
||||
* Name: section_start
|
||||
*/
|
||||
|
||||
function compile_include($arguments, &$object)
|
||||
{
|
||||
$_args = $object->_parse_arguments($arguments);
|
||||
|
||||
$arg_list = array();
|
||||
if (empty($_args['file']))
|
||||
{
|
||||
$object->trigger_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
foreach ($_args as $arg_name => $arg_value)
|
||||
{
|
||||
if ($arg_name == 'file')
|
||||
{
|
||||
$include_file = $arg_value;
|
||||
continue;
|
||||
}
|
||||
else if ($arg_name == 'assign')
|
||||
{
|
||||
$assign_var = $arg_value;
|
||||
continue;
|
||||
}
|
||||
if (is_bool($arg_value))
|
||||
{
|
||||
$arg_value = $arg_value ? 'true' : 'false';
|
||||
}
|
||||
$arg_list[] = "'$arg_name' => $arg_value";
|
||||
}
|
||||
|
||||
if (isset($assign_var))
|
||||
{
|
||||
$output = '<?php $_templatelite_tpl_vars = $this->_vars;' .
|
||||
"\n\$this->assign(" . $assign_var . ", \$this->_fetch_compile_include(" . $include_file . ", array(".implode(',', (array)$arg_list).")));\n" .
|
||||
"\$this->_vars = \$_templatelite_tpl_vars;\n" .
|
||||
"unset(\$_templatelite_tpl_vars);\n" .
|
||||
' ?>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = '<?php $_templatelite_tpl_vars = $this->_vars;' .
|
||||
"\necho \$this->_fetch_compile_include(" . $include_file . ", array(".implode(',', (array)$arg_list)."));\n" .
|
||||
"\$this->_vars = \$_templatelite_tpl_vars;\n" .
|
||||
"unset(\$_templatelite_tpl_vars);\n" .
|
||||
' ?>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
?>
|
||||
77
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.parse_is_expr.php
vendored
Normal file
77
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.parse_is_expr.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite compile IS exprenssion in IF tag - template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: compile_parse_is_expr
|
||||
*/
|
||||
|
||||
function compile_parse_is_expr($is_arg, $_args, &$object)
|
||||
{
|
||||
$expr_end = 0;
|
||||
$negate_expr = false;
|
||||
|
||||
if (($first_arg = array_shift($_args)) == 'not') {
|
||||
$negate_expr = true;
|
||||
$expr_type = array_shift($_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$expr_type = $first_arg;
|
||||
}
|
||||
|
||||
switch ($expr_type) {
|
||||
case 'even':
|
||||
if (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')
|
||||
{
|
||||
$expr_end++;
|
||||
$expr_arg = $_args[$expr_end++];
|
||||
$expr = "!(1 & ($is_arg / " . $object->_parse_variable($expr_arg) . "))";
|
||||
}
|
||||
else
|
||||
{
|
||||
$expr = "!(1 & $is_arg)";
|
||||
}
|
||||
break;
|
||||
|
||||
case 'odd':
|
||||
if (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')
|
||||
{
|
||||
$expr_end++;
|
||||
$expr_arg = $_args[$expr_end++];
|
||||
$expr = "(1 & ($is_arg / " . $object->_parse_variable($expr_arg) . "))";
|
||||
}
|
||||
else
|
||||
{
|
||||
$expr = "(1 & $is_arg)";
|
||||
}
|
||||
break;
|
||||
|
||||
case 'div':
|
||||
if (@$_args[$expr_end] == 'by')
|
||||
{
|
||||
$expr_end++;
|
||||
$expr_arg = $_args[$expr_end++];
|
||||
$expr = "!($is_arg % " . $object->_parse_variable($expr_arg) . ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->trigger_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$object->trigger_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($negate_expr) {
|
||||
$expr = "!($expr)";
|
||||
}
|
||||
|
||||
array_splice($_args, 0, $expr_end, $expr);
|
||||
|
||||
return $_args;
|
||||
}
|
||||
|
||||
?>
|
||||
129
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.section_start.php
vendored
Normal file
129
ThinkPHP/Library/Vendor/TemplateLite/internal/compile.section_start.php
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite section_start compile plugin converted from Smarty
|
||||
*
|
||||
* Type: compile
|
||||
* Name: section_start
|
||||
*/
|
||||
|
||||
function compile_section_start($arguments, &$object)
|
||||
{
|
||||
$attrs = $object->_parse_arguments($arguments);
|
||||
$arg_list = array();
|
||||
|
||||
$output = '<?php ';
|
||||
$section_name = $attrs['name'];
|
||||
if (empty($section_name))
|
||||
{
|
||||
$object->trigger_error("missing section name", E_USER_ERROR, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
$output .= "if (isset(\$this->_sections['$section_name'])) unset(\$this->_sections['$section_name']);\n";
|
||||
$section_props = "\$this->_sections['$section_name']";
|
||||
|
||||
foreach ($attrs as $attr_name => $attr_value)
|
||||
{
|
||||
switch ($attr_name)
|
||||
{
|
||||
case 'loop':
|
||||
$output .= "{$section_props}['loop'] = is_array($attr_value) ? count($attr_value) : max(0, (int)$attr_value);\n";
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
if (is_bool($attr_value))
|
||||
{
|
||||
$show_attr_value = $attr_value ? 'true' : 'false';
|
||||
}
|
||||
else
|
||||
{
|
||||
$show_attr_value = "(bool)$attr_value";
|
||||
}
|
||||
$output .= "{$section_props}['show'] = $show_attr_value;\n";
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
$output .= "{$section_props}['$attr_name'] = '$attr_value';\n";
|
||||
break;
|
||||
|
||||
case 'max':
|
||||
case 'start':
|
||||
$output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n";
|
||||
break;
|
||||
|
||||
case 'step':
|
||||
$output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
$object->trigger_error("unknown section attribute - '$attr_name'", E_USER_ERROR, __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($attrs['show']))
|
||||
{
|
||||
$output .= "{$section_props}['show'] = true;\n";
|
||||
}
|
||||
|
||||
if (!isset($attrs['loop']))
|
||||
{
|
||||
$output .= "{$section_props}['loop'] = 1;\n";
|
||||
}
|
||||
|
||||
if (!isset($attrs['max']))
|
||||
{
|
||||
$output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "if ({$section_props}['max'] < 0)\n" .
|
||||
" {$section_props}['max'] = {$section_props}['loop'];\n";
|
||||
}
|
||||
|
||||
if (!isset($attrs['step']))
|
||||
{
|
||||
$output .= "{$section_props}['step'] = 1;\n";
|
||||
}
|
||||
|
||||
if (!isset($attrs['start']))
|
||||
{
|
||||
$output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "if ({$section_props}['start'] < 0)\n" .
|
||||
" {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
|
||||
"else\n" .
|
||||
" {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
|
||||
}
|
||||
|
||||
$output .= "if ({$section_props}['show']) {\n";
|
||||
if (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max']))
|
||||
{
|
||||
$output .= " {$section_props}['total'] = {$section_props}['loop'];\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n";
|
||||
}
|
||||
$output .= " if ({$section_props}['total'] == 0)\n" .
|
||||
" {$section_props}['show'] = false;\n" .
|
||||
"} else\n" .
|
||||
" {$section_props}['total'] = 0;\n";
|
||||
|
||||
$output .= "if ({$section_props}['show']):\n";
|
||||
$output .= "
|
||||
for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;
|
||||
{$section_props}['iteration'] <= {$section_props}['total'];
|
||||
{$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n";
|
||||
$output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n";
|
||||
$output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n";
|
||||
$output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n";
|
||||
$output .= "{$section_props}['first'] = ({$section_props}['iteration'] == 1);\n";
|
||||
$output .= "{$section_props}['last'] = ({$section_props}['iteration'] == {$section_props}['total']);\n";
|
||||
|
||||
$output .= "?>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
?>
|
||||
77
ThinkPHP/Library/Vendor/TemplateLite/internal/debug.tpl
vendored
Normal file
77
ThinkPHP/Library/Vendor/TemplateLite/internal/debug.tpl
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{* templatelite debug console *}
|
||||
|
||||
{if isset($_templatelite_debug_output) and $_templatelite_debug_output eq "html"}
|
||||
<table border=0 width=100%>
|
||||
<tr bgcolor=#cccccc><th colspan=2>Template Lite Debug Console</th></tr>
|
||||
<tr bgcolor=#cccccc><td colspan=2><b>Included templates & config files (load time in seconds):</b></td></tr>
|
||||
{foreach key=key value=templates from=$_debug_tpls}
|
||||
<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>
|
||||
<td colspan=2><tt>{for start=0 stop=$_debug_tpls[$key].depth} {/for}
|
||||
<font color={if $_debug_tpls[$key].type eq "template"}brown{elseif $_debug_tpls[$key].type eq "insert"}black{else}green{/if}>
|
||||
{$_debug_tpls[$key].filename}</font>{if isset($_debug_tpls[$key].exec_time)}
|
||||
<font size=-1><i>({$_debug_tpls[$key].exec_time|string_format:"%.5f"} seconds){if $key eq 0} (total){/if}
|
||||
</i></font>{/if}</tt></td></tr>
|
||||
{foreachelse}
|
||||
<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template assigned</i></tt></td></tr>
|
||||
{/foreach}
|
||||
<tr bgcolor=#cccccc><td colspan=2><b>Assigned template variables:</b></td></tr>
|
||||
{foreach key=key value=vars from=$_debug_keys}
|
||||
<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>
|
||||
<td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[$key]}{rdelim}</font></tt></td>
|
||||
<td nowrap><tt><font color=green>{$_debug_vals[$key]|@debug_print_var}</font></tt></td></tr>
|
||||
{foreachelse}
|
||||
<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template variables assigned</i></tt></td></tr>
|
||||
{/foreach}
|
||||
<tr bgcolor=#cccccc><td colspan=2><b>Assigned config file variables (outer template scope):</b></td></tr>
|
||||
{foreach key=key value=config_vars from=$_debug_config_keys}
|
||||
<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>
|
||||
<td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[$key]}#{rdelim}</font></tt></td>
|
||||
<td><tt><font color=green>{$_debug_config_vals[$key]|@debug_print_var}</font></tt></td></tr>
|
||||
{foreachelse}
|
||||
<tr bgcolor=#eeeeee><td colspan=2><tt><i>No config vars assigned</i></tt></td></tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{else}
|
||||
<SCRIPT language=javascript>
|
||||
if( self.name == '' ) {ldelim}
|
||||
var title = 'Console';
|
||||
{rdelim}
|
||||
else {ldelim}
|
||||
var title = 'Console_' + self.name;
|
||||
{rdelim}
|
||||
_templatelite_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
|
||||
_templatelite_console.document.write("<HTML><TITLE>Template Lite Debug Console_"+self.name+"</TITLE><BODY bgcolor=#ffffff>");
|
||||
_templatelite_console.document.write("<table border=0 width=100%>");
|
||||
_templatelite_console.document.write("<tr bgcolor=#cccccc><th colspan=2>Template Lite Debug Console</th></tr>");
|
||||
_templatelite_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>Included templates & config files (load time in seconds):</b></td></tr>");
|
||||
{foreach key=key value=templates from=$_debug_tpls}
|
||||
_templatelite_console.document.write("<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>");
|
||||
_templatelite_console.document.write("<td colspan=2><tt>{for start=0 stop=$_debug_tpls[$key].depth} {/for}");
|
||||
_templatelite_console.document.write("<font color={if $_debug_tpls[$key].type eq "template"}brown{elseif $_debug_tpls[$key].type eq "insert"}black{else}green{/if}>");
|
||||
_templatelite_console.document.write("{$_debug_tpls[$key].filename}</font>{if isset($_debug_tpls[$key].exec_time)} ");
|
||||
_templatelite_console.document.write("<font size=-1><i>({$_debug_tpls[$key].exec_time|string_format:"%.5f"} seconds){if $key eq 0} (total){/if}");
|
||||
_templatelite_console.document.write("</i></font>{/if}</tt></td></tr>");
|
||||
{foreachelse}
|
||||
_templatelite_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template assigned</i></tt></td></tr> ");
|
||||
{/foreach}
|
||||
_templatelite_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>Assigned template variables:</b></td></tr>");
|
||||
{foreach key=key value=vars from=$_debug_keys}
|
||||
_templatelite_console.document.write("<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>");
|
||||
_templatelite_console.document.write("<td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[$key]}{rdelim}</font></tt></td>");
|
||||
_templatelite_console.document.write("<td nowrap><tt><font color=green>{$_debug_vals[$key]|@debug_print_var}</font></tt></td></tr>");
|
||||
{foreachelse}
|
||||
_templatelite_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template variables assigned</i></tt></td></tr>");
|
||||
{/foreach}
|
||||
_templatelite_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>Assigned config file variables (outer template scope):</b></td></tr>");
|
||||
{foreach key=key value=config_vars from=$_debug_config_keys}
|
||||
_templatelite_console.document.write("<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>");
|
||||
_templatelite_console.document.write("<td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[$key]}#{rdelim}</font></tt></td>");
|
||||
_templatelite_console.document.write("<td><tt><font color=green>{$_debug_config_vals[$key]|@debug_print_var}</font></tt></td></tr>");
|
||||
{foreachelse}
|
||||
_templatelite_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>No config vars assigned</i></tt></td></tr>");
|
||||
{/foreach}
|
||||
_templatelite_console.document.write("</table>");
|
||||
_templatelite_console.document.write("</BODY></HTML>");
|
||||
_templatelite_console.document.close();
|
||||
</SCRIPT>
|
||||
{/if}
|
||||
28
ThinkPHP/Library/Vendor/TemplateLite/internal/template.build_dir.php
vendored
Normal file
28
ThinkPHP/Library/Vendor/TemplateLite/internal/template.build_dir.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite template_build_dir template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: template_build_dir
|
||||
*/
|
||||
|
||||
function template_build_dir($dir, $id, &$object)
|
||||
{
|
||||
$_args = explode('|', $id);
|
||||
if (count($_args) == 1 && empty($_args[0]))
|
||||
{
|
||||
return $object->_get_dir($dir);
|
||||
}
|
||||
$_result = $object->_get_dir($dir);
|
||||
foreach($_args as $value)
|
||||
{
|
||||
$_result .= $value.DIRECTORY_SEPARATOR;
|
||||
if (!is_dir($_result))
|
||||
{
|
||||
@mkdir($_result, 0777);
|
||||
}
|
||||
}
|
||||
return $_result;
|
||||
}
|
||||
|
||||
?>
|
||||
76
ThinkPHP/Library/Vendor/TemplateLite/internal/template.config_loader.php
vendored
Normal file
76
ThinkPHP/Library/Vendor/TemplateLite/internal/template.config_loader.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite config_load template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: config_load
|
||||
*/
|
||||
|
||||
$this->_config_module_loaded = true;
|
||||
$this->template_dir = $this->_get_dir($this->template_dir);
|
||||
$this->config_dir = $this->_get_dir($this->config_dir);
|
||||
$this->compile_dir = $this->_get_dir($this->compile_dir);
|
||||
$name = ($this->encode_file_name) ? md5($this->template_dir . $file . $section_name . $var_name).'.php' : str_replace(".", "_", str_replace("/", "_", $file."_".$section_name."_".$var_name)).'.php';
|
||||
|
||||
if ($this->debugging)
|
||||
{
|
||||
$debug_start_time = array_sum(explode(' ', microtime()));
|
||||
}
|
||||
|
||||
if ($this->cache)
|
||||
{
|
||||
array_push($this->_cache_info['config'], $file);
|
||||
}
|
||||
|
||||
if (!$this->force_compile && file_exists($this->compile_dir.'c_'.$name) && (filemtime($this->compile_dir.'c_'.$name) > filemtime($this->config_dir.$file)))
|
||||
{
|
||||
include($this->compile_dir.'c_'.$name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!is_object($this->_config_obj))
|
||||
{
|
||||
require_once(TEMPLATE_LITE_DIR . "class.config.php");
|
||||
$this->_config_obj = new $this->config_class;
|
||||
$this->_config_obj->overwrite = $this->config_overwrite;
|
||||
$this->_config_obj->booleanize = $this->config_booleanize;
|
||||
$this->_config_obj->fix_new_lines = $this->config_fix_new_lines;
|
||||
$this->_config_obj->read_hidden = $this->config_read_hidden;
|
||||
}
|
||||
|
||||
if (!($_result = $this->_config_obj->config_load($this->config_dir.$file, $section_name, $var_name)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($var_name) || !empty($section_name))
|
||||
{
|
||||
$output = "\$this->_confs = " . var_export($_result, true) . ";";
|
||||
}
|
||||
else
|
||||
{
|
||||
// must shift of the bottom level of the array to get rid of the section labels
|
||||
$_temp = array();
|
||||
foreach($_result as $value)
|
||||
{
|
||||
$_temp = array_merge($_temp, $value);
|
||||
}
|
||||
$output = "\$this->_confs = " . var_export($_temp, true) . ";";
|
||||
}
|
||||
|
||||
$f = fopen($this->compile_dir.'c_'.$name, "w");
|
||||
fwrite($f, '<?php ' . $output . ' ?>');
|
||||
fclose($f);
|
||||
eval($output);
|
||||
|
||||
if ($this->debugging)
|
||||
{
|
||||
$this->_templatelite_debug_info[] = array('type' => 'config',
|
||||
'filename' => $file.' ['.$section_name.'] '.$var_name,
|
||||
'depth' => 0,
|
||||
'exec_time' => array_sum(explode(' ', microtime())) - $debug_start_time );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
?>
|
||||
68
ThinkPHP/Library/Vendor/TemplateLite/internal/template.destroy_dir.php
vendored
Normal file
68
ThinkPHP/Library/Vendor/TemplateLite/internal/template.destroy_dir.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite template_destroy_dir template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: template_destroy_dir
|
||||
*/
|
||||
|
||||
function template_destroy_dir($file, $id, $dir, &$object)
|
||||
{
|
||||
if ($file == null && $id == null)
|
||||
{
|
||||
if (is_dir($dir))
|
||||
{
|
||||
if($d = opendir($dir))
|
||||
{
|
||||
while(($f = readdir($d)) !== false)
|
||||
{
|
||||
if ($f != '.' && $f != '..')
|
||||
{
|
||||
template_rm_dir($dir.$f.DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($id == null)
|
||||
{
|
||||
$object->template_dir = $object->_get_dir($object->template_dir);
|
||||
|
||||
$name = ($object->encode_file_name) ? md5($object->template_dir.$file).'.php' : str_replace(".", "_", str_replace("/", "_", $file)).'.php';
|
||||
@unlink($dir.$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_args = "";
|
||||
foreach(explode('|', $id) as $value)
|
||||
{
|
||||
$_args .= $value.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
template_rm_dir($dir.DIRECTORY_SEPARATOR.$_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function template_rm_dir($dir)
|
||||
{
|
||||
if (is_file(substr($dir, 0, -1)))
|
||||
{
|
||||
@unlink(substr($dir, 0, -1));
|
||||
return;
|
||||
}
|
||||
if ($d = opendir($dir))
|
||||
{
|
||||
while(($f = readdir($d)) !== false)
|
||||
{
|
||||
if ($f != '.' && $f != '..')
|
||||
{
|
||||
template_rm_dir($dir.$f.DIRECTORY_SEPARATOR, $object);
|
||||
}
|
||||
}
|
||||
@rmdir($dir.$f);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
42
ThinkPHP/Library/Vendor/TemplateLite/internal/template.fetch_compile_include.php
vendored
Normal file
42
ThinkPHP/Library/Vendor/TemplateLite/internal/template.fetch_compile_include.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite template_fetch_compile_include template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: template_fetch_compile_include
|
||||
*/
|
||||
|
||||
function template_fetch_compile_include($_templatelite_include_file, $_templatelite_include_vars, &$object)
|
||||
{
|
||||
if ($object->debugging)
|
||||
{
|
||||
$object->_templatelite_debug_info[] = array('type' => 'template',
|
||||
'filename' => $_templatelite_include_file,
|
||||
'depth' => ++$object->_inclusion_depth,
|
||||
'exec_time' => array_sum(explode(' ', microtime())) );
|
||||
$included_tpls_idx = count($object->_templatelite_debug_info) - 1;
|
||||
}
|
||||
|
||||
$object->_vars = array_merge($object->_vars, $_templatelite_include_vars);
|
||||
$_templatelite_include_file = $object->_get_resource($_templatelite_include_file);
|
||||
if(isset($object->_confs[0]))
|
||||
{
|
||||
array_unshift($object->_confs, $object->_confs[0]);
|
||||
$_compiled_output = $object->_fetch_compile($_templatelite_include_file);
|
||||
array_shift($object->_confs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_compiled_output = $object->_fetch_compile($_templatelite_include_file);
|
||||
}
|
||||
|
||||
$object->_inclusion_depth--;
|
||||
|
||||
if ($object->debugging)
|
||||
{
|
||||
$object->_templatelite_debug_info[$included_tpls_idx]['exec_time'] = array_sum(explode(' ', microtime())) - $object->_templatelite_debug_info[$included_tpls_idx]['exec_time'];
|
||||
}
|
||||
return $_compiled_output;
|
||||
}
|
||||
|
||||
?>
|
||||
37
ThinkPHP/Library/Vendor/TemplateLite/internal/template.generate_debug_output.php
vendored
Normal file
37
ThinkPHP/Library/Vendor/TemplateLite/internal/template.generate_debug_output.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Lite template_generate_debug_output template internal module
|
||||
*
|
||||
* Type: template
|
||||
* Name: template_generate_debug_output
|
||||
*/
|
||||
|
||||
function template_generate_debug_output(&$object)
|
||||
{
|
||||
$assigned_vars = $object->_vars;
|
||||
ksort($assigned_vars);
|
||||
if (@is_array($object->_config[0]))
|
||||
{
|
||||
$config_vars = $object->_config[0];
|
||||
ksort($config_vars);
|
||||
$object->assign("_debug_config_keys", array_keys($config_vars));
|
||||
$object->assign("_debug_config_vals", array_values($config_vars));
|
||||
}
|
||||
|
||||
$included_templates = $object->_templatelite_debug_info;
|
||||
|
||||
$object->assign("_debug_keys", array_keys($assigned_vars));
|
||||
$object->assign("_debug_vals", array_values($assigned_vars));
|
||||
$object->assign("_debug_tpls", $included_templates);
|
||||
$object->assign("_templatelite_debug_output", "");
|
||||
|
||||
$object->_templatelite_debug_loop = true;
|
||||
$object->_templatelite_debug_dir = $object->template_dir;
|
||||
$object->template_dir = TEMPLATE_LITE_DIR . "internal/";
|
||||
$debug_output = $object->fetch("debug.tpl");
|
||||
$object->template_dir = $object->_templatelite_debug_dir;
|
||||
$object->_templatelite_debug_loop = false;
|
||||
return $debug_output;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user