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


PHP XenForo_Helper_String类代码示例

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


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

示例1: _sendEmail

 protected function _sendEmail(array $email, array $user, Zend_Mail_Transport_Abstract $transport)
 {
     if (!$user['email']) {
         return;
     }
     $phraseTitles = XenForo_Helper_String::findPhraseNamesFromStringSimple($email['email_title'] . $email['email_body']);
     /** @var XenForo_Model_Phrase $phraseModel */
     $phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
     $phrases = $phraseModel->getPhraseTextFromPhraseTitles($phraseTitles, $user['language_id']);
     foreach ($phraseTitles as $search => $phraseTitle) {
         if (isset($phrases[$phraseTitle])) {
             $email['email_title'] = str_replace($search, $phrases[$phraseTitle], $email['email_title']);
             $email['email_body'] = str_replace($search, $phrases[$phraseTitle], $email['email_body']);
         }
     }
     $mailObj = new Zend_Mail('utf-8');
     $mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']);
     $options = XenForo_Application::getOptions();
     $bounceEmailAddress = $options->bounceEmailAddress;
     if (!$bounceEmailAddress) {
         $bounceEmailAddress = $options->defaultEmailAddress;
     }
     $toEmail = $user['email'];
     $bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8);
     $mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}");
     if ($options->enableVerp) {
         $verpValue = str_replace('@', '=', $toEmail);
         $bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress);
     }
     $mailObj->setReturnPath($bounceEmailAddress);
     if ($email['email_format'] == 'html') {
         $replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $text = trim(htmlspecialchars_decode(strip_tags($email['email_body'])));
         $mailObj->setBodyHtml($email['email_body'])->setBodyText($text);
     } else {
         $replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $mailObj->setBodyText($email['email_body']);
     }
     if (!$mailObj->getMessageId()) {
         $mailObj->setMessageId();
     }
     $thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
     try {
         $mailObj->send($thisTransport);
     } catch (Exception $e) {
         if (method_exists($thisTransport, 'resetConnection')) {
             XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
             $thisTransport->resetConnection();
             try {
                 $mailObj->send($thisTransport);
             } catch (Exception $e) {
                 XenForo_Error::logException($e, false, "Email to {$user['email']} failed (after retry): ");
             }
         } else {
             XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
         }
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:60,代码来源:UserEmail.php

示例2: _Tinhte_XenTag_prepareRssEntry

 protected function _Tinhte_XenTag_prepareRssEntry($result, Zend_Feed_Writer_Feed $feed)
 {
     $entry = false;
     if ($result[XenForo_Model_Search::CONTENT_TYPE] == 'thread') {
         $thread = $result['content'];
         $entry = $feed->createEntry();
         $entry->setTitle($thread['title']);
         $entry->setLink(XenForo_Link::buildPublicLink('canonical:threads', $thread));
         $entry->setDateCreated(new Zend_Date($thread['post_date'], Zend_Date::TIMESTAMP));
         $entry->setDateModified(new Zend_Date($thread['last_post_date'], Zend_Date::TIMESTAMP));
         $discussionRssContentLength = XenForo_Application::getOptions()->get('discussionRssContentLength');
         if (!empty($thread['message']) && $discussionRssContentLength > 0) {
             $bbCodeParser = $this->_Tinhte_XenTag_getBbCodeParser('Base');
             $bbCodeSnippetParser = $this->_Tinhte_XenTag_getBbCodeParser('XenForo_BbCode_Formatter_BbCode_Clean');
             $rendererStates = array('disableProxying' => true);
             $wordTrimmed = XenForo_Helper_String::wholeWordTrim($thread['message'], $discussionRssContentLength);
             $snippet = $bbCodeSnippetParser->render($wordTrimmed, $rendererStates);
             if ($snippet != $thread['message']) {
                 $snippet .= "\n\n[url='" . XenForo_Link::buildPublicLink('canonical:threads', $thread) . "']" . $thread['title'] . '[/url]';
             }
             $content = trim($bbCodeParser->render($snippet, $rendererStates));
             if (strlen($content)) {
                 $entry->setContent($content);
             }
         }
         if (!$this->_Tinhte_XenTag_isBuggyXmlNamespace()) {
             $entry->addAuthor(array('name' => $thread['username'], 'uri' => XenForo_Link::buildPublicLink('canonical:members', $thread)));
             if ($thread['reply_count']) {
                 $entry->setCommentCount($thread['reply_count']);
             }
         }
     }
     return $entry;
 }
开发者ID:maitandat1507,项目名称:Tinhte_XenTag,代码行数:34,代码来源:View.php

示例3: filterString

 /**
  * Default, empty string filterer.
  *
  * @see XenForo_BbCode_Formatter_Base::filterString()
  */
 public function filterString($string, array $rendererStates)
 {
     if ($this->_censorString) {
         $string = XenForo_Helper_String::censorString($string);
     }
     return $string;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:12,代码来源:Abstract.php

示例4: _log

 /**
  * @param array $logUser
  * @param array $content
  * @param $action
  * @param array $actionParams
  * @param null $parentContent
  * @return mixed
  */
 protected function _log(array $logUser, array $content, $action, array $actionParams = array(), $parentContent = null)
 {
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_ModeratorLog');
     $dw->bulkSet(array('user_id' => $logUser['user_id'], 'content_type' => sonnb_XenGallery_Model_Photo::$xfContentType, 'content_id' => $content['content_id'], 'content_user_id' => $content['user_id'], 'content_username' => $content['username'], 'content_title' => XenForo_Helper_String::wordWrapString($content['title'], 140), 'content_url' => XenForo_Link::buildPublicLink('gallery/photos', $content), 'discussion_content_type' => sonnb_XenGallery_Model_Photo::$xfContentType, 'discussion_content_id' => $content['content_id'], 'action' => $action, 'action_params' => $actionParams));
     $dw->save();
     return $dw->get('moderator_log_id');
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Photo.php

示例5: 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

示例6: renderVerification

 public function renderVerification(XenForo_View $view, $context, array $user, array $providerData, array $triggerData)
 {
     $issuer = XenForo_Helper_String::wholeWordTrim(str_replace(':', '', XenForo_Application::getOptions()->boardTitle), 50);
     $user = str_replace(':', '', $user['username']);
     $params = array('secret' => $providerData['secret'], 'otpUrl' => $this->_getAuthHandler()->getOtpAuthUrl("{$issuer}: {$user}", $providerData['secret'], $issuer), 'data' => $providerData, 'context' => $context);
     return $view->createTemplateObject('two_step_totp', $params)->render();
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:7,代码来源:Totp.php

示例7: renderTagCode

 public function renderTagCode(array $tag, array $rendererStates)
 {
     if (strtolower(strval($tag['option'])) == 'html') {
         $tag['option'] = 'html5';
     }
     if (!$tag['option']) {
         $tag['option'] = 'text';
     }
     $content = $this->stringifyTree($tag['children']);
     $content = XenForo_Helper_String::censorString($content);
     $geshi = new GeSHi($content, $tag['option']);
     if (XenForo_Application::get('options')->get('dpSyntaxHighlighterShowLines')) {
         $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
     }
     $geshi->set_link_target('_blank" rel="nofollow');
     $geshi->set_header_type(GESHI_HEADER_NONE);
     $geshi->set_tab_width(4);
     $content = $geshi->parse_code();
     if ($this->_view) {
         $template = $this->_view->createTemplateObject('dp_bb_code_tag_code', array('content' => $content, 'language' => $geshi->get_language_name()));
         return $template->render();
     } else {
         return '<div style="margin: 1em auto" title="Code">' . $content . '</div>';
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:Base.php

示例8: 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

示例9: autoLinkTag

 public function autoLinkTag(array $tag, array $rendererStates)
 {
     $text = parent::autoLinkTag($tag, $rendererStates);
     if ($tag['tag'] == 'verse') {
         $bibleId = null;
         $option = explode(',', $tag['option']);
         $xenOptions = XenForo_Application::get('options');
         $verse = '';
         $version = null;
         if (count($option) > 1) {
             $verse = $option[0];
             $version = strtoupper($option[1]);
         } elseif ($option[0]) {
             if (preg_match('#^[A-z]+$#', $tag['option'])) {
                 $verse = '';
                 $version = strtoupper($tag['option']);
             } else {
                 $verse = $tag['option'];
                 $version = strtoupper($xenOptions->th_bible_defaultBible);
             }
         }
         if (in_array(strtolower($version), $xenOptions->th_bible_bbCodeBibles)) {
             $bibleId = strtolower($version);
         } elseif ($verse) {
             return $text;
         } else {
             $bibleId = null;
         }
         /* @var $verseModel ThemeHouse_Bible_Model_Verse */
         $verseModel = XenForo_Model::create('ThemeHouse_Bible_Model_Verse');
         if (!$verse) {
             $verse = XenForo_Helper_String::bbCodeStrip($text);
         }
         $verseText = $verseModel->getVerseFromText($verse, $bibleId);
         if ($verseText) {
             $verseTextStripped = XenForo_Helper_String::bbCodeStrip(str_ireplace('versenum', 'quote', $verseText), true);
             $textStripped = XenForo_Helper_String::bbCodeStrip(str_ireplace('versenum', 'quote', $text), true);
             $verseTextStripped = strtolower(preg_replace('!\\s+!', ' ', $verseTextStripped));
             // remove square brackets (i.e., extra comments)
             $textStripped = preg_replace('/\\[[^\\]]*\\]/', '', $textStripped);
             // remove double spaces, line breaks, etc.
             $textStripped = strtolower(preg_replace('!\\s+!', ' ', $textStripped));
             // split at elipsis
             $textStrippedSplit = preg_split("#(?:…)|(?:\\.\\.\\.)#", $textStripped);
             foreach ($textStrippedSplit as $_textStripped) {
                 if (!trim($_textStripped)) {
                     continue;
                 }
                 $strPos = strpos($verseTextStripped, $_textStripped);
                 if ($strPos === false) {
                     return '[VERSE=' . $verse . ',' . strtoupper($bibleId) . ']' . $verseText . '[/VERSE]';
                 } else {
                     $verseTextStripped = substr($verseTextStripped, $strPos + strlen($_textStripped));
                 }
             }
         }
     }
     return $text;
 }
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:59,代码来源:AutoLink.php

示例10: prepareCollection

 public function prepareCollection(array $collection, $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if (!empty($collection)) {
         $collection['title'] = XenForo_Helper_String::censorString($collection['title']);
         $collection['description'] = XenForo_Helper_String::censorString($collection['description']);
     }
     return $collection;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Collection.php

示例11: renderHtml

 /**
  * Help render the HTML output.
  *
  * @return mixed
  */
 public function renderHtml()
 {
     foreach ($this->_params['socialForums'] as &$forum) {
         $forum['urls'] = ThemeHouse_SocialGroups_Template_Helper_SocialForum::getAvatarUrls($forum);
         $forum['description'] = XenForo_Helper_String::bbCodeStrip($forum['description'], true);
     }
     unset($forum);
     $this->_params['renderedSocialForums'] = ThemeHouse_SocialGroups_ViewPublic_Helper::renderSocialForumsListFromDisplayArray($this, $this->_params['socialForums']);
 }
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:14,代码来源:List.php

示例12: _autoLinkUrlCallback

 /**
  * Callback for the auto-linker regex.
  *
  * @param array $match
  *
  * @return string
  */
 protected function _autoLinkUrlCallback(array $match)
 {
     $link = XenForo_Helper_String::prepareAutoLinkedUrl($match[0]);
     if ($link['url'] === $link['linkText']) {
         $tag = '[url]' . $link['url'] . '[/url]';
     } else {
         $tag = '[url="' . $link['url'] . '"]' . $link['linkText'] . '[/url]';
     }
     return $tag . $link['suffixText'];
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:17,代码来源:AutoLink.php

示例13: getContentByIds

 /**
  * Fetches the content required by alerts.
  *
  * @param array $contentIds
  * @param XenForo_Model_Alert $model Alert model invoking this
  * @param integer $userId User ID the alerts are for
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
 {
     $updateModel = $this->_getUpdateModel();
     $updates = $updateModel->getUpdatesByIds($contentIds, array('join' => XenResource_Model_Update::FETCH_RESOURCE | XenResource_Model_Update::FETCH_CATEGORY, 'permissionCombinationId' => $viewingUser['permission_combination_id']));
     foreach ($updates as &$update) {
         $update['resource_title'] = XenForo_Helper_String::censorString($update['resource_title']);
         $update['title'] = XenForo_Helper_String::censorString($update['title']);
     }
     return $updates;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:20,代码来源:Update.php

示例14: _prepareNewsFeedItemAfterAction

 /**
  * Prepares the news feed item for display
  *
  * @param array $item News feed item
  * @param array $content News feed item content
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 protected function _prepareNewsFeedItemAfterAction(array $item, $content, array $viewingUser)
 {
     $item['content'] = array('title' => XenForo_Helper_String::censorString($content['title']));
     foreach ($this->_getContentPrimaryKeynames() as $key) {
         if (isset($content[$key])) {
             $item['content'][$key] = $content[$key];
         }
     }
     return $item;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:19,代码来源:Discussion.php

示例15: _prepareNewsFeedItemAfterAction

 /**
  * Prepares the news feed item for display
  *
  * @param array $item News feed item
  * @param array $content News feed item content
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 protected function _prepareNewsFeedItemAfterAction(array $item, $content, array $viewingUser)
 {
     if (isset($item[$item['action']]['old'])) {
         $item[$item['action']]['old'] = XenForo_Helper_String::censorString($item[$item['action']]['old']);
     }
     if (isset($item[$item['action']]['new'])) {
         $item[$item['action']]['new'] = XenForo_Helper_String::censorString($item[$item['action']]['new']);
     }
     return $item;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:19,代码来源:User.php


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