]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/favorform.php
make performance optimization off by default
[quix0rs-gnu-social.git] / lib / favorform.php
index c67e186974e1241a905d8984e726f4d4bac5c932..eab5ba6e9c84847fda0e31202bcfe4219547d822 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Form for favoring a notice
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Form
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @author    Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @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 <evan@controlyourself.ca>
- * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Sarven Capadisli <csarven@status.net>
  * @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,7 +91,6 @@ class FavorForm extends Form
      *
      * @return void
      */
-
     function sessionToken()
     {
         $this->out->hidden('token-' . $this->notice->id,
@@ -104,16 +98,29 @@ class FavorForm extends Form
     }
 
     /**
-     * Data elements
+     * Legend of the Form
      *
      * @return void
      */
+    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));
+        }
     }
 
     /**
@@ -121,10 +128,24 @@ class FavorForm extends Form
      *
      * @return void
      */
-
     function formActions()
     {
         $this->out->submit('favor-submit-' . $this->notice->id,
-                           _('Make a favorite'));
+                           // 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.'));
     }
-}
\ No newline at end of file
+
+    /**
+     * Class of the form.
+     *
+     * @return string the form's class
+     */
+    function formClass()
+    {
+        return 'form_favor ajax';
+    }
+}