Exemple #1
0
 /**
  * Add stylesheet file name to read
  *
  * @param string $fileName Stylesheet file name
  * @param string $key Array key, if you want specify by key in template
  * @param boolean $isPreferred
  * @return void
  */
 protected function _addCss($fileName, $key = null, $isPreferred = false)
 {
     $fileName = trim($fileName, '/');
     $fileName = preg_replace('|.css$|', '', $fileName) . '.css';
     if (!file_exists(sprintf('%s/css/%s', PathManager::getHtdocsDirectory(), $fileName))) {
         return;
     }
     if (in_array($fileName, $this->_cssFiles) || in_array($fileName, $this->_cssFilesPreferred)) {
         return;
     }
     if ($isPreferred == true) {
         if ($key == null) {
             $this->_cssFilesPreferred[] = $fileName;
         } else {
             $this->_cssFilesPreferred[$key] = $fileName;
         }
     } else {
         if ($key == null) {
             $this->_cssFiles[] = $fileName;
         } else {
             $this->_cssFiles[$key] = $fileName;
         }
     }
 }