本文整理汇总了PHP中Smarty_Resource::parseResourceName方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Resource::parseResourceName方法的具体用法?PHP Smarty_Resource::parseResourceName怎么用?PHP Smarty_Resource::parseResourceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Resource
的用法示例。
在下文中一共展示了Smarty_Resource::parseResourceName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified
*
* @param Smarty_Internal_Template $_template template object
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
* @return Smarty_Template_Config Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
{
static $_incompatible_resources = array('extends' => true, 'php' => true);
$template_resource = $_template->template_resource;
if (empty($template_resource)) {
throw new SmartyException('Missing config name');
}
// parse resource_name, load resource handler
list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $_template->smarty->default_config_type);
// make sure configs are not loaded via anything smarty can't handle
if (isset($_incompatible_resources[$type])) {
throw new SmartyException("Unable to use resource '{$type}' for config");
}
$source = new Smarty_Template_Config($_template->smarty, $template_resource, $type, $name);
$source->handler->populate($source, $_template);
if (!$source->exists && isset($_template->smarty->default_config_handler_func)) {
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
}
return $source;
}
示例2: logInclude
/**
* log include count
*
* @param \Smarty_Internal_SmartyTemplateCompiler $compiler
* @param string $include_file
* @param bool $variable_template
*/
private function logInclude(Smarty_Internal_SmartyTemplateCompiler $compiler, $include_file, $variable_template)
{
if ($variable_template) {
return;
}
list($name, $type) = Smarty_Resource::parseResourceName(trim($include_file, '\'"'), $compiler->template->smarty->default_resource_type);
if (in_array($type, array('eval', 'string'))) {
return;
}
$include_name = $type . ':' . $name;
$compiled = $compiler->parent_compiler->template->compiled;
$compiled->includes[$include_name] = isset($compiled->includes[$include_name]) ? $compiled->includes[$include_name] + 1 : 1;
}
示例3: load
/**
* initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified
*
* @param Smarty_Internal_Template $_template template object
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
* @return Smarty_Template_Source Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
{
if ($_template) {
$smarty = $_template->smarty;
$template_resource = $_template->template_resource;
}
if (empty($template_resource)) {
throw new SmartyException('Missing template name');
}
// parse resource_name, load resource handler, identify unique resource name
list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_resource_type);
$resource = Smarty_Resource::load($smarty, $type);
// if resource is not recompiling and resource name is not dotted we can check the source cache
if ($smarty->resource_caching && !$resource->recompiled && !(isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/'))) {
$unique_resource = $resource->buildUniqueResourceName($smarty, $name);
if (isset($smarty->source_objects[$unique_resource])) {
return $smarty->source_objects[$unique_resource];
}
} else {
$unique_resource = null;
}
// create new source object
$source = new Smarty_Template_Source($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template);
if ((!isset($source->exists) || !$source->exists) && isset($_template->smarty->default_template_handler_func)) {
Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source, $resObj);
}
// on recompiling resources we are done
if ($smarty->resource_caching && !$resource->recompiled) {
// may by we have already $unique_resource
$is_relative = false;
if (!isset($unique_resource)) {
$is_relative = isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/') && ($type == 'file' || isset($_template->parent->source) && $_template->parent->source->type == 'extends');
$unique_resource = $resource->buildUniqueResourceName($smarty, $is_relative ? $source->filepath . $name : $name);
}
$source->unique_resource = $unique_resource;
// save in runtime cache if not relative
if (!$is_relative) {
$smarty->source_objects[$unique_resource] = $source;
}
}
return $source;
}
开发者ID:RafaelFar,项目名称:CodeIgniter-HMVC-SMARTY-DOCTRINE-BOOTSTRAP,代码行数:54,代码来源:smarty_template_source.php
示例4: load
/**
* initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified
* @param Smarty_Internal_Template $_template template object
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
* @return Smarty_Template_Source Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = NULL, Smarty $smarty = NULL, $template_resource = NULL)
{
static $_incompatible_resources = ['extends' => TRUE, 'php' => TRUE];
$smarty = $_template->smarty;
$template_resource = $_template->template_resource;
if (empty($template_resource)) {
throw new SmartyException('Missing config name');
}
// parse resource_name, load resource handler
list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type);
// make sure configs are not loaded via anything smarty can't handle
if (isset($_incompatible_resources[$type])) {
throw new SmartyException("Unable to use resource '{$type}' for config");
}
$resource = Smarty_Resource::load($smarty, $type);
$source = new Smarty_Template_Config($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template);
if ((!isset($source->exists) || !$source->exists) && isset($_template->smarty->default_config_handler_func)) {
Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source, $resource);
}
$source->unique_resource = $resource->buildUniqueResourceName($smarty, $name, TRUE);
return $source;
}
示例5: load
/**
* initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified
*
* @param Smarty_Internal_Template $_template template object
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
* @return Smarty_Template_Source Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
{
static $_incompatible_resources = array('extends' => true, 'php' => true);
$smarty = $_template->smarty;
$template_resource = $_template->template_resource;
if (empty($template_resource)) {
throw new SmartyException('Missing config name');
}
// parse resource_name, load resource handler
$name = $type = null;
Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type, $name, $type);
// make sure configs are not loaded via anything smarty can't handle
if (isset($_incompatible_resources[$type])) {
throw new SmartyException("Unable to use resource '{$type}' for config");
}
$resource = Smarty_Resource::load($smarty, $type);
if ($smarty->resource_caching) {
$unique_resource = $resource->buildUniqueResourceName($smarty, $name, true);
if (isset($smarty->source_objects[$unique_resource])) {
return $smarty->source_objects[$unique_resource];
}
} else {
$unique_resource = null;
}
$source = new Smarty_Template_Config($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template);
if ((!isset($source->exists) || !$source->exists) && isset($_template->smarty->default_config_handler_func)) {
Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source);
}
$source->unique_resource = $resource->buildUniqueResourceName($smarty, $name, true);
$smarty->source_objects[$source->unique_resource] = $source;
return $source;
}