]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/uapplugin.php
If there's no Happening, we can't use the RSVP.
[quix0rs-gnu-social.git] / lib / uapplugin.php
index 5160d9662984245994aa84f3e7b71d17fddf5950..dd72c8723d0224ab9c184d0f8f5416c7cb4226c3 100644 (file)
@@ -28,7 +28,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('STATUSNET')) {
     exit(1);
 }
 
@@ -51,13 +51,12 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
 abstract class UAPPlugin extends Plugin
 {
-    public $MediumRectangle = null;
-    public $Rectangle       = null;
-    public $Leaderboard     = null;
-    public $WideSkyscraper  = null;
+    public $mediumRectangle = null;
+    public $rectangle       = null;
+    public $leaderboard     = null;
+    public $wideSkyscraper  = null;
 
     /**
      * Output our dedicated stylesheet
@@ -66,8 +65,7 @@ abstract class UAPPlugin extends Plugin
      *
      * @return boolean hook flag
      */
-
-    function onEndShowStatusNetStyles($action)
+    public function onEndShowStylesheets(Action $action)
     {
         // XXX: allow override by theme
         $action->cssLink('css/uap.css', 'base', 'screen, projection, tv');
@@ -81,42 +79,74 @@ abstract class UAPPlugin extends Plugin
      *
      * @return boolean hook flag
      */
-
-    function onStartShowAside($action)
+    function onStartShowAside(Action $action)
     {
         if (!is_null($this->mediumRectangle)) {
 
             $action->elementStart('div',
-                                  array('class' => 'ad_medium-rectangle ad'));
+                                  array('id' => 'ad_medium-rectangle',
+                                        'class' => 'ad'));
 
             $this->showMediumRectangle($action);
 
             $action->elementEnd('div');
         }
 
+        // XXX: Hack to force ads to show on single-notice pages
+
+        if (!is_null($this->rectangle) &&
+            $action->trimmed('action') == 'shownotice') {
+
+            $action->elementStart('div', array('id' => 'aside_primary',
+                                               'class' => 'aside'));
+
+            if (Event::handle('StartShowSections', array($action))) {
+                $action->showSections();
+                Event::handle('EndShowSections', array($action));
+            }
+
+            $action->elementEnd('div');
+
+            return false;
+        }
+
         return true;
     }
 
     /**
-     * Add a leaderboard and/or rectangle in the header
+     * Add a leaderboard in the header
      *
      * @param Action $action Action being shown
      *
      * @return boolean hook flag
      */
 
-    function onStartShowHeader($action)
+    function onEndShowHeader($action)
     {
         if (!is_null($this->leaderboard)) {
             $action->elementStart('div',
-                                  array('class' => 'ad_leaderboard ad'));
+                                  array('id' => 'ad_leaderboard',
+                                        'class' => 'ad'));
             $this->showLeaderboard($action);
             $action->elementEnd('div');
         }
 
+        return true;
+    }
+
+    /**
+     * Add a rectangle before aside sections
+     *
+     * @param Action $action Action being shown
+     *
+     * @return boolean hook flag
+     */
+    function onStartShowSections(Action $action)
+    {
         if (!is_null($this->rectangle)) {
             $action->elementStart('div',
-                                  array('class' => 'ad_rectangle ad'));
+                                  array('id' => 'ad_rectangle',
+                                        'class' => 'ad'));
             $this->showRectangle($action);
             $action->elementEnd('div');
         }
@@ -131,12 +161,12 @@ abstract class UAPPlugin extends Plugin
      *
      * @return boolean hook flag
      */
-
-    function onEndShowAside($action)
+    function onEndShowAside(Action $action)
     {
         if (!is_null($this->wideSkyscraper)) {
             $action->elementStart('div',
-                                  array('class' => 'ad_wide-skyscraper ad'));
+                                  array('id' => 'ad_wide-skyscraper',
+                                        'class' => 'ad'));
 
             $this->showWideSkyscraper($action);
 
@@ -152,7 +182,6 @@ abstract class UAPPlugin extends Plugin
      *
      * @return void
      */
-
     abstract protected function showMediumRectangle($action);
 
     /**
@@ -162,7 +191,6 @@ abstract class UAPPlugin extends Plugin
      *
      * @return void
      */
-
     abstract protected function showRectangle($action);
 
     /**
@@ -172,7 +200,6 @@ abstract class UAPPlugin extends Plugin
      *
      * @return void
      */
-
     abstract protected function showWideSkyscraper($action);
 
     /**
@@ -182,6 +209,5 @@ abstract class UAPPlugin extends Plugin
      *
      * @return void
      */
-
     abstract protected function showLeaderboard($action);
 }