diff options
Diffstat (limited to '')
18 files changed, 668 insertions, 668 deletions
diff --git a/include/smarty/libs/plugins/modifiercompiler.cat.php b/include/smarty/libs/plugins/modifiercompiler.cat.php index 1cfe6308a..5049c63e5 100644 --- a/include/smarty/libs/plugins/modifiercompiler.cat.php +++ b/include/smarty/libs/plugins/modifiercompiler.cat.php @@ -1,30 +1,30 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty cat modifier plugin
- *
- * Type: modifier<br>
- * Name: cat<br>
- * Date: Feb 24, 2003<br>
- * Purpose: catenate a value to a variable<br>
- * Input: string to catenate<br>
- * Example: {$var|cat:"foo"}
- *
- * @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)
-{
- return '('.implode(').(', $params).')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty cat modifier plugin + * + * Type: modifier<br> + * Name: cat<br> + * Date: Feb 24, 2003<br> + * Purpose: catenate a value to a variable<br> + * Input: string to catenate<br> + * Example: {$var|cat:"foo"} + * + * @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) +{ + return '('.implode(').(', $params).')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.count_characters.php b/include/smarty/libs/plugins/modifiercompiler.count_characters.php index 98e8efa0d..0f269c9fa 100644 --- a/include/smarty/libs/plugins/modifiercompiler.count_characters.php +++ b/include/smarty/libs/plugins/modifiercompiler.count_characters.php @@ -1,33 +1,33 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_characters modifier plugin
- *
- * Type: modifier<br>
- * Name: count_characteres<br>
- * 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)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_characters($params, $compiler)
-{
- if (!isset($params[1]) || $params[1] != 'true') {
- return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
- }
- if (Smarty::$_MBSTRING) {
- return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
- }
- // no MBString fallback
- return 'strlen(' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty count_characters modifier plugin + * + * Type: modifier<br> + * Name: count_characteres<br> + * 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) + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_count_characters($params, $compiler) +{ + if (!isset($params[1]) || $params[1] != 'true') { + return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)'; + } + if (Smarty::$_MBSTRING) { + return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')'; + } + // no MBString fallback + return 'strlen(' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php b/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php index 0e1b0af83..853f98f46 100644 --- a/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php +++ b/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php @@ -1,28 +1,28 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_paragraphs modifier plugin
- *
- * Type: modifier<br>
- * Name: count_paragraphs<br>
- * Purpose: count the number of paragraphs in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- * count_paragraphs (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_paragraphs($params, $compiler)
-{
- // count \r or \n characters
- return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty count_paragraphs modifier plugin + * + * Type: modifier<br> + * Name: count_paragraphs<br> + * Purpose: count the number of paragraphs in a text + * + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * count_paragraphs (Smarty online manual) + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_count_paragraphs($params, $compiler) +{ + // count \r or \n characters + return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.count_sentences.php b/include/smarty/libs/plugins/modifiercompiler.count_sentences.php index 2f517be96..f8d79b3f2 100644 --- a/include/smarty/libs/plugins/modifiercompiler.count_sentences.php +++ b/include/smarty/libs/plugins/modifiercompiler.count_sentences.php @@ -1,28 +1,28 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_sentences modifier plugin
- *
- * Type: modifier<br>
- * Name: count_sentences
- * Purpose: count the number of sentences in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- * count_sentences (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_sentences($params, $compiler)
-{
- // 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)';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty count_sentences modifier plugin + * + * Type: modifier<br> + * Name: count_sentences + * Purpose: count the number of sentences in a text + * + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * count_sentences (Smarty online manual) + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_count_sentences($params, $compiler) +{ + // 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)'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.count_words.php b/include/smarty/libs/plugins/modifiercompiler.count_words.php index e05738c01..f53443e24 100644 --- a/include/smarty/libs/plugins/modifiercompiler.count_words.php +++ b/include/smarty/libs/plugins/modifiercompiler.count_words.php @@ -1,32 +1,32 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_words modifier plugin
- *
- * Type: modifier<br>
- * Name: count_words<br>
- * 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)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
-*/
-function smarty_modifiercompiler_count_words($params, $compiler)
-{
- if (Smarty::$_MBSTRING) {
- // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
- // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
- return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
- }
- // no MBString fallback
- return 'str_word_count(' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty count_words modifier plugin + * + * Type: modifier<br> + * Name: count_words<br> + * 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) + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code +*/ +function smarty_modifiercompiler_count_words($params, $compiler) +{ + if (Smarty::$_MBSTRING) { + // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)'; + // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592 + return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)'; + } + // no MBString fallback + return 'str_word_count(' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.default.php b/include/smarty/libs/plugins/modifiercompiler.default.php index 4f831a589..3554964e4 100644 --- a/include/smarty/libs/plugins/modifiercompiler.default.php +++ b/include/smarty/libs/plugins/modifiercompiler.default.php @@ -1,35 +1,35 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty default modifier plugin
- *
- * Type: modifier<br>
- * Name: default<br>
- * Purpose: designate default value for empty variables
- *
- * @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)
-{
- $output = $params[0];
- if (!isset($params[1])) {
- $params[1] = "''";
- }
-
- array_shift($params);
- foreach ($params as $param) {
- $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
- }
- return $output;
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty default modifier plugin + * + * Type: modifier<br> + * Name: default<br> + * Purpose: designate default value for empty variables + * + * @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) +{ + $output = $params[0]; + if (!isset($params[1])) { + $params[1] = "''"; + } + + array_shift($params); + foreach ($params as $param) { + $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)'; + } + return $output; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.escape.php b/include/smarty/libs/plugins/modifiercompiler.escape.php index f50028bd9..d38d12975 100644 --- a/include/smarty/libs/plugins/modifiercompiler.escape.php +++ b/include/smarty/libs/plugins/modifiercompiler.escape.php @@ -1,125 +1,125 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * @ignore
- */
-require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );
-
-/**
- * Smarty escape modifier plugin
- *
- * Type: modifier<br>
- * Name: escape<br>
- * Purpose: escape string for output
- *
- * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_escape($params, $compiler)
-{
- static $_double_encode = null;
- if ($_double_encode === null) {
- $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
- }
-
- try {
- $esc_type = smarty_literal_compiler_param($params, 1, 'html');
- $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
- $double_encode = smarty_literal_compiler_param($params, 3, true);
-
- if (!$char_set) {
- $char_set = Smarty::$_CHARSET;
- }
-
- switch ($esc_type) {
- case 'html':
- if ($_double_encode) {
- return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true) . ')';
- } else if ($double_encode) {
- return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
- } else {
- // fall back to modifier.escape.php
- }
-
- case 'htmlall':
- if (Smarty::$_MBSTRING) {
- 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) . ')';
- } else if ($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) . ')';
- } else {
- // fall back to modifier.escape.php
- }
- }
-
- // no MBString fallback
- 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) . ')';
- } else if ($double_encode) {
- // php <5.2.3 - only handle double encoding
- return 'htmlentities('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
- } else {
- // fall back to modifier.escape.php
- }
-
- case 'url':
- return 'rawurlencode(' . $params[0] . ')';
-
- case 'urlpathinfo':
- return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';
-
- case 'quotes':
- // escape unescaped single quotes
- return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';
-
- case 'javascript':
- // escape quotes and backslashes, newlines, etc.
- return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
-
- }
- } catch(SmartyException $e) {
- // pass through to regular plugin fallback
- }
-
- // could not optimize |escape call, so fallback to regular plugin
- if ($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']['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']['function'] = 'smarty_modifier_escape';
- }
- return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * @ignore + */ +require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' ); + +/** + * Smarty escape modifier plugin + * + * Type: modifier<br> + * Name: escape<br> + * Purpose: escape string for output + * + * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) + * @author Rodney Rehm + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_escape($params, $compiler) +{ + static $_double_encode = null; + if ($_double_encode === null) { + $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); + } + + try { + $esc_type = smarty_literal_compiler_param($params, 1, 'html'); + $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET); + $double_encode = smarty_literal_compiler_param($params, 3, true); + + if (!$char_set) { + $char_set = Smarty::$_CHARSET; + } + + switch ($esc_type) { + case 'html': + if ($_double_encode) { + return 'htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ', ' + . var_export($double_encode, true) . ')'; + } else if ($double_encode) { + return 'htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } + + case 'htmlall': + if (Smarty::$_MBSTRING) { + 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) . ')'; + } else if ($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) . ')'; + } else { + // fall back to modifier.escape.php + } + } + + // no MBString fallback + 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) . ')'; + } else if ($double_encode) { + // php <5.2.3 - only handle double encoding + return 'htmlentities(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } + + case 'url': + return 'rawurlencode(' . $params[0] . ')'; + + case 'urlpathinfo': + return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))'; + + case 'quotes': + // escape unescaped single quotes + return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')'; + + case 'javascript': + // escape quotes and backslashes, newlines, etc. + return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))'; + + } + } catch(SmartyException $e) { + // pass through to regular plugin fallback + } + + // could not optimize |escape call, so fallback to regular plugin + if ($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']['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']['function'] = 'smarty_modifier_escape'; + } + return 'smarty_modifier_escape(' . join( ', ', $params ) . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.from_charset.php b/include/smarty/libs/plugins/modifiercompiler.from_charset.php index 93b568a5a..5d6b7889a 100644 --- a/include/smarty/libs/plugins/modifiercompiler.from_charset.php +++ b/include/smarty/libs/plugins/modifiercompiler.from_charset.php @@ -1,34 +1,34 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty from_charset modifier plugin
- *
- * Type: modifier<br>
- * Name: from_charset<br>
- * 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)
-{
- if (!Smarty::$_MBSTRING) {
- // FIXME: (rodneyrehm) shouldn't this throw an error?
- return $params[0];
- }
-
- if (!isset($params[1])) {
- $params[1] = '"ISO-8859-1"';
- }
-
- return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty from_charset modifier plugin + * + * Type: modifier<br> + * Name: from_charset<br> + * 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) +{ + if (!Smarty::$_MBSTRING) { + // FIXME: (rodneyrehm) shouldn't this throw an error? + return $params[0]; + } + + if (!isset($params[1])) { + $params[1] = '"ISO-8859-1"'; + } + + return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.indent.php b/include/smarty/libs/plugins/modifiercompiler.indent.php index 020c4fdb3..26094b7ca 100644 --- a/include/smarty/libs/plugins/modifiercompiler.indent.php +++ b/include/smarty/libs/plugins/modifiercompiler.indent.php @@ -1,32 +1,32 @@ -<?php
-/**
- * Smarty plugin
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty indent modifier plugin
- *
- * Type: modifier<br>
- * Name: indent<br>
- * Purpose: indent lines of text
- *
- * @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)
-{
- if (!isset($params[1])) {
- $params[1] = 4;
- }
- if (!isset($params[2])) {
- $params[2] = "' '";
- }
- return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty indent modifier plugin + * + * Type: modifier<br> + * Name: indent<br> + * Purpose: indent lines of text + * + * @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) +{ + if (!isset($params[1])) { + $params[1] = 4; + } + if (!isset($params[2])) { + $params[2] = "' '"; + } + return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.lower.php b/include/smarty/libs/plugins/modifiercompiler.lower.php index 1845cc1d2..bc3abd727 100644 --- a/include/smarty/libs/plugins/modifiercompiler.lower.php +++ b/include/smarty/libs/plugins/modifiercompiler.lower.php @@ -1,31 +1,31 @@ -<?php
-/**
- * Smarty plugin
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty lower modifier plugin
- *
- * Type: modifier<br>
- * Name: lower<br>
- * Purpose: convert string to lowercase
- *
- * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-
-function smarty_modifiercompiler_lower($params, $compiler)
-{
- if (Smarty::$_MBSTRING) {
- return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
- }
- // no MBString fallback
- return 'strtolower(' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty lower modifier plugin + * + * Type: modifier<br> + * Name: lower<br> + * Purpose: convert string to lowercase + * + * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ + +function smarty_modifiercompiler_lower($params, $compiler) +{ + if (Smarty::$_MBSTRING) { + return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ; + } + // no MBString fallback + return 'strtolower(' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.noprint.php b/include/smarty/libs/plugins/modifiercompiler.noprint.php index 3ca26571a..d7433e985 100644 --- a/include/smarty/libs/plugins/modifiercompiler.noprint.php +++ b/include/smarty/libs/plugins/modifiercompiler.noprint.php @@ -1,25 +1,25 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty noprint modifier plugin
- *
- * Type: modifier<br>
- * Name: noprint<br>
- * Purpose: return an empty string
- *
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_noprint($params, $compiler)
-{
- return "''";
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty noprint modifier plugin + * + * Type: modifier<br> + * Name: noprint<br> + * Purpose: return an empty string + * + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_noprint($params, $compiler) +{ + return "''"; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.string_format.php b/include/smarty/libs/plugins/modifiercompiler.string_format.php index 83345977b..5a8d43578 100644 --- a/include/smarty/libs/plugins/modifiercompiler.string_format.php +++ b/include/smarty/libs/plugins/modifiercompiler.string_format.php @@ -1,26 +1,26 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty string_format modifier plugin
- *
- * Type: modifier<br>
- * Name: string_format<br>
- * Purpose: format strings via sprintf
- *
- * @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)
-{
- return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty string_format modifier plugin + * + * Type: modifier<br> + * Name: string_format<br> + * Purpose: format strings via sprintf + * + * @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) +{ + return 'sprintf(' . $params[1] . ',' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.strip.php b/include/smarty/libs/plugins/modifiercompiler.strip.php index f1d5db045..8d15ca434 100644 --- a/include/smarty/libs/plugins/modifiercompiler.strip.php +++ b/include/smarty/libs/plugins/modifiercompiler.strip.php @@ -1,33 +1,33 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty strip modifier plugin
- *
- * Type: modifier<br>
- * Name: strip<br>
- * Purpose: Replace all repeated spaces, newlines, tabs
- * with a single space or supplied replacement string.<br>
- * Example: {$var|strip} {$var|strip:" "}<br>
- * Date: September 25th, 2002
- *
- * @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)
-{
- if (!isset($params[1])) {
- $params[1] = "' '";
- }
- return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty strip modifier plugin + * + * Type: modifier<br> + * Name: strip<br> + * Purpose: Replace all repeated spaces, newlines, tabs + * with a single space or supplied replacement string.<br> + * Example: {$var|strip} {$var|strip:" "}<br> + * Date: September 25th, 2002 + * + * @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) +{ + if (!isset($params[1])) { + $params[1] = "' '"; + } + return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})"; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php index 296a3a2da..9ba71e3d9 100644 --- a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php +++ b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php @@ -1,33 +1,33 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty strip_tags modifier plugin
- *
- * Type: modifier<br>
- * Name: strip_tags<br>
- * Purpose: strip html tags from text
- *
- * @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)
-{
- if (!isset($params[1])) {
- $params[1] = true;
- }
- if ($params[1] === true) {
- return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
- } else {
- return 'strip_tags(' . $params[0] . ')';
- }
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty strip_tags modifier plugin + * + * Type: modifier<br> + * Name: strip_tags<br> + * Purpose: strip html tags from text + * + * @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) +{ + if (!isset($params[1])) { + $params[1] = true; + } + if ($params[1] === true) { + return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})"; + } else { + return 'strip_tags(' . $params[0] . ')'; + } +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.to_charset.php b/include/smarty/libs/plugins/modifiercompiler.to_charset.php index f5cdf455f..d6c0f296b 100644 --- a/include/smarty/libs/plugins/modifiercompiler.to_charset.php +++ b/include/smarty/libs/plugins/modifiercompiler.to_charset.php @@ -1,34 +1,34 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty to_charset modifier plugin
- *
- * Type: modifier<br>
- * Name: to_charset<br>
- * 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)
-{
- if (!Smarty::$_MBSTRING) {
- // FIXME: (rodneyrehm) shouldn't this throw an error?
- return $params[0];
- }
-
- if (!isset($params[1])) {
- $params[1] = '"ISO-8859-1"';
- }
-
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty to_charset modifier plugin + * + * Type: modifier<br> + * Name: to_charset<br> + * 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) +{ + if (!Smarty::$_MBSTRING) { + // FIXME: (rodneyrehm) shouldn't this throw an error? + return $params[0]; + } + + if (!isset($params[1])) { + $params[1] = '"ISO-8859-1"'; + } + + return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.unescape.php b/include/smarty/libs/plugins/modifiercompiler.unescape.php index 4321ff18d..61354926f 100644 --- a/include/smarty/libs/plugins/modifiercompiler.unescape.php +++ b/include/smarty/libs/plugins/modifiercompiler.unescape.php @@ -1,51 +1,51 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty unescape modifier plugin
- *
- * Type: modifier<br>
- * Name: unescape<br>
- * Purpose: unescape html entities
- *
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_unescape($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 'html';
- }
- if (!isset($params[2])) {
- $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
- } else {
- $params[2] = "'" . $params[2] . "'";
- }
-
- switch (trim($params[1], '"\'')) {
- case 'entity':
- case 'htmlall':
- if (Smarty::$_MBSTRING) {
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
- }
-
- return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
-
- case 'html':
- return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
-
- case 'url':
- return 'rawurldecode(' . $params[0] . ')';
-
- default:
- return $params[0];
- }
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty unescape modifier plugin + * + * Type: modifier<br> + * Name: unescape<br> + * Purpose: unescape html entities + * + * @author Rodney Rehm + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_unescape($params, $compiler) +{ + if (!isset($params[1])) { + $params[1] = 'html'; + } + if (!isset($params[2])) { + $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\''; + } else { + $params[2] = "'" . $params[2] . "'"; + } + + switch (trim($params[1], '"\'')) { + case 'entity': + case 'htmlall': + if (Smarty::$_MBSTRING) { + return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; + } + + return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')'; + + case 'html': + return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)'; + + case 'url': + return 'rawurldecode(' . $params[0] . ')'; + + default: + return $params[0]; + } +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.upper.php b/include/smarty/libs/plugins/modifiercompiler.upper.php index f368e37dc..8611fa870 100644 --- a/include/smarty/libs/plugins/modifiercompiler.upper.php +++ b/include/smarty/libs/plugins/modifiercompiler.upper.php @@ -1,30 +1,30 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty upper modifier plugin
- *
- * Type: modifier<br>
- * Name: lower<br>
- * Purpose: convert string to uppercase
- *
- * @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)
-{
- if (Smarty::$_MBSTRING) {
- return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
- }
- // no MBString fallback
- return 'strtoupper(' . $params[0] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty upper modifier plugin + * + * Type: modifier<br> + * Name: lower<br> + * Purpose: convert string to uppercase + * + * @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) +{ + if (Smarty::$_MBSTRING) { + return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ; + } + // no MBString fallback + return 'strtoupper(' . $params[0] . ')'; +} + ?>
\ No newline at end of file diff --git a/include/smarty/libs/plugins/modifiercompiler.wordwrap.php b/include/smarty/libs/plugins/modifiercompiler.wordwrap.php index f6845ad37..8b524f32c 100644 --- a/include/smarty/libs/plugins/modifiercompiler.wordwrap.php +++ b/include/smarty/libs/plugins/modifiercompiler.wordwrap.php @@ -1,46 +1,46 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty wordwrap modifier plugin
- *
- * Type: modifier<br>
- * Name: wordwrap<br>
- * 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)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_wordwrap($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 80;
- }
- if (!isset($params[2])) {
- $params[2] = '"\n"';
- }
- if (!isset($params[3])) {
- $params[3] = 'false';
- }
- $function = 'wordwrap';
- if (Smarty::$_MBSTRING) {
- if ($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']['function'] = 'smarty_mb_wordwrap';
- }
- $function = 'smarty_mb_wordwrap';
- }
- return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
-}
-
+<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty wordwrap modifier plugin + * + * Type: modifier<br> + * Name: wordwrap<br> + * 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) + * @author Uwe Tews + * @param array $params parameters + * @return string with compiled code + */ +function smarty_modifiercompiler_wordwrap($params, $compiler) +{ + if (!isset($params[1])) { + $params[1] = 80; + } + if (!isset($params[2])) { + $params[2] = '"\n"'; + } + if (!isset($params[3])) { + $params[3] = 'false'; + } + $function = 'wordwrap'; + if (Smarty::$_MBSTRING) { + if ($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']['function'] = 'smarty_mb_wordwrap'; + } + $function = 'smarty_mb_wordwrap'; + } + return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')'; +} + ?>
\ No newline at end of file |