Location: PHPKode > projects > Entier Studio > entierstudio/framework/httprequest.php
<?php
/**
 * Entier Studio
 *
 * LICENSE
 *
 *	Copyright 2006 Entier Studio team.
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 * @package    entier.framework
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: httprequest.php 94 2008-02-03 23:35:48Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefHttpRequest")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefHttpRequest", "1");
    //
    define("HTTP_VARS_REQUEST", 1);
    define("HTTP_VARS_SESSION", 4);
    define("HTTP_VARS_COOKIES", 8);
    //-------------------------------------------------------------------------
    //	Class
    class HttpRequest {
        //---------------------------------------------------------------------
        //	Attributes
        
        /**
         * Variables array
         *
         * @var	array
         */
        var $m_Parameters = array();
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         * HttpRequest constructor.
         *
         * @param	integer	variables processing kind
         * @access	public
         */
        function HttpRequest($method = HTTP_VARS_REQUEST) {
            //
            if ($method&HTTP_VARS_REQUEST) {
                //
                switch ($_SERVER['REQUEST_METHOD']) {
                    case 'GET':
                        #
                        $this->merge_variables_array($_GET);
                        //
                        
                    break;
                    case 'POST':
                        #
                        $this->merge_variables_array($_POST);
                        //
                        
                    break;
                }
            }
            //
            if ($method&HTTP_VARS_SESSION) $this->merge_variables_array($_SESSION);
            //
            if ($method&HTTP_VARS_COOKIES) $this->merge_variables_array($_COOKIE);
        }
        //---------------------------------------------------------------------
        //	Properties
        //	Property:	query_set
        
        /**
         *
         * @return	array
         */
        function Parameters() {
            return ($this->m_Parameters);
        }
        /**
         *
         * @return
         */
        function Parameter($name) {
            if( isset($this->m_Parameters[$name]) )
				return ($this->m_Parameters[$name]);
			return null;		
        }
        //---------------------------------------------------------------------
        //	Methods
        function merge_variables_array($array) {
            //
            if (is_array($array)) {
                $this->m_Parameters+= $array;
                return (true);
            }
            //
            return (false);
        }
    };
    # End class HttpRequest
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio