X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ffavorform.php;h=ebf1b5ffc99d98d110c55d2439051feed0b8cd25;hb=0fa00d510626f9131ca94edaf303b4c09691259f;hp=f3a7a97569019e0b635c4fdf1f1cf656826ff905;hpb=4b1cc73a583ce8b73760f6e709c0fc794af1b471;p=quix0rs-gnu-social.git diff --git a/lib/favorform.php b/lib/favorform.php index f3a7a97569..ebf1b5ffc9 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 GNUsocial + * @author Evan Prodromou + * @author Sarven Capadisli + * @author Mikael Nordfeldth + * @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://www.gnu.org/software/social/ */ -if (!defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/form.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Form for favoring a notice * * @category Form - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli + * @package GNUsocial + * @author Evan Prodromou + * @author Sarven Capadisli + * @author Mikael Nordfeldth * @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://www.gnu.org/software/social/ * * @see DisfavorForm */ - class FavorForm extends Form { /** * Notice to favor */ - var $notice = null; /** @@ -61,7 +57,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 +69,6 @@ class FavorForm extends Form * * @return int ID of the form */ - function id() { return 'favor-' . $this->notice->id; @@ -85,7 +79,6 @@ class FavorForm extends Form * * @return string URL of the action */ - function action() { return common_local_url('favor'); @@ -96,14 +89,13 @@ class FavorForm extends Form * * @return void */ - function sessionToken() { $this->out->hidden('token-' . $this->notice->id, - common_session_token()); + common_session_token(), + 'token'); } - /** * Legend of the Form * @@ -111,21 +103,23 @@ class FavorForm extends Form */ function formLegend() { + // 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 +127,24 @@ class FavorForm extends Form * * @return void */ - function formActions() { $this->out->submit('favor-submit-' . $this->notice->id, - _('Favor'), 'submit', null, _('Favor this notice')); + // TRANS: Button text for adding the favourite status to a notice. + _m('BUTTON','Favor'), + 'submit', + null, + // TRANS: Button title for adding the favourite status to a notice. + _('Add this notice to your list of favorite notices.')); } - + /** * Class of the form. * * @return string the form's class */ - function formClass() { - return 'form_favor'; + return 'form_favor ajax'; } }