X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOpenX%2FOpenXPlugin.php;h=1d2b9d53e823be18b5aa64086f12caea2c957b3b;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=59485f25d840f41c54c80aacdfb5d5b17bb7dbad;hpb=7ebd13fa69d2a5dac8bc59799281d3d6e017eeae;p=quix0rs-gnu-social.git diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php index 59485f25d8..1d2b9d53e8 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 = <<inlineScript(sprintf($scr, $this->adScript, $zone)); return true; } -} \ No newline at end of file + + function onRouterInitialized(URLMapper $m) + { + $m->connect('panel/openx', + array('action' => 'openxadminpanel')); + + return true; + } + + function onEndAdminPanelNav(Menu $menu) { + if (AdminPanelAction::canAdmin('openx')) { + // TRANS: Menu item title. + $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(array &$versions) + { + $versions[] = array('name' => 'OpenX', + 'version' => GNUSOCIAL_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:OpenX', + 'rawdescription' => + // TRANS: Plugin description. + _m('Plugin for OpenX Ad Server.')); + return true; + } +}