Ejemplo n.º 1
0
 public function addCSS($css_uri, $css_media_type = 'all')
 {
     if (self::_isActive()) {
         if (!is_array($css_uri)) {
             $css_uri = array($css_uri);
         }
         $new_uri = array();
         foreach ($css_uri as $uri) {
             if ($uri && !preg_match('/^http(s?):\\/\\//', $uri) && preg_match('#.css$#', $uri)) {
                 $proto = 'http://';
                 $uri = Tools::getMediaServer($uri, $proto) . $uri;
                 // Pass as reference, do not move $proto
                 $new_uri[] = $proto . $uri;
             } else {
                 $new_uri[] = $uri;
             }
         }
         return parent::addCSS($new_uri, $css_media_type);
     }
     return parent::addCSS($css_uri, $css_media_type);
 }
 /**
  * Add one or several CSS for front, checking if css files are overriden in theme/css/modules/ directory
  *
  * @see Controller::addCSS()
  */
 public function addCSS($css_uri, $css_media_type = 'all')
 {
     require_once dirname(__FILE__) . '../../../../modules/designerpreview/defines.inc.php';
     if (!is_array($css_uri)) {
         $css_uri = array($css_uri => $css_media_type);
     }
     $list_uri = array();
     foreach ($css_uri as $file => $media) {
         $different = 0;
         $override_path = str_replace(__PS_BASE_URI__ . 'modules/', _PS_ROOT_DIR_ . '/themes/' . getThemeName() . '/css/modules/', $file, $different);
         if ($different && file_exists($override_path)) {
             $file = str_replace(__PS_BASE_URI__ . 'modules/', __PS_BASE_URI__ . 'themes/' . getThemeName() . '/css/modules/', $file, $different);
         } else {
             $override_path = str_replace(_THEME_CSS_DIR_, _PS_ROOT_DIR_ . '/themes/' . getThemeName() . '/css/', $file, $different);
             if ($different && file_exists($override_path)) {
                 $file = str_replace(_THEME_CSS_DIR_, __PS_BASE_URI__ . 'themes/' . getThemeName() . '/css/', $file, $different);
             }
         }
         $list_uri[$file] = $media;
     }
     return parent::addCSS($list_uri, $css_media_type);
 }