summaryrefslogtreecommitdiff
path: root/plugins/Adsense/AdsensePlugin.php
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2010-08-16 02:52:23 +0000
committerBrenda Wallace <shiny@cpan.org>2010-08-16 02:52:23 +0000
commit640e7e7c43fa8e9b1a8516b486e560df84bd9887 (patch)
tree26f895ccbdbc4510d377e283a47bf66c52d5d5a7 /plugins/Adsense/AdsensePlugin.php
parentaf4fd327429fcc01769b33ece458a77a37b2463f (diff)
parentc1cab9bfb83496d941f9a4da918d1e9221f3a08a (diff)
Merge commit 'origin/0.9.x' into 0.9.x
Diffstat (limited to 'plugins/Adsense/AdsensePlugin.php')
-rw-r--r--plugins/Adsense/AdsensePlugin.php48
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