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


PHP Less_Parser::ParseFile方法代码示例

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


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

示例1: Cache

 public static function Cache(&$less_files, $parser_options = array())
 {
     //prepare the processor
     if (!class_exists('Less_Parser')) {
         include_once 'Less.php';
     }
     $parser = new Less_Parser($parser_options);
     $parser->SetCacheDir(self::$cache_dir);
     $parser->SetImportDirs(self::$import_dirs);
     // combine files
     try {
         foreach ($less_files as $file_path => $uri_or_less) {
             //treat as less markup if there are newline characters
             if (strpos($uri_or_less, "\n") !== false) {
                 $parser->Parse($uri_or_less);
                 continue;
             }
             $parser->ParseFile($file_path, $uri_or_less);
         }
         $compiled = $parser->getCss();
     } catch (Exception $e) {
         self::$error = $e;
         return false;
     }
     $less_files = $parser->allParsedFiles();
     return $compiled;
 }
开发者ID:Tommar,项目名称:remate,代码行数:27,代码来源:lesscache.php

示例2: Cache

 public static function Cache(&$less_files, $parser_options = array()) {
   $file = dirname(__FILE__) . '/Less.php';
   if (file_exists($file) && !class_exists('Less_Parser')) {
     require_once($file);
   }$parser_options['cache_dir'] = Less_Cache::$cache_dir;
   $parser = new Less_Parser($parser_options);
   foreach ($less_files as $file_path => $uri_or_less) {
     if (strpos($uri_or_less, "\n") !== false) {
       $parser->Parse($uri_or_less);
       continue;
     }$parser->ParseFile($file_path, $uri_or_less);
   }$compiled = $parser->getCss();
   $less_files = $parser->allParsedFiles();
   return $compiled;
 }
开发者ID:salatproduction,项目名称:Unona-Landing-Standalone,代码行数:15,代码来源:Cache.php

示例3: Cache

 public static function Cache(&$less_files, $parser_options = array())
 {
     // get less.php if it exists
     $file = dirname(__FILE__) . '/Less.php';
     if (file_exists($file) && !class_exists('Less_Parser')) {
         require_once $file;
     }
     $parser_options['cache_dir'] = Less_Cache::$cache_dir;
     $parser = new Less_Parser($parser_options);
     // combine files
     foreach ($less_files as $file_path => $uri_or_less) {
         //treat as less markup if there are newline characters
         if (strpos($uri_or_less, "\n") !== false) {
             $parser->Parse($uri_or_less);
             continue;
         }
         $parser->ParseFile($file_path, $uri_or_less);
     }
     $compiled = $parser->getCss();
     $less_files = $parser->allParsedFiles();
     return $compiled;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:22,代码来源:cache.php

示例4: ParseLess

 /**
  * Handle the processing of multiple less files into css
  *
  * @return mixed Compiled css string or false
  *
  */
 static function ParseLess(&$less_files)
 {
     global $dataDir;
     $compiled = false;
     // don't use less if the memory limit is less than 64M
     $limit = @ini_get('memory_limit');
     if ($limit) {
         $limit = \gp\tool::getByteValue($limit);
         //if less than 64M, disable less compiler if we can't increase
         if ($limit < 67108864 && @ini_set('memory_limit', '96M') === false) {
             if (\gp\tool::LoggedIn()) {
                 msg('LESS compilation disabled. Please increase php\'s memory_limit');
             }
             return false;
             //if less than 96M, try to increase
         } elseif ($limit < 100663296) {
             @ini_set('memory_limit', '96M');
         }
     }
     //compiler options
     $options = array();
     //prepare the compiler
     includeFile('thirdparty/less.php/Less.php');
     $parser = new \Less_Parser($options);
     $import_dirs[$dataDir] = \gp\tool::GetDir('/');
     $parser->SetImportDirs($import_dirs);
     $parser->cache_method = 'php';
     $parser->SetCacheDir($dataDir . '/data/_cache');
     // combine files
     try {
         foreach ($less_files as $less) {
             //treat as less markup if there are newline characters
             if (strpos($less, "\n") !== false) {
                 $parser->Parse($less);
                 continue;
             }
             // handle relative and absolute paths
             if (!empty($dataDir) && strpos($less, $dataDir) === false) {
                 $relative = $less;
                 $less = $dataDir . '/' . ltrim($less, '/');
             } else {
                 $relative = substr($less, strlen($dataDir));
             }
             $parser->ParseFile($less, \gp\tool::GetDir(dirname($relative)));
         }
         $compiled = $parser->getCss();
     } catch (Exception $e) {
         if (\gp\tool::LoggedIn()) {
             msg('LESS Compile Failed: ' . $e->getMessage());
         }
         return false;
     }
     // significant difference in used memory 15,000,000 -> 6,000,000. Max still @ 15,000,000
     if (function_exists('gc_collect_cycles')) {
         gc_collect_cycles();
     }
     $less_files = $parser->allParsedFiles();
     return $compiled;
 }
开发者ID:Bouhnosaure,项目名称:Typesetter,代码行数:65,代码来源:Css.php


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