/** * {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); }
/** * @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); }
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); }