Entire src dir now PSR-4 compatible

This commit is contained in:
Simon Wisselink
2022-12-22 22:38:37 +01:00
parent f1e7b2d46f
commit 4d66910e7f
53 changed files with 279 additions and 268 deletions

View File

@@ -1,3 +1,9 @@
- [ ] \Smarty\Cacheresource\Base::load generates classnames that are now invalid
- [ ] \Smarty\Resource\BasePlugin::load generates classnames that are now invalid
- [ ] consistent ConfigFile Configfile
- [ ] review usages of ->_getSmartyObj and ->smarty: maybe change this so we can hide more - [ ] review usages of ->_getSmartyObj and ->smarty: maybe change this so we can hide more
- [ ] ->_objType and ->objMap - [ ] ->_objType and ->objMap
- [ ] refactor _isTplObj, _isDataObj - [ ] refactor _isTplObj, _isDataObj
- [ ] remove `require_once` calls from tests/*, especially where they load files from the demo dir
- [ ] look for and remove @method and @property phpdoc tags

View File

@@ -9,7 +9,7 @@
* @package CacheResource-examples * @package CacheResource-examples
* @author Uwe Tews * @author Uwe Tews
*/ */
class Smarty_CacheResource_Apc extends \Smarty\Cacheresource\KeyValueStore class My_CacheResource_Apc extends \Smarty\Cacheresource\KeyValueStore
{ {
/** /**
* Smarty_CacheResource_Apc constructor. * Smarty_CacheResource_Apc constructor.

View File

@@ -10,7 +10,7 @@
* @package CacheResource-examples * @package CacheResource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_CacheResource_Memcache extends \Smarty\Cacheresource\KeyValueStore class My_CacheResource_Memcache extends \Smarty\Cacheresource\KeyValueStore
{ {
/** /**
* memcache instance * memcache instance

View File

@@ -24,7 +24,7 @@ use Smarty\Exception;
* @package CacheResource-examples * @package CacheResource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_CacheResource_Mysql extends \Smarty\Cacheresource\Custom class My_CacheResource_Mysql extends \Smarty\Cacheresource\Custom
{ {
/** /**
* @var \PDO * @var \PDO

View File

@@ -28,7 +28,7 @@ use Smarty\Exception;
* *
* @author Beno!t POLASZEK - 2014 * @author Beno!t POLASZEK - 2014
*/ */
class Smarty_CacheResource_Pdo extends \Smarty\Cacheresource\Custom class My_CacheResource_Pdo extends \Smarty\Cacheresource\Custom
{ {
/** /**
* @var string[] * @var string[]

View File

@@ -11,7 +11,7 @@ require_once 'cacheresource.pdo.php';
* @require Smarty_CacheResource_Pdo class * @require Smarty_CacheResource_Pdo class
* @author Beno!t POLASZEK - 2014 * @author Beno!t POLASZEK - 2014
*/ */
class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo class My_CacheResource_Pdo_Gzip extends My_CacheResource_Pdo
{ {
/** /**
* Encodes the content before saving to database * Encodes the content before saving to database

View File

@@ -12,7 +12,7 @@ use Smarty\Template\Source;
* @package Resource-examples * @package Resource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_Resource_Extendsall extends \Smarty\Resource\ExtendsPlugin class My_Resource_Extendsall extends \Smarty\Resource\ExtendsPlugin
{ {
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource

View File

@@ -143,7 +143,9 @@ the same vars, etc., we can do that in one place.
```php ```php
<?php <?php
class Smarty_GuestBook extends Smarty { use Smarty\Smarty;
class My_GuestBook extends Smarty {
public function __construct() public function __construct()
{ {
@@ -161,9 +163,9 @@ class Smarty_GuestBook extends Smarty {
} }
``` ```
Now, we can use `Smarty_GuestBook` instead of `Smarty` in our scripts: Now, we can use `My_GuestBook` instead of `Smarty` in our scripts:
```php ```php
$smarty = new Smarty_GuestBook(); $smarty = new My_GuestBook();
$smarty->assign('name','Ned'); $smarty->assign('name','Ned');
$smarty->display('index.tpl'); $smarty->display('index.tpl');
``` ```

View File

@@ -17,7 +17,7 @@ to return the result of the processing.
<?php <?php
// put this in your application // put this in your application
function protect_email($tpl_output, Smarty_Internal_Template $template) function protect_email($tpl_output, \Smarty\Template\ $template)
{ {
$tpl_output = $tpl_output =
preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!', preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',

View File

@@ -12,7 +12,7 @@ function to return the result of the processing.
<?php <?php
// put this in your application // put this in your application
function add_header_comment($tpl_source, Smarty_Internal_Template $template) function add_header_comment($tpl_source, \Smarty\Template\ $template)
{ {
return "<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source; return "<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source;
} }

View File

@@ -18,7 +18,7 @@ This will remove all the html comments in the template source.
<?php <?php
// put this in your application // put this in your application
function remove_dw_comments($tpl_source, Smarty_Internal_Template $template) function remove_dw_comments($tpl_source, \Smarty\Template\ $template)
{ {
return preg_replace("/<!--#.*-->/U",'',$tpl_source); return preg_replace("/<!--#.*-->/U",'',$tpl_source);
} }

View File

@@ -103,9 +103,8 @@ Smarty\_Security class or create an instance of it.
<?php <?php
require 'Smarty.class.php';
class My_Security_Policy extends Smarty_Security { class My_Security_Policy extends \Smarty\Security {
// disable all PHP functions // disable all PHP functions
public $php_functions = null; public $php_functions = null;
// allow everthing as modifier // allow everthing as modifier
@@ -118,9 +117,8 @@ Smarty\_Security class or create an instance of it.
<?php <?php
require 'Smarty.class.php';
$smarty = new Smarty(); $smarty = new Smarty();
$my_security_policy = new Smarty_Security($smarty); $my_security_policy = new \Smarty\Security($smarty);
// disable all PHP functions // disable all PHP functions
$my_security_policy->php_functions = null; $my_security_policy->php_functions = null;
// allow everthing as modifier // allow everthing as modifier

View File

@@ -31,7 +31,7 @@ how to create custom CacheResources.
<?php <?php
$smarty->registerCacheResource('mysql', new Smarty_CacheResource_Mysql()); $smarty->registerCacheResource('mysql', new My_CacheResource_Mysql());
?> ?>

View File

@@ -37,7 +37,7 @@ plugin types.
* @param string $name name of the undefined tag * @param string $name name of the undefined tag
* @param string $type tag type (e.g. Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK, * @param string $type tag type (e.g. Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK,
Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_MODIFIER, Smarty::PLUGIN_MODIFIERCOMPILER) Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_MODIFIER, Smarty::PLUGIN_MODIFIERCOMPILER)
* @param Smarty_Internal_Template $template template object * @param \Smarty\Template\ $template template object
* @param string &$callback returned function name * @param string &$callback returned function name
* @param string &$script optional returned script filepath if function is external * @param string &$script optional returned script filepath if function is external
* @param bool &$cacheable true by default, set to false if plugin is not cachable (Smarty >= 3.1.8) * @param bool &$cacheable true by default, set to false if plugin is not cachable (Smarty >= 3.1.8)

View File

@@ -37,7 +37,7 @@ information on how to setup a function for fetching templates.
<?php <?php
$smarty->registerResource('mysql', new Smarty_Resource_Mysql()); $smarty->registerResource('mysql', new My_Resource_Mysql());
?> ?>

View File

@@ -66,7 +66,7 @@ to invoke your custom CacheResource implementation.
* @package CacheResource-examples * @package CacheResource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_CacheResource_Mysql extends \Smarty\Cacheresource\Custom { class My_CacheResource_Mysql extends \Smarty\Cacheresource\Custom {
// PDO instance // PDO instance
protected $db; protected $db;
protected $fetch; protected $fetch;
@@ -214,7 +214,7 @@ to invoke your custom CacheResource implementation.
* @package CacheResource-examples * @package CacheResource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_CacheResource_Memcache extends \Smarty\Cacheresource\KeyValueStore { class My_CacheResource_Memcache extends \Smarty\Cacheresource\KeyValueStore {
/** /**
* memcache instance * memcache instance
* @var Memcache * @var Memcache

View File

@@ -40,7 +40,7 @@ some other Smarty-provided functionality, it can use the supplied
* Purpose: outputs a random magic answer * Purpose: outputs a random magic answer
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_function_eightball($params, Smarty_Internal_Template $template) function smarty_function_eightball($params, \Smarty\Template\ $template)
{ {
$answers = array('Yes', $answers = array('Yes',
'No', 'No',
@@ -71,7 +71,7 @@ which can be used in the template as:
* Purpose: assign a value to a template variable * Purpose: assign a value to a template variable
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_function_assign($params, Smarty_Internal_Template $template) function smarty_function_assign($params, \Smarty\Template\ $template)
{ {
if (empty($params['var'])) { if (empty($params['var'])) {
trigger_error("assign: missing 'var' parameter"); trigger_error("assign: missing 'var' parameter");

View File

@@ -35,7 +35,7 @@ substituted in place of the `{insert}` tag in the template.
* Purpose: Inserts current date/time according to format * Purpose: Inserts current date/time according to format
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_insert_time($params, Smarty_Internal_Template $template) function smarty_insert_time($params, \Smarty\Template\ $template)
{ {
if (empty($params['format'])) { if (empty($params['format'])) {
trigger_error("insert time: missing 'format' parameter"); trigger_error("insert time: missing 'format' parameter");

View File

@@ -35,7 +35,7 @@ and return the results.
* a simple protection against spambots * a simple protection against spambots
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_outputfilter_protect_email($output, Smarty_Internal_Template $template) function smarty_outputfilter_protect_email($output, \Smarty\Template\ $template)
{ {
return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!', return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
'$1%40$2', $output); '$1%40$2', $output);

View File

@@ -57,7 +57,7 @@ of this code.
* Purpose: Convert html tags to be lowercase. * Purpose: Convert html tags to be lowercase.
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_prefilter_pre01($source, Smarty_Internal_Template $template) function smarty_prefilter_pre01($source, \Smarty\Template\ $template)
{ {
return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source); return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
} }
@@ -76,7 +76,7 @@ of this code.
* Purpose: Output code that lists all current template vars. * Purpose: Output code that lists all current template vars.
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
function smarty_postfilter_post01($compiled, Smarty_Internal_Template $template) function smarty_postfilter_post01($compiled, \Smarty\Template\ $template)
{ {
$compiled = "<pre>\n<?php print_r(\$template->getTemplateVars()); ?>\n</pre>" . $compiled; $compiled = "<pre>\n<?php print_r(\$template->getTemplateVars()); ?>\n</pre>" . $compiled;
return $compiled; return $compiled;

View File

@@ -12,7 +12,7 @@ will be able to access that resource by prepending its name to the
template you\'re addressing: `foobarxyz:yourtemplate.tpl`. template you\'re addressing: `foobarxyz:yourtemplate.tpl`.
If a Resource\'s templates should not be run through the Smarty If a Resource\'s templates should not be run through the Smarty
compiler, the Custom Resource may extend `Smarty_Resource_Uncompiled`. compiler, the Custom Resource may extend `\Smarty\Resource\UncompiledPlugin`.
The Resource Handler must then implement the function The Resource Handler must then implement the function
`renderUncompiled(\Smarty\Template $_template)`. `$_template` is `renderUncompiled(\Smarty\Template $_template)`. `$_template` is
a reference to the current template and contains all assigned variables a reference to the current template and contains all assigned variables
@@ -23,7 +23,7 @@ output-cached if the Smarty instance was configured accordingly. See
`src/Resource/PhpPlugin.php` for an example. `src/Resource/PhpPlugin.php` for an example.
If the Resource\'s compiled templates should not be cached on disk, the If the Resource\'s compiled templates should not be cached on disk, the
Custom Resource may extend `Smarty_Resource_Recompiled`. These Resources Custom Resource may extend `\Smarty\Resource\RecompiledPlugin`. These Resources
are compiled every time they are accessed. This may be an expensive are compiled every time they are accessed. This may be an expensive
overhead. See `src/Resource/StringEval.php` for an overhead. See `src/Resource/StringEval.php` for an
example. example.
@@ -51,7 +51,7 @@ example.
* @package Resource-examples * @package Resource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_Resource_Mysql extends Smarty_Resource_Custom { class My_Resource_Mysql extends \Smarty\Resource\CustomPlugin {
// PDO instance // PDO instance
protected $db; protected $db;
// prepared fetch() statement // prepared fetch() statement
@@ -109,7 +109,7 @@ example.
require_once 'libs/Smarty.class.php'; require_once 'libs/Smarty.class.php';
$smarty = new Smarty(); $smarty = new Smarty();
$smarty->registerResource('mysql', new Smarty_Resource_Mysql()); $smarty->registerResource('mysql', new My_Resource_Mysql());
// using resource from php script // using resource from php script
$smarty->display("mysql:index.tpl"); $smarty->display("mysql:index.tpl");

View File

@@ -37,7 +37,7 @@ on the functions you are supposed to provide.
* @package Resource-examples * @package Resource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_Resource_Mysql extends Smarty_Resource_Custom { class My_Resource_Mysql extends \Smarty\Resource\Custom {
// PDO instance // PDO instance
protected $db; protected $db;
// prepared fetch() statement // prepared fetch() statement
@@ -95,7 +95,7 @@ on the functions you are supposed to provide.
require_once 'libs/Smarty.class.php'; require_once 'libs/Smarty.class.php';
$smarty = new Smarty(); $smarty = new Smarty();
$smarty->registerResource('mysql', new Smarty_Resource_Mysql()); $smarty->registerResource('mysql', new My_Resource_Mysql());
// using resource from php script // using resource from php script
$smarty->display("mysql:index.tpl"); $smarty->display("mysql:index.tpl");

View File

@@ -47,7 +47,7 @@ on the functions you are supposed to provide.
* @package Resource-examples * @package Resource-examples
* @author Rodney Rehm * @author Rodney Rehm
*/ */
class Smarty_Resource_Mysql extends Smarty_Resource_Custom { class My_Resource_Mysql extends \Smarty\Resource\Custom {
// PDO instance // PDO instance
protected $db; protected $db;
// prepared fetch() statement // prepared fetch() statement
@@ -105,7 +105,7 @@ on the functions you are supposed to provide.
require_once 'libs/Smarty.class.php'; require_once 'libs/Smarty.class.php';
$smarty = new Smarty(); $smarty = new Smarty();
$smarty->registerResource('mysql', new Smarty_Resource_Mysql()); $smarty->registerResource('mysql', new My_Resource_Mysql());
// using resource from php script // using resource from php script
$smarty->display("mysql:index.tpl"); $smarty->display("mysql:index.tpl");

View File

@@ -9,7 +9,9 @@ namespace Smarty\Cacheresource;
* @subpackage Cacher * @subpackage Cacher
*/ */
use Smarty\Smarty;
use Smarty\Template; use Smarty\Template;
use Smarty\Template\Cached;
/** /**
* Cache Handler API * Cache Handler API
@@ -126,18 +128,18 @@ abstract class Custom extends Base
$cached->exists = !!$cached->timestamp; $cached->exists = !!$cached->timestamp;
} }
/** /**
* Read the cached template and process the header * Read the cached template and process the header
* *
* @param \Smarty\Template $_smarty_tpl do not change variable name, is used by compiled template * @param Template $_smarty_tpl do not change variable name, is used by compiled template
* @param Smarty_Template_Cached $cached cached object * @param Cached|null $cached cached object
* @param boolean $update flag if called because cache update * @param boolean $update flag if called because cache update
* *
* @return boolean true or false if the cached content does not exist * @return boolean true or false if the cached content does not exist
*/ */
public function process( public function process(
Template $_smarty_tpl, Template $_smarty_tpl,
Smarty_Template_Cached $cached = null, \Smarty\Template\Cached $cached = null,
$update = false $update = false
) { ) {
if (!$cached) { if (!$cached) {
@@ -239,7 +241,7 @@ abstract class Custom extends Base
{ {
$cache_name = null; $cache_name = null;
if (isset($resource_name)) { if (isset($resource_name)) {
$source = Smarty_Template_Source::load(null, $smarty, $resource_name); $source = \Smarty\Template\Source::load(null, $smarty, $resource_name);
if ($source->exists) { if ($source->exists) {
$cache_name = $source->name; $cache_name = $source->name;
} else { } else {
@@ -249,15 +251,15 @@ abstract class Custom extends Base
return $this->delete($cache_name, $cache_id, $compile_id, $exp_time); return $this->delete($cache_name, $cache_id, $compile_id, $exp_time);
} }
/** /**
* Check is cache is locked for this template * Check is cache is locked for this template
* *
* @param \Smarty\Smarty $smarty Smarty object * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object * @param Cached $cached cached object
* *
* @return boolean true or false if cache is locked * @return boolean true or false if cache is locked
*/ */
public function hasLock(\Smarty\Smarty $smarty, Smarty_Template_Cached $cached) public function hasLock(\Smarty\Smarty $smarty, \Smarty\Template\Cached $cached)
{ {
$id = $cached->lock_id; $id = $cached->lock_id;
$name = $cached->source->name . '.lock'; $name = $cached->source->name . '.lock';
@@ -272,11 +274,11 @@ abstract class Custom extends Base
* Lock cache for this template * Lock cache for this template
* *
* @param \Smarty\Smarty $smarty Smarty object * @param \Smarty\Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object * @param \Smarty\Template\Cached $cached cached object
* *
* @return bool|void * @return bool|void
*/ */
public function acquireLock(\Smarty\Smarty $smarty, Smarty_Template_Cached $cached) public function acquireLock(\Smarty\Smarty $smarty, \Smarty\Template\Cached $cached)
{ {
$cached->is_locked = true; $cached->is_locked = true;
$id = $cached->lock_id; $id = $cached->lock_id;
@@ -288,11 +290,11 @@ abstract class Custom extends Base
* Unlock cache for this template * Unlock cache for this template
* *
* @param \Smarty\Smarty $smarty Smarty object * @param \Smarty\Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object * @param \Smarty\Template\Cached $cached cached object
* *
* @return bool|void * @return bool|void
*/ */
public function releaseLock(\Smarty\Smarty $smarty, Smarty_Template_Cached $cached) public function releaseLock(\Smarty\Smarty $smarty, \Smarty\Template\Cached $cached)
{ {
$cached->is_locked = false; $cached->is_locked = false;
$name = $cached->source->name . '.lock'; $name = $cached->source->name . '.lock';

View File

@@ -234,7 +234,7 @@ abstract class KeyValueStore extends Base
protected function getTemplateUid(Smarty $smarty, $resource_name) protected function getTemplateUid(Smarty $smarty, $resource_name)
{ {
if (isset($resource_name)) { if (isset($resource_name)) {
$source = Smarty_Template_Source::load(null, $smarty, $resource_name); $source = \Smarty\Template\Source::load(null, $smarty, $resource_name);
if ($source->exists) { if ($source->exists) {
return $source->uid; return $source->uid;
} }

View File

@@ -44,7 +44,7 @@ class BlockClose extends Inheritance {
foreach ($_block as $property => $value) { foreach ($_block as $property => $value) {
$output .= "public \${$property} = " . var_export($value, true) . ";\n"; $output .= "public \${$property} = " . var_export($value, true) . ";\n";
} }
$output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; $output .= "public function callBlock(\\Smarty\\Template \$_smarty_tpl) {\n";
if ($compiler->template->compiled->has_nocache_code) { if ($compiler->template->compiled->has_nocache_code) {
$output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n";
} }

View File

@@ -35,7 +35,7 @@ class BreakTag extends Base {
protected $shorttag_order = ['levels']; protected $shorttag_order = ['levels'];
/** /**
* Tag name may be overloaded by Smarty_Internal_Compile_Continue * Tag name may be overloaded by ContinueTag
* *
* @var string * @var string
*/ */

View File

@@ -70,7 +70,7 @@ class FunctionClose extends Base {
$output = "<?php\n"; $output = "<?php\n";
$output .= $compiler->cStyleComment(" {$_funcNameCaching} ") . "\n"; $output .= $compiler->cStyleComment(" {$_funcNameCaching} ") . "\n";
$output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; $output .= "if (!function_exists('{$_funcNameCaching}')) {\n";
$output .= "function {$_funcNameCaching} (Smarty_Internal_Template \$_smarty_tpl,\$params) {\n"; $output .= "function {$_funcNameCaching} (\\Smarty\\Template \$_smarty_tpl,\$params) {\n";
$output .= "ob_start();\n"; $output .= "ob_start();\n";
$output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n";
$output .= $_paramsCode; $output .= $_paramsCode;
@@ -114,7 +114,7 @@ class FunctionClose extends Base {
$output = "<?php\n"; $output = "<?php\n";
$output .= $compiler->cStyleComment(" {$_funcName} ") . "\n"; $output .= $compiler->cStyleComment(" {$_funcName} ") . "\n";
$output .= "if (!function_exists('{$_funcName}')) {\n"; $output .= "if (!function_exists('{$_funcName}')) {\n";
$output .= "function {$_funcName}(Smarty_Internal_Template \$_smarty_tpl,\$params) {\n"; $output .= "function {$_funcName}(\\Smarty\\Template \$_smarty_tpl,\$params) {\n";
$output .= $_paramsCode; $output .= $_paramsCode;
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new \\Smarty\\Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n"; $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new \\Smarty\\Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n";
$output .= "?>\n"; $output .= "?>\n";

View File

@@ -325,7 +325,7 @@ class IncludeTag extends Base {
// get compiled code // get compiled code
$compiled_code = "<?php\n\n"; $compiled_code = "<?php\n\n";
$compiled_code .= $compiler->cStyleComment(" Start inline template \"{$sourceInfo}\" =============================") . "\n"; $compiled_code .= $compiler->cStyleComment(" Start inline template \"{$sourceInfo}\" =============================") . "\n";
$compiled_code .= "function {$tpl->compiled->unifunc} (Smarty_Internal_Template \$_smarty_tpl) {\n"; $compiled_code .= "function {$tpl->compiled->unifunc} (\\Smarty\\Template \$_smarty_tpl) {\n";
$compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler); $compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler);
$compiled_code .= "<?php\n"; $compiled_code .= "<?php\n";
$compiled_code .= "}\n?>\n"; $compiled_code .= "}\n?>\n";

View File

@@ -144,13 +144,13 @@ class Insert extends Base {
// call insert // call insert
if (isset($_assign)) { if (isset($_assign)) {
if ($_smarty_tpl->caching && !$nocacheParam) { if ($_smarty_tpl->caching && !$nocacheParam) {
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>"; $_output .= "echo \\Smarty\\Compile\\Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>";
} else { } else {
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>"; $_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
} }
} else { } else {
if ($_smarty_tpl->caching && !$nocacheParam) { if ($_smarty_tpl->caching && !$nocacheParam) {
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>"; $_output .= "echo \\Smarty\\Compile\\Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
} else { } else {
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>"; $_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
} }

View File

@@ -57,11 +57,11 @@ class CodeFrame
date("Y-m-d H:i:s"), date("Y-m-d H:i:s"),
str_replace('*/', '* /', $this->_template->source->filepath) str_replace('*/', '* /', $this->_template->source->filepath)
); );
$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n"; $output .= "/* @var \\Smarty\\Template \$_smarty_tpl */\n";
$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
($cache ? 'true' : 'false') . ')'; ($cache ? 'true' : 'false') . ')';
$output .= "if ({$dec}) {\n"; $output .= "if ({$dec}) {\n";
$output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n"; $output .= "function {$properties['unifunc']} (\\Smarty\\Template \$_smarty_tpl) {\n";
if (!$cache && !empty($compiler->tpl_function)) { if (!$cache && !empty($compiler->tpl_function)) {
$output .= '$_smarty_tpl->smarty->getRuntime(\'TplFunction\')->registerTplFunctions($_smarty_tpl, '; $output .= '$_smarty_tpl->smarty->getRuntime(\'TplFunction\')->registerTplFunctions($_smarty_tpl, ';
$output .= var_export($compiler->tpl_function, true); $output .= var_export($compiler->tpl_function, true);

View File

@@ -11,8 +11,8 @@
namespace Smarty\Compiler; namespace Smarty\Compiler;
use Smarty; use Smarty;
use Smarty_Internal_ConfigFileLexer; use Smarty\Lexer\ConfigFileLexer;
use Smarty_Internal_ConfigFileParser; use Smarty\Parser\ConfigFileParser;
use Smarty\Template; use Smarty\Template;
use Smarty\CompilerException; use Smarty\CompilerException;
@@ -113,7 +113,7 @@ class ConfigFile {
$this->smarty->_debug->start_compile($this->template); $this->smarty->_debug->start_compile($this->template);
} }
// init the lexer/parser to compile the config file // init the lexer/parser to compile the config file
/* @var Smarty_Internal_ConfigFileLexer $this- >lex */ /* @var \Smarty\Lexer\ConfigfileLexer $this->lex */
$this->lex = new $this->lexer_class( $this->lex = new $this->lexer_class(
str_replace( str_replace(
[ [
@@ -125,7 +125,7 @@ class ConfigFile {
) . "\n", ) . "\n",
$this $this
); );
/* @var Smarty_Internal_ConfigFileParser $this- >parser */ /* @var \Smarty\Parser\ConfigfileParser $this->parser */
$this->parser = new $this->parser_class($this->lex, $this); $this->parser = new $this->parser_class($this->lex, $this);
if (function_exists('mb_internal_encoding') if (function_exists('mb_internal_encoding')
&& function_exists('ini_get') && function_exists('ini_get')

View File

@@ -13,7 +13,7 @@ namespace Smarty\Compiler;
use Smarty; use Smarty;
use Smarty\Compile\Base; use Smarty\Compile\Base;
use Smarty\Compile\ExtendsTag; use Smarty\Compile\ExtendsTag;
use Smarty_Internal_Templateparser; use Smarty\Parser\TemplateParser;
use Smarty\CompilerException; use Smarty\CompilerException;
use Smarty\Exception; use Smarty\Exception;
@@ -42,7 +42,7 @@ class Template {
/** /**
* Parser object * Parser object
* *
* @var Smarty_Internal_Templateparser * @var \Smarty\Parser\TemplateParser
*/ */
public $parser = null; public $parser = null;
@@ -84,7 +84,7 @@ class Template {
/** /**
* current template * current template
* *
* @var Smarty_Internal_Template * @var \Smarty\Template
*/ */
public $template = null; public $template = null;
@@ -356,15 +356,15 @@ class Template {
/** /**
* Method to compile a Smarty template * Method to compile a Smarty template
* *
* @param Smarty_Internal_Template $template template object to compile * @param Smarty\Template $template template object to compile
* @param bool $nocache true is shall be compiled in nocache mode * @param null $nocache true is shall be compiled in nocache mode
* @param null|\Smarty\Compiler\Template $parent_compiler * @param null|Template $parent_compiler
* *
* @return bool true if compiling succeeded, false if it failed * @return bool true if compiling succeeded, false if it failed
* @throws \Exception * @throws Exception
*/ */
public function compileTemplate( public function compileTemplate(
Smarty_Internal_Template $template, \Smarty\Template $template,
$nocache = null, $nocache = null,
\Smarty\Compiler\Template $parent_compiler = null \Smarty\Compiler\Template $parent_compiler = null
) { ) {
@@ -394,7 +394,7 @@ class Template {
* @throws \Exception * @throws \Exception
*/ */
public function compileTemplateSource( public function compileTemplateSource(
Smarty_Internal_Template $template, \Smarty\Template $template,
$nocache = null, $nocache = null,
\Smarty\Compiler\Template $parent_compiler = null \Smarty\Compiler\Template $parent_compiler = null
) { ) {
@@ -694,8 +694,7 @@ class Template {
/** /**
* lazy loads internal compile plugin for tag and calls the compile method * lazy loads internal compile plugin for tag and calls the compile method
* compile objects cached for reuse. * compile objects cached for reuse.
* class name format: Smarty_Internal_Compile_TagName * class name format: \Smarty\Compile\TagName
* plugin filename format: Smarty_Internal_TagName.php
* *
* @param string $tag tag name * @param string $tag tag name
* @param array $args list of tag attributes * @param array $args list of tag attributes

View File

@@ -73,7 +73,7 @@ abstract class Data
* @param mixed $value the value to assign * @param mixed $value the value to assign
* @param boolean $nocache if true any output of this variable will be not cached * @param boolean $nocache if true any output of this variable will be not cached
* *
* @return Data current Data (or Smarty or Smarty_Internal_Template) instance for * @return Data current Data (or Smarty or \Smarty\Template) instance for
* chaining * chaining
*/ */
public function assign($tpl_var, $value = null, $nocache = false) public function assign($tpl_var, $value = null, $nocache = false)
@@ -222,7 +222,7 @@ abstract class Data
} }
protected function _updateScope($varName, $tagScope = 0) { protected function _updateScope($varName, $tagScope = 0) {
// implemented in Smarty_Internal_Template only // implemented in \Smarty\Template only
} }
/** /**
@@ -466,7 +466,7 @@ abstract class Data
$confObj->caching = Smarty::CACHING_OFF; $confObj->caching = Smarty::CACHING_OFF;
$confObj->source->config_sections = $sections; $confObj->source->config_sections = $sections;
$confObj->source->scope = $scope; $confObj->source->scope = $scope;
$confObj->compiled = Smarty_Template_Compiled::load($confObj); $confObj->compiled = \Smarty\Template\Compiled::load($confObj);
$confObj->compiled->render($confObj); $confObj->compiled->render($confObj);
if ($this->_isTplObj()) { if ($this->_isTplObj()) {
$this->compiled->file_dependency[ $confObj->source->uid ] = $this->compiled->file_dependency[ $confObj->source->uid ] =

View File

@@ -1,4 +1,7 @@
<?php <?php
namespace Smarty\Lexer;
/** /**
* Smarty Internal Plugin Configfilelexer * Smarty Internal Plugin Configfilelexer
* *
@@ -8,16 +11,16 @@
* @author Uwe Tews * @author Uwe Tews
*/ */
/** /**
* Smarty_Internal_Configfilelexer * Configfilelexer
* *
* This is the config file lexer. * This is the config file lexer.
* It is generated from the smarty_internal_configfilelexer.plex file * It is generated from the ConfigfileLexer.plex file
* *
* @package Smarty * @package Smarty
* @subpackage Compiler * @subpackage Compiler
* @author Uwe Tews * @author Uwe Tews
*/ */
class Smarty_Internal_Configfilelexer class Configfilelexer
{ {
/** /**
* Source * Source
@@ -70,7 +73,7 @@ class Smarty_Internal_Configfilelexer
/** /**
* compiler object * compiler object
* *
* @var Smarty\Compiler\ConfigFile * @var \Smarty\Compiler\ConfigFile
*/ */
private $compiler = null; private $compiler = null;
/** /**
@@ -122,9 +125,9 @@ class Smarty_Internal_Configfilelexer
* constructor * constructor
* *
* @param string $data template source * @param string $data template source
* @param Smarty\Compiler\ConfigFile $compiler * @param \Smarty\Compiler\ConfigFile $compiler
*/ */
public function __construct($data, Smarty\Compiler\ConfigFile $compiler) public function __construct($data, \Smarty\Compiler\ConfigFile $compiler)
{ {
$this->data = $data . "\n"; //now all lines are \n-terminated $this->data = $data . "\n"; //now all lines are \n-terminated
$this->dataLength = strlen($data); $this->dataLength = strlen($data);
@@ -179,31 +182,31 @@ naked_string = /[^\n]+?(?=[ \t\r]*\n)/
%statename START %statename START
commentstart { commentstart {
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; $this->token = \Smarty\Parser\ConfigfileParser::TPC_COMMENTSTART;
$this->yypushstate(self::COMMENT); $this->yypushstate(self::COMMENT);
} }
openB { openB {
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB; $this->token = \Smarty\Parser\ConfigfileParser::TPC_OPENB;
$this->yypushstate(self::SECTION); $this->yypushstate(self::SECTION);
} }
closeB { closeB {
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; $this->token = \Smarty\Parser\ConfigfileParser::TPC_CLOSEB;
} }
equal { equal {
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; $this->token = \Smarty\Parser\ConfigfileParser::TPC_EQUAL;
$this->yypushstate(self::VALUE); $this->yypushstate(self::VALUE);
} }
whitespace { whitespace {
return false; return false;
} }
newline { newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NEWLINE;
} }
id { id {
$this->token = Smarty_Internal_Configfileparser::TPC_ID; $this->token = \Smarty\Parser\ConfigfileParser::TPC_ID;
} }
text { text {
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER; $this->token = \Smarty\Parser\ConfigfileParser::TPC_OTHER;
} }
*/ */
@@ -215,23 +218,23 @@ whitespace {
return false; return false;
} }
float { float {
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; $this->token = \Smarty\Parser\ConfigfileParser::TPC_FLOAT;
$this->yypopstate(); $this->yypopstate();
} }
int { int {
$this->token = Smarty_Internal_Configfileparser::TPC_INT; $this->token = \Smarty\Parser\ConfigfileParser::TPC_INT;
$this->yypopstate(); $this->yypopstate();
} }
tripple_quotes { tripple_quotes {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_QUOTES;
$this->yypushstate(self::TRIPPLE); $this->yypushstate(self::TRIPPLE);
} }
single_quoted_string { single_quoted_string {
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_SINGLE_QUOTED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
double_quoted_string { double_quoted_string {
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_DOUBLE_QUOTED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
maybe_bool { maybe_bool {
@@ -240,16 +243,16 @@ maybe_bool {
$this->yypushstate(self::NAKED_STRING_VALUE); $this->yypushstate(self::NAKED_STRING_VALUE);
return true; //reprocess in new state return true; //reprocess in new state
} else { } else {
$this->token = Smarty_Internal_Configfileparser::TPC_BOOL; $this->token = \Smarty\Parser\ConfigfileParser::TPC_BOOL;
$this->yypopstate(); $this->yypopstate();
} }
} }
naked_string { naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
newline { newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING;
$this->value = ''; $this->value = '';
$this->yypopstate(); $this->yypopstate();
} }
@@ -260,7 +263,7 @@ newline {
%statename NAKED_STRING_VALUE %statename NAKED_STRING_VALUE
naked_string { naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
@@ -273,10 +276,10 @@ whitespace {
return false; return false;
} }
naked_string { naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING;
} }
newline { newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->token = \Smarty\Parser\ConfigfileParser::TPC_NEWLINE;
$this->yypopstate(); $this->yypopstate();
} }
@@ -286,10 +289,10 @@ newline {
%statename SECTION %statename SECTION
dot { dot {
$this->token = Smarty_Internal_Configfileparser::TPC_DOT; $this->token = \Smarty\Parser\ConfigfileParser::TPC_DOT;
} }
section { section {
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION; $this->token = \Smarty\Parser\ConfigfileParser::TPC_SECTION;
$this->yypopstate(); $this->yypopstate();
} }
@@ -298,7 +301,7 @@ section {
%statename TRIPPLE %statename TRIPPLE
tripple_quotes_end { tripple_quotes_end {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_QUOTES_END;
$this->yypopstate(); $this->yypopstate();
$this->yypushstate(self::START); $this->yypushstate(self::START);
} }
@@ -311,7 +314,7 @@ text {
$this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag'); $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
} }
$this->value = substr($this->data,$this->counter,$to-$this->counter); $this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_TEXT;
} }
*/ */

View File

@@ -1,4 +1,7 @@
<?php <?php
namespace Smarty\Lexer;
/* /*
* This file is part of Smarty. * This file is part of Smarty.
* *
@@ -9,14 +12,14 @@
*/ */
/** /**
* Smarty_Internal_Templatelexer * TemplateLexer
* This is the template file lexer. * This is the template file lexer.
* It is generated from the smarty_internal_templatelexer.plex file * It is generated from the TemplateLexer.plex file
* *
* *
* @author Uwe Tews <uwe.tews@googlemail.com> * @author Uwe Tews <uwe.tews@googlemail.com>
*/ */
class Smarty_Internal_Templatelexer class TemplateLexer
{ {
/** /**
* Source * Source
@@ -339,7 +342,7 @@ class Smarty_Internal_Templatelexer
/*!lex2php /*!lex2php
%statename TEXT %statename TEXT
emptyjava { emptyjava {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
comment { comment {
$to = $this->dataLength; $to = $this->dataLength;
@@ -353,14 +356,14 @@ class Smarty_Internal_Templatelexer
return false; return false;
} }
userliteral { userliteral {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
ldel literal rdel { ldel literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->token = \Smarty\Parser\TemplateParser::TP_LITERALSTART;
$this->yypushstate(self::LITERAL); $this->yypushstate(self::LITERAL);
} }
ldel slash literal rdel { ldel slash literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->token = \Smarty\Parser\TemplateParser::TP_LITERALEND;
$this->yypushstate(self::LITERAL); $this->yypushstate(self::LITERAL);
} }
ldel { ldel {
@@ -377,70 +380,70 @@ class Smarty_Internal_Templatelexer
$to = $match[0][1]; $to = $match[0][1];
} }
$this->value = substr($this->data,$this->counter,$to-$this->counter); $this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
*/ */
/*!lex2php /*!lex2php
%statename TAG %statename TAG
ldel if { ldel if {
$this->token = Smarty_Internal_Templateparser::TP_LDELIF; $this->token = \Smarty\Parser\TemplateParser::TP_LDELIF;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel for { ldel for {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR; $this->token = \Smarty\Parser\TemplateParser::TP_LDELFOR;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel foreach { ldel foreach {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; $this->token = \Smarty\Parser\TemplateParser::TP_LDELFOREACH;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel setfilter { ldel setfilter {
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; $this->token = \Smarty\Parser\TemplateParser::TP_LDELSETFILTER;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel makenocache { ldel makenocache {
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE; $this->token = \Smarty\Parser\TemplateParser::TP_LDELMAKENOCACHE;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel id nocacherdel { ldel id nocacherdel {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; $this->token = \Smarty\Parser\TemplateParser::TP_SIMPLETAG;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel smartyblockchildparent rdel { ldel smartyblockchildparent rdel {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; $this->token = \Smarty\Parser\TemplateParser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel slash id rdel { ldel slash id rdel {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->token = \Smarty\Parser\TemplateParser::TP_CLOSETAG;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel dollar id nocacherdel { ldel dollar id nocacherdel {
if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) { if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->token = \Smarty\Parser\TemplateParser::TP_SIMPELOUTPUT;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} else { } else {
$this->value = $this->smarty->getLeftDelimiter(); $this->value = $this->smarty->getLeftDelimiter();
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = \Smarty\Parser\TemplateParser::TP_LDEL;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
} }
ldel slash { ldel slash {
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->token = \Smarty\Parser\TemplateParser::TP_LDELSLASH;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
ldel { ldel {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = \Smarty\Parser\TemplateParser::TP_LDEL;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
@@ -448,7 +451,7 @@ class Smarty_Internal_Templatelexer
/*!lex2php /*!lex2php
%statename TAGBODY %statename TAGBODY
rdel { rdel {
$this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->token = \Smarty\Parser\TemplateParser::TP_RDEL;
$this->yypopstate(); $this->yypopstate();
} }
ldel { ldel {
@@ -456,143 +459,143 @@ class Smarty_Internal_Templatelexer
return true; return true;
} }
double_quote { double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = \Smarty\Parser\TemplateParser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote(); $this->compiler->enterDoubleQuote();
} }
singlequotestring { singlequotestring {
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; $this->token = \Smarty\Parser\TemplateParser::TP_SINGLEQUOTESTRING;
} }
dollar id { dollar id {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID; $this->token = \Smarty\Parser\TemplateParser::TP_DOLLARID;
} }
dollar { dollar {
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR; $this->token = \Smarty\Parser\TemplateParser::TP_DOLLAR;
} }
isin { isin {
$this->token = Smarty_Internal_Templateparser::TP_ISIN; $this->token = \Smarty\Parser\TemplateParser::TP_ISIN;
} }
as { as {
$this->token = Smarty_Internal_Templateparser::TP_AS; $this->token = \Smarty\Parser\TemplateParser::TP_AS;
} }
to { to {
$this->token = Smarty_Internal_Templateparser::TP_TO; $this->token = \Smarty\Parser\TemplateParser::TP_TO;
} }
step { step {
$this->token = Smarty_Internal_Templateparser::TP_STEP; $this->token = \Smarty\Parser\TemplateParser::TP_STEP;
} }
instanceof { instanceof {
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; $this->token = \Smarty\Parser\TemplateParser::TP_INSTANCEOF;
} }
lop { lop {
$this->token = Smarty_Internal_Templateparser::TP_LOGOP; $this->token = \Smarty\Parser\TemplateParser::TP_LOGOP;
} }
slop { slop {
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP; $this->token = \Smarty\Parser\TemplateParser::TP_SLOGOP;
} }
tlop { tlop {
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP; $this->token = \Smarty\Parser\TemplateParser::TP_TLOGOP;
} }
scond { scond {
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; $this->token = \Smarty\Parser\TemplateParser::TP_SINGLECOND;
} }
not{ not{
$this->token = Smarty_Internal_Templateparser::TP_NOT; $this->token = \Smarty\Parser\TemplateParser::TP_NOT;
} }
typecast { typecast {
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST; $this->token = \Smarty\Parser\TemplateParser::TP_TYPECAST;
} }
openP { openP {
$this->token = Smarty_Internal_Templateparser::TP_OPENP; $this->token = \Smarty\Parser\TemplateParser::TP_OPENP;
} }
closeP { closeP {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP; $this->token = \Smarty\Parser\TemplateParser::TP_CLOSEP;
} }
openB { openB {
$this->token = Smarty_Internal_Templateparser::TP_OPENB; $this->token = \Smarty\Parser\TemplateParser::TP_OPENB;
} }
closeB { closeB {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB; $this->token = \Smarty\Parser\TemplateParser::TP_CLOSEB;
} }
ptr { ptr {
$this->token = Smarty_Internal_Templateparser::TP_PTR; $this->token = \Smarty\Parser\TemplateParser::TP_PTR;
} }
aptr { aptr {
$this->token = Smarty_Internal_Templateparser::TP_APTR; $this->token = \Smarty\Parser\TemplateParser::TP_APTR;
} }
equal { equal {
$this->token = Smarty_Internal_Templateparser::TP_EQUAL; $this->token = \Smarty\Parser\TemplateParser::TP_EQUAL;
} }
incdec { incdec {
$this->token = Smarty_Internal_Templateparser::TP_INCDEC; $this->token = \Smarty\Parser\TemplateParser::TP_INCDEC;
} }
unimath { unimath {
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH; $this->token = \Smarty\Parser\TemplateParser::TP_UNIMATH;
} }
math { math {
$this->token = Smarty_Internal_Templateparser::TP_MATH; $this->token = \Smarty\Parser\TemplateParser::TP_MATH;
} }
at { at {
$this->token = Smarty_Internal_Templateparser::TP_AT; $this->token = \Smarty\Parser\TemplateParser::TP_AT;
} }
array openP { array openP {
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN; $this->token = \Smarty\Parser\TemplateParser::TP_ARRAYOPEN;
} }
hatch { hatch {
$this->token = Smarty_Internal_Templateparser::TP_HATCH; $this->token = \Smarty\Parser\TemplateParser::TP_HATCH;
} }
attr { attr {
// resolve conflicts with shorttag and right_delimiter starting with '=' // resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) { if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) {
preg_match('/\s+/',$this->value,$match); preg_match('/\s+/',$this->value,$match);
$this->value = $match[0]; $this->value = $match[0];
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = \Smarty\Parser\TemplateParser::TP_SPACE;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_ATTR; $this->token = \Smarty\Parser\TemplateParser::TP_ATTR;
} }
} }
namespace { namespace {
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; $this->token = \Smarty\Parser\TemplateParser::TP_NAMESPACE;
} }
id { id {
$this->token = Smarty_Internal_Templateparser::TP_ID; $this->token = \Smarty\Parser\TemplateParser::TP_ID;
} }
integer { integer {
$this->token = Smarty_Internal_Templateparser::TP_INTEGER; $this->token = \Smarty\Parser\TemplateParser::TP_INTEGER;
} }
backtick { backtick {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = \Smarty\Parser\TemplateParser::TP_BACKTICK;
$this->yypopstate(); $this->yypopstate();
} }
vert { vert {
$this->token = Smarty_Internal_Templateparser::TP_VERT; $this->token = \Smarty\Parser\TemplateParser::TP_VERT;
} }
dot { dot {
$this->token = Smarty_Internal_Templateparser::TP_DOT; $this->token = \Smarty\Parser\TemplateParser::TP_DOT;
} }
comma { comma {
$this->token = Smarty_Internal_Templateparser::TP_COMMA; $this->token = \Smarty\Parser\TemplateParser::TP_COMMA;
} }
semicolon { semicolon {
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; $this->token = \Smarty\Parser\TemplateParser::TP_SEMICOLON;
} }
doublecolon { doublecolon {
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; $this->token = \Smarty\Parser\TemplateParser::TP_DOUBLECOLON;
} }
colon { colon {
$this->token = Smarty_Internal_Templateparser::TP_COLON; $this->token = \Smarty\Parser\TemplateParser::TP_COLON;
} }
qmark { qmark {
$this->token = Smarty_Internal_Templateparser::TP_QMARK; $this->token = \Smarty\Parser\TemplateParser::TP_QMARK;
} }
hex { hex {
$this->token = Smarty_Internal_Templateparser::TP_HEX; $this->token = \Smarty\Parser\TemplateParser::TP_HEX;
} }
space { space {
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = \Smarty\Parser\TemplateParser::TP_SPACE;
} }
char { char {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
*/ */
@@ -600,14 +603,14 @@ class Smarty_Internal_Templatelexer
%statename LITERAL %statename LITERAL
ldel literal rdel { ldel literal rdel {
$this->literal_cnt++; $this->literal_cnt++;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL;
} }
ldel slash literal rdel { ldel slash literal rdel {
if ($this->literal_cnt) { if ($this->literal_cnt) {
$this->literal_cnt--; $this->literal_cnt--;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->token = \Smarty\Parser\TemplateParser::TP_LITERALEND;
$this->yypopstate(); $this->yypopstate();
} }
} }
@@ -623,19 +626,19 @@ class Smarty_Internal_Templatelexer
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag"); $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
} }
$this->value = substr($this->data,$this->counter,$to-$this->counter); $this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL;
} }
*/ */
/*!lex2php /*!lex2php
%statename DOUBLEQUOTEDSTRING %statename DOUBLEQUOTEDSTRING
userliteral { userliteral {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
ldel literal rdel { ldel literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
ldel slash literal rdel { ldel slash literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
ldel slash { ldel slash {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
@@ -646,33 +649,33 @@ class Smarty_Internal_Templatelexer
return true; return true;
} }
ldel { ldel {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = \Smarty\Parser\TemplateParser::TP_LDEL;
$this->taglineno = $this->line; $this->taglineno = $this->line;
$this->yypushstate(self::TAGBODY); $this->yypushstate(self::TAGBODY);
} }
double_quote { double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = \Smarty\Parser\TemplateParser::TP_QUOTE;
$this->yypopstate(); $this->yypopstate();
} }
backtick dollar { backtick dollar {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = \Smarty\Parser\TemplateParser::TP_BACKTICK;
$this->value = substr($this->value,0,-1); $this->value = substr($this->value,0,-1);
$this->yypushstate(self::TAGBODY); $this->yypushstate(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
dollar id { dollar id {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID; $this->token = \Smarty\Parser\TemplateParser::TP_DOLLARID;
} }
dollar { dollar {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
textdoublequoted { textdoublequoted {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
char { char {
$to = $this->dataLength; $to = $this->dataLength;
$this->value = substr($this->data,$this->counter,$to-$this->counter); $this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
} }
*/ */
} }

View File

@@ -36,11 +36,11 @@ abstract class Base
/** /**
* Return buffer * Return buffer
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string buffer content * @return string buffer content
*/ */
abstract public function to_smarty_php(\Smarty_Internal_Templateparser $parser); abstract public function to_smarty_php(\Smarty\Parser\TemplateParser $parser);
/** /**
* Template data object destructor * Template data object destructor

View File

@@ -34,11 +34,11 @@ class Code extends Base
/** /**
* Return buffer content in parentheses * Return buffer content in parentheses
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string content * @return string content
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
return sprintf('(%s)', $this->data); return sprintf('(%s)', $this->data);
} }

View File

@@ -35,10 +35,10 @@ class Dq extends Base
/** /**
* Append buffer to subtree * Append buffer to subtree
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* @param Base $subtree parse tree buffer * @param Base $subtree parse tree buffer
*/ */
public function append_subtree(\Smarty_Internal_Templateparser $parser, Base $subtree) public function append_subtree(\Smarty\Parser\TemplateParser $parser, Base $subtree)
{ {
$last_subtree = count($this->subtrees) - 1; $last_subtree = count($this->subtrees) - 1;
if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Tag if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Tag
@@ -71,11 +71,11 @@ class Dq extends Base
/** /**
* Merge subtree buffer content together * Merge subtree buffer content together
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string compiled template code * @return string compiled template code
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
$code = ''; $code = '';
foreach ($this->subtrees as $subtree) { foreach ($this->subtrees as $subtree) {

View File

@@ -33,11 +33,11 @@ class DqContent extends Base
/** /**
* Return content as double-quoted string * Return content as double-quoted string
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string doubled quoted string * @return string doubled quoted string
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
return '"' . $this->data . '"'; return '"' . $this->data . '"';
} }

View File

@@ -31,10 +31,10 @@ class Tag extends Base
/** /**
* Create parse tree buffer for Smarty tag * Create parse tree buffer for Smarty tag
* *
* @param \Smarty_Internal_Templateparser $parser parser object * @param \Smarty\Parser\TemplateParser $parser parser object
* @param string $data content * @param string $data content
*/ */
public function __construct(\Smarty_Internal_Templateparser $parser, $data) public function __construct(\Smarty\Parser\TemplateParser $parser, $data)
{ {
$this->data = $data; $this->data = $data;
$this->saved_block_nesting = $parser->block_nesting_level; $this->saved_block_nesting = $parser->block_nesting_level;
@@ -43,11 +43,11 @@ class Tag extends Base
/** /**
* Return buffer content * Return buffer content
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string content * @return string content
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
return $this->data; return $this->data;
} }
@@ -55,11 +55,11 @@ class Tag extends Base
/** /**
* Return complied code that loads the evaluated output of buffer content into a temporary variable * Return complied code that loads the evaluated output of buffer content into a temporary variable
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string template code * @return string template code
*/ */
public function assign_to_var(\Smarty_Internal_Templateparser $parser) public function assign_to_var(\Smarty\Parser\TemplateParser $parser)
{ {
$var = $parser->compiler->getNewPrefixVariable(); $var = $parser->compiler->getNewPrefixVariable();
$tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data); $tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data);

View File

@@ -38,10 +38,10 @@ class Template extends Base
/** /**
* Append buffer to subtree * Append buffer to subtree
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* @param Base $subtree * @param Base $subtree
*/ */
public function append_subtree(\Smarty_Internal_Templateparser $parser, Base $subtree) public function append_subtree(\Smarty\Parser\TemplateParser $parser, Base $subtree)
{ {
if (!empty($subtree->subtrees)) { if (!empty($subtree->subtrees)) {
$this->subtrees = array_merge($this->subtrees, $subtree->subtrees); $this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
@@ -55,10 +55,10 @@ class Template extends Base
/** /**
* Append array to subtree * Append array to subtree
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* @param Base[] $array * @param Base[] $array
*/ */
public function append_array(\Smarty_Internal_Templateparser $parser, $array = array()) public function append_array(\Smarty\Parser\TemplateParser $parser, $array = array())
{ {
if (!empty($array)) { if (!empty($array)) {
$this->subtrees = array_merge($this->subtrees, (array)$array); $this->subtrees = array_merge($this->subtrees, (array)$array);
@@ -68,10 +68,10 @@ class Template extends Base
/** /**
* Prepend array to subtree * Prepend array to subtree
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* @param Base[] $array * @param Base[] $array
*/ */
public function prepend_array(\Smarty_Internal_Templateparser $parser, $array = array()) public function prepend_array(\Smarty\Parser\TemplateParser $parser, $array = array())
{ {
if (!empty($array)) { if (!empty($array)) {
$this->subtrees = array_merge((array)$array, $this->subtrees); $this->subtrees = array_merge((array)$array, $this->subtrees);
@@ -81,11 +81,11 @@ class Template extends Base
/** /**
* Sanitize and merge subtree buffers together * Sanitize and merge subtree buffers together
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string template code content * @return string template code content
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
$code = ''; $code = '';

View File

@@ -48,11 +48,11 @@ class Text extends Base
/** /**
* Return buffer content * Return buffer content
* *
* @param \Smarty_Internal_Templateparser $parser * @param \Smarty\Parser\TemplateParser $parser
* *
* @return string text * @return string text
*/ */
public function to_smarty_php(\Smarty_Internal_Templateparser $parser) public function to_smarty_php(\Smarty\Parser\TemplateParser $parser)
{ {
return $this->data; return $this->data;
} }

View File

@@ -4,7 +4,7 @@ namespace Smarty\Parser;
use \Smarty\Lexer\Configfile as Lexer; use \Smarty\Lexer\Configfile as Lexer;
/** /**
* Smarty Internal Plugin Configfileparser * ConfigfileParser
* *
* This is the config file parser * This is the config file parser
* *
@@ -19,12 +19,12 @@ use \Smarty\Lexer\Configfile as Lexer;
* Smarty Internal Plugin Configfileparse * Smarty Internal Plugin Configfileparse
* *
* This is the config file parser. * This is the config file parser.
* It is generated from the smarty_internal_configfileparser.y file * It is generated from the ConfigfileParser.y file
* @package Smarty * @package Smarty
* @subpackage Compiler * @subpackage Compiler
* @author Uwe Tews * @author Uwe Tews
*/ */
class Configfile class ConfigfileParser
} }
%include_class %include_class
{ {
@@ -59,7 +59,7 @@ class Configfile
/** /**
* compiler object * compiler object
* *
* @var Smarty\Compiler\ConfigFile * @var \Smarty\Compiler\ConfigFile
*/ */
public $compiler = null; public $compiler = null;
/** /**
@@ -92,9 +92,9 @@ class Configfile
* constructor * constructor
* *
* @param Lexer $lex * @param Lexer $lex
* @param Smarty\Compiler\ConfigFile $compiler * @param \Smarty\Compiler\ConfigFile $compiler
*/ */
public function __construct(Lexer $lex, Smarty\Compiler\ConfigFile $compiler) public function __construct(Lexer $lex, \Smarty\Compiler\ConfigFile $compiler)
{ {
$this->lex = $lex; $this->lex = $lex;
$this->smarty = $compiler->smarty; $this->smarty = $compiler->smarty;

View File

@@ -1,3 +1,8 @@
namespace Smarty\Parser;
use \Smarty\Lexer\Configfile as Lexer;
/* /*
* This file is part of Smarty. * This file is part of Smarty.
* *
@@ -13,11 +18,11 @@
* Smarty Template Parser Class * Smarty Template Parser Class
* *
* This is the template parser. * This is the template parser.
* It is generated from the smarty_internal_templateparser.y file * It is generated from the TemplateParser.y file
* *
* @author Uwe Tews <uwe.tews@googlemail.com> * @author Uwe Tews <uwe.tews@googlemail.com>
*/ */
class Smarty_Internal_Templateparser class TemplateParser
} }
%include_class %include_class
{ {
@@ -74,7 +79,7 @@ class Smarty_Internal_Templateparser
/** /**
* lexer object * lexer object
* *
* @var Smarty_Internal_Templatelexer * @var Lexer
*/ */
public $lex; public $lex;
@@ -101,14 +106,14 @@ class Smarty_Internal_Templateparser
/** /**
* smarty object * smarty object
* *
* @var Smarty * @var \Smarty\Smarty
*/ */
public $smarty = null; public $smarty = null;
/** /**
* template object * template object
* *
* @var Smarty_Internal_Template * @var \Smarty\Template
*/ */
public $template = null; public $template = null;
@@ -122,7 +127,7 @@ class Smarty_Internal_Templateparser
/** /**
* security object * security object
* *
* @var Smarty_Security * @var \Smarty\Security
*/ */
public $security = null; public $security = null;
@@ -143,10 +148,10 @@ class Smarty_Internal_Templateparser
/** /**
* constructor * constructor
* *
* @param Smarty_Internal_Templatelexer $lex * @param Lexer $lex
* @param \Smarty\Compiler\Template $compiler * @param \Smarty\Compiler\Template $compiler
*/ */
public function __construct(Smarty_Internal_Templatelexer $lex, \Smarty\Compiler\Template $compiler) public function __construct(Lexer $lex, \Smarty\Compiler\Template $compiler)
{ {
$this->lex = $lex; $this->lex = $lex;
$this->compiler = $compiler; $this->compiler = $compiler;

View File

@@ -17,9 +17,9 @@ namespace Smarty\Resource;
* @package Smarty * @package Smarty
* @subpackage TemplateResources * @subpackage TemplateResources
* *
* @method renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template) * @method renderUncompiled(\Smarty\Template\Source $source, \Smarty\Template $_template)
* @method populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) * @method populateCompiledFilepath(\Smarty\Template\Compiled $compiled, \Smarty\Template $_template)
* @method process(Smarty_Internal_Template $_smarty_tpl) * @method process(\Smarty\Template $_smarty_tpl)
*/ */
abstract class BasePlugin abstract class BasePlugin
{ {

View File

@@ -8,12 +8,12 @@
*/ */
/** /**
* FIXME: Smarty_Security API * FIXME: \Smarty\Security API
* - getter and setter instead of public properties would allow cultivating an internal cache properly * - getter and setter instead of public properties would allow cultivating an internal cache properly
* - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir * - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir
* are immutable the cache is killed every time either of the variables change. That means that two distinct * are immutable the cache is killed every time either of the variables change. That means that two distinct
* Smarty objects with differing * Smarty objects with differing
* $template_dir or $config_dir should NOT share the same Smarty_Security instance, * $template_dir or $config_dir should NOT share the same \Smarty\Security instance,
* as this would lead to (severe) performance penalty! how should this be handled? * as this would lead to (severe) performance penalty! how should this be handled?
*/ */
@@ -618,7 +618,7 @@ class Security {
$smarty->security_policy = $security_class; $smarty->security_policy = $security_class;
return $smarty; return $smarty;
} elseif (is_object($security_class)) { } elseif (is_object($security_class)) {
throw new Exception("Class '" . get_class($security_class) . "' must extend Smarty_Security."); throw new Exception("Class '" . get_class($security_class) . "' must extend \\Smarty\\Security.");
} }
if ($security_class === null) { if ($security_class === null) {
$security_class = $smarty->security_class; $security_class = $smarty->security_class;

View File

@@ -271,7 +271,7 @@ class Smarty extends \Smarty\TemplateBase
/** /**
* class name * class name
* This should be instance of \Smarty_Security. * This should be instance of \Smarty\Security.
* *
* @var string * @var string
* @see \Smarty\Security * @see \Smarty\Security
@@ -1476,7 +1476,7 @@ class Smarty extends \Smarty\TemplateBase
$_tpl = new $this->template_class($_file, $_smarty); $_tpl = new $this->template_class($_file, $_smarty);
$_tpl->caching = self::CACHING_OFF; $_tpl->caching = self::CACHING_OFF;
$_tpl->source = $_tpl->source =
$isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl); $isConfig ? \Smarty\Template\Config::load($_tpl) : \Smarty\Template\Source::load($_tpl);
if ($_tpl->mustCompile()) { if ($_tpl->mustCompile()) {
$_tpl->compileTemplateSource(); $_tpl->compileTemplateSource();
$_count++; $_count++;
@@ -1563,9 +1563,6 @@ class Smarty extends \Smarty\TemplateBase
/** /**
* Run filters over content * Run filters over content
* The filters will be lazy loaded if required * The filters will be lazy loaded if required
* class name format: Smarty_FilterType_FilterName
* plugin filename format: filtertype.filtername.php
* Smarty2 filter plugins could be used
* *
* @param string $type the type of filter ('pre','post','output') which shall run * @param string $type the type of filter ('pre','post','output') which shall run
* @param string $content the content which shall be processed by the filters * @param string $content the content which shall be processed by the filters

View File

@@ -10,13 +10,12 @@
namespace Smarty; namespace Smarty;
use Smarty; use Smarty\Smarty;
use Smarty\Runtime\InheritanceRuntime; use Smarty\Runtime\InheritanceRuntime;
use Smarty\Template\Source; use Smarty\Template\Source;
use Smarty\Template\Cached; use Smarty\Template\Cached;
use Smarty\Template\Compiled; use Smarty\Template\Compiled;
use Smarty\Template\Config; use Smarty\Template\Config;
use Smarty\Exception;
/** /**
* Main class with template data structures and methods * Main class with template data structures and methods
@@ -133,14 +132,11 @@ class Template extends TemplateBase {
* *
* @param string $template_resource template resource string * @param string $template_resource template resource string
* @param Smarty $smarty Smarty instance * @param Smarty $smarty Smarty instance
* @param null|\Smarty_Internal_Template|\Smarty|\Smarty\Data $_parent back pointer to parent * @param \Smarty\Data|null $_parent back pointer to parent object with variables or null
* object with variables or
* null
* @param mixed $_cache_id cache id or null * @param mixed $_cache_id cache id or null
* @param mixed $_compile_id compile id or null * @param mixed $_compile_id compile id or null
* @param bool|int|null $_caching use caching? * @param bool|int|null $_caching use caching?
* @param int|null $_cache_lifetime cache life-time in * @param int|null $_cache_lifetime cache life-time in seconds
* seconds
* @param bool $_isConfig * @param bool $_isConfig
* *
* @throws \Smarty\Exception * @throws \Smarty\Exception
@@ -439,7 +435,7 @@ class Template extends TemplateBase {
* - Decode saved properties from compiled template and cache files * - Decode saved properties from compiled template and cache files
* - Check if compiled or cache file is valid * - Check if compiled or cache file is valid
* *
* @param \Smarty_Internal_Template $tpl * @param \Smarty\Template $tpl
* @param array $properties special template properties * @param array $properties special template properties
* @param bool $cache flag if called from cache file * @param bool $cache flag if called from cache file
* *
@@ -709,7 +705,6 @@ class Template extends TemplateBase {
/** /**
* load config variables into template object * load config variables into template object
* *
* @param \Smarty_Internal_Template $tpl
* @param array $new_config_vars * @param array $new_config_vars
*/ */
public function _loadConfigVars($new_config_vars) { public function _loadConfigVars($new_config_vars) {
@@ -727,7 +722,7 @@ class Template extends TemplateBase {
$mergedScope = $tagScope | $this->scope; $mergedScope = $tagScope | $this->scope;
if ($mergedScope) { if ($mergedScope) {
// update scopes // update scopes
/* @var \Smarty_Internal_Template|\Smarty|Data $ptr */ /* @var \Smarty\Data $ptr */
foreach ($this->parent->_getAffectedScopes($mergedScope) as $ptr) { foreach ($this->parent->_getAffectedScopes($mergedScope) as $ptr) {
$this->_assignConfigVars($ptr->config_vars, $new_config_vars); $this->_assignConfigVars($ptr->config_vars, $new_config_vars);
if ($tagScope && $ptr->_isTplObj() && isset($this->_var_stack)) { if ($tagScope && $ptr->_isTplObj() && isset($this->_var_stack)) {
@@ -897,7 +892,7 @@ class Template extends TemplateBase {
/** /**
* Update variable in template local variable stack * Update variable in template local variable stack
* *
* @param \Smarty_Internal_Template $tpl * @param Template $tpl
* @param string|null $varName variable name or null for config variables * @param string|null $varName variable name or null for config variables
*/ */
private function _updateVarStack(Template $tpl, $varName) { private function _updateVarStack(Template $tpl, $varName) {

View File

@@ -40,21 +40,21 @@ class Config extends Source {
* *
* @var string * @var string
*/ */
public $compiler_class = 'Smarty\Compiler\ConfigFile'; public $compiler_class = \Smarty\Compiler\ConfigFile::class;
/** /**
* Name of the Class to tokenize this resource's contents with * Name of the Class to tokenize this resource's contents with
* *
* @var string * @var string
*/ */
public $template_lexer_class = 'Smarty_Internal_Configfilelexer'; public $template_lexer_class = \Smarty\Lexer\ConfigfileLexer::class;
/** /**
* Name of the Class to parse this resource's contents with * Name of the Class to parse this resource's contents with
* *
* @var string * @var string
*/ */
public $template_parser_class = 'Smarty_Internal_Configfileparser'; public $template_parser_class = \Smarty\Parser\ConfigfileParser::class;
/** /**
* initialize Source Object for given resource * initialize Source Object for given resource

View File

@@ -24,7 +24,7 @@ class Source {
public $uid = null; public $uid = null;
/** /**
* Template Resource (Smarty_Internal_Template::$template_resource) * Template Resource (\Smarty\Template::$template_resource)
* *
* @var string * @var string
*/ */
@@ -75,7 +75,7 @@ class Source {
/** /**
* The Components an extended template is made of * The Components an extended template is made of
* *
* @var \Smarty_Template_Source[] * @var \Smarty\Template\Source[]
*/ */
public $components = null; public $components = null;
@@ -112,21 +112,21 @@ class Source {
* *
* @var string * @var string
*/ */
public $compiler_class = 'Smarty\Compiler\Template'; public $compiler_class = \Smarty\Compiler\Template::class;
/** /**
* Name of the Class to tokenize this resource's contents with * Name of the Class to tokenize this resource's contents with
* *
* @var string * @var string
*/ */
public $template_lexer_class = 'Smarty_Internal_Templatelexer'; public $template_lexer_class = \Smarty\Lexer\TemplateLexer::class;
/** /**
* Name of the Class to parse this resource's contents with * Name of the Class to parse this resource's contents with
* *
* @var string * @var string
*/ */
public $template_parser_class = 'Smarty_Internal_Templateparser'; public $template_parser_class = \Smarty\Parser\TemplateParser::class;
/** /**
* create Source Object container * create Source Object container

View File

@@ -25,7 +25,7 @@ class LoadPluginTest extends PHPUnit_Smarty
*/ */
public function testLoadPluginErrorReturn() public function testLoadPluginErrorReturn()
{ {
$this->assertFalse($this->smarty->loadPlugin('Smarty_Not_Known')); $this->assertFalse($this->smarty->loadPlugin('\\Smarty\\Not\\Known'));
} }
/** /**
@@ -33,7 +33,7 @@ class LoadPluginTest extends PHPUnit_Smarty
*/ */
public function testLoadPluginSmartyInternalDebug() public function testLoadPluginSmartyInternalDebug()
{ {
$this->assertTrue($this->smarty->loadPlugin('\Smarty\Debug') == true); $this->assertTrue($this->smarty->loadPlugin(\Smarty\Debug::class) == true);
} }
/** /**
@@ -49,6 +49,6 @@ class LoadPluginTest extends PHPUnit_Smarty
*/ */
public function testLoadPluginSmartyPluginCounter() public function testLoadPluginSmartyPluginCounter()
{ {
$this->assertTrue($this->smarty->loadPlugin('Smarty_Function_Counter') == true); $this->assertTrue($this->smarty->loadPlugin('smarty_function_counter') == true);
} }
} }

View File

@@ -1,11 +1,12 @@
<?php <?php
use Smarty\Smarty;
use Smarty\Template; use Smarty\Template;
use Smarty\Template\Cached; use Smarty\Template\Cached;
require_once SMARTY_DIR . '../demo/plugins/cacheresource.apc.php'; require_once SMARTY_DIR . '../demo/plugins/cacheresource.apc.php';
class Smarty_CacheResource_Apctest extends Smarty_CacheResource_Apc class Smarty_CacheResource_Apctest extends My_CacheResource_Apc
{ {
public $lockTime = 0; public $lockTime = 0;