Created
August 26, 2013 11:02
-
-
Save paulschwarz/6340325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Kostache_Page extends Kostache_Base { | |
/** | |
* @return Kostache_Page | |
*/ | |
public static function factory() | |
{ | |
$m = new Mustache_Engine( | |
array( | |
'loader' => new Mustache_Loader_Kohana(), | |
'partials_loader' => new Mustache_Loader_Kohana('templates/partials'), | |
'escape' => function($value) { | |
return HTML::chars($value); | |
}, | |
'cache' => APPPATH.'cache/mustache', | |
) | |
); | |
$class = get_called_class(); | |
return new $class($m); | |
} | |
public function render($class, $template = NULL) | |
{ | |
$content = parent::render($class, $template); | |
return str_replace([ | |
'[[assets_head]]', | |
'[[assets_body]]', | |
'</form>', | |
], [ | |
$class->assets_head(), | |
$class->assets_body(), | |
Form::hidden('csrf', Security::token())."\n".'</form>', | |
], $content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment