]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make notice title phpcs-clean
authorEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 19:01:29 +0000 (12:01 -0700)
committerEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 19:01:29 +0000 (12:01 -0700)
plugins/NoticeTitle/NoticeTitlePlugin.php

index c708a9fa0ce452a034b10ee063211fb3ad20d2f2..115e1c14cf102a675e0047917d50b6e82b66cb21 100644 (file)
@@ -69,8 +69,15 @@ class NoticeTitlePlugin extends Plugin
         // For storing titles for notices
 
         $schema->ensureTable('notice_title',
-                             array(new ColumnDef('notice_id', 'integer', null, true, 'PRI'),
-                                   new ColumnDef('title', 'varchar', Notice_title::MAXCHARS, false)));
+                             array(new ColumnDef('notice_id',
+                                                 'integer',
+                                                 null,
+                                                 true,
+                                                 'PRI'),
+                                   new ColumnDef('title',
+                                                 'varchar',
+                                                 Notice_title::MAXCHARS,
+                                                 false)));
 
         return true;
     }
@@ -97,41 +104,79 @@ class NoticeTitlePlugin extends Plugin
         }
     }
 
+    /**
+     * Provide plugin version information.
+     *
+     * This data is used when showing the version page.
+     *
+     * @param array &$versions array of version data arrays; see EVENTS.txt
+     *
+     * @return boolean hook value
+     */
+
     function onPluginVersion(&$versions)
     {
+        $url = 'http://status.net/wiki/Plugin:NoticeTitle';
+
         $versions[] = array('name' => 'NoticeTitle',
                             'version' => NOTICE_TITLE_PLUGIN_VERSION,
                             'author' => 'Evan Prodromou',
-                            'homepage' => 'http://status.net/wiki/Plugin:NoticeTitle',
+                            'homepage' => $url,
                             'rawdescription' =>
                             _m('Adds optional titles to notices'));
         return true;
     }
 
+    /**
+     * Show title entry when showing notice form
+     *
+     * @param Form $form Form being shown
+     *
+     * @return boolean hook value
+     */
+
     function onStartShowNoticeFormData($form)
     {
         $form->out->element('input', array('type' => 'text',
                                            'id' => 'notice_title',
                                            'name' => 'notice_title',
                                            'size' => 40,
-                                           'maxlength' => Notice_title::MAXCHARS,
-                                           'value' => _m('Title'),
-                                           'style' => 'color: 333333',
-                                           'onFocus' => 'this.value = ""; this.style = \'color: black\';'));
+                                           'maxlength' => Notice_title::MAXCHARS));
         return true;
     }
 
+    /**
+     * Validate notice title before saving
+     *
+     * @param Action  $action    NewNoticeAction being executed
+     * @param integer &$authorId Author ID
+     * @param string  &$text     Text of the notice
+     * @param array   &$options  Options array
+     *
+     * @return boolean hook value
+     */
+
     function onStartNoticeSaveWeb($action, &$authorId, &$text, &$options)
     {
         $title = $action->trimmed('notice_title');
         if (!empty($title)) {
             if (mb_strlen($title) > Notice_title::MAXCHARS) {
-                throw new Exception(sprintf(_m("Notice title too long (max %d chars)", Notice_title::MAXCHARS)));
+                throw new Exception(sprintf(_m("Notice title too long (max %d)",
+                                               Notice_title::MAXCHARS)));
             }
         }
         return true;
     }
 
+    /**
+     * Save notice title after notice is saved
+     *
+     * @param Action $action NewNoticeAction being executed
+     * @param Notice $notice Notice that was saved
+     *
+     * @return boolean hook value
+     */
+
     function onEndNoticeSaveWeb($action, $notice)
     {
         if (!empty($notice)) {
@@ -152,6 +197,14 @@ class NoticeTitlePlugin extends Plugin
         return true;
     }
 
+    /**
+     * Show the notice title in lists
+     *
+     * @param NoticeListItem $nli NoticeListItem being shown
+     *
+     * @return boolean hook value
+     */
+
     function onStartShowNoticeItem($nli)
     {
         $title = Notice_title::fromNotice($nli->notice);
@@ -163,6 +216,15 @@ class NoticeTitlePlugin extends Plugin
         return true;
     }
 
+    /**
+     * Show the notice title in RSS output
+     *
+     * @param Notice $notice Notice being shown
+     * @param array  &$entry array of values used for RSS output
+     *
+     * @return boolean hook value
+     */
+
     function onEndRssEntryArray($notice, &$entry)
     {
         $title = Notice_title::fromNotice($notice);
@@ -174,6 +236,16 @@ class NoticeTitlePlugin extends Plugin
         return true;
     }
 
+    /**
+     * Show the notice title in Atom output
+     *
+     * @param Notice      &$notice Notice being shown
+     * @param XMLStringer &$xs     output context
+     * @param string      &$output string to be output as title
+     *
+     * @return boolean hook value
+     */
+
     function onStartActivityTitle(&$notice, &$xs, &$output)
     {
         $title = Notice_title::fromNotice($notice);