本文整理汇总了PHP中smarty_core_get_microtime函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_core_get_microtime函数的具体用法?PHP smarty_core_get_microtime怎么用?PHP smarty_core_get_microtime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_core_get_microtime函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_ci_db_session
/**
* Smarty {ci_db_session} function plugin
*
* Type: function<br>
* Name: ci_db_session<br>
* Purpose: bridge to code igniter db_session properties
* @author Neighbor Webmastert <kepler ar neighborwebmaster dot com>
* @param array Format:
* <pre>
* array(
* 'name' => required name of the db_session properties
* 'type' => optional type 'user' or 'flash' - defaults to 'user'
* 'assign' => optional smarty variable name to assign to - defaults to name
* )
* </pre>
* @param Smarty
*/
function smarty_function_ci_db_session($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_name = isset($params['name']) ? $params['name'] : '';
$_type = isset($params['type']) ? $params['type'] : 'user';
$_assign = isset($params['assign']) ? $params['assign'] : $_name;
if ($_name != '') {
// get a Code Igniter instance
$CI =& get_instance();
$value = '';
if ($_type == 'user') {
$value = $CI->db_session->userdata($_name);
} else {
$value = $CI->db_session->flashdata($_name);
}
$smarty->assign($_assign, $value);
}
if ($smarty->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$smarty->_smarty_debug_info[] = array('type' => 'config', 'filename' => $_file . ' [' . $_section . '] ' . $_scope, 'depth' => $smarty->_inclusion_depth, 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
}
示例2: smarty_core_process_cached_inserts
/**
* Replace cached inserts with the actual results
*
* @param string $results
* @return string
*/
function smarty_core_process_cached_inserts($params, &$smarty)
{
preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
$params['results'], $match);
list($cached_inserts, $insert_args) = $match;
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$args = unserialize($insert_args[$i]);
$name = $args['name'];
if (isset($args['script'])) {
$_params = array('resource_name' => $smarty->_dequote($args['script']));
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
$resource_type = $_params['resource_type'];
$php_resource = $_params['php_resource'];
if ($resource_type == 'file') {
$smarty->_include($php_resource, true);
} else {
$smarty->_eval($php_resource);
}
}
$function_name = $smarty->_plugins['insert'][$name][0];
if (empty($args['assign'])) {
$replace = $function_name($args, $smarty);
} else {
$smarty->assign($args['assign'], $function_name($args, $smarty));
$replace = '';
}
$params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$name,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
}
}
return $params['results'];
}
示例3: smarty_core_run_insert_handler
/**
* Handle insert tags
*
* @param array $args
* @return string
*/
function smarty_core_run_insert_handler($params, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
if ($smarty->debugging) {
$_params = array();
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
if ($smarty->caching) {
$_arg_string = serialize($params['args']);
$_name = $params['args']['name'];
if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
$smarty->_cache_info['insert_tags'][$_name] = array('insert',
$_name,
$smarty->_plugins['insert'][$_name][1],
$smarty->_plugins['insert'][$_name][2],
!empty($params['args']['script']) ? true : false);
}
return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
} else {
if (isset($params['args']['script'])) {
$_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
if ($_params['resource_type'] == 'file') {
$smarty->_include($_params['php_resource'], true);
} else {
$smarty->_eval($_params['php_resource']);
}
unset($params['args']['script']);
}
$_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
$_content = $_funcname($params['args'], $smarty);
if ($smarty->debugging) {
$_params = array();
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$params['args']['name'],
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
if (!empty($params['args']["assign"])) {
$smarty->assign($params['args']["assign"], $_content);
} else {
return $_content;
}
}
}
示例4: _smarty_include
function _smarty_include($params)
{
if ($this->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $params['smarty_include_tpl_file'], 'depth' => ++$this->_inclusion_depth);
$included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
// Extract array with parameters
if (!empty($params['smarty_include_vars']['params_array'])) {
foreach ($params['smarty_include_vars']['params_array'] as $k => $v) {
$this->_tpl_vars[$k] = $v;
}
unset($params['smarty_include_vars']['params_array']);
}
// Get customization mode info
if ($this->customization) {
$this->_smarty_customization_info[] = array('filename' => $params['smarty_include_tpl_file'], 'depth' => $this->debugging ? $this->_inclusion_depth : ++$this->_inclusion_depth);
}
$this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
// Load addons if necessary
if (strpos($params['smarty_include_tpl_file'], 'addons/') === 0) {
$path_array = explode('/', $params['smarty_include_tpl_file']);
if (fn_load_addon($path_array[1]) == false) {
return false;
}
}
// Substitute current skin area
$_skin_name = $this->_tpl_vars['skin_area'] == 'mail' || $this->_tpl_vars['skin_area'] == 'customer' ? Registry::get('settings.skin_name_customer') : Registry::get('config.skin_name');
$this->template_dir = DIR_ROOT . '/skins/' . $_skin_name . '/' . $this->_tpl_vars['skin_area'];
$this->_tpl_vars['images_dir'] = Registry::get('config.current_path') . '/skins/' . $_skin_name . '/' . $this->_tpl_vars['skin_area'] . '/images';
$this->_tpl_vars['skin_dir'] = Registry::get('config.current_path') . '/skins/' . $_skin_name . '/' . $this->_tpl_vars['skin_area'];
// config vars are treated as local, so push a copy of the
// current ones onto the front of the stack
array_unshift($this->_config, $this->_config[0]);
$_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path) || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path)) {
include $_smarty_compile_path;
}
// pop the local vars off the front of the stack
array_shift($this->_config);
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
} else {
$this->_inclusion_depth--;
}
if ($this->caching) {
$this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
}
}
示例5: smarty_function_ci_validation
/**
* Smarty {ci_validation} function plugin
*
* Type: function<br>
* Name: ci_validation<br>
* Purpose: bridge to code igniter validation properties
* @author Neighbor Webmaster <kepler ar neighborwebmaster dot com>
* @param array Format:
* <pre>
* array(
* 'field' => required field validation property
* 'error' => optional boolean indicating whether this is an error message
* 'assign' => optional variable to assign the error message to - defaults to output
* )
* </pre>
* @param Smarty
*/
function smarty_function_ci_validation($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_field = isset($params['field']) ? $smarty->_dequote($params['field']) : '';
$_type = isset($params['type']) ? $smarty->_dequote($params['type']) : '';
$_error = isset($params['error']) ? ((strcasecmp($smarty->_dequote($params['error']), "true") == 0) ? true : false ) : false;
$_assign = isset($params['assign']) ? $smarty->_dequote($params['assign']) : null;
if ($_field != '')
{
if (substr($_field, 0, 1) == '$')
{
$_field = $smarty->get_template_vars( substr($_field, 1) );
}
// get a Code Igniter instance
$CI = &get_instance();
$_validation = $CI->validation;
if ($_type == 'auth')
{
$_validation = $CI->auth_validation;
}
if ( $_error )
{
$_field .= "_error";
}
$value = $_validation->$_field;
if ( isset( $_assign ) )
{
$smarty->assign( $_assign, $value );
}
else
{
echo $value;
}
}
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'validation',
'filename' => $_file.' ['.$_section.'] '.$_scope,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
}
示例6: smarty_function_ci_form_validation
/**
* Smarty {ci_form_validation} function plugin
*
* Type: function<br>
* Name: ci_form_validation<br>
* Purpose: bridge to code igniter form validation properties
* @author Neighbor Webmaster <kepler ar neighborwebmaster dot com>
* @param array Format:
* <pre>
* array(
* 'field' => required field validation property
* 'error' => optional boolean indicating whether this is an error message
* 'assign' => optional variable to assign the error message to - defaults to output
* 'type' => optional class name of your own form_validation
* )
* </pre>
* @param Smarty
*/
function smarty_function_ci_form_validation($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_field = isset($params['field']) ? $params['field'] : '';
$_type = isset($params['type']) ? $params['type'] : '';
$_error = isset($params['error']) ? strcasecmp($params['error'], "true") == 0 ? true : false : false;
$_assign = isset($params['assign']) ? $params['assign'] : null;
if ($_field != '') {
if (substr($_field, 0, 1) == '$') {
$_field = $smarty->get_template_vars(substr($_field, 1));
}
// get a Code Igniter instance
$CI =& get_instance();
$_validation = $CI->form_validation;
// did you want to use your own form_validation class instead?
if ($_type != '') {
$_validation = $CI->{$_type};
}
if ($_error) {
$value = $_validation->error($_field);
} else {
$value = $_validation->set_value($_field);
}
if (isset($_assign)) {
$smarty->assign($_assign, $value);
} else {
echo $value;
}
}
if ($smarty->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$smarty->_smarty_debug_info[] = array('type' => 'validation', 'filename' => $_file . ' [' . $_section . '] ' . $_scope, 'depth' => $smarty->_inclusion_depth, 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
}
示例7: _smarty_include
function _smarty_include($params)
{
if ($this->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $params['smarty_include_tpl_file'], 'depth' => ++$this->_inclusion_depth);
$included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
$this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
// config vars are treated as local, so push a copy of the
// current ones onto the front of the stack
array_unshift($this->_config, $this->_config[0]);
$_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path) || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path)) {
include $_smarty_compile_path;
}
// pop the local vars off the front of the stack
array_shift($this->_config);
$this->_inclusion_depth--;
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
}
if ($this->caching) {
$this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
}
}
示例8: smarty_function_config_load
/**
* Smarty {config_load} function plugin
*
* Type: function<br>
* Name: config_load<br>
* Purpose: load config file vars
* @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author messju mohr <messju at lammfellpuschen dot de> (added use of resources)
* @param array Format:
* <pre>
* array('file' => required config file name,
* 'section' => optional config file section to load
* 'scope' => local/parent/global
* 'global' => overrides scope, setting to parent if true)
* </pre>
* @param Smarty
*/
function smarty_function_config_load($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once ECARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null;
$_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null;
$_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global';
$_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false;
if (!isset($_file) || strlen($_file) == 0) {
$smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
}
if (isset($_scope)) {
if ($_scope != 'local' && $_scope != 'parent' && $_scope != 'global') {
$smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
}
} else {
if ($_global) {
$_scope = 'parent';
} else {
$_scope = 'local';
}
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, 'get_source' => false);
$smarty->_parse_resource_name($_params);
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
if (isset($_section)) {
$_compile_file = $smarty->_get_compile_path($_file_path . '|' . $_section);
} else {
$_compile_file = $smarty->_get_compile_path($_file_path);
}
if ($smarty->force_compile || !file_exists($_compile_file)) {
$_compile = true;
} elseif ($smarty->compile_check) {
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, 'get_source' => false);
$_compile = $smarty->_fetch_resource_info($_params) && $_params['resource_timestamp'] > filemtime($_compile_file);
} else {
$_compile = false;
}
if ($_compile) {
// compile config file
if (!is_object($smarty->_conf_obj)) {
require_once ECARTY_DIR . $smarty->config_class . '.class.php';
$smarty->_conf_obj = new $smarty->config_class();
$smarty->_conf_obj->overwrite = $smarty->config_overwrite;
$smarty->_conf_obj->booleanize = $smarty->config_booleanize;
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, $_params['get_source'] = true);
if (!$smarty->_fetch_resource_info($_params)) {
return;
}
$smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
$_config_vars = array_merge($smarty->_conf_obj->get($_file), $smarty->_conf_obj->get($_file, $_section));
if (function_exists('var_export')) {
$_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>';
} else {
$_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars), array('\'' => '\\\'', '\\' => '\\\\')) . '\'); ?>';
}
$_params = array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']);
require_once ECARTY_CORE_DIR . 'core.write_compiled_resource.php';
smarty_core_write_compiled_resource($_params, $smarty);
} else {
include $_compile_file;
}
if ($smarty->caching) {
$smarty->_cache_info['config'][$_file] = true;
}
$smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars);
$smarty->_config[0]['files'][$_file] = true;
if ($_scope == 'parent') {
$smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars);
$smarty->_config[1]['files'][$_file] = true;
} else {
if ($_scope == 'global') {
for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) {
$smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars);
$smarty->_config[$i]['files'][$_file] = true;
//.........这里部分代码省略.........
示例9: fetchDebugConsole
/**
* Return smarty's debug console if debug mode is active.
*
* @return string
*/
function fetchDebugConsole()
{
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
return smarty_core_display_debug_console($_params, $this);
}
}
示例10: _fetch
/**
* Smarty override to customize the core.process_cached_inserts
*
* @param string $template The name of the template.
* @param string $cache_id The cache ID (optional).
* @param string $compile_id The compile ID (optional).
* @param boolean $display Whether or not to display directly (optional).
*
* @return string The template output.
*/
public function _fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) ? $this->error_reporting : error_reporting() & ~E_NOTICE);
$_smarty_old_error_level &= ~E_USER_DEPRECATED;
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
$_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
if (@strstr($_query_string, $this->_smarty_debug_id)) {
if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
// enable debugging for this browser session
@setcookie('SMARTY_DEBUG', true);
$this->debugging = true;
} elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
// disable debugging for this browser session
@setcookie('SMARTY_DEBUG', false);
$this->debugging = false;
} else {
// enable debugging for this page
$this->debugging = true;
}
} else {
$this->debugging = (bool) ($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
}
}
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $resource_name, 'depth' => 0);
$_included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
if (!isset($compile_id)) {
$compile_id = $this->compile_id;
}
$this->_compile_id = $compile_id;
$this->_inclusion_depth = 0;
if ($this->caching) {
// save old cache_info, initialize cache_info
array_push($_cache_info, $this->_cache_info);
$this->_cache_info = array();
$_params = array('tpl_file' => $resource_name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, 'results' => null);
require_once SMARTY_CORE_DIR . 'core.read_cache_file.php';
if (smarty_core_read_cache_file($_params, $this)) {
$_smarty_results = $_params['results'];
if (!empty($this->_cache_info['insert_tags'])) {
$_params = array('plugins' => $this->_cache_info['insert_tags']);
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins($_params, $this);
$_params = array('results' => $_smarty_results);
// ZIKULA OVERRIDE
require_once 'lib/legacy/viewplugins/zikula.process_cached_inserts.php';
$_smarty_results = smarty_core_process_cached_inserts($_params, $this);
}
if (!empty($this->_cache_info['cache_serials'])) {
$_params = array('results' => $_smarty_results);
require_once SMARTY_CORE_DIR . 'core.process_compiled_include.php';
$_smarty_results = smarty_core_process_compiled_include($_params, $this);
}
if ($display) {
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
$_smarty_results .= smarty_core_display_debug_console($_params, $this);
}
if ($this->cache_modified_check) {
$_server_vars = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
$_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
$_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']) . ' GMT';
if (@count($this->_cache_info['insert_tags']) == 0 && !$this->_cache_serials && $_gmt_mtime == $_last_modified_date) {
if (php_sapi_name() == 'cgi') {
header('Status: 304 Not Modified');
} else {
header('HTTP/1.1 304 Not Modified');
}
} else {
header('Last-Modified: ' . $_gmt_mtime);
echo $_smarty_results;
}
} else {
echo $_smarty_results;
}
error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return true;
} else {
//.........这里部分代码省略.........
示例11: smarty_function_ci_language
/**
* Smarty {ci_language} function plugin
*
* Type: function<br>
* Name: ci_language<br>
* Purpose: bridge to code igniter language files
* @author Neighbor Webmastert <kepler ar neighborwebmaster dot com>
* @param array Format:
* <pre>
* array(
* 'file' => language file to load
* 'lang' => optional language identifier - defaults to 'english'
* 'lang' => option language identifier - defaults to 'english'
* 'lang' => option language identifier - defaults to 'english'
* )
* </pre>
* @param Smarty
*/
function smarty_function_ci_language($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_lang = isset($params['lang']) ? $smarty->_dequote($params['lang']) : 'english';
$_file = isset($params['file']) ? $smarty->_dequote($params['file']) : '';
$_line = isset($params['line']) ? $smarty->_dequote($params['line']) : '';
$_template = isset($params['template']) ? $smarty->_dequote($params['template']) : '';
$_assign = isset($params['assign']) ? $smarty->_dequote($params['assign']) : '';
if (substr($_lang, 0, 1) == '$')
{
$_lang = $smarty->get_template_vars( substr($_lang, 1) );
}
if (substr($_file, 0, 1) == '$')
{
$_file = $smarty->get_template_vars( substr($_file, 1) );
}
if (substr($_line, 0, 1) == '$')
{
$_line = $smarty->get_template_vars( substr($_line, 1) );
}
$CI = &get_instance();
if ($_file != '') $CI->lang->load($_file, $_lang);
if ($_line != '')
{
// echo "KEY ->".$_line."<-";
// echo "TEMPLATE ->".$_template."<-";
if ($_template != '')
{
$line = str_replace('$', $_line, $_template);
}
else
{
$line = $_line;
}
// echo "LINE ->".$line."<-";
$val = $CI->lang->line($line);
if ( $val == '' )
{
$val = $line;
}
if ($_assign != '')
{
$smarty->assign( $_assign, $val );
}
else
{
echo $val;
}
}
else
{
$arr = $CI->lang->line($_lang);
}
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'config',
'filename' => $_file.' ['.$_section.'] '.$_scope,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
}
示例12: _smarty_include
function _smarty_include($params)
{
if ($this->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $params['smarty_include_tpl_file'], 'depth' => ++$this->_inclusion_depth);
$included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
$this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
// config vars are treated as local, so push a copy of the
// current ones onto the front of the stack
array_unshift($this->_config, $this->_config[0]);
$_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
// OpenX - hack to allow on-the fly compilation
$oa_content = null;
if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path) || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path, $oa_content)) {
if (!(include $_smarty_compile_path)) {
// OpenX - hack to execute the compiled template
eval('?' . '>' . $oa_content . '<' . '?php 0;');
}
// OpenX - try to explicity free memory
unset($oa_content);
}
// pop the local vars off the front of the stack
array_shift($this->_config);
$this->_inclusion_depth--;
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
}
if ($this->caching) {
$this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
}
}
示例13: smarty_function_config_load
/**
* Smarty {config_load} function plugin
*
* Type: function<br>
* Name: config_load<br>
* Purpose: load config file vars
* @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author messju mohr <messju at lammfellpuschen dot de> (added use of resources)
* @param array Format:
* <pre>
* array('file' => required config file name,
* 'section' => optional config file section to load
* 'scope' => local/parent/global
* 'global' => overrides scope, setting to parent if true)
* </pre>
* @param Smarty
*/
function smarty_function_config_load($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null;
$_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null;
$_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global';
$_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false;
if (!isset($_file) || strlen($_file) == 0) {
$smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
}
if (isset($_scope)) {
if ($_scope != 'local' && $_scope != 'parent' && $_scope != 'global') {
$smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
}
} else {
if ($_global) {
$_scope = 'parent';
} else {
$_scope = 'local';
}
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, 'get_source' => false);
$smarty->_parse_resource_name($_params);
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
if (isset($_section)) {
$_compile_file = $smarty->_get_compile_path($_file_path . '|' . $_section);
} else {
$_compile_file = $smarty->_get_compile_path($_file_path);
}
if ($smarty->force_compile || !file_exists($_compile_file)) {
$_compile = true;
} elseif ($smarty->compile_check) {
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, 'get_source' => false);
$_compile = $smarty->_fetch_resource_info($_params) && $_params['resource_timestamp'] > filemtime($_compile_file);
} else {
$_compile = false;
}
if ($_compile) {
// compile config file
if (!is_object($smarty->_conf_obj)) {
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
$smarty->_conf_obj = new $smarty->config_class();
$smarty->_conf_obj->overwrite = $smarty->config_overwrite;
$smarty->_conf_obj->booleanize = $smarty->config_booleanize;
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir, $_params['get_source'] = true);
if (!$smarty->_fetch_resource_info($_params)) {
return;
}
$smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
$_config_vars = array_merge($smarty->_conf_obj->get($_file), $smarty->_conf_obj->get($_file, $_section));
if (function_exists('var_export')) {
$_output = '<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r42807 - 2008-12-29 11:16:59 -0800 (Mon, 29 Dec 2008) - dwong - Branch from trunk/sugarcrm r42806 to branches/tokyo/sugarcrm
r10971 - 2006-01-12 14:58:30 -0800 (Thu, 12 Jan 2006) - chris - Bug 4128: updating Smarty templates to 2.6.11, a version supposedly that plays better with PHP 5.1
r8230 - 2005-10-03 17:47:19 -0700 (Mon, 03 Oct 2005) - majed - Added Sugar_Smarty to the code tree.
//.........这里部分代码省略.........