mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09:54:27 +02:00
Replace Smarty:: with symfony/polyfill-mbstring
This commit is contained in:
@@ -30,12 +30,13 @@
|
|||||||
"forum": "https://github.com/smarty-php/smarty/discussions"
|
"forum": "https://github.com/smarty-php/smarty/discussions"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1 || ^8.0"
|
"php": "^7.1 || ^8.0",
|
||||||
|
"symfony/polyfill-mbstring": "^1.27"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"psr-4" : {
|
||||||
"libs/"
|
"Smarty\\" : "src/"
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
|
@@ -6,9 +6,7 @@ Charset Encoding {#charset.encoding}
|
|||||||
|
|
||||||
There are a variety of encodings for textual data, ISO-8859-1 (Latin1)
|
There are a variety of encodings for textual data, ISO-8859-1 (Latin1)
|
||||||
and UTF-8 being the most popular. Unless you change `\Smarty\Smarty::$_CHARSET`,
|
and UTF-8 being the most popular. Unless you change `\Smarty\Smarty::$_CHARSET`,
|
||||||
Smarty recognizes `UTF-8` as the internal charset if
|
Smarty recognizes `UTF-8` as the internal charset.
|
||||||
[Multibyte String](https://www.php.net/mbstring) is available,
|
|
||||||
`ISO-8859-1` if not.
|
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
@@ -26,10 +24,7 @@ Smarty recognizes `UTF-8` as the internal charset if
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> Smarty\'s internals and core plugins are truly UTF-8 compatible since
|
> Smarty\'s internals and core plugins are truly UTF-8 compatible since
|
||||||
> Smarty 3.1. To achieve unicode compatibility, the [Multibyte
|
> Smarty 3.1.
|
||||||
> String](https://www.php.net/mbstring) PECL is required. Unless your PHP
|
|
||||||
> environment offers this package, Smarty will not be able to offer
|
|
||||||
> full-scale UTF-8 compatibility.
|
|
||||||
|
|
||||||
|
|
||||||
// use japanese character encoding
|
// use japanese character encoding
|
||||||
|
@@ -92,11 +92,7 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te
|
|||||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||||
}
|
}
|
||||||
// wordwrap sentences
|
// wordwrap sentences
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
$_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
$_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||||
} else {
|
|
||||||
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
|
||||||
}
|
|
||||||
// indent lines
|
// indent lines
|
||||||
if ($indent > 0) {
|
if ($indent > 0) {
|
||||||
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
|
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
|
||||||
|
@@ -24,7 +24,6 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
{
|
{
|
||||||
$string = (string) $string;
|
$string = (string) $string;
|
||||||
|
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
if ($lc_rest) {
|
if ($lc_rest) {
|
||||||
// uppercase (including hyphenated words)
|
// uppercase (including hyphenated words)
|
||||||
$upper_string = mb_convert_case($string, MB_CASE_TITLE, \Smarty\Smarty::$_CHARSET);
|
$upper_string = mb_convert_case($string, MB_CASE_TITLE, \Smarty\Smarty::$_CHARSET);
|
||||||
@@ -64,39 +63,6 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
);
|
);
|
||||||
return $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\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\Smarty::$_UTF8_MODIFIER,
|
|
||||||
$string,
|
|
||||||
$matches,
|
|
||||||
PREG_OFFSET_CAPTURE
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
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\Smarty::$_UTF8_MODIFIER,
|
|
||||||
'smarty_mod_cap_ucfirst2_cb',
|
|
||||||
$upper_string
|
|
||||||
);
|
|
||||||
return $upper_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@@ -74,29 +74,17 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
|
|||||||
break;
|
break;
|
||||||
case 'string':
|
case 'string':
|
||||||
$results = strtr($var, $_replace);
|
$results = strtr($var, $_replace);
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
if (mb_strlen($var, \Smarty\Smarty::$_CHARSET) > $length) {
|
if (mb_strlen($var, \Smarty\Smarty::$_CHARSET) > $length) {
|
||||||
$results = mb_substr($var, 0, $length - 3, \Smarty\Smarty::$_CHARSET) . '...';
|
$results = mb_substr($var, 0, $length - 3, \Smarty\Smarty::$_CHARSET) . '...';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (isset($var[ $length ])) {
|
|
||||||
$results = substr($var, 0, $length - 3) . '...';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, \Smarty\Smarty::$_CHARSET);
|
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, \Smarty\Smarty::$_CHARSET);
|
||||||
break;
|
break;
|
||||||
case 'unknown type':
|
case 'unknown type':
|
||||||
default:
|
default:
|
||||||
$results = strtr((string)$var, $_replace);
|
$results = strtr((string)$var, $_replace);
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
if (mb_strlen($results, \Smarty\Smarty::$_CHARSET) > $length) {
|
if (mb_strlen($results, \Smarty\Smarty::$_CHARSET) > $length) {
|
||||||
$results = mb_substr($results, 0, $length - 3, \Smarty\Smarty::$_CHARSET) . '...';
|
$results = mb_substr($results, 0, $length - 3, \Smarty\Smarty::$_CHARSET) . '...';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (strlen($results) > $length) {
|
|
||||||
$results = substr($results, 0, $length - 3) . '...';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$results = htmlspecialchars($results, ENT_QUOTES, \Smarty\Smarty::$_CHARSET);
|
$results = htmlspecialchars($results, ENT_QUOTES, \Smarty\Smarty::$_CHARSET);
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
|
@@ -34,12 +34,8 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
|
return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
|
||||||
// no break
|
// no break
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
$string = mb_convert_encoding($string, 'UTF-8', $char_set);
|
$string = mb_convert_encoding($string, 'UTF-8', $char_set);
|
||||||
return htmlentities($string, ENT_QUOTES, 'UTF-8', $double_encode);
|
return htmlentities($string, ENT_QUOTES, 'UTF-8', $double_encode);
|
||||||
}
|
|
||||||
// no MBString fallback
|
|
||||||
return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
|
|
||||||
// no break
|
// no break
|
||||||
case 'url':
|
case 'url':
|
||||||
return rawurlencode($string);
|
return rawurlencode($string);
|
||||||
@@ -58,35 +54,17 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
case 'hexentity':
|
case 'hexentity':
|
||||||
$return = '';
|
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
$return = '';
|
$return = '';
|
||||||
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
||||||
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
|
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
|
||||||
// no MBString fallback
|
|
||||||
$_length = strlen($string);
|
|
||||||
for ($x = 0; $x < $_length; $x++) {
|
|
||||||
$return .= '&#x' . bin2hex($string[ $x ]) . ';';
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
case 'decentity':
|
case 'decentity':
|
||||||
$return = '';
|
$return = '';
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
$return = '';
|
|
||||||
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
||||||
$return .= '&#' . $unicode . ';';
|
$return .= '&#' . $unicode . ';';
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
|
||||||
// no MBString fallback
|
|
||||||
$_length = strlen($string);
|
|
||||||
for ($x = 0; $x < $_length; $x++) {
|
|
||||||
$return .= '&#' . ord($string[ $x ]) . ';';
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
case 'javascript':
|
case 'javascript':
|
||||||
// escape quotes and backslashes, newlines, etc.
|
// escape quotes and backslashes, newlines, etc.
|
||||||
return strtr(
|
return strtr(
|
||||||
@@ -105,7 +83,6 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
case 'mail':
|
case 'mail':
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return smarty_mb_str_replace(
|
return smarty_mb_str_replace(
|
||||||
array(
|
array(
|
||||||
'@',
|
'@',
|
||||||
@@ -117,23 +94,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
),
|
),
|
||||||
$string
|
$string
|
||||||
);
|
);
|
||||||
}
|
|
||||||
// no MBString fallback
|
|
||||||
return str_replace(
|
|
||||||
array(
|
|
||||||
'@',
|
|
||||||
'.'
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
' [AT] ',
|
|
||||||
' [DOT] '
|
|
||||||
),
|
|
||||||
$string
|
|
||||||
);
|
|
||||||
case 'nonstd':
|
case 'nonstd':
|
||||||
// escape non-standard chars, such as ms document quotes
|
// escape non-standard chars, such as ms document quotes
|
||||||
$return = '';
|
$return = '';
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
foreach (smarty_mb_to_unicode($string, \Smarty\Smarty::$_CHARSET) as $unicode) {
|
||||||
if ($unicode >= 126) {
|
if ($unicode >= 126) {
|
||||||
$return .= '&#' . $unicode . ';';
|
$return .= '&#' . $unicode . ';';
|
||||||
@@ -142,18 +105,6 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
|
||||||
$_length = strlen($string);
|
|
||||||
for ($_i = 0; $_i < $_length; $_i++) {
|
|
||||||
$_ord = ord(substr($string, $_i, 1));
|
|
||||||
// non-standard char, escape it
|
|
||||||
if ($_ord >= 126) {
|
|
||||||
$return .= '&#' . $_ord . ';';
|
|
||||||
} else {
|
|
||||||
$return .= substr($string, $_i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
default:
|
default:
|
||||||
trigger_error("escape: unsupported type: $esc_type - returning unmodified string", E_USER_NOTICE);
|
trigger_error("escape: unsupported type: $esc_type - returning unmodified string", E_USER_NOTICE);
|
||||||
return $string;
|
return $string;
|
||||||
|
@@ -23,8 +23,5 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifier_replace($string, $search, $replace)
|
function smarty_modifier_replace($string, $search, $replace)
|
||||||
{
|
{
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return smarty_mb_str_replace($search, $replace, $string);
|
return smarty_mb_str_replace($search, $replace, $string);
|
||||||
}
|
}
|
||||||
return str_replace($search, $replace, $string);
|
|
||||||
}
|
|
||||||
|
@@ -29,7 +29,6 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
|||||||
if ($length === 0) {
|
if ($length === 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
if (mb_strlen($string, \Smarty\Smarty::$_CHARSET) > $length) {
|
if (mb_strlen($string, \Smarty\Smarty::$_CHARSET) > $length) {
|
||||||
$length -= min($length, mb_strlen($etc, \Smarty\Smarty::$_CHARSET));
|
$length -= min($length, mb_strlen($etc, \Smarty\Smarty::$_CHARSET));
|
||||||
if (!$break_words && !$middle) {
|
if (!$break_words && !$middle) {
|
||||||
@@ -47,16 +46,3 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
|||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
|
||||||
if (isset($string[ $length ])) {
|
|
||||||
$length -= min($length, strlen($etc));
|
|
||||||
if (!$break_words && !$middle) {
|
|
||||||
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
|
|
||||||
}
|
|
||||||
if (!$middle) {
|
|
||||||
return substr($string, 0, $length) . $etc;
|
|
||||||
}
|
|
||||||
return substr($string, 0, intval($length / 2)) . $etc . substr($string, -intval($length / 2));
|
|
||||||
}
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
@@ -24,9 +24,5 @@ function smarty_modifiercompiler_count_characters($params)
|
|||||||
if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') {
|
if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') {
|
||||||
return 'preg_match_all(\'/[^\s]/' . \Smarty\Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
|
return 'preg_match_all(\'/[^\s]/' . \Smarty\Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
|
||||||
}
|
}
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
|
||||||
return 'strlen(' . $params[ 0 ] . ')';
|
|
||||||
}
|
|
||||||
|
@@ -20,11 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_count_words($params)
|
function smarty_modifiercompiler_count_words($params)
|
||||||
{
|
{
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
// expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
|
// 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\Smarty::$_UTF8_MODIFIER . '\', ' .
|
return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . \Smarty\Smarty::$_UTF8_MODIFIER . '\', ' .
|
||||||
$params[ 0 ] . ', $tmp)';
|
$params[ 0 ] . ', $tmp)';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
|
||||||
return 'str_word_count(' . $params[ 0 ] . ')';
|
|
||||||
}
|
|
||||||
|
@@ -35,14 +35,9 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
|
|||||||
var_export($double_encode, true) . ')';
|
var_export($double_encode, true) . ')';
|
||||||
// no break
|
// no break
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return 'htmlentities(mb_convert_encoding((string)' . $params[ 0 ] . ', \'UTF-8\', ' .
|
return 'htmlentities(mb_convert_encoding((string)' . $params[ 0 ] . ', \'UTF-8\', ' .
|
||||||
var_export($char_set, true) . '), ENT_QUOTES, \'UTF-8\', ' .
|
var_export($char_set, true) . '), ENT_QUOTES, \'UTF-8\', ' .
|
||||||
var_export($double_encode, true) . ')';
|
var_export($double_encode, true) . ')';
|
||||||
}
|
|
||||||
// no MBString fallback
|
|
||||||
return 'htmlentities((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
|
||||||
var_export($double_encode, true) . ')';
|
|
||||||
// no break
|
// no break
|
||||||
case 'url':
|
case 'url':
|
||||||
return 'rawurlencode((string)' . $params[ 0 ] . ')';
|
return 'rawurlencode((string)' . $params[ 0 ] . ')';
|
||||||
|
@@ -19,10 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_from_charset($params)
|
function smarty_modifiercompiler_from_charset($params)
|
||||||
{
|
{
|
||||||
if (!\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
|
||||||
return $params[ 0 ];
|
|
||||||
}
|
|
||||||
if (!isset($params[ 1 ])) {
|
if (!isset($params[ 1 ])) {
|
||||||
$params[ 1 ] = '"ISO-8859-1"';
|
$params[ 1 ] = '"ISO-8859-1"';
|
||||||
}
|
}
|
||||||
|
@@ -21,9 +21,5 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_lower($params)
|
function smarty_modifiercompiler_lower($params)
|
||||||
{
|
{
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
|
||||||
return 'strtolower(' . $params[ 0 ] . ')';
|
|
||||||
}
|
|
||||||
|
@@ -19,10 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_to_charset($params)
|
function smarty_modifiercompiler_to_charset($params)
|
||||||
{
|
{
|
||||||
if (!\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
|
||||||
return $params[ 0 ];
|
|
||||||
}
|
|
||||||
if (!isset($params[ 1 ])) {
|
if (!isset($params[ 1 ])) {
|
||||||
$params[ 1 ] = '"ISO-8859-1"';
|
$params[ 1 ] = '"ISO-8859-1"';
|
||||||
}
|
}
|
||||||
|
@@ -29,10 +29,7 @@ function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompi
|
|||||||
switch ($esc_type) {
|
switch ($esc_type) {
|
||||||
case 'entity':
|
case 'entity':
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return 'html_entity_decode(mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'UTF-8\'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
return 'html_entity_decode(mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'UTF-8\'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
||||||
}
|
|
||||||
return 'html_entity_decode(' . $params[ 0 ] . ', ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
|
||||||
case 'html':
|
case 'html':
|
||||||
return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
||||||
case 'url':
|
case 'url':
|
||||||
|
@@ -20,9 +20,5 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_upper($params)
|
function smarty_modifiercompiler_upper($params)
|
||||||
{
|
{
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
return 'mb_strtoupper(' . $params[ 0 ] . ' ?? \'\', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
return 'mb_strtoupper(' . $params[ 0 ] . ' ?? \'\', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
|
||||||
return 'strtoupper(' . $params[ 0 ] . ' ?? \'\')';
|
|
||||||
}
|
|
||||||
|
@@ -31,9 +31,6 @@ function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompi
|
|||||||
if (!isset($params[ 3 ])) {
|
if (!isset($params[ 3 ])) {
|
||||||
$params[ 3 ] = 'false';
|
$params[ 3 ] = 'false';
|
||||||
}
|
}
|
||||||
$function = 'wordwrap';
|
|
||||||
if (\Smarty\Smarty::$_MBSTRING) {
|
|
||||||
$function = $compiler->getPlugin('mb_wordwrap', 'modifier');
|
$function = $compiler->getPlugin('mb_wordwrap', 'modifier');
|
||||||
}
|
|
||||||
return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')';
|
return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')';
|
||||||
}
|
}
|
||||||
|
@@ -20,12 +20,6 @@ namespace Smarty\Resource;
|
|||||||
*/
|
*/
|
||||||
class Extending extends Base
|
class Extending extends Base
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* mbstring.overload flag
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $mbstring_overload = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populate Source Object with metadata from Resource
|
* populate Source Object with metadata from Resource
|
||||||
|
@@ -32,13 +32,6 @@ namespace Smarty;
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('SMARTY_MBSTRING')) {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
define('SMARTY_MBSTRING', function_exists('mb_get_info'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main Smarty class
|
* This is the main Smarty class
|
||||||
*
|
*
|
||||||
@@ -105,14 +98,9 @@ class Smarty extends \Smarty_Internal_TemplateBase
|
|||||||
public static $global_tpl_vars = array();
|
public static $global_tpl_vars = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag denoting if Multibyte String functions are available
|
* The character set to adhere to (defaults to "UTF-8")
|
||||||
*/
|
*/
|
||||||
public static $_MBSTRING = SMARTY_MBSTRING;
|
public static $_CHARSET = 'UTF-8';
|
||||||
|
|
||||||
/**
|
|
||||||
* The character set to adhere to (e.g. "UTF-8")
|
|
||||||
*/
|
|
||||||
public static $_CHARSET = SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date format to be used internally
|
* The date format to be used internally
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// compiler.test.php
|
// compiler.test.php
|
||||||
class smarty_compiler_test extends Smarty_Internal_CompileBase
|
use Smarty\Compile\Base;
|
||||||
|
|
||||||
|
class smarty_compiler_test extends Base
|
||||||
{
|
{
|
||||||
public function compile($args, $compiler)
|
public function compile($args, $compiler)
|
||||||
{
|
{
|
||||||
@@ -16,7 +18,7 @@ class smarty_compiler_test extends Smarty_Internal_CompileBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compiler.testclose.php
|
// compiler.testclose.php
|
||||||
class smarty_compiler_testclose extends Smarty_Internal_CompileBase
|
class smarty_compiler_testclose extends Base
|
||||||
{
|
{
|
||||||
public function compile($args, $compiler)
|
public function compile($args, $compiler)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// compiler.testclose.php
|
// compiler.testclose.php
|
||||||
class smarty_compiler_testclose extends Smarty_Internal_CompileBase
|
use Smarty\Compile\Base;
|
||||||
|
|
||||||
|
class smarty_compiler_testclose extends Base
|
||||||
{
|
{
|
||||||
public function execute($args, $compiler)
|
public function execute($args, $compiler)
|
||||||
{
|
{
|
||||||
|
@@ -29,15 +29,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = "This is foo. This is foo. This is foo.\nThis is foo. This is foo. This is foo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo\nfoo. bar foo bar foo foo. bar foo bar\nfoo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIndent()
|
public function testIndent()
|
||||||
{
|
{
|
||||||
$result = " This is foo. This is foo. This is\n foo. This is foo. This is foo. This\n is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo. bar foo bar foo foo.\n bar foo bar foo foo. bar foo bar foo\n foo.\n\n";
|
$result = " This is foo. This is foo. This is\n foo. This is foo. This is foo. This\n is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo. bar foo bar foo foo.\n bar foo bar foo foo. bar foo bar foo\n foo.\n\n";
|
||||||
@@ -45,15 +36,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndentWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = " This is foo. This is foo. This is\n foo. This is foo. This is foo. This\n is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo. bar foo bar foo foo.\n bar foo bar foo foo. bar foo bar foo\n foo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIndentFirst()
|
public function testIndentFirst()
|
||||||
{
|
{
|
||||||
$result = " This is foo. This is foo. This\n is foo. This is foo. This is foo.\n This is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar\n foo foo. bar foo bar foo foo. bar\n foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo.\n\n";
|
$result = " This is foo. This is foo. This\n is foo. This is foo. This is foo.\n This is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar\n foo foo. bar foo bar foo foo. bar\n foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo.\n\n";
|
||||||
@@ -61,15 +43,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndentFirstWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = " This is foo. This is foo. This\n is foo. This is foo. This is foo.\n This is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar\n foo foo. bar foo bar foo foo. bar\n foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_first=4}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIndentchar()
|
public function testIndentchar()
|
||||||
{
|
{
|
||||||
$result = "####This is foo. This is foo. This is\n####foo. This is foo. This is foo. This\n####is foo.\n\n####This is bar.\n\n####bar foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo. bar foo bar foo foo.\n####bar foo bar foo foo. bar foo bar foo\n####foo.\n\n";
|
$result = "####This is foo. This is foo. This is\n####foo. This is foo. This is foo. This\n####is foo.\n\n####This is bar.\n\n####bar foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo. bar foo bar foo foo.\n####bar foo bar foo foo. bar foo bar foo\n####foo.\n\n";
|
||||||
@@ -77,15 +50,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndentcharWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = "####This is foo. This is foo. This is\n####foo. This is foo. This is foo. This\n####is foo.\n\n####This is bar.\n\n####bar foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo. bar foo bar foo foo.\n####bar foo bar foo foo. bar foo bar foo\n####foo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_char="#"}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIndentcharFirst()
|
public function testIndentcharFirst()
|
||||||
{
|
{
|
||||||
$result = "########This is foo. This is foo. This\n####is foo. This is foo. This is foo.\n####This is foo.\n\n########This is bar.\n\n########bar foo bar foo foo. bar foo bar\n####foo foo. bar foo bar foo foo. bar\n####foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo.\n\n";
|
$result = "########This is foo. This is foo. This\n####is foo. This is foo. This is foo.\n####This is foo.\n\n########This is bar.\n\n########bar foo bar foo foo. bar foo bar\n####foo foo. bar foo bar foo foo. bar\n####foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo.\n\n";
|
||||||
@@ -93,15 +57,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndentcharFirstWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = "########This is foo. This is foo. This\n####is foo. This is foo. This is foo.\n####This is foo.\n\n########This is bar.\n\n########bar foo bar foo foo. bar foo bar\n####foo foo. bar foo bar foo foo. bar\n####foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_first=4 indent_char="#"}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testWrapchar()
|
public function testWrapchar()
|
||||||
{
|
{
|
||||||
$result = " This is foo. This is foo. This is#foo. This is foo. This is foo. This#is foo.## This is bar.## bar foo bar foo foo. bar foo bar foo#foo. bar foo bar foo foo. bar foo#bar foo foo. bar foo bar foo foo.#bar foo bar foo foo. bar foo bar foo#foo.##";
|
$result = " This is foo. This is foo. This is#foo. This is foo. This is foo. This#is foo.## This is bar.## bar foo bar foo foo. bar foo bar foo#foo. bar foo bar foo foo. bar foo#bar foo foo. bar foo bar foo foo.#bar foo bar foo foo. bar foo bar foo#foo.##";
|
||||||
@@ -109,15 +64,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWrapcharWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = " This is foo. This is foo. This is#foo. This is foo. This is foo. This#is foo.## This is bar.## bar foo bar foo foo. bar foo bar foo#foo. bar foo bar foo foo. bar foo#bar foo foo. bar foo bar foo foo.#bar foo bar foo foo. bar foo bar foo#foo.##";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 wrap_char="#"}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testStyleEmail()
|
public function testStyleEmail()
|
||||||
{
|
{
|
||||||
$result = "This is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
|
$result = "This is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
|
||||||
@@ -125,12 +71,4 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testStyleEmailWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = "This is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{textformat style="email"}' . $this->string . '{/textformat}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -27,15 +27,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me@example.com" >me@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testText()
|
public function testText()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:me@example.com" >send me some mail</a>';
|
$result = '<a href="mailto:me@example.com" >send me some mail</a>';
|
||||||
@@ -43,15 +34,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTextWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me@example.com" >send me some mail</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" text="send me some mail"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEncodeJavascript()
|
public function testEncodeJavascript()
|
||||||
{
|
{
|
||||||
$result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
|
$result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
|
||||||
@@ -59,15 +41,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeJavascriptWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEncodeJavascriptCharcode()
|
public function testEncodeJavascriptCharcode()
|
||||||
{
|
{
|
||||||
$result = '<script type="text/javascript">document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
|
$result = '<script type="text/javascript">document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
|
||||||
@@ -75,15 +48,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeJavascriptCharcodeWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<script type="text/javascript">document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript_charcode"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEncodeHex()
|
public function testEncodeHex()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >me@example.com</a>';
|
$result = '<a href="mailto:%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >me@example.com</a>';
|
||||||
@@ -91,15 +55,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeHexWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >me@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="hex"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSubject()
|
public function testSubject()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>';
|
$result = '<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>';
|
||||||
@@ -107,15 +62,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubjectWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" subject="Hello to you!"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCc()
|
public function testCc()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:me@example.com?cc=you@example.com,they@example.com" >me@example.com</a>';
|
$result = '<a href="mailto:me@example.com?cc=you@example.com,they@example.com" >me@example.com</a>';
|
||||||
@@ -123,15 +69,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCcWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me@example.com?cc=you@example.com,they@example.com" >me@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" cc="you@example.com,they@example.com"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testExtra()
|
public function testExtra()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:me@example.com" class="email">me@example.com</a>';
|
$result = '<a href="mailto:me@example.com" class="email">me@example.com</a>';
|
||||||
@@ -139,15 +76,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExtraWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me@example.com" class="email">me@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" extra=\'class="email"\'}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
|
$result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
|
||||||
@@ -155,15 +83,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{mailto address="me+smtpext@example.com" cc="you@example.com,they@example.com" subject="hällo wörld"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testJavascriptChars()
|
public function testJavascriptChars()
|
||||||
{
|
{
|
||||||
$result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%3c%2f%61%3e\'))</script>';
|
$result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%3c%2f%61%3e\'))</script>';
|
||||||
|
@@ -40,33 +40,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Next X-Men Film, X3, Delayed. Ümlauts Äre Cööl.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Next X-Men Film, X3, Delayed. Ümlauts Äre Cööl.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, x3, Delayed.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDigitsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize:true}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, X3, Delayed.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testTrueCaptialsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize:true:true}');
|
|
||||||
$this->assertEquals("Next X-Men Film, X3, Delayed.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testQuotes()
|
public function testQuotes()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize}');
|
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize}');
|
||||||
@@ -75,17 +48,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Next X-Men FiLm, x3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Next X-Men FiLm, x3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testQuotesWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, x3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, x3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testQuotesDigits()
|
public function testQuotesDigits()
|
||||||
{
|
{
|
||||||
$tpl =
|
$tpl =
|
||||||
@@ -96,19 +58,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Next X-Men FiLm, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Next X-Men FiLm, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testQuotesDigitsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl =
|
|
||||||
$this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize:true}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, X3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
|
|
||||||
$tpl =
|
|
||||||
$this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize:true}');
|
|
||||||
$this->assertEquals("Next X-Men FiLm, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testQuotesTrueCapitals()
|
public function testQuotesTrueCapitals()
|
||||||
{
|
{
|
||||||
$tpl =
|
$tpl =
|
||||||
@@ -119,19 +68,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Next X-Men Film, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Next X-Men Film, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testQuotesTrueCapitalsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl =
|
|
||||||
$this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize:true:true}');
|
|
||||||
$this->assertEquals("Next X-Men Film, X3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
|
|
||||||
$tpl =
|
|
||||||
$this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize:true:true}');
|
|
||||||
$this->assertEquals("Next X-Men Film, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testQuotesBeginning()
|
public function testQuotesBeginning()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"\"delayed. umlauts\" foo."|capitalize}');
|
$tpl = $this->smarty->createTemplate('string:{"\"delayed. umlauts\" foo."|capitalize}');
|
||||||
@@ -140,14 +76,4 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
$this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testQuotesBeginningWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"\"delayed. umlauts\" foo."|capitalize}');
|
|
||||||
$this->assertEquals("\"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"\'delayed. umlauts\' foo."|capitalize}');
|
|
||||||
$this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -28,17 +28,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToLatin1WithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$encoded = "hällö wörld 2";
|
|
||||||
$result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
|
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFromLatin1()
|
public function testFromLatin1()
|
||||||
{
|
{
|
||||||
$result = "hällö wörld 3";
|
$result = "hällö wörld 3";
|
||||||
@@ -47,17 +36,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromLatin1WithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$result = "hällö wörld 4";
|
|
||||||
$encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
|
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFromUtf32le()
|
public function testFromUtf32le()
|
||||||
{
|
{
|
||||||
$result = "hällö wörld 5";
|
$result = "hällö wörld 5";
|
||||||
@@ -66,17 +44,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromUtf32leWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$result = "hällö wörld 6";
|
|
||||||
$encoded = mb_convert_encoding($result, "UTF-32LE", "UTF-8");
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset:"UTF-32LE"}');
|
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testToUtf32le()
|
public function testToUtf32le()
|
||||||
{
|
{
|
||||||
$encoded = "hällö wörld 7";
|
$encoded = "hällö wörld 7";
|
||||||
@@ -85,14 +52,4 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToUtf32leWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$encoded = "hällö wörld 8";
|
|
||||||
$result = mb_convert_encoding($encoded, "UTF-32LE", "UTF-8");
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset:"UTF-32LE"}');
|
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -27,16 +27,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId ('mb');
|
|
||||||
$result = "29";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Cold Wave Linked to Temperatures."|count_characters}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSpaces()
|
public function testSpaces()
|
||||||
{
|
{
|
||||||
$result = "33";
|
$result = "33";
|
||||||
@@ -44,16 +34,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSpacesWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId ('mb');
|
|
||||||
$result = "33";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Cold Wave Linked to Temperatures."|count_characters:true}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$result = "29";
|
$result = "29";
|
||||||
@@ -61,16 +41,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId ('mb');
|
|
||||||
$result = "29";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Cold Wäve Linked tö Temperatures."|count_characters}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlautsSpaces()
|
public function testUmlautsSpaces()
|
||||||
{
|
{
|
||||||
$result = "33";
|
$result = "33";
|
||||||
@@ -78,13 +48,4 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsSpacesWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId ('mb');
|
|
||||||
$result = "33";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Cold Wäve Linked tö Temperatures."|count_characters:true}');
|
|
||||||
$this->assertNotEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -35,18 +35,6 @@ class PluginModifierCountSentencesTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("0", $this->smarty->fetch($tpl));
|
$this->assertEquals("0", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"hello world."|count_sentences}');
|
|
||||||
$this->assertEquals("1", $this->smarty->fetch($tpl));
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"hello world. I\'m another? Sentence!"|count_sentences}');
|
|
||||||
$this->assertEquals("3", $this->smarty->fetch($tpl));
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"hello world.wrong"|count_sentences}');
|
|
||||||
$this->assertEquals("0", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"hello worldä."|count_sentences}');
|
$tpl = $this->smarty->createTemplate('string:{"hello worldä."|count_sentences}');
|
||||||
|
@@ -27,15 +27,6 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "7";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Dealers Will Hear Car Talk at Noon."|count_words}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDashes()
|
public function testDashes()
|
||||||
{
|
{
|
||||||
$result = "7";
|
$result = "7";
|
||||||
@@ -43,15 +34,6 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDashesWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "7";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Smalltime-Dealers Will Hear Car Talk at Noon."|count_words}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$result = "7";
|
$result = "7";
|
||||||
@@ -59,12 +41,4 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "7";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Dealers Will Hear Cär Talk at Nöön."|count_words}');
|
|
||||||
$this->assertNotEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -33,28 +33,12 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html"}');
|
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHtmlDouble()
|
public function testHtmlDouble()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html":null:false}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html":null:false}');
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlDoubleWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html":null:false}');
|
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHtmlallCompiled()
|
public function testHtmlallCompiled()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
||||||
@@ -68,37 +52,12 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlallWithoutMbstringCompiled()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHtmlallWithoutMbstringModifier()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:$mode}');
|
|
||||||
$this->smarty->assign('mode', 'htmlall');
|
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHtmlallDouble()
|
public function testHtmlallDouble()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall":null:false}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall":null:false}');
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlallDoubleWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall":null:false}');
|
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or ©", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUrlCompiled()
|
public function testUrlCompiled()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
|
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
|
||||||
@@ -112,42 +71,18 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUrlWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
|
|
||||||
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUrlpathinfo()
|
public function testUrlpathinfo()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"urlpathinfo"}');
|
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"urlpathinfo"}');
|
||||||
$this->assertEquals("http%3A//some.encoded.com/url%3Fparts%23foo", $this->smarty->fetch($tpl));
|
$this->assertEquals("http%3A//some.encoded.com/url%3Fparts%23foo", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUrlpathinfoWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"urlpathinfo"}');
|
|
||||||
$this->assertEquals("http%3A//some.encoded.com/url%3Fparts%23foo", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHex()
|
public function testHex()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"a/cäa"|escape:"hex"}');
|
$tpl = $this->smarty->createTemplate('string:{"a/cäa"|escape:"hex"}');
|
||||||
$this->assertEquals("%61%2f%63%c3%a4%61", $this->smarty->fetch($tpl));
|
$this->assertEquals("%61%2f%63%c3%a4%61", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHexWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"a/cäa"|escape:"hex"}');
|
|
||||||
$this->assertEquals("%61%2f%63%c3%a4%61", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHexentity()
|
public function testHexentity()
|
||||||
{
|
{
|
||||||
$q = "aäЗдравсствуйте";
|
$q = "aäЗдравсствуйте";
|
||||||
@@ -159,19 +94,6 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHexentityWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$q = "aäЗдравсствуйте";
|
|
||||||
$r = html_entity_decode($q, ENT_NOQUOTES, 'UTF-8');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $r . '"|escape:"hexentity"}');
|
|
||||||
$this->assertNotEquals("aäЗдравсствуйте", $this->smarty->fetch($tpl));
|
|
||||||
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"abc"|escape:"hexentity"}');
|
|
||||||
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDecentity()
|
public function testDecentity()
|
||||||
{
|
{
|
||||||
$q = "aäЗдравсствуйте";
|
$q = "aäЗдравсствуйте";
|
||||||
@@ -183,58 +105,22 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDecentityWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$q = "aäЗдравсствуйте";
|
|
||||||
$r = html_entity_decode($q, ENT_NOQUOTES, 'UTF-8');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $r . '"|escape:"decentity"}');
|
|
||||||
$this->assertNotEquals("aäЗдравсствуйте", $this->smarty->fetch($tpl));
|
|
||||||
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"abc"|escape:"decentity"}');
|
|
||||||
$this->assertEquals("abc", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testJavascript()
|
public function testJavascript()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"var x = { foo : \"bar\n\" };"|escape:"javascript"}');
|
$tpl = $this->smarty->createTemplate('string:{"var x = { foo : \"bar\n\" };"|escape:"javascript"}');
|
||||||
$this->assertEquals("var x = { foo : \\\"bar\\n\\\" };", $this->smarty->fetch($tpl));
|
$this->assertEquals("var x = { foo : \\\"bar\\n\\\" };", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testJavascriptWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"var x = { foo : \"bar\n\" };"|escape:"javascript"}');
|
|
||||||
$this->assertEquals("var x = { foo : \\\"bar\\n\\\" };", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMail()
|
public function testMail()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"smarty@example.com"|escape:"mail"}');
|
$tpl = $this->smarty->createTemplate('string:{"smarty@example.com"|escape:"mail"}');
|
||||||
$this->assertEquals("smarty [AT] example [DOT] com", $this->smarty->fetch($tpl));
|
$this->assertEquals("smarty [AT] example [DOT] com", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMailWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"smarty@example.com"|escape:"mail"}');
|
|
||||||
$this->assertEquals("smarty [AT] example [DOT] com", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNonstd()
|
public function testNonstd()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"sma\'rty|»example«.com"|escape:"nonstd"}');
|
$tpl = $this->smarty->createTemplate('string:{"sma\'rty|»example«.com"|escape:"nonstd"}');
|
||||||
$this->assertEquals("sma'rty|»example«.com", $this->smarty->fetch($tpl));
|
$this->assertEquals("sma'rty|»example«.com", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNonstdWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . mb_convert_encoding('sma\'rty@»example«.com', 'ISO-8859-1', 'UTF-8') . '"|escape:"nonstd"}');
|
|
||||||
$this->assertEquals("sma'rty@»example«.com", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,15 +26,6 @@ class PluginModifierLowerTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "two convicts evade noose, jury hung.";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Convicts Evade Noose, Jury Hung."|lower}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$result = "two convicts eväde nööse, jury hung.";
|
$result = "two convicts eväde nööse, jury hung.";
|
||||||
@@ -42,12 +33,4 @@ class PluginModifierLowerTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "two convicts eväde nööse, jury hung.";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Convicts Eväde NöÖse, Jury Hung."|lower}');
|
|
||||||
$this->assertNotEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,14 +26,6 @@ class PluginModifierRegexReplaceTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Infertility unlikely to\nbe passed on, experts say."|regex_replace:"/[\r\t\n]/":" "}');
|
|
||||||
$this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Infertility unlikely tö\näe passed on, experts say."|regex_replace:"/[\r\t\n]/u":" "}');
|
$tpl = $this->smarty->createTemplate('string:{"Infertility unlikely tö\näe passed on, experts say."|regex_replace:"/[\r\t\n]/u":" "}');
|
||||||
|
@@ -27,15 +27,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after Eighteen Years at Checkout Counter.';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLength()
|
public function testLength()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Reunite after...';
|
$result = 'Two Sisters Reunite after...';
|
||||||
@@ -43,15 +34,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLengthWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after...';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEtc()
|
public function testEtc()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Reunite after';
|
$result = 'Two Sisters Reunite after';
|
||||||
@@ -59,15 +41,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEtcWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:""}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEtc2()
|
public function testEtc2()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Reunite after---';
|
$result = 'Two Sisters Reunite after---';
|
||||||
@@ -75,15 +48,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEtc2WithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after---';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"---"}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBreak()
|
public function testBreak()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Reunite after Eigh';
|
$result = 'Two Sisters Reunite after Eigh';
|
||||||
@@ -91,15 +55,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBreakWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after Eigh';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"":true}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBreak2()
|
public function testBreak2()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Reunite after E...';
|
$result = 'Two Sisters Reunite after E...';
|
||||||
@@ -107,15 +62,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBreak2WithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Reunite after E...';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"...":true}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMiddle()
|
public function testMiddle()
|
||||||
{
|
{
|
||||||
$result = 'Two Sisters Re..ckout Counter.';
|
$result = 'Two Sisters Re..ckout Counter.';
|
||||||
@@ -123,12 +69,4 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMiddleWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = 'Two Sisters Re..ckout Counter.';
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"..":true:true}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -28,16 +28,6 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$encoded = "aäЗдра><&amp;ääвсствуйте";
|
|
||||||
$result = "aäЗдра><&ääвсствуйте";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"html"}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHtmlall()
|
public function testHtmlall()
|
||||||
{
|
{
|
||||||
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
||||||
@@ -46,16 +36,6 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlallWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
|
||||||
$result = "'\"aäЗдра><&ääвсствуйте";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUrl()
|
public function testUrl()
|
||||||
{
|
{
|
||||||
$encoded = "a%C3%A4%D0%97%D0%B4%D1%80%D0%B0%3E%3C%26amp%3B%C3%A4%C3%A4%D0%B2%D1%81%D1%81%D1%82%D0%B2%3F%3D%2B%D1%83%D0%B9%D1%82%D0%B5";
|
$encoded = "a%C3%A4%D0%97%D0%B4%D1%80%D0%B0%3E%3C%26amp%3B%C3%A4%C3%A4%D0%B2%D1%81%D1%81%D1%82%D0%B2%3F%3D%2B%D1%83%D0%B9%D1%82%D0%B5";
|
||||||
|
@@ -27,15 +27,6 @@ class PluginModifierUpperTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"If Strike isn\'t Settled Quickly it may Last a While."|upper}');
|
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUmlauts()
|
public function testUmlauts()
|
||||||
{
|
{
|
||||||
$result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
|
$result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
|
||||||
@@ -43,12 +34,4 @@ class PluginModifierUpperTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUmlautsWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
|
||||||
$result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"If Strike isn\'t Sättled ÜQuickly it may Last a While."|upper}');
|
|
||||||
$this->assertNotEquals($result, $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,15 +26,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Blind woman gets new kidney from dad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman gets new kidney from dad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap}');
|
|
||||||
$this->assertEquals("Blind woman gets new kidney from dad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDefaultUmlauts()
|
public function testDefaultUmlauts()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsä new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
|
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsä new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
|
||||||
@@ -47,45 +38,18 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Blind woman gets new kidney\nfrom dad she hasn't seen in\nyears.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman gets new kidney\nfrom dad she hasn't seen in\nyears.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLengthWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
|
|
||||||
$this->assertEquals("Blind woman gets new kidney\nfrom dad she hasn't seen in\nyears.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBreak()
|
public function testBreak()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30:"<br />\n"}');
|
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30:"<br />\n"}');
|
||||||
$this->assertEquals("Blind woman gets new kidney<br />\nfrom dad she hasn't seen in<br />\nyears.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman gets new kidney<br />\nfrom dad she hasn't seen in<br />\nyears.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBreakWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30:"<br />\n"}');
|
|
||||||
$this->assertEquals("Blind woman gets new kidney<br />\nfrom dad she hasn't seen in<br />\nyears.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLong()
|
public function testLong()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n"}');
|
$tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n"}');
|
||||||
$this->assertEquals("Blind woman\nwithaverylongandunpronoucablenameorso\ngets new kidney from dad\nshe hasn't seen in years.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman\nwithaverylongandunpronoucablenameorso\ngets new kidney from dad\nshe hasn't seen in years.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLongWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n"}');
|
|
||||||
$this->assertEquals("Blind woman\nwithaverylongandunpronoucablenameorso\ngets new kidney from dad\nshe hasn't seen in years.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLongUmlauts()
|
public function testLongUmlauts()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26}');
|
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26}');
|
||||||
@@ -98,15 +62,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Blind woman\nwithaverylongandunpronouca\nblenameorso gets new\nkidney from dad she hasn't\nseen in years.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman\nwithaverylongandunpronouca\nblenameorso gets new\nkidney from dad she hasn't\nseen in years.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLongCutWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n":true}');
|
|
||||||
$this->assertEquals("Blind woman\nwithaverylongandunpronouca\nblenameorso gets new\nkidney from dad she hasn't\nseen in years.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLongCutUmlauts()
|
public function testLongCutUmlauts()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n":true}');
|
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n":true}');
|
||||||
@@ -119,15 +74,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals("Blind woman\ngets new kidney from dad she\nhasn't seen in years.", $this->smarty->fetch($tpl));
|
$this->assertEquals("Blind woman\ngets new kidney from dad she\nhasn't seen in years.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLinebreaksWithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman\ngets new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
|
|
||||||
$this->assertEquals("Blind woman\ngets new kidney from dad she\nhasn't seen in years.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLinebreaks2()
|
public function testLinebreaks2()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman
|
$tpl = $this->smarty->createTemplate('string:{"Blind woman
|
||||||
@@ -138,26 +84,4 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
|
|||||||
new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLinebreaks2WithoutMbstring()
|
|
||||||
{
|
|
||||||
\Smarty\Smarty::$_MBSTRING = false;
|
|
||||||
$this->smarty->setCompileId('mb');
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"Blind woman
|
|
||||||
gets
|
|
||||||
new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
|
|
||||||
$this->assertEquals("Blind woman
|
|
||||||
gets
|
|
||||||
new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
|
|
||||||
\Smarty\Smarty::$_MBSTRING = true;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
public function testUnicodeSpaces()
|
|
||||||
{
|
|
||||||
// Some Unicode Spaces
|
|
||||||
$string = " hello spaced       words ";
|
|
||||||
$string = mb_convert_encoding($string, 'UTF-8', "HTML-ENTITIES");
|
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $string . '"|strip}');
|
|
||||||
$this->assertEquals(" hello spaced words ", $this->smarty->fetch($tpl));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@@ -30,11 +30,6 @@ class MbSplitEncodingIssue549Test extends PHPUnit_Smarty
|
|||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
if(!\Smarty::$_MBSTRING)
|
|
||||||
{
|
|
||||||
$this->markTestSkipped("mbstring extension is not in use by Smarty");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->charset = \Smarty::$_CHARSET;
|
$this->charset = \Smarty::$_CHARSET;
|
||||||
$this->setUpSmarty(__DIR__);
|
$this->setUpSmarty(__DIR__);
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
* @subpackage PHPunitPlugin
|
* @subpackage PHPunitPlugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Smarty\Compile\Base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {getparams}
|
* Smarty {getparams}
|
||||||
*
|
*
|
||||||
@@ -14,13 +16,13 @@
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
class smarty_compiler_getparamsshort extends Smarty_Internal_CompileBase
|
class smarty_compiler_getparamsshort extends Base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Attribute definition: Overwrites base class.
|
* Attribute definition: Overwrites base class.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @see Smarty_Internal_CompileBase
|
* @see Base
|
||||||
*/
|
*/
|
||||||
public $required_attributes = array();
|
public $required_attributes = array();
|
||||||
|
|
||||||
@@ -28,14 +30,14 @@ class smarty_compiler_getparamsshort extends Smarty_Internal_CompileBase
|
|||||||
* Attribute definition: Overwrites base class.
|
* Attribute definition: Overwrites base class.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @see Smarty_Internal_CompileBase
|
* @see Base
|
||||||
*/
|
*/
|
||||||
public $optional_attributes = array('_any');
|
public $optional_attributes = array('_any');
|
||||||
/**
|
/**
|
||||||
* Attribute definition: Overwrites base class.
|
* Attribute definition: Overwrites base class.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @see Smarty_Internal_CompileBase
|
* @see Base
|
||||||
*/
|
*/
|
||||||
public $shorttag_order = array('s1', 's2', 's3');
|
public $shorttag_order = array('s1', 's2', 's3');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user