* @link http://status.net/
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
-
-require_once INSTALLDIR.'/lib/favorform.php';
-require_once INSTALLDIR.'/lib/disfavorform.php';
-require_once INSTALLDIR.'/lib/attachmentlist.php';
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* widget for displaying a list of notices
$total = count($notices);
$notices = array_slice($notices, 0, NOTICES_PER_PAGE);
- $this->prefill($notices);
+ self::prefill($notices);
foreach ($notices as $notice) {
return new NoticeListItem($notice, $this->out);
}
- function prefill(&$notices)
+ static function prefill(&$notices, $avatarSize=AVATAR_STREAM_SIZE)
{
- // Prefill the profiles
- Notice::fillProfiles($notices);
+ if (Event::handle('StartNoticeListPrefill', array(&$notices, $avatarSize))) {
+
+ // Prefill attachments
+ Notice::fillAttachments($notices);
+ // Prefill attachments
+ Notice::fillFaves($notices);
+ // Prefill repeat data
+ Notice::fillRepeats($notices);
+ // Prefill the profiles
+ $profiles = Notice::fillProfiles($notices);
+
+ $p = Profile::current();
+ if ($p instanceof Profile) {
+
+ $ids = array();
+
+ foreach ($notices as $notice) {
+ $ids[] = $notice->id;
+ }
+
+ Fave::pivotGet('notice_id', $ids, array('user_id' => $p->id));
+ Notice::pivotGet('repeat_of', $ids, array('profile_id' => $p->id));
+ }
+
+ Event::handle('EndNoticeListPrefill', array(&$notices, &$profiles, $avatarSize));
+ }
}
}