PHP Classes

File: lib/plugins/shared.escape_chars.php

Recommend this page to a friend!
  Classes of David Tamas  >  g-template-php  >  lib/plugins/shared.escape_chars.php  >  Download  
File: lib/plugins/shared.escape_chars.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: g-template-php
Process and render templates generating PHP code
Author: By
Last change:
Date: 3 years ago
Size: 968 bytes


Class file image Download
 * gTemplate Plugins
 * @package gTemplate
 * @subpackage Plugins

 * escape_special_chars common function
 * Function: smarty_function_escape_special_chars<br>
 * Purpose: used by other smarty functions to escape
 * special chars except for already escaped ones
 * @version 1.0
 * @author Tamas David (G-Lex) <glex at>
 * @link G-Template Engine on Github
 * @internal Some source codes are taken from Smarty
 * @internal author Monte Ohrt <monte at ohrt dot com>
 * @internal link Smarty
function tpl_escape_chars($string)
$string = preg_replace('!&(#?\w+);!', '%%%TEMPLATE_START%%%\\1%%%TEMPLATE_END%%%', $string);
$string = htmlspecialchars($string);
$string = str_replace(array('%%%TEMPLATE_START%%%','%%%TEMPLATE_END%%%'), array('&',';'), $string);

For more information send a message to info at phpclasses dot org.