?? smarty.class.php
字號:
* * @var string */ var $compiler_class = 'Smarty_Compiler'; /** * The class used to load config vars. * * @var string */ var $config_class = 'Config_File';/**#@+ * END Smarty Configuration Section * There should be no need to touch anything below this line. * @access private */ /** * where assigned template vars are kept * * @var array */ var $_tpl_vars = array(); /** * stores run-time $smarty.* vars * * @var null|array */ var $_smarty_vars = null; /** * keeps track of sections * * @var array */ var $_sections = array(); /** * keeps track of foreach blocks * * @var array */ var $_foreach = array(); /** * keeps track of tag hierarchy * * @var array */ var $_tag_stack = array(); /** * configuration object * * @var Config_file */ var $_conf_obj = null; /** * loaded configuration settings * * @var array */ var $_config = array(array('vars' => array(), 'files' => array())); /** * md5 checksum of the string 'Smarty' * * @var string */ var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; /** * Smarty version number * * @var string */ var $_version = '2.6.6'; /** * current template inclusion depth * * @var integer */ var $_inclusion_depth = 0; /** * for different compiled templates * * @var string */ var $_compile_id = null; /** * text in URL to enable debug mode * * @var string */ var $_smarty_debug_id = 'SMARTY_DEBUG'; /** * debugging information for debug console * * @var array */ var $_smarty_debug_info = array(); /** * info that makes up a cache file * * @var array */ var $_cache_info = array(); /** * default file permissions * * @var integer */ var $_file_perms = 0644; /** * default dir permissions * * @var integer */ var $_dir_perms = 0771; /** * registered objects * * @var array */ var $_reg_objects = array(); /** * table keeping track of plugins * * @var array */ var $_plugins = array( 'modifier' => array(), 'function' => array(), 'block' => array(), 'compiler' => array(), 'prefilter' => array(), 'postfilter' => array(), 'outputfilter' => array(), 'resource' => array(), 'insert' => array()); /** * cache serials * * @var array */ var $_cache_serials = array(); /** * name of optional cache include file * * @var string */ var $_cache_include = null; /** * indicate if the current code is used in a compiled * include * * @var string */ var $_cache_including = false; /**#@-*/ /** * The class constructor. */ function Smarty() { $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']); } /** * assigns values to template variables * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to assign */ function assign($tpl_var, $value = null) { if (is_array($tpl_var)){ foreach ($tpl_var as $key => $val) { if ($key != '') { $this->_tpl_vars[$key] = $val; } } } else { if ($tpl_var != '') $this->_tpl_vars[$tpl_var] = $value; } } /** * assigns values to template variables by reference * * @param string $tpl_var the template variable name * @param mixed $value the referenced value to assign */ function assign_by_ref($tpl_var, &$value) { if ($tpl_var != '') $this->_tpl_vars[$tpl_var] = &$value; } /** * appends values to template variables * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to append */ function append($tpl_var, $value=null, $merge=false) { if (is_array($tpl_var)) { // $tpl_var is an array, ignore $value foreach ($tpl_var as $_key => $_val) { if ($_key != '') { if(!@is_array($this->_tpl_vars[$_key])) { settype($this->_tpl_vars[$_key],'array'); } if($merge && is_array($_val)) { foreach($_val as $_mkey => $_mval) { $this->_tpl_vars[$_key][$_mkey] = $_mval; } } else { $this->_tpl_vars[$_key][] = $_val; } } } } else { if ($tpl_var != '' && isset($value)) { if(!@is_array($this->_tpl_vars[$tpl_var])) { settype($this->_tpl_vars[$tpl_var],'array'); } if($merge && is_array($value)) { foreach($value as $_mkey => $_mval) { $this->_tpl_vars[$tpl_var][$_mkey] = $_mval; } } else { $this->_tpl_vars[$tpl_var][] = $value; } } } } /** * appends values to template variables by reference * * @param string $tpl_var the template variable name * @param mixed $value the referenced value to append */ function append_by_ref($tpl_var, &$value, $merge=false) { if ($tpl_var != '' && isset($value)) { if(!@is_array($this->_tpl_vars[$tpl_var])) { settype($this->_tpl_vars[$tpl_var],'array'); } if ($merge && is_array($value)) { foreach($value as $_key => $_val) { $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key]; } } else { $this->_tpl_vars[$tpl_var][] = &$value; } } } /** * clear the given assigned template variable. * * @param string $tpl_var the template variable to clear */ function clear_assign($tpl_var) { if (is_array($tpl_var)) foreach ($tpl_var as $curr_var) unset($this->_tpl_vars[$curr_var]); else unset($this->_tpl_vars[$tpl_var]); } /** * Registers custom function to be used in templates * * @param string $function the name of the template function * @param string $function_impl the name of the PHP function to register */ function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) { $this->_plugins['function'][$function] = array($function_impl, null, null, false, $cacheable, $cache_attrs); } /** * Unregisters custom function * * @param string $function name of template function */ function unregister_function($function) { unset($this->_plugins['function'][$function]); } /** * Registers object to be used in templates * * @param string $object name of template object * @param object &$object_impl the referenced PHP object to register * @param null|array $allowed list of allowed methods (empty = all) * @param boolean $smarty_args smarty argument format, else traditional * @param null|array $block_functs list of methods that are block format */ function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) { settype($allowed, 'array'); settype($smarty_args, 'boolean'); $this->_reg_objects[$object] = array(&$object_impl, $allowed, $smarty_args, $block_methods); } /** * Unregisters object * * @param string $object name of template object */ function unregister_object($object) { unset($this->_reg_objects[$object]); } /** * Registers block function to be used in templates * * @param string $block name of template block * @param string $block_impl PHP function to register */ function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null) { $this->_plugins['block'][$block] = array($block_impl, null, null, false, $cacheable, $cache_attrs); } /** * Unregisters block function * * @param string $block name of template function */ function unregister_block($block) { unset($this->_plugins['block'][$block]); } /** * Registers compiler function * * @param string $function name of template function * @param string $function_impl name of PHP function to register */ function register_compiler_function($function, $function_impl, $cacheable=true) { $this->_plugins['compiler'][$function] = array($function_impl, null, null, false, $cacheable); } /** * Unregisters compiler function * * @param string $function name of template function */ function unregister_compiler_function($function) { unset($this->_plugins['compiler'][$function]);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -