Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
entity.php
1<?php
2
4
8
9Loc::loadMessages(__FILE__);
10
11abstract class Entity
12{
13 protected $siteId;
14 protected $apiCaller;
15 protected $authToken;
16 protected $ebaySiteId;
17 protected $warningLevel = "High";
18
19 public function __construct($siteId)
20 {
21 if(!isset($siteId))
22 throw new ArgumentNullException("siteId");
23
24 $this->siteId = $siteId;
25 $ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
26 $settings = $ebay->getSettings();
27
28 if(empty($settings[$siteId]["API"]["SITE_ID"]))
29 throw new SystemException(Loc::getMessage('SALE_EBAY_ENTITY_SETTINGS_EMPTY', array('#SITE_ID#' => $siteId)));
30
31 if(empty($settings[$siteId]["API"]["SITE_ID"]))
32 throw new ArgumentNullException(Loc::getMessage('SALE_EBAY_ENTITY_TOKEN_EMPTY', array('#SITE_ID#' => $siteId)));
33
34 $this->ebaySiteId = $settings[$siteId]["API"]["SITE_ID"];
35 $this->authToken = $settings[$siteId]["API"]["AUTH_TOKEN"];
36 $this->apiCaller = new Caller( array(
37 "EBAY_SITE_ID" => $settings[$siteId]["API"]["SITE_ID"],
38 "URL" => $ebay->getApiUrl(),
39 ));
40 }
41
42 protected function array2Tags(array $params)
43 {
44 $result = "";
45
46 foreach($params as $tag => $value)
47 {
48 if(is_array($value))
49 {
50 reset($value);
51
52 if(key($value) !== 0)
53 {
54 $result .= $this->array2Tags($value);
55 }
56 else
57 {
58 foreach($value as $val)
59 {
60 $result .= '<'.$tag.'>'.$val.'</'.$tag.'>'."\n";
61 }
62 }
63 }
64 elseif($value <> '')
65 {
66 $result .= '<'.$tag.'>'.$value.'</'.$tag.'>'."\n";
67 }
68 }
69
70 return $result;
71 }
72}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29