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


PHP XenForo_Template_Helper_Core::helperUserTitle方法代码示例

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


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

示例1: actionGetPost

    public function actionGetPost()
    {
        // Whole function is an ugly hack.  Revisit later.
        global $dependencies, $zresponse;
        $postid = $this->_input->filterSingle('postid', XenForo_Input::UINT);
        $type = $this->_input->filterSingle('type', XenForo_Input::STRING);
        $signature = $this->_input->filterSingle('signature', XenForo_Input::UINT);
        if (!$type || $type == '') {
            $type = 'html';
        }
        $user_model = $this->getModelFromCache('XenForo_Model_User');
        $session_model = $this->getModelFromCache('XenForo_Model_Session');
        $thread_model = $this->getModelFromCache('XenForo_Model_Thread');
        $forum_model = $this->getModelFromCache('XenForo_Model_Forum');
        $attachment_model = $this->getModelFromCache('XenForo_Model_Attachment');
        $helper = $this->getHelper('ForumThreadPost');
        try {
            list($post, $thread, $forum) = $helper->assertPostValidAndViewable($postid);
        } catch (Exception $e) {
            json_error($e->getControllerResponse()->errorText->render());
        }
        $post_model = $this->_getPostModel();
        $post = $post_model->getPostById($postid, array('join' => XenForo_Model_Post::FETCH_THREAD | XenForo_Model_Post::FETCH_FORUM | XenForo_Model_Post::FETCH_USER | XenForo_Model_Post::FETCH_USER_PROFILE));
        $user = $user_model->getUserById($post['user_id']);
        $online_info = $session_model->getSessionActivityRecords(array('user_id' => $post['user_id'], 'cutOff' => array('>', $session_model->getOnlineStatusTimeout())));
        $is_online = false;
        if (count($online_info) == 1) {
            $is_online = true;
        }
        $avatarurl = '';
        if ($user !== false) {
            $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($user, 'm'));
            if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) {
                $avatarurl = '';
            }
        }
        $attachments = $attachment_model->getAttachmentsByContentId('post', $postid);
        $message = fr_strip_smilies($this, $post['message']);
        list($text, $nuked_quotes, $images) = parse_post($message, true, array());
        $image = '';
        if ($type == 'html') {
            $css = <<<EOF
<style type="text/css">
body {
  margin: 0;
  padding: 3;
  font: 13px Arial, Helvetica, sans-serif;
}
.alt2 {
  background-color: #e6edf5;
  font: 13px Arial, Helvetica, sans-serif;
}
html {
    -webkit-text-size-adjust: none;
}
</style>
EOF;
            $formatter = XenForo_BbCode_Formatter_Base::create('ForumRunner_BbCode_Formatter_BbCode_Post', array('smilies' => XenForo_Application::get('smilies')));
            $parser = new XenForo_BbCode_Parser($formatter);
            $html = $css . $parser->render($message);
            if ($signature && $post['signature']) {
                $html .= '<div style="border-top: 1px dashed grey; font-size: 9pt; margin-top: 5px; padding: 5px 0 0;">' . $parser->render(fr_strip_smilies($this, $post['signature'])) . '</div>';
            }
        } else {
            if ($type == 'facebook') {
                $html = XenForo_Helper_String::censorString(XenForo_Helper_String::bbCodeStrip($message, true));
                if (count($attachments)) {
                    $attachments = array_values($attachments);
                    $link = XenForo_Link::buildPublicLink('attachments', $attachments[0]);
                    $image = fr_get_xenforo_bburl() . '/' . $link;
                }
            }
        }
        $post_page = floor($post['position'] / XenForo_Application::get('options')->messagesPerPage) + 1;
        $out = array('post_id' => $post['post_id'], 'thread_id' => $post['thread_id'], 'forum_id' => $post['node_id'], 'forum_title' => prepare_utf8_string(strip_tags($post['node_title'])), 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string(XenForo_Locale::date($post['register_date'], 'absolute')), 'usertitle' => XenForo_Template_Helper_Core::helperUserTitle($user), 'numposts' => $user ? $user['message_count'] : 0, 'userid' => $post['user_id'], 'title' => prepare_utf8_string($post['title']), 'online' => $is_online, 'post_timestamp' => prepare_utf8_string(XenForo_Locale::dateTime($post['post_date'], 'absolute')), 'html' => prepare_utf8_string($html), 'quotable' => $nuked_quotes, 'canpost' => $thread_model->canReplyToThread($thread, $forum), 'canattach' => $forum_model->canUploadAndManageAttachment($forum), 'post_link' => fr_get_xenforo_bburl() . '/' . XenForo_Link::buildPublicLink('threads', $thread, array('page' => $post_page)) . '#post-' . $post['post_id']);
        if ($image != '') {
            $out['image'] = $image;
        }
        if ($avatarurl != '') {
            $out['avatarurl'] = $avatarurl;
        }
        return $out;
    }
开发者ID:Sywooch,项目名称:forums,代码行数:83,代码来源:Post.php

示例2: prepareApiDataForUser

 public function prepareApiDataForUser(array $user)
 {
     $visitor = XenForo_Visitor::getInstance();
     $session = bdApi_Data_Helper_Core::safeGetSession();
     /* @var $userGroupModel bdApi_XenForo_Model_UserGroup */
     $userGroupModel = $this->getModelFromCache('XenForo_Model_UserGroup');
     /* @var $conversationModel XenForo_Model_Conversation */
     $conversationModel = $this->getModelFromCache('XenForo_Model_Conversation');
     $hasAdminScope = !empty($session) && $session->checkScope(bdApi_Model_OAuth2::SCOPE_MANAGE_SYSTEM);
     $isAdminRequest = $hasAdminScope && $visitor->hasAdminPermission('user');
     $prepareProtectedData = $user['user_id'] == $visitor->get('user_id') || $isAdminRequest;
     $publicKeys = array('user_id' => 'user_id', 'username' => 'username', 'message_count' => 'user_message_count', 'register_date' => 'user_register_date', 'like_count' => 'user_like_count');
     if ($prepareProtectedData) {
         $publicKeys = array_merge($publicKeys, array('email' => 'user_email', 'alerts_unread' => 'user_unread_notification_count', 'dob_day' => 'user_dob_day', 'dob_month' => 'user_dob_month', 'dob_year' => 'user_dob_year'));
         if (!empty($session) and $session->checkScope(bdApi_Model_OAuth2::SCOPE_PARTICIPATE_IN_CONVERSATIONS)) {
             // xf_user
             $publicKeys['conversations_unread'] = 'user_unread_conversation_count';
         }
     }
     $data = bdApi_Data_Helper_Core::filter($user, $publicKeys);
     $data['user_title'] = XenForo_Template_Helper_Core::helperUserTitle($user);
     if (isset($user['user_state']) and isset($user['is_banned'])) {
         if (!empty($user['is_banned'])) {
             $data['user_is_valid'] = false;
             $data['user_is_verified'] = true;
         } else {
             switch ($user['user_state']) {
                 case 'valid':
                     $data['user_is_valid'] = true;
                     $data['user_is_verified'] = true;
                     break;
                 case 'email_confirm':
                 case 'email_confirm_edit':
                     $data['user_is_valid'] = true;
                     $data['user_is_verified'] = false;
                     break;
                 case 'moderated':
                     $data['user_is_valid'] = false;
                     $data['user_is_verified'] = false;
                     break;
             }
         }
     }
     $data['user_is_followed'] = !empty($user['bdapi_user_is_followed']);
     if ($this->canViewUserCurrentActivity($user)) {
         $data['user_last_seen_date'] = $user['last_activity'];
     } else {
         // user hides his/her activity, use the register date value instead
         // (IMHO using 0 will make it too obvious that activity is hidden)
         $data['user_last_seen_date'] = $user['register_date'];
     }
     $data['links'] = array('permalink' => XenForo_Link::buildPublicLink('members', $user), 'detail' => bdApi_Data_Helper_Core::safeBuildApiLink('users', $user), 'avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 'm', false, true)), 'avatar_big' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 'l', false, true)), 'avatar_small' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 's', false, true)), 'followers' => bdApi_Data_Helper_Core::safeBuildApiLink('users/followers', $user), 'followings' => bdApi_Data_Helper_Core::safeBuildApiLink('users/followings', $user), 'ignore' => bdApi_Data_Helper_Core::safeBuildApiLink('users/ignore', $user));
     $data['permissions'] = array('edit' => $prepareProtectedData, 'follow' => $user['user_id'] != $visitor->get('user_id') && $visitor->canFollow());
     /** @var XenForo_Model_UserIgnore $ignoreModel */
     $ignoreModel = $this->getModelFromCache('XenForo_Model_UserIgnore');
     $data['permissions']['ignore'] = $ignoreModel->canIgnoreUser($visitor->get('user_id'), $user);
     $data['user_is_ignored'] = $visitor->isIgnoring($user['user_id']);
     $data['user_is_visitor'] = $user['user_id'] == $visitor->get('user_id');
     if ($prepareProtectedData) {
         if (isset($user['timezone'])) {
             $dtz = new DateTimeZone($user['timezone']);
             $dt = new DateTime('now', $dtz);
             $data['user_timezone_offset'] = $dtz->getOffset($dt);
         }
         $auth = $this->getUserAuthenticationObjectByUserId($user['user_id']);
         $data['user_has_password'] = $auth->hasPassword();
         $data['user_fields'] = $this->prepareApiDataForUserFields($user);
         $thisUserGroups = array();
         $userGroups = $userGroupModel->bdApi_getAllUserGroupsCached();
         foreach ($userGroups as $userGroup) {
             if ($this->isMemberOfUserGroup($user, $userGroup['user_group_id'])) {
                 $thisUserGroups[] = $userGroup;
             }
         }
         $data['user_groups'] = $userGroupModel->prepareApiDataForUserGroups($thisUserGroups);
         foreach ($data['user_groups'] as &$userGroupRef) {
             if ($userGroupRef['user_group_id'] == $user['user_group_id']) {
                 $userGroupRef['is_primary_group'] = true;
             } else {
                 $userGroupRef['is_primary_group'] = false;
             }
         }
         $data['self_permissions'] = array('create_conversation' => $conversationModel->canStartConversations(), 'upload_attachment_conversation' => $conversationModel->canUploadAndManageAttachment());
         $data['edit_permissions'] = array('password' => true, 'user_email' => true, 'username' => false, 'user_title' => false, 'primary_group_id' => false, 'secondary_group_ids' => false, 'user_dob_day' => false, 'user_dob_month' => false, 'user_dob_year' => false, 'user_fields' => true);
         if ($isAdminRequest) {
             $data['edit_permissions'] = array_merge($data['edit_permissions'], array('username' => true, 'user_title' => true, 'primary_group_id' => true, 'secondary_group_ids' => true));
         }
         if (empty($data['user_dob_day']) && empty($data['user_dob_month']) && empty($data['user_dob_year']) || $isAdminRequest) {
             $data['edit_permissions'] = array_merge($data['edit_permissions'], array('user_dob_day' => true, 'user_dob_month' => true, 'user_dob_year' => true));
         }
     }
     /** @var XenForo_Model_UserProfile $userProfileModel */
     $userProfileModel = $this->getModelFromCache('XenForo_Model_UserProfile');
     if ($userProfileModel->canViewProfilePosts($user)) {
         $data['links']['timeline'] = bdApi_Data_Helper_Core::safeBuildApiLink('users/timeline', $user);
         if ($user['user_id'] == $visitor->get('user_id')) {
             $data['permissions']['profile_post'] = $visitor->canUpdateStatus();
         } else {
             $data['permissions']['profile_post'] = $userProfileModel->canPostOnProfile($user);
         }
//.........这里部分代码省略.........
开发者ID:billyprice1,项目名称:bdApi,代码行数:101,代码来源:User.php

示例3: helperPlainUserTitle

 public static function helperPlainUserTitle($user, $allowCustomTitle = true, $withBanner = false)
 {
     return parent::helperUserTitle($user, $allowCustomTitle, $withBanner);
 }
开发者ID:iversia,项目名称:3ps_cmfu,代码行数:4,代码来源:Base.php

示例4: actionGetConversation

 public function actionGetConversation()
 {
     $conversationid = $this->_input->filterSingle('conversationid', XenForo_Input::UINT);
     $signature = $this->_input->filterSingle('signature', XenForo_Input::UINT);
     $page = max($this->_input->filterSingle('page', XenForo_Input::UINT), 1);
     $perpage = $this->_input->filterSingle('perpage', XenForo_Input::UINT);
     if (!$perpage) {
         $perpage = XenForo_Application::get('options')->messagesPerPage;
     }
     $conversation_model = $this->_getConversationModel();
     $session_model = $this->getModelFromCache('XenForo_Model_Session');
     try {
         $conversation_info = $this->_getConversationOrError($conversationid);
     } catch (Exception $e) {
         json_error($e->getControllerResponse()->errorText->render());
     }
     $gotomessageid = 0;
     if ($page == FR_LAST_POST) {
         if (!$conversation_info['last_read_date']) {
             $page = 1;
         } else {
             if ($conversation_info['last_read_date'] >= $conversation_info['last_message_date']) {
                 $first_unread = false;
             } else {
                 $first_unread = $conversation_model->getNextMessageInConversation($conversationid, $conversation_info['last_read_date']);
             }
             if (!$first_unread || $first_unread['message_id'] == $conversation_info['last_message_id']) {
                 $page = floor($conversation_info['reply_count'] / $perpage) + 1;
                 $gotomessageid = $conversation_info['last_message_id'];
             } else {
                 $before = $conversation_model->countMessagesBeforeDateInConversation($conversationid, $first_unread['message_date']);
                 $page = floor($before / $perpage) + 1;
                 $gotomessageid = $first_unread['message_id'];
             }
         }
     }
     $recipients = $conversation_model->getConversationRecipients($conversationid);
     $messages = $conversation_model->getConversationMessages($conversationid, array('page' => $page, 'perPage' => $perpage));
     $max = $conversation_model->getMaximumMessageDate($messages);
     if ($max > $conversation_info['last_read_date']) {
         $conversation_model->markConversationAsRead($conversationid, XenForo_Visitor::getUserId(), $max, $conversation_info['last_message_date']);
     }
     $messages = $conversation_model->prepareMessages($messages, $conversation_info);
     $user_model = $this->getModelFromCache('XenForo_Model_User');
     foreach ($messages as &$message) {
         $user = $user_model->getUserById($message['user_id']);
         $online_info = $session_model->getSessionActivityRecords(array('user_id' => $message['user_id'], 'cutOff' => array('>', $session_model->getOnlineStatusTimeout())));
         $is_online = false;
         if (count($online_info) == 1) {
             $is_online = true;
         }
         list($text, $nuked_quotes, $images) = parse_post(fr_strip_smilies($this, XenForo_Helper_String::censorString($message['message'])), true);
         $fr_images = array();
         foreach ($images as $image) {
             $fr_images[] = array('img' => $image);
         }
         $avatarurl = '';
         if ($user !== false) {
             $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($user, 'm'));
             if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) {
                 $avatarurl = '';
             }
         }
         $out = array('post_id' => $message['message_id'], 'thread_id' => $message['conversation_id'], 'username' => prepare_utf8_string(strip_tags($message['username'])), 'joindate' => prepare_utf8_string(XenForo_Locale::date($message['register_date'], 'absolute')), 'usertitle' => XenForo_Template_Helper_Core::helperUserTitle($user), 'numposts' => $user ? $user['message_count'] : 0, 'userid' => $message['user_id'], 'online' => $is_online, 'post_timestamp' => prepare_utf8_string(XenForo_Locale::dateTime($message['message_date'], 'absolute')), 'fr_images' => $fr_images, 'text' => $text, 'quotable' => $nuked_quotes);
         if ($avatarurl != '') {
             $out['avatarurl'] = $avatarurl;
         }
         if ($signature) {
             $sig = trim(strip_tags(remove_bbcode($message['signature'], true, true), '<a>'));
             $sig = str_replace(array("\t", "\r"), array('', ''), $sig);
             $sig = str_replace("\n\n", "\n", $sig);
             $out['sig'] = prepare_utf8_string($sig);
         }
         $message_data[] = $out;
     }
     $out = array('posts' => $message_data, 'total_posts' => $conversation_info['reply_count'] + 1, 'page' => $page, 'canattach' => false, 'canpost' => true, 'title' => prepare_utf8_string(XenForo_Helper_String::censorString($conversation_info['title'])), 'thread_link' => process_avatarurl(XenForo_Link::buildPublicLink('conversations', $conversation_info)));
     if ($gotomessageid) {
         $out['gotopostid'] = $gotomessageid;
     }
     $r = array_values($conversation_model->getConversationRecipients($conversationid));
     $recipients = '';
     for ($i = 0; $i < count($r); $i++) {
         if ($i != 0) {
             $recipients .= ', ';
         }
         $recipients .= prepare_utf8_string(strip_tags($r[$i]['username']));
     }
     $out['recipients'] = $recipients;
     return $out;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:90,代码来源:Conversation.php

示例5: actionGetThread


//.........这里部分代码省略.........
                 $ext = strtolower($attachment['extension']);
                 $link = XenForo_Link::buildPublicLink('attachments', $attachment);
                 if ($ext == 'jpe' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpg') {
                     $data = array('img' => fr_get_xenforo_bburl() . '/' . $link);
                     if ($attachment['thumbnailUrl']) {
                         $data['tmb'] = fr_get_xenforo_bburl() . '/' . $attachment['thumbnailUrl'];
                     }
                     $fr_images[] = $data;
                 } else {
                     if ($ext == 'pdf') {
                         $docattach[] = fr_get_xenforo_bburl() . '/' . $link;
                     }
                 }
             }
         }
         list($text, $nuked_quotes, $images) = parse_post(fr_strip_smilies($this, XenForo_Helper_String::censorString($post['message'])), true);
         if (count($fr_images) > 0) {
             $text .= "<br/>";
             foreach ($fr_images as $attachment) {
                 $text .= "<img src=\"{$attachment['img']}\"/>";
             }
         }
         foreach ($images as $image) {
             $fr_images[] = array('img' => $image);
         }
         $avatarurl = '';
         if ($user !== false) {
             $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($user, 'm'));
             if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) {
                 $avatarurl = '';
             }
         }
         $post_page = floor($post['position'] / XenForo_Application::get('options')->messagesPerPage) + 1;
         $out = array('post_id' => $post['post_id'], 'thread_id' => $post['thread_id'], 'forum_id' => $post['node_id'], 'forum_title' => prepare_utf8_string(strip_tags($post['node_title'])), 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string(XenForo_Locale::date($post['register_date'], 'absolute')), 'usertitle' => strip_tags(XenForo_Template_Helper_Core::helperUserTitle($user)), 'numposts' => $user ? $user['message_count'] : 0, 'userid' => $post['user_id'], 'canlike' => $post['canLike'] ? true : false, 'likes' => $post['like_date'] > 0 ? true : false, 'title' => prepare_utf8_string(XenForo_Helper_String::censorString($post['title'])), 'online' => $is_online, 'post_timestamp' => prepare_utf8_string(XenForo_Locale::dateTime($post['post_date'], 'absolute')), 'post_link' => fr_get_xenforo_bburl() . '/' . XenForo_Link::buildPublicLink('threads', $thread_info, array('page' => $post_page)) . '#post-' . $post['post_id'], 'fr_images' => $fr_images);
         if ($post['canDelete']) {
             $out['candelete'] = true;
         }
         if ($post['likes']) {
             $out['likestext'] = prepare_utf8_string($post_helper->likesHtml($post['post_id'], $post['likes'], $post['like_date'], $post['likeUsers']));
             $like_users = '';
             for ($i = 0; $i < count($post['likeUsers']); $i++) {
                 if ($i != 0) {
                     $like_users .= ', ';
                 }
                 $like_users .= $post['likeUsers'][$i]['username'];
             }
             $out['likesusers'] = prepare_utf8_string($like_users);
         }
         if ($avatarurl != '') {
             $out['avatarurl'] = $avatarurl;
         }
         if ($post['message_state'] == 'deleted') {
             $out += array('deleted' => true, 'del_username' => prepare_utf8_string(strip_tags($post['delete_username'])));
             if ($post['delete_reason']) {
                 $out['del_reason'] = prepare_utf8_string($post['delete_reason']);
             }
         } else {
             if ($post['canEdit']) {
                 $out += array('canedit' => $post['canEdit']);
             }
             $out += array('text' => $text, 'quotable' => $nuked_quotes, 'edittext' => prepare_utf8_string($post['message']));
         }
         if (count($docattach)) {
             $out['docattach'] = $docattach;
         }
         if ($signature) {
开发者ID:Sywooch,项目名称:forums,代码行数:67,代码来源:Thread.php


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