Page 1 of 1

Google AdSense for 1.5 without Class suffix

Posted: 17 Sep 2011, 02:32
by aaronrrc
Hello, I found in Phoca Google Adsense for J1.5 (which is a very good module, thanks Jan!) have the class suffix in XML file, but it doesnt in PHP file, so I added some code for the module to get this work, Maybe is not the most efficient code, but works for me...

Code: Select all

<?php
/*
 * @package Joomla 1.5
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 *
 * @module Phoca - Google AdSense Easy
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die('Restricted access');// no direct access

$adsense_code		= trim( $params->get( 'adsense_code' ) );
$ip_block_list		= trim( $params->get( 'ip_block_list' ) );
$alternate_content	= trim( $params->get( 'alternate_content' ) );
$moduleclass_sfx	= trim( $params->get( 'moduleclass_sfx' ) );
$module_css_style	= trim( $params->get( 'module_css_style' ) );
$ip_array 			= explode( ';', $ip_block_list );
$ipa 				= 1;//display
foreach ($ip_array as $value)	{if ($_SERVER["REMOTE_ADDR"] == trim($value)) {$ipa = 0;}}
if ($module_css_style || $moduleclass_sfx)			{echo '<div style="'.$module_css_style.'" class="'.$moduleclass_sfx.'">';}
if ($ipa == 1)					{echo $adsense_code;}
else							{echo $alternate_content;}
if ($module_css_style || $moduleclass_sfx)	{echo '</div>';}
?>

Re: Google AdSense for 1.5 without Class suffix

Posted: 22 Sep 2011, 23:32
by Jan
Hi, thank you for the guide.
Jan