N2F Request Handler

     The request handler provides an interface to handle interactions with the global variable $_REQUEST, sanitizing any of the values which are gathered.

Examples

     $request = n2f_request::getInstance();
     $mod = $request->get('nmod', N2F_TYPE_STRING, 'main');

Explanation

     When using the request::get method, it will look for $_REQUEST['nmod'], and make it will make sure that a string is returned. If the value doesn't exist, then it will return 'main' as the default value.

Sanitation Types

     N2F_TYPE_STRING, will return a string value.
     N2F_TYPE_INTEGER, will convert the value to an integer.
     N2F_TYPE_BOOL, will convert the value to a boolean.
     N2F_TYPE_DOUBLE, will convert the value to a float type.
     N2F_TYPE_JSON, will use json_decode on the value, returning a stdClass object.
     N2F_TYPE_XML, will use simplexml_load_string to convert the value to a simplexml object.

Last edited Nov 10, 2012 at 9:07 PM by cbutcher84, version 2