diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-25 13:14:33 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-25 13:14:33 -0700 |
commit | b483a0549f115b2d5f2cfb3d447e6cc5c4f469f3 (patch) | |
tree | f63f4f3e93bad7611f4b5651171fc5122ec65455 /plugins/OpenX/OpenXPlugin.php | |
parent | 3b6f738ab73b7f77dd09ac21dd9446876776fc04 (diff) | |
parent | ca489631db840e33757a71a7e4cb56b187c182d3 (diff) |
Merge branch '1.0.x' into schema-x
Conflicts:
plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po
Diffstat (limited to 'plugins/OpenX/OpenXPlugin.php')
-rw-r--r-- | plugins/OpenX/OpenXPlugin.php | 76 |
1 files changed, 69 insertions, 7 deletions
diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php index 59485f25d..5d3bb2306 100644 --- a/plugins/OpenX/OpenXPlugin.php +++ b/plugins/OpenX/OpenXPlugin.php @@ -75,11 +75,26 @@ if (!defined('STATUSNET')) { * * @seeAlso UAPPlugin */ - class OpenXPlugin extends UAPPlugin { public $adScript = null; + function initialize() + { + parent::initialize(); + + // A little bit of chicanery so we avoid overwriting values that + // are passed in with the constructor + foreach (array('mediumRectangle', 'rectangle', 'leaderboard', 'wideSkyscraper', 'adScript') as $setting) { + $value = common_config('openx', $setting); + if (!empty($value)) { // not found + $this->$setting = $value; + } + } + + return true; + } + /** * Show a medium rectangle 'ad' * @@ -87,7 +102,6 @@ class OpenXPlugin extends UAPPlugin * * @return void */ - protected function showMediumRectangle($action) { $this->showAd($action, $this->mediumRectangle); @@ -100,7 +114,6 @@ class OpenXPlugin extends UAPPlugin * * @return void */ - protected function showRectangle($action) { $this->showAd($action, $this->rectangle); @@ -113,7 +126,6 @@ class OpenXPlugin extends UAPPlugin * * @return void */ - protected function showWideSkyscraper($action) { $this->showAd($action, $this->wideSkyscraper); @@ -126,7 +138,6 @@ class OpenXPlugin extends UAPPlugin * * @return void */ - protected function showLeaderboard($action) { $this->showAd($action, $this->leaderboard); @@ -140,7 +151,6 @@ class OpenXPlugin extends UAPPlugin * * @return void */ - protected function showAd($action, $zone) { $scr = <<<ENDOFSCRIPT @@ -162,4 +172,56 @@ ENDOFSCRIPT; $action->inlineScript(sprintf($scr, $this->adScript, $zone)); return true; } -}
\ No newline at end of file + + function onRouterInitialized($m) + { + $m->connect('admin/openx', + array('action' => 'openxadminpanel')); + + return true; + } + + function onAutoload($cls) + { + $dir = dirname(__FILE__); + + switch ($cls) + { + case 'OpenxadminpanelAction': + require_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; + return false; + default: + return true; + } + } + + function onEndAdminPanelNav($menu) { + if (AdminPanelAction::canAdmin('openx')) { + // TRANS: Menu item title/tooltip + $menu_title = _m('OpenX configuration'); + // TRANS: Menu item for site administration + $menu->out->menuItem(common_local_url('openxadminpanel'), _m('OpenX'), + $menu_title, $action_name == 'openxadminpanel', 'nav_openx_admin_panel'); + } + return true; + } + + /** + * Add our version information to output + * + * @param array &$versions Array of version-data arrays + * + * @return boolean hook value + */ + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'OpenX', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:OpenX', + 'rawdescription' => + // TRANS: Plugin description. + _m('Plugin for <a href="http://www.openx.org/">OpenX Ad Server</a>.')); + return true; + } +} |