/* The current authenticated user */
protected $cur;
+ protected $scoped = null;
/* Title of the document */
protected $title;
{
parent::__construct($items, $url);
- $this->cur = $cur;
+ $this->cur = $cur ?: common_current_user();
+ $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
/* Title of the JSON document */
$this->title = $title;
function addItemFromNotice($notice)
{
- $cur = empty($this->cur) ? common_current_user() : $this->cur;
-
- $act = $notice->asActivity($cur);
- $act->extra[] = $notice->noticeInfo($cur->getProfile());
+ $act = $notice->asActivity($this->scoped);
+ $act->extra[] = $notice->noticeInfo($this->scoped);
array_push($this->items, $act->asArray());
$this->count++;
}
class AtomNoticeFeed extends Atom10Feed
{
var $cur;
+ protected $scoped=null;
/**
* Constructor - adds a bunch of XML namespaces we need in our
function __construct($cur = null, $indent = true) {
parent::__construct($indent);
- $this->cur = $cur;
+ $this->cur = $cur ?: common_current_user();
+ $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
// Feeds containing notice info use these namespaces
$source = $this->showSource();
$author = $this->showAuthor();
- $cur = empty($this->cur) ? common_current_user() : $this->cur;
-
- $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
+ $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped));
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
// we continue on exceptions
$profile = $user->getProfile();
$ao = $profile->asActivityObject();
-
- // quick fix until we start using Profile everywhere instead of User
- $scoped = !is_null($cur) ? $cur->getProfile() : null;
-
- array_push($ao->extra, $profile->profileInfo($scoped));
+
+ array_push($ao->extra, $profile->profileInfo($this->scoped));
$this->addAuthorRaw($ao->asString('author'));
}