X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ffavorform.php;h=c07ba6df5997010a5300d1b4b831b10a4201383c;hb=37cf7c0e8ccaffb11b743da45eaea4a2897bad94;hp=977f191838d201c6782fe8e65c8b05f31238a589;hpb=8f25e4b48a5a578720baac0bc26dd5b9ba8fe3e3;p=quix0rs-gnu-social.git diff --git a/lib/favorform.php b/lib/favorform.php index 977f191838..c07ba6df59 100644 --- a/lib/favorform.php +++ b/lib/favorform.php @@ -1,6 +1,6 @@ . * * @category Form - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,21 +38,19 @@ require_once INSTALLDIR.'/lib/form.php'; * Form for favoring a notice * * @category Form - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see DisfavorForm */ - class FavorForm extends Form { /** * Notice to favor */ - var $notice = null; /** @@ -61,7 +59,6 @@ class FavorForm extends Form * @param HTMLOutputter $out output channel * @param Notice $notice notice to favor */ - function __construct($out=null, $notice=null) { parent::__construct($out); @@ -74,7 +71,6 @@ class FavorForm extends Form * * @return int ID of the form */ - function id() { return 'favor-' . $this->notice->id; @@ -85,10 +81,9 @@ class FavorForm extends Form * * @return string URL of the action */ - function action() { - common_local_url('favor'); + return common_local_url('favor'); } /** @@ -96,14 +91,12 @@ class FavorForm extends Form * * @return void */ - function sessionToken() { $this->out->hidden('token-' . $this->notice->id, common_session_token()); } - /** * Legend of the Form * @@ -111,21 +104,23 @@ class FavorForm extends Form */ function formLegend() { - $this->out->element('legend', null, _('Delete this notice')); + // TRANS: Form legend for adding the favourite status to a notice. + $this->out->element('legend', null, _('Favor this notice')); } - /** * Data elements * * @return void */ - 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)); + } } /** @@ -133,21 +128,24 @@ class FavorForm extends Form * * @return void */ - function formActions() { $this->out->submit('favor-submit-' . $this->notice->id, - _('Favorite')); + // TRANS: Button text for adding the favourite status to a notice. + _m('BUTTON','Favor'), + 'submit', + null, + // TRANS: Title for button text for adding the favourite status to a notice. + _('Favor this notice')); } - + /** * Class of the form. * * @return string the form's class */ - function formClass() { - return 'notice_favorite'; + return 'form_favor ajax'; } }