Example #1
0
        $name = '/' . $name;
    }
    //this is the final name
    //which is also the path to the template
    $name = $path . $name;
    //get the partial
    $partial = Eden\Handlebars\Runtime::getPartial($name);
    //if there is no partial and file exists
    if (is_null($partial) && file_exists($name)) {
        //this is the partial
        $partial = file_get_contents($name);
        //register the partial
        Eden\Handlebars\Runtime::registerPartial($name, $partial);
    }
    //prep to call tokenize
    $tokenize = Eden\Handlebars\Runtime::getHelper('tokenize->');
    //bind the arguments back
    $options['args'] = str_replace('partial ', '> ', $options['args']);
    array_unshift($args, "'" . $name . "'");
    array_push($args, $options);
    return call_user_func_array($tokenize, $args);
}, 'strip' => function ($html, $options) {
    return strip_tags($html, '<p><b><em><i><strong><b><br><u><ul><li><ol>');
}, 'block' => function ($key, $options) {
    $args = func_get_args();
    $options = array_pop($args);
    $key = array_shift($args);
    try {
        $block = eve()->block($key);
    } catch (Exception $e) {
        return '';
Example #2
0
 public function testUnregisterPartial()
 {
     Eden\Handlebars\Runtime::registerPartial('foo', 'bar');
     Eden\Handlebars\Runtime::unregisterPartial('foo');
     $this->assertNull(Eden\Handlebars\Runtime::getPartial('foo'));
 }