Ejemplo n.º 1
0
 /**
  * @return bdSocialShare_Shareable_Abstract
  */
 public function getShareableForRouteMatchAndRequest(XenForo_RouteMatch $routeMatch, Zend_Controller_Request_Http $request)
 {
     $shareable = null;
     switch ($routeMatch->getControllerName()) {
         case 'NFLJ_Showcase_ControllerPublic_Index':
         case 'NFLJ_Showcase_ControllerPublic_Showcase':
             $itemId = $request->getParam('item_id');
             if (!empty($itemId)) {
                 $shareable = bdSocialShare_Shareable_NFLJ_Showcase_Item::createFromId($itemId);
             }
             break;
         case 'sonnb_XenGallery_ControllerPublic_XenGallery_Photo':
             $contentId = $request->getParam('content_id');
             if (!empty($contentId)) {
                 $shareable = bdSocialShare_Shareable_sonnb_XenGallery_Photo::createFromId($contentId);
             }
             break;
         case 'sonnb_XenGallery_ControllerPublic_XenGallery_Video':
             $contentId = $request->getParam('content_id');
             if (!empty($contentId)) {
                 $shareable = bdSocialShare_Shareable_sonnb_XenGallery_Video::createFromId($contentId);
             }
             break;
         case 'XenForo_ControllerPublic_Post':
             $postId = $request->getParam('post_id');
             if (!empty($postId)) {
                 $shareable = bdSocialShare_Shareable_Post::createFromId($postId);
             }
             break;
         case 'XenForo_ControllerPublic_ProfilePost':
             $profilePostId = $request->getParam('profile_post_id');
             if (!empty($profilePostId)) {
                 $shareable = bdSocialShare_Shareable_ProfilePost::createFromId($profilePostId);
             }
             break;
         case 'XenForo_ControllerPublic_Thread':
             $threadId = $request->getParam('thread_id');
             if (!empty($threadId)) {
                 $thread = $this->getModelFromCache('XenForo_Model_Thread')->getThreadById($threadId);
                 if (!empty($thread)) {
                     $shareable = bdSocialShare_Shareable_Post::createFromId($thread['first_post_id']);
                 }
             }
             break;
         case 'XenGallery_ControllerPublic_Media':
             $mediaId = $request->getParam('media_id');
             if (!empty($mediaId)) {
                 $shareable = bdSocialShare_Shareable_XenGallery_Media::createFromId($mediaId);
             }
             break;
         case 'XenResource_ControllerPublic_Resource':
             $resourceId = $request->getParam('resource_id');
             if (!empty($resourceId)) {
                 $shareable = bdSocialShare_Shareable_XenResource_Resource::createFromId($resourceId);
             }
             break;
     }
     return $shareable;
 }