Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sitespeed.php
1<?php
3
10
11Loc::loadMessages(__FILE__);
12
14{
15 public static function onBuildGlobalMenu(&$arGlobalMenu, &$arModuleMenu)
16 {
17 $siteSpeedItem = array(
18 "text" => Loc::getMessage("MAIN_ANALYTICS_MENU_SITE_SPEED"),
19 "url" => "site_speed.php?lang=".LANGUAGE_ID,
20 "more_url" => array("site_speed.php"),
21 "title" => Loc::getMessage("MAIN_ANALYTICS_MENU_SITE_SPEED_ALT"),
22 );
23
24 $found = false;
25 foreach ($arModuleMenu as &$arMenuItem)
26 {
27 if (!isset($arMenuItem["items_id"]) || $arMenuItem["items_id"] !== "menu_perfmon")
28 {
29 continue;
30 }
31
32 if (isset($arMenuItem["items"]) && is_array($arMenuItem["items"]))
33 {
34 array_unshift($arMenuItem["items"], $siteSpeedItem);
35 }
36 else
37 {
38 $arMenuItem["items"] = array($siteSpeedItem);
39 }
40
41 $found = true;
42 break;
43 }
44
45 if (!$found)
46 {
47 $arModuleMenu[] = array(
48 "parent_menu" => "global_menu_settings",
49 "section" => "perfmon",
50 "sort" => 1850,
51 "text" => Loc::getMessage("MAIN_ANALYTICS_MENU_PERFORMANCE"),
52 "title" => Loc::getMessage("MAIN_ANALYTICS_MENU_PERFORMANCE"),
53 "icon" => "perfmon_menu_icon",
54 "page_icon" => "perfmon_page_icon",
55 "items_id" => "menu_perfmon",
56 "items" => array($siteSpeedItem),
57 );
58 }
59 }
60
64 public static function isRussianSiteManager()
65 {
66 return (
67 Directory::isDirectoryExists(Application::getDocumentRoot()."/bitrix/modules/main/lang/ru")
68 || Directory::isDirectoryExists(Application::getDocumentRoot()."/bitrix/modules/main/lang/ua")
69 );
70 }
71
81 public static function isIntranetSite($siteId)
82 {
83 if (defined("ADMIN_SECTION") && ADMIN_SECTION === true)
84 {
85 return false;
86 }
87
88 $portalSiteList = [];
89 $siteList = \Bitrix\Main\SiteTable::getList([
90 "select" => ["LID"],
91 "cache" => ["ttl" => 86400],
92 ])->fetchAll();
93 foreach ($siteList as $site)
94 {
95 if (Option::get("main", "wizard_firstportal_".$site["LID"], false, $site["LID"]) !== false)
96 {
97 $portalSiteList[] = $site["LID"];
98 }
99 else if (Option::get("main", "wizard_firstbitrix24_".$site["LID"], false, $site["LID"]) !== false)
100 {
101 $portalSiteList[] = $site["LID"];
102 }
103 }
104
105 if ($extranetSiteId = Option::get("extranet", "extranet_site", false))
106 {
107 $portalSiteList[] = $extranetSiteId;
108 }
109
110 return in_array($siteId, $portalSiteList);
111 }
112
113 public static function canGatherStat()
114 {
115 $enabled = !Application::getInstance()->getLicense()->isDemoKey();
116 if($enabled)
117 {
118 $settings = Configuration::getValue("analytics_counter");
119 if(isset($settings["enabled"]) && $settings["enabled"] === false)
120 {
121 $enabled = false;
122 }
123 }
124 return $enabled;
125 }
126
127 public static function isOn()
128 {
130 }
131}
static onBuildGlobalMenu(&$arGlobalMenu, &$arModuleMenu)
Definition sitespeed.php:15
static isDirectoryExists($path)
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29