]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/BlankAd/BlankAdPlugin.php
Merge branch 'readme-plugins' into 'nightly'
[quix0rs-gnu-social.git] / plugins / BlankAd / BlankAdPlugin.php
index bf3a225c017e4787c7d5b36d1c8b280ff70f6012..fbcf70bb03093711f29bf057705e4cd82ad5e60b 100644 (file)
@@ -35,14 +35,13 @@ if (!defined('STATUSNET')) {
  * Plugin for testing ad layout
  *
  * This plugin uses the UAPPlugin framework to output ad content. However,
- * its ad content is just paragraphs with defined background colors. It's
- * mostly useful for debugging theme layout.
+ * its ad content is just images with one red pixel stretched to the
+ * right size. It's mostly useful for debugging theme layout.
  *
  * To use this plugin, set the parameter for the ad size you want to use
- * to the background you want to use. For example, to make a leaderboard
- * that's red:
+ * to true (or anything non-null). For example, to make a leaderboard:
  *
- *     addPlugin('BlankAd', array('leaderboard' => 'red'));
+ *     addPlugin('BlankAd', array('leaderboard' => true));
  *
  * @category Plugin
  * @package  StatusNet
@@ -52,7 +51,6 @@ if (!defined('STATUSNET')) {
  *
  * @seeAlso  Location
  */
-
 class BlankAdPlugin extends UAPPlugin
 {
     /**
@@ -62,13 +60,13 @@ class BlankAdPlugin extends UAPPlugin
      *
      * @return void
      */
-
     protected function showMediumRectangle($action)
     {
-        $style = 'width: 300px; height: 250px; background-color: ' .
-          $this->mediumRectangle;
-
-        $action->element('p', array('style' => $style), '');
+        $action->element('img',
+                         array('width' => 300,
+                               'height' => 250,
+                               'src' => $this->path('redpixel.png')),
+                         '');
     }
 
     /**
@@ -78,13 +76,13 @@ class BlankAdPlugin extends UAPPlugin
      *
      * @return void
      */
-
     protected function showRectangle($action)
     {
-        $style = 'width: 180px; height: 150px; background-color: ' .
-          $this->rectangle;
-
-        $action->element('p', array('style' => $style), '');
+        $action->element('img',
+                         array('width' => 180,
+                               'height' => 150,
+                               'src' => $this->path('redpixel.png')),
+                         '');
     }
 
     /**
@@ -94,13 +92,13 @@ class BlankAdPlugin extends UAPPlugin
      *
      * @return void
      */
-
     protected function showWideSkyscraper($action)
     {
-        $style = 'width: 160px; height: 600px; background-color: ' .
-          $this->wideSkyscraper;
-
-        $action->element('p', array('style' => $style), '');
+        $action->element('img',
+                         array('width' => 160,
+                               'height' => 600,
+                               'src' => $this->path('redpixel.png')),
+                         '');
     }
 
     /**
@@ -110,12 +108,24 @@ class BlankAdPlugin extends UAPPlugin
      *
      * @return void
      */
-
     protected function showLeaderboard($action)
     {
-        $style = 'width: 728px; height: 90px; background-color: ' .
-          $this->leaderboard;
+        $action->element('img',
+                         array('width' => 728,
+                               'height' => 90,
+                               'src' => $this->path('redpixel.png')),
+                         '');
+    }
 
-        $action->element('p', array('style' => $style), '');
+    function onPluginVersion(array &$versions)
+    {
+        $versions[] = array('name' => 'BlankAd',
+                            'version' => GNUSOCIAL_VERSION,
+                            'author' => 'Evan Prodromou',
+                            'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/BlankAdPlugin',
+                            'rawdescription' =>
+                            // TRANS: Plugin description.
+                            _m('Plugin for testing ad layout.'));
+        return true;
     }
-}
\ No newline at end of file
+}