00001 <?php 00002 00015 // $Id: OpenAdsBlockPlugin.inc.php,v 1.4 2008/07/01 01:16:13 asmecher Exp $ 00016 00017 00018 import('classes.plugins.BlockPlugin'); 00019 00020 class OpenAdsBlockPlugin extends BlockPlugin { 00025 function getName() { 00026 return 'OpenAdsBlockPlugin'; 00027 } 00028 00033 function getDisplayName() { 00034 return Locale::translate('plugins.generic.openads'); 00035 } 00036 00041 function getDescription() { 00042 return Locale::translate('plugins.generic.openads.description'); 00043 } 00044 00049 function getPluginPath() { 00050 $plugin =& $this->getOpenAdsPlugin(); 00051 return $plugin->getPluginPath(); 00052 } 00053 00058 function getTemplatePath() { 00059 $plugin =& $this->getOpenAdsPlugin(); 00060 return $plugin->getTemplatePath(); 00061 } 00062 00067 function getSupportedContexts() { 00068 return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR); 00069 } 00070 00076 function getContents(&$templateMgr) { 00077 $journal =& Request::getJournal(); 00078 if (!$journal) return ''; 00079 00080 // Get the ad settings. 00081 $plugin =& $this->getOpenAdsPlugin(); 00082 $this->import('OpenAdsConnection'); 00083 $openAdsConnection =& new OpenAdsConnection($plugin, $plugin->getInstallationPath()); 00084 $sidebarAdHtml = $openAdsConnection->getAdHtml($plugin->getSetting($journal->getJournalId(), 'sidebarAdId')); 00085 return '<div class="block">' . $sidebarAdHtml . '</div>'; 00086 } 00087 00092 function &getOpenAdsPlugin() { 00093 $plugin =& PluginRegistry::getPlugin('generic', 'OpenAdsPlugin'); 00094 return $plugin; 00095 } 00096 00101 function getEnabled() { 00102 $plugin =& $this->getOpenAdsPlugin(); 00103 return $plugin->getEnabled(); 00104 } 00105 } 00106 00107 ?>
1.5.6