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


PHP XenForo_Helper_String::autoLinkBbCode方法代码示例

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


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

示例1: actionPostIndex

 public function actionPostIndex()
 {
     if (!$this->_getConversationModel()->canStartConversations($errorPhraseKey)) {
         throw $this->getErrorOrNoPermissionResponseException($errorPhraseKey);
     }
     $input = $this->_input->filter(array('recipients' => XenForo_Input::STRING, 'conversation_title' => XenForo_Input::STRING));
     /* @var $editorHelper XenForo_ControllerHelper_Editor */
     $editorHelper = $this->getHelper('Editor');
     $input['message_body'] = $editorHelper->getMessageText('message_body', $this->_input);
     $input['message_body'] = XenForo_Helper_String::autoLinkBbCode($input['message_body']);
     $visitor = XenForo_Visitor::getInstance();
     /* @var $conversationDw XenForo_DataWriter_ConversationMaster */
     $conversationDw = XenForo_DataWriter::create('XenForo_DataWriter_ConversationMaster');
     $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_ACTION_USER, $visitor->toArray());
     $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_MESSAGE, $input['message_body']);
     $conversationDw->set('user_id', $visitor['user_id']);
     $conversationDw->set('username', $visitor['username']);
     $conversationDw->set('title', $input['conversation_title']);
     $conversationDw->addRecipientUserNames(explode(',', $input['recipients']));
     // checks permissions
     $messageDw = $conversationDw->getFirstMessageDw();
     $messageDw->set('message', $input['message_body']);
     $messageDw->setExtraData(XenForo_DataWriter_ConversationMessage::DATA_ATTACHMENT_HASH, $this->_getAttachmentHelper()->getAttachmentTempHash());
     $conversationDw->preSave();
     if (!$conversationDw->hasErrors()) {
         $this->assertNotFlooding('conversation');
     }
     $conversationDw->save();
     $conversation = $conversationDw->getMergedData();
     $this->_getConversationModel()->markConversationAsRead($conversation['conversation_id'], XenForo_Visitor::getUserId(), XenForo_Application::$time);
     $this->_request->setParam('conversation_id', $conversation['conversation_id']);
     return $this->responseReroute(__CLASS__, 'single');
 }
开发者ID:burtay,项目名称:bdApi,代码行数:33,代码来源:Conversation.php

示例2: actionSave

 public function actionSave()
 {
     if ($this->_input->inRequest('preview')) {
         return $this->responseReroute(__CLASS__, 'preview');
     }
     $this->_assertPostOnly();
     $feedId = $this->_input->filterSingle('feed_id', XenForo_Input::UINT);
     $data = $this->_getFeedFormData();
     $data['message_template'] = $this->getHelper('Editor')->getMessageText('message_template', $this->_input);
     $data['message_template'] = XenForo_Helper_String::autoLinkBbCode($data['message_template']);
     if ($data['user_id'] == -1) {
         $username = $this->_input->filterSingle('username', XenForo_Input::STRING);
         if ($user = $this->getModelFromCache('XenForo_Model_User')->getUserByName($username)) {
             $data['user_id'] = $user['user_id'];
         }
     }
     $data['user_id'] = intval(max($data['user_id'], 0));
     $writer = XenForo_DataWriter::create('XenForo_DataWriter_Feed');
     if ($feedId) {
         $writer->setExistingData($feedId);
     }
     $writer->bulkSet($data);
     $writer->save();
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('feeds'));
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:25,代码来源:Feed.php

示例3: updateCategory

 public function updateCategory($input)
 {
     $dw = XenForo_DataWriter::create('EWRmedio_DataWriter_Categories');
     if (!empty($input['category_id']) && ($category = $this->getCategoryByID($input['category_id']))) {
         $dw->setExistingData($category);
     }
     $dw->bulkSet(array('category_name' => $input['category_name'], 'category_description' => XenForo_Helper_String::autoLinkBbCode($input['category_description']), 'category_parent' => $input['category_parent'], 'category_disabled' => $input['category_disabled']));
     $dw->save();
     $input['category_id'] = $dw->get('category_id');
     return $input;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:11,代码来源:Categories.php

示例4: renderJson

 public function renderJson()
 {
     $options = XenForo_Application::get('options');
     $formatter = XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_Tenori', array('view' => $this));
     switch ($options->dark_taigachat_bbcode) {
         case 'Full':
             $formatter->displayableTags = true;
             break;
         case 'Basic':
         default:
             $formatter->displayableTags = array('img', 'url', 'email', 'b', 'u', 'i', 's', 'color');
             break;
         case 'None':
             $formatter->displayableTags = array('url', 'email');
             break;
     }
     $formatter->getTagsAgain();
     $parser = new XenForo_BbCode_Parser($formatter);
     if ($options->dark_taigachat_imagemode == 'Link') {
         foreach ($this->_params['taigachat']['messages'] as &$message) {
             $message['message'] = str_ireplace(array("[img]", "[/img]"), array("[url]", "[/url]"), $message['message']);
         }
     }
     $maxid = $this->_params['taigachat']['lastrefresh'];
     foreach ($this->_params['taigachat']['messages'] as &$message) {
         if ($options->dark_taigachat_bbcode == 'Full') {
             $message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
         } else {
             // We don't want to parse youtube etc. urls if [media] is disabled
             $autoLinkParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_BbCode_AutoLink', false));
             $message['message'] = $autoLinkParser->render($message['message']);
         }
         if ($message['id'] > $maxid) {
             $maxid = $message['id'];
         }
     }
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['taigachat']['messages'], $parser);
     if ($options->dark_taigachat_direction) {
         $this->_params['taigachat']['messages'] = array_reverse($this->_params['taigachat']['messages']);
     }
     $template = $this->createTemplateObject($this->_templateName, $this->_params);
     $template->setParams($this->_params);
     $rendered = $template->render();
     $rendered = preg_replace('/\\s+<\\/(.*?)>\\s+</si', ' </$1> <', $rendered);
     $rendered = preg_replace('/\\s+<(.*?)([ >])/si', ' <$1$2', $rendered);
     //$rendered = str_replace(array("\r", "\n", "\t"), "", $rendered);
     $derp = XenForo_ViewRenderer_Json::jsonEncodeForOutput(array("templateHtml" => $rendered, "reverse" => $options->dark_taigachat_direction, "lastrefresh" => $maxid));
     $extraHeaders = XenForo_Application::gzipContentIfSupported($derp);
     foreach ($extraHeaders as $extraHeader) {
         header("{$extraHeader['0']}: {$extraHeader['1']}", $extraHeader[2]);
     }
     return $derp;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:53,代码来源:List.php

示例5: actionAddReply

 public function actionAddReply()
 {
     $this->_assertPostOnly();
     $threadId = $this->_input->filterSingle('thread_id', XenForo_Input::UINT);
     $message = $this->getHelper('Editor')->getMessageText('message', $this->_input);
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     //Get visitor id and check for duplicate post
     $visitorId = XenForo_Visitor::getUserId();
     $xenOptions = XenForo_Application::getOptions();
     $timeDiff = $xenOptions->sonnbPreventDoublePost_duration;
     $this->_assertIsDoublePost($message, $visitorId, $threadId, $timeDiff);
     return parent::actionAddReply();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:13,代码来源:Thread.php

示例6: save

 public function save()
 {
     $userId = $this->_options['conversation_send_by_user_id']['option_value'] != '' ? $this->_options['conversation_send_by_user_id']['option_value'] : XenForo_Visitor::getUserId();
     $recipientUserId = $this->_options['conversation_recipient_user_id']['option_value'];
     $recipientUserId = explode(',', $recipientUserId);
     // guests can't participate in conversations
     if (!$userId) {
         return false;
     }
     // users can't send themselves messages
     if ($userId == $recipientUserId) {
         return false;
     }
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $user = $userModel->getUserById($userId);
     if ($this->_options['conversation_message_template']['option_value'] == '') {
         $message = '';
         foreach ($this->_templateFields as $field) {
             if ($this->_options['conversation_hide_empty_fields']['option_value'] == array() || $this->_options['conversation_hide_empty_fields']['option_value'] !== array() && $field['value'] != '') {
                 $message .= $field['title'] . ':' . PHP_EOL;
                 if ($field['field_type'] == 'wysiwyg') {
                     $message .= '[INDENT="1"]' . $field['value'] . '[/INDENT]' . PHP_EOL;
                 } else {
                     $message .= '[INDENT="1"][B]' . $field['value'] . '[/B][/INDENT]' . PHP_EOL;
                 }
             }
         }
     } else {
         $message = $this->_options['conversation_message_template']['option_value'];
     }
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     $locked = $this->_options['conversation_locked']['option_value'] !== array() ? true : false;
     $conversationDw = XenForo_DataWriter::create('XenForo_DataWriter_ConversationMaster');
     $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_ACTION_USER, $user);
     $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_MESSAGE, $message);
     $conversationDw->set('user_id', $user['user_id']);
     $conversationDw->set('username', $user['username']);
     $conversationDw->set('title', $this->_options['conversation_title_template']['option_value']);
     $conversationDw->set('conversation_open', $locked ? 0 : 1);
     $conversationDw->addRecipientUserIds($recipientUserId);
     $messageDw = $conversationDw->getFirstMessageDw();
     $messageDw->set('message', $message);
     if ($this->_attachmentHash) {
         $messageDw->setExtraData(XenForo_DataWriter_ConversationMessage::DATA_ATTACHMENT_HASH, $this->_attachmentHash);
     }
     $conversationDw->preSave();
     $conversationDw->save();
     $conversation = $conversationDw->getMergedData();
     $this->_getConversationModel()->markConversationAsRead($conversation['conversation_id'], $user['user_id'], XenForo_Application::$time);
 }
开发者ID:Mirovinger,项目名称:xenforo-simple-forms,代码行数:50,代码来源:Conversation.php

示例7: approveModerationQueueEntry

 /**
  * Approves the specified moderation queue entry.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::approveModerationQueueEntry()
  */
 public function approveModerationQueueEntry($contentId, $message, $title)
 {
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post', XenForo_DataWriter::ERROR_SILENT);
     $dw->setExistingData($contentId);
     $dw->set('message_state', 'visible');
     $dw->set('message', $message);
     if ($dw->save()) {
         XenForo_Model_Log::logModeratorAction('post', $dw->getMergedData(), 'approve');
         return true;
     } else {
         return false;
     }
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:19,代码来源:Post.php

示例8: processMessagesForView

 public static function processMessagesForView(&$params, &$view)
 {
     $options = XenForo_Application::get('options');
     $formatter = XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_Tenori', array('view' => $view));
     switch ($options->dark_taigachat_bbcode) {
         case 'Full':
             $formatter->displayableTags = true;
             break;
         case 'Basic':
         default:
             $formatter->displayableTags = array('img', 'url', 'email', 'b', 'u', 'i', 's', 'color');
             break;
         case 'None':
             $formatter->displayableTags = array('url', 'email');
             break;
     }
     $formatter->getTagsAgain();
     $parser = new XenForo_BbCode_Parser($formatter);
     if ($options->dark_taigachat_imagemode == 'Link') {
         foreach ($params['taigachat']['messages'] as &$message) {
             $message['message'] = str_ireplace(array("[img]", "[/img]"), array("[url]", "[/url]"), $message['message']);
         }
     }
     $maxUpdate = $params['taigachat']['lastrefresh'];
     foreach ($params['taigachat']['messages'] as &$message) {
         if ($options->dark_taigachat_bbcode == 'Full') {
             $message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
         } else {
             // We don't want to parse youtube etc. urls if [media] is disabled
             $autoLinkParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_BbCode_AutoLink', false));
             $message['message'] = $autoLinkParser->render($message['message']);
         }
         if ($message['last_update'] > $maxUpdate) {
             $maxUpdate = $message['last_update'];
         }
         if (substr($message['message'], 0, 3) == '/me') {
             $message['message'] = substr($message['message'], 4);
             $message['me'] = true;
         }
     }
     if ($options->dark_taigachat_smilies) {
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($params['taigachat']['messages'], $parser);
     } else {
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($params['taigachat']['messages'], $parser, array("states" => array("stopSmilies" => true)));
     }
     if ($options->dark_taigachat_direction) {
         $params['taigachat']['messages'] = array_reverse($params['taigachat']['messages']);
     }
     return max($maxUpdate, XenForo_Application::getSimpleCacheData('taigachat_lastUpdate'));
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:50,代码来源:Global.php

示例9: approveModerationQueueEntry

 /**
  * Approves the specified moderation queue entry.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::approveModerationQueueEntry()
  */
 public function approveModerationQueueEntry($contentId, $message, $title)
 {
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     $dw = XenForo_DataWriter::create('ThemeHouse_SocialGroups_DataWriter_SocialForum', XenForo_DataWriter::ERROR_SILENT);
     $dw->setExistingData($contentId);
     $dw->set('group_state', 'visible');
     $dw->set('title', $title);
     $dw->set('description', $message);
     if ($dw->save()) {
         XenForo_Model_Log::logModeratorAction('socialForum', $dw->getMergedData(), 'approve');
         return true;
     } else {
         return false;
     }
 }
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:20,代码来源:SocialForum.php

示例10: actionCreateArticleThumbnails

 /**
  * Shows thumbs of images in the thread being created.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionCreateArticleThumbnails()
 {
     $this->_assertPostOnly();
     $forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
     $forumName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
     $ftpHelper = $this->getHelper('ForumThreadPost');
     $forum = $ftpHelper->assertForumValidAndViewable($forumId ? $forumId : $forumName);
     $forumId = $forum['node_id'];
     $this->_assertCanPostThreadInForum($forum);
     $message = $this->getHelper('Editor')->getMessageText('message', $this->_input);
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     $thumbnailsModel = $this->_getThumbnailsModel();
     $thumbs = $thumbnailsModel->getImagesFromMessage($message);
     $viewParams = array('forum' => $forum, 'thumbs' => $thumbs);
     return $this->responseView('Waindigo_Thumbnails_ViewPublic_Thread_Thumbnails', 'waindigo_thread_create_thumbs_thumbnails', $viewParams);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:21,代码来源:Library.php

示例11: runDailyCleanUp

 public static function runDailyCleanUp()
 {
     $options = XenForo_Application::get('options');
     $model = XenForo_Model::create('Dark_TaigaChat_Model_TaigaChat');
     if ($options->dark_taigachat_archivethread > 0) {
         // swap timezone to default temporarily
         $oldTimeZone = XenForo_Locale::getDefaultTimeZone()->getName();
         XenForo_Locale::setDefaultTimeZone($options->guestTimeZone);
         $messages = array_reverse($model->getMessagesToday());
         if (count($messages) > 0) {
             $userModel = XenForo_Model::create('XenForo_Model_User');
             $post = "";
             foreach ($messages as $message) {
                 $message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
                 $date = XenForo_Locale::dateTime($message['date'], 'absolute');
                 if ($message['user_id'] > 0) {
                     $url = XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("members/" . $message['user_id']), true);
                     $user = "[url='{$url}']{$message['username']}[/url]";
                 } else {
                     $user = "[b]{$message['username']}[/b]";
                 }
                 $me = substr($message['message'], 0, 3) == '/me';
                 if ($me) {
                     $message['message'] = substr($message['message'], 3);
                     $post .= "{$date} - [i]{$user} {$message['message']}[/i]\r\n";
                 } else {
                     $post .= "{$date} - {$user}: {$message['message']}\r\n";
                 }
             }
             $username = "TaigaChat";
             if ($options->dark_taigachat_archiveuser > 0) {
                 $user = $userModel->getUserById($options->dark_taigachat_archiveuser);
                 $username = $user['username'];
             }
             $writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
             $writer->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_IS_AUTOMATED, true);
             $writer->set('user_id', $options->dark_taigachat_archiveuser);
             $writer->set('username', $username);
             $writer->set('message', $post);
             $writer->set('thread_id', $options->dark_taigachat_archivethread);
             $writer->save();
         }
         // put timezone back to how it was
         XenForo_Locale::setDefaultTimeZone($oldTimeZone);
     }
     $model->deleteOldMessages();
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:47,代码来源:CleanUp.php

示例12: actionAddReply

 public function actionAddReply()
 {
     $this->_assertPostOnly();
     $input['message'] = $this->getHelper('Editor')->getMessageText('message', $this->_input);
     $input['message'] = XenForo_Helper_String::autoLinkBbCode($input['message']);
     $str = strtoupper($input['message']);
     $numberLink = substr_count($str, '[/URL]');
     $visitor = XenForo_Visitor::getInstance();
     $daysRegistered = XenForo_Permission::hasPermission($visitor['permissions'], 'forum', 'daysRegistered');
     if ($daysRegistered && $daysRegistered > 0) {
         $canPostLink = $visitor['register_date'] + $daysRegistered * 60 * 60 * 24;
         if ($canPostLink > XenForo_Application::$time && $numberLink) {
             return $this->responseError(new XenForo_Phrase('XP_you_must_wait_x_days_to_post_link', array('days' => $daysRegistered)));
         }
     }
     return parent::actionAddReply();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:17,代码来源:Thread.php

示例13: save

 public function save()
 {
     $threadId = $this->_options['post_thread_id']['option_value'];
     $threadModel = $this->_getThreadModel();
     $thread = $threadModel->getThreadById($threadId);
     $forum = $this->_getForumModel()->getForumById($thread['node_id']);
     $userId = $this->_options['post_post_by_user_id']['option_value'] != '' ? $this->_options['post_post_by_user_id']['option_value'] : XenForo_Visitor::getUserId();
     if (!$userId) {
         $user = array('username' => 'Guest', 'user_id' => null);
     } else {
         $userModel = XenForo_Model::create('XenForo_Model_User');
         $user = $userModel->getUserById($userId);
     }
     if ($this->_options['post_message_template']['option_value'] == '') {
         $message = '';
         foreach ($this->_templateFields as $field) {
             if ($this->_options['post_hide_empty_fields']['option_value'] == array() || $this->_options['post_hide_empty_fields']['option_value'] !== array() && $field['value'] != '') {
                 $message .= $field['title'] . ':' . PHP_EOL;
                 if ($field['field_type'] == 'wysiwyg') {
                     $message .= '[INDENT="1"]' . $field['value'] . '[/INDENT]' . PHP_EOL;
                 } else {
                     $message .= '[INDENT="1"][B]' . $field['value'] . '[/B][/INDENT]' . PHP_EOL;
                 }
             }
         }
     } else {
         $message = $this->_options['post_message_template']['option_value'];
     }
     $message = XenForo_Helper_String::autoLinkBbCode($message);
     $writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
     $writer->set('user_id', $user['user_id']);
     $writer->set('username', $user['username']);
     $writer->set('message', $message);
     $writer->set('message_state', $this->_getPostModel()->getPostInsertMessageState($thread, $forum));
     $writer->set('thread_id', $threadId);
     $writer->setExtraData(XenForo_DataWriter_DiscussionMessage_Post::DATA_FORUM, $forum);
     if ($this->_attachmentHash) {
         $writer->setExtraData(XenForo_DataWriter_DiscussionMessage::DATA_ATTACHMENT_HASH, $this->_attachmentHash);
     }
     $writer->preSave();
     $writer->save();
     $post = $writer->getMergedData();
     // set the post
     $this->_post = $post;
 }
开发者ID:jljr222,项目名称:xenforo-simple-forms,代码行数:45,代码来源:Post.php

示例14: actionPostEdit

 public function actionPostEdit()
 {
     $vals = $this->_input->filter(array('postid' => XenForo_Input::UINT, 'poststarttime' => XenForo_Input::STRING, 'message' => XenForo_Input::STRING));
     $helper = $this->getHelper('ForumThreadPost');
     try {
         list($post_info, $thread_info, $forum_info) = $helper->assertPostValidAndViewable($vals['postid']);
         $this->_assertCanEditPost($post_info, $thread_info, $forum_info);
     } catch (Exception $e) {
         json_error($e->getControllerResponse()->errorText->render(), RV_POST_ERROR);
     }
     $vals['message'] = XenForo_Helper_String::autoLinkBbCode($vals['message']);
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
     $dw->setExistingData($vals['postid']);
     $dw->set('message', $vals['message']);
     $dw->setExtraData(XenForo_DataWriter_DiscussionMessage::DATA_ATTACHMENT_HASH, $vals['poststarttime']);
     $dw->save();
     return array('success' => true);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:18,代码来源:Post.php

示例15: actionSave

 /**
  * Inserts a new user or updates an existing one.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionSave()
 {
     $xenOptions = XenForo_Application::get('options');
     if ($xenOptions->th_noForo_noMessageCount) {
         $this->_assertPostOnly();
         $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
         if ($userId) {
             $user = $this->_getUserOrError($userId);
             $this->getHelper('Admin')->checkSuperAdminEdit($user);
             if ($this->_getUserModel()->isUserSuperAdmin($user)) {
                 $visitorPassword = $this->_input->filterSingle('visitor_password', XenForo_Input::STRING);
                 $this->getHelper('Admin')->assertVisitorPasswordCorrect($visitorPassword);
             }
         }
         $userInput = $this->_input->filter(array('username' => XenForo_Input::STRING, 'email' => XenForo_Input::STRING, 'user_group_id' => XenForo_Input::UINT, 'user_state' => XenForo_Input::STRING, 'is_discouraged' => XenForo_Input::UINT, 'gender' => XenForo_Input::STRING, 'dob_day' => XenForo_Input::UINT, 'dob_month' => XenForo_Input::UINT, 'dob_year' => XenForo_Input::UINT, 'location' => XenForo_Input::STRING, 'occupation' => XenForo_Input::STRING, 'custom_title' => XenForo_Input::STRING, 'homepage' => XenForo_Input::STRING, 'about' => XenForo_Input::STRING, 'signature' => XenForo_Input::STRING, 'like_count' => XenForo_Input::UINT, 'trophy_points' => XenForo_Input::UINT, 'style_id' => XenForo_Input::UINT, 'language_id' => XenForo_Input::UINT, 'timezone' => XenForo_Input::STRING, 'content_show_signature' => XenForo_Input::UINT, 'enable_rte' => XenForo_Input::UINT, 'visible' => XenForo_Input::UINT, 'receive_admin_email' => XenForo_Input::UINT, 'show_dob_date' => XenForo_Input::UINT, 'show_dob_year' => XenForo_Input::UINT, 'allow_view_profile' => XenForo_Input::STRING, 'allow_post_profile' => XenForo_Input::STRING, 'allow_send_personal_conversation' => XenForo_Input::STRING, 'allow_view_identities' => XenForo_Input::STRING, 'allow_receive_news_feed' => XenForo_Input::STRING));
         $secondaryGroupIds = $this->_input->filterSingle('secondary_group_ids', XenForo_Input::UINT, array('array' => true));
         $userInput['about'] = XenForo_Helper_String::autoLinkBbCode($userInput['about']);
         if ($this->_input->filterSingle('clear_status', XenForo_Input::UINT)) {
             //TODO: clear status
         }
         /* @var $writer XenForo_DataWriter_User */
         $writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
         if ($userId) {
             $writer->setExistingData($userId);
         }
         $writer->setOption(XenForo_DataWriter_User::OPTION_ADMIN_EDIT, true);
         $writer->bulkSet($userInput);
         $writer->setSecondaryGroups($secondaryGroupIds);
         $password = $this->_input->filterSingle('password', XenForo_Input::STRING);
         if ($password !== '') {
             $writer->setPassword($password);
         }
         $customFields = $this->_input->filterSingle('custom_fields', XenForo_Input::ARRAY_SIMPLE);
         $customFieldsShown = $this->_input->filterSingle('custom_fields_shown', XenForo_Input::STRING, array('array' => true));
         $writer->setCustomFields($customFields, $customFieldsShown);
         $writer->save();
         $userId = $writer->get('user_id');
         // TODO: redirect to previous search if possible?
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('users/search', null, array('last_user_id' => $userId)) . $this->getLastHash($userId));
     }
     return parent::actionSave();
 }
开发者ID:ThemeHouse-XF,项目名称:NoForo,代码行数:47,代码来源:User.php


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