diff --git a/3.1.16_RELEASE_NOTES.txt b/INHERITANCE_RELEASE_NOTES.txt
similarity index 100%
rename from 3.1.16_RELEASE_NOTES.txt
rename to INHERITANCE_RELEASE_NOTES.txt
diff --git a/change_log.txt b/change_log.txt
index fc3205e3..253c3133 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,12 +1,31 @@
- ===== 3.1.19-dev ===== (xx.xx.2014)
+ ===== 3.1.20-dev ===== (xx.xx.2014)
+ ===== 3.1.19 ===== (30.06.2014)
+ 20.06.2014
+ - bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131)
+
+ 17.06.2014
+ - bugfix large template text of some charsets could cause parsing errors (topic 24630)
+
+ 08.06.2014
+ - bugfix registered objects did not work after spelling fixes of 06.06.2014
+ - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024)
+ - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192)
+ - bugfix {html_image} security check did fail on files relative to basedir (Issue 191)
+
+ 06.06.2014
+ - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result
+ - fixed spelling, PHPDoc , minor errors, code cleanup
+
+ 02.06.2014
+ - using multiple cwd with relative template dirs could result in identical compiled file names. (issue 194 and topic 25099)
+
19.04.2014
- bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)
- bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified
18.04.2014
- - revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems
-
+ - revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems
===== 3.1.18 ===== (07.04.2014)
06.04.2014
diff --git a/demo/index.php b/demo/index.php
index b7d988f5..33f3035c 100644
--- a/demo/index.php
+++ b/demo/index.php
@@ -1,7 +1,7 @@
debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
-$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true);
-$smarty->assign("FirstName",array("John","Mary","James","Henry"));
-$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
-$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
- array("I", "J", "K", "L"), array("M", "N", "O", "P")));
+$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
+$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
+$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
+$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"),
+ array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
- array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+ array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
-$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
-$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
+$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
+$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
diff --git a/demo/plugins/cacheresource.apc.php b/demo/plugins/cacheresource.apc.php
index 9854f638..d7336f2b 100644
--- a/demo/plugins/cacheresource.apc.php
+++ b/demo/plugins/cacheresource.apc.php
@@ -2,12 +2,12 @@
/**
* APC CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
* *
+ *
* @package CacheResource-examples
- * @author Uwe Tews
+ * @author Uwe Tews
*/
class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
{
@@ -22,7 +22,8 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
+ * @param array $keys list of keys to fetch
+ *
* @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
@@ -40,11 +41,12 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
apc_store($k, $v, $expire);
@@ -56,7 +58,8 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
diff --git a/demo/plugins/cacheresource.memcache.php b/demo/plugins/cacheresource.memcache.php
index f38b00ac..e265365f 100644
--- a/demo/plugins/cacheresource.memcache.php
+++ b/demo/plugins/cacheresource.memcache.php
@@ -2,20 +2,19 @@
/**
* Memcache CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
- *
* Note that memcache has a limitation of 256 characters per cache-key.
* To avoid complications all cache-keys are translated to a sha1 hash.
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
{
/**
* memcache instance
+ *
* @var Memcache
*/
protected $memcache = null;
@@ -23,13 +22,14 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
public function __construct()
{
$this->memcache = new Memcache();
- $this->memcache->addServer( '127.0.0.1', 11211 );
+ $this->memcache->addServer('127.0.0.1', 11211);
}
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
+ * @param array $keys list of keys to fetch
+ *
* @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
@@ -53,11 +53,12 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
$k = sha1($k);
@@ -70,7 +71,8 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
@@ -90,6 +92,6 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
*/
protected function purge()
{
- return $this->memcache->flush();
+ $this->memcache->flush();
}
}
diff --git a/demo/plugins/cacheresource.mysql.php b/demo/plugins/cacheresource.mysql.php
index 73771e7b..d8d00ab2 100644
--- a/demo/plugins/cacheresource.mysql.php
+++ b/demo/plugins/cacheresource.mysql.php
@@ -2,10 +2,8 @@
/**
* MySQL CacheResource
- *
* CacheResource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's output caching.
- *
* Table definition:
*
CREATE TABLE IF NOT EXISTS `output_cache` (
* `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
@@ -22,7 +20,7 @@
* ) ENGINE = InnoDB;
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
{
@@ -36,7 +34,8 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
- } catch (PDOException $e) {
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
@@ -54,6 +53,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
* @param string $compile_id compile id
* @param string $content cached content
* @param integer $mtime cache modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime)
@@ -74,10 +74,12 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
* Fetch cached content's modification timestamp from data source
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content.
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
+ *
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ *
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
@@ -98,17 +100,18 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
* @param string $compile_id compile id
* @param integer|null $exp_time seconds till expiration time in seconds or null
* @param string $content content to cache
+ *
* @return boolean success
*/
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
{
$this->save->execute(array(
- 'id' => $id,
- 'name' => $name,
- 'cache_id' => $cache_id,
- 'compile_id' => $compile_id,
- 'content' => $content,
- ));
+ 'id' => $id,
+ 'name' => $name,
+ 'cache_id' => $cache_id,
+ 'compile_id' => $compile_id,
+ 'content' => $content,
+ ));
return !!$this->save->rowCount();
}
@@ -120,6 +123,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
* @param string $cache_id cache id
* @param string $compile_id compile id
* @param integer|null $exp_time seconds till expiration or null
+ *
* @return integer number of deleted caches
*/
protected function delete($name, $cache_id, $compile_id, $exp_time)
@@ -129,7 +133,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
// returning the number of deleted caches would require a second query to count them
$query = $this->db->query('TRUNCATE TABLE output_cache');
- return -1;
+ return - 1;
}
// build the filter
$where = array();
@@ -147,8 +151,8 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
}
// equal test cache_id and match sub-groups
if ($cache_id !== null) {
- $where[] = '(cache_id = '. $this->db->quote($cache_id)
- . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')';
+ $where[] = '(cache_id = ' . $this->db->quote($cache_id)
+ . ' OR cache_id LIKE ' . $this->db->quote($cache_id . '|%') . ')';
}
// run delete query
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
diff --git a/demo/plugins/resource.extendsall.php b/demo/plugins/resource.extendsall.php
index 586e6c8c..500b3c86 100644
--- a/demo/plugins/resource.extendsall.php
+++ b/demo/plugins/resource.extendsall.php
@@ -2,12 +2,11 @@
/**
* Extends All Resource
- *
* Resource Implementation modifying the extends-Resource to walk
* through the template_dirs and inherit all templates of the same name
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
{
@@ -16,22 +15,25 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$uid = '';
$sources = array();
$exists = true;
foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
try {
- $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name );
+ $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name);
if (!$s->exists) {
continue;
}
$sources[$s->uid] = $s;
$uid .= $s->filepath;
- } catch (SmartyException $e) {}
+ }
+ catch (SmartyException $e) {
+ }
}
if (!$sources) {
diff --git a/demo/plugins/resource.mysql.php b/demo/plugins/resource.mysql.php
index af78394c..dfc9606b 100644
--- a/demo/plugins/resource.mysql.php
+++ b/demo/plugins/resource.mysql.php
@@ -2,10 +2,8 @@
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Table definition:
* CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
@@ -13,12 +11,11 @@
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- *
* Demo data:
* INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
class Smarty_Resource_Mysql extends Smarty_Resource_Custom
{
@@ -33,7 +30,8 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
- } catch (PDOException $e) {
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
@@ -46,6 +44,7 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
@@ -66,7 +65,9 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom
* Fetch a template's modification time from database
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
- * @param string $name template name
+ *
+ * @param string $name template name
+ *
* @return integer timestamp (epoch) the template was modified
*/
protected function fetchTimestamp($name)
diff --git a/demo/plugins/resource.mysqls.php b/demo/plugins/resource.mysqls.php
index d16ad4b5..f694ddf1 100644
--- a/demo/plugins/resource.mysqls.php
+++ b/demo/plugins/resource.mysqls.php
@@ -2,13 +2,10 @@
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Note that this MySQL implementation fetches the source and timestamps in
* a single database query, instead of two separate like resource.mysql.php does.
- *
* Table definition:
* CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
@@ -16,12 +13,11 @@
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- *
* Demo data:
* INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
{
@@ -34,7 +30,8 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
- } catch (PDOException $e) {
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
@@ -46,6 +43,7 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
diff --git a/demo/templates/header.tpl b/demo/templates/header.tpl
index 783210a1..13fa6cb5 100644
--- a/demo/templates/header.tpl
+++ b/demo/templates/header.tpl
@@ -1,5 +1,5 @@
-{$title} - {$Name}
+ {$title} - {$Name}
diff --git a/demo/templates/index.tpl b/demo/templates/index.tpl
index 38d23341..1fbb6d37 100644
--- a/demo/templates/index.tpl
+++ b/demo/templates/index.tpl
@@ -4,18 +4,18 @@
{* bold and title are read from the config file *}
-{if #bold#}{/if}
-{* capitalize the first letters of each word of the title *}
-Title: {#title#|capitalize}
-{if #bold#} {/if}
+ {if #bold#}{/if}
+ {* capitalize the first letters of each word of the title *}
+ Title: {#title#|capitalize}
+ {if #bold#} {/if}
-The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
+ The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
-The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
+ The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
-Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
+ Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
-The value of {ldelim}$Name{rdelim} is {$Name}
+ The value of {ldelim}$Name{rdelim} is {$Name}
variable modifier example of {ldelim}$Name|upper{rdelim}
@@ -24,59 +24,64 @@ variable modifier example of {ldelim}$Name|upper{rdelim}
An example of a section loop:
-{section name=outer
-loop=$FirstName}
-{if $smarty.section.outer.index is odd by 2}
- {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
-{else}
- {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
-{/if}
-{sectionelse}
- none
-{/section}
+ {section name=outer
+ loop=$FirstName}
+ {if $smarty.section.outer.index is odd by 2}
+ {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
+ {else}
+ {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
+ {/if}
+ {sectionelse}
+ none
+ {/section}
-An example of section looped key values:
+ An example of section looped key values:
-{section name=sec1 loop=$contacts}
- phone: {$contacts[sec1].phone}
- fax: {$contacts[sec1].fax}
- cell: {$contacts[sec1].cell}
-{/section}
-
+ {section name=sec1 loop=$contacts}
+ phone: {$contacts[sec1].phone}
+
-testing strip tags
-{strip}
+ fax: {$contacts[sec1].fax}
+
+
+ cell: {$contacts[sec1].cell}
+
+ {/section}
+
+
+ testing strip tags
+ {strip}
-{/strip}
+ {/strip}
This is an example of the html_select_date function:
This is an example of the html_select_time function:
This is an example of the html_options function:
{include file="footer.tpl"}
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index e320a6b7..ea5b9cea 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -3,32 +3,28 @@
* Project: Smarty: the PHP compiling template engine
* File: Smarty.class.php
* SVN: $Id$
- *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
- * @link http://www.smarty.net/
+ * @link http://www.smarty.net/
* @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt
- * @author Uwe Tews
- * @author Rodney Rehm
- * @package Smarty
- * @version 3.1-DEV
+ * @author Monte Ohrt
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ * @package Smarty
+ * @version 3.1-DEV
*/
/**
@@ -92,16 +88,17 @@ if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR
/**
* Load always needed external class files
*/
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_data.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_templatebase.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_template.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_resource.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_resource_file.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_cacheresource.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_cacheresource_file.php';
/**
* This is the main Smarty class
+ *
* @package Smarty
*/
class Smarty extends Smarty_Internal_TemplateBase
@@ -131,7 +128,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* define constant for clearing cache files be saved expiration datees
*/
- const CLEAR_EXPIRED = -1;
+ const CLEAR_EXPIRED = - 1;
/**
* define compile check modes
@@ -206,111 +203,133 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* auto literal on delimiters with whitspace
+ *
* @var boolean
*/
public $auto_literal = true;
/**
* display error on not assigned variables
+ *
* @var boolean
*/
public $error_unassigned = false;
/**
* look up relative filepaths in include_path
+ *
* @var boolean
*/
public $use_include_path = false;
/**
* template directory
+ *
* @var array
*/
private $template_dir = array();
/**
* joined template directory string used in cache keys
+ *
* @var string
*/
public $joined_template_dir = null;
/**
* joined config directory string used in cache keys
+ *
* @var string
*/
public $joined_config_dir = null;
/**
* default template handler
+ *
* @var callable
*/
public $default_template_handler_func = null;
/**
* default config handler
+ *
* @var callable
*/
public $default_config_handler_func = null;
/**
* default plugin handler
+ *
* @var callable
*/
public $default_plugin_handler_func = null;
/**
* compile directory
+ *
* @var string
*/
private $compile_dir = null;
/**
* plugins directory
+ *
* @var array
*/
private $plugins_dir = array();
/**
* cache directory
+ *
* @var string
*/
private $cache_dir = null;
/**
* config directory
+ *
* @var array
*/
private $config_dir = array();
/**
* force template compiling?
+ *
* @var boolean
*/
public $force_compile = false;
/**
* check template for modifications?
+ *
* @var boolean
*/
public $compile_check = true;
/**
* use sub dirs for compiled/cached files?
+ *
* @var boolean
*/
public $use_sub_dirs = false;
/**
* allow ambiguous resources (that are made unique by the resource handler)
+ *
* @var boolean
*/
public $allow_ambiguous_resources = false;
/**
* caching enabled
+ *
* @var boolean
*/
public $caching = false;
/**
* merge compiled includes
+ *
* @var boolean
*/
public $merge_compiled_includes = false;
/**
* template inheritance merge compiled includes
+ *
* @var boolean
- */
+ */
public $inheritance_merge_compiled_includes = true;
/**
* cache lifetime in seconds
+ *
* @var integer
*/
public $cache_lifetime = 3600;
/**
* force cache file creation
+ *
* @var boolean
*/
public $force_cache = false;
@@ -330,11 +349,13 @@ class Smarty extends Smarty_Internal_TemplateBase
public $compile_id = null;
/**
* template left-delimiter
+ *
* @var string
*/
public $left_delimiter = "{";
/**
* template right-delimiter
+ *
* @var string
*/
public $right_delimiter = "}";
@@ -343,7 +364,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
/**
* class name
- *
* This should be instance of Smarty_Security.
*
* @var string
@@ -370,7 +390,6 @@ class Smarty extends Smarty_Internal_TemplateBase
public $allow_php_templates = false;
/**
* Should compiled-templates be prevented from being called directly?
- *
* {@internal
* Currently used by Smarty_Internal_Template only.
* }}
@@ -381,7 +400,6 @@ class Smarty extends Smarty_Internal_TemplateBase
/**#@-*/
/**
* debug mode
- *
* Setting this to true enables the debug-console.
*
* @var boolean
@@ -393,12 +411,12 @@ class Smarty extends Smarty_Internal_TemplateBase
* NONE => no debugging control allowed
* URL => enable debugging when SMARTY_DEBUG is found in the URL.
*
+ *
* @var string
*/
public $debugging_ctrl = 'NONE';
/**
* Name of debugging URL-param.
- *
* Only used when $debugging_ctrl is set to 'URL'.
* The name of the URL-parameter that activates debugging.
*
@@ -407,16 +425,19 @@ class Smarty extends Smarty_Internal_TemplateBase
public $smarty_debug_id = 'SMARTY_DEBUG';
/**
* Path of debug template.
+ *
* @var string
*/
public $debug_tpl = null;
/**
* When set, smarty uses this value as error_reporting-level.
+ *
* @var int
*/
public $error_reporting = null;
/**
* Internal flag for getTags()
+ *
* @var boolean
*/
public $get_used_tags = false;
@@ -427,16 +448,19 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Controls whether variables with the same name overwrite each other.
+ *
* @var boolean
*/
public $config_overwrite = true;
/**
* Controls whether config values of on/true/yes and off/false/no get converted to boolean.
+ *
* @var boolean
*/
public $config_booleanize = true;
/**
* Controls whether hidden config sections/vars are read from the file.
+ *
* @var boolean
*/
public $config_read_hidden = false;
@@ -449,16 +473,19 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* locking concurrent compiles
+ *
* @var boolean
*/
public $compile_locking = true;
/**
* Controls whether cache resources should emply locking mechanism
+ *
* @var boolean
*/
public $cache_locking = false;
/**
* seconds to wait for acquiring a lock before ignoring the write lock
+ *
* @var float
*/
public $locking_timeout = 10;
@@ -467,19 +494,19 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* global template functions
+ *
* @var array
*/
public $template_functions = array();
/**
* resource type used if none given
- *
* Must be an valid key of $registered_resources.
+ *
* @var string
*/
public $default_resource_type = 'file';
/**
* caching type
- *
* Must be an element of $cache_resource_types.
*
* @var string
@@ -487,121 +514,145 @@ class Smarty extends Smarty_Internal_TemplateBase
public $caching_type = 'file';
/**
* internal config properties
+ *
* @var array
*/
public $properties = array();
/**
* config type
+ *
* @var string
*/
public $default_config_type = 'file';
/**
* cached template objects
+ *
* @var array
*/
public $template_objects = array();
/**
* check If-Modified-Since headers
+ *
* @var boolean
*/
public $cache_modified_check = false;
/**
* registered plugins
+ *
* @var array
*/
public $registered_plugins = array();
/**
* plugin search order
+ *
* @var array
*/
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
/**
* registered objects
+ *
* @var array
*/
public $registered_objects = array();
/**
* registered classes
+ *
* @var array
*/
public $registered_classes = array();
/**
* registered filters
+ *
* @var array
*/
public $registered_filters = array();
/**
* registered resources
+ *
* @var array
*/
public $registered_resources = array();
/**
* resource handler cache
+ *
* @var array
*/
public $_resource_handlers = array();
/**
* registered cache resources
+ *
* @var array
*/
public $registered_cache_resources = array();
/**
* cache resource handler cache
+ *
* @var array
*/
public $_cacheresource_handlers = array();
/**
* autoload filter
+ *
* @var array
*/
public $autoload_filters = array();
/**
* default modifier
+ *
* @var array
*/
public $default_modifiers = array();
/**
* autoescape variable output
+ *
* @var boolean
*/
public $escape_html = false;
/**
* global internal smarty vars
+ *
* @var array
*/
public static $_smarty_vars = array();
/**
* start time for execution time calculation
+ *
* @var int
*/
public $start_time = 0;
/**
* default file permissions
+ *
* @var int
*/
public $_file_perms = 0644;
/**
* default dir permissions
+ *
* @var int
*/
public $_dir_perms = 0771;
/**
* block tag hierarchy
+ *
* @var array
*/
public $_tag_stack = array();
/**
* self pointer to Smarty object
+ *
* @var Smarty
*/
public $smarty;
/**
* required by the compiler for BC
+ *
* @var string
*/
public $_current_file = null;
/**
* internal flag to enable parser debugging
+ *
* @var bool
*/
public $_parserdebug = false;
@@ -615,7 +666,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Initialize new Smarty object
- *
+
*/
public function __construct()
{
@@ -656,33 +707,32 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* <> Generic getter.
- *
* Calls the appropriate getter function.
* Issues an E_USER_NOTICE if no valid getter is found.
*
* @param string $name property name
+ *
* @return mixed
*/
public function __get($name)
{
$allowed = array(
- 'template_dir' => 'getTemplateDir',
- 'config_dir' => 'getConfigDir',
- 'plugins_dir' => 'getPluginsDir',
- 'compile_dir' => 'getCompileDir',
- 'cache_dir' => 'getCacheDir',
+ 'template_dir' => 'getTemplateDir',
+ 'config_dir' => 'getConfigDir',
+ 'plugins_dir' => 'getPluginsDir',
+ 'compile_dir' => 'getCompileDir',
+ 'cache_dir' => 'getCacheDir',
);
if (isset($allowed[$name])) {
return $this->{$allowed[$name]}();
} else {
- trigger_error('Undefined property: '. get_class($this) .'::$'. $name, E_USER_NOTICE);
+ trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
}
}
/**
* <> Generic setter.
- *
* Calls the appropriate setter function.
* Issues an E_USER_NOTICE if no valid setter is found.
*
@@ -692,11 +742,11 @@ class Smarty extends Smarty_Internal_TemplateBase
public function __set($name, $value)
{
$allowed = array(
- 'template_dir' => 'setTemplateDir',
- 'config_dir' => 'setConfigDir',
- 'plugins_dir' => 'setPluginsDir',
- 'compile_dir' => 'setCompileDir',
- 'cache_dir' => 'setCacheDir',
+ 'template_dir' => 'setTemplateDir',
+ 'config_dir' => 'setConfigDir',
+ 'plugins_dir' => 'setPluginsDir',
+ 'compile_dir' => 'setCompileDir',
+ 'cache_dir' => 'setCacheDir',
);
if (isset($allowed[$name])) {
@@ -709,7 +759,8 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Check if a template resource exists
*
- * @param string $resource_name template name
+ * @param string $resource_name template name
+ *
* @return boolean status
*/
public function templateExists($resource_name)
@@ -727,8 +778,8 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Returns a single or all global variables
*
- * @param object $smarty
* @param string $varname variable name or null
+ *
* @return string variable value or or array of variables
*/
public function getGlobal($varname = null)
@@ -754,6 +805,7 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param integer $exp_time expiration time
* @param string $type resource type
+ *
* @return integer number of cache files deleted
*/
public function clearAllCache($exp_time = null, $type = null)
@@ -773,6 +825,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param string $compile_id compile id
* @param integer $exp_time expiration time
* @param string $type resource type
+ *
* @return integer number of cache files deleted
*/
public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
@@ -788,6 +841,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Loads security class and enables security
*
* @param string|Smarty_Security $security_class if a string is used, it must be class-name
+ *
* @return Smarty current Smarty instance for chaining
* @throws SmartyException when an invalid class name is provided
*/
@@ -816,6 +870,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Disable security
+ *
* @return Smarty current Smarty instance for chaining
*/
public function disableSecurity()
@@ -829,13 +884,14 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set template directory
*
* @param string|array $template_dir directory(s) of template sources
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setTemplateDir($template_dir)
{
$this->template_dir = array();
foreach ((array) $template_dir as $k => $v) {
- $this->template_dir[$k] = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
+ $this->template_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
}
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
@@ -846,19 +902,20 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Add template directory(s)
*
- * @param string|array $template_dir directory(s) of template sources
- * @param string $key of the array element to assign the template dir to
+ * @param string|array $template_dir directory(s) of template sources
+ * @param string $key of the array element to assign the template dir to
+ *
* @return Smarty current Smarty instance for chaining
* @throws SmartyException when the given template directory is not valid
*/
- public function addTemplateDir($template_dir, $key=null)
+ public function addTemplateDir($template_dir, $key = null)
{
// make sure we're dealing with an array
$this->template_dir = (array) $this->template_dir;
if (is_array($template_dir)) {
foreach ($template_dir as $k => $v) {
- $v = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
if (is_int($k)) {
// indexes are not merged but appended
$this->template_dir[] = $v;
@@ -867,15 +924,15 @@ class Smarty extends Smarty_Internal_TemplateBase
$this->template_dir[$k] = $v;
}
}
- } else {
- $v = str_replace(array('//','\\\\'), DS, rtrim($template_dir, '/\\')) . DS;
+ } else {
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS;
if ($key !== null) {
// override directory at specified index
$this->template_dir[$key] = $v;
- } else {
+ } else {
// append new directory
$this->template_dir[] = $v;
- }
+ }
}
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
@@ -885,10 +942,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Get template directories
*
- * @param mixed index of directory to get, null to get all
+ * @param mixed $index index of directory to get, null to get all
+ *
* @return array|string list of template directories, or directory of $index
*/
- public function getTemplateDir($index=null)
+ public function getTemplateDir($index = null)
{
if ($index !== null) {
return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null;
@@ -900,14 +958,15 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Set config directory
*
- * @param string|array $template_dir directory(s) of configuration sources
+ * @param $config_dir
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setConfigDir($config_dir)
{
$this->config_dir = array();
foreach ((array) $config_dir as $k => $v) {
- $this->config_dir[$k] = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
+ $this->config_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
}
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
@@ -918,18 +977,19 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Add config directory(s)
*
- * @param string|array $config_dir directory(s) of config sources
- * @param string key of the array element to assign the config dir to
+ * @param string|array $config_dir directory(s) of config sources
+ * @param mixed $key key of the array element to assign the config dir to
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function addConfigDir($config_dir, $key=null)
+ public function addConfigDir($config_dir, $key = null)
{
// make sure we're dealing with an array
$this->config_dir = (array) $this->config_dir;
if (is_array($config_dir)) {
foreach ($config_dir as $k => $v) {
- $v = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
if (is_int($k)) {
// indexes are not merged but appended
$this->config_dir[] = $v;
@@ -939,14 +999,14 @@ class Smarty extends Smarty_Internal_TemplateBase
}
}
} else {
- $v = str_replace(array('//','\\\\'), DS, rtrim($config_dir, '/\\')) . DS;
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS;
if ($key !== null) {
// override directory at specified index
$this->config_dir[$key] = rtrim($v, '/\\') . DS;
- } else {
+ } else {
// append new directory
$this->config_dir[] = rtrim($v, '/\\') . DS;
- }
+ }
}
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
@@ -957,10 +1017,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Get config directory
*
- * @param mixed index of directory to get, null to get all
+ * @param mixed $index index of directory to get, null to get all
+ *
* @return array|string configuration directory
*/
- public function getConfigDir($index=null)
+ public function getConfigDir($index = null)
{
if ($index !== null) {
return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null;
@@ -973,6 +1034,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set plugins directory
*
* @param string|array $plugins_dir directory(s) of plugins
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setPluginsDir($plugins_dir)
@@ -988,8 +1050,8 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Adds directory of plugin files
*
- * @param object $smarty
- * @param string $ |array $ plugins folder
+ * @param $plugins_dir
+ *
* @return Smarty current Smarty instance for chaining
*/
public function addPluginsDir($plugins_dir)
@@ -1031,6 +1093,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set compile directory
*
* @param string $compile_dir directory to store compiled templates in
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setCompileDir($compile_dir)
@@ -1057,6 +1120,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set cache directory
*
* @param string $cache_dir directory to store cached templates in
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setCacheDir($cache_dir)
@@ -1083,6 +1147,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set default modifiers
*
* @param array|string $modifiers modifier or list of modifiers to set
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setDefaultModifiers($modifiers)
@@ -1096,6 +1161,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* Add default modifiers
*
* @param array|string $modifiers modifier or list of modifiers to add
+ *
* @return Smarty current Smarty instance for chaining
*/
public function addDefaultModifiers($modifiers)
@@ -1119,15 +1185,15 @@ class Smarty extends Smarty_Internal_TemplateBase
return $this->default_modifiers;
}
-
/**
* Set autoload filters
*
* @param array $filters filters to load automatically
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function setAutoloadFilters($filters, $type=null)
+ public function setAutoloadFilters($filters, $type = null)
{
if ($type !== null) {
$this->autoload_filters[$type] = (array) $filters;
@@ -1143,9 +1209,10 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param array $filters filters to load automatically
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function addAutoloadFilters($filters, $type=null)
+ public function addAutoloadFilters($filters, $type = null)
{
if ($type !== null) {
if (!empty($this->autoload_filters[$type])) {
@@ -1170,9 +1237,10 @@ class Smarty extends Smarty_Internal_TemplateBase
* Get autoload filters
*
* @param string $type type of filter to get autoloads for. Defaults to all autoload filters
+ *
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified
*/
- public function getAutoloadFilters($type=null)
+ public function getAutoloadFilters($type = null)
{
if ($type !== null) {
return isset($this->autoload_filters[$type]) ? $this->autoload_filters[$type] : array();
@@ -1194,7 +1262,8 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* set the debug template
*
- * @param string $tpl_name
+ * @param string $tpl_name
+ *
* @return Smarty current Smarty instance for chaining
* @throws SmartyException if file is not readable
*/
@@ -1216,6 +1285,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
* @param boolean $do_clone flag is Smarty object shall be cloned
+ *
* @return object template object
*/
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
@@ -1275,7 +1345,6 @@ class Smarty extends Smarty_Internal_TemplateBase
return $tpl;
}
-
/**
* Takes unknown classes and loads plugin files for them
* class name format: Smarty_PluginType_PluginName
@@ -1283,6 +1352,8 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param string $plugin_name class plugin name to load
* @param bool $check check if already loaded
+ *
+ * @throws SmartyException
* @return string |boolean filepath of loaded file or false
*/
public function loadPlugin($plugin_name, $check = true)
@@ -1297,8 +1368,6 @@ class Smarty extends Smarty_Internal_TemplateBase
// count($_name_parts) < 3 === !isset($_name_parts[2])
if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
-
- return false;
}
// if type is "internal", get plugin from sysplugins
if (strtolower($_name_parts[1]) == 'internal') {
@@ -1351,10 +1420,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Compile all template files
*
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
* @return integer number of template files recompiled
*/
public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
@@ -1365,10 +1435,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Compile all config files
*
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
* @return integer number of template files recompiled
*/
public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
@@ -1382,6 +1453,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param string $resource_name template name
* @param string $compile_id compile id
* @param integer $exp_time expiration time
+ *
* @return integer number of template files deleted
*/
public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
@@ -1389,11 +1461,11 @@ class Smarty extends Smarty_Internal_TemplateBase
return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);
}
-
/**
* Return array of tag/attributes of all tags used by an template
*
- * @param object $templae template object
+ * @param Smarty_Internal_Template $template
+ *
* @return array of tag/attributes
*/
public function getTags(Smarty_Internal_Template $template)
@@ -1404,10 +1476,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Run installation test
*
- * @param array $errors Array to write errors into, rather than outputting them
+ * @param array $errors Array to write errors into, rather than outputting them
+ *
* @return boolean true if setup is fine, false if something is wrong
*/
- public function testInstall(&$errors=null)
+ public function testInstall(&$errors = null)
{
return Smarty_Internal_Utility::testInstall($this, $errors);
}
@@ -1416,7 +1489,13 @@ class Smarty extends Smarty_Internal_TemplateBase
* Error Handler to mute expected messages
*
* @link http://php.net/set_error_handler
+ *
* @param integer $errno Error level
+ * @param $errstr
+ * @param $errfile
+ * @param $errline
+ * @param $errcontext
+ *
* @return boolean
*/
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
@@ -1428,7 +1507,7 @@ class Smarty extends Smarty_Internal_TemplateBase
$smarty_dir = realpath(SMARTY_DIR);
if ($smarty_dir !== false) {
Smarty::$_muted_directories[SMARTY_DIR] = array(
- 'file' => $smarty_dir,
+ 'file' => $smarty_dir,
'length' => strlen($smarty_dir),
);
}
@@ -1445,7 +1524,7 @@ class Smarty extends Smarty_Internal_TemplateBase
continue;
}
$dir = array(
- 'file' => $file,
+ 'file' => $file,
'length' => strlen($file),
);
}
@@ -1519,6 +1598,7 @@ if (Smarty::$_CHARSET !== 'UTF-8') {
/**
* Smarty exception class
+ *
* @package Smarty
*/
class SmartyException extends Exception
@@ -1527,12 +1607,13 @@ class SmartyException extends Exception
public function __toString()
{
- return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
+ return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
}
}
/**
* Smarty compiler exception class
+ *
* @package Smarty
*/
class SmartyCompilerException extends SmartyException
@@ -1541,23 +1622,28 @@ class SmartyCompilerException extends SmartyException
{
return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
}
+
/**
* The line number of the template error
+ *
* @type int|null
*/
public $line = null;
/**
* The template source snippet relating to the error
+ *
* @type string|null
*/
public $source = null;
/**
* The raw text of the error message
+ *
* @type string|null
*/
public $desc = null;
/**
* The resource identifier or template name
+ *
* @type string|null
*/
public $template = null;
@@ -1570,16 +1656,16 @@ function smartyAutoload($class)
{
$_class = strtolower($class);
static $_classes = array(
- 'smarty_config_source' => true,
- 'smarty_config_compiled' => true,
- 'smarty_security' => true,
- 'smarty_cacheresource' => true,
- 'smarty_cacheresource_custom' => true,
+ 'smarty_config_source' => true,
+ 'smarty_config_compiled' => true,
+ 'smarty_security' => true,
+ 'smarty_cacheresource' => true,
+ 'smarty_cacheresource_custom' => true,
'smarty_cacheresource_keyvaluestore' => true,
- 'smarty_resource' => true,
- 'smarty_resource_custom' => true,
- 'smarty_resource_uncompiled' => true,
- 'smarty_resource_recompiled' => true,
+ 'smarty_resource' => true,
+ 'smarty_resource_custom' => true,
+ 'smarty_resource_uncompiled' => true,
+ 'smarty_resource_recompiled' => true,
);
if (!strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) {
diff --git a/libs/SmartyBC.class.php b/libs/SmartyBC.class.php
index 3c1a0aa9..cec94674 100644
--- a/libs/SmartyBC.class.php
+++ b/libs/SmartyBC.class.php
@@ -3,31 +3,27 @@
* Project: Smarty: the PHP compiling template engine
* File: SmartyBC.class.php
* SVN: $Id: $
- *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
- * @link http://www.smarty.net/
+ * @link http://www.smarty.net/
* @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt
- * @author Uwe Tews
- * @author Rodney Rehm
- * @package Smarty
+ * @author Monte Ohrt
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ * @package Smarty
*/
/**
* @ignore
@@ -43,6 +39,7 @@ class SmartyBC extends Smarty
{
/**
* Smarty 2 BC
+ *
* @var string
*/
public $_version = self::SMARTY_VERSION;
@@ -52,7 +49,7 @@ class SmartyBC extends Smarty
*
* @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
*/
- public function __construct(array $options=array())
+ public function __construct(array $options = array())
{
parent::__construct($options);
// register {php} tag
@@ -100,7 +97,7 @@ class SmartyBC extends Smarty
* @param bool $cacheable
* @param mixed $cache_attrs
*/
- public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
+ public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
{
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
}
@@ -118,11 +115,14 @@ class SmartyBC extends Smarty
/**
* Registers object to be used in templates
*
- * @param string $object name of template object
- * @param object $object_impl the referenced PHP object to register
- * @param array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param array $block_functs list of methods that are block format
+ * @param string $object name of template object
+ * @param object $object_impl the referenced PHP object to register
+ * @param array $allowed list of allowed methods (empty = all)
+ * @param boolean $smarty_args smarty argument format, else traditional
+ * @param array $block_methods list of methods that are block format
+ *
+ * @throws SmartyException
+ * @internal param array $block_functs list of methods that are block format
*/
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
{
@@ -144,12 +144,12 @@ class SmartyBC extends Smarty
/**
* Registers block function to be used in templates
*
- * @param string $block name of template block
- * @param string $block_impl PHP function to register
+ * @param string $block name of template block
+ * @param string $block_impl PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*/
- public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
+ public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
{
$this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
}
@@ -171,7 +171,7 @@ class SmartyBC extends Smarty
* @param string $function_impl name of PHP function to register
* @param bool $cacheable
*/
- public function register_compiler_function($function, $function_impl, $cacheable=true)
+ public function register_compiler_function($function, $function_impl, $cacheable = true)
{
$this->registerPlugin('compiler', $function, $function_impl, $cacheable);
}
@@ -305,10 +305,11 @@ class SmartyBC extends Smarty
/**
* clear cached content for the given template and cache id
*
- * @param string $tpl_file name of template file
- * @param string $cache_id name of cache_id
- * @param string $compile_id name of compile_id
- * @param string $exp_time expiration time
+ * @param string $tpl_file name of template file
+ * @param string $cache_id name of cache_id
+ * @param string $compile_id name of compile_id
+ * @param string $exp_time expiration time
+ *
* @return boolean
*/
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
@@ -319,7 +320,8 @@ class SmartyBC extends Smarty
/**
* clear the entire contents of cache (all templates)
*
- * @param string $exp_time expire time
+ * @param string $exp_time expire time
+ *
* @return boolean
*/
public function clear_all_cache($exp_time = null)
@@ -330,9 +332,10 @@ class SmartyBC extends Smarty
/**
* test to see if valid cache exists for this template
*
- * @param string $tpl_file name of template file
- * @param string $cache_id
- * @param string $compile_id
+ * @param string $tpl_file name of template file
+ * @param string $cache_id
+ * @param string $compile_id
+ *
* @return boolean
*/
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
@@ -353,9 +356,10 @@ class SmartyBC extends Smarty
* or all compiled template files if one is not specified.
* This function is for advanced use only, not normally needed.
*
- * @param string $tpl_file
- * @param string $compile_id
- * @param string $exp_time
+ * @param string $tpl_file
+ * @param string $compile_id
+ * @param string $exp_time
+ *
* @return boolean results of {@link smarty_core_rm_auto()}
*/
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
@@ -366,7 +370,8 @@ class SmartyBC extends Smarty
/**
* Checks whether requested template exists.
*
- * @param string $tpl_file
+ * @param string $tpl_file
+ *
* @return boolean
*/
public function template_exists($tpl_file)
@@ -378,9 +383,10 @@ class SmartyBC extends Smarty
* Returns an array containing template variables
*
* @param string $name
+ *
* @return array
*/
- public function get_template_vars($name=null)
+ public function get_template_vars($name = null)
{
return $this->getTemplateVars($name);
}
@@ -389,9 +395,10 @@ class SmartyBC extends Smarty
* Returns an array containing config variables
*
* @param string $name
+ *
* @return array
*/
- public function get_config_vars($name=null)
+ public function get_config_vars($name = null)
{
return $this->getConfigVars($name);
}
@@ -412,6 +419,7 @@ class SmartyBC extends Smarty
* return a reference to a registered object
*
* @param string $name
+ *
* @return object
*/
public function get_registered_object($name)
@@ -439,7 +447,6 @@ class SmartyBC extends Smarty
{
trigger_error("Smarty error: $error_msg", $error_type);
}
-
}
/**
@@ -449,6 +456,7 @@ class SmartyBC extends Smarty
* @param string $content contents of the block
* @param object $template template object
* @param boolean &$repeat repeat flag
+ *
* @return string content re-formatted
*/
function smarty_php_tag($params, $content, $template, &$repeat)
diff --git a/libs/debug.tpl b/libs/debug.tpl
index 12eef0ff..61b8876a 100644
--- a/libs/debug.tpl
+++ b/libs/debug.tpl
@@ -1,133 +1,137 @@
{capture name='_smarty_debug' assign=debug_output}
-
-
-
- Smarty Debug Console
-
-
-
+ #table_config_vars th {
+ color: maroon;
+ }
-Smarty Debug Console - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}
+ {/literal}
+
+
+
-{if !empty($template_data)}
-included templates & config files (load time in seconds)
+ Smarty Debug Console
+ - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}
-
-{foreach $template_data as $template}
-
{$template.name}
-
- (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
+ {if !empty($template_data)}
+ included templates & config files (load time in seconds)
+
+ {foreach $template_data as $template}
+ {$template.name}
+
+ (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}
+ )
-
-{/foreach}
-
-{/if}
+
+ {/foreach}
+
+ {/if}
-assigned template variables
+ assigned template variables
-
- {foreach $assigned_vars as $vars}
-
- ${$vars@key|escape:'html'}
- {$vars|debug_print_var nofilter}
- {/foreach}
-
+
+ {foreach $assigned_vars as $vars}
+
+ ${$vars@key|escape:'html'}
+ {$vars|debug_print_var nofilter}
+
+ {/foreach}
+
-assigned config file variables (outer template scope)
+ assigned config file variables (outer template scope)
-
- {foreach $config_vars as $vars}
-
- {$vars@key|escape:'html'}
- {$vars|debug_print_var nofilter}
- {/foreach}
+
+ {foreach $config_vars as $vars}
+
+ {$vars@key|escape:'html'}
+ {$vars|debug_print_var nofilter}
+
+ {/foreach}
-
-
-
+
+
+
{/capture}
diff --git a/libs/plugins/block.textformat.php b/libs/plugins/block.textformat.php
index b62a4f8e..abf54493 100644
--- a/libs/plugins/block.textformat.php
+++ b/libs/plugins/block.textformat.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin to format text blocks
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsBlock
*/
/**
* Smarty {textformat}{/textformat} block plugin
- *
* Type: block function
* Name: textformat
* Purpose: format text a certain way with preset styles
@@ -23,12 +22,14 @@
* - wrap_boundary - boolean (true)
*
*
- * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
+ * (Smarty online manual)
+ *
* @param array $params parameters
* @param string $content contents of the block
* @param Smarty_Internal_Template $template template object
* @param boolean &$repeat repeat flag
+ *
* @return string content re-formatted
* @author Monte Ohrt
*/
@@ -76,7 +77,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
}
// split into paragraphs
$_paragraphs = preg_split('![\r\n]{2}!', $content);
- $_output = '';
foreach ($_paragraphs as &$_paragraph) {
if (!$_paragraph) {
diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php
index cd147634..4da85a14 100644
--- a/libs/plugins/function.counter.php
+++ b/libs/plugins/function.counter.php
@@ -1,22 +1,24 @@
* Name: counter
* Purpose: print out a counter value
*
* @author Monte Ohrt
- * @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
+ * (Smarty online manual)
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
function smarty_function_counter($params, $template)
@@ -26,11 +28,11 @@ function smarty_function_counter($params, $template)
$name = (isset($params['name'])) ? $params['name'] : 'default';
if (!isset($counters[$name])) {
$counters[$name] = array(
- 'start'=>1,
- 'skip'=>1,
- 'direction'=>'up',
- 'count'=>1
- );
+ 'start' => 1,
+ 'skip' => 1,
+ 'direction' => 'up',
+ 'count' => 1
+ );
}
$counter =& $counters[$name];
@@ -66,11 +68,11 @@ function smarty_function_counter($params, $template)
$counter['direction'] = $params['direction'];
}
- if ($counter['direction'] == "down")
+ if ($counter['direction'] == "down") {
$counter['count'] -= $counter['skip'];
- else
+ } else {
$counter['count'] += $counter['skip'];
+ }
return $retval;
-
}
diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php
index 9bf26f8c..8dc5cd9d 100644
--- a/libs/plugins/function.cycle.php
+++ b/libs/plugins/function.cycle.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {cycle} function plugin
- *
* Type: function
* Name: cycle
* Date: May 3, 2002
@@ -31,15 +30,17 @@
* {cycle name=row}
*
*
- * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
- * (Smarty online manual)
- * @author Monte Ohrt
- * @author credit to Mark Priatel
- * @author credit to Gerard
- * @author credit to Jason Sweat
+ * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
+ * (Smarty online manual)
+ * @author Monte Ohrt
+ * @author credit to Mark Priatel
+ * @author credit to Gerard
+ * @author credit to Jason Sweat
* @version 1.3
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
@@ -59,8 +60,9 @@ function smarty_function_cycle($params, $template)
return;
}
} else {
- if(isset($cycle_vars[$name]['values'])
- && $cycle_vars[$name]['values'] != $params['values'] ) {
+ if (isset($cycle_vars[$name]['values'])
+ && $cycle_vars[$name]['values'] != $params['values']
+ ) {
$cycle_vars[$name]['index'] = 0;
}
$cycle_vars[$name]['values'] = $params['values'];
@@ -75,10 +77,10 @@ function smarty_function_cycle($params, $template)
if (is_array($cycle_vars[$name]['values'])) {
$cycle_array = $cycle_vars[$name]['values'];
} else {
- $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
+ $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
}
- if (!isset($cycle_vars[$name]['index']) || $reset ) {
+ if (!isset($cycle_vars[$name]['index']) || $reset) {
$cycle_vars[$name]['index'] = 0;
}
@@ -94,10 +96,10 @@ function smarty_function_cycle($params, $template)
}
if ($advance) {
- if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
+ if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
$cycle_vars[$name]['index'] = 0;
} else {
- $cycle_vars[$name]['index']++;
+ $cycle_vars[$name]['index'] ++;
}
}
diff --git a/libs/plugins/function.fetch.php b/libs/plugins/function.fetch.php
index a4eaef37..3506d4a8 100644
--- a/libs/plugins/function.fetch.php
+++ b/libs/plugins/function.fetch.php
@@ -2,28 +2,30 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {fetch} plugin
- *
* Type: function
* Name: fetch
* Purpose: fetch file, web or ftp data and display results
*
- * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
+ * (Smarty online manual)
* @author Monte Ohrt
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
+ * @throws SmartyException
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
*/
function smarty_function_fetch($params, $template)
{
if (empty($params['file'])) {
- trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
+ trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE);
return;
}
@@ -60,7 +62,7 @@ function smarty_function_fetch($params, $template)
$host = $server_name = $uri_parts['host'];
$timeout = 30;
$accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
- $agent = "Smarty Template Engine ". Smarty::SMARTY_VERSION;
+ $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION;
$referer = "";
$uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
$uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
@@ -100,8 +102,8 @@ function smarty_function_fetch($params, $template)
break;
case "header":
if (!empty($param_value)) {
- if (!preg_match('![\w\d-]+: .+!',$param_value)) {
- trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE);
+ if (!preg_match('![\w\d-]+: .+!', $param_value)) {
+ trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE);
return;
} else {
@@ -118,7 +120,7 @@ function smarty_function_fetch($params, $template)
if (!preg_match('!\D!', $param_value)) {
$proxy_port = (int) $param_value;
} else {
- trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
return;
}
@@ -137,26 +139,26 @@ function smarty_function_fetch($params, $template)
if (!preg_match('!\D!', $param_value)) {
$timeout = (int) $param_value;
} else {
- trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
return;
}
break;
default:
- trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE);
return;
}
}
if (!empty($proxy_host) && !empty($proxy_port)) {
$_is_proxy = true;
- $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+ $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout);
} else {
- $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+ $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout);
}
if (!$fp) {
- trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE);
+ trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE);
return;
} else {
@@ -179,35 +181,35 @@ function smarty_function_fetch($params, $template)
}
if (isset($extra_headers) && is_array($extra_headers)) {
foreach ($extra_headers as $curr_header) {
- fputs($fp, $curr_header."\r\n");
+ fputs($fp, $curr_header . "\r\n");
}
}
if (!empty($user) && !empty($pass)) {
- fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+ fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n");
}
fputs($fp, "\r\n");
while (!feof($fp)) {
- $content .= fgets($fp,4096);
+ $content .= fgets($fp, 4096);
}
fclose($fp);
- $csplit = preg_split("!\r\n\r\n!",$content,2);
+ $csplit = preg_split("!\r\n\r\n!", $content, 2);
$content = $csplit[1];
if (!empty($params['assign_headers'])) {
- $template->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
+ $template->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0]));
}
}
} else {
- trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE);
+ trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE);
return;
}
} else {
$content = @file_get_contents($params['file']);
if ($content === false) {
- throw new SmartyException("{fetch} cannot read resource '" . $params['file'] ."'");
+ throw new SmartyException("{fetch} cannot read resource '" . $params['file'] . "'");
}
}
diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php
index ad0e9cd4..d7868036 100644
--- a/libs/plugins/function.html_checkboxes.php
+++ b/libs/plugins/function.html_checkboxes.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_checkboxes} function plugin
- *
* File: function.html_checkboxes.php
* Type: function
* Name: html_checkboxes
@@ -32,15 +31,17 @@
* - escape (optional) - escape the content (not value), defaults to true
*
*
- * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ * (Smarty online manual)
* @author Christopher Kvarme
- * @author credits to Monte Ohrt
+ * @author credits to Monte Ohrt
* @version 1.0
- * @param array $params parameters
+ *
+ * @param array $params parameters
* @param object $template template object
+ *
* @return string
- * @uses smarty_function_escape_special_chars()
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_checkboxes($params, $template)
{
@@ -89,7 +90,7 @@ function smarty_function_html_checkboxes($params, $template)
if (method_exists($_sel, "__toString")) {
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
} else {
- trigger_error("html_checkboxes: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
continue;
}
} else {
@@ -101,7 +102,7 @@ function smarty_function_html_checkboxes($params, $template)
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_checkboxes: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = smarty_function_escape_special_chars((string) $_val);
@@ -116,7 +117,8 @@ function smarty_function_html_checkboxes($params, $template)
case 'assign':
break;
- case 'strict': break;
+ case 'strict':
+ break;
case 'disabled':
case 'readonly':
@@ -131,11 +133,11 @@ function smarty_function_html_checkboxes($params, $template)
break;
}
- // omit break; to fall through!
+ // omit break; to fall through!
default:
if (!is_array($_val)) {
- $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+ $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
@@ -143,17 +145,18 @@ function smarty_function_html_checkboxes($params, $template)
}
}
- if (!isset($options) && !isset($values))
- return ''; /* raise error here? */
+ if (!isset($options) && !isset($values)) {
+ return '';
+ } /* raise error here? */
$_html_result = array();
if (isset($options)) {
- foreach ($options as $_key=>$_val) {
+ foreach ($options as $_key => $_val) {
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
}
} else {
- foreach ($values as $_i=>$_key) {
+ foreach ($values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
}
@@ -164,10 +167,9 @@ function smarty_function_html_checkboxes($params, $template)
} else {
return implode("\n", $_html_result);
}
-
}
-function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true)
+function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true)
{
$_output = '';
@@ -175,7 +177,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
if (method_exists($value, "__toString")) {
$value = (string) $value->__toString();
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
return '';
}
@@ -187,7 +189,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
if (method_exists($output, "__toString")) {
$output = (string) $output->__toString();
} else {
- trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
return '';
}
@@ -229,7 +231,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
$_output .= '';
}
- $_output .= $separator;
+ $_output .= $separator;
return $_output;
}
diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php
index 1674a262..5037e8bd 100644
--- a/libs/plugins/function.html_image.php
+++ b/libs/plugins/function.html_image.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_image} function plugin
- *
* Type: function
* Name: html_image
* Date: Feb 24, 2003
@@ -24,15 +23,18 @@
* - path_prefix - prefix for path output (optional, default empty)
*
*
- * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
- * (Smarty online manual)
- * @author Monte Ohrt
- * @author credits to Duda
+ * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
+ * (Smarty online manual)
+ * @author Monte Ohrt
+ * @author credits to Duda
* @version 1.0
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
+ * @throws SmartyException
* @return string
- * @uses smarty_function_escape_special_chars()
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_image($params, $template)
{
@@ -112,7 +114,7 @@ function smarty_function_html_image($params, $template)
}
} else {
// local file
- if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
+ if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
return;
}
}
diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php
index 5ff98750..7ec3e065 100644
--- a/libs/plugins/function.html_options.php
+++ b/libs/plugins/function.html_options.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_options} function plugin
- *
* Type: function
* Name: html_options
* Purpose: Prints the list of tags generated from
@@ -24,16 +23,17 @@
* - class (optional) - string default not set
*
*
- * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
- * (Smarty online manual)
- * @author Monte Ohrt
- * @author Ralf Strehle (minor optimization)
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
+ * (Smarty online manual)
+ * @author Monte Ohrt
+ * @author Ralf Strehle (minor optimization)
+ *
+ * @param array $params parameters
+ *
* @return string
- * @uses smarty_function_escape_special_chars()
+ * @uses smarty_function_escape_special_chars()
*/
-function smarty_function_html_options($params, $template)
+function smarty_function_html_options($params)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
@@ -72,7 +72,7 @@ function smarty_function_html_options($params, $template)
if (method_exists($_sel, "__toString")) {
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
} else {
- trigger_error("html_options: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
continue;
}
} else {
@@ -84,14 +84,15 @@ function smarty_function_html_options($params, $template)
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_options: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = smarty_function_escape_special_chars((string) $_val);
}
break;
- case 'strict': break;
+ case 'strict':
+ break;
case 'disabled':
case 'readonly':
@@ -106,7 +107,7 @@ function smarty_function_html_options($params, $template)
break;
}
- // omit break; to fall through!
+ // omit break; to fall through!
default:
if (!is_array($_val)) {
@@ -139,8 +140,8 @@ function smarty_function_html_options($params, $template)
}
if (!empty($name)) {
- $_html_class = !empty($class) ? ' class="'.$class.'"' : '';
- $_html_id = !empty($id) ? ' id="'.$id.'"' : '';
+ $_html_class = !empty($class) ? ' class="' . $class . '"' : '';
+ $_html_id = !empty($id) ? ' id="' . $id . '"' : '';
$_html_result = '' . "\n" . $_html_result . ' ' . "\n";
}
@@ -159,13 +160,13 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
} elseif ($_key === $selected) {
$_html_result .= ' selected="selected"';
}
- $_html_class = !empty($class) ? ' class="'.$class.' option"' : '';
- $_html_id = !empty($id) ? ' id="'.$id.'-'.$idx.'"' : '';
+ $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
+ $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
if (is_object($value)) {
if (method_exists($value, "__toString")) {
$value = smarty_function_escape_special_chars((string) $value->__toString());
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
return '';
}
@@ -173,11 +174,11 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
$value = smarty_function_escape_special_chars((string) $value);
}
$_html_result .= $_html_class . $_html_id . '>' . $value . ' ' . "\n";
- $idx++;
+ $idx ++;
} else {
$_idx = 0;
- $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx);
- $idx++;
+ $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx);
+ $idx ++;
}
return $_html_result;
diff --git a/libs/plugins/function.html_radios.php b/libs/plugins/function.html_radios.php
index 16606ebf..f121d5ea 100644
--- a/libs/plugins/function.html_radios.php
+++ b/libs/plugins/function.html_radios.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_radios} function plugin
- *
* File: function.html_radios.php
* Type: function
* Name: html_radios
@@ -32,15 +31,17 @@
* {html_radios values=$ids checked=$checked separator=' ' output=$names}
*
*
- * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
- * (Smarty online manual)
- * @author Christopher Kvarme
- * @author credits to Monte Ohrt
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ * (Smarty online manual)
+ * @author Christopher Kvarme
+ * @author credits to Monte Ohrt
* @version 1.0
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string
- * @uses smarty_function_escape_special_chars()
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_radios($params, $template)
{
@@ -72,7 +73,7 @@ function smarty_function_html_radios($params, $template)
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_radios: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = (string) $_val;
@@ -102,7 +103,8 @@ function smarty_function_html_radios($params, $template)
case 'assign':
break;
- case 'strict': break;
+ case 'strict':
+ break;
case 'disabled':
case 'readonly':
@@ -117,7 +119,7 @@ function smarty_function_html_radios($params, $template)
break;
}
- // omit break; to fall through!
+ // omit break; to fall through!
default:
if (!is_array($_val)) {
@@ -163,7 +165,7 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
if (method_exists($value, "__toString")) {
$value = (string) $value->__toString();
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
return '';
}
@@ -175,7 +177,7 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
if (method_exists($output, "__toString")) {
$output = (string) $output->__toString();
} else {
- trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
return '';
}
diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php
index b1bfee2b..d6625665 100644
--- a/libs/plugins/function.html_select_date.php
+++ b/libs/plugins/function.html_select_date.php
@@ -2,7 +2,7 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
@@ -17,11 +17,9 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
/**
* Smarty {html_select_date} plugin
- *
* Type: function
* Name: html_select_date
* Purpose: Prints the dropdowns for date selection.
- *
* ChangeLog:
*
* - 1.0 initial release
@@ -41,17 +39,18 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
* added attributes month_names, *_id
*
*
- * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
- * (Smarty online manual)
- * @version 2.0
- * @author Andrei Zmievski
- * @author Monte Ohrt
- * @author Rodney Rehm
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
+ * (Smarty online manual)
+ * @version 2.0
+ * @author Andrei Zmievski
+ * @author Monte Ohrt
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ *
* @return string
*/
-function smarty_function_html_select_date($params, $template)
+function smarty_function_html_select_date($params)
{
// generate timestamps used for month names only
static $_month_timestamps = null;
@@ -59,7 +58,7 @@ function smarty_function_html_select_date($params, $template)
if ($_month_timestamps === null) {
$_current_year = date('Y');
$_month_timestamps = array();
- for ($i = 1; $i <= 12; $i++) {
+ for ($i = 1; $i <= 12; $i ++) {
$_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);
}
}
@@ -181,22 +180,20 @@ function smarty_function_html_select_date($params, $template)
if (isset($params['time']) && is_array($params['time'])) {
if (isset($params['time'][$prefix . 'Year'])) {
// $_REQUEST[$field_array] given
- foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
+ foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$prefix . $_elementName])
? $params['time'][$prefix . $_elementName]
: date($_elementKey);
}
- $time = mktime(0, 0, 0, $_month, $_day, $_year);
} elseif (isset($params['time'][$field_array][$prefix . 'Year'])) {
// $_REQUEST given
- foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
+ foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
? $params['time'][$field_array][$prefix . $_elementName]
: date($_elementKey);
}
- $time = mktime(0, 0, 0, $_month, $_day, $_year);
} else {
// no date found, use NOW
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
@@ -219,9 +216,9 @@ function smarty_function_html_select_date($params, $template)
if ($t === null) {
$$key = (int) $_current_year;
} elseif ($t[0] == '+') {
- $$key = (int) ($_current_year + trim(substr($t, 1)));
+ $$key = (int) ($_current_year + (int)trim(substr($t, 1)));
} elseif ($t[0] == '-') {
- $$key = (int) ($_current_year - trim(substr($t, 1)));
+ $$key = (int) ($_current_year - (int)trim(substr($t, 1)));
} else {
$$key = (int) $$key;
}
@@ -236,7 +233,6 @@ function smarty_function_html_select_date($params, $template)
// generate year or
if ($display_years) {
- $_html_years = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
if ($all_extra) {
@@ -252,8 +248,8 @@ function smarty_function_html_select_date($params, $template)
$_html_years = '' . $option_separator;
if (isset($year_empty) || isset($all_empty)) {
- $_html_years .= '' . ( isset($year_empty) ? $year_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_years .= '' . (isset($year_empty) ? $year_empty : $all_empty) . ' ' . $option_separator;
}
- $op = $start_year > $end_year ? -1 : 1;
- for ($i=$start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
+ $op = $start_year > $end_year ? - 1 : 1;
+ for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
$_html_years .= '' . $i . ' ' . $option_separator;
@@ -277,7 +273,6 @@ function smarty_function_html_select_date($params, $template)
// generate month or
if ($display_months) {
- $_html_month = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
if ($all_extra) {
@@ -290,8 +285,8 @@ function smarty_function_html_select_date($params, $template)
$_html_months = '' . $option_separator;
if (isset($month_empty) || isset($all_empty)) {
- $_html_months .= '' . ( isset($month_empty) ? $month_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_months .= '' . (isset($month_empty) ? $month_empty : $all_empty) . ' ' . $option_separator;
}
- for ($i = 1; $i <= 12; $i++) {
+ for ($i = 1; $i <= 12; $i ++) {
$_val = sprintf('%02d', $i);
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
$_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);
@@ -316,7 +311,6 @@ function smarty_function_html_select_date($params, $template)
// generate day or
if ($display_days) {
- $_html_day = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
if ($all_extra) {
@@ -329,8 +323,8 @@ function smarty_function_html_select_date($params, $template)
$_html_days = '' . $option_separator;
if (isset($day_empty) || isset($all_empty)) {
- $_html_days .= '' . ( isset($day_empty) ? $day_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_days .= '' . (isset($day_empty) ? $day_empty : $all_empty) . ' ' . $option_separator;
}
- for ($i = 1; $i <= 31; $i++) {
+ for ($i = 1; $i <= 31; $i ++) {
$_val = sprintf('%02d', $i);
$_text = $day_format == '%02d' ? $_val : sprintf($day_format, $i);
- $_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i);
+ $_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i);
$_html_days .= '' . $_text . ' ' . $option_separator;
@@ -355,7 +349,7 @@ function smarty_function_html_select_date($params, $template)
// order the fields for output
$_html = '';
- for ($i=0; $i <= 2; $i++) {
+ for ($i = 0; $i <= 2; $i ++) {
switch ($field_order[$i]) {
case 'Y':
case 'y':
@@ -365,7 +359,7 @@ function smarty_function_html_select_date($params, $template)
}
$_html .= $_html_years;
}
- break;
+ break;
case 'm':
case 'M':
@@ -375,7 +369,7 @@ function smarty_function_html_select_date($params, $template)
}
$_html .= $_html_months;
}
- break;
+ break;
case 'd':
case 'D':
@@ -385,7 +379,7 @@ function smarty_function_html_select_date($params, $template)
}
$_html .= $_html_days;
}
- break;
+ break;
}
}
diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php
index 9e7f9117..9af6aad5 100644
--- a/libs/plugins/function.html_select_time.php
+++ b/libs/plugins/function.html_select_time.php
@@ -2,7 +2,7 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
@@ -17,21 +17,21 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
/**
* Smarty {html_select_time} function plugin
- *
* Type: function
* Name: html_select_time
* Purpose: Prints the dropdowns for time selection
*
- * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
- * (Smarty online manual)
- * @author Roberto Berto
- * @author Monte Ohrt
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
+ * (Smarty online manual)
+ * @author Roberto Berto
+ * @author Monte Ohrt
+ *
+ * @param array $params parameters
+ *
* @return string
- * @uses smarty_make_timestamp()
+ * @uses smarty_make_timestamp()
*/
-function smarty_function_html_select_time($params, $template)
+function smarty_function_html_select_time($params)
{
$prefix = "Time_";
$field_array = null;
@@ -151,7 +151,7 @@ function smarty_function_html_select_time($params, $template)
if (isset($params['time']) && is_array($params['time'])) {
if (isset($params['time'][$prefix . 'Hour'])) {
// $_REQUEST[$field_array] given
- foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
+ foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$prefix . $_elementName])
? $params['time'][$prefix . $_elementName]
@@ -160,11 +160,11 @@ function smarty_function_html_select_time($params, $template)
$_meridian = isset($params['time'][$prefix . 'Meridian'])
? (' ' . $params['time'][$prefix . 'Meridian'])
: '';
- $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );
+ $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
} elseif (isset($params['time'][$field_array][$prefix . 'Hour'])) {
// $_REQUEST given
- foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
+ foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
? $params['time'][$field_array][$prefix . $_elementName]
@@ -173,7 +173,7 @@ function smarty_function_html_select_time($params, $template)
$_meridian = isset($params['time'][$field_array][$prefix . 'Meridian'])
? (' ' . $params['time'][$field_array][$prefix . 'Meridian'])
: '';
- $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );
+ $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
} else {
// no date found, use NOW
@@ -204,8 +204,8 @@ function smarty_function_html_select_time($params, $template)
$_html_hours = '' . $option_separator;
if (isset($hour_empty) || isset($all_empty)) {
- $_html_hours .= '' . ( isset($hour_empty) ? $hour_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_hours .= '' . (isset($hour_empty) ? $hour_empty : $all_empty) . ' ' . $option_separator;
}
$start = $use_24_hours ? 0 : 1;
$end = $use_24_hours ? 23 : 12;
- for ($i=$start; $i <= $end; $i++) {
+ for ($i = $start; $i <= $end; $i ++) {
$_val = sprintf('%02d', $i);
$_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
$_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
@@ -226,7 +226,7 @@ function smarty_function_html_select_time($params, $template)
if (!$use_24_hours) {
$_hour12 = $_hour == 0
? 12
- : ($_hour <= 12 ? $_hour : $_hour -12);
+ : ($_hour <= 12 ? $_hour : $_hour - 12);
}
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
@@ -253,8 +253,8 @@ function smarty_function_html_select_time($params, $template)
$_html_minutes = '' . $option_separator;
if (isset($minute_empty) || isset($all_empty)) {
- $_html_minutes .= '' . ( isset($minute_empty) ? $minute_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_minutes .= '' . (isset($minute_empty) ? $minute_empty : $all_empty) . ' ' . $option_separator;
}
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
- for ($i=0; $i <= 59; $i += $minute_interval) {
+ for ($i = 0; $i <= 59; $i += $minute_interval) {
$_val = sprintf('%02d', $i);
$_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
$_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
@@ -293,8 +293,8 @@ function smarty_function_html_select_time($params, $template)
$_html_seconds = '' . $option_separator;
if (isset($second_empty) || isset($all_empty)) {
- $_html_seconds .= '' . ( isset($second_empty) ? $second_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_seconds .= '' . (isset($second_empty) ? $second_empty : $all_empty) . ' ' . $option_separator;
}
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
- for ($i=0; $i <= 59; $i += $second_interval) {
+ for ($i = 0; $i <= 59; $i += $second_interval) {
$_val = sprintf('%02d', $i);
$_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
$_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
@@ -333,8 +333,8 @@ function smarty_function_html_select_time($params, $template)
$_html_meridian = '' . $option_separator;
if (isset($meridian_empty) || isset($all_empty)) {
- $_html_meridian .= '' . ( isset($meridian_empty) ? $meridian_empty : $all_empty ) . ' ' . $option_separator;
+ $_html_meridian .= '' . (isset($meridian_empty) ? $meridian_empty : $all_empty) . ' ' . $option_separator;
}
- $_html_meridian .= ' 0 && $_hour < 12 ? ' selected="selected"' : '') .'>AM ' . $option_separator
- . 'PM ' . $option_separator
+ $_html_meridian .= ' 0 && $_hour < 12 ? ' selected="selected"' : '') . '>AM ' . $option_separator
+ . 'PM ' . $option_separator
. ' ';
}
diff --git a/libs/plugins/function.html_table.php b/libs/plugins/function.html_table.php
index 275f6c24..ec7ba48a 100644
--- a/libs/plugins/function.html_table.php
+++ b/libs/plugins/function.html_table.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_table} function plugin
- *
* Type: function
* Name: html_table
* Date: Feb 17, 2003
@@ -37,17 +36,18 @@
* {table loop=$data cols="first,second,third" tr_attr=$colors}
*
*
- * @author Monte Ohrt
- * @author credit to Messju Mohr
- * @author credit to boots
- * @version 1.1
- * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
- * (Smarty online manual)
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @author Monte Ohrt
+ * @author credit to Messju Mohr
+ * @author credit to boots
+ * @version 1.1
+ * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
+ * (Smarty online manual)
+ *
+ * @param array $params parameters
+ *
* @return string
*/
-function smarty_function_html_table($params, $template)
+function smarty_function_html_table($params)
{
$table_attr = 'border="1"';
$tr_attr = '';
@@ -63,7 +63,7 @@ function smarty_function_html_table($params, $template)
$loop = null;
if (!isset($params['loop'])) {
- trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING);
+ trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
return;
}
@@ -130,7 +130,7 @@ function smarty_function_html_table($params, $template)
$cols = ($hdir == 'right') ? $cols : array_reverse($cols);
$output .= "\n";
- for ($r = 0; $r < $cols_count; $r++) {
+ for ($r = 0; $r < $cols_count; $r ++) {
$output .= '';
$output .= $cols[$r];
$output .= " \n";
@@ -139,12 +139,12 @@ function smarty_function_html_table($params, $template)
}
$output .= " \n";
- for ($r = 0; $r < $rows; $r++) {
+ for ($r = 0; $r < $rows; $r ++) {
$output .= "\n";
- $rx = ($vdir == 'down') ? $r * $cols_count : ($rows-1 - $r) * $cols_count;
+ $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
- for ($c = 0; $c < $cols_count; $c++) {
- $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count-1 - $c;
+ for ($c = 0; $c < $cols_count; $c ++) {
+ $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
if ($inner != 'cols') {
/* shuffle x to loop over rows*/
$x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php
index ac94ae04..520fb7aa 100644
--- a/libs/plugins/function.mailto.php
+++ b/libs/plugins/function.mailto.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {mailto} function plugin
- *
* Type: function
* Name: mailto
* Date: May 21, 2002
@@ -39,22 +38,23 @@
* {mailto address="me@domain.com" extra='class="mailto"'}
*
*
- * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
- * (Smarty online manual)
- * @version 1.2
- * @author Monte Ohrt
- * @author credits to Jason Sweat (added cc, bcc and subject functionality)
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
+ * (Smarty online manual)
+ * @version 1.2
+ * @author Monte Ohrt
+ * @author credits to Jason Sweat (added cc, bcc and subject functionality)
+ *
+ * @param array $params parameters
+ *
* @return string
*/
-function smarty_function_mailto($params, $template)
+function smarty_function_mailto($params)
{
static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
$extra = '';
if (empty($params['address'])) {
- trigger_error("mailto: missing 'address' parameter",E_USER_WARNING);
+ trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
return;
} else {
@@ -72,8 +72,9 @@ function smarty_function_mailto($params, $template)
case 'cc':
case 'bcc':
case 'followupto':
- if (!empty($value))
- $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
+ if (!empty($value)) {
+ $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
+ }
break;
case 'subject':
@@ -104,7 +105,7 @@ function smarty_function_mailto($params, $template)
$string = 'document.write(\'' . $text . ' \');';
$js_encode = '';
- for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) {
$js_encode .= '%' . bin2hex($string[$x]);
}
@@ -112,7 +113,7 @@ function smarty_function_mailto($params, $template)
} elseif ($encode == 'javascript_charcode') {
$string = '' . $text . ' ';
- for ($x = 0, $y = strlen($string); $x < $y; $x++) {
+ for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
$ord[] = ord($string[$x]);
}
@@ -127,12 +128,12 @@ function smarty_function_mailto($params, $template)
} elseif ($encode == 'hex') {
preg_match('!^(.*)(\?.*)$!', $address, $match);
if (!empty($match[2])) {
- trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.",E_USER_WARNING);
+ trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
return;
}
$address_encode = '';
- for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) {
if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[$x])) {
$address_encode .= '%' . bin2hex($address[$x]);
} else {
@@ -140,7 +141,7 @@ function smarty_function_mailto($params, $template)
}
}
$text_encode = '';
- for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) {
$text_encode .= '' . bin2hex($text[$x]) . ';';
}
diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php
index 7bcc8acf..aba76e82 100644
--- a/libs/plugins/function.math.php
+++ b/libs/plugins/function.math.php
@@ -1,36 +1,37 @@
* Name: math
* Purpose: handle math computations in template
*
- * @link http://www.smarty.net/manual/en/language.function.math.php {math}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.math.php {math}
+ * (Smarty online manual)
* @author Monte Ohrt
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
function smarty_function_math($params, $template)
{
static $_allowed_funcs = array(
- 'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
- 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
- 'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true ,'tan' => true
+ 'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
+ 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
+ 'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true
);
// be sure equation parameter is present
if (empty($params['equation'])) {
- trigger_error("math: missing equation parameter",E_USER_WARNING);
+ trigger_error("math: missing equation parameter", E_USER_WARNING);
return;
}
@@ -38,18 +39,18 @@ function smarty_function_math($params, $template)
$equation = $params['equation'];
// make sure parenthesis are balanced
- if (substr_count($equation,"(") != substr_count($equation,")")) {
- trigger_error("math: unbalanced parenthesis",E_USER_WARNING);
+ if (substr_count($equation, "(") != substr_count($equation, ")")) {
+ trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
return;
}
// match all vars in equation, make sure all are passed
- preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
+ preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!", $equation, $match);
foreach ($match[1] as $curr_var) {
if ($curr_var && !isset($params[$curr_var]) && !isset($_allowed_funcs[$curr_var])) {
- trigger_error("math: function call $curr_var not allowed",E_USER_WARNING);
+ trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
return;
}
@@ -58,13 +59,13 @@ function smarty_function_math($params, $template)
foreach ($params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// make sure value is not empty
- if (strlen($val)==0) {
- trigger_error("math: parameter $key is empty",E_USER_WARNING);
+ if (strlen($val) == 0) {
+ trigger_error("math: parameter $key is empty", E_USER_WARNING);
return;
}
if (!is_numeric($val)) {
- trigger_error("math: parameter $key: is not numeric",E_USER_WARNING);
+ trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
return;
}
@@ -72,19 +73,19 @@ function smarty_function_math($params, $template)
}
}
$smarty_math_result = null;
- eval("\$smarty_math_result = ".$equation.";");
+ eval("\$smarty_math_result = " . $equation . ";");
if (empty($params['format'])) {
if (empty($params['assign'])) {
return $smarty_math_result;
} else {
- $template->assign($params['assign'],$smarty_math_result);
+ $template->assign($params['assign'], $smarty_math_result);
}
} else {
if (empty($params['assign'])) {
- printf($params['format'],$smarty_math_result);
+ printf($params['format'], $smarty_math_result);
} else {
- $template->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
+ $template->assign($params['assign'], sprintf($params['format'], $smarty_math_result));
}
}
}
diff --git a/libs/plugins/modifier.capitalize.php b/libs/plugins/modifier.capitalize.php
index c019df5f..a8ad7637 100644
--- a/libs/plugins/modifier.capitalize.php
+++ b/libs/plugins/modifier.capitalize.php
@@ -2,22 +2,21 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty capitalize modifier plugin
- *
* Type: modifier
* Name: capitalize
* Purpose: capitalize words in the string
- *
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
*
* @param string $string string to capitalize
* @param boolean $uc_digits also capitalize "x123" to "X123"
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
+ *
* @return string capitalized string
* @author Monte Ohrt
* @author Rodney Rehm
@@ -27,40 +26,40 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
if (Smarty::$_MBSTRING) {
if ($lc_rest) {
// uppercase (including hyphenated words)
- $upper_string = mb_convert_case( $string, MB_CASE_TITLE, Smarty::$_CHARSET );
+ $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
} else {
// uppercase word breaks
- $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
+ $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
}
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
- foreach($matches[1] as $match) {
+ foreach ($matches[1] as $match) {
$upper_string = substr_replace($upper_string, mb_strtolower($match[0], Smarty::$_CHARSET), $match[1], strlen($match[0]));
}
- }
+ }
}
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', $upper_string);
return $upper_string;
}
-
+
// lowercase first
if ($lc_rest) {
$string = strtolower($string);
}
// uppercase (including hyphenated words)
- $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
+ $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
- foreach($matches[1] as $match) {
+ foreach ($matches[1] as $match) {
$upper_string = substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0]));
}
- }
+ }
}
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', $upper_string);
return $upper_string;
-}
+}
/*
*
@@ -70,18 +69,22 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
*
* @author Kyle Renfrow
*/
-function smarty_mod_cap_mbconvert_cb($matches){
- return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[2]),MB_CASE_UPPER, Smarty::$_CHARSET);
+function smarty_mod_cap_mbconvert_cb($matches)
+{
+ return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[2]), MB_CASE_UPPER, Smarty::$_CHARSET);
}
-function smarty_mod_cap_mbconvert2_cb($matches){
- return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, Smarty::$_CHARSET);
+function smarty_mod_cap_mbconvert2_cb($matches)
+{
+ return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[3]), MB_CASE_UPPER, Smarty::$_CHARSET);
}
-function smarty_mod_cap_ucfirst_cb($matches){
- return stripslashes($matches[1]).ucfirst(stripslashes($matches[2]));
+function smarty_mod_cap_ucfirst_cb($matches)
+{
+ return stripslashes($matches[1]) . ucfirst(stripslashes($matches[2]));
}
-function smarty_mod_cap_ucfirst2_cb($matches){
- return stripslashes($matches[1]).ucfirst(stripslashes($matches[3]));
+function smarty_mod_cap_ucfirst2_cb($matches)
+{
+ return stripslashes($matches[1]) . ucfirst(stripslashes($matches[3]));
}
diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php
index e1a9d33e..5ad7540b 100644
--- a/libs/plugins/modifier.date_format.php
+++ b/libs/plugins/modifier.date_format.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty date_format modifier plugin
- *
* Type: modifier
* Name: date_format
* Purpose: format datestamps via strftime
@@ -17,23 +16,25 @@
* - format: strftime format for output
* - default_date: default date if $string is empty
*
- * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
* @author Monte Ohrt
+ *
* @param string $string input date string
* @param string $format strftime format for output
* @param string $default_date default date if $string is empty
* @param string $formatter either 'strftime' or 'auto'
+ *
* @return string |void
- * @uses smarty_make_timestamp()
+ * @uses smarty_make_timestamp()
*/
-function smarty_modifier_date_format($string, $format=null, $default_date='', $formatter='auto')
+function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
{
if ($format === null) {
$format = Smarty::$_DATE_FORMAT;
}
/**
- * Include the {@link shared.make_timestamp.php} plugin
- */
+ * Include the {@link shared.make_timestamp.php} plugin
+ */
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') {
$timestamp = smarty_make_timestamp($string);
@@ -42,7 +43,7 @@ function smarty_modifier_date_format($string, $format=null, $default_date='', $f
} else {
return;
}
- if ($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) {
+ if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
if (DS == '\\') {
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php
index ea63c8a7..66363d25 100644
--- a/libs/plugins/modifier.debug_print_var.php
+++ b/libs/plugins/modifier.debug_print_var.php
@@ -2,38 +2,39 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Debug
*/
/**
* Smarty debug_print_var modifier plugin
- *
* Type: modifier
* Name: debug_print_var
* Purpose: formats variable contents for display in the console
*
* @author Monte Ohrt
- * @param array|object $var variable to be formatted
- * @param integer $depth maximum recursion depth if $var is an array
- * @param integer $length maximum string length if $var is a string
+ *
+ * @param array|object $var variable to be formatted
+ * @param integer $depth maximum recursion depth if $var is an array
+ * @param integer $length maximum string length if $var is a string
+ *
* @return string
*/
-function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
+function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
{
$_replace = array("\n" => '\n ',
- "\r" => '\r ',
- "\t" => '\t '
- );
+ "\r" => '\r ',
+ "\t" => '\t '
+ );
switch (gettype($var)) {
case 'array' :
$results = 'Array (' . count($var) . ') ';
foreach ($var as $curr_key => $curr_val) {
$results .= ' ' . str_repeat(' ', $depth * 2)
- . '' . strtr($curr_key, $_replace) . ' => '
- . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
- $depth--;
+ . '' . strtr($curr_key, $_replace) . ' => '
+ . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+ $depth --;
}
break;
@@ -42,9 +43,9 @@ function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
$results = '' . get_class($var) . ' Object (' . count($object_vars) . ') ';
foreach ($object_vars as $curr_key => $curr_val) {
$results .= ' ' . str_repeat(' ', $depth * 2)
- . ' ->' . strtr($curr_key, $_replace) . ' = '
- . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
- $depth--;
+ . ' ->' . strtr($curr_key, $_replace) . ' = '
+ . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+ $depth --;
}
break;
diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php
index bc8ad42a..f2537260 100644
--- a/libs/plugins/modifier.escape.php
+++ b/libs/plugins/modifier.escape.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty escape modifier plugin
- *
* Type: modifier
* Name: escape
* Purpose: escape string for output
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
* @author Monte Ohrt
+ *
* @param string $string input string
* @param string $esc_type escape type
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
+ *
* @return string escaped input string
*/
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
@@ -105,7 +106,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
// Note that the UTF-8 encoded character ä will be represented as %c3%a4
$return = '';
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '%' . bin2hex($string[$x]);
}
@@ -124,7 +125,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
}
// no MBString fallback
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '' . bin2hex($string[$x]) . ';';
}
@@ -143,7 +144,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
}
// no MBString fallback
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '' . ord($string[$x]) . ';';
}
@@ -179,7 +180,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
}
$_length = strlen($string);
- for ($_i = 0; $_i < $_length; $_i++) {
+ for ($_i = 0; $_i < $_length; $_i ++) {
$_ord = ord(substr($string, $_i, 1));
// non-standard char, escape it
if ($_ord >= 126) {
diff --git a/libs/plugins/modifier.regex_replace.php b/libs/plugins/modifier.regex_replace.php
index a44afb5f..abb1ff54 100644
--- a/libs/plugins/modifier.regex_replace.php
+++ b/libs/plugins/modifier.regex_replace.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty regex_replace modifier plugin
- *
* Type: modifier
* Name: regex_replace
* Purpose: regular expression search/replace
*
- * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
* regex_replace (Smarty online manual)
- * @author Monte Ohrt
- * @param string $string input string
- * @param string|array $search regular expression(s) to search for
- * @param string|array $replace string(s) that should be replaced
+ * @author Monte Ohrt
+ *
+ * @param string $string input string
+ * @param string|array $search regular expression(s) to search for
+ * @param string|array $replace string(s) that should be replaced
+ *
* @return string
*/
function smarty_modifier_regex_replace($string, $search, $replace)
@@ -36,6 +37,7 @@ function smarty_modifier_regex_replace($string, $search, $replace)
/**
* @param string $search string(s) that should be replaced
+ *
* @return string
* @ignore
*/
@@ -43,12 +45,12 @@ function _smarty_regex_replace_check($search)
{
// null-byte injection detection
// anything behind the first null-byte is ignored
- if (($pos = strpos($search,"\0")) !== false) {
- $search = substr($search,0,$pos);
+ if (($pos = strpos($search, "\0")) !== false) {
+ $search = substr($search, 0, $pos);
}
// remove eval-modifier from $search
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
- $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
+ $search = substr($search, 0, - strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
}
return $search;
diff --git a/libs/plugins/modifier.replace.php b/libs/plugins/modifier.replace.php
index cf4f6459..aa5e8570 100644
--- a/libs/plugins/modifier.replace.php
+++ b/libs/plugins/modifier.replace.php
@@ -1,23 +1,25 @@
* Name: replace
* Purpose: simple search/replace
*
- * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
* @author Monte Ohrt
* @author Uwe Tews
+ *
* @param string $string input string
* @param string $search text to search for
* @param string $replace replacement text
+ *
* @return string
*/
function smarty_modifier_replace($string, $search, $replace)
diff --git a/libs/plugins/modifier.spacify.php b/libs/plugins/modifier.spacify.php
index 1a5f425a..e5c41ad8 100644
--- a/libs/plugins/modifier.spacify.php
+++ b/libs/plugins/modifier.spacify.php
@@ -1,25 +1,27 @@
* Name: spacify
* Purpose: add spaces between characters in a string
*
- * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
* @author Monte Ohrt
+ *
* @param string $string input string
* @param string $spacify_char string to insert between characters.
+ *
* @return string
*/
function smarty_modifier_spacify($string, $spacify_char = ' ')
{
// well… what about charsets besides latin and UTF-8?
- return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
+ return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY));
}
diff --git a/libs/plugins/modifier.truncate.php b/libs/plugins/modifier.truncate.php
index e2810ed7..fbe62e82 100644
--- a/libs/plugins/modifier.truncate.php
+++ b/libs/plugins/modifier.truncate.php
@@ -2,32 +2,34 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty truncate modifier plugin
- *
* Type: modifier
* Name: truncate
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
*
- * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
* @author Monte Ohrt
+ *
* @param string $string input string
* @param integer $length length of truncated text
* @param string $etc end string
* @param boolean $break_words truncate at word boundary
* @param boolean $middle truncate in the middle of text
+ *
* @return string truncated string
*/
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
{
- if ($length == 0)
+ if ($length == 0) {
return '';
+ }
if (Smarty::$_MBSTRING) {
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
diff --git a/libs/plugins/modifiercompiler.cat.php b/libs/plugins/modifiercompiler.cat.php
index 5dff7474..db9d81fb 100644
--- a/libs/plugins/modifiercompiler.cat.php
+++ b/libs/plugins/modifiercompiler.cat.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty cat modifier plugin
- *
* Type: modifier
* Name: cat
* Date: Feb 24, 2003
@@ -16,13 +15,15 @@
* Input: string to catenate
* Example: {$var|cat:"foo"}
*
- * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
- * (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ * (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_cat($params, $compiler)
+function smarty_modifiercompiler_cat($params)
{
- return '('.implode(').(', $params).')';
+ return '(' . implode(').(', $params) . ')';
}
diff --git a/libs/plugins/modifiercompiler.count_characters.php b/libs/plugins/modifiercompiler.count_characters.php
index 778d0385..f8463d80 100644
--- a/libs/plugins/modifiercompiler.count_characters.php
+++ b/libs/plugins/modifiercompiler.count_characters.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty count_characters modifier plugin
- *
* Type: modifier
* Name: count_characteres
* Purpose: count the number of characters in a text
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_count_characters($params, $compiler)
+function smarty_modifiercompiler_count_characters($params)
{
if (!isset($params[1]) || $params[1] != 'true') {
return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
diff --git a/libs/plugins/modifiercompiler.count_paragraphs.php b/libs/plugins/modifiercompiler.count_paragraphs.php
index 581d291c..34f0bbb8 100644
--- a/libs/plugins/modifiercompiler.count_paragraphs.php
+++ b/libs/plugins/modifiercompiler.count_paragraphs.php
@@ -2,24 +2,25 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty count_paragraphs modifier plugin
- *
* Type: modifier
* Name: count_paragraphs
* Purpose: count the number of paragraphs in a text
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* count_paragraphs (Smarty online manual)
- * @author Uwe Tews
+ * @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_count_paragraphs($params, $compiler)
+function smarty_modifiercompiler_count_paragraphs($params)
{
// count \r or \n characters
return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
diff --git a/libs/plugins/modifiercompiler.count_sentences.php b/libs/plugins/modifiercompiler.count_sentences.php
index 5cb0f2ae..f1ec5600 100644
--- a/libs/plugins/modifiercompiler.count_sentences.php
+++ b/libs/plugins/modifiercompiler.count_sentences.php
@@ -2,24 +2,25 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty count_sentences modifier plugin
- *
* Type: modifier
* Name: count_sentences
* Purpose: count the number of sentences in a text
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* count_sentences (Smarty online manual)
- * @author Uwe Tews
+ * @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_count_sentences($params, $compiler)
+function smarty_modifiercompiler_count_sentences($params)
{
// find periods, question marks, exclamation marks with a word before but not after.
return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
diff --git a/libs/plugins/modifiercompiler.count_words.php b/libs/plugins/modifiercompiler.count_words.php
index 9146900d..8b4330f1 100644
--- a/libs/plugins/modifiercompiler.count_words.php
+++ b/libs/plugins/modifiercompiler.count_words.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty count_words modifier plugin
- *
* Type: modifier
* Name: count_words
* Purpose: count the number of words in a text
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
-*/
-function smarty_modifiercompiler_count_words($params, $compiler)
+ */
+function smarty_modifiercompiler_count_words($params)
{
if (Smarty::$_MBSTRING) {
// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
diff --git a/libs/plugins/modifiercompiler.default.php b/libs/plugins/modifiercompiler.default.php
index 83b3f365..fe777623 100644
--- a/libs/plugins/modifiercompiler.default.php
+++ b/libs/plugins/modifiercompiler.default.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty default modifier plugin
- *
* Type: modifier
* Name: default
* Purpose: designate default value for empty variables
*
- * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_default ($params, $compiler)
+function smarty_modifiercompiler_default($params)
{
$output = $params[0];
if (!isset($params[1])) {
diff --git a/libs/plugins/modifiercompiler.escape.php b/libs/plugins/modifiercompiler.escape.php
index 6c6a356a..7e848aae 100644
--- a/libs/plugins/modifiercompiler.escape.php
+++ b/libs/plugins/modifiercompiler.escape.php
@@ -2,25 +2,27 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* @ignore
*/
-require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );
+require_once(SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php');
/**
* Smarty escape modifier plugin
- *
* Type: modifier
* Name: escape
* Purpose: escape string for output
*
- * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
+ * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
* @author Rodney Rehm
+ *
* @param array $params parameters
+ * @param $compiler
+ *
* @return string with compiled code
*/
function smarty_modifiercompiler_escape($params, $compiler)
@@ -43,13 +45,13 @@ function smarty_modifiercompiler_escape($params, $compiler)
case 'html':
if ($_double_encode) {
return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
} elseif ($double_encode) {
return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
} else {
// fall back to modifier.escape.php
}
@@ -59,18 +61,18 @@ function smarty_modifiercompiler_escape($params, $compiler)
if ($_double_encode) {
// php >=5.2.3 - go native
return 'mb_convert_encoding(htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true)
- . '), "HTML-ENTITIES", '
- . var_export($char_set, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
} elseif ($double_encode) {
// php <5.2.3 - only handle double encoding
return 'mb_convert_encoding(htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true)
- . '), "HTML-ENTITIES", '
- . var_export($char_set, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
} else {
// fall back to modifier.escape.php
}
@@ -80,14 +82,14 @@ function smarty_modifiercompiler_escape($params, $compiler)
if ($_double_encode) {
// php >=5.2.3 - go native
return 'htmlentities('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
} elseif ($double_encode) {
// php <5.2.3 - only handle double encoding
return 'htmlentities('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
} else {
// fall back to modifier.escape.php
}
@@ -105,20 +107,20 @@ function smarty_modifiercompiler_escape($params, $compiler)
case 'javascript':
// escape quotes and backslashes, newlines, etc.
return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "" => "<\/" ))';
-
}
- } catch (SmartyException $e) {
+ }
+ catch (SmartyException $e) {
// pass through to regular plugin fallback
}
// could not optimize |escape call, so fallback to regular plugin
if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
- $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
+ $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
$compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
} else {
- $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
+ $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
$compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
}
- return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';
+ return 'smarty_modifier_escape(' . join(', ', $params) . ')';
}
diff --git a/libs/plugins/modifiercompiler.from_charset.php b/libs/plugins/modifiercompiler.from_charset.php
index 1dfee367..dab43e9c 100644
--- a/libs/plugins/modifiercompiler.from_charset.php
+++ b/libs/plugins/modifiercompiler.from_charset.php
@@ -2,22 +2,23 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty from_charset modifier plugin
- *
* Type: modifier
* Name: from_charset
* Purpose: convert character encoding from $charset to internal encoding
*
* @author Rodney Rehm
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_from_charset($params, $compiler)
+function smarty_modifiercompiler_from_charset($params)
{
if (!Smarty::$_MBSTRING) {
// FIXME: (rodneyrehm) shouldn't this throw an error?
diff --git a/libs/plugins/modifiercompiler.indent.php b/libs/plugins/modifiercompiler.indent.php
index 85bc6105..e3ca2082 100644
--- a/libs/plugins/modifiercompiler.indent.php
+++ b/libs/plugins/modifiercompiler.indent.php
@@ -1,24 +1,26 @@
* Name: indent
* Purpose: indent lines of text
*
- * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_indent($params, $compiler)
+function smarty_modifiercompiler_indent($params)
{
if (!isset($params[1])) {
$params[1] = 4;
diff --git a/libs/plugins/modifiercompiler.lower.php b/libs/plugins/modifiercompiler.lower.php
index b1a23186..1d255f37 100644
--- a/libs/plugins/modifiercompiler.lower.php
+++ b/libs/plugins/modifiercompiler.lower.php
@@ -1,28 +1,30 @@
* Name: lower
* Purpose: convert string to lowercase
*
- * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
* @author Monte Ohrt
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_lower($params, $compiler)
+function smarty_modifiercompiler_lower($params)
{
if (Smarty::$_MBSTRING) {
- return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
+ return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
}
// no MBString fallback
return 'strtolower(' . $params[0] . ')';
diff --git a/libs/plugins/modifiercompiler.noprint.php b/libs/plugins/modifiercompiler.noprint.php
index 71f6bfae..4906908b 100644
--- a/libs/plugins/modifiercompiler.noprint.php
+++ b/libs/plugins/modifiercompiler.noprint.php
@@ -2,22 +2,20 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty noprint modifier plugin
- *
* Type: modifier
* Name: noprint
* Purpose: return an empty string
*
* @author Uwe Tews
- * @param array $params parameters
* @return string with compiled code
*/
-function smarty_modifiercompiler_noprint($params, $compiler)
+function smarty_modifiercompiler_noprint()
{
return "''";
}
diff --git a/libs/plugins/modifiercompiler.string_format.php b/libs/plugins/modifiercompiler.string_format.php
index defbf6e2..71cdf281 100644
--- a/libs/plugins/modifiercompiler.string_format.php
+++ b/libs/plugins/modifiercompiler.string_format.php
@@ -2,23 +2,24 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty string_format modifier plugin
- *
* Type: modifier
* Name: string_format
* Purpose: format strings via sprintf
*
- * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_string_format($params, $compiler)
+function smarty_modifiercompiler_string_format($params)
{
return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
}
diff --git a/libs/plugins/modifiercompiler.strip.php b/libs/plugins/modifiercompiler.strip.php
index 6c732e81..fcd6cbae 100644
--- a/libs/plugins/modifiercompiler.strip.php
+++ b/libs/plugins/modifiercompiler.strip.php
@@ -2,13 +2,12 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty strip modifier plugin
- *
* Type: modifier
* Name: strip
* Purpose: Replace all repeated spaces, newlines, tabs
@@ -16,13 +15,15 @@
* Example: {$var|strip} {$var|strip:" "}
* Date: September 25th, 2002
*
- * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_strip($params, $compiler)
+function smarty_modifiercompiler_strip($params)
{
if (!isset($params[1])) {
$params[1] = "' '";
diff --git a/libs/plugins/modifiercompiler.strip_tags.php b/libs/plugins/modifiercompiler.strip_tags.php
index bc5eab26..3e6e1304 100644
--- a/libs/plugins/modifiercompiler.strip_tags.php
+++ b/libs/plugins/modifiercompiler.strip_tags.php
@@ -2,26 +2,27 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty strip_tags modifier plugin
- *
* Type: modifier
* Name: strip_tags
* Purpose: strip html tags from text
*
- * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_strip_tags($params, $compiler)
+function smarty_modifiercompiler_strip_tags($params)
{
- if (!isset($params[1]) || $params[1] === true || trim($params[1],'"') == 'true') {
- return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
+ if (!isset($params[1]) || $params[1] === true || trim($params[1], '"') == 'true') {
+ return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
} else {
return 'strip_tags(' . $params[0] . ')';
}
diff --git a/libs/plugins/modifiercompiler.to_charset.php b/libs/plugins/modifiercompiler.to_charset.php
index af75779a..9122d8bb 100644
--- a/libs/plugins/modifiercompiler.to_charset.php
+++ b/libs/plugins/modifiercompiler.to_charset.php
@@ -2,22 +2,23 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty to_charset modifier plugin
- *
* Type: modifier
* Name: to_charset
* Purpose: convert character encoding from internal encoding to $charset
*
* @author Rodney Rehm
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_to_charset($params, $compiler)
+function smarty_modifiercompiler_to_charset($params)
{
if (!Smarty::$_MBSTRING) {
// FIXME: (rodneyrehm) shouldn't this throw an error?
diff --git a/libs/plugins/modifiercompiler.unescape.php b/libs/plugins/modifiercompiler.unescape.php
index 19474fcb..3b17ea2e 100644
--- a/libs/plugins/modifiercompiler.unescape.php
+++ b/libs/plugins/modifiercompiler.unescape.php
@@ -2,22 +2,23 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty unescape modifier plugin
- *
* Type: modifier
* Name: unescape
* Purpose: unescape html entities
*
* @author Rodney Rehm
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_unescape($params, $compiler)
+function smarty_modifiercompiler_unescape($params)
{
if (!isset($params[1])) {
$params[1] = 'html';
diff --git a/libs/plugins/modifiercompiler.upper.php b/libs/plugins/modifiercompiler.upper.php
index f10ed187..52ca4e8f 100644
--- a/libs/plugins/modifiercompiler.upper.php
+++ b/libs/plugins/modifiercompiler.upper.php
@@ -2,26 +2,27 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty upper modifier plugin
- *
* Type: modifier
* Name: lower
* Purpose: convert string to uppercase
*
- * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ *
* @return string with compiled code
*/
-function smarty_modifiercompiler_upper($params, $compiler)
+function smarty_modifiercompiler_upper($params)
{
if (Smarty::$_MBSTRING) {
- return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
+ return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
}
// no MBString fallback
return 'strtoupper(' . $params[0] . ')';
diff --git a/libs/plugins/modifiercompiler.wordwrap.php b/libs/plugins/modifiercompiler.wordwrap.php
index 39312b41..2ad928ea 100644
--- a/libs/plugins/modifiercompiler.wordwrap.php
+++ b/libs/plugins/modifiercompiler.wordwrap.php
@@ -2,20 +2,22 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty wordwrap modifier plugin
- *
* Type: modifier
* Name: wordwrap
* Purpose: wrap a string of text at a given length
*
- * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
* @author Uwe Tews
+ *
* @param array $params parameters
+ * @param $compiler
+ *
* @return string with compiled code
*/
function smarty_modifiercompiler_wordwrap($params, $compiler)
@@ -31,11 +33,11 @@ function smarty_modifiercompiler_wordwrap($params, $compiler)
}
$function = 'wordwrap';
if (Smarty::$_MBSTRING) {
- if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
+ if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
+ $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
$compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
} else {
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
+ $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
$compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
}
$function = 'smarty_mb_wordwrap';
diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php
index 9da7f3db..62ab4e77 100644
--- a/libs/plugins/outputfilter.trimwhitespace.php
+++ b/libs/plugins/outputfilter.trimwhitespace.php
@@ -2,22 +2,22 @@
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFilter
*/
/**
* Smarty trimwhitespace outputfilter plugin
- *
* Trim unnecessary whitespace from HTML markup.
*
* @author Rodney Rehm
- * @param string $source input string
- * @param Smarty_Internal_Template $smarty Smarty object
+ *
+ * @param string $source input string
+ *
* @return string filtered output
- * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
+ * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
*/
-function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)
+function smarty_outputfilter_trimwhitespace($source)
{
$store = array();
$_store = 0;
@@ -35,13 +35,13 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s
$source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
$_offset += $_length - strlen($replace);
- $_store++;
+ $_store ++;
}
}
// Strip all HTML-Comments
// yes, even the ones in