Пример #1
0
 /**
  * Method to load the CSS headers
  * 
  * @param array $headers
  * @return null
  */
 public function loadCss($headers)
 {
     // Dot not load if this is not the right document-class
     $document = JFactory::getDocument();
     if ($document->getType() != 'html') {
         return false;
     }
     // Check whether the bridge is offline
     $offline = MageBridge::getBridge()->isOffline();
     if ($offline == true) {
         return false;
     }
     // Initialize the internal array
     $this->_stylesheets = array();
     // Get system variables
     $document = JFactory::getDocument();
     // Load the CSS from the MageBridge component
     $this->loadDefaultCss();
     // Fetch the value of "disable_css_all"
     // * 0 = Do not disable any Magento CSS
     // * 1 = Disable all Magento CSS (so we just skip this step
     // * 2 = Disable only the CSS listed under "disable_css_custom"
     // * 3 = Disable all CSS except for the CSS listed under "disable_css_custom"
     $disable_css_all = MagebridgeModelConfig::load('disable_css_all');
     if ($disable_css_all != 1 && !empty($headers['items'])) {
         foreach ($headers['items'] as $item) {
             if ($item['type'] == 'skin_css' || $item['type'] == 'css') {
                 if ($disable_css_all != 0 && MageBridgeHelper::cssIsDisabled($item['name']) == true) {
                     continue;
                 }
                 $this->_stylesheets[] = $item['name'];
                 $css = '';
                 if (!empty($item['if']) && strpos($item['if'], "><!-->") !== false) {
                     $css .= $item['if'] . "\n";
                 } elseif (!empty($item['if'])) {
                     $css .= '<!--[if ' . $item['if'] . ' ]>' . "\n";
                 }
                 $css .= '<link rel="stylesheet" href="' . $item['path'] . '" type="text/css" ' . $item['params'] . '/>' . "\n";
                 if (!empty($item['if']) && strpos($item['if'], "><!-->") !== false) {
                     $css .= '<!--<![endif]-->' . "\n";
                 } elseif (!empty($item['if'])) {
                     $css .= '<![endif]-->' . "\n";
                 }
                 $document->addCustomTag($css);
                 continue;
             }
         }
     }
 }