/** * Output filter to modify the RT sidebar */ function rtOutputFilter($output, &$smarty) { $journal =& Request::getJournal(); if (!$journal) { return $output; } //Get the ad settings. $this->import('OpenAdsConnection'); $openAdsConnection = new OpenAdsConnection($this, $this->getInstallationPath()); $sidebarAdHtml = $openAdsConnection->getAdHtml($this->getSetting($journal->getId(), 'sidebarAdId')); $index = strrpos($output, '<h5>' . __('rt.readingTools') . '</h5>'); if ($index !== false && !empty($sidebarAdHtml)) { $newOutput = substr($output, 0, $index); $newOutput .= $sidebarAdHtml; $newOutput .= substr($output, $index); $output =& $newOutput; } $smarty->unregister_outputfilter('sidebarOutputFilter'); return $output; }
/** * Get the contents of the CMS plugin TOC. * @param $templateMgr object * @return string */ function getContents(&$templateMgr) { $journal =& Request::getJournal(); if (!$journal) { return ''; } // Get the ad settings. $plugin =& $this->getOpenAdsPlugin(); $this->import('OpenAdsConnection'); $openAdsConnection = new OpenAdsConnection($plugin, $plugin->getInstallationPath()); $sidebarAdHtml = $openAdsConnection->getAdHtml($plugin->getSetting($journal->getId(), 'sidebarAdId')); return '<div class="block">' . $sidebarAdHtml . '</div>'; }