10">Link', '?>cond > 10){ ?> class="active">Link' ), // cond array( 'Link1say, hello', '?>Link1cond){ ?>say, hello' ), // cond array( 'Link1Link2', '?>Link1v==$__Context->k){ ?>Link2' ), // for loop array( '', '?>' ), // foreach loop array( '', '?>' ), // while loop array( '', '?>' ), // ~ array( 'LinkHello, world ', '?>Linkcond){ ?>Hello, world ' ), // ~ array( 'LinkHello, {$world}', '?>Linkcond){ ?>Hello, world ?>' ), // ~ ~ array( 'LinkHello, worldWow', '?>Linkcond){ ?>Hello, worldWow' ), // ~ ~ ~ array( 'LinkHello, worldHaHaWow', '?>Linkcond){ ?>Hello, worldcond2){ ?>HaHaWow' ), // ~ array( '
  • Repeat this
  • ', PHP_EOL.'for($__Context->i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
  • Repeat this
  • ' ), // ~ array( '
  • item{$key} : {$val}
  • ', PHP_EOL . 'if($__Context->arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
  • itemkey ?> : val ?>
  • ' ), // ~ array( '{$v->text}', PHP_EOL.'while($__Context->item=$__Context->list->getItem()){ ?>v->text ?>' ), // ~ ~ ~ ~ array( ' A BC', '?>var){;'.PHP_EOL.'case "A": ?> ABC' ), // invalid block statement array( '', '?>' ), // {@ ...PHP_CODE...} array( '{@$list_page = $page_no}', '?>list_page = $__Context->page_no ?>' ), // %load_js_plugin array( '', '?>' ), // #include array( '
    This is another dummy
    ', '?>compile(\'tests/unit/classes/template\',\'sample.html\') ?>
    This is another dummy
    ' ), // array( '
    This is another dummy
    ', '?>compile(\'tests/unit/classes\',\'sample.html\') ?>
    This is another dummy
    ' ), // array( '', '?>' ), // array( '', '?>' ), // array( '', '?>' ), // array( '', '?>compile(); ?>' ), // array( '', '?>' ), // array( '', '?>' ), // comment array( '', '?>' ), // self-closing tag array( '', PHP_EOL . 'if($__Context->foo){ ?>' ), // relative path1 array( '', '?>' ), // relative path2 array( '', '?>' ), // error case array( 'logo', PHP_EOL . 'if($__Context->layout_info->logo_image){ ?>logo' ), // error case - ignore stylesheets array( '', '?>' ), // error case - ignore json array( '', '?>' ), // error case - inline javascript array( '
    ', '?>
    ' ), // issue 103 array( '', '?>' ), // issue 135 array( '

    {$key}

    Loop block {$val}
    ', PHP_EOL . '$t1b443c9e474abcf95c0ff70798d10a4c=$__Context->_m_list_all;if($t1b443c9e474abcf95c0ff70798d10a4c&&count($t1b443c9e474abcf95c0ff70798d10a4c))foreach($t1b443c9e474abcf95c0ff70798d10a4c as $__Context->key=>$__Context->val){ ?>

    key ?>

    Loop block val ?>
    ' ), // issue 136 array( '
    bar', PHP_EOL . 'if($__Context->var==\'foo\'){ ?>
    bar' ), // issue 188 array( '
    Hello, world!
    ', PHP_EOL . 'if($__Context->ii < $__Context->nn){;' . PHP_EOL . '$te536ab402425aa07f37ece1808639b07=$__Context->dummy;if($te536ab402425aa07f37ece1808639b07&&count($te536ab402425aa07f37ece1808639b07))foreach($te536ab402425aa07f37ece1808639b07 as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' ), // issue 190 array( '
    Hello, world!
    ', PHP_EOL . 'if(!($__Context->i >= $__Context->n)){;' . PHP_EOL . '$tcf235db237866cd5f280e0a7fdb2dca8=$__Context->dummy;if($tcf235db237866cd5f280e0a7fdb2dca8&&count($tcf235db237866cd5f280e0a7fdb2dca8))foreach($tcf235db237866cd5f280e0a7fdb2dca8 as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' ), // issue 183 array( ''."\n".'
    {$vvv}
    CD
    ', '?>vvvls;if($t605f930a4a05d6efbed70a9059f688fe&&count($t605f930a4a05d6efbed70a9059f688fe))foreach($t605f930a4a05d6efbed70a9059f688fe as $__Context->vvv){ ?>'."\n".'
    vvv ?>
    CD
    ' ), // issue 512 - ignores array( '
    {$lang->sl_show_topimgtext}
    ', '?>
    lang->sl_show_topimgtext ?>
    ' ), // issue 584 array( 'mobile', PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?>mobile' ), // issue 831 array( "
  • class=\"on\">", "?>
  • act, array(\n'dispNmsAdminGroupList',\n'dispNmsAdminInsertGroup',\n'dispNmsAdminGroupInfo',\n'dispNmsAdminDeleteGroup'))){ ?>class=\"on\">" ), // issue 746 array( '', '?>' ), // issue 696 array( '{@ eval(\'$val = $document_srl;\')}', PHP_EOL . 'eval(\'$__Context->val = $__Context->document_srl;\') ?>' ), // https://github.com/xpressengine/xe-core/issues/1510 array( '', PHP_EOL . 'if($__Context->foo->bar){ ?>' ), // https://github.com/xpressengine/xe-core/issues/1510 array( 'a!@#$%^&*()_-=[]{}?/', PHP_EOL . 'if($__Context->foo->bar > 100){ ?>a!@#$%^&*()_-=[]{}?/' ), // https://github.com/xpressengine/xe-core/issues/1510 array( '', PHP_EOL . 'if($__Context->foo->bar){ ?>' ), // https://github.com/xpressengine/xe-core/issues/1510 array( '', PHP_EOL . 'if(!$__Context->module_info->title){ ?>' ), // https://github.com/xpressengine/xe-core/issues/1510 array( '', PHP_EOL . 'if($__Context->mi->title){ ?>mi->use){ ?> class="tmp_class" src="/xe/tests/unit/classes/img/common/blank.gif" />' ), array( ' alt', '?> foo->bar){ ?>alt' ), array( '' . "\n" . ' alt', '?>' . PHP_EOL . ' foo->bar){ ?>alt' ), array( 'asf ', '?>asf ' ), array( '', '?>' ), array( 'asdf src="../img/img.gif" asdf src asdf src="../img/img.gif" asdf', '?>asdf src="../img/img.gif" asdf src asdf src="../img/img.gif" asdf' ), array( 'asdf src="../img/img.gif" asdf', '?>asdf src="../img/img.gif" asdf' ), ); foreach ($tests as $test) { $tmpl = new TemplateHandlerWrapper; $tmpl->init(__DIR__ . '/template', 'no_file.html'); $result = $tmpl->parse($test[0]); $this->assertEquals($this->prefix . $test[1], $result); } } public function testParseNoContent() { $tmpl = new TemplateHandlerWrapper; $tmpl->init(__DIR__ . '/template', 'no_file.html'); $result = $tmpl->parse($tpl); $this->assertEquals('', $result); } public function testCompileDirect() { $tmpl = TemplateHandler::getInstance(); $result = $tmpl->compileDirect(__DIR__ . '/template', 'sample.html'); $result = trim($result); $this->assertEquals($result, $this->prefix.PHP_EOL.'if($__Context->has_blog){ ?>Taggon\'s blog'.PHP_EOL.''); } } class TemplateHandlerWrapper extends \TemplateHandler { private $inst; function __construct() { $this->inst = parent::getInstance(); } public function init($tpl_path, $tpl_filename, $tpl_file = '') { call_user_func(array($this->inst, 'init'), $tpl_path, $tpl_filename, $tpl_file); } public function parse($buff = null) { return call_user_func(array($this->inst, 'parse'), $buff); } }