shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

request.php (1100B)


      1 <?php
      2 /**
      3  * @package		OpenCart
      4  * @author		Daniel Kerr
      5  * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
      6  * @license		https://opensource.org/licenses/GPL-3.0
      7  * @link		https://www.opencart.com
      8 */
      9 
     10 /**
     11 * Request class
     12 */
     13 class Request {
     14 	public $get = array();
     15 	public $post = array();
     16 	public $cookie = array();
     17 	public $files = array();
     18 	public $server = array();
     19 	
     20 	/**
     21 	 * Constructor
     22  	*/
     23 	public function __construct() {
     24 		$this->get = $this->clean($_GET);
     25 		$this->post = $this->clean($_POST);
     26 		$this->request = $this->clean($_REQUEST);
     27 		$this->cookie = $this->clean($_COOKIE);
     28 		$this->files = $this->clean($_FILES);
     29 		$this->server = $this->clean($_SERVER);
     30 	}
     31 	
     32 	/**
     33      * 
     34 	 * @param	array	$data
     35 	 *
     36      * @return	array
     37      */
     38 	public function clean($data) {
     39 		if (is_array($data)) {
     40 			foreach ($data as $key => $value) {
     41 				unset($data[$key]);
     42 
     43 				$data[$this->clean($key)] = $this->clean($value);
     44 			}
     45 		} else {
     46 			$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
     47 		}
     48 
     49 		return $data;
     50 	}
     51 }