* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class GAdsense extends Module { function __construct() { $this->name = 'gadsense'; $this->tab = 'advertising_marketing'; $this->version = '1.1'; $this->author = 'PrestaShop'; $this->displayName = $this->l('Google Adsense'); parent::__construct(); if ($this->id AND !Configuration::get('GADSENSE_ID')) $this->warning = $this->l('You have not yet set your Google Adsense code'); $this->description = $this->l('Integrate Google Adsense script into your shop'); $this->confirmUninstall = $this->l('Are you sure you want to delete your details ?'); } function install() { if (!parent::install() OR !$this->registerHook('home')) return false; return true; } function uninstall() { if (!Configuration::deleteByName('GADSENSE_ID') OR !parent::uninstall()) return false; return true; } public function getContent() { $output = '

'.$this->displayName.'

'; if (Tools::isSubmit('submitGAdsense') AND ($gai = Tools::getValue('gadsense_id'))) { $gai = htmlentities($gai, ENT_COMPAT, 'UTF-8'); Configuration::updateValue('GADSENSE_ID', $gai); $output .= '
'.$this->l('Settings updated').'
'; } return $output.$this->displayForm(); } public function displayForm() { $output = '
'.$this->l('Settings').'

'.$this->l('Example:').'

'; return $output; } function hookLeftColumn($params) { return $this->hookHome($params); } function hookRightColumn($params) { return $this->hookHome($params); } function hookTop($params) { return $this->hookHome($params); } function hookHome($params) { $output = html_entity_decode(Configuration::get('GADSENSE_ID'), ENT_COMPAT, 'UTF-8'); return $output; } }