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