Пример #1
0
 public function singleActivity($activity)
 {
     // we will determine all the user settings based on the activity viewed
     $actor = CFactory::getUser($activity->actor);
     $userId = $activity->actor;
     if ($activity->id == 0 || empty($activity->id)) {
         //redirect this to error : no activity found
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     $document = JFactory::getDocument();
     $document->setTitle(JHTML::_('string.truncate', $activity->title, 75));
     CHeadHelper::setDescription(JHTML::_('string.truncate', $activity->title, 300, true));
     //lets find the image if there is any
     $params = new CParameter($activity->params);
     $headMetaParams = new JRegistry($params->get('headMetas'));
     if ($headMetaParams->get('image')) {
         CHeadHelper::addOpengraph('og:image', $headMetaParams->get('image'));
     } else {
         if (($photo = $actor->getAvatarInfo()) && !$actor->isDefaultAvatar()) {
             CHeadHelper::addOpengraph('og:image', $photo->getImageURI(true));
         } else {
             CHeadHelper::addOpengraph('og:image', JURI::base() . $actor->getAvatar());
         }
     }
     if ($headMetaParams->get('title')) {
         CHeadHelper::addOpengraph('og:title', $headMetaParams->get('title'));
     }
     //see if the user has blocked each other
     $getBlockStatus = new blockUser();
     $blocked = $getBlockStatus->isUserBlocked($userId, 'profile');
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     //everything is fine, lets get to the activity
     echo $this->_getNewsfeedHTML();
 }
Пример #2
0
 /**
  *
  * @param type $app
  * @param type $data
  * @return \CTemplate
  */
 public function setMetaTags($app, $data)
 {
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $description = '';
     $groupName = '';
     if (isset($data->description)) {
         $description = strip_tags($data->description);
     }
     switch ($app) {
         case 'event':
             $description = JHTML::_('string.truncate', CStringHelper::escape($description), $config->getInt('streamcontentlength'));
             $document->addHeadLink($data->getThumbAvatar(), 'image_src', 'rel');
             /* set head meta */
             CHeadHelper::setTitle(JText::sprintf('COM_COMMUNITY_EVENT_PAGE_TITLE', $data->title));
             break;
         case 'video':
             $description = JHTML::_('string.truncate', CStringHelper::escape($description), $config->getInt('streamcontentlength'));
             $document->setMetaData('medium', 'video');
             $document->addHeadLink($data->getThumbnail(), 'image_src', 'rel');
             //cannot exceed 130x110 pixels (facebook)
             /* set head meta */
             CHeadHelper::setTitle($data->title);
             break;
         case 'group':
             $data->title = $data->name;
             $pageTitle = JText::sprintf('COM_COMMUNITY_GROUP_PAGE_TITLE', $data->name);
             if ($data->approvals == COMMUNITY_PRIVATE_GROUP) {
                 $pageTitle .= ' (' . JText::_('COM_COMMUNITY_GROUPS_PRIVATE') . ')';
                 $data->title .= ' (' . JText::_('COM_COMMUNITY_GROUPS_PRIVATE') . ')';
             }
             $description = JText::sprintf('COM_COMMUNITY_GROUP_META_DESCRIPTION', CStringHelper::escape($data->name), $config->get('sitename'), CStringHelper::escape($description));
             $document->addHeadLink($data->getThumbAvatar(), 'image_src', 'rel');
             /* set head meta */
             CHeadHelper::setTitle($pageTitle);
             break;
         default:
             $description = JHTML::_('string.truncate', CStringHelper::escape($description), $config->getInt('streamcontentlength'));
             CHeadHelper::setTitle($data->title);
             // JDocument will perform htmlspecialchars escape
     }
     $document->setMetaData('title', CStringHelper::escape($data->title));
     // hack the above line
     CHeadHelper::setDescription($description);
     // Return this object
     return $this;
 }
Пример #3
0
 public function singleActivity($activity)
 {
     // we will determine all the user settings based on the activity viewed
     $my = CFactory::getUser();
     $userId = $activity->actor;
     if ($activity->id == 0 || empty($activity->id)) {
         //redirect this to error : no activity found
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     $document = JFactory::getDocument();
     $document->setTitle(JHTML::_('string.truncate', $activity->title, 75));
     CHeadHelper::setDescription(JHTML::_('string.truncate', $activity->title, 300, true));
     //see if the user has blocked each other
     $getBlockStatus = new blockUser();
     $blocked = $getBlockStatus->isUserBlocked($userId, 'profile');
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     //everything is fine, lets get to the activity
     echo $this->_getNewsfeedHTML();
 }