本文整理汇总了PHP中phpbb\template\template::assign_display方法的典型用法代码示例。如果您正苦于以下问题:PHP template::assign_display方法的具体用法?PHP template::assign_display怎么用?PHP template::assign_display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\template\template
的用法示例。
在下文中一共展示了template::assign_display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewtopic_modify_data
/**
* Show bbcodes and smilies in the quickreply
* Template data for Ajax submit
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_data($event)
{
$forum_id = $event['forum_id'];
$topic_data = $event['topic_data'];
$post_list = $event['post_list'];
$topic_id = $topic_data['topic_id'];
$s_quick_reply = false;
if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
// Quick reply enabled forum
$s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
}
if (!$this->user->data['is_registered'] && $s_quick_reply) {
add_form_key('posting');
$s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
$s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
$s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
$s_notify = false;
$qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
// Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
!$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
!$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
!$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
$s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
$s_notify ? $qr_hidden_fields['notify'] = 1 : true;
$topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
$this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
if ($this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Ajaxify viewtopic data
if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Fix issues if the inserted post is not the first.
if ($this->qr_insert && !$this->qr_first) {
$this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
}
$page_title = $event['page_title'];
$this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
// Output the page
page_header($page_title, false, $forum_id);
page_footer(false, false, false);
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
}
if ($s_quick_reply) {
include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
$quote_status = true;
// Build custom bbcodes array
if ($bbcode_status) {
display_custom_bbcodes();
}
// Generate smiley listing
if ($smilies_status) {
generate_smilies('inline', $forum_id);
}
// Show attachment box for adding attachments if true
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
$allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
$attachment_data = false;
if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
$this->user->add_lang('posting');
}
if ($this->config['qr_attach'] && $allowed) {
$this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$message_parser->set_plupload($this->plupload);
$message_parser->set_mimetype_guesser($this->mimetype_guesser);
$message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
示例2: render
/**
* Automate setting up the page and creating the response object.
*
* @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param int $status_code The status code to be sent to the page header
* @param bool $display_online_list Do we display online users list
*
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false)
{
page_header($page_title, $display_online_list);
$this->template->set_filenames(array('body' => $template_file));
page_footer(true, false, false);
return new Response($this->template->assign_display('body'), $status_code);
}
示例3: on_kernel_exception
/**
* This listener is run when the KernelEvents::EXCEPTION event is triggered
*
* @param GetResponseForExceptionEvent $event
* @return null
*/
public function on_kernel_exception(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
$message = $exception->getMessage();
if ($exception instanceof \phpbb\exception\exception_interface) {
$message = $this->language->lang_array($message, $exception->get_parameters());
}
if (!$event->getRequest()->isXmlHttpRequest()) {
page_header($this->language->lang('INFORMATION'));
$this->template->assign_vars(array('MESSAGE_TITLE' => $this->language->lang('INFORMATION'), 'MESSAGE_TEXT' => $message));
$this->template->set_filenames(array('body' => 'message_body.html'));
page_footer(true, false, false);
$response = new Response($this->template->assign_display('body'), 500);
} else {
$data = array();
if (!empty($message)) {
$data['message'] = $message;
}
if (defined('DEBUG')) {
$data['trace'] = $exception->getTrace();
}
$response = new JsonResponse($data, 500);
}
if ($exception instanceof HttpExceptionInterface) {
$response->setStatusCode($exception->getStatusCode());
$response->headers->add($exception->getHeaders());
}
$event->setResponse($response);
}
示例4: render
/**
* Automate setting up the page and creating the response object.
*
* @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param int $status_code The status code to be sent to the page header
* @param bool $display_online_list Do we display online users list
* @param int $item_id Restrict online users to item id
* @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id
* @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers.
*
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false)
{
page_header($page_title, $display_online_list, $item_id, $item, $send_headers);
$this->template->set_filenames(array('body' => $template_file));
page_footer(true, false, false);
$headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array();
return new Response($this->template->assign_display('body'), $status_code, $headers);
}
示例5: get_edit_form
/**
* @param array $block_data
* @param array $default_settings
* @return template|string
*/
public function get_edit_form(array $block_data, array $default_settings)
{
global $module;
if (!function_exists('build_cfg_template')) {
include $this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext;
}
// We fake this class as it is needed by the build_cfg_template function
$module = new \stdClass();
$module->module = $this;
$this->_generate_config_fields($block_data['settings'], $default_settings);
$this->template->assign_vars(array('S_ACTIVE' => $block_data['status'], 'S_TYPE' => $block_data['type'], 'S_NO_WRAP' => $block_data['no_wrap'], 'S_HIDE_TITLE' => $block_data['hide_title'], 'S_BLOCK_CLASS' => trim($block_data['class']), 'S_GROUP_OPS' => $this->_get_group_options($block_data['permission'])));
$this->template->set_filenames(array('block_settings' => 'block_settings.html'));
return $this->template->assign_display('block_settings');
}
示例6: viewforum_modify_topicrow
/**
* Event: core.viewforum_modify_topicrow
*
* Get and assign tags to topic-row-template -> RH_TOPICTAGS_TAGS.
*
* Note that we assign a string which includes the a-href-links already,
* because we cannot assign sub-blocks before the outer-block with
* assign_block_vars(...) and the event is before the actual assignment.
*
* @param $event
*/
public function viewforum_modify_topicrow($event)
{
if ($this->config[prefixes::CONFIG . '_display_tags_in_viewforum']) {
$data = $event->get_data();
$topic_id = (int) $data['row']['topic_id'];
$forum_id = (int) $data['row']['forum_id'];
if ($this->tags_manager->is_tagging_enabled_in_forum($forum_id)) {
$tags = $this->tags_manager->get_assigned_tags($topic_id);
if (!empty($tags)) {
// we cannot use assign_block_vars('topicrow.tags', ...) here, because the block 'topicrow' is not yet assigned
// add links
$this->assign_tags_to_template('rh_tags_tmp', $tags);
// small_tag.html might want to use our extension's css.
$this->template->assign_var('S_RH_TOPICTAGS_INCLUDE_CSS', true);
// we cannot just use 'small_tag.html' because in viewforum.php twig only searches in phpbb_root/styles/prosilver/template,
// but we need a template from our extension.
$rendered_tags = $this->template->assign_display('./../../../ext/robertheim/topictags/styles/all/template/small_tag.html');
// remove temporary data
$this->template->destroy_block_vars('rh_tags_tmp');
// assign the template data
$data['topic_row']['RH_TOPICTAGS_TAGS'] = $rendered_tags;
$event->set_data($data);
}
}
}
}
示例7: add_user_form_group
/**
* {@inheritdoc}
*/
public function add_user_form_group($title, $form)
{
$this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form));
$this->template->assign_block_vars('options', array('LEGEND' => $this->language->lang($title), 'S_LEGEND' => true));
foreach ($form as $input_name => $input_options) {
if (!isset($input_options['type'])) {
continue;
}
$tpl_ary = array();
$tpl_ary['TYPE'] = $input_options['type'];
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
$tpl_ary['KEY'] = $input_name;
$tpl_ary['S_EXPLAIN'] = false;
if (isset($input_options['default'])) {
$default = $input_options['default'];
$default = preg_replace_callback('#\\{L_([A-Z0-9\\-_]*)\\}#s', array($this, 'lang_replace_callback'), $default);
$tpl_ary['DEFAULT'] = $default;
}
if (isset($input_options['description'])) {
$tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']);
$tpl_ary['S_EXPLAIN'] = true;
}
if (in_array($input_options['type'], array('select', 'radio'))) {
for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) {
if (isset($input_options['options'][$i]['label'])) {
$input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']);
}
}
$tpl_ary['OPTIONS'] = $input_options['options'];
}
$this->template->assign_block_vars('options', $tpl_ary);
}
$this->template->set_filenames(array('form_install' => 'installer_form.html'));
$this->form = $this->template->assign_display('form_install');
}
示例8: display_panels
/**
* Display the panels (tabs)
*/
public function display_panels()
{
foreach ($this->posting_panels as $name => $lang) {
$this->template->set_filenames(array($name => 'posting/panels/' . $name . '.html'));
$this->template->assign_block_vars('panels', array('NAME' => $name, 'TITLE' => $this->user->lang($lang), 'OUTPUT' => $this->template->assign_display($name)));
}
}
示例9: viewtopic_modify_sql
/**
* Reduce the set of elements to the one that we need to retrieve.
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_sql($event)
{
if ($this->request->is_ajax() && $this->request->is_set('qr_captcha_refresh')) {
if ($this->config['enable_post_confirm']) {
$this->helper->set_captcha(false);
}
$json_response = new \phpbb\json_response();
$json_response->send(array('captcha_refreshed' => true, 'captcha_result' => $this->template->assign_display('@boardtools_quickreply/quickreply_captcha_template.html', '', true)));
}
$post_list = $event['post_list'];
$current_post = $this->request->variable('qr_cur_post_id', 0);
if ($this->request->is_ajax() && $this->request->variable('qr_no_refresh', 0) && in_array($current_post, $post_list)) {
$sql_ary = $event['sql_ary'];
$qr_get_current = $this->request->is_set('qr_get_current');
$compare = $qr_get_current ? ' >= ' : ' > ';
$sql_ary['WHERE'] .= ' AND p.post_id' . $compare . $current_post;
$event['sql_ary'] = $sql_ary;
$this->helper->qr_insert = true;
$this->helper->qr_first = $current_post == min($post_list) && $qr_get_current;
// Check whether no posts are found.
if ($compare == ' > ' && max($post_list) <= $current_post) {
$json_response = new \phpbb\json_response();
$json_response->send(array('error' => true, 'MESSAGE_TITLE' => $this->user->lang['INFORMATION'], 'MESSAGE_TEXT' => $this->user->lang['NO_POSTS_TIME_FRAME']));
}
}
$this->user->add_lang_ext('boardtools/quickreply', 'quickreply');
}
示例10: _get_form
/**
* Get the html form
*
* @param array $block_data
* @return string
*/
private function _get_form(array $block_data)
{
$selected_groups = $this->_ensure_array($block_data['permission']);
$this->template->assign_vars(array('S_ACTIVE' => $block_data['status'], 'S_TYPE' => $block_data['type'], 'S_NO_WRAP' => $block_data['no_wrap'], 'S_HIDE_TITLE' => $block_data['hide_title'], 'S_BLOCK_CLASS' => trim($block_data['class']), 'S_GROUP_OPS' => $this->groups->get_options('special', $selected_groups)));
$this->template->set_filenames(array('block_settings' => 'block_settings.html'));
return $this->template->assign_display('block_settings');
}
示例11: process_field_row
/**
* Return templated value/field. Possible values for $mode are:
* change == user is able to set/enter profile values; preview == just show the value
*/
public function process_field_row($mode, $profile_row)
{
$preview_options = $mode == 'preview' ? $profile_row['lang_options'] : false;
// set template filename
$this->template->set_filenames(array('cp_body' => $this->get_template_filename()));
// empty previously filled blockvars
$this->template->destroy_block_vars($this->get_name_short());
// Assign template variables
$this->generate_field($profile_row, $preview_options);
return $this->template->assign_display('cp_body');
}
示例12: run_automod_test
/**
* Run AutoMOD test.
*
* @param \phpbb\titania\entity\package $package
* @param string $phpbb_path Path to phpBB files we run the test on
* @param string $details Will hold the details of the mod
* @param string $results Will hold the results for output
* @param string $bbcode_results Will hold the results for storage
* @return bool true on success, false on failure
*/
public function run_automod_test($package, $phpbb_path, &$details, &$results, &$bbcode_results)
{
require $this->phpbb_root_path . 'includes/functions_transfer.' . $this->php_ext;
require $this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext;
require $this->ext_root_path . 'includes/library/automod/acp_mods.' . $this->php_ext;
require $this->ext_root_path . 'includes/library/automod/editor.' . $this->php_ext;
require $this->ext_root_path . 'includes/library/automod/mod_parser.' . $this->php_ext;
require $this->ext_root_path . 'includes/library/automod/functions_mods.' . $this->php_ext;
$this->user->add_lang_ext('phpbb/titania', 'automod');
// Find the main modx file
$modx_root = $package->find_directory(array('files' => array('required' => 'install*.xml')));
if ($modx_root === null) {
$this->user->add_lang_ext('phpbb/titania', 'contributions');
$this->errors[] = $this->user->lang['COULD_NOT_FIND_ROOT'];
return false;
}
$modx_root = $package->get_temp_path() . '/' . $modx_root . '/';
$modx_file = false;
if (file_exists($modx_root . 'install.xml')) {
$modx_file = $modx_root . 'install.xml';
} else {
$finder = new \Symfony\Component\Finder\Finder();
$finder->name('install*.xml')->depth(0)->in($modx_root);
if ($finder->count()) {
foreach ($finder as $file) {
$modx_file = $file->getPathname();
break;
}
}
}
if (!$modx_file) {
$this->user->add_lang_ext('phpbb/titania', 'contributions');
$this->errors[] = $this->user->lang['COULD_NOT_FIND_ROOT'];
return false;
}
// HAX
global $phpbb_root_path;
$phpbb_root_path = $phpbb_path;
// The real stuff
$acp_mods = new \acp_mods();
$acp_mods->mods_dir = $this->ext_config->__get('contrib_temp_path');
$acp_mods->mod_root = $modx_root;
$editor = new \editor_direct();
$details = $acp_mods->mod_details($modx_file, false);
$actions = $acp_mods->mod_actions($modx_file);
$installed = $acp_mods->process_edits($editor, $actions, $details, false, true, false);
// Reverse HAX
$phpbb_root_path = $this->phpbb_root_path;
$this->template->set_filenames(array('automod' => 'contributions/automod.html', 'automod_bbcode' => 'contributions/automod_bbcode.html'));
$this->template->assign_var('S_AUTOMOD_SUCCESS', $installed);
$results = $this->template->assign_display('automod');
$bbcode_results = $this->template->assign_display('automod_bbcode');
return $installed;
}
示例13: on_kernel_exception
/**
* This listener is run when the KernelEvents::EXCEPTION event is triggered
*
* @param GetResponseForExceptionEvent $event
* @return null
*/
public function on_kernel_exception(GetResponseForExceptionEvent $event)
{
page_header($this->user->lang('INFORMATION'));
$exception = $event->getException();
$this->template->assign_vars(array(
'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
'MESSAGE_TEXT' => $exception->getMessage(),
));
$this->template->set_filenames(array(
'body' => 'message_body.html',
));
page_footer(true, false, false);
$status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500;
$response = new Response($this->template->assign_display('body'), $status_code);
$event->setResponse($response);
}
示例14: render_update_file_status
/**
* {@inheritdoc}
*/
public function render_update_file_status($status_array)
{
$this->template->assign_vars(array('T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . 'adm/images/'));
foreach ($status_array as $block => $list) {
foreach ($list as $filename) {
$dirname = dirname($filename);
$this->template->assign_block_vars($block, array('STATUS' => $block, 'FILENAME' => $filename, 'DIR_PART' => !empty($dirname) && $dirname !== '.' ? dirname($filename) . '/' : false, 'FILE_PART' => basename($filename)));
}
}
$this->template->set_filenames(array('file_status' => 'installer_update_file_status.html'));
$this->file_status = $this->template->assign_display('file_status');
}
示例15: render
/**
* Automate setting up the page and creating the response object.
*
* @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param bool $selected_language True to enable language selector it, false otherwise
* @param int $status_code The status code to be sent to the page header
*
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $selected_language = false, $status_code = 200)
{
$this->page_header($page_title, $selected_language);
$this->template->set_filenames(array('body' => $template_file));
$response = new Response($this->template->assign_display('body'), $status_code);
// Set language cookie
if ($this->language_cookie !== false) {
$cookie = new Cookie('lang', $this->language_cookie, time() + 3600);
$response->headers->setCookie($cookie);
$this->language_cookie = false;
}
return $response;
}