|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /home/pathumthani_integration/p_sdoc/plugins/system/ |
Upload File : |
<?php
/**
* @version 1.0
* @package RokClicky
* @copyright Copyright (C) 2008 RocketTheme, LLC. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* RokClicky Analytics Plugin
*
* @author Andy Miller
* @package RokClicky
* @subpackage System
*/
class plgSystemRokClicky extends JPlugin
{
function plgSystemRokClicky(& $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();
$user =& $mainframe->getUser();
// Only render for HTML output
if ( $doctype !== 'html' ) { return; }
// Don't show if admin tracking is off and we're in admin
if ($mainframe->isAdmin() && $this->params->get('clicky_trackadmin', 0) == 0) return;
ob_start();
$clicky_id = trim($this->params->get('clicky_siteid', 0));
$clicky_dbserver = trim($this->params->get('clicky_dbserver', 'db10'));
$clicky_username = $user->get('name');
$clicky_email = $user->get('email');
$clicky_trackusernames = $this->params->get('clicky_trackusernames');
$clicky_trackemails = $this->params->get('clicky_trackemails');
if ($clicky_id===0) {
echo "<p style=\"text-align:center;color:#999;\">NOTE: Clicky Analytics <b>Site ID</b> is not set, please update this field in the RokClicky Plugin Parameters</p>";
} else {
if ($clicky_trackusernames==1 or $clicky_trackemails==1) {
echo "
<script type='text/javascript'>\n
var clicky_custom = {};
clicky_custom.session = {";
if ($clicky_trackusernames==1) echo "\n username: '". $clicky_username ."'";
if ($clicky_trackusernames==1 and $clicky_trackemails==1) echo ",";
if ($clicky_trackemails==1) echo "\n email: '". $clicky_email ."'";
echo "\n };
</script>\n";
}
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo "
<script src='https://static.getclicky.com/".$clicky_id.".secure.js' type='text/javascript'></script>
<noscript><p><img alt='Clicky' src='https://static.getclicky.com/".$clicky_id."-".$clicky_dbserver.".gif' /></p></noscript>\n";
}
else {
echo "
<script src='http://static.getclicky.com/".$clicky_id.".js' type='text/javascript'></script>
<noscript><p><img alt='Clicky' src='http://static.getclicky.com/".$clicky_id."-".$clicky_dbserver.".gif' /></p></noscript>\n";
}
}
$output = ob_get_clean();
$body = JResponse::getBody();
$body = str_replace('</body>', $output.'</body>', $body);
JResponse::setBody($body);
}
}