diff options
Diffstat (limited to 'framework/Web/THttpUtility.php')
-rw-r--r-- | framework/Web/THttpUtility.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/framework/Web/THttpUtility.php b/framework/Web/THttpUtility.php index 6a39b91f..0e81af56 100644 --- a/framework/Web/THttpUtility.php +++ b/framework/Web/THttpUtility.php @@ -4,7 +4,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2011 PradoSoft + * @copyright Copyright © 2005-2011 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web
@@ -22,12 +22,13 @@ class THttpUtility {
private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"');
private static $_decodeTable=array('<'=>'<','>'=>'>','"'=>'"');
+ private static $_stripTable=array('<'=>'','>'=>'','"'=>'');
/**
* HTML-encodes a string.
* This method translates the following characters to their corresponding
* HTML entities: <, >, "
- * Note, unlike {@link htmlspeicalchars}, & is not translated.
+ * Note, unlike {@link htmlspecialchars}, & is not translated.
* @param string string to be encoded
* @return string encoded string
*/
@@ -46,5 +47,16 @@ class THttpUtility {
return strtr($s,self::$_decodeTable);
}
+
+ /**
+ * This method strips the following characters from a string:
+ * HTML entities: <, >, "
+ * @param string string to be encoded
+ * @return string encoded string
+ */
+ public static function htmlStrip($s)
+ {
+ return strtr($s,self::$_stripTable);
+ }
}
|