added htmlall attribute to escape modifier

This commit is contained in:
mohrt
2002-04-04 20:34:44 +00:00
parent 873f47f7a8
commit 5dd4649cba
6 changed files with 17 additions and 7 deletions

1
NEWS
View File

@@ -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)

View File

@@ -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;

View File

@@ -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 &amp; &quot; &#039; &lt; &gt; *}
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
{$articleTitle|escape:"url"} {$articleTitle|escape:"url"}
{$articleTitle|escape:"quotes"} {$articleTitle|escape:"quotes"}
&lt;a &lt;a

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);