mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
added htmlall attribute to escape modifier
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- added htmlall attribute to escape (Monte)
|
||||||
- added template_exists() API function. (Andrei)
|
- added template_exists() API function. (Andrei)
|
||||||
- fixed a problem with using dynamic values for 'file'
|
- fixed a problem with using dynamic values for 'file'
|
||||||
attribute of {include_php} tag. (Andrei)
|
attribute of {include_php} tag. (Andrei)
|
||||||
|
@@ -741,6 +741,7 @@ function _generate_debug_output() {
|
|||||||
/*
|
/*
|
||||||
* Find out if the resource exists.
|
* Find out if the resource exists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$readable = true;
|
$readable = true;
|
||||||
if ($resource_type == 'file' && !@is_file($resource_name)) {
|
if ($resource_type == 'file' && !@is_file($resource_name)) {
|
||||||
$readable = false;
|
$readable = false;
|
||||||
|
@@ -669,19 +669,20 @@ no title</programlisting>
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
This is used to html escape, url escape, escape single quotes on a
|
This is used to html (or htmlall) escape, url escape, escape single
|
||||||
variable not already escaped, hex escape or hexentity escape. hex
|
quotes on a variable not already escaped, hex escape or hexentity
|
||||||
and hexentity escape can be used in conjunction to hide "mailto:"
|
escape. hex and hexentity escape can be used in conjunction to hide
|
||||||
links on a page from web spiders (spam collectors) and yet keep
|
"mailto:" links on a page from web spiders (spam collectors) and
|
||||||
them readable and linkable. By default, the variable is html
|
yet keep them readable and linkable. By default, the variable is
|
||||||
escaped.
|
html escaped.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>escape</title>
|
<title>escape</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{$articleTitle}
|
{$articleTitle}
|
||||||
{$articleTitle|escape}
|
{$articleTitle|escape}
|
||||||
{$articleTitle|escape:"html"}
|
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
|
||||||
|
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
|
||||||
{$articleTitle|escape:"url"}
|
{$articleTitle|escape:"url"}
|
||||||
{$articleTitle|escape:"quotes"}
|
{$articleTitle|escape:"quotes"}
|
||||||
<a
|
<a
|
||||||
|
@@ -741,6 +741,7 @@ function _generate_debug_output() {
|
|||||||
/*
|
/*
|
||||||
* Find out if the resource exists.
|
* Find out if the resource exists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$readable = true;
|
$readable = true;
|
||||||
if ($resource_type == 'file' && !@is_file($resource_name)) {
|
if ($resource_type == 'file' && !@is_file($resource_name)) {
|
||||||
$readable = false;
|
$readable = false;
|
||||||
|
@@ -14,6 +14,9 @@ function smarty_modifier_escape($string, $esc_type = 'html')
|
|||||||
case 'html':
|
case 'html':
|
||||||
return htmlspecialchars($string, ENT_QUOTES);
|
return htmlspecialchars($string, ENT_QUOTES);
|
||||||
|
|
||||||
|
case 'htmlall':
|
||||||
|
return htmlentities($string, ENT_QUOTES);
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return urlencode($string);
|
return urlencode($string);
|
||||||
|
|
||||||
|
@@ -14,6 +14,9 @@ function smarty_modifier_escape($string, $esc_type = 'html')
|
|||||||
case 'html':
|
case 'html':
|
||||||
return htmlspecialchars($string, ENT_QUOTES);
|
return htmlspecialchars($string, ENT_QUOTES);
|
||||||
|
|
||||||
|
case 'htmlall':
|
||||||
|
return htmlentities($string, ENT_QUOTES);
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return urlencode($string);
|
return urlencode($string);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user