Exemplo n.º 1
0
 function _PrepareAdditionalData()
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     // get CSS changes list
     if ($this->bStyle) {
         $arCSSList = $APPLICATION->sPath2css;
         $cnt_old = count($this->arCSSList);
         $cnt_new = count($arCSSList);
         $arCSSNew = array();
         if ($cnt_old != $cnt_new) {
             for ($i = $cnt_old; $i < $cnt_new; $i++) {
                 $css_path = $arCSSList[$i];
                 if (strtolower(substr($css_path, 0, 7)) != 'http://' && strtolower(substr($css_path, 0, 8)) != 'https://') {
                     if (($p = strpos($css_path, "?")) > 0) {
                         $css_file = substr($css_path, 0, $p);
                     } else {
                         $css_file = $css_path;
                     }
                     if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css_file)) {
                         $arCSSNew[] = $arCSSList[$i];
                     }
                 } else {
                     $arCSSNew[] = $arCSSList[$i];
                 }
             }
         }
     }
     // get scripts changes list
     $arHeadScripts = $APPLICATION->arHeadScripts;
     $cnt_old = count($this->arHeadScripts);
     $cnt_new = count($arHeadScripts);
     $arHeadScriptsNew = array();
     if ($cnt_old != $cnt_new) {
         for ($i = $cnt_old; $i < $cnt_new; $i++) {
             $arHeadScriptsNew[] = $arHeadScripts[$i];
         }
     }
     if (!$APPLICATION->oAsset->optimizeJs()) {
         $arHeadScriptsNew = array_merge(CJSCore::GetScriptsList(), $arHeadScriptsNew);
     }
     // prepare additional data
     $arAdditionalData = array();
     $arAdditionalData['TITLE'] = htmlspecialcharsback($APPLICATION->GetTitle());
     $arAdditionalData['WINDOW_TITLE'] = htmlspecialcharsback($APPLICATION->GetTitle('title'));
     $arAdditionalData['SCRIPTS'] = array();
     $arHeadScriptsNew = array_unique($arHeadScriptsNew);
     foreach ($arHeadScriptsNew as $script) {
         $arAdditionalData['SCRIPTS'][] = CUtil::GetAdditionalFileURL($script);
     }
     if (null !== $this->__nav_params) {
         $arAdditionalData['NAV_CHAIN'] = $APPLICATION->GetNavChain($this->__nav_params[0], $this->__nav_params[1], $this->__nav_params[2], $this->__nav_params[3], $this->__nav_params[4]);
     }
     if ($this->bStyle) {
         $arAdditionalData["CSS"] = array();
         /** @noinspection PhpUndefinedVariableInspection */
         $arCSSNew = array_unique($arCSSNew);
         foreach ($arCSSNew as $style) {
             $arAdditionalData['CSS'][] = CUtil::GetAdditionalFileURL($style);
         }
     }
     $additional_data = '<script type="text/javascript" bxrunfirst="true">' . "\n";
     $additional_data .= 'var arAjaxPageData = ' . CUtil::PhpToJSObject($arAdditionalData) . ";\r\n";
     $additional_data .= 'top.BX.ajax.UpdatePageData(arAjaxPageData)' . ";\r\n";
     $additional_data .= '</script><script type="text/javascript">';
     if (!$this->bIFrameMode && $this->bHistory) {
         $additional_data .= 'top.BX.ajax.history.put(window.AJAX_PAGE_STATE.getState(), \'' . CUtil::JSEscape(CAjax::encodeURI($APPLICATION->GetCurPageParam('', array(BX_AJAX_PARAM_ID), false))) . '\')' . ";\r\n";
     }
     if ($this->bJump) {
         if ($this->bIFrameMode) {
             $additional_data .= 'top.setTimeout(\'BX.scrollToNode("comp_' . $this->componentID . '")\', 100)' . ";\r\n";
         } else {
             $additional_data .= 'top.BX.scrollToNode(\'comp_' . $this->componentID . '\')' . ";\r\n";
         }
     }
     $additional_data .= '</script>';
     echo $additional_data;
 }
Exemplo n.º 2
0
 $arCSSListNew = $APPLICATION->sPath2css;
 $arCSSNew = array();
 foreach ($arCSSListNew as $i => $css_path) {
     if (strtolower(substr($css_path, 0, 7)) != 'http://' && strtolower(substr($css_path, 0, 8)) != 'https://') {
         $css_file = ($p = strpos($css_path, "?")) > 0 ? substr($css_path, 0, $p) : $css_path;
         if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css_file)) {
             $arCSSNew[] = $css_path;
         }
     } else {
         $arCSSNew[] = $css_path;
     }
 }
 $arCSSNew = array_unique($arCSSNew);
 $arHeadScriptsNew = $APPLICATION->arHeadScripts;
 if (!$APPLICATION->oAsset->optimizeJs()) {
     $arHeadScriptsNew = array_merge(CJSCore::GetScriptsList(), $arHeadScriptsNew);
 }
 $arAdditionalData["CSS"] = array();
 foreach ($arCSSNew as $style) {
     $arAdditionalData["CSS"][] = CUtil::GetAdditionalFileURL($style);
 }
 $arAdditionalData['SCRIPTS'] = array();
 $arHeadScriptsNew = array_unique($arHeadScriptsNew);
 foreach ($arHeadScriptsNew as $script) {
     $arAdditionalData["SCRIPTS"][] = CUtil::GetAdditionalFileURL($script);
 }
 $additional_data = '<script type="text/javascript" bxrunfirst="true">' . "\n";
 $additional_data .= 'top.__logGetNextPageLinkEntities(' . CUtil::PhpToJSObject($component->arResult["ENTITIES_XML_ID"]) . ', ' . CUtil::PhpToJSObject($component->arResult["ENTITIES_CORRESPONDENCE"]) . ');';
 $additional_data .= '</script>';
 if ($arResult["AJAX_CALL"]) {
     $strText = ob_get_clean();
Exemplo n.º 3
0
 public static function getPageAdditionals()
 {
     global $APPLICATION;
     $arCSSListNew = $APPLICATION->sPath2css;
     $arCSSNew = array();
     foreach ($arCSSListNew as $i => $css_path) {
         if (strtolower(substr($css_path, 0, 7)) != 'http://' && strtolower(substr($css_path, 0, 8)) != 'https://') {
             $css_file = ($p = strpos($css_path, "?")) > 0 ? substr($css_path, 0, $p) : $css_path;
             if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css_file)) {
                 $arCSSNew[] = $css_path;
             }
         } else {
             $arCSSNew[] = $css_path;
         }
     }
     $arCSSNew = array_unique($arCSSNew);
     $arHeadScriptsNew = $APPLICATION->arHeadScripts;
     if (!$APPLICATION->oAsset->optimizeJs()) {
         $arHeadScriptsNew = array_merge(CJSCore::GetScriptsList(), $arHeadScriptsNew);
     }
     $arAdditionalData["CSS"] = array();
     foreach ($arCSSNew as $style) {
         $arAdditionalData["CSS"][] = CUtil::GetAdditionalFileURL($style);
     }
     $arAdditionalData['SCRIPTS'] = array();
     $arHeadScriptsNew = array_unique($arHeadScriptsNew);
     foreach ($arHeadScriptsNew as $script) {
         $arAdditionalData["SCRIPTS"][] = CUtil::GetAdditionalFileURL($script);
     }
     return $arAdditionalData;
 }