本文整理汇总了PHP中FileTemplate::render方法的典型用法代码示例。如果您正苦于以下问题:PHP FileTemplate::render方法的具体用法?PHP FileTemplate::render怎么用?PHP FileTemplate::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileTemplate
的用法示例。
在下文中一共展示了FileTemplate::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
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();
}
示例2: get_menu_content
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();
}
示例3: display
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();
}
示例4: display
/**
* @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;
}
示例5: display
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();
}
示例6: get_menu_content
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();
}
示例7: get_search_form
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();
}
示例8: display
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;
}
示例9: get_menu_content
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();
}
示例10: get_menu_content
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();
}
示例11: display
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;
}
示例12: get_view
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());
}
示例13: display
function display()
{
$template = $this->get_template_to_use();
$tpl = new FileTemplate('news/NewsFormFieldSelectSources.tpl');
$tpl->add_lang(LangLoader::get('common'));
$tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled()));
$this->assign_common_template_variables($template);
$i = 0;
foreach ($this->get_value() as $name => $value) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => $value, 'NAME' => $name));
$i++;
}
if ($i == 0) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'VALUE' => '', 'NAME' => ''));
}
$tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input, 'NBR_FIELDS' => $i == 0 ? 1 : $i));
$template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render()));
return $template;
}
示例14: display
function display()
{
$template = $this->get_template_to_use();
$lang = LangLoader::get('common', 'contact');
$config = ContactConfig::load();
$tpl = new FileTemplate('contact/ContactFormFieldObjectPossibleValues.tpl');
$tpl->add_lang($lang);
$this->assign_common_template_variables($template);
$fields = $config->get_fields();
$recipients_field_id = $config->get_field_id_by_name('f_recipients');
$recipients_field = new ContactField();
$recipients_field->set_properties($fields[$recipients_field_id]);
foreach ($recipients_field->get_possible_values() as $id => $options) {
if (!empty($options)) {
$tpl->assign_block_vars('recipients_list', array('ID' => $id, 'NAME' => stripslashes($options['title'])));
}
}
$i = 0;
foreach ($this->get_value() as $name => $options) {
if (!empty($options)) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => stripslashes($options['title']), 'IS_DEFAULT' => (int) $options['is_default']));
foreach ($recipients_field->get_possible_values() as $id => $recipient_options) {
if (!empty($recipient_options)) {
$tpl->assign_block_vars('fieldelements.recipients_list', array('C_RECIPIENT_SELECTED' => $options['recipient'] == $id, 'ID' => $id, 'NAME' => stripslashes($recipient_options['title'])));
}
}
$i++;
}
}
if ($i == 0) {
$tpl->assign_block_vars('fieldelements', array('ID' => $i, 'NAME' => '', 'IS_DEFAULT' => 0));
foreach ($recipients_field->get_possible_values() as $id => $options) {
if (!empty($options)) {
$tpl->assign_block_vars('fieldelements.recipients_list', array('ID' => $id, 'NAME' => stripslashes($options['title'])));
}
}
$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;
}
示例15: display
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;
}