* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7541 $
* @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;
require (_PS_MODULE_DIR_.'trustedshops/lib/AbsTrustedShops.php');
require (_PS_MODULE_DIR_.'trustedshops/lib/TrustedShopsRating.php');
require (_PS_MODULE_DIR_.'trustedshops/lib/TSBuyerProtection.php');
class TrustedShops extends Module
{
/**
* Saved each Object needed list of AbsTrustedShops extended objects
* @var array
*/
private static $objects_list = array();
private $errors = array();
private $warnings = array();
public $limited_countries = array();
private $confirmations = array();
public function __construct()
{
global $smarty;
$this->name = 'trustedshops';
$this->tab = 'payment_security';
$this->version = 1.3;
parent::__construct();
if (empty(self::$objects_list))
{
TSBuyerProtection::setTranslationObject($this);
$obj_ts_rating = new TrustedShopsRating();
$obj_ts_buyerprotection = new TSBuyerProtection();
$obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD);
self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection);
self::$objects_list[0]->setModuleName($this->name);
self::$objects_list[0]->setSmarty($smarty);
}
if (!extension_loaded('soap'))
$this->warnings[] = $this->l('This module requires the SOAP PHP extension to function properly.');
foreach (self::$objects_list as $object)
{
$this->limited_countries = array_merge($this->limited_countries, $object->limited_countries);
if (!empty($object->warnings))
$this->warnings = array_merge($this->warnings, $object->warnings);
}
if (!empty($this->warnings))
$this->warning = implode(',
', $this->warnings).'.';
$this->displayName = $this->l('Trusted Shops trust solutions');
$this->description = $this->l('Build confidence in your online shop with the Trusted Shops quality seal, buyer protection and customer rating.');
$this->confirmUninstall = $this->l('Are you sure you want to delete all your settings?');
}
public function install()
{
$return = true;
foreach (self::$objects_list as $object)
{
$return = $object->install();
if (!$return)
break;
}
$return = ($return) ? (parent::install() AND $this->registerHook('orderConfirmation') AND $this->registerHook('newOrder') AND $this->registerHook('rightColumn') AND $this->registerHook('paymentTop') AND $this->registerHook('orderConfirmation')) : $return;
$id_hook = Hook::get('payment');
$this->updatePosition($id_hook, 0, 1);
return $return;
}
public function uninstall()
{
$return = true;
foreach (self::$objects_list as $object)
{
$return = $object->uninstall();
if (!$return)
break;
}
$return = ($return) ? parent::uninstall() : $return;
return $return;
}
public function getContent()
{
$out = '