summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-08-29 10:45:47 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-08-29 10:45:47 -0700
commit020281d932c566476222e6c825ada3affff239a6 (patch)
tree80d8e2a60fcbaeabcc1939b06531f563c3014948 /modules/gallery/helpers
parenta2e2a2178b1b84a9895fdddd020c5ec8dddf89c5 (diff)
Adding SafeString which is going to replace p::clean() and p::purify().
Refactoring of Xss_Security_Test. t() and t2() return a SafeString instance. TODO: - Update all code to use SafeString where appropriate. - Update golden fole of Xss_Security_Test - Stop reporting CLEAN vars in Xss_Security_Test
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/p.php16
1 files changed, 3 insertions, 13 deletions
diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php
index 862c769b..e852c086 100644
--- a/modules/gallery/helpers/p.php
+++ b/modules/gallery/helpers/p.php
@@ -18,22 +18,12 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class p_Core {
- private static $_purifier = null;
static function clean($dirty_html) {
- return html::specialchars($dirty_html);
+ return new SafeString($dirty_html);
}
+ // Deprecated: Please use p::clean($var).purified_html()
static function purify($dirty_html) {
- if (empty(self::$_purifier)) {
- require_once(dirname(__file__) . "/../lib/HTMLPurifier/HTMLPurifier.auto.php");
- $config = HTMLPurifier_Config::createDefault();
- foreach (Kohana::config('purifier') as $category => $key_value) {
- foreach ($key_value as $key => $value) {
- $config->set("$category.$key", $value);
- }
- }
- self::$_purifier = new HTMLPurifier($config);
- }
- return self::$_purifier->purify($dirty_html);
+ return SafeString::of($dirty_html)->purified_html();
}
}