/[cvs]/nfo/php/libs/net.php.smarty/plugins/shared.escape_special_chars.php
ViewVC logotype

Annotation of /nfo/php/libs/net.php.smarty/plugins/shared.escape_special_chars.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Jun 16 21:58:17 2004 UTC (20 years, 1 month ago) by joko
Branch: MAIN
CVS Tags: HEAD
updated to smarty-2.6.3

1 joko 1.1 <?php
2     /**
3     * Smarty shared plugin
4     * @package Smarty
5     * @subpackage plugins
6     */
7    
8    
9     /**
10     * escape_special_chars common function
11     *
12     * Function: smarty_function_escape_special_chars<br>
13     * Purpose: used by other smarty functions to escape
14     * special chars except for already escaped ones
15     * @param string
16     * @return string
17     */
18     function smarty_function_escape_special_chars($string)
19     {
20     if(!is_array($string)) {
21     $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
22     $string = htmlspecialchars($string);
23     $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
24     }
25     return $string;
26     }
27    
28     /* vim: set expandtab: */
29    
30     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed