当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils::generate_avatar_markup方法代码示例

本文整理汇总了PHP中FeatherBB\Core\Utils::generate_avatar_markup方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::generate_avatar_markup方法的具体用法?PHP Utils::generate_avatar_markup怎么用?PHP Utils::generate_avatar_markup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatherBB\Core\Utils的用法示例。


在下文中一共展示了Utils::generate_avatar_markup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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&amp;user_id=' . $user['id'] . '">' . __('Show topics') . '</a>';
             $quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_user_posts&amp;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&amp;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;
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:96,代码来源:Profile.php

示例2: print_posts

 public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
 {
     $post_data = array();
     $post_data = Container::get('hooks')->fire('model.topic.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(User::get()->disp_topics)->offset($start_from);
     $result = Container::get('hooks')->fireDB('model.topic.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 ' . ForumSettings::get('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 = Container::get('hooks')->fireDB('model.topic.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 (User::get()->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 (ForumSettings::get('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 (ForumSettings::get('o_avatars') == '1' && User::get()->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 (ForumSettings::get('o_show_user_info') == '1') {
                 if ($cur_post['location'] != '') {
                     if (ForumSettings::get('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') . ' ' . Utils::format_time($cur_post['registered'], true) . '</span></dd>';
                 if (ForumSettings::get('o_show_post_count') == '1' || User::get()->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' && !User::get()->is_guest || User::get()->is_admmod) && User::get()->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' && !User::get()->is_guest && User::get()->g_send_email == '1') {
                     $cur_post['user_contacts'][] = '<span class="email"><a href="' . Router::pathFor('email', ['id' => $cur_post['poster_id']]) . '">' . __('Email') . '</a></span>';
                 }
                 if ($cur_post['url'] != '') {
                     if (ForumSettings::get('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 (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->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 (User::get()->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['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 (User::get()->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>';
             }
             if (ForumSettings::get('o_show_user_info') == '1' && $cur_post['poster_email'] != '' && !User::get()->is_guest && User::get()->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 (!User::get()->is_guest) {
                 $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . Router::pathFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>';
//.........这里部分代码省略.........
开发者ID:featherbb,项目名称:featherbb,代码行数:101,代码来源:Topic.php

示例3: display

 public function display($id, $section = null)
 {
     global $forum_time_formats, $forum_date_formats;
     // Include UTF-8 function
     require $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/Helpers/utf8/substr_replace.php';
     require $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/Helpers/utf8/ucwords.php';
     // utf8_ucwords needs utf8_substr_replace
     require $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/Helpers/utf8/strcasecmp.php';
     if ($this->request->post('update_group_membership')) {
         if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->update_group_membership($id, $this->feather);
     } elseif ($this->request->post('update_forums')) {
         if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->update_mod_forums($id, $this->feather);
     } elseif ($this->request->post('ban')) {
         if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->ban_user($id);
     } elseif ($this->request->post('delete_user') || $this->request->post('delete_user_comply')) {
         if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->delete_user($id, $this->feather);
         $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Confirm delete user')), 'active_page' => 'profile', 'username' => $this->model->get_username($id), 'id' => $id));
         $this->feather->template->addTemplate('profile/delete_user.php');
         $this->feather->template->display();
     } elseif ($this->request->post('form_sent')) {
         // Fetch the user group of the user we are editing
         $info = $this->model->fetch_user_group($id);
         if ($this->user->id != $id && (!$this->user->is_admmod || $this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_mod_edit_users == '0' || $info['group_id'] == $this->feather->forum_env['FEATHER_ADMIN'] || $info['is_moderator']))) {
             // or the user is another mod
             throw new Error(__('No permission'), 403);
         }
         $this->model->update_profile($id, $info, $section, $this->feather);
     }
     $user = $this->model->get_user_info($id);
     if ($user['signature'] != '') {
         $parsed_signature = $this->feather->parser->parse_signature($user['signature']);
     }
     // View or edit?
     if ($this->user->id != $id && (!$this->user->is_admmod || $this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_mod_edit_users == '0' || $user['g_id'] == $this->feather->forum_env['FEATHER_ADMIN'] || $user['g_moderator'] == '1'))) {
         // or the user is another mod
         $user_info = $this->model->parse_user_info($user);
         $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), sprintf(__('Users profile'), Utils::escape($user['username']))), 'active_page' => 'profile', 'user_info' => $user_info, 'id' => $id));
         $this->feather->template->addTemplate('profile/view_profile.php')->display();
     } else {
         if (!$section || $section == 'essentials') {
             $user_disp = $this->model->edit_essentials($id, $user);
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section essentials')), 'required_fields' => array('req_username' => __('Username'), 'req_email' => __('Email')), 'active_page' => 'profile', 'id' => $id, 'page' => 'essentials', 'user' => $user, 'user_disp' => $user_disp, 'forum_time_formats' => $forum_time_formats, 'forum_date_formats' => $forum_date_formats));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_essentials.php')->display();
         } elseif ($section == 'personal') {
             if ($this->user->g_set_title == '1') {
                 $title_field = '<label>' . __('Title') . ' <em>(' . __('Leave blank') . ')</em><br /><input type="text" name="title" value="' . Utils::escape($user['title']) . '" size="30" maxlength="50" /><br /></label>' . "\n";
             }
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section personal')), 'active_page' => 'profile', 'id' => $id, 'page' => 'personal', 'user' => $user, 'title_field' => $title_field));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_personal.php')->display();
         } elseif ($section == 'messaging') {
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section messaging')), 'active_page' => 'profile', 'page' => 'messaging', 'user' => $user, 'id' => $id));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_messaging.php')->display();
         } elseif ($section == 'personality') {
             if ($this->config['o_avatars'] == '0' && $this->config['o_signatures'] == '0') {
                 throw new Error(__('Bad request'), 404);
             }
             $avatar_field = '<span><a href="' . $this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'upload_avatar']) . '">' . __('Change avatar') . '</a></span>';
             $user_avatar = Utils::generate_avatar_markup($id);
             if ($user_avatar) {
                 $avatar_field .= ' <span><a href="' . $this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'delete_avatar']) . '">' . __('Delete avatar') . '</a></span>';
             } else {
                 $avatar_field = '<span><a href="' . $this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'upload_avatar']) . '">' . __('Upload avatar') . '</a></span>';
             }
             if ($user['signature'] != '') {
                 $signature_preview = '<p>' . __('Sig preview') . '</p>' . "\n\t\t\t\t\t\t\t" . '<div class="postsignature postmsg">' . "\n\t\t\t\t\t\t\t\t" . '<hr />' . "\n\t\t\t\t\t\t\t\t" . $parsed_signature . "\n\t\t\t\t\t\t\t" . '</div>' . "\n";
             } else {
                 $signature_preview = '<p>' . __('No sig') . '</p>' . "\n";
             }
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section personality')), 'active_page' => 'profile', 'user_avatar' => $user_avatar, 'avatar_field' => $avatar_field, 'signature_preview' => $signature_preview, 'page' => 'personality', 'user' => $user, 'id' => $id));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_personality.php')->display();
         } elseif ($section == 'display') {
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section display')), 'active_page' => 'profile', 'page' => 'display', 'user' => $user, 'id' => $id));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_display.php')->display();
         } elseif ($section == 'privacy') {
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section privacy')), 'active_page' => 'profile', 'page' => 'privacy', 'user' => $user, 'id' => $id));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_privacy.php')->display();
         } elseif ($section == 'admin') {
             if (!$this->user->is_admmod || $this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '0') {
                 throw new Error(__('Bad request'), 404);
             }
             $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Profile'), __('Section admin')), 'active_page' => 'profile', 'page' => 'admin', 'user' => $user, 'forum_list' => $this->model->get_forum_list($id), 'group_list' => $this->model->get_group_list($user), 'id' => $id));
             $this->feather->template->addTemplate('profile/menu.php', 5)->addTemplate('profile/section_admin.php')->display();
         } else {
             throw new Error(__('Bad request'), 404);
         }
     }
 }
开发者ID:bohwaz,项目名称:featherbb,代码行数:99,代码来源:Profile.php


注:本文中的FeatherBB\Core\Utils::generate_avatar_markup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。