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


PHP sfRequest::initialize方法代码示例

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


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

示例1: initialize

 /**
  * Initializes this sfRequest.
  *
  * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance
  * @param  array             $parameters  An associative array of initialization parameters
  * @param  array             $attributes  An associative array of initialization attributes
  *
  * @return bool true, if initialization completes successfully, otherwise false
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest
  */
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array())
 {
     parent::initialize($dispatcher, $parameters, $attributes);
     if (isset($_SERVER['REQUEST_METHOD'])) {
         switch ($_SERVER['REQUEST_METHOD']) {
             case 'GET':
                 $this->setMethod(self::GET);
                 break;
             case 'POST':
                 $this->setMethod(self::POST);
                 break;
             case 'PUT':
                 $this->setMethod(self::PUT);
                 break;
             case 'DELETE':
                 $this->setMethod(self::DELETE);
                 break;
             case 'HEAD':
                 $this->setMethod(self::HEAD);
                 break;
             default:
                 $this->setMethod(self::GET);
         }
     } else {
         // set the default method
         $this->setMethod(self::GET);
     }
     foreach ($this->getAttribute('formats', array()) as $format => $mimeTypes) {
         $this->setFormat($format, $mimeTypes);
     }
     // load parameters from GET/PATH_INFO/POST
     $this->loadParameters();
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:44,代码来源:sfWebRequest.class.php

示例2: initialize

 /**
  * Initializes this sfRequest.
  *
  * Available options:
  *
  *  * formats:           The list of supported format and their associated mime-types
  *  * path_info_key:     The path info key (default to PATH_INFO)
  *  * path_info_array:   The path info array (default to SERVER)
  *  * relative_url_root: The relative URL root
  *  * http_port:         The port to use for HTTP requests
  *  * https_port:        The port to use for HTTPS requests
  *
  * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance
  * @param  array             $parameters  An associative array of initialization parameters
  * @param  array             $attributes  An associative array of initialization attributes
  * @param  array             $options     An associative array of options
  *
  * @return bool true, if initialization completes successfully, otherwise false
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest
  *
  * @see sfRequest
  */
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     $options = array_merge(array('path_info_key' => 'PATH_INFO', 'path_info_array' => 'SERVER', 'http_port' => null, 'https_port' => null, 'default_format' => null), $options);
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     // GET parameters
     $this->getParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_GET) : $_GET;
     $this->parameterHolder->add($this->getParameters);
     $postParameters = $_POST;
     if (isset($_SERVER['REQUEST_METHOD'])) {
         switch ($_SERVER['REQUEST_METHOD']) {
             case 'GET':
                 $this->setMethod(self::GET);
                 break;
             case 'POST':
                 if (isset($_POST['sf_method'])) {
                     $this->setMethod(strtoupper($_POST['sf_method']));
                     unset($postParameters['sf_method']);
                 } elseif (isset($_GET['sf_method'])) {
                     $this->setMethod(strtoupper($_GET['sf_method']));
                     unset($_GET['sf_method']);
                 } else {
                     $this->setMethod(self::POST);
                 }
                 $this->parameterHolder->remove('sf_method');
                 break;
             case 'PUT':
                 $this->setMethod(self::PUT);
                 if ('application/x-www-form-urlencoded' === $this->getContentType()) {
                     parse_str($this->getContent(), $postParameters);
                 }
                 break;
             case 'DELETE':
                 $this->setMethod(self::DELETE);
                 if ('application/x-www-form-urlencoded' === $this->getContentType()) {
                     parse_str($this->getContent(), $postParameters);
                 }
                 break;
             case 'HEAD':
                 $this->setMethod(self::HEAD);
                 break;
             default:
                 $this->setMethod(self::GET);
         }
     } else {
         // set the default method
         $this->setMethod(self::GET);
     }
     $this->postParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($postParameters) : $postParameters;
     $this->parameterHolder->add($this->postParameters);
     if (isset($this->options['formats'])) {
         foreach ($this->options['formats'] as $format => $mimeTypes) {
             $this->setFormat($format, $mimeTypes);
         }
     }
     // additional parameters
     $this->requestParameters = $this->parseRequestParameters();
     $this->parameterHolder->add($this->requestParameters);
     $this->fixParameters();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:82,代码来源:sfWebRequest.class.php

示例3: initialize

 /**
  * Initializes this sfRequest.
  *
  * Available options:
  *
  *  * formats:           The list of supported format and their associated mime-types
  *  * path_info_key:     The path info key (default to SERVER)
  *  * path_info_array:   The path info key (default to PATH_INFO)
  *  * relative_url_root: The relative URL root
  *
  * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance
  * @param  array             $parameters  An associative array of initialization parameters
  * @param  array             $attributes  An associative array of initialization attributes
  * @param  array             $options     An associative array of options
  *
  * @return bool true, if initialization completes successfully, otherwise false
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest
  *
  * @see sfRequest
  */
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     // GET parameters
     $this->getParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_GET) : $_GET;
     $this->parameterHolder->add($this->getParameters);
     // POST parameters
     $this->postParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_POST) : $_POST;
     $this->parameterHolder->add($this->postParameters);
     if (isset($_SERVER['REQUEST_METHOD'])) {
         switch ($_SERVER['REQUEST_METHOD']) {
             case 'GET':
                 $this->setMethod(self::GET);
                 break;
             case 'POST':
                 $this->setMethod(strtoupper($this->getParameter('sf_method', 'POST')));
                 $this->parameterHolder->remove('sf_method');
                 break;
             case 'PUT':
                 $this->setMethod(self::PUT);
                 $putParameters = array();
                 parse_str($this->getContent(), $putParameters);
                 $putParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($putParameters) : $putParameters;
                 $this->parameterHolder->add($putParameters);
                 break;
             case 'DELETE':
                 $this->setMethod(self::DELETE);
                 break;
             case 'HEAD':
                 $this->setMethod(self::HEAD);
                 break;
             default:
                 $this->setMethod(self::GET);
         }
     } else {
         // set the default method
         $this->setMethod(self::GET);
     }
     if (isset($this->options['formats'])) {
         foreach ($this->options['formats'] as $format => $mimeTypes) {
             $this->setFormat($format, $mimeTypes);
         }
     }
     if (!isset($this->options['path_info_key'])) {
         $this->options['path_info_key'] = 'PATH_INFO';
     }
     if (!isset($this->options['path_info_array'])) {
         $this->options['path_info_array'] = 'SERVER';
     }
     // additional parameters
     $this->requestParameters = $this->parseRequestParameters();
     $this->parameterHolder->add($this->requestParameters);
     $this->fixParameters();
 }
开发者ID:hibharani,项目名称:mongodbloganalyzer,代码行数:75,代码来源:sfWebRequest.class.php

示例4: initialize

 public function initialize($context, $parameters = array(), $attributes = array())
 {
     parent::initialize($context, $parameters, $attributes);
     if (isset($_SERVER['REQUEST_METHOD'])) {
         switch ($_SERVER['REQUEST_METHOD']) {
             case 'GET':
                 $this->setMethod(self::GET);
                 break;
             case 'POST':
                 $this->setMethod(self::POST);
                 break;
             case 'PUT':
                 $this->setMethod(self::PUT);
                 break;
             case 'DELETE':
                 $this->setMethod(self::DELETE);
                 break;
             case 'HEAD':
                 $this->setMethod(self::HEAD);
                 break;
             default:
                 $this->setMethod(self::GET);
         }
     } else {
         $this->setMethod(self::GET);
     }
     $this->loadParameters();
 }
开发者ID:kotow,项目名称:work,代码行数:28,代码来源:config_core_compile.yml.php

示例5: initialize

 /**
  * Initializes this sfRequest.
  *
  * @param sfContext A sfContext instance
  * @param array   An associative array of initialization parameters
  * @param array   An associative array of initialization attributes
  *
  * @return boolean true, if initialization completes successfully, otherwise false
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this Request
  */
 public function initialize($context, $parameters = array(), $attributes = array())
 {
     parent::initialize($context, $parameters, $attributes);
     $this->getParameterHolder()->add($_SERVER['argv']);
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:16,代码来源:sfConsoleRequest.class.php

示例6: initialize

 /**
  * Initializes this sfRequest.
  *
  * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance
  * @param  array             $parameters  An associative array of initialization parameters
  * @param  array             $attributes  An associative array of initialization attributes
  * @param  array             $options     An associative array of options
  *
  * @return bool true, if initialization completes successfully, otherwise false
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest
  */
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     $this->getParameterHolder()->add($_SERVER['argv']);
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:17,代码来源:sfConsoleRequest.class.php


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