This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 8.2 KiB |
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @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 BlockAdvertising extends Module
|
||||
{
|
||||
public $adv_link;
|
||||
/**
|
||||
* adv_img contains url to the image to display.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $adv_img;
|
||||
|
||||
/**
|
||||
* adv_imgname is the filename of the image to display
|
||||
* @TODO make it configurable for SEO, but need a function to clean filename
|
||||
* @var string
|
||||
*/
|
||||
public $adv_imgname = 'advertising_custom';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockadvertising';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = 0.2;
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Block advertising');
|
||||
$this->description = $this->l('Adds a block to display an advertisement.');
|
||||
|
||||
$current_dir = defined('__DIR__')?__DIR__:dirname(__FILE__);
|
||||
if (!file_exists($current_dir.'/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))
|
||||
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/advertising.jpg';
|
||||
else
|
||||
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT');
|
||||
$this->adv_link = htmlentities(Configuration::get('BLOCKADVERT_LINK'), ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
|
||||
public function install()
|
||||
{
|
||||
Configuration::updateValue('BLOCKADVERT_LINK', 'http://www.prestashop.com');
|
||||
if (!parent::install())
|
||||
return false;
|
||||
if (!$this->registerHook('leftColumn') OR !$this->registerHook('rightColumn'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* _deleteCurrentImg delete current image, (so this will use default image)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _deleteCurrentImg()
|
||||
{
|
||||
// can work before 5.3
|
||||
$current_dir=defined(__DIR__)?__DIR__:dirname(__FILE__);
|
||||
|
||||
if(file_exists($current_dir.'/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))
|
||||
unlink($current_dir.'/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT'));
|
||||
}
|
||||
/**
|
||||
* postProcess update configuration
|
||||
* @TODO adding alt and title attributes for <img> and <a>
|
||||
* @var string
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$errors = '';
|
||||
if (Tools::isSubmit('submitDeleteImgConf'))
|
||||
$this->_deleteCurrentImg();
|
||||
|
||||
if (Tools::isSubmit('submitAdvConf'))
|
||||
{
|
||||
$file = false;
|
||||
if (isset($_FILES['adv_img']) AND isset($_FILES['adv_img']['tmp_name']) AND !empty($_FILES['adv_img']['tmp_name']))
|
||||
{
|
||||
if ($error = checkImage($_FILES['adv_img'], 4000000))
|
||||
$errors .= $error;
|
||||
elseif ($dot_pos = strrpos($_FILES['adv_img']['name'],'.'))
|
||||
{
|
||||
// __DIR__ exists since php 5.3
|
||||
$current_dir = defined(__DIR__)?__DIR__:dirname(__FILE__);
|
||||
// as checkImage tell us it's a good image, we'll just copy the extension
|
||||
$ext=substr($_FILES['adv_img']['name'], $dot_pos+1);
|
||||
$newname=$this->adv_imgname.'.'.$ext;
|
||||
|
||||
$this->_deleteCurrentImg();
|
||||
|
||||
if (!move_uploaded_file($_FILES['adv_img']['tmp_name'], $current_dir.'/'.$newname))
|
||||
$errors .= $this->l('Error move uploaded file');
|
||||
|
||||
Configuration::updateValue('BLOCKADVERT_IMG_EXT',$ext);
|
||||
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT');
|
||||
}
|
||||
}
|
||||
|
||||
if ($link = Tools::getValue('adv_link'))
|
||||
{
|
||||
Configuration::updateValue('BLOCKADVERT_LINK', $link);
|
||||
$this->adv_link = htmlentities($link, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
if ($errors)
|
||||
echo $this->displayError($errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* getContent used to display admin module form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
global $protocol_content;
|
||||
|
||||
$this->postProcess();
|
||||
$output = '';
|
||||
$output .= '
|
||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" enctype="multipart/form-data">
|
||||
<fieldset><legend>'.$this->l('Advertising block configuration').'</legend>
|
||||
<a href="'.$this->adv_link.'" target="_blank" title="'.$this->l('Advertising').'">';
|
||||
if ($this->adv_img)
|
||||
$output .= '<img src="'.$protocol_content.$this->adv_img.'" alt="'.$this->l('Advertising image').'" style="height:163px;margin-left: 100px;width:163px"/>';
|
||||
else
|
||||
$output .= $this->l('no image');
|
||||
$output .= '</a>';
|
||||
if ($this->adv_img)
|
||||
$output .= '<input class="button" type="submit" name="submitDeleteImgConf" value="'.$this->l('Delete image').'" style=""/>';
|
||||
$output .= '<br/>
|
||||
<br/>
|
||||
<label for="adv_img">'.$this->l('Change image').' </label><input id="adv_img" type="file" name="adv_img" />
|
||||
( '.$this->l('Image will be displayed as 155x163').' )
|
||||
<br/>
|
||||
<br class="clear"/>
|
||||
<label for="adv_link">'.$this->l('Image link').' </label><input id="adv_link" type="text" name="adv_link" value="'.$this->adv_link.'" />
|
||||
<br class="clear"/>
|
||||
<br/>
|
||||
<input class="button" type="submit" name="submitAdvConf" value="'.$this->l('validate').'" style="margin-left: 200px;"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
';
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns module content
|
||||
*
|
||||
* @param array $params Parameters
|
||||
* @return string Content
|
||||
*/
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
global $smarty, $protocol_content;
|
||||
|
||||
Tools::addCSS(($this->_path).'blockadvertising.css', 'all');
|
||||
$smarty->assign('image', $protocol_content.$this->adv_img);
|
||||
$smarty->assign('adv_link', $this->adv_link);
|
||||
|
||||
return $this->display(__FILE__, 'blockadvertising.tpl');
|
||||
}
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
return $this->hookRightColumn($params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<!-- MODULE Block advertising -->
|
||||
<div class="advertising_block">
|
||||
<a href="{$adv_link}" title="{l s='Advertising' mod='blockadvertising'}"><img src="{$image}" alt="{l s='Advertising' mod='blockadvertising'}" width="155" height="163" /></a>
|
||||
</div>
|
||||
<!-- /MODULE Block advertising -->
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockadvertising</name>
|
||||
<displayName>Block advertising</displayName>
|
||||
<version>0.2</version>
|
||||
<description>Adds a block to display an advertisement.</description>
|
||||
<author>PrestaShop</author>
|
||||
<tab>advertising_marketing</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
</module>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_fd4c71c948857cce596a69fbaea7426b'] = 'Werbeblock';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_a7339a98fd0ebea5ed982f92eed11c70'] = 'Fügt einen block für Werbeanzeigen hinzu';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_226ed577d0eff50725be6447bcd5a2f0'] = 'Fehler bewegt hochgeladene Datei';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_6e7be6d836003f069c00cd217660913b'] = 'Werbeblock-Konfiguration';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_2ce5fc289845ce826261032b9c6749ea'] = 'Werbung';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_93d5113a3d56b880522391fd049128f6'] = 'Werbebild';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_706bebc78ad992a07e4c1ce0f39def81'] = 'kein Bild';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_83b5a65e518c21ed0a5f2b383dd9b617'] = 'Bild löschen';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_8c38cf08a0d0a01bd44c682479432350'] = 'Bild ändern';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_56d9dfa26d7848a3fbcd2ae3091d38d9'] = 'Bild wird mit 155x163 gezeigt';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_9ce38727cff004a058021a6c7351a74a'] = 'Bild-Link';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_f9ab05454998236921a6b0e281fae632'] = 'bestätigen';
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_fd4c71c948857cce596a69fbaea7426b'] = 'Bloque de publicidad';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_a7339a98fd0ebea5ed982f92eed11c70'] = 'Añadir un bloque para mostrar la publicidad';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_226ed577d0eff50725be6447bcd5a2f0'] = 'error al desplazar el fichero uploado';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_6e7be6d836003f069c00cd217660913b'] = 'Configuración del bloque de publicidad';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_2ce5fc289845ce826261032b9c6749ea'] = 'Publicidad';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_93d5113a3d56b880522391fd049128f6'] = 'Imagen de la publicidad';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_706bebc78ad992a07e4c1ce0f39def81'] = 'Ninguna imagen';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_83b5a65e518c21ed0a5f2b383dd9b617'] = 'Eliminar la imagen';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_8c38cf08a0d0a01bd44c682479432350'] = 'Cambiar la imagen';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_56d9dfa26d7848a3fbcd2ae3091d38d9'] = 'La imagen se mostrará como 155x163';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_9ce38727cff004a058021a6c7351a74a'] = 'Enlace de la imagen';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_f9ab05454998236921a6b0e281fae632'] = 'Validar';
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_fd4c71c948857cce596a69fbaea7426b'] = 'Bloc publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_a7339a98fd0ebea5ed982f92eed11c70'] = 'Ajoute un bloc affichant une publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_226ed577d0eff50725be6447bcd5a2f0'] = 'Erreur de deplacement du fichier uploadé';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_6e7be6d836003f069c00cd217660913b'] = 'Configuration du bloc de publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_2ce5fc289845ce826261032b9c6749ea'] = 'Publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_93d5113a3d56b880522391fd049128f6'] = 'Image de la publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_706bebc78ad992a07e4c1ce0f39def81'] = 'Pas d\'image';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_83b5a65e518c21ed0a5f2b383dd9b617'] = 'supprimer l\'image';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_8c38cf08a0d0a01bd44c682479432350'] = 'Changer l\'image';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_56d9dfa26d7848a3fbcd2ae3091d38d9'] = 'l\'image sera affiché en 155x163';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_9ce38727cff004a058021a6c7351a74a'] = 'Lien de l\'image';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_f9ab05454998236921a6b0e281fae632'] = 'valider';
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_fd4c71c948857cce596a69fbaea7426b'] = 'Blocco pubblicità';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_a7339a98fd0ebea5ed982f92eed11c70'] = 'Aggiunge un blocco per visualizzare un messaggio pubblicitario';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_226ed577d0eff50725be6447bcd5a2f0'] = 'Errore sposta il file caricato';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_6e7be6d836003f069c00cd217660913b'] = 'Pubblicità blocco di configurazione';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_2ce5fc289845ce826261032b9c6749ea'] = 'Pubblicità';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_93d5113a3d56b880522391fd049128f6'] = 'Pubblicità immagine';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_706bebc78ad992a07e4c1ce0f39def81'] = 'nessuna immagine';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_83b5a65e518c21ed0a5f2b383dd9b617'] = 'elimina l\'immagine';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_8c38cf08a0d0a01bd44c682479432350'] = 'Cambia immagine';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_56d9dfa26d7848a3fbcd2ae3091d38d9'] = 'immagine verrà visualizzata come 155x163';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_9ce38727cff004a058021a6c7351a74a'] = 'Immagine Link';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_f9ab05454998236921a6b0e281fae632'] = 'convalidare';
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
Reference in New Issue
Block a user