Net_UserAgent_Mobile
[ class tree: Net_UserAgent_Mobile ] [ index: Net_UserAgent_Mobile ] [ all elements ]

Source for file Request.php

Documentation is available at Request.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2004 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 3.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available through the world-wide-web at the following url:           |
  11. // | http://www.php.net/license/3_0.txt.                                  |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: KUBO Atsuhiro <kubo@isite.co.jp>                            |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Request.php,v 1.4 2004/02/08 11:58:38 kuboa Exp $
  20. //
  21.  
  22. /**
  23.  * Utility class that constructs appropriate class instance for miscellaneous
  24.  * HTTP header containers
  25.  *
  26.  * @package  Net_UserAgent_Mobile
  27.  * @category Networking
  28.  * @author   KUBO Atsuhiro <kubo@isite.co.jp>
  29.  * @access   public
  30.  * @version  $Revision: 1.4 $
  31.  */
  32. {
  33.  
  34.     /**#@+
  35.      * @access public
  36.      * @static
  37.      */
  38.  
  39.     // }}}
  40.     // {{{ factory()
  41.  
  42.     /**
  43.      * create a new Net_UserAgent_Mobile_Request_XXX instance
  44.      *
  45.      * parses HTTP headers and constructs appropriate class instance.
  46.      * If no argument is supplied, $_SERVER is used.
  47.      *
  48.      * @param mixed $stuff User-Agent string or object that works with
  49.      *      HTTP_Request (not implemented)
  50.      * @return mixed a newly created Net_UserAgent_Request object
  51.      * @global array $_SERVER 
  52.      */
  53.     function &factory($stuff = null)
  54.     {
  55.         if ($stuff === null{
  56.             $request &new Net_UserAgent_Mobile_Request_Env($_SERVER);
  57.         else {
  58.             $request =
  59.                 &new Net_UserAgent_Mobile_Request_Env(array(
  60.                                                             'HTTP_USER_AGENT' => $stuff)
  61.                                                       );
  62.         }
  63.         return $request;
  64.     }
  65.  
  66.     /**#@-*/
  67. }
  68.  
  69. /**
  70.  * provides easy way to access environment variables
  71.  *
  72.  * @package  Net_UserAgent_Mobile
  73.  * @category Networking
  74.  * @author   KUBO Atsuhiro <kubo@isite.co.jp>
  75.  * @access   public
  76.  * @version  $Revision: 1.4 $
  77.  */
  78. {
  79.  
  80.     // {{{ properties
  81.  
  82.     /**#@+
  83.      * @access private
  84.      */
  85.  
  86.     /**
  87.      * array of environment variables defined by Web Server
  88.      * @var array 
  89.      */
  90.     var $_env;
  91.  
  92.     /**#@-*/
  93.  
  94.     /**#@+
  95.      * @access public
  96.      */
  97.  
  98.     // }}}
  99.     // {{{ constructor
  100.  
  101.     /**
  102.      * constructor
  103.      *
  104.      * @param array $env 
  105.      */
  106.     function Net_UserAgent_Mobile_Request_Env($env)
  107.     {
  108.         $this->_env $env;
  109.     }
  110.  
  111.     /**
  112.      * returns a specified HTTP Header
  113.      *
  114.      * @param string $header 
  115.      * @return string 
  116.      */
  117.     function get($header)
  118.     {
  119.         $header strtr($header'-''_');
  120.         return @$this->_env'HTTP_' strtoupper($header];
  121.     }
  122.  
  123.     /**#@-*/
  124. }
  125.  
  126. /*
  127.  * Local Variables:
  128.  * mode: php
  129.  * coding: iso-8859-1
  130.  * tab-width: 4
  131.  * c-basic-offset: 4
  132.  * c-hanging-comment-ender-p: nil
  133.  * indent-tabs-mode: nil
  134.  * End:
  135.  */
  136. ?>

Documentation generated on Mon, 11 Mar 2019 14:16:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.