Google AdSense for 1.5 without Class suffix

Phoca modules - support for all Phoca modules except Phoca Gallery modules
aaronrrc
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 10 Jan 2010, 22:11

Google AdSense for 1.5 without Class suffix

Post 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>';}
?>
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Google AdSense for 1.5 without Class suffix

Post by Jan »

Hi, thank you for the guide.
Jan
If you find Phoca extensions useful, please support the project
Post Reply