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


PHP Authorization::setAuthorizationParams方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * Upon invoking of the constructor, a few objects need to be created
  * in order to approve, authorize and secure the action contexts.
  *
  * This constructor sets up the Security, ErrorContainer, Authorization
  * and also sets the request parameters, files parameters, the format of the output
  * and of course the most important part which is the action/output contexts themselves.
  *
  * @warning IF-Clusterfuck.
  *
  * @see Security
  * @see ErrorContainer
  * @see Authorization
  * @params object $customAuthorization optional custom authorization extending Frapi_Authorization
  */
 public function __construct($customAuthorization = null)
 {
     try {
         $this->security = new Frapi_Security();
         $this->authorization = $customAuthorization instanceof Frapi_Authorization ? $customAuthorization : new Frapi_Authorization();
         $this->router = new Frapi_Router();
         $this->router->loadAndPrepareRoutes();
         $this->setInputFormat();
         $uri = $_SERVER['REQUEST_URI'];
         // For some reason, this is now a fatal
         // error in 5.3 and no longer a warning
         // in php (parse_url() with an http:// in the URL_PATH)...
         if (stristr($uri, '?') !== false) {
             $uri = substr($uri, 0, strpos($uri, '?'));
         }
         $query_path = parse_url($uri, PHP_URL_PATH);
         // @deprecated The use of extensions is considered deprecated
         //Query ending in .xxx may or may not be an output format
         $query_path_format = pathinfo($query_path, PATHINFO_EXTENSION);
         $format = $this->getParam('format');
         if (is_string($query_path_format) && strlen($query_path_format) || $format) {
             $extension = $query_path_format ? $query_path_format : $format;
             if ($query_path_format) {
                 $query_path = substr($query_path, 0, (strlen($extension) + 1) * -1);
             }
             if (Frapi_Rules::validateOutputType($extension) === true) {
                 $accept = Frapi_Output::getMimeTypeByFormat($extension);
                 if (isset($_SERVER['HTTP_ACCEPT'])) {
                     $_SERVER['HTTP_ACCEPT'] = $accept . ',' . $_SERVER['HTTP_ACCEPT'];
                 } else {
                     $_SERVER['HTTP_ACCEPT'] = $accept;
                 }
             }
             $query_path_format = $format = null;
         }
         if ($routed = $this->router->match($query_path)) {
             $_REQUEST = array_merge($_REQUEST, $routed['params']);
             $this->setAction(strtolower($routed['action']));
             $this->setRequest($_REQUEST);
         } else {
             $this->setRequest($_REQUEST);
             $this->setAction($this->getParam('action'));
         }
         // assign the files and params from the request
         $this->setFiles($_FILES)->setParams($this->request);
         $this->authorization->setAuthorizationParams($this->getParams());
     } catch (Frapi_Exception $e) {
         // Something RONG happened. Need to tell developers.
         throw $e;
     } catch (Exception $e) {
         // Something else? Silence! I Keeel you.
     }
 }
开发者ID:nickolasnikolic,项目名称:frapi,代码行数:70,代码来源:Main.php

示例2: __construct

 /**
  * Constructor
  *
  * Upon invoking of the constructor, a few objects need to be created
  * in order to approve, authorize and secure the action contexts.
  *
  * This constructor sets up the Security, ErrorContainer, Authorization
  * and also sets the request parameters, files parameters, the format of the output
  * and of course the most important part which is the action/output contexts themselves.
  *
  * @warning IF-Clusterfuck.
  *
  * @see Security
  * @see ErrorContainer
  * @see Authorization
  * @see Frapi_Router
  */
 public function __construct()
 {
     try {
         $this->security = new Frapi_Security();
         $this->authorization = new Frapi_Authorization();
         $this->router = new Frapi_Router();
         $this->router->loadAndPrepareRoutes();
         $this->setInputFormat();
         $uri = $_SERVER['REQUEST_URI'];
         // For some reason, this is now a fatal
         // error in 5.3 and no longer a warning
         // in php (parse_url() with an http:// in the URL_PATH)...
         if (stristr($uri, '?') !== false) {
             $uri = substr($uri, 0, strpos($uri, '?'));
         }
         $query_path = parse_url($uri, PHP_URL_PATH);
         //Query ending in .xxx may or may not be an output format
         $query_path_format = null;
         if (strrpos($query_path, '.')) {
             $query_path_format = substr($query_path, $format_pos = strrpos($query_path, '.') + 1);
         }
         if (Frapi_Rules::validateOutputType($query_path_format) === true) {
             //Output format suffix is valid, remove from URL!
             $query_path = substr($query_path, 0, $format_pos - 1);
         } else {
             $query_path_format = null;
         }
         if ($routed = $this->router->match($query_path)) {
             $_REQUEST = array_merge($_REQUEST, $routed['params']);
             $this->setAction(strtolower($routed['action']));
             $this->setRequest($_REQUEST);
         } else {
             $this->setRequest($_REQUEST);
             $this->setAction($this->getParam('action'));
         }
         $this->setFiles($_FILES);
         try {
             $format = $this->getParam('format');
             if (!is_null($query_path_format)) {
                 $format = $query_path_format;
                 $this->formatSetByExtension = true;
             }
             $setFormat = $this->getFormat();
             $this->setFormat(isset($setFormat) && Frapi_Controller_Api::DEFAULT_OUTPUT_FORMAT == $setFormat ? $format : $setFormat);
         } catch (Frapi_Exception $fex) {
             $this->setFormat($this->getDefaultFormatFromConfiguration());
         }
         $this->authorization->setAuthorizationParams($this->getParams());
     } catch (Frapi_Exception $e) {
         // Something RONG happened. Need to tell developers.
         throw $e;
     } catch (Exception $e) {
         // Something else? Silence! I Keeel you.
     }
 }
开发者ID:helgi,项目名称:frapi,代码行数:72,代码来源:Main.php

示例3: __construct

 /**
  * Constructor
  *
  * Upon invoking of the constructor, a few objects need to be created
  * in order to approve, authorize and secure the action contexts.
  *
  * This constructor sets up the Security, ErrorContainer, Authorization
  * and also sets the request parameters, files parameters, the format of the output
  * and of course the most important part which is the action/output contexts themselves.
  *
  * @warning IF-Clusterfuck.
  *
  * @see Security
  * @see ErrorContainer
  * @see Authorization
  * @see Frapi_Router
  */
 public function __construct()
 {
     try {
         $this->security = new Frapi_Security();
         $this->authorization = new Frapi_Authorization();
         $this->router = new Frapi_Router();
         $this->router->loadAndPrepareRoutes();
         $query_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
         //Query ending in .xxx may or may not be an output format
         $query_path_format = null;
         if (strrpos($query_path, '.')) {
             $query_path_format = substr($query_path, $format_pos = strrpos($query_path, '.') + 1);
         }
         if (Frapi_Rules::validateOutputType($query_path_format) === true) {
             //Output format suffix is valid, remove from URL!
             $query_path = substr($query_path, 0, $format_pos - 1);
         } else {
             $query_path_format = null;
         }
         if ($routed = $this->router->match($query_path)) {
             $_REQUEST = array_merge($_REQUEST, $routed['params']);
             $this->setAction(strtolower($routed['action']));
             $this->setRequest($_REQUEST);
         } else {
             $this->setRequest($_REQUEST);
             $this->setAction($this->getParam('action'));
         }
         $this->setFiles($_FILES);
         try {
             if (!is_null($query_path_format)) {
                 $format = $query_path_format;
             } else {
                 $format = $this->getParam('format');
             }
             $this->setFormat($format);
         } catch (Frapi_Exception $fex) {
             $this->setFormat($this->getDefaultFormatFromConfiguration());
         }
         $this->authorization->setAuthorizationParams($this->getParams());
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:jeremykendall,项目名称:spaz-api,代码行数:60,代码来源:Main.php


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