Esempio n. 1
0
 /**
  * {snippet ...}
  */
 public function macroOldSnippet($content)
 {
     $args = array('');
     if ($snippet = LatteFilter::fetchToken($content)) {
         // [name [,]] [tag]
         $args[] = LatteFilter::formatString($snippet);
     }
     if ($content) {
         $args[] = LatteFilter::formatString($content);
     }
     return implode(', ', $args);
 }
Esempio n. 2
0
 /**
  * @return void
  */
 public function templatePrepareFilters($template)
 {
     LatteMacros::$defaultMacros = OldLatteMacros::$defaultMacros + LatteMacros::$defaultMacros;
     $filter = new LatteFilter();
     $template->registerFilter($filter->setHandler(new OldLatteMacros()));
 }
 /**
  * Just modifiers helper.
  */
 public function macroModifiers($content, $modifiers)
 {
     return LatteFilter::formatModifiers($content, $modifiers);
 }
Esempio n. 4
0
 private static function fetchNameAndModifiers($code)
 {
     $name = LatteFilter::fetchToken($code);
     $modifiers = LatteFilter::formatArray($code);
     $name = String::startsWith($name, '$') ? $name : "'{$name}'";
     $modifiers = $modifiers ? $modifiers : "array()";
     return array($name, $modifiers);
 }