static function checkedLessCompile($files, $path, $inc_paths = null, $force = false, $check_global_inc = true)
 {
     static $initialized;
     if ($initialized === null) {
         jimport('joomla.filesystem.path');
         jimport('joomla.filesystem.folder');
         jimport('joomla.filesystem.file');
         require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'lessphp' . DS . 'lessc.inc.php';
         $initialized = 1;
     }
     $app = JFactory::getApplication();
     $flexiparams = JComponentHelper::getParams('com_flexicontent');
     $print_logging_info = $flexiparams->get('print_logging_info');
     $debug = JDEBUG || $print_logging_info;
     // Validate paths
     $path = JPath::clean($path);
     if (!is_array($inc_paths)) {
         $inc_paths = $inc_paths ? array($inc_paths) : array();
     }
     foreach ($inc_paths as $k => $v) {
         $inc_paths[$k] = JPath::clean($v);
     }
     // Check if LESS include paths have modified less files
     $_dirty = flexicontent_html::dirty_less_incPath_exists($inc_paths, $check_global_inc);
     // Find which LESS files have changed
     $stale = array();
     foreach ($files as $inFile) {
         //$inFile   = urldecode(base64_decode($inFile));
         $inFilename = basename($inFile);
         $nameOnly = basename($inFilename, '.less');
         $outFile = 'css/' . $nameOnly . '.css';
         if (!JFile::exists($path . $inFile)) {
             //if ($debug) $app->enqueueMessage('Path not found: '.$path.$inFile, 'warning');
         } else {
             if ($_dirty || $force || !is_file($path . $outFile) || filemtime($path . $inFile) > filemtime($path . $outFile)) {
                 $stale[$inFile] = $outFile;
             }
         }
     }
     //print_r($stale);
     // We are done if no CSS files need to be updated
     if (empty($stale)) {
         return array();
     }
     static $prev_path = null;
     if ($prev_path != $path && $debug) {
         $app->enqueueMessage('Compiling LESS files in: ' . $path, 'message');
     }
     $compiled = array();
     $msg = '';
     $error = false;
     foreach ($stale as $in => $out) {
         // *** WARNING: Always create new object on every call, otherwise files needed more than one place, will may NOT be include
         $less = new \FLEXIcontent\lessc();
         // JLess($fname = null, new JLessFormatterJoomla);
         $formater = new \FLEXIcontent\lessc_formatter_classic();
         $formater->disableSingle = true;
         $formater->breakSelectors = true;
         $formater->assignSeparator = ": ";
         $formater->selectorSeparator = ",";
         $formater->indentChar = "\t";
         $less->setFormatter($formater);
         try {
             $wasCompiled = $less->compileFile($path . $in, $path . $out);
             // $less->checkedCompile($path.$in, $path.$out);   // consider modification times
             if ($wasCompiled) {
                 $compiled[$in] = $out;
             }
         } catch (Exception $e) {
             $error = true;
             if ($debug || $app->isAdmin()) {
                 $app->enqueueMessage('- LESS to CSS halted ... CSS file was not changed ... please edit LESS file(s) find offending <b>lines</b> and fix or remove<br/>' . str_replace($path . $in, '<br/><b>' . $path . $in . '</b>', $e->getMessage()), 'notice');
             }
             continue;
         }
     }
     if (count($compiled) && $debug) {
         foreach ($compiled as $inPath => $outPath) {
             $msg .= '<span class="row" style="display:block; margin:0;"><span class="span4">' . $inPath . '</span><span class="span4">' . $outPath . '</span></span>';
         }
         $app->enqueueMessage(($prev_path != $path ? '<span class="row" style="display:block; margin:0;"><span class="span4">LESS</span><span class="span4">CSS</span></span>' : '') . $msg, 'message');
     }
     $prev_path = $path;
     return !$error ? $stale : false;
 }