private static function get_subheader_tpl() { $subheader_lang = LangLoader::get('admin-links-common'); $subheader_tpl = new FileTemplate('admin/subheader_menu.tpl'); $subheader_tpl->add_lang($subheader_lang); $modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); $modules_number = 0; foreach ($modules as $module) { if ($module->get_configuration()->get_admin_menu() == 'modules') { $modules_number++; } } $subheader_tpl->put_all(array('L_ADD' => $subheader_lang['add'], 'L_ADMINISTRATION' => $subheader_lang['administration'], 'L_MANAGEMENT' => $subheader_lang['management'], 'L_CONFIGURATION' => $subheader_lang['configuration'], 'L_CONFIG_GENERAL' => $subheader_lang['administration.configuration.general'], 'L_CONFIG_ADVANCED' => $subheader_lang['administration.configuration.advanced'], 'L_MAIL_CONFIG' => $subheader_lang['administration.configuration.mail'], 'L_THEMES' => $subheader_lang['administration.themes'], 'L_LANGS' => $subheader_lang['administration.langs'], 'L_SMILEY' => $subheader_lang['administration.smileys'], 'L_ADMINISTRATOR_ALERTS' => $subheader_lang['administration.alerts'], 'L_TOOLS' => $subheader_lang['tools'], 'L_UPDATES' => $subheader_lang['updates'], 'L_KERNEL' => $subheader_lang['tools.updates.kernel'], 'L_MAINTAIN' => $subheader_lang['tools.maintain'], 'L_CACHE' => $subheader_lang['tools.cache'], 'L_SYNDICATION_CACHE' => $subheader_lang['tools.cache.syndication'], 'L_CSS_CACHE_CONFIG' => $subheader_lang['tools.cache.css'], 'L_ERRORS' => $subheader_lang['tools.errors-archived'], 'L_404_ERRORS' => $subheader_lang['tools.404-errors-archived'], 'L_SERVER' => $subheader_lang['tools.server'], 'L_PHPINFO' => $subheader_lang['tools.server.phpinfo'], 'L_SYSTEM_REPORT' => $subheader_lang['tools.server.system-report'], 'L_USER' => $subheader_lang['users'], 'L_PUNISHEMENT' => $subheader_lang['users.punishement'], 'L_GROUP' => $subheader_lang['users.groups'], 'L_EXTEND_FIELD' => $subheader_lang['users.extended-fields'], 'L_CONTENT' => $subheader_lang['content'], 'L_CONTENT_CONFIG' => $subheader_lang['content'], 'L_MENUS' => $subheader_lang['content.menus'], 'L_ADD_CONTENT_MENU' => $subheader_lang['content.menus.content'], 'L_ADD_LINKS_MENU' => $subheader_lang['content.menus.links'], 'L_ADD_FEED_MENU' => $subheader_lang['content.menus.feed'], 'L_FILES' => $subheader_lang['content.files'], 'L_COMMENTS' => $subheader_lang['content.comments'], 'L_MODULES' => $subheader_lang['modules'], 'U_NBR_MODULES' => ceil(($modules_number + 1) / 7), 'U_INDEX_SITE' => Environment::get_home_page(), 'C_ADMIN_LINKS_1' => false, 'C_ADMIN_LINKS_2' => false, 'C_ADMIN_LINKS_3' => false, 'C_ADMIN_LINKS_4' => false, 'C_ADMIN_LINKS_5' => false, 'C_ADMIN_LINKS_1' => false)); $array_pos = array(0, 4, 4, 3, 3, 1); $menus_numbers = array('index' => 1, 'administration' => 2, 'tools' => 3, 'members' => 4, 'content' => 5, 'modules' => 6); foreach ($modules as $module) { $module_id = $module->get_id(); $configuration = $module->get_configuration(); $menu_pos_name = $configuration->get_admin_menu(); $menu_pos = 0; if (!empty($menu_pos_name) && !empty($menus_numbers[$menu_pos_name])) { $menu_pos = $menus_numbers[$menu_pos_name]; } if ($menu_pos > 0) { $array_pos[$menu_pos - 1]++; $idmenu = $array_pos[$menu_pos - 1]; $subheader_tpl->put('C_ADMIN_LINKS_' . $menu_pos, true); $subheader_tpl->assign_block_vars('admin_links_' . $menu_pos, array('MODULE_MENU' => ModuleTreeLinksService::display_admin_actions_menu($module))); } } return $subheader_tpl; }
public static function display($content, $type, $timeout = 0, $display_small = false) { $tpl = new FileTemplate('framework/helper/message.tpl'); switch ($type) { case self::SUCCESS: $css_class = 'success'; $image = 'error_success'; break; case self::NOTICE: $css_class = 'notice'; $image = 'error_notice'; break; case self::WARNING: $css_class = 'warning'; $image = 'error_warning'; break; case self::ERROR: $css_class = 'error'; $image = 'error_fatal'; break; case self::QUESTION: $css_class = 'question'; $image = 'error_question'; break; } $tpl->put_all(array('ID' => KeyGenerator::generate_key(4), 'MESSAGE_CSS_CLASS' => $css_class . ($display_small ? ' message-helper-small' : ''), 'MESSAGE_IMG' => $image, 'MESSAGE_CONTENT' => $content, 'C_TIMEOUT' => $timeout > 0, 'TIMEOUT' => $timeout * 1000)); return $tpl; }
function lateral_menu() { global $LANG; $tpl = new FileTemplate('admin/menus/panel.tpl'); $tpl->put_all(array('L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'L_ADD_CONTENT_MENUS' => $LANG['menus_content_add'], 'L_ADD_LINKS_MENUS' => $LANG['menus_links_add'], 'L_ADD_FEED_MENUS' => $LANG['menus_feed_add'])); $tpl->display(); }
public function display($content) { $template = new FileTemplate('admin/frame.tpl'); $customization_config = CustomizationConfig::load(); $template->put_all(array('C_FAVICON' => $customization_config->favicon_exists(), 'C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $this->get_seo_meta_data()->get_full_title(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'BODY' => new StringTemplate($content))); $template->display(); }
public function get_content() { $tpl = new FileTemplate('newsletter/newsletter_mini.tpl'); $tpl->add_lang(LangLoader::get('common', 'newsletter')); $tpl->put('USER_MAIL', AppContext::get_current_user()->get_email()); return $tpl; }
function processTemplateMacro($macro, $file, $optstr) { $template = new FileTemplate($file); $template->registerFilter(Environment::getNette()->createLatte()); $template->registerHelperLoader('TemplateHelpers::loader'); $template->setCacheStorage(Environment::getContext()->nette->templateCacheStorage); $template->page = $this->pageContext; //TODO disable macros in getContent() $template->opts = $opts = self::parseOptions($optstr); //from Nette\Application\UI\Control $template->baseUri = $template->baseUrl = rtrim($this->url->getBaseUrl(), '/'); $template->basePath = preg_replace('#https?://[^/]+#A', '', $template->baseUrl); //lang settings $template->lang = $this->pageContext->lang; $template->langs = $this->i18n->langs; $template->setTranslator(new TranslationsModel($this->pageContext->lang)); try { $template = $template->__toString(true); } catch (Exception $e) { if (Debugger::$productionMode) { Debugger::log($e); return "<span class='zprava'>Error: {$macro} not availible</span>"; } else { return "<span class='zprava'>Error: " . $e->getMessage() . "</span>"; } } return $template; }
public function get_menu_content() { $tpl = new FileTemplate('calendar/CalendarModuleMiniMenu.tpl'); $tpl->add_lang(LangLoader::get('common', 'calendar')); $tpl->put('CALENDAR', CalendarAjaxCalendarController::get_view(true)); return $tpl->render(); }
/** * @param Template $view * @return InstallDisplayResponse */ private function create_response() { $view = new FileTemplate('install/license.tpl'); $view->put('LICENSE_FORM', $this->form->display()); $step_title = $this->lang['step.license.title']; $response = new InstallDisplayResponse(1, $step_title, $view); return $response; }
public function display() { $tpl = new FileTemplate('ReCaptcha/ReCaptcha.tpl'); $this->lang = LangLoader::get('common', 'ReCaptcha'); $tpl->add_lang($this->lang); $tpl->put_all(array('C_RECAPTCHA_V2' => $this->is_recaptcha_v2, 'SITE_KEY' => $this->is_recaptcha_v2 ? $this->config->get_site_key() : self::DEFAULT_SITE_KEY, 'HTML_ID' => $this->get_html_id())); return $tpl->render(); }
public function get_content() { global $LANG; load_module_lang('search'); $search = retrieve(REQUEST, 'q', ''); $tpl = new FileTemplate('search/search_mini.tpl'); $tpl->put_all(array('TEXT_SEARCHED' => !empty($search) ? stripslashes(retrieve(REQUEST, 'q', '')) : '', 'WARNING_LENGTH_STRING_SEARCH' => addslashes($LANG['warning_length_string_searched']), 'L_SEARCH' => $LANG['search'], 'U_FORM_VALID' => url(TPL_PATH_TO_ROOT . '/search/search.php#results'), 'L_ADVANCED_SEARCH' => $LANG['advanced_search'], 'U_ADVANCED_SEARCH' => url(TPL_PATH_TO_ROOT . '/search/search.php'))); return $tpl; }
/** * {@inheritdoc} */ public function display($content) { $template = new FileTemplate('frame.tpl'); $customization_config = CustomizationConfig::load(); $lang = LangLoader::get('main'); $description = $this->get_seo_meta_data()->get_full_description(); $template->put_all(array('C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'C_CSS_LOGIN_DISPLAYED' => $this->display_css_login, 'C_FAVICON' => $customization_config->favicon_exists(), 'C_CANONICAL_URL' => $this->get_seo_meta_data()->canonical_link_exists(), 'C_DESCRIPTION' => !empty($description), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $this->get_seo_meta_data()->get_full_title(), 'SITE_DESCRIPTION' => $description, 'U_CANONICAL' => $this->get_seo_meta_data()->get_canonical_link(), 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'BODY' => new StringTemplate($content))); $template->display(true); }
/** * @return Template The html code for the file input. */ function display() { $template = $this->get_template_to_use(); $tpl = new FileTemplate('framework/builder/form/FormFieldMultipleFilePicker.tpl'); $tpl->put_all(array('MAX_FILE_SIZE' => $this->get_max_file_size(), 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input)); $this->assign_common_template_variables($template); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
private function build_view() { $config_html = new SitemapExportConfig('sitemap/export/sitemap.html.tpl', 'sitemap/export/module_map.html.tpl', 'sitemap/export/sitemap_section.html.tpl', 'sitemap/export/sitemap_link.html.tpl'); $sitemap = SitemapService::get_personal_sitemap(); $tpl = new FileTemplate('sitemap/ViewSitemapController.tpl'); $tpl->add_lang($this->lang); $tpl->put('SITEMAP', $sitemap->export($config_html)); return $tpl; }
public function display() { $question_id = array_rand(self::$questions); //Question aléatoire $question = new QuestionCaptchaQuestion(); $question->set_properties(self::$questions[$question_id]); $tpl = new FileTemplate('QuestionCaptcha/QuestionCaptcha.tpl'); $tpl->put_all(array('QUESTION_ID' => $question_id, 'QUESTION' => $question->get_label(), 'HTML_ID' => $this->get_html_id())); return $tpl->render(); }
public static function add_filter_fieldset(Menu $menu, Template $tpl) { $tpl_filter = new FileTemplate('admin/menus/filters.tpl'); $tpl_filter->assign_block_vars('modules', array('ID' => '')); foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $home_page = $configuration->get_home_page(); if (!empty($home_page)) { $tpl_filter->assign_block_vars('modules', array('ID' => $module->get_id())); } } //Ajout du menu if ($menu->get_id() == '') { $menu->set_filters(array(new MenuStringFilter('/'))); } // Installed modules foreach ($menu->get_filters() as $key => $filter) { $filter_pattern = $filter->get_pattern(); $filter_infos = explode('/', $filter_pattern); $module_name = $filter_infos[0]; $regex = substr(strstr($filter_pattern, '/'), 1); $tpl_filter->assign_block_vars('filters', array('ID' => $key, 'FILTER' => $regex)); $tpl_filter->assign_block_vars('filters.modules', array('ID' => '', 'SELECTED' => $filter_pattern == '/' ? ' selected="selected"' : '')); foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $home_page = $configuration->get_home_page(); if (!empty($home_page)) { $tpl_filter->assign_block_vars('filters.modules', array('ID' => $module->get_id(), 'SELECTED' => $module_name == $module->get_id() ? ' selected="selected"' : '')); } } } $tpl_filter->add_lang(LangLoader::get('admin-menus-common')); $tpl_filter->put_all(array('NBR_FILTER' => $menu->get_id() == '' ? 0 : count($menu->get_filters()) - 1)); $tpl->put('filters', $tpl_filter); }
public function get_search_form($args = null) { require_once PATH_TO_ROOT . '/kernel/begin.php'; load_module_lang('wiki'); global $LANG; $tpl = new FileTemplate('wiki/wiki_search_form.tpl'); if (!isset($args['WikiWhere']) || !in_array($args['WikiWhere'], explode(',', 'title,contents,all'))) { $args['WikiWhere'] = 'title'; } $tpl->put_all(array('L_WHERE' => $LANG['wiki_search_where'], 'IS_TITLE_SELECTED' => $args['WikiWhere'] == 'title' ? ' selected="selected"' : '', 'IS_CONTENTS_SELECTED' => $args['WikiWhere'] == 'contents' ? ' selected="selected"' : '', 'IS_ALL_SELECTED' => $args['WikiWhere'] == 'all' ? ' selected="selected"' : '', 'L_TITLE' => $LANG['wiki_search_where_title'], 'L_CONTENTS' => $LANG['wiki_search_where_contents'])); return $tpl->render(); }
public function get_menu_content() { global $LANG; //Chargement de la langue du module. load_module_lang('stats'); $tpl = new FileTemplate('stats/stats_mini.tpl'); $stats_cache = StatsCache::load(); $l_member_registered = $stats_cache->get_stats_properties('nbr_members') > 1 ? $LANG['member_registered_s'] : $LANG['member_registered']; $group_color = User::get_group_color($stats_cache->get_stats_properties('last_member_groups'), $stats_cache->get_stats_properties('last_member_level')); $tpl->put_all(array('L_MORE_STAT' => $LANG['more_stats'], 'L_USER_REGISTERED' => sprintf($l_member_registered, $stats_cache->get_stats_properties('nbr_members')), 'L_LAST_REGISTERED_USER' => $LANG['last_member'], 'U_LINK_LAST_USER' => '<a href="' . UserUrlBuilder::profile($stats_cache->get_stats_properties('last_member_id'))->rel() . '" class="' . UserService::get_level_class($stats_cache->get_stats_properties('last_member_level')) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $stats_cache->get_stats_properties('last_member_login') . '</a>')); return $tpl->render(); }
private function build_response(View $view) { $body_view = new FileTemplate('newsletter/NewsletterBody.tpl'); $body_view->add_lang($this->lang); $body_view->put('TEMPLATE', $view); $response = new SiteDisplayResponse($body_view); $breadcrumb = $response->get_graphical_environment()->get_breadcrumb(); $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel()); $breadcrumb->add($this->lang['unsubscribe.newsletter'], NewsletterUrlBuilder::unsubscribe()->rel()); $graphical_environment = $response->get_graphical_environment(); $graphical_environment->set_page_title($this->lang['unsubscribe.newsletter'], $this->lang['newsletter']); $graphical_environment->get_seo_meta_data()->set_canonical_url(NewsletterUrlBuilder::unsubscribe()); return $response; }
private function get_view() { global $Bread_crumb, $LANG, $pages; $pages_config = PagesConfig::load(); //Configuration des authorisations $config_authorizations = $pages_config->get_authorizations(); require_once PATH_TO_ROOT . '/pages/pages_begin.php'; $tpl = new FileTemplate('pages/index.tpl'); $num_pages = PersistenceContext::get_querier()->count(PREFIX . "pages", 'WHERE redirect = 0'); $num_coms = CommentsService::get_number_and_lang_comments('pages', $pages['id']); $tpl->put_all(array('NUM_PAGES' => sprintf($LANG['pages_num_pages'], $num_pages), 'NUM_COMS' => sprintf($LANG['pages_num_coms'], $num_coms, $num_pages > 0 ? $num_coms / $num_pages : 0), 'L_EXPLAIN_PAGES' => $LANG['pages_explain'], 'L_STATS' => $LANG['pages_stats'])); //Liste des dossiers de la racine $root = ''; foreach (PagesCategoriesCache::load()->get_categories() as $key => $cat) { if ($cat['id_parent'] == 0) { //Autorisation particulière ? $special_auth = !empty($cat['auth']); //Vérification de l'autorisation d'éditer la page if ($special_auth && AppContext::get_current_user()->check_auth($cat['auth'], READ_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, READ_PAGE)) { $root .= '<li><a href="javascript:open_cat(' . $key . '); show_pages_cat_contents(' . $cat['id_parent'] . ', 0);"><i class="fa fa-folder"></i>' . stripslashes($cat['title']) . '</a></li>'; } } } //Liste des fichiers de la racine $result = PersistenceContext::get_querier()->select("SELECT title, id, encoded_title, auth\r\n\t\t\tFROM " . PREFIX . "pages\r\n\t\t\tWHERE id_cat = 0 AND is_cat = 0\r\n\t\t\tORDER BY is_cat DESC, title ASC"); while ($row = $result->fetch()) { //Autorisation particulière ? $special_auth = !empty($row['auth']); $array_auth = unserialize($row['auth']); //Vérification de l'autorisation d'éditer la page if ($special_auth && AppContext::get_current_user()->check_auth($array_auth, READ_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, READ_PAGE)) { $root .= '<li><a href="' . PagesUrlBuilder::get_link_item($row['encoded_title']) . '"><i class="fa fa-file"></i>' . stripslashes($row['title']) . '</a></li>'; } } $result->dispose(); $tpl->put_all(array('TITLE' => $LANG['pages'], 'L_ROOT' => $LANG['pages_root'], 'ROOT_CONTENTS' => $root, 'L_CATS' => $LANG['pages_cats_tree'], 'L_EXPLORER' => $LANG['pages_explorer'], 'SELECTED_CAT' => 0, 'CAT_0' => 'selected', 'CAT_LIST' => '')); $contents = ''; $result = PersistenceContext::get_querier()->select("SELECT c.id, p.title, p.encoded_title\r\n\t\tFROM " . PREFIX . "pages_cats c\r\n\t\tLEFT JOIN " . PREFIX . "pages p ON p.id = c.id_page\r\n\t\tWHERE c.id_parent = 0\r\n\t\tORDER BY p.title ASC"); while ($row = $result->fetch()) { $sub_cats_number = PersistenceContext::get_querier()->count(PREFIX . "pages_cats", 'WHERE id_parent=:id_parent', array('id_parent' => $row['id'])); if ($sub_cats_number > 0) { $tpl->assign_block_vars('list', array('DIRECTORY' => '<li class="sub"><a class="parent" href="javascript:show_pages_cat_contents(' . $row['id'] . ', 0);"><i class="fa fa-plus-square-o" id="img2_' . $row['id'] . '"></i><i class="fa fa-folder" id ="img_' . $row['id'] . '"></i></a><a id="class_' . $row['id'] . '" href="javascript:open_cat(' . $row['id'] . ');">' . stripslashes($row['title']) . '</a><span id="cat_' . $row['id'] . '"></li>')); } else { $tpl->assign_block_vars('list', array('DIRECTORY' => '<li class="sub"><a id="class_' . $row['id'] . '" href="javascript:open_cat(' . $row['id'] . ');"><i class="fa fa-folder"></i>' . stripslashes($row['title']) . '</a><span id="cat_' . $row['id'] . '"></span></li>')); } } $result->dispose(); return $tpl; }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('guestbook/GuestbookModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'guestbook')); $tpl->put('U_GUESTBOOK', GuestbookUrlBuilder::home()->rel()); $guestbook_cache = GuestbookMessagesCache::load(); $random_message = $guestbook_cache->get_message(array_rand($guestbook_cache->get_messages())); if ($random_message !== null) { $user_group_color = User::get_group_color($random_message['groups'], $random_message['level']); $tpl->put_all(array('C_ANY_MESSAGE_GUESTBOOK' => true, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_MORE_CONTENTS' => strlen($random_message['contents']) >= 200, 'C_VISITOR' => empty($random_message['user_id']), 'CONTENTS' => $random_message['contents'], 'SHORT_CONTENTS' => nl2br(TextHelper::substr_html($random_message['contents'], 0, 200)), 'USER_PSEUDO' => $random_message['login'], 'USER_LEVEL_CLASS' => UserService::get_level_class($random_message['level']), 'USER_GROUP_COLOR' => $user_group_color, 'U_MESSAGE' => GuestbookUrlBuilder::home($random_message['page'], $random_message['id'])->rel(), 'U_PROFILE' => UserUrlBuilder::profile($random_message['user_id'])->rel())); } return $tpl->render(); }
function display() { $template = $this->get_template_to_use(); $tpl = new FileTemplate('QuestionCaptcha/QuestionCaptchaFormFieldQuestions.tpl'); $tpl->add_lang(LangLoader::get('common', 'QuestionCaptcha')); $this->assign_common_template_variables($template); $i = 1; foreach ($this->get_value() as $id => $options) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'LABEL' => $options['label'], 'ANSWERS' => $options['answers'], 'C_DELETE' => $i > 1)); $i++; } $tpl->put_all(array('NAME' => $this->get_html_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_QUESTIONS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
public function execute(HTTPRequestCustom $request) { $view = new FileTemplate('sitemap/GenerateXMLSitemapController.tpl'); $lang = LangLoader::get('common', 'sitemap'); $view->add_lang($lang); try { SitemapXMLFileService::try_to_generate(); } catch (IOException $ex) { $view->put_all(array('C_GOT_ERROR' => true)); } $view->put_all(array('U_GENERATE' => SitemapUrlBuilder::get_xml_file_generation()->rel())); $response = new AdminSitemapResponse($view); $response->get_graphical_environment()->set_page_title($lang['generate_xml_file'], $lang['sitemap']); return $response; }
public function render() { $this->newSource = preg_replace_callback('(\\$[\\w\\[\\]\\(\\)\'\\-\\>]*)', function ($matches) { if (strpos($matches[0], 'style') !== FALSE || strpos($matches[0], '$presenter') !== FALSE) { return $matches[0]; } return "'" . str_replace(array("'"), array('"'), $matches[0]) . "'"; }, parent::getSource()); $this->newSource = preg_replace_callback('/\\{[^}]*\\}/', function ($matches) { if (strpos($matches[0], '{if') !== FALSE || strpos($matches[0], '/if}') !== FALSE || strpos($matches[0], '{ifset') !== FALSE || strpos($matches[0], '/ifset}') !== FALSE || strpos($matches[0], '{for') !== FALSE || strpos($matches[0], '/for}') !== FALSE || strpos($matches[0], '/foreach}') !== FALSE || strpos($matches[0], '{else') !== FALSE || strpos($matches[0], '{var') !== FALSE || strpos($matches[0], '|round') !== FALSE || strpos($matches[0], 'round(') !== FALSE || strpos($matches[0], 'strtolower') !== FALSE || strpos($matches[0], 'nl2br') !== FALSE || strpos($matches[0], '{?') !== FALSE || strpos($matches[0], 'count(') !== FALSE || strpos($matches[0], '|count') !== FALSE || strpos($matches[0], '|replace') !== FALSE || strpos($matches[0], 'replace(') !== FALSE || strpos($matches[0], '_replace') !== FALSE || strpos($matches[0], '{sep') !== FALSE || strpos($matches[0], '/sep}') !== FALSE || strpos($matches[0], '{last') !== FALSE || strpos($matches[0], '/last}') !== FALSE || strpos($matches[0], '{first') !== FALSE || strpos($matches[0], '/first}') !== FALSE || strpos($matches[0], '{*') !== FALSE || strpos($matches[0], '*}') !== FALSE) { return ''; } elseif (strpos($matches[0], 'number') !== FALSE || strpos($matches[0], '|ceil') !== FALSE || strpos($matches[0], 'ceil(') !== FALSE) { return "{'NUMBER'}"; } elseif (strpos($matches[0], '{control') !== FALSE) { return "{'control'}"; } elseif (strpos($matches[0], '|ucwords') !== FALSE || strpos($matches[0], 'ucwords(') !== FALSE) { return "{'NAME'}"; } elseif (strpos($matches[0], '|date') !== FALSE || strpos($matches[0], 'date(') !== FALSE || strpos($matches[0], 'format(') !== FALSE) { return "{'DATE'}"; } elseif (strpos($matches[0], '?') !== FALSE) { return str_replace(array(':', '?'), '.', $matches[0]); } return $matches[0]; }, $this->newSource); $this->newSource = str_replace(array("n:", "[''", "{*", "*}", "ucwords", "{('", "')}", ")' }", "', ('"), array("", "[", '', '', '', "{'", "'}", "') }", "', '"), $this->newSource); // Uncomment for debugging code //die($this->newSource); parent::render(); }
public function get_menu_content() { //Create file template $tpl = new FileTemplate('web/WebModuleMiniMenu.tpl'); //Assign the lang file to the tpl $tpl->add_lang(LangLoader::get('common', 'web')); //Load module cache $web_cache = WebCache::load(); $partners_weblinks = $web_cache->get_partners_weblinks(); $tpl->put('C_PARTNERS', !empty($partners_weblinks)); foreach ($partners_weblinks as $partner) { $partner_picture = new Url($partner['partner_picture']); $picture = $partner_picture->rel(); $tpl->assign_block_vars('partners', array('C_HAS_PARTNER_PICTURE' => !empty($picture), 'NAME' => $partner['name'], 'U_PARTNER_PICTURE' => $picture, 'U_VISIT' => WebUrlBuilder::visit($partner['id'])->rel())); } return $tpl->render(); }
private function build_children_view($template, $categories, $id_parent) { foreach ($categories as $id => $category) { if ($category->get_id_parent() == $id_parent && $id != Category::ROOT_CATEGORY) { $description = ''; if (method_exists($category, 'get_description')) { $description = FormatingHelper::second_parse($category->get_description()); $description = strlen($description) > 250 ? substr(@strip_tags($description, '<br><br/>'), 0, 250) . '...' : $description; } $description_exists = method_exists($category, 'get_description'); $category_view = new FileTemplate('default/framework/content/categories/category.tpl'); $category_view->add_lang($this->lang); $category_view->put_all(array('C_DESCRIPTION' => !empty($description), 'U_DISPLAY' => $this->get_display_category_url($category)->rel(), 'U_EDIT' => $this->get_edit_category_url($category)->rel(), 'U_DELETE' => $this->get_delete_category_url($category)->rel(), 'ID' => $id, 'NAME' => $category->get_name(), 'DESCRIPTION' => $description)); $this->build_children_view($category_view, $categories, $id); $template->assign_block_vars('childrens', array('child' => $category_view->render())); } } }
function display() { $template = $this->get_template_to_use(); $lang = LangLoader::get('admin-user-common'); $tpl = new FileTemplate('contact/ContactFormFieldRecipientsPossibleValues.tpl'); $tpl->add_lang($lang); $this->assign_common_template_variables($template); $i = 0; foreach ($this->get_value() as $name => $options) { if (!empty($options)) { $tpl->assign_block_vars('fieldelements', array('C_DELETABLE' => $i > 0, 'ID' => $i, 'NAME' => stripslashes($options['title']), 'IS_DEFAULT' => (int) $options['is_default'], 'EMAIL' => $i > 0 ? stripslashes($options['email']) : implode(',', MailServiceConfig::load()->get_administrators_mails()))); $i++; } } $tpl->put_all(array('NAME' => $this->get_html_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
private function get_view() { global $Bread_crumb, $LANG, $encoded_title, $id_article, $article_infos, $id_cat; load_module_lang('wiki'); include_once PATH_TO_ROOT . '/wiki/wiki_functions.php'; $bread_crumb_key = 'wiki'; require_once PATH_TO_ROOT . '/wiki/wiki_bread_crumb.php'; $config = WikiConfig::load(); $tpl = new FileTemplate('wiki/index.tpl'); if ($config->get_number_articles_on_index() > 1) { $result = PersistenceContext::get_querier()->select("SELECT a.title, a.encoded_title, a.id\r\n\t\t\tFROM " . PREFIX . "wiki_articles a\r\n\t\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\r\n\t\t\tWHERE a.redirect = 0\r\n\t\t\tORDER BY c.timestamp DESC\r\n\t\t\tLIMIT :number_articles_on_index OFFSET 0", array('number_articles_on_index' => $config->get_number_articles_on_index())); $tpl->assign_block_vars('last_articles', array('C_ARTICLES' => $result->get_rows_count(), 'L_ARTICLES' => $LANG['wiki_last_articles_list'])); $i = 0; while ($row = $result->fetch()) { $tpl->assign_block_vars('last_articles.list', array('ARTICLE' => $row['title'], 'TR' => $i > 0 && $i % 2 == 0 ? '</tr><tr>' : '', 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']))); $i++; } $result->dispose(); if ($i == 0) { $tpl->put_all(array('L_NO_ARTICLE' => '<td class="center" colspan="2">' . $LANG['wiki_no_article'] . '</td>')); } } //Affichage de toutes les catégories si c'est activé if ($config->are_categories_displayed_on_index()) { $tpl->assign_block_vars('cat_list', array('L_CATS' => $LANG['wiki_cats_list'])); $i = 0; foreach (WikiCategoriesCache::load()->get_categories() as $id => $cat) { //Si c'est une catégorie mère if ($cat['id_parent'] == 0) { $tpl->assign_block_vars('cat_list.list', array('CAT' => stripslashes($cat['title']), 'U_CAT' => url('wiki.php?title=' . $cat['encoded_title'], $cat['encoded_title']))); $i++; } } if ($i == 0) { $tpl->put_all(array('L_NO_CAT' => $LANG['wiki_no_cat'])); } } $tpl->put_all(array('TITLE' => $config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki'], 'INDEX_TEXT' => $config->get_index_text() ? FormatingHelper::second_parse(wiki_no_rewrite($config->get_index_text())) : $LANG['wiki_empty_index'], 'L_EXPLORER' => $LANG['wiki_explorer'], 'U_EXPLORER' => url('explorer.php'))); $page_type = 'index'; include PATH_TO_ROOT . '/wiki/wiki_tools.php'; $tpl->put('wiki_tools', $tools_tpl); return new StringTemplate($tpl->render()); }
public function display() { $template = $this->get_template_to_use(); $tpl = new FileTemplate('framework/builder/form/FormFieldMultipleAutocompleter.tpl'); $this->assign_common_template_variables($template); if (empty($this->file)) { throw new Exception('Add file options containing file url'); } $i = 0; foreach ($this->get_value() as $value) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => $value)); $i++; } if ($i == 0) { $tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => '')); } $tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i == 0 ? 1 : $i, 'SIZE' => $this->size, 'METHOD' => $this->method, 'NAME_PARAMETER' => $this->name_parameter, 'FILE' => $this->file)); $template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render())); return $template; }
public static function display_admin_actions_menu(Module $module) { $id_module = $module->get_id(); $configuration = $module->get_configuration(); $admin_main_page = $configuration->get_admin_main_page(); $tpl = new FileTemplate('framework/module/admin_module_actions_links_menu.tpl'); $tpl->put_all(array('U_LINK' => TPL_PATH_TO_ROOT . '/' . $id_module . '/' . $configuration->get_admin_main_page(), 'NAME' => $configuration->get_name(), 'IMG' => TPL_PATH_TO_ROOT . '/' . $id_module . '/' . $id_module . '_mini.png', 'C_HAS_SUB_LINK' => false, 'C_DISPLAY' => !empty($admin_main_page))); $tree_links = self::get_tree_links($id_module); if ($tree_links !== null) { $actions_tree_links = $tree_links->get_actions_tree_links(); $tpl->put_all(array('C_HAS_SUB_LINK' => $actions_tree_links->has_links(), 'C_DISPLAY' => $actions_tree_links->has_links() || !empty($admin_main_page))); $home_page = $configuration->get_home_page(); if (!empty($home_page)) { $module_home = new ModuleLink(LangLoader::get_message('home', 'main'), new Url('/' . $id_module . '/' . $home_page)); $tpl->assign_block_vars('element', array(), array('ELEMENT' => $module_home->export())); } return self::display($actions_tree_links, $tpl); } return $tpl; }
private function get_view() { $this->check_authorizations(); global $Bread_crumb, $LANG; require_once PATH_TO_ROOT . '/poll/poll_begin.php'; $tpl = new FileTemplate('poll/poll.tpl'); $now = new Date(); $show_archives = PersistenceContext::get_querier()->count(PREFIX . "poll", 'WHERE archive = 1 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)', array('timestamp' => $now->get_timestamp())); $show_archives = !empty($show_archives) ? '<a href="poll' . url('.php?archives=1', '.php?archives=1') . '">' . $LANG['archives'] . '</a>' : ''; $edit = ''; if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) { $edit = '<a href="' . PATH_TO_ROOT . '/poll/admin_poll.php" title="' . LangLoader::get_message('edit', 'common') . '" class="fa fa-edit"></a>'; } $tpl->put_all(array('C_POLL_MAIN' => true, 'EDIT' => $edit, 'U_ARCHIVE' => $show_archives, 'L_POLL' => $LANG['poll'], 'L_POLL_MAIN' => $LANG['poll_main'])); $result = PersistenceContext::get_querier()->select("SELECT id, question \r\n\t\tFROM " . PREFIX . "poll \r\n\t\tWHERE archive = 0 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)\r\n\t\tORDER BY id DESC", array('timestamp' => $now->get_timestamp())); while ($row = $result->fetch()) { $tpl->assign_block_vars('list', array('U_POLL_ID' => url('.php?id=' . $row['id'], '-' . $row['id'] . '.php'), 'QUESTION' => stripslashes($row['question']))); } $result->dispose(); return $tpl; }