]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Awesomeness/AwesomenessPlugin.php
Merge branch 'issue-326' into 'master'
[quix0rs-gnu-social.git] / plugins / Awesomeness / AwesomenessPlugin.php
index 0d7900064db16238ef0581bbf6a0f729d93deb8b..fff833d4ee91380a5358a40f1ed83857eecf48fa 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * StatusNet, the distributed open-source microblogging tool
  *
- * Plugin to add adittional awesomenss to StatusNet
+ * Plugin to add additional awesomenss to StatusNet
  *
  * PHP version 5
  *
@@ -31,8 +31,7 @@ if (!defined('STATUSNET')) {
 }
 
 /**
- * Facebook plugin to add a StatusNet Facebook canvas application
- * and allow registration and authentication via Facebook Connect
+ * Fun sample plugin: tweaks input data and adds a 'Cornify' widget to sidebar.
  *
  * @category Plugin
  * @package  StatusNet
@@ -43,24 +42,23 @@ if (!defined('STATUSNET')) {
 
 class AwesomenessPlugin extends Plugin
 {
-       
-       const VERSION = '0.0.42';
-       
-    public function onPluginVersion(&$versions)
+    const VERSION = '0.0.42';
+
+    public function onPluginVersion(array &$versions)
     {
         $versions[] = array(
             'name' => 'Awesomeness',
             'version' => self::VERSION,
             'author' => 'Jeroen De Dauw',
-            'homepage' => 'http://status.net/wiki/Plugin:Awesomeness',
-            'rawdescription' => _m(
-                'The Awesomeness plugin adds adittional awesomeness ' .
-                'to your StatusNet install. '
+            'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Awesomeness',
+            // TRANS: Plugin description for a sample plugin.
+            'rawdescription' => _m('The Awesomeness plugin adds additional awesomeness ' .
+                'to a StatusNet installation.'
             )
         );
         return true;
     }
-    
+
     /**
      * Add the conrnify button
      *
@@ -68,34 +66,33 @@ class AwesomenessPlugin extends Plugin
      *
      * @return void
      */
-
     function onEndShowSections(Action $action)
-    {   
+    {
         $action->elementStart('div', array('id' => 'cornify_section',
-                                         'class' => 'section'));       
-       
-       $action->raw(
-       <<<EOT
-               <a href="http://www.cornify.com" onclick="cornify_add();return false;">
-               <img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
-               </a>
-       <script type="text/javascript">(function() {
-       var js = document.createElement('script');
-       js.type = 'text/javascript';
-       js.async = true;
-       js.src = 'http://www.cornify.com/js/cornify.js';
-       (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
+                                         'class' => 'section'));
+
+        $action->raw(
+        <<<EOT
+                <a href="http://www.cornify.com" onclick="cornify_add();return false;">
+                <img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
+                </a>
+        <script type="text/javascript">(function() {
+        var js = document.createElement('script');
+        js.type = 'text/javascript';
+        js.async = true;
+        js.src = 'http://www.cornify.com/js/cornify.js';
+        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
 })();</script>
 EOT
-       );    
-       
-       $action->elementEnd('div');
+        );
+
+        $action->elementEnd('div');
     }
-    
+
     /**
      * Hook for new-notice form processing to take our HTML goodies;
      * won't affect API posting etc.
-     * 
+     *
      * @param NewNoticeAction $action
      * @param User $user
      * @param string $content
@@ -104,8 +101,7 @@ EOT
      */
     function onStartSaveNewNoticeWeb($action, $user, &$content, &$options)
     {
-       $content = htmlspecialchars($content);
-       $options['rendered'] = preg_replace("/(^|\s|-)(awesome|awesomeness[\?!\.\,]?)(\s|$)/i", " <b>$2</b> ", $content);
+        $content = htmlspecialchars($content);
+        $options['rendered'] = preg_replace("/(^|\s|-)((?:awesome|awesomeness)[\?!\.\,]?)(\s|$)/i", " <b>$2</b> ", $content);
     }
-       
-}
\ No newline at end of file
+}