当前位置: 首页>>代码示例>>PHP>>正文


PHP flexicontent_html::dirty_less_incPath_exists方法代码示例

本文整理汇总了PHP中flexicontent_html::dirty_less_incPath_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::dirty_less_incPath_exists方法的具体用法?PHP flexicontent_html::dirty_less_incPath_exists怎么用?PHP flexicontent_html::dirty_less_incPath_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flexicontent_html的用法示例。


在下文中一共展示了flexicontent_html::dirty_less_incPath_exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkedLessCompile

 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;
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:85,代码来源:flexicontent.helper.php


注:本文中的flexicontent_html::dirty_less_incPath_exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。