Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
handlerhelper.php
1<?php
9namespace Bitrix\Rest;
10
11
13{
14 const ERROR_UNSUPPORTED_PROTOCOL = 'ERROR_UNSUPPORTED_PROTOCOL';
15 const ERROR_WRONG_HANDLER_URL = 'ERROR_WRONG_HANDLER_URL';
16 const ERROR_HANDLER_URL_MATCH = 'ERROR_HANDLER_URL_MATCH';
17
18 protected static $applicationList = array();
19
31 public static function checkCallback($handlerUrl, $appInfo = array(), $checkInstallUrl = true)
32 {
33 $callbackData = parse_url($handlerUrl);
34
35 if(is_array($callbackData)
36 && $callbackData['host'] <> ''
37 && mb_strpos($callbackData['host'], '.') > 0
38 )
39 {
40 if($callbackData['scheme'] !== 'http' && $callbackData['scheme'] !== 'https')
41 {
42 throw new RestException('Unsupported handler protocol', static::ERROR_UNSUPPORTED_PROTOCOL);
43 }
44 }
45 else
46 {
47 throw new RestException('Wrong handler URL', static::ERROR_WRONG_HANDLER_URL);
48 }
49
50 return true;
51 }
52
53 public static function storeApplicationList($PLACEMENT, $applicationList)
54 {
55 static::$applicationList[$PLACEMENT] = $applicationList;
56 }
57
58 public static function getApplicationList($PLACEMENT)
59 {
60 return isset(static::$applicationList[$PLACEMENT]) && is_array(static::$applicationList[$PLACEMENT])
61 ? static::$applicationList[$PLACEMENT]
62 : array();
63 }
64}
static storeApplicationList($PLACEMENT, $applicationList)
static checkCallback($handlerUrl, $appInfo=array(), $checkInstallUrl=true)
static getApplicationList($PLACEMENT)