当前位置: 首页>>代码示例>>PHP>>正文


PHP JInput::__construct方法代码示例

本文整理汇总了PHP中JInput::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP JInput::__construct方法的具体用法?PHP JInput::__construct怎么用?PHP JInput::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JInput的用法示例。


在下文中一共展示了JInput::__construct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Public constructor. Overriden to allow specifying the global input array
  * to use as a string and instantiate from an objetc holding variables.
  *
  * @param   array|string|object|null  $source   Source data; set null to use $_REQUEST
  * @param   array                     $options  Filter options
  */
 public function __construct($source = null, array $options = array())
 {
     $hash = null;
     if (is_string($source)) {
         $hash = strtoupper($source);
         switch ($hash) {
             case 'GET':
                 $source = $_GET;
                 break;
             case 'POST':
                 $source = $_POST;
                 break;
             case 'FILES':
                 $source = $_FILES;
                 break;
             case 'COOKIE':
                 $source = $_COOKIE;
                 break;
             case 'ENV':
                 $source = $_ENV;
                 break;
             case 'SERVER':
                 $source = $_SERVER;
                 break;
             default:
                 $source = $_REQUEST;
                 $hash = 'REQUEST';
                 break;
         }
     } elseif (is_object($source)) {
         try {
             $source = (array) $source;
         } catch (Exception $exc) {
             $source = null;
         }
     } elseif (is_array($source)) {
         // Nothing, it's already an array
     } else {
         // Any other case
         $source = $_REQUEST;
         $hash = 'REQUEST';
     }
     // Magic quotes GPC handling (something JInput simply can't handle at all)
     if ($hash == 'REQUEST' && get_magic_quotes_gpc() && class_exists('JRequest', true)) {
         $source = JRequest::get('REQUEST', 2);
     }
     parent::__construct($source, $options);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:55,代码来源:input.php

示例2: __construct

 /**
  * Public constructor. Overridden to allow specifying the global input array
  * to use as a string and instantiate from an object holding variables.
  *
  * @param   array|string|object|null  $source   Source data; set null to use $_REQUEST
  * @param   array                     $options  Filter options
  */
 public function __construct($source = null, array $options = array())
 {
     $hash = null;
     if (is_string($source)) {
         $hash = strtoupper($source);
         switch ($hash) {
             case 'GET':
                 $source = $_GET;
                 break;
             case 'POST':
                 $source = $_POST;
                 break;
             case 'FILES':
                 $source = $_FILES;
                 break;
             case 'COOKIE':
                 $source = $_COOKIE;
                 break;
             case 'ENV':
                 $source = $_ENV;
                 break;
             case 'SERVER':
                 $source = $_SERVER;
                 break;
             default:
                 $source = $_REQUEST;
                 $hash = 'REQUEST';
                 break;
         }
     } elseif (is_object($source) && $source instanceof Input) {
         $source = $source->getData();
     } elseif (is_object($source) && $source instanceof \JInput) {
         $serialised = $source->serialize();
         list($xOptions, $xData, $xInput) = unserialize($serialised);
         unset($xOptions);
         unset($xInput);
         unset($source);
         $source = $xData;
         unset($xData);
     } elseif (is_object($source)) {
         try {
             $source = (array) $source;
         } catch (\Exception $exc) {
             $source = null;
         }
     } elseif (is_array($source)) {
         // Nothing, it's already an array
     } else {
         // Any other case
         $source = null;
     }
     // If we are not sure use the REQUEST array
     if (empty($source)) {
         $source = $_REQUEST;
         $hash = 'REQUEST';
     }
     // Magic quotes GPC handling (something JInput simply can't handle at all)
     // @codeCoverageIgnoreStart
     if ($hash == 'REQUEST' && get_magic_quotes_gpc() && class_exists('\\JRequest', true)) {
         $source = \JRequest::get('REQUEST', 2);
     }
     // @codeCoverageIgnoreEnd
     parent::__construct($source, $options);
 }
开发者ID:akeeba,项目名称:fof,代码行数:71,代码来源:Input.php


注:本文中的JInput::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。