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


PHP Less_Parser::FileParsed方法代码示例

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


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

示例1: compileCss


//.........这里部分代码省略.........
                     $importcontent = preg_replace($rimportvars, '', $importcontent);
                 }
                 // remember this path when lookup for import
                 if (preg_match($rimport, $importcontent)) {
                     $importdirs[dirname(JPATH_ROOT . '/' . $rtl_url)] = self::relativePath($todir, dirname($rtl_url));
                 }
                 $rtlcontent .= "\n{$importcontent}\n\n";
                 // rtl theme overwrite
                 if ($theme && strpos($url, 'themes/') === false) {
                     $rtlthemepath = preg_replace($rswitchrtl, '/less/rtl/' . $theme . '/', $url);
                     if (is_file(JPATH_ROOT . '/' . $rtlthemepath)) {
                         // process import file
                         $importcontent = JFile::read(JPATH_ROOT . '/' . $rtlthemepath);
                         $rtlcontent .= "\n{$importcontent}\n\n";
                         $importdirs[dirname(JPATH_ROOT . '/' . $rtlthemepath)] = self::relativePath($todir, dirname($rtlthemepath));
                     }
                 }
             } else {
                 $import = true;
             }
         }
         // override in template for this file
         $rtlpath = preg_replace($rswitchrtl, '/less/rtl/', $path);
         if (is_file(JPATH_ROOT . '/' . $rtlpath)) {
             // process import file
             $importcontent = JFile::read(JPATH_ROOT . '/' . $rtlpath);
             $rtlcontent .= "\n{$importcontent}\n\n";
             $importdirs[dirname(JPATH_ROOT . '/' . $rtlpath)] = self::relativePath($todir, dirname($rtlpath));
         }
         // rtl theme
         if ($theme) {
             $rtlthemepath = preg_replace($rswitchrtl, '/less/rtl/' . $theme . '/', $path);
             if (is_file(JPATH_ROOT . '/' . $rtlthemepath)) {
                 // process import file
                 $importcontent = JFile::read(JPATH_ROOT . '/' . $rtlthemepath);
                 $rtlcontent .= "\n{$importcontent}\n\n";
                 $importdirs[dirname(JPATH_ROOT . '/' . $rtlthemepath)] = self::relativePath($todir, dirname($rtlthemepath));
             }
         }
         if ($rtlcontent) {
             $output = $output . "\n#{$krtlsep}{content: \"separator\";}\n\n{$rtlcontent}\n\n";
         }
     }
     // common place
     $importdirs[T3_TEMPLATE_PATH . '/less'] = self::relativePath($todir, T3_TEMPLATE_URL);
     // myself
     $importdirs[dirname(JPATH_ROOT . '/' . $path)] = self::relativePath($todir, dirname($path));
     // ignore all these files
     foreach (array(T3_PATH, T3_PATH . '/bootstrap', T3_TEMPLATE_PATH) as $know_path) {
         foreach (array('vars', 'variables', 'mixins') as $know_file) {
             $realfile = realpath($know_path . '/less/' . $know_file . '.less');
             if (is_file($realfile) && !Less_Parser::FileParsed($realfile)) {
                 Less_Parser::AddParsedFile($realfile);
             }
         }
     }
     // compile less to css using lessphp
     $parser->SetImportDirs($importdirs);
     $parser->SetFileInfo(JPATH_ROOT . '/' . $path, self::relativePath($todir, dirname($path)));
     $source = $vars . "\n#{$kvarsep}{content: \"separator\";}\n" . $output;
     $parser->parse($source);
     $output = $parser->getCss();
     // remove the duplicate clearfix at the beginning if not bootstrap.css file
     if (strpos($path, $tpl . '/less/bootstrap.less') === false) {
         $arr = preg_split($rsplitbegin . $kvarsep . $rsplitend, $output);
         // ignore first one, it's clearfix
         if (is_array($arr)) {
             array_shift($arr);
         }
         $output = implode("\n", $arr);
     } else {
         $output = preg_replace($rsplitbegin . $kvarsep . $rsplitend, '', $output);
     }
     //update url if needed
     if (defined('T3_DEV_MODE') && T3_DEV_MODE) {
         $output = T3Path::updateUrl($output, $topath ? T3Path::relativePath(dirname($topath), dirname($path)) : T3_TEMPLATE_URL . '/css/');
     }
     if ($is_rtl) {
         if ($rtlcontent) {
             $output = preg_split($rsplitbegin . $krtlsep . $rsplitend, $output, -1, PREG_SPLIT_DELIM_CAPTURE);
             $rtlcontent = isset($output[2]) ? $output[2] : false;
             $output = $output[0];
         }
         T3::import('jacssjanus/ja.cssjanus');
         $output = JACSSJanus::transform($output, true);
         //join again
         if ($rtlcontent) {
             $output = $output . "\n" . $rtlcontent;
         }
     }
     //remove comments and clean up
     $output = preg_replace($rcomment, '', $output);
     $output = preg_replace($rspace, "\n\n", $output);
     if ($tofile) {
         $ret = JFile::write($tofile, $output);
         @chmod($tofile, 0644);
         return $ret;
     }
     return $output;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:less.php

示例2: Skip

 /**
  * Should the import be skipped?
  *
  * @return boolean|null
  */
 private function Skip($path, $env)
 {
     $path = Less_Parser::winPath(realpath($path));
     if ($path && Less_Parser::FileParsed($path)) {
         if (isset($this->currentFileInfo['reference'])) {
             return true;
         }
         return !isset($this->options['multiple']) && !$env->importMultiple;
     }
 }
开发者ID:netAction,项目名称:diabetes-schule-berlin-wordpress,代码行数:15,代码来源:Less.php

示例3: compile

 function compile($env)
 {
     $evald = $this->compileForImport($env);
     $uri = $full_path = false;
     //get path & uri
     $evald_path = $evald->getPath();
     if ($evald_path && $env->isPathRelative($evald_path)) {
         foreach (Less_Parser::$import_dirs as $rootpath => $rooturi) {
             $temp = $rootpath . $evald_path;
             if (file_exists($temp)) {
                 $full_path = Less_Environment::NormPath($temp);
                 $uri = Less_Environment::NormPath(dirname($rooturi . $evald_path));
                 break;
             }
         }
     }
     if (!$full_path) {
         $uri = $evald_path;
         $full_path = $evald_path;
     }
     //import once
     $realpath = realpath($full_path);
     if (!isset($evald->options['multiple']) && $realpath && Less_Parser::FileParsed($realpath)) {
         $evald->skip = true;
     }
     $features = $evald->features ? $evald->features->compile($env) : null;
     if ($evald->skip) {
         return array();
     }
     if ($evald->css) {
         $temp = $this->compilePath($env);
         return new Less_Tree_Import($this->compilePath($env), $features, $this->options, $this->index);
     }
     $parser = new Less_Parser($env);
     $evald->root = $parser->parseFile($full_path, $uri, true);
     $ruleset = new Less_Tree_Ruleset(array(), $evald->root->rules);
     $ruleset->evalImports($env);
     return $this->features ? new Less_Tree_Media($ruleset->rules, $this->features->value) : $ruleset->rules;
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:39,代码来源:Import.php


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