diff --git a/gump.class.php b/gump.class.php index fec98674..04a6de28 100644 --- a/gump.class.php +++ b/gump.class.php @@ -54,6 +54,10 @@ public static function get_instance(){ public static $basic_tags = '
'; + // By default the instance_tags are the basic tags, but they can be changed on a per instance + // of GUMP basis (see the constructor) + public $instance_tags; + public static $en_noise_words = "about,after,all,also,an,and,another,any,are,as,at,be,because,been,before, being,between,both,but,by,came,can,come,could,did,do,each,for,from,get, got,has,had,he,have,her,here,him,himself,his,how,if,in,into,is,it,its,it's,like, @@ -66,6 +70,15 @@ public static function get_instance(){ // field characters below will be replaced with a space. protected $fieldCharsToRemove = array('_', '-'); + public function __construct($opts = array()) { + $this->instance_tags = static::$basic_tags; + + // permit overrides + foreach($opts as $key => $value) { + $this->$key = $value; + } + } + // ** ------------------------- Validation Helpers ---------------------------- ** // /** @@ -325,7 +338,9 @@ public function sanitize(array $input, array $fields = array(), $utf8_encode = t } } - $value = filter_var($value, FILTER_SANITIZE_STRING); + // old code - filter_var($value, FILTER_SANITIZE_STRING); + // See #106 https://github.com/Wixel/GUMP/issues/106 + $value = $this->filter_basic_tags($value); } $return[$field] = $value; @@ -927,7 +942,7 @@ protected function filter_sanitize_numbers($value, $params = null) */ protected function filter_basic_tags($value, $params = null) { - return strip_tags($value, self::$basic_tags); + return strip_tags($value, $this->instance_tags); } /**