diff options
author | Evan Prodromou <evan@status.net> | 2010-08-10 23:36:13 -0700 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-08-10 23:36:13 -0700 |
commit | 41dfea163460bb216483e8e12fff7a8afefbb4fb (patch) | |
tree | 8049f397c1a39b1a49a7a0d3d6eac707f5f13e14 /plugins/Adsense/AdsensePlugin.php | |
parent | 3062cc270607ad60993e5e6d6e3977fab74508b0 (diff) | |
parent | 5c210f724a865830d0c39feba8386f495b18ee4f (diff) |
Merge branch 'master' of gitorious.org:statusnet/mainline
Diffstat (limited to 'plugins/Adsense/AdsensePlugin.php')
-rw-r--r-- | plugins/Adsense/AdsensePlugin.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/Adsense/AdsensePlugin.php b/plugins/Adsense/AdsensePlugin.php index ab2b9a6fb..cd6fc3503 100644 --- a/plugins/Adsense/AdsensePlugin.php +++ b/plugins/Adsense/AdsensePlugin.php @@ -83,6 +83,21 @@ class AdsensePlugin extends UAPPlugin public $adScript = 'http://pagead2.googlesyndication.com/pagead/show_ads.js'; public $client = 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', 'client') as $setting) { + $value = common_config('adsense', strtolower($setting)); + if (!empty($value)) { // not found + $this->$setting = $value; + } + } + } + /** * Show a medium rectangle 'ad' * @@ -157,4 +172,37 @@ class AdsensePlugin extends UAPPlugin $action->script($this->adScript); } + + function onRouterInitialized($m) + { + $m->connect('admin/adsense', + array('action' => 'adsenseadminpanel')); + + return true; + } + + function onAutoload($cls) + { + $dir = dirname(__FILE__); + + switch ($cls) + { + case 'AdsenseadminpanelAction': + require_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; + return false; + default: + return true; + } + } + + function onEndAdminPanelNav($menu) { + if (AdminPanelAction::canAdmin('adsense')) { + // TRANS: Menu item title/tooltip + $menu_title = _('Adsense configuration'); + // TRANS: Menu item for site administration + $menu->out->menuItem(common_local_url('adsenseadminpanel'), _('Adsense'), + $menu_title, $action_name == 'adsenseadminpanel', 'nav_adsense_admin_panel'); + } + return true; + } }
\ No newline at end of file |