Event::handle('EndNoticeSaveWeb', array($this, $notice));
}
+
+ assert($notice instanceof Notice);
+
Event::handle('EndSaveNewNoticeWeb', array($this, $user, &$content_shortened, &$options));
if (StatusNet::isAjax()) {
*
* @return void
*/
- function showNotice($notice)
+ function showNotice(Notice $notice)
{
$nli = new NoticeListItem($notice, $this);
$nli->show();
$id = $this->arg('notice');
$notice = Notice::getKV('id', $id);
+ if ($notice instanceof Notice) {
+ // Alright, got it!
+ return $notice;
+ }
- if (!$notice instanceof Notice) {
- // Did we used to have it, and it got deleted?
- $deleted = Deleted_notice::getKV($id);
- if ($deleted instanceof Deleted_notice) {
- // TRANS: Client error displayed trying to show a deleted notice.
- $this->clientError(_('Notice deleted.'), 410);
- } else {
- // TRANS: Client error displayed trying to show a non-existing notice.
- $this->clientError(_('No such notice.'), 404);
- }
- return false;
+ // Did we use to have it, and it got deleted?
+ $deleted = Deleted_notice::getKV('id', $id);
+ if ($deleted instanceof Deleted_notice) {
+ // TRANS: Client error displayed trying to show a deleted notice.
+ $this->clientError(_('Notice deleted.'), 410);
}
- return $notice;
+ // TRANS: Client error displayed trying to show a non-existing notice.
+ $this->clientError(_('No such notice.'), 404);
}
/**
*
* @param Notice $notice stream of notices from DB_DataObject
*/
- function __construct($notice, $out=null)
+ function __construct(Notice $notice, $out=null)
{
parent::__construct($out);
$this->notice = $notice;
*
* @return NoticeListItem a list item for displaying the notice
*/
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new NoticeListItem($notice, $this->out);
}
*
* @param Notice $notice The notice we'll display
*/
- function __construct($notice, $out=null)
+ function __construct(Notice $notice, HTMLOutputter $out=null)
{
parent::__construct($out);
if (!empty($notice->repeat_of)) {
return null;
}
- function showNotice($notice)
+ function showNotice(Notice $notice)
{
$profile = $notice->getProfile();
if (empty($profile)) {
{
protected $userProfile;
- function __construct($notice, $out=null, $profile=-1)
+ function __construct(Notice $notice, HTMLOutputter $out=null, $profile=-1)
{
parent::__construct($notice, $out);
if (is_int($profile) && $profile == -1) {
*
* @return NoticeListItem a list item for displaying the notice
*/
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new ThreadedNoticeListItem($notice, $this->out, $this->userProfile);
}
{
protected $userProfile = null;
- function __construct($notice, $out=null, $profile=null)
+ function __construct(Notice $notice, HTMLOutputter $out=null, $profile=null)
{
parent::__construct($notice, $out);
$this->userProfile = $profile;
{
protected $root = null;
- function __construct($notice, $root, $out)
+ function __construct(Notice $notice, $root, $out)
{
$this->root = $root;
parent::__construct($notice, $out);
{
protected $cnt;
- function __construct($notice, $out, $cnt)
+ function __construct(Notice $notice, HTMLOutputter $out, $cnt)
{
parent::__construct($notice, $out);
$this->cnt = $cnt;
*
* @return void
*/
- function showNotice($notice)
+ function showNotice(Notice $notice)
{
class_exists('NoticeList'); // @fixme hack for autoloader
$nli = new NoticeListItem($notice, $this);
*
* @return void
*/
- function showNotice($notice)
+ function showNotice(Notice $notice)
{
$nli = new NoticeListItem($notice, $this);
$nli->show();
* open here, but we probably shouldn't open it here. Check parent class
* and Bookmark plugin for if that's right.
*/
- function showNotice($notice, $out)
+ function showNotice(Notice $notice, $out)
{
switch ($notice->object_type) {
case self::POLL_OBJECT:
}
}
- function showNoticePoll($notice, $out)
+ function showNoticePoll(Notice $notice, $out)
{
$user = common_current_user();
$out->elementStart('div', array('class' => 'entry-content'));
}
- function showNoticePollResponse($notice, $out)
+ function showNoticePollResponse(Notice $notice, $out)
{
$user = common_current_user();
*
* @return void
*/
- function showNotice($notice)
+ function showNotice(Notice $notice)
{
class_exists('NoticeList'); // @fixme hack for autoloader
$nli = new NoticeListItem($notice, $this);
* @param Notice $notice
* @param HTMLOutputter $out
*/
- function showNotice($notice, $out)
+ function showNotice(Notice $notice, $out)
{
switch ($notice->object_type) {
case QnA_Question::OBJECT_TYPE:
}
}
- function showNoticeQuestion($notice, $out)
+ function showNoticeQuestion(Notice $notice, $out)
{
$user = common_current_user();
return false;
}
- function showNoticeAnswer($notice, $out)
+ function showNoticeAnswer(Notice $notice, $out)
{
$user = common_current_user();