/** * @param array $item * @param $content * @param array $viewingUser * @return array */ protected function _prepareNewsFeedItemBeforeAction(array $item, $content, array $viewingUser) { $item = parent::_prepareNewsFeedItemBeforeAction($item, $content, $viewingUser); $item['extra_data'] = @unserialize($item['extra_data']); if ($item['action'] === 'add_photo') { if (!empty($item['extra_data']['photoIds'])) { $fetchOptions = array('join' => sonnb_XenGallery_Model_Photo::FETCH_DATA); $photos = $this->_getPhotoModel()->getContentsByIds($item['extra_data']['photoIds'], $fetchOptions); $photos = $this->_getPhotoModel()->prepareContents($photos, $fetchOptions); foreach ($photos as $photoId => $photo) { if (!$photo['canView']) { unset($photos[$photoId]); } } $item['content']['newPhotos'] = $photos; } } if ($item['action'] === 'add_video') { if (!empty($item['extra_data']['videoIds'])) { $fetchOptions = array('join' => sonnb_XenGallery_Model_Video::FETCH_DATA); $videos = $this->_getVideoModel()->getContentsByIds($item['extra_data']['videoIds'], $fetchOptions); $videos = $this->_getVideoModel()->prepareContents($videos, $fetchOptions); foreach ($videos as $videoId => $video) { if (!$video['canView']) { unset($videos[$videoId]); } } $item['content']['newVideos'] = $videos; } } return $item; }
protected function _prepareNewsFeedItemBeforeAction(array $item, $content, array $viewingUser) { $item = parent::_prepareNewsFeedItemBeforeAction($item, $content, $viewingUser); $item['extra_data'] = @unserialize($item['extra_data']); return $item; }
/** * Fetches an instance of the specified news feed handler class * * @param string $contentType * * @return XenForo_NewsFeedHandler_Abstract */ protected function _getNewsFeedHandlerFromCache($contentType) { $class = $this->_getNewsFeedHandlerForContent($contentType); if (!$class || !class_exists($class)) { return false; } if (!isset($this->_handlerCache[$contentType])) { $this->_handlerCache[$contentType] = XenForo_NewsFeedHandler_Abstract::create($class); } return $this->_handlerCache[$contentType]; }
/** * Fetches an instance of the specified news feed handler class * * @param string $class * * @return XenForo_NewsFeedHandler_Abstract */ protected function _getNewsFeedHandlerFromCache($class) { if (!isset($this->_handlerCache[$class])) { $this->_handlerCache[$class] = XenForo_NewsFeedHandler_Abstract::create($class); } return $this->_handlerCache[$class]; }