Пример #1
0
Файл: loader.php Проект: GE3/GE3
 protected function createTemplate()
 {
     $template = new NTemplate();
     $presenter = $this->getPresenter(FALSE);
     $template->onPrepareFilters[] = callback($this, 'templatePrepareFilters');
     $template->component = $this;
     $template->control = $this;
     $template->presenter = $presenter;
     $template->baseUri = NEnvironment::getVariable('baseUri');
     $template->basePath = rtrim($template->baseUri, '/');
     if ($presenter !== NULL && $presenter->hasFlashSession()) {
         $id = $this->getParamId('flash');
         $template->flashes = $presenter->getFlashSession()->{$id};
     }
     if (!isset($template->flashes) || !is_array($template->flashes)) {
         $template->flashes = array();
     }
     $template->registerHelper('escape', 'NTemplateHelpers::escapeHtml');
     $template->registerHelper('escapeUrl', 'rawurlencode');
     $template->registerHelper('stripTags', 'strip_tags');
     $template->registerHelper('nl2br', 'nl2br');
     $template->registerHelper('substr', 'iconv_substr');
     $template->registerHelper('repeat', 'str_repeat');
     $template->registerHelper('replaceRE', 'NString::replace');
     $template->registerHelper('implode', 'implode');
     $template->registerHelper('number', 'number_format');
     $template->registerHelperLoader('NTemplateHelpers::loader');
     return $template;
 }