mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-18 06:55:20 +02:00
Entire src dir now PSR-4 compatible
This commit is contained in:
@@ -40,7 +40,7 @@ some other Smarty-provided functionality, it can use the supplied
|
||||
* 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',
|
||||
'No',
|
||||
@@ -71,7 +71,7 @@ which can be used in the template as:
|
||||
* 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'])) {
|
||||
trigger_error("assign: missing 'var' parameter");
|
||||
|
@@ -35,7 +35,7 @@ substituted in place of the `{insert}` tag in the template.
|
||||
* 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'])) {
|
||||
trigger_error("insert time: missing 'format' parameter");
|
||||
|
@@ -35,7 +35,7 @@ and return the results.
|
||||
* 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}))!',
|
||||
'$1%40$2', $output);
|
||||
|
@@ -57,7 +57,7 @@ of this code.
|
||||
* 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);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ of this code.
|
||||
* 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;
|
||||
return $compiled;
|
||||
|
@@ -12,7 +12,7 @@ will be able to access that resource by prepending its name to the
|
||||
template you\'re addressing: `foobarxyz:yourtemplate.tpl`.
|
||||
|
||||
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
|
||||
`renderUncompiled(\Smarty\Template $_template)`. `$_template` is
|
||||
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.
|
||||
|
||||
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
|
||||
overhead. See `src/Resource/StringEval.php` for an
|
||||
example.
|
||||
@@ -51,7 +51,7 @@ example.
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
|
||||
class My_Resource_Mysql extends \Smarty\Resource\CustomPlugin {
|
||||
// PDO instance
|
||||
protected $db;
|
||||
// prepared fetch() statement
|
||||
@@ -109,7 +109,7 @@ example.
|
||||
|
||||
require_once 'libs/Smarty.class.php';
|
||||
$smarty = new Smarty();
|
||||
$smarty->registerResource('mysql', new Smarty_Resource_Mysql());
|
||||
$smarty->registerResource('mysql', new My_Resource_Mysql());
|
||||
|
||||
// using resource from php script
|
||||
$smarty->display("mysql:index.tpl");
|
||||
|
Reference in New Issue
Block a user