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


PHP Less_Environment::lastRule方法代码示例

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


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

示例1: Init

 public function Init()
 {
     self::$parensStack = 0;
     self::$tabLevel = 0;
     self::$lastRule = false;
     self::$mixin_stack = 0;
     if (Less_Parser::$options['compress']) {
         Less_Environment::$_outputMap = array(',' => ',', ': ' => ':', '' => '', ' ' => ' ', ':' => ' :', '+' => '+', '~' => '~', '>' => '>', '|' => '|', '^' => '^', '^^' => '^^');
     } else {
         Less_Environment::$_outputMap = array(',' => ', ', ': ' => ': ', '' => '', ' ' => ' ', ':' => ' :', '+' => ' + ', '~' => ' ~ ', '>' => ' > ', '|' => '|', '^' => ' ^ ', '^^' => ' ^^ ');
     }
 }
开发者ID:cloverink,项目名称:lzd,代码行数:12,代码来源:Environment.php

示例2: genCSS

 /**
  * @see Less_Tree::genCSS
  */
 public function genCSS($output)
 {
     if (!$this->root) {
         Less_Environment::$tabLevel++;
     }
     $tabRuleStr = $tabSetStr = '';
     if (!Less_Parser::$options['compress']) {
         if (Less_Environment::$tabLevel) {
             $tabRuleStr = "\n" . str_repeat('  ', Less_Environment::$tabLevel);
             $tabSetStr = "\n" . str_repeat('  ', Less_Environment::$tabLevel - 1);
         } else {
             $tabSetStr = $tabRuleStr = "\n";
         }
     }
     $ruleNodes = array();
     $rulesetNodes = array();
     foreach ($this->rules as $rule) {
         $class = get_class($rule);
         if ($class === 'Less_Tree_Media' || $class === 'Less_Tree_Directive' || $this->root && $class === 'Less_Tree_Comment' || $class === 'Less_Tree_Ruleset' && $rule->rules) {
             $rulesetNodes[] = $rule;
         } else {
             $ruleNodes[] = $rule;
         }
     }
     // If this is the root node, we don't render
     // a selector, or {}.
     if (!$this->root) {
         /*
         debugInfo = tree.debugInfo(env, this, tabSetStr);
         
         if (debugInfo) {
         	output.add(debugInfo);
         	output.add(tabSetStr);
         }
         */
         $paths_len = count($this->paths);
         for ($i = 0; $i < $paths_len; $i++) {
             $path = $this->paths[$i];
             $firstSelector = true;
             foreach ($path as $p) {
                 $p->genCSS($output, $firstSelector);
                 $firstSelector = false;
             }
             if ($i + 1 < $paths_len) {
                 $output->add(',' . $tabSetStr);
             }
         }
         $output->add((Less_Parser::$options['compress'] ? '{' : " {") . $tabRuleStr);
     }
     // Compile rules and rulesets
     $ruleNodes_len = count($ruleNodes);
     $rulesetNodes_len = count($rulesetNodes);
     for ($i = 0; $i < $ruleNodes_len; $i++) {
         $rule = $ruleNodes[$i];
         // @page{ directive ends up with root elements inside it, a mix of rules and rulesets
         // In this instance we do not know whether it is the last property
         if ($i + 1 === $ruleNodes_len && (!$this->root || $rulesetNodes_len === 0 || $this->firstRoot)) {
             Less_Environment::$lastRule = true;
         }
         $rule->genCSS($output);
         if (!Less_Environment::$lastRule) {
             $output->add($tabRuleStr);
         } else {
             Less_Environment::$lastRule = false;
         }
     }
     if (!$this->root) {
         $output->add($tabSetStr . '}');
         Less_Environment::$tabLevel--;
     }
     $firstRuleset = true;
     $space = $this->root ? $tabRuleStr : $tabSetStr;
     for ($i = 0; $i < $rulesetNodes_len; $i++) {
         if ($ruleNodes_len && $firstRuleset) {
             $output->add($space);
         } elseif (!$firstRuleset) {
             $output->add($space);
         }
         $firstRuleset = false;
         $rulesetNodes[$i]->genCSS($output);
     }
     if (!Less_Parser::$options['compress'] && $this->firstRoot) {
         $output->add("\n");
     }
 }
开发者ID:netAction,项目名称:diabetes-schule-berlin-wordpress,代码行数:88,代码来源:Less.php

示例3: genCSS

 public function genCSS($output) {
   if (!$this->root) {
     Less_Environment::$tabLevel++;
   }$tabRuleStr = $tabSetStr = '';
   if (!Less_Parser::$options['compress']) {
     if (Less_Environment::$tabLevel) {
       $tabRuleStr = "\n" . str_repeat('  ', Less_Environment::$tabLevel);
       $tabSetStr = "\n" . str_repeat('  ', Less_Environment::$tabLevel - 1);
     } else {
       $tabSetStr = $tabRuleStr = "\n";
     }
   }$ruleNodes = array();
   $rulesetNodes = array();
   foreach ($this->rules as $rule) {
     $class = get_class($rule);
     if (($class === 'Less_Tree_Media') || ($class === 'Less_Tree_Directive') || ($this->root && $class === 'Less_Tree_Comment') || ($class === 'Less_Tree_Ruleset' && $rule->rules)) {
       $rulesetNodes[] = $rule;
     } else {
       $ruleNodes[] = $rule;
     }
   }if (!$this->root) {
     $paths_len = count($this->paths);
     for ($i = 0; $i < $paths_len; $i++) {
       $path = $this->paths[$i];
       $firstSelector = true;
       foreach ($path as $p) {
         $p->genCSS($output, $firstSelector);
         $firstSelector = false;
       }if ($i + 1 < $paths_len) {
         $output->add(',' . $tabSetStr);
       }
     }$output->add((Less_Parser::$options['compress'] ? '{' : " {") . $tabRuleStr);
   }$ruleNodes_len = count($ruleNodes);
   $rulesetNodes_len = count($rulesetNodes);
   for ($i = 0; $i < $ruleNodes_len; $i++) {
     $rule = $ruleNodes[$i];
     if ($i + 1 === $ruleNodes_len && (!$this->root || $rulesetNodes_len === 0 || $this->firstRoot)) {
       Less_Environment::$lastRule = true;
     }$rule->genCSS($output);
     if (!Less_Environment::$lastRule) {
       $output->add($tabRuleStr);
     } else {
       Less_Environment::$lastRule = false;
     }
   }if (!$this->root) {
     $output->add($tabSetStr . '}');
     Less_Environment::$tabLevel--;
   }$firstRuleset = true;
   $space = ($this->root ? $tabRuleStr : $tabSetStr);
   for ($i = 0; $i < $rulesetNodes_len; $i++) {
     if ($ruleNodes_len && $firstRuleset) {
       $output->add($space);
     } elseif (!$firstRuleset) {
       $output->add($space);
     }$firstRuleset = false;
     $rulesetNodes[$i]->genCSS($output);
   }if (!Less_Parser::$options['compress'] && $this->firstRoot) {
     $output->add("\n");
   }
 }
开发者ID:salatproduction,项目名称:Unona-Landing-Standalone,代码行数:60,代码来源:Less.php


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