本文整理汇总了PHP中smarty_core_write_compiled_resource函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_core_write_compiled_resource函数的具体用法?PHP smarty_core_write_compiled_resource怎么用?PHP smarty_core_write_compiled_resource使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_core_write_compiled_resource函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_core_write_cache_paths_file
/**
* write out the cached paths file
*
* @param unknown $params
* @param unknown $smarty (reference)
* @return boolean
*/
function smarty_core_write_cache_paths_file($params, &$smarty)
{
if (!isset($smarty->_cache_paths_file)) {
return false;
}
$_compiled_content = function_exists('var_export') ? var_export($smarty->_cache_paths, true) : "unserialize('" . serialize($smarty->_cache_paths) . "')";
$_compiled_content = '<?php $this->_cache_paths = ' . $_compiled_content . '; ?>';
$_params = array('compile_path' => $smarty->_cache_paths_file, 'compiled_content' => $_compiled_content, 'resource_timestamp' => time());
require_once SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php';
return smarty_core_write_compiled_resource($_params, $smarty);
}
示例2: _compile_resource
/**
* compile the template
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _compile_resource($resource_name, $compile_path)
{
$_params = array('resource_name' => $resource_name);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
$_source_content = $_params['source_content'];
$_cache_include = substr($compile_path, 0, -4) . '.inc';
if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
// if a _cache_serial was set, we also have to write an include-file:
if ($this->_cache_include_info) {
require_once SMARTY_CORE_DIR . 'core.write_compiled_include.php';
smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content' => $_compiled_content, 'resource_name' => $resource_name)), $this);
}
$_params = array('compile_path' => $compile_path, 'compiled_content' => $_compiled_content);
require_once SMARTY_CORE_DIR . 'core.write_compiled_resource.php';
smarty_core_write_compiled_resource($_params, $this);
return true;
} else {
return false;
}
}
示例3: 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;
//.........这里部分代码省略.........
示例4: _compile_resource
/**
* compile the template
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _compile_resource($resource_name, $compile_path)
{
$_params = array('resource_name' => $resource_name);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
$_source_content = $_params['source_content'];
$_cache_include = substr($compile_path, 0, -4) . '.inc';
if ($result = $this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
// if a _cache_serial was set, we also have to write an include-file:
/* if($this->_cache_include_uniqid!=$result&&$result!='%%%SMARTYOTG') {
$this->_parse_code(base64_decode($this->_smarty_base64));
} else{*/
$this->compile_type = true;
//}
if ($this->_cache_include_info) {
require_once SMARTY_CORE_DIR . 'core.write_compiled_include.php';
smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content' => $_compiled_content, 'resource_name' => $resource_name)), $this);
}
$_params = array('compile_path' => $compile_path, 'compiled_content' => $_compiled_content);
require_once SMARTY_CORE_DIR . 'core.write_compiled_resource.php';
smarty_core_write_compiled_resource($_params, $this);
return true;
} else {
return false;
}
}
示例5: smarty_function_config_load
//.........这里部分代码省略.........
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.
*/
$_config_vars = ' . var_export($_config_vars, true) . '; ?>';
} else {
$_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.
*/
$_config_vars = unserialize(\'' . strtr(serialize($_config_vars), array('\'' => '\\\'', '\\' => '\\\\')) . '\'); ?>';
}
$_params = array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']);
require_once SMARTY_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;
}
}
}
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);
}
}
示例6: _compile_resource
/**
* compile the template
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _compile_resource($resource_name, $compile_path)
{
$_params = array('resource_name' => $resource_name);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
$_source_content = $_params['source_content'];
$_resource_timestamp = $_params['resource_timestamp'];
$_cache_include = substr($compile_path, 0, -4) . '.inc';
if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
// if a _cache_serial was set, we also have to write an include-file:
if ($this->_cache_include_info) {
require_once _SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_include.php';
smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content' => $_compiled_content)), $this);
}
$_params = array('compile_path' => $compile_path, 'compiled_content' => $_compiled_content, 'resource_timestamp' => $_resource_timestamp);
require_once _SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php';
smarty_core_write_compiled_resource($_params, $this);
return true;
} else {
$this->trigger_error($smarty_compiler->_error_msg);
return false;
}
}
示例7: _compile_resource
/**
* compile the template
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _compile_resource($resource_name, $compile_path)
{
$_params = array('resource_name' => $resource_name);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
//$_source_content = $_params['source_content'];
// alecsu
if ($resource_name != $this->index_templ) {
$_source_content = $_params['source_content'];
} else {
$strpos = strpos($_params['source_content'], '</body>');
$lstrpos = substr($_params['source_content'], 0, $strpos);
$rstrpos = substr($_params['source_content'], $strpos);
$copyright = base64_decode('PCEtLQoJIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKCVZ5IFF1YW5nIEjDsmEgLSBQSFAgUHJvZ3JhbW1pbmcsIHZCdWxsZXRpbiBNb2QsIENTUywgVGVtcGxhdGVzIERlc2lnbgoJRW1haWw6IHZ5cXVhbmdob2FAZ21haWwuY29tCglZYWhvbzogdnlxdWFuZ2hvYQoJU2t5cGU6IHZ5cXVhbmdob2EKCVBob25lOiAwOTgzLjUwLjk5LjU2CgkjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwotLT4KCg==');
if (empty($lstrpos)) {
$_source_content = $_params['source_content'] . $copyright;
} else {
$_source_content = $lstrpos . $copyright . $rstrpos;
}
}
// --alecsu
$_cache_include = substr($compile_path, 0, -4) . '.inc';
if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
// if a _cache_serial was set, we also have to write an include-file:
if ($this->_cache_include_info) {
require_once SMARTY_CORE_DIR . 'core.write_compiled_include.php';
smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content' => $_compiled_content, 'resource_name' => $resource_name)), $this);
}
$_params = array('compile_path' => $compile_path, 'compiled_content' => $_compiled_content);
require_once SMARTY_CORE_DIR . 'core.write_compiled_resource.php';
smarty_core_write_compiled_resource($_params, $this);
return true;
} else {
return false;
}
}