Takes an array and wraps it inside an object. If $strict is not set to
FALSE, the original array will be destroyed, and the data can only be
accessed via the object's accessor methods
/** * Returns the $_FILES data wrapped in an Cage object * * This utilizes a singleton pattern to get around scoping issues * * @param string $config_file * @param boolean $strict whether or not to nullify the superglobal array * @return Cage */ public static function makeFilesCage($config_file = null, $strict = true) { /** * @staticvar $_instance */ static $_instance; if (!isset($_instance)) { $_instance = Cage::factory($_FILES, $config_file, '_FILES', $strict); } $GLOBALS['HTTP_POST_FILES'] = null; return $_instance; }
/** */ public function testNoTagsOrSpecial() { $input = array('foo' => ' <SCRIPT<strong>>alert(\'foobar\');<</strong>/SCRIPT>'); $cage = Cage::factory($input); $expect = '    alert(&#39;foobar&#39;);'; $this->assertSame($expect, $cage->noTagsOrSpecial('foo')); }