16 "detail" =>
"detail/#ID#/",
17 "edit" =>
"edit/#ID#/",
21 private static $localDir =
null;
22 private static array $instance = [];
24 private function __construct()
26 if (defined(
'ADMIN_SECTION'))
28 $this->adminSectionMode =
true;
32 protected function getPage(
string $code): string
34 return $this->adminSectionMode && !empty($this->pageListAdmin[$code])
35 ? $this->directoryAdmin . $this->pageListAdmin[$code]
36 : $this->
getDir() . $this->pages[$code]
42 if (!array_key_exists(static::class, static::$instance))
44 static::$instance[static::class] =
new static();
47 return static::$instance[static::class];
56 public function addUrlFrom($url, $from) : string
60 if (mb_strpos($url,
'?') ===
false)
62 $url .=
'?from=' . $from;
66 $url .=
'&from=' . $from;
75 $url = $this->
getDir() . $this->pages[
"index"];
96 if (
null === self::$localDir)
99 $site = \Bitrix\Main\Context::getCurrent()->getSiteObject();
100 if ($site && $site->getDir() !=
'')
102 $siteId = $site->getLid();
103 $path = [\Bitrix\Main\SiteTable::getDocumentRoot($siteId), $site->getDir(),
$this->directory];
104 $dir = new \Bitrix\Main\IO\Directory(\
Bitrix\Main\
IO\Path::combine($path), $siteId);
105 if ($dir->isExists())
107 self::$localDir = \Bitrix\Main\IO\Path::combine([self::$localDir, $site->getDir()]);
111 $res = \Bitrix\Main\IO\Path::combine([self::$localDir, $this->directory]);
112 if (mb_substr($res, 0, -1) !== \
Bitrix\Main\
IO\Path::DIRECTORY_SEPARATOR)
119 $url = $this->
getDir().$url;
121 $url = str_replace(
"#ID#", $id, $url);
125 protected function getReplaced(
string $url, $replace =
null, $subject =
null)
127 $url = $this->
getDir().$url;
128 if (!is_null($replace) && !is_null($subject))
129 $url = str_replace($replace, $subject, $url);
139 "list" =>
"installed/",
140 "detail" =>
"detail/#ID#/",
141 "category" =>
"category/#ID#/",
142 "category_placement" =>
"?placement=#CODE#",
143 "placement_view" =>
"view/#APP#/",
144 "placement" =>
"placement/#PLACEMENT_ID#/",
145 "booklet" =>
"booklet/#CODE#/"
164 $url = $this->
getReplaced($this->pages[
'category_placement'],
'#CODE#', $code);
174 $result =
'/settings/license_buy.php?product=subscr';
178 $region = Option::get(
'main',
'~PARAM_CLIENT_LANG', LANGUAGE_ID);
180 if ($region ===
'ru')
182 $result =
'https://www.1c-bitrix.ru/buy/products/b24.php?subscr=y';
184 elseif ($region ===
'ua')
186 $result =
'https://www.bitrix.ua/buy/products/b24.php?subscr=y';
188 elseif ($region ===
'by')
190 $result =
'https://www.1c-bitrix.by/buy/products/b24.php?subscr=y';
199 $placementId = intval($placementId);
202 if ($placementId > 0)
211 $url = $this->
getReplaced($this->pages[
"placement"], $replace, $subject);
213 if(is_array($params))
215 $uri = new \Bitrix\Main\Web\Uri($url);
221 $url = $uri->getUri();
226 public function getBooklet($code =
null, $from =
'')
239 $url = $this->
getReplaced($this->pages[
"booklet"], $replace, $subject);
259 $url = $this->
getReplaced($this->pages[
"placement_view"], $replace, $subject);
261 if (is_array($params))
263 $uri = new \Bitrix\Main\Web\Uri($url);
269 $url = $uri->getUri();
282 "edit" =>
"edit/#ID#/"
292 "detail" =>
"detail/#ID#/",
293 "edit" =>
"edit/#ID#/"
302 'placement' =>
'placement/#PLACEMENT_CODE#/',
303 'section' =>
'section/#MANIFEST_CODE#/',
304 'import' =>
'import/',
305 'import_app' =>
'import/#APP_CODE#/',
306 'import_rollback' =>
'import_rollback/#APP#/',
307 'import_zip' =>
'import_zip/#ZIP_ID#/',
308 'import_manifest' =>
'import_#MANIFEST_CODE#/',
309 'export' =>
'export_#MANIFEST_CODE#/',
310 'export_element' =>
'export_#MANIFEST_CODE#/#ITEM_CODE#/'
314 'import_zip' =>
'rest_import_zip.php?id=#ZIP_ID#',
317 public function getPlacement($code =
null, $context =
null)
332 if(!is_null($context))
334 $uri = new \Bitrix\Main\Web\Uri($url);
340 $url = $uri->getUri();
345 public function getSection($manifestCode =
null)
349 if (!is_null($manifestCode))
370 if (!is_null($manifestCode))
423 public function getExport($manifestCode =
null)
427 if (!is_null($manifestCode))
443 if (!is_null($manifestCode))
457 protected function getReplaced(
string $url, $replace =
null, $subject =
null)
459 if (!is_null($replace) && !is_null($subject))
461 $url = str_replace($replace, $subject, $url);
479 public static function getCategoryUrl($id =
null, $from =
'')
484 public static function getCategoryByPlacement($code, $from =
'')
489 public static function getApplicationDetailUrl($id =
null, $from =
'')
493 public static function getApplicationUrl($id =
null)
502 public static function getApplicationAddUrl()
506 public static function getWidgetAddUrl()
518 public static function getApplicationPlacementUrl($placementId =
null, $params =
null)
520 return DevOps::getInstance()->getPlacementUrl((
int)$placementId, $params);
523 public static function getApplicationPlacementViewUrl($appCode =
null, $params =
null)
528 public static function getMarketplaceUrl($from =
'')
533 public static function getBookletUrl($code =
null, $from =
'')
538 public static function getConfigurationUrl()
540 return Configuration::getInstance()->getIndexUrl();
543 public static function getConfigurationPlacementUrl($code =
null, $context =
null)
545 return Configuration::getInstance()->getPlacement($code, $context);
548 public static function getConfigurationSectionUrl($manifestCode =
null)
550 return Configuration::getInstance()->getSection($manifestCode);
553 public static function getConfigurationImportUrl()
555 return Configuration::getInstance()->getImport();
558 public static function getConfigurationImportManifestUrl($code)
560 return Configuration::getInstance()->getImportManifest($code);
563 public static function getConfigurationImportAppUrl($code =
null)
565 return Configuration::getInstance()->getImportApp($code);
568 public static function getConfigurationImportRollbackUrl($appCode)
570 return Configuration::getInstance()->getImportRollback($appCode);
573 public static function getConfigurationImportZipUrl($zipId, $from =
'')
575 return Configuration::getInstance()->getImportZip($zipId, $from);
578 public static function getConfigurationExportUrl($manifestCode =
null)
580 return Configuration::getInstance()->getExport($manifestCode);
583 public static function getConfigurationExportElementUrl($manifestCode =
null, $itemCode =
null)
585 return Configuration::getInstance()->getExportElement($manifestCode, $itemCode);
588 public static function getSubscriptionBuyUrl() : string
const DIRECTORY_SEPARATOR
static isModuleInstalled($moduleName)
static getCategoryUrl($id=null, $from='')
getImportRollback($appCode)
getExport($manifestCode=null)
getSection($manifestCode=null)
getReplaced(string $url, $replace=null, $subject=null)
getImportZip($zipId, $from)
getExportElement($manifestCode=null, $itemCode=null)
getImportManifest($manifestCode)
getPlacement($code=null, $context=null)
getBooklet($code=null, $from='')
getCategoryUrl($id=null, $from='')
getPlacementViewUrl($appCode, $params)
getPlacementUrl($placementId, $params)
getCategoryByPlacement($code, $from='')
getReplacedId(string $url, $id=null)
getReplaced(string $url, $replace=null, $subject=null)
getDetailUrl($id=null, $from='')