3 * StatusNet, the distributed open-source microblogging tool
5 * UAP (Universal Ad Package) plugin
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Sarven Capadisli <csarven@status.net>
25 * @author Evan Prodromou <evan@status.net>
26 * @copyright 2010 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET') && !defined('LACONICA')) {
36 * Abstract superclass for advertising plugins
38 * Plugins for showing ads should derive from this plugin.
40 * Outputs the following ad types (based on UAP):
42 * Medium Rectangle 300x250
45 * Wide Skyscraper 160x600
49 * @author Sarven Capadisli <csarven@status.net>
50 * @author Evan Prodromou <evan@status.net>
51 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
52 * @link http://status.net/
55 abstract class UAPPlugin extends Plugin
57 public $mediumRectangle = null;
58 public $rectangle = null;
59 public $leaderboard = null;
60 public $wideSkyscraper = null;
63 * Output our dedicated stylesheet
65 * @param Action $action Action being shown
67 * @return boolean hook flag
70 function onEndShowStatusNetStyles($action)
72 // XXX: allow override by theme
73 $action->cssLink('css/uap.css', 'base', 'screen, projection, tv');
78 * Add a medium rectangle ad at the beginning of sidebar
80 * @param Action $action Action being shown
82 * @return boolean hook flag
85 function onStartShowAside($action)
87 if (!is_null($this->mediumRectangle)) {
89 $action->elementStart('div',
90 array('id' => 'ad_medium-rectangle',
93 $this->showMediumRectangle($action);
95 $action->elementEnd('div');
102 * Add a leaderboard in the header
104 * @param Action $action Action being shown
106 * @return boolean hook flag
109 function onEndShowHeader($action)
111 if (!is_null($this->leaderboard)) {
112 $action->elementStart('div',
113 array('id' => 'ad_leaderboard',
115 $this->showLeaderboard($action);
116 $action->elementEnd('div');
123 * Add a rectangle before aside sections
125 * @param Action $action Action being shown
127 * @return boolean hook flag
130 function onStartShowSections($action)
132 if (!is_null($this->rectangle)) {
133 $action->elementStart('div',
134 array('id' => 'ad_rectangle',
136 $this->showRectangle($action);
137 $action->elementEnd('div');
144 * Add a wide skyscraper after the aside
146 * @param Action $action Action being shown
148 * @return boolean hook flag
151 function onEndShowAside($action)
153 if (!is_null($this->wideSkyscraper)) {
154 $action->elementStart('div',
155 array('id' => 'ad_wide-skyscraper',
158 $this->showWideSkyscraper($action);
160 $action->elementEnd('div');
166 * Show a medium rectangle ad
168 * @param Action $action Action being shown
173 abstract protected function showMediumRectangle($action);
176 * Show a rectangle ad
178 * @param Action $action Action being shown
183 abstract protected function showRectangle($action);
186 * Show a wide skyscraper ad
188 * @param Action $action Action being shown
193 abstract protected function showWideSkyscraper($action);
196 * Show a leaderboard ad
198 * @param Action $action Action being shown
203 abstract protected function showLeaderboard($action);