示例#1
0
 function RenderComponents($arParams)
 {
     global $USER;
     $bLPA = !$USER->CanDoOperation('edit_php');
     $startCount = CEditorUtils::StartFetchCSS();
     // Start fetch CSS files
     $arParams['name'] = addslashes($arParams['name']);
     $arParams['template'] = addslashes($arParams['template']);
     $arParams['siteTemplateId'] = addslashes($arParams['siteTemplateId']);
     if ($arParams['siteTemplateId'] && !defined("SITE_TEMPLATE_ID")) {
         define("SITE_TEMPLATE_ID", $arParams['siteTemplateId']);
     }
     // Report only errors
     error_reporting(E_ERROR);
     if ($arParams['name']) {
         // one component by name
         $s = CEditorUtils::_RenderOneComponent($arParams, $bLPA);
     } elseif ($arParams['source']) {
         // all components from content
         $s = CEditorUtils::_RenderAllComponents($arParams, $bLPA);
     }
     CEditorUtils::GetCSS($startCount);
     // Echo path to css
     // Cut out all scripts
     $s = preg_replace("/<script[^>]*?>[\\s|\\S]*?<\\/script>/is", '', $s);
     // Cut out <div class="bx-component-panel"> .... </div>
     $s = preg_replace("/<div[^>]*?class=\"bx-component-panel\"[^>]*?>[^<]*?<table[\\s|\\S]*?<\\/table>[^<]*?<\\/div>/is", '', $s);
     echo $s;
 }