public static function Init($arExt = array(), $bReturn = false) { if (!self::$bInited) { self::_RegisterStandardExt(); self::$bInited = true; } $str = ''; if (!is_array($arExt) && strlen($arExt) > 0) $arExt = array($arExt); $bReturn = ($bReturn === true); // prevent syntax mistake if (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 && !$bReturn) { $bOldReturn = false; $bReturn = true; } $bNeedCore = false; if (count($arExt) > 0) { foreach ($arExt as $ext) { if (self::$arRegisteredExt[$ext] && !self::$arRegisteredExt[$ext]['skip_core']) { $bNeedCore = true; break; } } } else { $bNeedCore = true; } $ret = ''; if ($bNeedCore && !self::$arCurrentlyLoadedExt['core']) { $autoTimeZone = "N"; if(is_object($GLOBALS["USER"])) $autoTimeZone = trim($GLOBALS["USER"]->GetParam("AUTO_TIME_ZONE")); $arLang = array( 'LANGUAGE_ID' => LANGUAGE_ID, 'FORMAT_DATE' => FORMAT_DATE, 'FORMAT_DATETIME' => FORMAT_DATETIME, 'COOKIE_PREFIX' => COption::GetOptionString("main", "cookie_name", "BITRIX_SM"), 'USER_ID' => $GLOBALS['USER']->GetID(), 'SERVER_TIME' => time(), 'SERVER_TZ_OFFSET' => date("Z"), 'USER_TZ_OFFSET' => CTimeZone::GetOffset(), 'USER_TZ_AUTO' => $autoTimeZone == 'N'? 'N': 'Y', 'bitrix_sessid' => bitrix_sessid(), ); if(!defined("ADMIN_SECTION") || ADMIN_SECTION !== true) $arLang["SITE_ID"] = SITE_ID; $ret .= self::_loadCSS('/bitrix/js/main/core/css/core.css', $bReturn); $ret .= self::_loadJS('/bitrix/js/main/core/core.js', $bReturn); $ret .= self::_loadLang(BX_ROOT.'/modules/main/lang/'.LANGUAGE_ID.'/js_core.php', $bReturn, $arLang); self::$arCurrentlyLoadedExt['core'] = true; } for ($i = 0, $len = count($arExt); $i < $len; $i++) { $ret .= self::_loadExt($arExt[$i], $bReturn); } if (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 && !$bOldReturn) echo $ret; return $bReturn ? $ret : true; }
public static function Init($arExt = array(), $bReturn = false) { global $USER; if (!self::$bInited) { self::_RegisterStandardExt(); self::$bInited = true; } if (!is_array($arExt) && strlen($arExt) > 0) { $arExt = array($arExt); } $bReturn = $bReturn === true; // prevent syntax mistake $bNeedCore = false; if (count($arExt) > 0) { foreach ($arExt as $ext) { if (self::$arRegisteredExt[$ext] && (!isset(self::$arRegisteredExt[$ext]['skip_core']) || !self::$arRegisteredExt[$ext]['skip_core'])) { $bNeedCore = true; break; } } } else { $bNeedCore = true; } $ret = ''; if ($bNeedCore && !self::$arCurrentlyLoadedExt['core']) { $ret .= self::_loadCSS('/bitrix/js/main/core/css/core.css', $bReturn); $ret .= self::_loadJS('/bitrix/js/main/core/core.js', $bReturn); $ret .= self::_loadLang(BX_ROOT . '/modules/main/lang/' . LANGUAGE_ID . '/js_core.php', $bReturn); self::$arCurrentlyLoadedExt['core'] = true; } for ($i = 0, $len = count($arExt); $i < $len; $i++) { $ret .= self::_loadExt($arExt[$i], $bReturn); } if (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) { echo $ret; } return $bReturn ? $ret : true; }