Ejemplo n.º 1
0
 function buildCss($path)
 {
     $app = JFactory::getApplication();
     // get vars last-modified
     $vars_lm = $app->getUserState('vars_last_modified', 0);
     $theme = $app->getUserState('vars_theme', '');
     // less file last-modified
     $filepath = JPATH_ROOT . '/' . $path;
     $less_lm = filemtime($filepath);
     // get css cached file
     $cssfile = PLAZART_DEV_FOLDER . '/' . ($theme ? $theme . '/' : '') . str_replace('/', '.', $path) . '.css';
     $cssurl = JURI::base(true) . '/' . $cssfile;
     $csspath = JPATH_ROOT . '/' . $cssfile;
     if (is_file($csspath) && filemtime($csspath) > $less_lm && filemtime($csspath) > $vars_lm) {
         return $cssurl;
     }
     // not cached, build & store it
     if (!$this->compileCss($path, $cssfile)) {
         Plazart::error(JText::sprintf('PLAZART_MSG_DEVFOLDER_NOT_WRITABLE', PLAZART_DEV_FOLDER));
     }
     return $cssurl;
 }