summaryrefslogtreecommitdiff
path: root/plugins/OpenX/OpenXPlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-10-18 16:42:43 -0400
committerEvan Prodromou <evan@status.net>2010-10-18 16:42:43 -0400
commit749fe8ca2ec179e01f286d28dbf15251f2a25716 (patch)
treecb099e80784f36caaf45c9316e5d1f878e754726 /plugins/OpenX/OpenXPlugin.php
parente04a6ef93ef7706671ba14f5108690bfe12c1592 (diff)
OpenX plugin admin panel
Diffstat (limited to 'plugins/OpenX/OpenXPlugin.php')
-rw-r--r--plugins/OpenX/OpenXPlugin.php51
1 files changed, 50 insertions, 1 deletions
diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php
index 59485f25d..3206e4c71 100644
--- a/plugins/OpenX/OpenXPlugin.php
+++ b/plugins/OpenX/OpenXPlugin.php
@@ -80,6 +80,22 @@ 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'
*
@@ -162,4 +178,37 @@ 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;
+ }
+}