Inspekt\Inspekt::makePostCage PHP Method

makePostCage() public static method

This utilizes a singleton pattern to get around scoping issues
public static makePostCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
return Cage
    public static function makePostCage($config_file = null, $strict = true)
    {
        /**
         * @staticvar $_instance
         */
        static $_instance;
        if (!isset($_instance)) {
            $_instance = Cage::factory($_POST, $config_file, '_POST', $strict);
        }
        $GLOBALS['HTTP_POST_VARS'] = null;
        return $_instance;
    }

Usage Example

Ejemplo n.º 1
0
/**
 * second level of scoping
 *
 */
function testScoping2()
{
    $cage_POST = Inspekt::makePostCage();
    echo "<pre>In " . __FUNCTION__ . "(): ";
    var_dump($cage_POST->testAlnum('/funky,_+=_\\|;:!@#$%^&*~time/0/0/`~foo,.+=_\\|;:!@#$%^&*~-bar'));
    echo "</pre>\n";
    echo "<pre>POST is not accessible here: ";
    var_dump($_POST);
    echo "</pre>\n";
}
All Usage Examples Of Inspekt\Inspekt::makePostCage