@@ -186,13 +186,15 @@ public function hasGetParam($key) {
186186
187187 /**
188188 * Returns the GET parameter value from the request.
189- * @param string $key - the parameter name
190- * @param mixed $default - the default value to return when parameter does not exist (optional, default is NULL).
189+ * @param string $key - the parameter name
190+ * @param mixed $default - the default value to return when parameter does not exist (optional, default is NULL).
191+ * @param object $filter - a filter to sanitize the value.
191192 * @return mixed the parameter value or its default.
192193 */
193- public function getGetParam ($ key , $ default = NULL ) {
194+ public function getGetParam ($ key , $ default = NULL , $ filter = NULL ) {
194195 $ params = $ this ->getParams ;
195- return isset ($ params [$ key ]) ? $ params [$ key ] : $ default ;
196+ if ($ filter == NULL ) $ filter = StringFilters::$ NO_HTML ;
197+ return isset ($ params [$ key ]) ? $ filter ->filter ($ params [$ key ]) : $ default ;
196198 }
197199
198200 /**
@@ -214,13 +216,15 @@ public function hasPostParam($key) {
214216
215217 /**
216218 * Returns the POST parameter value from the request.
217- * @param string $key - the parameter name
218- * @param mixed $default - the default value to return when parameter does not exist (optional, default is NULL).
219+ * @param string $key - the parameter name
220+ * @param mixed $default - the default value to return when parameter does not exist (optional, default is NULL).
221+ * @param object $filter - a filter to sanitize the value.
219222 * @return mixed the parameter value or its default.
220223 */
221- public function getPostParam ($ key , $ default = NULL ) {
224+ public function getPostParam ($ key , $ default = NULL , $ filter = NULL ) {
222225 $ params = $ this ->getPostParams ();
223- return isset ($ params [$ key ]) ? $ params [$ key ] : $ default ;
226+ if ($ filter == NULL ) $ filter = StringFilters::$ NO_HTML ;
227+ return isset ($ params [$ key ]) ? $ filter ->filter ($ params [$ key ]) : $ default ;
224228 }
225229
226230 /**
0 commit comments