function loadCompiledTemplate($intended) { $contents = file_get_contents($intended); $target = get_template_directory() . '/tmp/mason/'; require_once get_template_directory() . '/includes/mason/template-map.php'; Mason::build($intended, $target . basename(str_replace(".php", "", $intended))); return $target . basename($intended); }
}); Mason::directive([":each", ":endeach"], function ($a, $content, $arguments) { return Mason::PHP("foreach( \${$a[0]} as \$i => \${$a[2]} ) : ") . "\n" . Mason::buildString($content) . "\n" . Mason::PHP("endforeach;"); }); Mason::directive([":col", ":endcol"], function ($a, $content, $arguments) { $w = $a[0]; $res = Mason::buildString($content . " \n"); return "<div class='col-md-{$w} {$arguments['class']}' style='background-color: rgba({$arguments['color']}, 255, 255, 1)'>" . $res . "</div>"; }, DIRECTIVE_ARGS); Mason::directive(["img", "\n"], function ($a, $b) { $templatePath = get_template_directory_uri(); return "<img src='{$templatePath}/img/{$a[0]}' />"; }); Mason::directive(["rawImg", "\n"], function ($a, $b) { $a = implode(" ", $a); return "<img src='{$a}' />"; }); Mason::directive(["if", "fi"], function ($a, $b) { }, DIRECTIVE_ARGS); Mason::directive(['@@ ', '\\n'], function ($a) { $class = App::module($a[0]); if ($class) { return Mason::EOL($class()); } }); Mason::directive(['render', '\\n'], function ($a) { $class = App::helper($a[0]); if ($class) { return Mason::EOL($class()); } });