本文整理汇总了PHP中phpbb\event\dispatcher_interface::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP dispatcher_interface::dispatch方法的具体用法?PHP dispatcher_interface::dispatch怎么用?PHP dispatcher_interface::dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\event\dispatcher_interface
的用法示例。
在下文中一共展示了dispatcher_interface::dispatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_page
/**
* Renders data for a page
*
* @param $page The page we are rendering for, one of index|custom|archive
*/
protected function render_page($page)
{
// Add lang file
$this->user->add_lang('posting');
// If the static message is defined in the language file use it, else the entry in the database is used
if (isset($this->user->lang['STATIC_MESSAGE'])) {
$this->config['mchat_static_message'] = $this->user->lang('STATIC_MESSAGE');
}
$this->template->assign_vars(array('MCHAT_FILE_NAME' => $this->helper->route('dmzx_mchat_controller'), 'MCHAT_REFRESH_JS' => 1000 * $this->config['mchat_refresh'], 'MCHAT_INPUT_TYPE' => $this->user->data['user_mchat_input_area'], 'MCHAT_RULES' => !empty($this->user->lang['MCHAT_RULES']) || !empty($this->config['mchat_rules']), 'MCHAT_ALLOW_USE' => $this->auth->acl_get('u_mchat_use'), 'MCHAT_ALLOW_SMILES' => $this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies'), 'MCHAT_ALLOW_BBCODES' => $this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode'), 'MCHAT_MESSAGE_TOP' => $this->config['mchat_message_top'], 'MCHAT_ARCHIVE_URL' => $this->helper->route('dmzx_mchat_page_controller', array('page' => 'archive')), 'MCHAT_INDEX_HEIGHT' => $this->config['mchat_index_height'], 'MCHAT_CUSTOM_HEIGHT' => $this->config['mchat_custom_height'], 'MCHAT_READ_ARCHIVE_BUTTON' => $this->auth->acl_get('u_mchat_archive'), 'MCHAT_FOUNDER' => $this->user->data['user_type'] == USER_FOUNDER, 'MCHAT_STATIC_MESS' => !empty($this->config['mchat_static_message']) ? htmlspecialchars_decode($this->config['mchat_static_message']) : '', 'L_MCHAT_COPYRIGHT' => base64_decode('PGEgaHJlZj0iaHR0cHM6Ly9lbnRyb3B5LmZpL2tlc2t1c3RlbHUvbWVtYmVybGlzdC5waHA/bW9kZT12aWV3cHJvZmlsZSZ1PTI5MiI+VGhlSDwvYT4gJmNvcHk7IDxhIGhyZWY9Imh0dHA6Ly9ybWNnaXJyODMub3JnIj5STWNHaXJyODM8L2E+ICZjb3B5OyA8YSBocmVmPSJodHRwOi8vd3d3LmRtengtd2ViLm5ldCIgdGl0bGU9Ind3dy5kbXp4LXdlYi5uZXQiPmRteng8L2E+'), 'MCHAT_MESSAGE_LNGTH' => $this->config['mchat_max_message_lngth'], 'MCHAT_MESS_LONG' => sprintf($this->user->lang('MCHAT_MESS_LONG'), $this->config['mchat_max_message_lngth']), 'MCHAT_USER_TIMEOUT_TIME' => gmdate('H:i:s', (int) $this->config['mchat_timeout']), 'MCHAT_WHOIS_REFRESH' => $this->config['mchat_whois'] ? 1000 * $this->config['mchat_whois_refresh'] : 0, 'MCHAT_WHOIS_REFRESH_EXPLAIN' => sprintf($this->user->lang('WHO_IS_REFRESH_EXPLAIN'), $this->config['mchat_whois_refresh']), 'MCHAT_PAUSE_ON_INPUT' => $this->config['mchat_pause_on_input'], 'MCHAT_REFRESH_YES' => sprintf($this->user->lang('MCHAT_REFRESH_YES'), $this->config['mchat_refresh']), 'MCHAT_LIVE_UPDATES' => $this->config['mchat_live_updates'], 'S_MCHAT_LOCATION' => $this->config['mchat_location'], 'S_MCHAT_SOUND_YES' => $this->user->data['user_mchat_sound'], 'U_MORE_SMILIES' => generate_board_url() . append_sid("/{$this->root_path}/posting.{$this->php_ext}", 'mode=smilies'), 'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_page_controller', array('page' => 'rules')), 'S_MCHAT_ON_INDEX' => $this->config['mchat_on_index'] && !empty($this->user->data['user_mchat_index']), 'S_MCHAT_MOBILE_BEFORE' => $this->user->data['user_mchat_mobile_before'], 'S_MCHAT_TITLEFLASHDURATION' => $this->user->data['user_mchat_titleflash_duration'], 'S_MCHAT_FOLLOW' => $this->user->data['user_mchat_follow'], 'S_MCHAT_ON_VIEWTOPIC' => $this->config['mchat_on_viewtopic'], 'S_MCHAT_ON_VIEWFORUM' => $this->config['mchat_on_viewforum'], 'S_MCHAT_SIMPLE_MSG' => $this->config['mchat_simple_msg']));
$sql_where = $this->user->data['user_mchat_topics'] ? '' : 'm.forum_id = 0';
$limit = $page == 'archive' ? $this->config['mchat_archive_limit'] : $this->config[$page == 'index' ? 'mchat_message_num' : 'mchat_message_limit'];
$start = $page == 'archive' ? $this->request->variable('start', 0) : 0;
$rows = $this->functions_mchat->mchat_get_messages($sql_where, $limit, $start);
$this->assign_global_template_data();
$this->assign_messages($rows);
// Render pagination
if ($page == 'archive') {
$archive_url = $this->helper->route('dmzx_mchat_page_controller', array('page' => 'archive'));
$total_messages = $this->functions_mchat->mchat_total_message_count();
$this->pagination->generate_template_pagination($archive_url, 'pagination', 'start', $total_messages, $limit, $start);
$this->template->assign_var('MCHAT_TOTAL_MESSAGES', sprintf($this->user->lang('MCHAT_TOTALMESSAGES'), $total_messages));
}
// Render legend
if ($page != 'index' && $this->config['mchat_whois']) {
$legend = $this->functions_mchat->mchat_legend();
$this->template->assign_var('LEGEND', implode(', ', $legend));
}
if ($this->auth->acl_get('u_mchat_use')) {
add_form_key('mchat');
}
$this->is_mchat_rendered = true;
/**
* Event render_helper_aft
*
* @event dmzx.mchat.core.render_helper_aft
* @since 0.1.2
*/
$this->dispatcher->dispatch('dmzx.mchat.core.render_helper_aft');
}