Location: PHPKode > scripts > WebNight Commander > webnight-commander-v2/source/includes/11_class_gpc.php
<?php

class gpc {
    protected $get;
    protected $post;
    protected $cookie;

    public function __construct() {
        $this->get = self::clear_slashes($_GET);
        $this->post = self::clear_slashes($_POST);
        $this->cookie = self::clear_slashes($_COOKIE);
    }

    public function get() {
        $args = func_get_args();
        return $this->get_source($this->get, $args);
    }

    public function post() {
        $args = func_get_args();
        return $this->get_source($this->post, $args);
    }

    public function cookie() {
        $args = func_get_args();
        return $this->get_source($this->cookie, $args);
    }

    protected function get_source($src, $args) {
        foreach ($args as $arg)
            if (isset($src[$arg]))
                $src = $src[$arg];
            else
                return null;
        return $src;
    }

    static function clear_slashes($sbj) {
        if (ini_get('magic_quotes_gpc')) {
            if (is_array($sbj))
                foreach ($sbj as $key => $val)
                    $sbj[$key] = self::clear_slashes($val);
            elseif (is_scalar($sbj))
                $sbj = stripslashes($sbj);
        }
        return $sbj;
    }

}

?>
Return current item: WebNight Commander