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

Source for file Display.php

Documentation is available at Display.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: Display.php,v 1.8 2004/09/25 12:37:08 kuboa Exp $
  20. //
  21.  
  22. /**
  23.  * Display information for Net_UserAgent_Mobile
  24.  *
  25.  * Net_UserAgent_Mobile_Display is a class for display information on
  26.  * {@link Net_UserAgent_Mobile}. Handy for image resizing or dispatching.
  27.  *
  28.  * SYNOPSIS:
  29.  * <code>
  30.  * require_once('Net/UserAgent/Mobile.php');
  31.  *
  32.  * $agent = &Net_UserAgent_Mobile::factory();
  33.  * $display = $agent->getDisplay();
  34.  *
  35.  * $width  = $display->getWidth();
  36.  * $height = $display->getHeight();
  37.  * list($width, $height) = $display->getSize();
  38.  *
  39.  * if ($display->isColor()) {
  40.  *     $depth = $display->getDepth();
  41.  * }
  42.  *
  43.  * // only available in DoCoMo 505i
  44.  * $width_bytes  = $display->getWidthBytes();
  45.  * $height_bytes = $display->getHeightBytes();
  46.  * </code>
  47.  *
  48.  * USING EXTERNAL MAP FILE:
  49.  * If the environment variable DOCOMO_MAP exists, the specified XML data will
  50.  * be used for DoCoMo display information.
  51.  *
  52.  * ex) Please add the following code.
  53.  * $_SERVER['DOCOMO_MAP'] = '/path/to/DoCoMoMap.xml';
  54.  *
  55.  * @package  Net_UserAgent_Mobile
  56.  * @category Networking
  57.  * @author   KUBO Atsuhiro <kubo@isite.co.jp>
  58.  * @access   public
  59.  * @version  $Revision: 1.8 $
  60.  */
  61. {
  62.  
  63.     // {{{ properties
  64.  
  65.     /**#@+
  66.      * @access private
  67.      */
  68.  
  69.     /**
  70.      * width of the display
  71.      * @var integer 
  72.      */
  73.     var $_width;
  74.  
  75.     /**
  76.      * height of the display
  77.      * @var integer 
  78.      */
  79.     var $_height;
  80.  
  81.     /**
  82.      * depth of the display
  83.      * @var integer 
  84.      */
  85.     var $_depth;
  86.  
  87.     /**
  88.      * color capability of the display
  89.      * @var boolean 
  90.      */
  91.     var $_color;
  92.  
  93.     /**
  94.      * width (bytes) of the display
  95.      * @var integer 
  96.      */
  97.     var $_widthBytes;
  98.  
  99.     /**
  100.      * height (bytes) of the display
  101.      * @var integer 
  102.      */
  103.     var $_heightBytes;
  104.  
  105.     /**#@-*/
  106.  
  107.     // }}}
  108.     // {{{ constructor
  109.  
  110.     /**
  111.      * constructor
  112.      *
  113.      * @param array $data display infomation
  114.      */
  115.     function Net_UserAgent_Mobile_Display($data)
  116.     {
  117.         $this->_width  = (integer)@$data['width'];
  118.         $this->_height = (integer)@$data['height'];
  119.         $this->_depth  = (integer)@$data['depth'];
  120.         $this->_color  = (boolean)@$data['color'];
  121.  
  122.         $this->_widthBytes  = (integer)@$data['width_bytes'];
  123.         $this->_heightBytes = (integer)@$data['height_bytes'];
  124.     }
  125.  
  126.     /**#@+
  127.      * @access public
  128.      */
  129.  
  130.     // }}}
  131.     // {{{ calcSize()
  132.  
  133.     /**
  134.      * returns width * height of the display
  135.      *
  136.      * @return integer 
  137.      */
  138.     function calcSize()
  139.     {
  140.         return $this->_width $this->_height;
  141.     }
  142.  
  143.     // }}}
  144.     // {{{ getSize()
  145.  
  146.     /**
  147.      * returns width with height of the display
  148.      *
  149.      * @return array 
  150.      */
  151.     function getSize()
  152.     {
  153.         return array($this->_width$this->_height);
  154.     }
  155.  
  156.     // }}}
  157.     // {{{ getWidth()
  158.  
  159.     /**
  160.      * returns width of the display
  161.      *
  162.      * @return integer 
  163.      */
  164.     function getWidth()
  165.     {
  166.         return $this->_width;
  167.     }
  168.  
  169.     // }}}
  170.     // {{{ getHeight()
  171.  
  172.     /**
  173.      * returns height of the display
  174.      *
  175.      * @return integer 
  176.      */
  177.     function getHeight()
  178.     {
  179.         return $this->_height;
  180.     }
  181.  
  182.     // }}}
  183.     // {{{ getDepth()
  184.  
  185.     /**
  186.      * returns depth of the display
  187.      *
  188.      * @return integer 
  189.      */
  190.     function getDepth()
  191.     {
  192.         return $this->_depth;
  193.     }
  194.  
  195.     // }}}
  196.     // {{{ isColor()
  197.  
  198.     /**
  199.      * returns true if the display has color capability
  200.      *
  201.      * @return boolean 
  202.      */
  203.     function isColor()
  204.     {
  205.         return $this->_color;
  206.     }
  207.  
  208.     // }}}
  209.     // {{{ getWidthBytes()
  210.  
  211.     /**
  212.      * returns width (bytes) of the display
  213.      *
  214.      * @return integer 
  215.      */
  216.     function getWidthBytes()
  217.     {
  218.         return $this->_widthBytes;
  219.     }
  220.  
  221.     // }}}
  222.     // {{{ getHeightBytes()
  223.  
  224.     /**
  225.      * returns height (bytes) of the display
  226.      *
  227.      * @return integer 
  228.      */
  229.     function getHeightBytes()
  230.     {
  231.         return $this->_heightBytes;
  232.     }
  233.  
  234.     /**#@-*/
  235. }
  236.  
  237. /*
  238.  * Local Variables:
  239.  * mode: php
  240.  * coding: iso-8859-1
  241.  * tab-width: 4
  242.  * c-basic-offset: 4
  243.  * c-hanging-comment-ender-p: nil
  244.  * indent-tabs-mode: nil
  245.  * End:
  246.  */
  247. ?>

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