本文整理汇总了PHP中FeatherBB\Core\Utils::get_title方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::get_title方法的具体用法?PHP Utils::get_title怎么用?PHP Utils::get_title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatherBB\Core\Utils
的用法示例。
在下文中一共展示了Utils::get_title方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
_e('Registered');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($userlist_data as $user) {
?>
<tr>
<td class="tcl"><?php
echo '<a href="' . $feather->urlFor('userProfile', ['id' => $user['id']]) . '">' . Utils::escape($user['username']) . '</a>';
?>
</td>
<td class="tc2"><?php
echo Utils::get_title($user);
?>
</td>
<?php
if ($show_post_count) {
?>
<td class="tc3"><?php
echo Utils::forum_number_format($user['num_posts']);
?>
</td>
<?php
}
?>
<td class="tcr"><?php
echo $feather->utils->format_time($user['registered'], true);
?>
示例2: display_posts_view
public function display_posts_view($tid, $start_from)
{
$this->hook->fire('display_posts_view_start', $tid, $start_from);
$post_data = array();
$post_count = 0;
// Keep track of post numbers
// Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
$find_ids = DB::for_table('posts')->select('id')->where('topic_id', $tid)->order_by('id')->limit($this->user->disp_posts)->offset($start_from);
$find_ids = $this->hook->fireDB('display_posts_view_find_ids', $find_ids);
$find_ids = $find_ids->find_many();
foreach ($find_ids as $id) {
$post_ids[] = $id['id'];
}
// Retrieve the posts (and their respective poster)
$result['select'] = array('u.title', 'u.num_posts', 'g.g_id', 'g.g_user_title', 'p.id', 'p.poster', 'p.poster_id', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by');
$result = DB::for_table('posts')->table_alias('p')->select_many($result['select'])->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->where_in('p.id', $post_ids)->order_by('p.id');
$result = $this->hook->fireDB('display_posts_view_query', $result);
$result = $result->find_many();
foreach ($result as $cur_post) {
$post_count++;
// If the poster is a registered user
if ($cur_post->poster_id > 1) {
if ($this->user->g_view_users == '1') {
$cur_post->poster_disp = '<a href="' . $this->feather->urlFor('userProfile', ['id' => $cur_post->poster_id]) . '">' . Utils::escape($cur_post->poster) . '</a>';
} else {
$cur_post->poster_disp = Utils::escape($cur_post->poster);
}
// Utils::get_title() requires that an element 'username' be present in the array
$cur_post->username = $cur_post->poster;
$cur_post->user_title = Utils::get_title($cur_post);
if ($this->config['o_censoring'] == '1') {
$cur_post->user_title = Utils::censor($cur_post->user_title);
}
} else {
$cur_post->poster_disp = Utils::escape($cur_post->poster);
$cur_post->user_title = __('Guest');
}
// Perform the main parsing of the message (BBCode, smilies, censor words etc)
$cur_post->message = $this->feather->parser->parse_message($cur_post->message, $cur_post->hide_smilies);
$post_data[] = $cur_post;
}
$post_data = $this->hook->fire('display_posts_view', $post_data);
return $post_data;
}
示例3: parse_user_info
public function parse_user_info($user)
{
$user_info = array();
$user_info = Container::get('hooks')->fire('model.profile.parse_user_info_start', $user_info, $user);
$user_info['personal'][] = '<dt>' . __('Username') . '</dt>';
$user_info['personal'][] = '<dd>' . Utils::escape($user['username']) . '</dd>';
$user_title_field = Utils::get_title($user);
$user_info['personal'][] = '<dt>' . __('Title') . '</dt>';
$user_info['personal'][] = '<dd>' . (ForumSettings::get('o_censoring') == '1' ? Utils::censor($user_title_field) : $user_title_field) . '</dd>';
if ($user['realname'] != '') {
$user_info['personal'][] = '<dt>' . __('Realname') . '</dt>';
$user_info['personal'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['realname']) : $user['realname']) . '</dd>';
}
if ($user['location'] != '') {
$user_info['personal'][] = '<dt>' . __('Location') . '</dt>';
$user_info['personal'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['location']) : $user['location']) . '</dd>';
}
if ($user['url'] != '') {
$user['url'] = Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['url']) : $user['url']);
$user_info['personal'][] = '<dt>' . __('Website') . '</dt>';
$user_info['personal'][] = '<dd><span class="website"><a href="' . $user['url'] . '" rel="nofollow">' . $user['url'] . '</a></span></dd>';
}
if ($user['email_setting'] == '0' && !User::get()->is_guest && User::get()->g_send_email == '1') {
$user['email_field'] = '<a href="mailto:' . Utils::escape($user['email']) . '">' . Utils::escape($user['email']) . '</a>';
} elseif ($user['email_setting'] == '1' && !User::get()->is_guest && User::get()->g_send_email == '1') {
$user['email_field'] = '<a href="' . Router::pathFor('email', ['id' => $user['id']]) . '">' . __('Send email') . '</a>';
} else {
$user['email_field'] = '';
}
if ($user['email_field'] != '') {
$user_info['personal'][] = '<dt>' . __('Email') . '</dt>';
$user_info['personal'][] = '<dd><span class="email">' . $user['email_field'] . '</span></dd>';
}
if ($user['jabber'] != '') {
$user_info['messaging'][] = '<dt>' . __('Jabber') . '</dt>';
$user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['jabber']) : $user['jabber']) . '</dd>';
}
if ($user['icq'] != '') {
$user_info['messaging'][] = '<dt>' . __('ICQ') . '</dt>';
$user_info['messaging'][] = '<dd>' . $user['icq'] . '</dd>';
}
if ($user['msn'] != '') {
$user_info['messaging'][] = '<dt>' . __('MSN') . '</dt>';
$user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['msn']) : $user['msn']) . '</dd>';
}
if ($user['aim'] != '') {
$user_info['messaging'][] = '<dt>' . __('AOL IM') . '</dt>';
$user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['aim']) : $user['aim']) . '</dd>';
}
if ($user['yahoo'] != '') {
$user_info['messaging'][] = '<dt>' . __('Yahoo') . '</dt>';
$user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['yahoo']) : $user['yahoo']) . '</dd>';
}
if (ForumSettings::get('o_avatars') == '1') {
$avatar_field = Utils::generate_avatar_markup($user['id']);
if ($avatar_field != '') {
$user_info['personality'][] = '<dt>' . __('Avatar') . '</dt>';
$user_info['personality'][] = '<dd>' . $avatar_field . '</dd>';
}
}
if (ForumSettings::get('o_signatures') == '1') {
if (isset($parsed_signature)) {
$user_info['personality'][] = '<dt>' . __('Signature') . '</dt>';
$user_info['personality'][] = '<dd><div class="postsignature postmsg">' . $parsed_signature . '</div></dd>';
}
}
$posts_field = '';
if (ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod) {
$posts_field = Utils::forum_number_format($user['num_posts']);
}
if (User::get()->g_search == '1') {
$quick_searches = array();
if ($user['num_posts'] > 0) {
$quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_user_topics&user_id=' . $user['id'] . '">' . __('Show topics') . '</a>';
$quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_user_posts&user_id=' . $user['id'] . '">' . __('Show posts') . '</a>';
}
if (User::get()->is_admmod && ForumSettings::get('o_topic_subscriptions') == '1') {
$quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_subscriptions&user_id=' . $user['id'] . '">' . __('Show subscriptions') . '</a>';
}
if (!empty($quick_searches)) {
$posts_field .= ($posts_field != '' ? ' - ' : '') . implode(' - ', $quick_searches);
}
}
if ($posts_field != '') {
$user_info['activity'][] = '<dt>' . __('Posts') . '</dt>';
$user_info['activity'][] = '<dd>' . $posts_field . '</dd>';
}
if ($user['num_posts'] > 0) {
$user_info['activity'][] = '<dt>' . __('Last post') . '</dt>';
$user_info['activity'][] = '<dd>' . Utils::format_time($user['last_post']) . '</dd>';
}
$user_info['activity'][] = '<dt>' . __('Registered') . '</dt>';
$user_info['activity'][] = '<dd>' . Utils::format_time($user['registered'], true) . '</dd>';
$user_info = Container::get('hooks')->fire('model.profile.parse_user_info', $user_info);
return $user_info;
}
示例4: print_posts
public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
{
$post_data = array();
$post_data = $this->hook->fire('print_posts_start', $post_data, $topic_id, $start_from, $cur_topic, $is_admmod);
$post_count = 0;
// Keep track of post numbers
// Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
$result = DB::for_table('posts')->select('id')->where('topic_id', $topic_id)->order_by('id')->limit($this->user->disp_topics)->offset($start_from);
$result = $this->hook->fireDB('print_posts_ids_query', $result);
$result = $result->find_many();
$post_ids = array();
foreach ($result as $cur_post_id) {
$post_ids[] = $cur_post_id['id'];
}
if (empty($post_ids)) {
throw new Error('The post table and topic table seem to be out of sync!', 500);
}
// Retrieve the posts (and their respective poster/online status)
$result['select'] = array('u.email', 'u.title', 'u.url', 'u.location', 'u.signature', 'u.email_setting', 'u.num_posts', 'u.registered', 'u.admin_note', 'p.id', 'username' => 'p.poster', 'p.poster_id', 'p.poster_ip', 'p.poster_email', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by', 'g.g_id', 'g.g_user_title', 'g.g_promote_next_group', 'is_online' => 'o.user_id');
$result = DB::for_table('posts')->table_alias('p')->select_many($result['select'])->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->raw_join('LEFT OUTER JOIN ' . $this->feather->forum_settings['db_prefix'] . 'online', "o.user_id!=1 AND o.idle=0 AND o.user_id=u.id", 'o')->where_in('p.id', $post_ids)->order_by('p.id');
$result = $this->hook->fireDB('print_posts_query', $result);
$result = $result->find_array();
foreach ($result as $cur_post) {
$post_count++;
$cur_post['user_avatar'] = '';
$cur_post['user_info'] = array();
$cur_post['user_contacts'] = array();
$cur_post['post_actions'] = array();
$cur_post['is_online_formatted'] = '';
$cur_post['signature_formatted'] = '';
// If the poster is a registered user
if ($cur_post['poster_id'] > 1) {
if ($this->user->g_view_users == '1') {
$cur_post['username_formatted'] = '<a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/">' . Utils::escape($cur_post['username']) . '</a>';
} else {
$cur_post['username_formatted'] = Utils::escape($cur_post['username']);
}
$cur_post['user_title_formatted'] = Utils::get_title($cur_post);
if ($this->config['o_censoring'] == '1') {
$cur_post['user_title_formatted'] = Utils::censor($cur_post['user_title_formatted']);
}
// Format the online indicator
$cur_post['is_online_formatted'] = $cur_post['is_online'] == $cur_post['poster_id'] ? '<strong>' . __('Online') . '</strong>' : '<span>' . __('Offline') . '</span>';
if ($this->config['o_avatars'] == '1' && $this->user->show_avatars != '0') {
if (isset($avatar_cache[$cur_post['poster_id']])) {
$cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']];
} else {
$cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']] = Utils::generate_avatar_markup($cur_post['poster_id']);
}
}
// We only show location, register date, post count and the contact links if "Show user info" is enabled
if ($this->config['o_show_user_info'] == '1') {
if ($cur_post['location'] != '') {
if ($this->config['o_censoring'] == '1') {
$cur_post['location'] = Utils::censor($cur_post['location']);
}
$cur_post['user_info'][] = '<dd><span>' . __('From') . ' ' . Utils::escape($cur_post['location']) . '</span></dd>';
}
$cur_post['user_info'][] = '<dd><span>' . __('Registered topic') . ' ' . $this->feather->utils->format_time($cur_post['registered'], true) . '</span></dd>';
if ($this->config['o_show_post_count'] == '1' || $this->user->is_admmod) {
$cur_post['user_info'][] = '<dd><span>' . __('Posts topic') . ' ' . Utils::forum_number_format($cur_post['num_posts']) . '</span></dd>';
}
// Now let's deal with the contact links (Email and URL)
if (($cur_post['email_setting'] == '0' && !$this->user->is_guest || $this->user->is_admmod) && $this->user->g_send_email == '1') {
$cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['email']) . '">' . __('Email') . '</a></span>';
} elseif ($cur_post['email_setting'] == '1' && !$this->user->is_guest && $this->user->g_send_email == '1') {
$cur_post['user_contacts'][] = '<span class="email"><a href="' . $this->feather->urlFor('email', ['id' => $cur_post['poster_id']]) . '">' . __('Email') . '</a></span>';
}
if ($cur_post['url'] != '') {
if ($this->config['o_censoring'] == '1') {
$cur_post['url'] = Utils::censor($cur_post['url']);
}
$cur_post['user_contacts'][] = '<span class="website"><a href="' . Utils::escape($cur_post['url']) . '" rel="nofollow">' . __('Website') . '</a></span>';
}
}
if ($this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || $this->user->g_moderator == '1' && $this->user->g_mod_promote_users == '1') {
if ($cur_post['g_promote_next_group']) {
$cur_post['user_info'][] = '<dd><span><a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/action/promote/pid/' . $cur_post['id'] . '">' . __('Promote user') . '</a></span></dd>';
}
}
if ($this->user->is_admmod) {
$cur_post['user_info'][] = '<dd><span><a href="' . $this->feather->urlFor('getHostPost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>';
if ($cur_post['admin_note'] != '') {
$cur_post['user_info'][] = '<dd><span>' . __('Note') . ' <strong>' . Utils::escape($cur_post['admin_note']) . '</strong></span></dd>';
}
}
} else {
$cur_post['username_formatted'] = Utils::escape($cur_post['username']);
$cur_post['user_title_formatted'] = Utils::get_title($cur_post);
if ($this->user->is_admmod) {
$cur_post['user_info'][] = '<dd><span><a href="' . $this->feather->urlFor('getHostPost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>';
}
if ($this->config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$this->user->is_guest && $this->user->g_send_email == '1') {
$cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['poster_email']) . '">' . __('Email') . '</a></span>';
}
}
// Generation post action array (quote, edit, delete etc.)
if (!$is_admmod) {
if (!$this->user->is_guest) {
$cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . $this->feather->urlFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>';
//.........这里部分代码省略.........
示例5:
?>
</h2>
<div class="box">
<div class="inbox">
<div class="postbody">
<div class="postleft">
<dl>
<dt><strong><a href="<?php
echo Router::pathFor('userProfile', ['id' => $message['poster_id']]);
?>
"><span><?php
echo Utils::escape($message['username']);
?>
</span></a></strong></dt>
<dd class="usertitle"><strong><?php
echo Utils::get_title($message);
?>
</strong></dd>
</dl>
</div>
<div class="postright">
<h3><?php
if ($message['id'] != $cur_conv['first_post_id']) {
_e('Re') . ' ';
}
?>
<?php
echo Utils::escape($cur_conv['subject']);
?>
</h3>
<div class="postmsg">
示例6:
if (isset($info['user_data'][$cur_poster['poster_id']])) {
?>
<tr>
<td class="tcl"><?php
echo '<a href="' . Router::pathFor('userProfile', ['id' => $info['user_data'][$cur_poster['poster_id']]['id']]) . '">' . Utils::escape($info['user_data'][$cur_poster['poster_id']]['username']) . '</a>';
?>
</td>
<td class="tc2"><a href="mailto:<?php
echo Utils::escape($info['user_data'][$cur_poster['poster_id']]['email']);
?>
"><?php
echo Utils::escape($info['user_data'][$cur_poster['poster_id']]['email']);
?>
</a></td>
<td class="tc3"><?php
echo Utils::get_title($info['user_data'][$cur_poster['poster_id']]);
?>
</td>
<td class="tc4"><?php
echo Utils::forum_number_format($info['user_data'][$cur_poster['poster_id']]['num_posts']);
?>
</td>
<td class="tc5"><?php
echo $info['user_data'][$cur_poster['poster_id']]['admin_note'] != '' ? Utils::escape($info['user_data'][$cur_poster['poster_id']]['admin_note']) : ' ';
?>
</td>
<td class="tcr"><?php
echo '<a href="' . Router::pathFor('usersIpStats', ['id' => $info['user_data'][$cur_poster['poster_id']]['id']]) . '">' . __('Results view IP link') . '</a> | <a href="' . Router::pathFor('search') . '?action=show_user_posts&user_id=' . $info['user_data'][$cur_poster['poster_id']]['id'] . '">' . __('Results show posts link') . '</a>';
?>
</td>
</tr>
示例7: print_users
public function print_users($conditions, $order_by, $direction, $start_from)
{
$user_data = array();
$select_print_users = array('u.id', 'u.username', 'u.email', 'u.title', 'u.num_posts', 'u.admin_note', 'g.g_id', 'g.g_user_title');
$result = DB::for_table('users')->table_alias('u')->select_many($select_print_users)->left_outer_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->where_raw('u.id>1' . (!empty($conditions) ? ' AND ' . implode(' AND ', $conditions) : ''))->offset($start_from)->limit(50)->order_by($order_by, $direction);
$result = $this->hook->fireDB('model.users.print_users.query', $result);
$result = $result->find_many();
if ($result) {
foreach ($result as $cur_user) {
$cur_user['user_title'] = Utils::get_title($cur_user);
// This script is a special case in that we want to display "Not verified" for non-verified users
if (($cur_user['g_id'] == '' || $cur_user['g_id'] == $this->feather->forum_env['FEATHER_UNVERIFIED']) && $cur_user['user_title'] != __('Banned')) {
$cur_user['user_title'] = '<span class="warntext">' . __('Not verified') . '</span>';
}
$user_data[] = $cur_user;
}
}
$user_data = $this->hook->fire('model.users.print_users.user_data', $user_data);
return $user_data;
}