* @package RokBox
* @subpackage System
*/
class plgSystemRokBox extends JPlugin
{
function plgSystemRokBox(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterRender()
{
global $mainframe;
$document =& JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ( $doctype !== 'html' ) { return; }
$profiler =& $_PROFILER;
ob_start();
$theme = $this->params->get('theme', 'light');
// Added to prevent loading on the Forums page, where it conflicted and caused a javascript error.
global $option;
if ($option == "com_kunena") {
return;
}
$rokboxJS = $document->baseurl."/plugins/system/rokbox/rokbox.js";
$remoteFolder = $document->baseurl."/plugins/system/rokbox/themes";
$localFolder = dirname($_SERVER['SCRIPT_FILENAME']) . "/plugins/system/rokbox/themes";
if ($theme == 'custom') $theme = $this->params->get('custom-theme', 'sample');
$config_exists = file_exists($localFolder . "/$theme/rokbox-config.js");
echo "\r\n";
echo "\r\n";
// Load style for ie6 or ie7 if exist
$browser = $this->getBrowser();
if ($browser == 7 || $browser == 6) {
if (file_exists($localFolder . "/$theme/rokbox-style-ie$browser.php")) {
echo "\r\n";
}
elseif (file_exists($localFolder . "/$theme/rokbox-style-ie$browser.css")) {
echo "\r\n";
}
}
if ($this->params->get('custom-legacy', 0) == 1) {
$this->loadManualConfiguration($theme);
} else {
if ($config_exists) {
echo "\r\n";
} else
$this->loadManualConfiguration($theme);
}
$output = ob_get_clean();
$body = JResponse::getBody();
$body = str_replace('', $output.'', $body);
JResponse::setBody($body);
}
function getBrowser()
{
$agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : false;
$ie_version = false;
if (eregi("msie", $agent) && !eregi("opera", $agent)){
$val = explode(" ",stristr($agent, "msie"));
$ver = explode(".", $val[1]);
$ie_version = $ver[0];
$ie_version = ereg_replace("[^0-9,.,a-z,A-Z]", "", $ie_version);
}
return $ie_version;
}
function loadManualConfiguration($theme)
{
echo "\r\n";
}
}