remove unneeded properties

This commit is contained in:
Uwe Tews
2015-08-06 19:05:11 +02:00
parent 8cffee8426
commit 35c7e9767d
2 changed files with 17 additions and 37 deletions

View File

@@ -29,37 +29,18 @@ abstract class Smarty_Resource
* @var boolean * @var boolean
*/ */
public $recompiled = false; public $recompiled = false;
/**
* resource handler object
*
* @var Smarty_Resource
*/
public $handler = null;
/**
* cache for Smarty_Template_Source instances
*
* @var array
*/
public static $sources = array();
/**
* cache for Smarty_Template_Compiled instances
*
* @var array
*/
public static $compileds = array();
/** /**
* resource types provided by the core * resource types provided by the core
* *
* @var array * @var array
*/ */
protected static $sysplugins = array( protected static $sysplugins = array('file' => 'smarty_internal_resource_file.php',
'file' => 'smarty_internal_resource_file.php', 'string' => 'smarty_internal_resource_string.php',
'string' => 'smarty_internal_resource_string.php', 'extends' => 'smarty_internal_resource_extends.php',
'extends' => 'smarty_internal_resource_extends.php', 'stream' => 'smarty_internal_resource_stream.php',
'stream' => 'smarty_internal_resource_stream.php', 'eval' => 'smarty_internal_resource_eval.php',
'eval' => 'smarty_internal_resource_eval.php', 'php' => 'smarty_internal_resource_php.php');
'php' => 'smarty_internal_resource_php.php'
);
/** /**
* Name of the Class to compile this resource's contents with * Name of the Class to compile this resource's contents with
@@ -182,12 +163,10 @@ abstract class Smarty_Resource
if (class_exists($_resource_class, false)) { if (class_exists($_resource_class, false)) {
return $smarty->_resource_handlers[$type] = new $_resource_class(); return $smarty->_resource_handlers[$type] = new $_resource_class();
} else { } else {
$smarty->registerResource($type, array( $smarty->registerResource($type, array("smarty_resource_{$type}_source",
"smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp",
"smarty_resource_{$type}_timestamp", "smarty_resource_{$type}_secure",
"smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted"));
"smarty_resource_{$type}_trusted"
));
// give it another try, now that the resource is registered properly // give it another try, now that the resource is registered properly
return self::load($smarty, $type); return self::load($smarty, $type);
} }
@@ -200,7 +179,7 @@ abstract class Smarty_Resource
if (is_object($smarty->security_policy)) { if (is_object($smarty->security_policy)) {
$smarty->security_policy->isTrustedStream($type); $smarty->security_policy->isTrustedStream($type);
} }
return $smarty->_resource_handlers[$type] = new Smarty_Internal_Resource_Stream();; return $smarty->_resource_handlers[$type] = new Smarty_Internal_Resource_Stream();
} }
// TODO: try default_(template|config)_handler // TODO: try default_(template|config)_handler
@@ -220,7 +199,7 @@ abstract class Smarty_Resource
*/ */
public static function parseResourceName($resource_name, $default_resource) public static function parseResourceName($resource_name, $default_resource)
{ {
if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]/', $resource_name, $match)) { if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]/', $resource_name, $match)) {
$type = $match[1]; $type = $match[1];
$name = substr($resource_name, strlen($match[0])); $name = substr($resource_name, strlen($match[0]));
} else { } else {
@@ -228,7 +207,6 @@ abstract class Smarty_Resource
// or single character before the colon is not a resource type, but part of the filepath // or single character before the colon is not a resource type, but part of the filepath
$type = $default_resource; $type = $default_resource;
$name = $resource_name; $name = $resource_name;
} }
return array($name, $type); return array($name, $type);
} }
@@ -258,7 +236,9 @@ abstract class Smarty_Resource
$resource = Smarty_Resource::load($smarty, $type); $resource = Smarty_Resource::load($smarty, $type);
// go relative to a given template? // go relative to a given template?
$_file_is_dotted = $name[0] == '.' && ($name[1] == '.' || $name[1] == '/'); $_file_is_dotted = $name[0] == '.' && ($name[1] == '.' || $name[1] == '/');
if ($template instanceof Smarty_Internal_Template && $_file_is_dotted && ($template->source->type == 'file' || $template->parent->source->type == 'extends')) { if ($template instanceof Smarty_Internal_Template && $_file_is_dotted &&
($template->source->type == 'file' || $template->parent->source->type == 'extends')
) {
$name = dirname($template->source->filepath) . DS . $name; $name = dirname($template->source->filepath) . DS . $name;
} }
return $resource->buildUniqueResourceName($smarty, $name); return $resource->buildUniqueResourceName($smarty, $name);

View File

@@ -216,7 +216,7 @@ class Smarty_Template_Source
// create new source object // create new source object
$source = new Smarty_Template_Source($resource, $smarty, $template_resource, $type, $name); $source = new Smarty_Template_Source($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template); $resource->populate($source, $_template);
if ((!isset($source->exists) || !$source->exists) && isset($_template->smarty->default_template_handler_func)) { if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source); Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source);
} }
// on recompiling resources we are done // on recompiling resources we are done