3 * THttpUtility class file
5 * @author Qiang Xue <qiang.xue@gmail.com>
6 * @link https://github.com/pradosoft/prado
7 * @copyright Copyright © 2005-2016 The PRADO Group
8 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
15 * @author Qiang Xue <qiang.xue@gmail.com>
21 private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"');
22 private static $_decodeTable=array('<'=>'<','>'=>'>','"'=>'"');
23 private static $_stripTable=array('<'=>'','>'=>'','"'=>'');
26 * HTML-encodes a string.
27 * This method translates the following characters to their corresponding
28 * HTML entities: <, >, "
29 * Note, unlike {@link htmlspecialchars}, & is not translated.
30 * @param string string to be encoded
31 * @return string encoded string
33 public static function htmlEncode($s)
35 return strtr($s,self::$_encodeTable);
39 * HTML-decodes a string.
40 * It is the inverse of {@link htmlEncode}.
41 * @param string string to be decoded
42 * @return string decoded string
44 public static function htmlDecode($s)
46 return strtr($s,self::$_decodeTable);
50 * This method strips the following characters from a string:
51 * HTML entities: <, >, "
52 * @param string string to be encoded
53 * @return string encoded string
55 public static function htmlStrip($s)
57 return strtr($s,self::$_stripTable);