本文整理汇总了PHP中CActivityStream::getFEED方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::getFEED方法的具体用法?PHP CActivityStream::getFEED怎么用?PHP CActivityStream::getFEED使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActivityStream
的用法示例。
在下文中一共展示了CActivityStream::getFEED方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($data = null)
{
$mainframe = JFactory::getApplication();
$config = CFactory::getConfig();
$document =& JFactory::getDocument();
$document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
$document->setLink(CRoute::_('index.php?option=com_community'));
$my = CFactory::getUser();
CFactory::load('libraries', 'activities');
CFactory::load('helpers', 'string');
$act = new CActivityStream();
$rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// load individual item creator class
$item = new JFeedItem();
// cannot escape the title. it's already formated. we should
// escape it during CActivityStream::add
//$item->title = CStringHelper::escape($row->title);
$item->title = $row->title;
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
$item->description = "<img src=\"{$row->favicon}\" alt=\"\"/> " . $row->title;
$item->date = $row->createdDate;
$item->category = '';
//$row->category;
// Make sure url is absolute
$item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}
}
示例2: profile
/**
* Displays the viewing profile page.
*
* @access public
* @param array An associative array to display the fields
*/
public function profile(&$data)
{
$mainframe = JFactory::getApplication();
$friendsModel = CFactory::getModel('friends');
$showfriends = JRequest::getVar('showfriends', false);
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
$linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$document = JFactory::getDocument();
$document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
$document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
$document->setLink($linkUrl);
include_once JPATH_COMPONENT . '/libraries/activities.php';
$act = new CActivityStream();
$friendIds = $friendsModel->getFriendIds($user->id);
$friendIds = $showfriends ? $friendIds : null;
$rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
// add the avatar image
$rssImage = new JFeedImage();
$rssImage->url = $user->getThumbAvatar();
$rssImage->link = $linkUrl;
$rssImage->width = 64;
$rssImage->height = 64;
$document->image = $rssImage;
//CFactory::load( 'helpers' , 'string' );
//CFactory::load( 'helpers' , 'time' );
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// Get activities link
$pattern = '/<a href=\\"(.*?)\\"/';
preg_match_all($pattern, $row->title, $matches);
// Use activity owner link when activity link is not available
if (!empty($matches[1][1])) {
$linkUrl = $matches[1][1];
} else {
if (!empty($matches[1][0])) {
$linkUrl = $matches[1][0];
}
}
// load individual item creator class
$item = new JFeedItem();
$item->title = $row->title;
$item->link = $linkUrl;
$item->description = "<img src=\"{$row->favicon}\" alt=\"\" /> " . $row->title;
$item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$pattern = '/href="(.*?)index.php/';
$replace = 'href="' . JURI::base() . 'index.php';
$string = $item->description;
$item->description = preg_replace($pattern, $replace, $string);
// loads item info into rss array
$document->addItem($item);
}
}
}