Пример #1
0
 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     $output['lastDate'] = $this->_params['lastMessage']['message_date'];
     $output['count'] = count($this->_params['messages']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #2
0
 public function renderJson()
 {
     $output = array();
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
     $viewParams = $this->_params;
     unset($viewParams['posts']);
     foreach ($this->_params['posts'] as &$post) {
         $viewParams['post'] = $post;
         $template = $this->createTemplateObject('post', $viewParams);
         $output['posts'][] = $template->render();
     }
     if (XenForo_Application::getOptions()->sonnb_LiveThread_reserveOrder) {
         $lastPost = reset($this->_params['posts']);
     } else {
         $lastPost = end($this->_params['posts']);
     }
     $template = $this->createTemplateObject('', $viewParams);
     $viewOutput = $template->render();
     $output['css'] = $template->getRequiredExternals('css');
     $output['js'] = $template->getRequiredExternals('js');
     $output['lastDate'] = $lastPost['post_date'];
     $output['reserveOrder'] = isset($viewParams['reserveOrder']) ? $viewParams['reserveOrder'] : false;
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #3
0
 public function renderJson()
 {
     $this->_params['urls'] = ThemeHouse_SocialGroups_Template_Helper_SocialForum::getAvatarUrls($this->_params['socialForum']);
     $this->_params['user_id'] = "sg-" . $this->_params['social_forum_id'];
     $output = XenForo_Application::arrayFilterKeys($this->_params, array('sizeCode', 'maxWidth', 'maxDimension', 'width', 'height', 'cropX', 'cropY', 'urls', 'user_id', 'logo_date', 'cropCss', 'message'));
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #4
0
 public function renderJson()
 {
     foreach ($this->_params['followUsers'] as $userId => &$user) {
         $user = $this->createTemplateObject('member_list_item_follower', array('user' => $user));
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('followUsers' => $this->_params['followUsers'], 'following' => $this->_params['following']));
 }
Пример #5
0
 public function renderJson()
 {
     $options = XenForo_Application::get('options');
     $maxid = Dark_TaigaChat_Helper_Global::processMessagesForView($this->_params, $this);
     $template = $this->createTemplateObject($this->_templateName, $this->_params);
     $template->setParams($this->_params);
     if (!empty($this->_params['taigachat']['publichtml'])) {
         $template->setLanguageId(XenForo_Phrase::getLanguageId());
         $template->setStyleId($options->defaultStyleId);
     }
     $rendered = $template->render();
     $rendered = preg_replace('/\\s+<\\/(.*?)>\\s+</si', ' </$1> <', $rendered);
     $rendered = preg_replace('/\\s+<(.*?)([ >])/si', ' <$1$2', $rendered);
     $params = array("templateHtml" => $rendered, "reverse" => $options->dark_taigachat_direction, "lastrefresh" => $maxid, "motd" => $this->_params['taigachat']['motd'], "numInChat" => $this->_params['taigachat']['numInChat']);
     if (!empty($this->_params['taigachat']['publichtml'])) {
         $params += array("_visitor_conversationsUnread" => "IGNORE", "_visitor_alertsUnread" => "IGNORE");
     }
     //$rendered = str_replace(array("\r", "\n", "\t"), "", $rendered);
     $derp = XenForo_ViewRenderer_Json::jsonEncodeForOutput($params, empty($this->_params['taigachat']['publichtml']));
     if (empty($this->_params['taigachat']['publichtml'])) {
         $extraHeaders = XenForo_Application::gzipContentIfSupported($derp);
         foreach ($extraHeaders as $extraHeader) {
             header("{$extraHeader['0']}: {$extraHeader['1']}", $extraHeader[2]);
         }
     }
     return $derp;
 }
Пример #6
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['comment'], $bbCodeParser, array());
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #7
0
 public function renderJson()
 {
     foreach ($this->_params['linkedUsers'] as $userId => &$user) {
         $user = $this->createTemplateObject('th_member_list_item_linked_parentalcontrol', array('user' => $user));
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('users' => $this->_params['linkedUsers'], 'userIds' => array_keys($this->_params['linkedUsers'])));
 }
Пример #8
0
 public function renderJson()
 {
     $output = array('templateHtml' => '', 'js' => '', 'css' => '');
     $output['watched'] = $this->_params['watched'];
     $output += sonnb_XenGallery_ViewPublic_Helper::getWatchViewParams($this->_params['watched']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #9
0
 public function renderJson()
 {
     $photo = $this->_preparePhotoForJson($this->_params['content'], $this->_params['album']);
     if (!empty($this->_params['message'])) {
         $photo['message'] = $this->_params['message'];
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($photo);
 }
Пример #10
0
 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     if ($this->_params['isStatus']) {
         $output['statusHtml'] = XenForo_Template_Helper_Core::callHelper('bodytext', array($this->_params['profilePost']['message'])) . ' ' . XenForo_Template_Helper_Core::callHelper('datetimehtml', array($this->_params['profilePost']['post_date']));
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #11
0
 public function renderJson()
 {
     if (!empty($this->_params['startNewsFeedId'])) {
         // this is for loading more entries
         $this->renderHtml();
         return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('news_feed', $this->_params), 'oldestItemId' => $this->_params['oldestItemId'], 'feedEnds' => $this->_params['feedEnds']));
     }
 }
Пример #12
0
 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     $output['newPostCount'] = $this->_params['newPostCount'];
     $output['draftSaved'] = $this->_params['draftSaved'];
     $output['draftDeleted'] = $this->_params['draftDeleted'];
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #13
0
 public function renderJson()
 {
     $attach = $this->_prepareAttachmentForJson($this->_params['attachment']);
     if (!empty($this->_params['message'])) {
         $attach['message'] = $this->_params['message'];
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($attach);
 }
Пример #14
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['comment']['message'], $bbCodeParser);
     $this->_params['comment']['message'] = $this->_params['comment']['messageHtml'];
     // sanity check in case template not updated
     $this->_params['comment']['comment_state'] = 'visible';
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('xengallery_comment', $this->_params), 'commentId' => $this->_params['comment']['comment_id']));
 }
Пример #15
0
 /**
  * Simple handler for XML redirects - do not redirect, just send status:ok and redirect:$redirectTarget
  *
  * @param integer Type of redirect. See {@link XenForo_ControllerResponse_Redirect}
  * @param string  Target to redirect to
  * @param mixed   Redirect message
  *
  * @return string XML response (response tag)
  */
 public function renderRedirect($redirectType, $redirectTarget, $redirectMessage = null, array $redirectParams = array())
 {
     $document = new DOMDocument('1.0', 'utf-8');
     $document->formatOutput = true;
     $rootNode = $document->createElement('response');
     XenForo_Helper_DevelopmentXml::createDomElements($rootNode, array('_redirectStatus' => 'ok', '_redirectTarget' => $redirectTarget, '_redirectMessage' => is_null($redirectMessage) ? new XenForo_Phrase('redirect_changes_saved_successfully') : $redirectMessage, 'jsonParams' => XenForo_ViewRenderer_Json::jsonEncodeForOutput($redirectParams)));
     $document->appendChild($rootNode);
     return $document->saveXML();
 }
Пример #16
0
 public function renderJson()
 {
     $this->_params['noOverlay'] = true;
     $this->_params['id'] = 'member-' . $this->_params['user']['user_id'];
     if (isset($this->_params['user']['username'])) {
         return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('th_member_list_item_socialgroups', $this->_params), 'memberId' => $this->_params['user']['user_id']));
     } else {
         return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('memberId' => $this->_params['user']['user_id']));
     }
 }
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['comment']['message'], $bbCodeParser);
     $this->_params['comment']['message'] = $this->_params['comment']['messageHtml'];
     // sanity check in case template not update
     $params = $this->_params;
     $params['comment'] = XenForo_Model::create('XenGallery_Model_Comment')->prepareComments($params['comment']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('xengallery_comment', $params), 'commentId' => $this->_params['comment']['comment_id'], 'date' => XenForo_Application::$time));
 }
Пример #18
0
 public function renderJson()
 {
     $options = XenForo_Application::get('options');
     $maxUpdate = Dark_TaigaChat_Helper_Global::processMessagesForView($this->_params, $this);
     $messages = $this->_params['taigachat']['messages'];
     if ($options->dark_taigachat_reverse) {
         $messages = array_reverse($messages);
     }
     $twelveHour = false;
     $template = $this->createTemplateObject("dark_taigachat_robots");
     if (!empty($this->_params['taigachat']['publichtml'])) {
         /** @var XenForo_Model_Language */
         $languageModel = XenForo_Model::create('XenForo_Model_Language');
         $language = $languageModel->getLanguageById(XenForo_Phrase::getLanguageId());
         if ($language['time_format'] == 'g:i A') {
             $twelveHour = true;
         }
         $template->setLanguageId(XenForo_Phrase::getLanguageId());
         $template->setStyleId($options->defaultStyleId);
     }
     $robots = $template->render();
     $outputMessages = array();
     $previous = null;
     $template = $this->createTemplateObject("dark_taigachat_message", $this->_params);
     if (!empty($this->_params['taigachat']['publichtml'])) {
         $template->setLanguageId(XenForo_Phrase::getLanguageId());
         $template->setStyleId($options->defaultStyleId);
     }
     foreach ($messages as &$message) {
         $template->setParam("message", $message);
         $rendered = $template->render();
         $rendered = preg_replace('/\\s+<\\/(.*?)>\\s+</si', ' </$1> <', $rendered);
         $rendered = preg_replace('/\\s+<(.*?)([ >])/si', ' <$1$2', $rendered);
         $outputMessages[] = array("id" => $message['id'], "previous" => empty($previous) ? 0 : $previous['id'], "last_update" => $message['last_update'], "html" => $rendered);
         $previous = $message;
     }
     $template = $this->createTemplateObject("dark_taigachat_online_users", $this->_params);
     if (!empty($this->_params['taigachat']['publichtml'])) {
         $template->setLanguageId(XenForo_Phrase::getLanguageId());
         $template->setStyleId($options->defaultStyleId);
     }
     $outputOnlineUsers = $template->render();
     $params = array("robots" => $robots, "messages" => $outputMessages, "messageIds" => $this->_params['taigachat']['messageIds'], "onlineUsers" => $outputOnlineUsers, "reverse" => $options->dark_taigachat_direction, "lastrefresh" => $maxUpdate, "motd" => $this->_params['taigachat']['motd'], "numInChat" => $this->_params['taigachat']['numInChat'], "twelveHour" => $twelveHour);
     if (!empty($this->_params['taigachat']['publichtml'])) {
         $params += array("_visitor_conversationsUnread" => "IGNORE", "_visitor_alertsUnread" => "IGNORE");
     }
     $jsonOutput = XenForo_ViewRenderer_Json::jsonEncodeForOutput($params, empty($this->_params['taigachat']['publichtml']));
     if (empty($this->_params['taigachat']['publichtml'])) {
         $extraHeaders = XenForo_Application::gzipContentIfSupported($jsonOutput);
         foreach ($extraHeaders as $extraHeader) {
             header("{$extraHeader['0']}: {$extraHeader['1']}", $extraHeader[2]);
         }
     }
     return $jsonOutput;
 }
Пример #19
0
 public function renderJson()
 {
     $message = $this->_params['post'];
     if (!empty($message['likes'])) {
         $params = array('message' => $message, 'likesUrl' => XenForo_Link::buildPublicLink('posts/likes', $message));
         $output = $this->_renderer->getDefaultOutputArray(get_class($this), $params, 'likes_summary');
     } else {
         $output = array('templateHtml' => '', 'js' => '', 'css' => '');
     }
     $output += XenForo_ViewPublic_Helper_Like::getLikeViewParams($this->_params['liked']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #20
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     foreach ($this->_params['comments'] as &$comment) {
         $comment['messageHtml'] = new XenForo_BbCode_TextWrapper($comment['message'], $bbCodeParser);
         $comment['message'] = $comment['messageHtml'];
         // sanity check in case template not update
     }
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     $output['date'] = $this->_params['date'];
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #21
0
 public function renderJson()
 {
     $bbCodeFormatter = XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this));
     $parser = new XenForo_BbCode_Parser($bbCodeFormatter);
     $output = array();
     $this->_params['comment']['message'] = sonnb_XenGallery_ViewPublic_Helper::renderGalleryComment($parser, $this->_params['comment']['message']);
     $output['messagesTemplateHtml'] = $this->createTemplateObject('sonnb_xengallery_comment', $this->_params);
     $output['_message'] = nl2br($this->_params['comment']['message']);
     $output['css'] = $output['messagesTemplateHtml']->getRequiredExternals('css');
     $output['js'] = $output['messagesTemplateHtml']->getRequiredExternals('js');
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #22
0
 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;
 }
Пример #23
0
 public function renderJson()
 {
     $content = $this->_params['album'];
     $output = array();
     $output['message'] = isset($this->_params['message']) ? $this->_params['message'] : '';
     if (!empty($content['tagUsers'])) {
         $output['tagList'] = sonnb_XenGallery_Template_Helper_Tag::helperTags($content['tagUsers'], XenForo_Link::buildPublicLink('gallery/albums/tags', $content));
     } else {
         $output['tagList'] = '';
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #24
0
 public function renderJson()
 {
     $options = XenForo_Application::get('options');
     Dark_TaigaChat_Helper_Global::processMessagesForView($this->_params, $this);
     $this->_params['message'] = $this->_params['taigachat']['messages'][0];
     $template = $this->createTemplateObject($this->_templateName, $this->_params);
     $template->setParams($this->_params);
     $rendered = $template->render();
     $params = array("templateHtml" => $rendered, "editId" => $this->_params['taigachat']['editid']);
     $derp = XenForo_ViewRenderer_Json::jsonEncodeForOutput($params, true);
     return $derp;
 }
Пример #25
0
 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     $output['dbtc_transaction_id'] = $this->_params['dbtc_transaction_id'];
     $output['dbtc_thread_id'] = $this->_params['dbtc_thread_id'];
     $output['dbtc_donor_id'] = $this->_params['dbtc_donor_id'];
     $output['dbtc_receiver_id'] = $this->_params['dbtc_receiver_id'];
     $output['dbtc_receiver_avatar_html'] = $this->_params['dbtc_receiver_avatar_html'];
     $output['dbtc_status_id'] = $this->_params['dbtc_status_id'];
     $output['dbtc_receiver_name'] = $this->_params['dbtc_receiver_name'];
     $output['dbtc_date'] = $this->_params['dbtc_date'];
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #26
0
 public function renderViewObject($class, $responseType, array &$params = array(), &$templateName = '')
 {
     $return = parent::renderViewObject($class, $responseType, $params, $templateName);
     if ($return === null) {
         foreach (array_keys($params) as $paramKey) {
             if (strpos($paramKey, '_') === 0) {
                 // filter out internal params
                 unset($params[$paramKey]);
             }
         }
     }
     return $return;
 }
Пример #27
0
 public static function jsonEncodeForOutput($input, $addDefaultParams = true)
 {
     if ($addDefaultParams) {
         self::_addDefaultParams($input);
     }
     foreach (array_keys($input) as $inputKey) {
         if (strpos($inputKey, '_') === 0) {
             // filter out internal params
             unset($input[$inputKey]);
         }
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($input, false);
 }
Пример #28
0
 public function renderJson()
 {
     $content = $this->_params['content'];
     if (!empty($content['likeUsers'])) {
         $params = array('message' => $content, 'likesUrl' => XenForo_Link::buildPublicLink("gallery/{$content['content_type']}s/likes", $content));
         $output = $this->_renderer->getDefaultOutputArray(get_class($this), $params, 'likes_summary');
     } else {
         $output = array('templateHtml' => '', 'js' => '', 'css' => '');
     }
     $output['content'] = $content;
     $output['liked'] = $this->_params['liked'];
     $output += XenForo_ViewPublic_Helper_Like::getLikeViewParams($this->_params['liked']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #29
0
 public function renderJson()
 {
     $content = $this->_params['content'];
     $output = array('image' => array($content['content_id'] => array('content_id' => $content['content_id'], 'tags' => array())));
     if (!empty($content['tagUsers'])) {
         $output['tagList'] = sonnb_XenGallery_Template_Helper_Tag::helperTags($content['tagUsers'], XenForo_Link::buildPublicLink('gallery/' . $content['content_type'] . 's/tags', $content));
         foreach ($content['tagUsers'] as $_tag) {
             $output['image'][$content['content_id']]['tags'][] = array('tag_id' => $_tag['tag_id'], 'username' => $_tag['username'], 'left' => $_tag['tag_x'], 'top' => $_tag['tag_y'], 'url' => XenForo_Link::buildPublicLink('gallery/authors', $_tag), 'isDeleteEnable' => $content['canEdit'] || $_tag['user_id'] == XenForo_Visitor::getUserId());
         }
     } else {
         $output['tagList'] = '';
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Пример #30
0
 public function renderJson()
 {
     if ($this->_params['fetchTags']) {
         $tags = $this->_params['tags'];
         $content = $this->_params['content'];
         $output = array('image' => array($content['content_id'] => array('content_id' => $content['content_id'], 'tags' => array())));
         if ($tags) {
             foreach ($tags as $_tagId => $_tag) {
                 $output['image'][$content['content_id']]['tags'][] = array('tag_id' => $_tagId, 'username' => $_tag['username'], 'left' => $_tag['tag_x'], 'top' => $_tag['tag_y'], 'url' => XenForo_Link::buildPublicLink('gallery/authors', $_tag), 'isDeleteEnable' => $content['canEdit'] || $_tag['user_id'] == XenForo_Visitor::getUserId());
             }
         }
         return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
     }
 }