當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Okapi::get_allowed_base_urls方法代碼示例

本文整理匯總了PHP中okapi\Okapi::get_allowed_base_urls方法的典型用法代碼示例。如果您正苦於以下問題:PHP Okapi::get_allowed_base_urls方法的具體用法?PHP Okapi::get_allowed_base_urls怎麽用?PHP Okapi::get_allowed_base_urls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在okapi\Okapi的用法示例。


在下文中一共展示了Okapi::get_allowed_base_urls方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: call

 public static function call(OkapiRequest $request)
 {
     $result = array();
     $result['site_url'] = Settings::get('SITE_URL');
     $result['okapi_base_url'] = Okapi::get_recommended_base_url();
     $result['okapi_base_urls'] = Okapi::get_allowed_base_urls();
     $result['site_name'] = Okapi::get_normalized_site_name();
     $result['okapi_version_number'] = Okapi::$version_number;
     $result['okapi_revision'] = Okapi::$version_number;
     /* Important for backward-compatibility! */
     $result['okapi_git_revision'] = Okapi::$git_revision;
     $result['registration_url'] = Settings::get('REGISTRATION_URL');
     $result['mobile_registration_url'] = Settings::get('MOBILE_REGISTRATION_URL');
     $result['image_max_upload_size'] = Settings::get('IMAGE_MAX_UPLOAD_SIZE');
     $result['image_rcmd_max_pixels'] = Settings::get('IMAGE_MAX_PIXEL_COUNT');
     return Okapi::formatted_response($request, $result);
 }
開發者ID:kratenko,項目名稱:oc-server3,代碼行數:17,代碼來源:installation.php

示例2: init_request

 private function init_request()
 {
     $this->request = OAuthRequest::from_request();
     /* Verify if the request was issued with proper HTTP method. */
     if (!in_array($this->request->get_normalized_http_method(), array('GET', 'POST'))) {
         throw new BadRequest("Use GET and POST methods only.");
     }
     /* Verify if the request was issued with proper okapi_base_url. */
     $url = $this->request->get_normalized_http_url();
     $allowed = false;
     foreach (Okapi::get_allowed_base_urls() as $allowed_prefix) {
         if (strpos($url, $allowed_prefix) === 0) {
             $allowed = true;
             break;
         }
     }
     if (!$allowed) {
         throw new BadRequest("Unrecognized base URL prefix! See `okapi_base_urls` field " . "in the `services/apisrv/installation` method. (Recommended " . "base URL to use is '" . Okapi::get_recommended_base_url() . "'.)");
     }
 }
開發者ID:kojoty,項目名稱:opencaching-pl,代碼行數:20,代碼來源:core.php


注:本文中的okapi\Okapi::get_allowed_base_urls方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。