當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。