Пример #1
0
 public static function hasNew($pfile, $cssurl, $pthfile)
 {
     $content = JFile::read($pthfile);
     $arrImport = preg_split('#^\\s*@import\\s+"([^"]*)"\\s*;#im', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     $import = false;
     foreach ($arrImport as $s) {
         if ($import) {
             $import = false;
             $url = YTPath::cleanPath(dirname($pthfile) . '/' . $s);
             //echo $url.' vs '.$cssurl.' ||||||| '.filemtime($cssurl).' vs '.filemtime($url).'<br/>';
             if (is_file($cssurl) && filemtime($cssurl) < filemtime($url)) {
                 YTLess::complieToCss($pfile, $cssurl);
                 return;
             }
             YTLess::hasNew($pfile, $cssurl, $url);
         } else {
             $import = true;
             $s = trim($s);
         }
     }
     return;
 }
Пример #2
0
 public function ytStyleSheet($url)
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $lessurl = str_replace('.css', '.less', str_replace('/css/', '/less/', $url));
     if (($app->getTemplate(true)->params->get('developing', 0) == 1 || JRequest::getVar('less2css') == 'all') && file_exists($lessurl)) {
         YTLess::addStyleSheet($lessurl);
     } elseif (file_exists($url)) {
         $doc->addStyleSheet($url);
     } else {
         die($url . ' not exists');
     }
 }
Пример #3
0
 function ytStyleSheet($url)
 {
     $doc = JFactory::getDocument();
     if (!file_exists($url) && (strpos($url, 'http:') == false || strpos($url, 'https:') == false)) {
         $url = 'templates/' . $this->template . '/' . $url;
     }
     $lessurl = str_replace('.css', '.less', str_replace('/css/', '/less/', $url));
     if (($this->getParam('developing', 0) == 1 || JRequest::getVar('less2css') == 'all') && file_exists($lessurl)) {
         YTLess::addStyleSheet($lessurl);
     } elseif (file_exists($url)) {
         $doc->addStyleSheet($url);
     } elseif (basename($url) == 'template.css') {
         $doc->addStyleSheet(str_replace('template.css', 'template-' . $this->getParam('themecolor') . '.css', $url));
     } else {
         die($url . ' not exists');
     }
 }