diff options
author | Zach Copley <zach@status.net> | 2010-09-30 13:57:39 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-09-30 13:57:39 -0700 |
commit | 8a28d9cc4de896c154325c8ca0e346d78fc4c510 (patch) | |
tree | fa0241c15999cb6b68c4b14a8354b41581d1bbf1 /lib | |
parent | 8ad933c86f8593e61eea9692f863f9adaa6820b7 (diff) | |
parent | 3224f7fec9906b00684851759fcb476517d14e48 (diff) |
Merge branch 'anon-fave-plugin'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/disfavorform.php | 10 | ||||
-rw-r--r-- | lib/favorform.php | 9 | ||||
-rw-r--r-- | lib/noticelist.php | 52 |
3 files changed, 44 insertions, 27 deletions
diff --git a/lib/disfavorform.php b/lib/disfavorform.php index 5b135b38a..6023766d7 100644 --- a/lib/disfavorform.php +++ b/lib/disfavorform.php @@ -123,9 +123,13 @@ class DisfavorForm extends Form function formData() { - $this->out->hidden('notice-n'.$this->notice->id, - $this->notice->id, - 'notice'); + if (Event::handle('StartDisFavorNoticeForm', array($this, $this->notice))) { + $this->out->hidden('notice-n'.$this->notice->id, + $this->notice->id, + 'notice'); + Event::handle('EndDisFavorNoticeForm', array($this, $this->notice)); + } + } /** diff --git a/lib/favorform.php b/lib/favorform.php index 625df7c8b..4e2891ffd 100644 --- a/lib/favorform.php +++ b/lib/favorform.php @@ -123,9 +123,12 @@ class FavorForm extends Form function formData() { - $this->out->hidden('notice-n'.$this->notice->id, - $this->notice->id, - 'notice'); + if (Event::handle('StartFavorNoticeForm', array($this, $this->notice))) { + $this->out->hidden('notice-n'.$this->notice->id, + $this->notice->id, + 'notice'); + Event::handle('EndFavorNoticeForm', array($this, $this->notice)); + } } /** diff --git a/lib/noticelist.php b/lib/noticelist.php index 529d6a3f9..df1533980 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -226,24 +226,31 @@ class NoticeListItem extends Widget function showNoticeInfo() { $this->out->elementStart('div', 'entry-content'); - $this->showNoticeLink(); - $this->showNoticeSource(); - $this->showNoticeLocation(); - $this->showContext(); - $this->showRepeat(); + if (Event::handle('StartShowNoticeInfo', array($this))) { + $this->showNoticeLink(); + $this->showNoticeSource(); + $this->showNoticeLocation(); + $this->showContext(); + $this->showRepeat(); + Event::handle('EndShowNoticeInfo', array($this)); + } + $this->out->elementEnd('div'); } function showNoticeOptions() { - $user = common_current_user(); - if ($user) { - $this->out->elementStart('div', 'notice-options'); - $this->showFaveForm(); - $this->showReplyLink(); - $this->showRepeatForm(); - $this->showDeleteLink(); - $this->out->elementEnd('div'); + if (Event::handle('StartShowNoticeOptions', array($this))) { + $user = common_current_user(); + if ($user) { + $this->out->elementStart('div', 'notice-options'); + $this->showFaveForm(); + $this->showReplyLink(); + $this->showRepeatForm(); + $this->showDeleteLink(); + $this->out->elementEnd('div'); + } + Event::handle('EndShowNoticeOptions', array($this)); } } @@ -270,15 +277,18 @@ class NoticeListItem extends Widget function showFaveForm() { - $user = common_current_user(); - if ($user) { - if ($user->hasFave($this->notice)) { - $disfavor = new DisfavorForm($this->out, $this->notice); - $disfavor->show(); - } else { - $favor = new FavorForm($this->out, $this->notice); - $favor->show(); + if (Event::handle('StartShowFaveForm', array($this))) { + $user = common_current_user(); + if ($user) { + if ($user->hasFave($this->notice)) { + $disfavor = new DisfavorForm($this->out, $this->notice); + $disfavor->show(); + } else { + $favor = new FavorForm($this->out, $this->notice); + $favor->show(); + } } + Event::handle('EndShowFaveForm', array($this)); } } |