/** * Returns a SuperglobalsCage object, which wraps ALL input superglobals * * @param string $config_file * @param boolean $strict whether or not to nullify the superglobal * @return SuperglobalsCage */ public static function makeSuperCage($config_file = null, $strict = true) { /** * @staticvar $_instance */ static $_scinstance; if (!isset($_scinstance)) { $_scinstance = SuperglobalsCage::Factory($config_file, $strict); } return $_scinstance; }
require_once dirname(__FILE__) . "/../vendor/autoload.php"; use Inspekt\SuperglobalsCage; // for the sake of this example, plug-in some values $_POST['userid'] = '--12<strong>34</strong>'; $_POST['username'] = '******'; ?> <h2>contents of $_POST</h2> <?php echo "<pre>"; var_dump($_POST); echo "</pre>"; // create a supercage and pass it a config file path $sc = SuperglobalsCage::factory('config.ini'); ?> <h2>config file contents</h2> <?php echo "<pre>"; echo print_r(file_get_contents('config.ini'), true); echo "</pre>"; ?> <h2>echo $sc->post->getRaw('userid')</h2> <?php // displays "1234" echo "<pre>";