[~] Hook::get replaced by Hook::getIdByName

This commit is contained in:
fBrignoli
2011-08-05 14:49:18 +00:00
parent 1816946216
commit d9fa602cc3
6 changed files with 202 additions and 178 deletions
+25 -26
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -111,8 +111,8 @@ class MoneyBookers extends PaymentModule
public function install()
{
if (!parent::install() OR
!$this->registerHook('payment') OR
if (!parent::install() OR
!$this->registerHook('payment') OR
!$this->registerHook('paymentReturn'))
return false;
Configuration::updateValue('MB_HIDE_LOGIN', 1);
@@ -157,28 +157,28 @@ class MoneyBookers extends PaymentModule
'max_redirects' => 10,
'timeout' => $timeout,
'header' => array(
'Accept-language: en',
'Accept-language: en',
'Cookie: foo=bar')));
if (is_callable('curl_init') && ($ch = curl_init()))
{
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$content = curl_exec($ch);
curl_close($ch);
}
else
{
// Check availability of the context options
// Check availability of the context options
if (!is_array($contextOptions) || !count($contextOptions))
$contextOptions = $defaultContextOptions;
// Create a stream context
$stream_context = stream_context_create($contextOptions);
if (($fp = @fopen($url, $mode, false, $stream_context)))
{
$content = fgets($fp, 4096);
@@ -187,7 +187,7 @@ class MoneyBookers extends PaymentModule
else if (!($content = @file_get_contents($url, false, $stream_context)))
if (($fp = @fsockopen($url, 80, $errnom, $errstr, $timeout)))
{
preg_match('@^(?:http://)?([^/]+)@i', $url, $matches);
preg_match('@^(?:http://)?([^/]+)@i', $url, $matches);
$host = $matches[1];
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
@@ -218,7 +218,7 @@ class MoneyBookers extends PaymentModule
if (isset($_POST['mb_email_to_validate']) &&
!empty($_POST['mb_email_to_validate']))
{
try
try
{
$url = 'http://moneybookers.prestashop.com/email_check.php?email='.$_POST['mb_email_to_validate'].'&url=http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__;
$content = $this->_fetchWebContent($url);
@@ -237,7 +237,7 @@ class MoneyBookers extends PaymentModule
}
}
catch(Exception $e)
{
{
$errors[] = $this->l('Unable to contact activation server, please try again later.');
}
}
@@ -317,13 +317,13 @@ class MoneyBookers extends PaymentModule
{
foreach(array('leftColumn', 'rightColumn') as $hookName)
if ($this->isRegisteredInHook($hookName))
$this->unregisterHook(Hook::get($hookName));
$this->unregisterHook(Hook::getIdByName($hookName));
if (Tools::getValue('logo_position') == self::LEFT_COLUMN)
$this->registerHook('leftColumn');
else if (Tools::getValue('logo_position') == self::RIGHT_COLUMN)
$this->registerHook('rightColumn');
}
/* Display errors */
if (sizeof($errors))
{
@@ -351,9 +351,9 @@ class MoneyBookers extends PaymentModule
self::DISABLE => $this->l('Disable'),
self::LEFT_COLUMN => $this->l('Left Column'),
self::RIGHT_COLUMN => $this->l('Right Column'));
$currentLogoBlockPosition = ($this->isRegisteredInHook('leftColumn')) ? self::LEFT_COLUMN :
(($this->isRegisteredInHook('rightColumn')) ? self::RIGHT_COLUMN : -1);
$currentLogoBlockPosition = ($this->isRegisteredInHook('leftColumn')) ? self::LEFT_COLUMN :
(($this->isRegisteredInHook('rightColumn')) ? self::RIGHT_COLUMN : -1);
/* Display settings form */
$output .= '
@@ -368,7 +368,7 @@ class MoneyBookers extends PaymentModule
<fieldset class="width2" style="margin: 20px 0; width: 800px;">
<legend><img src="'.__PS_BASE_URI__.'modules/moneybookers/logo.gif" alt="" />'.$this->l('Settings').'</legend>
<div class="margin-form" style="margin:0; padding:0 0 1em 20px">
<b>'.$this->l('Select the logo position').'</b> :
<b>'.$this->l('Select the logo position').'</b> :
<select name="logo_position">';
foreach($blockPositionList as $position => $translation)
{
@@ -380,8 +380,8 @@ class MoneyBookers extends PaymentModule
$iso_code = strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
$landingPage = ($iso_code == 'en' || $iso_code == 'us') ? 'http://www.moneybookers.com/ads/partners/index.html?p=Prestashop' :
'http://www.moneybookers.com/ads/partners/'.$iso_code.'/index.html?p=Prestashop';
$output .= '
</select>
<p>'.$this->l('Change youpr logo position in the Front Office. Works with').'
@@ -424,7 +424,7 @@ class MoneyBookers extends PaymentModule
<tr><td colspan="3" style="border-top: 1px solid black;"><small>'.$this->l('For merchants over €100,000 fees can be negotiated.').' Contact: ecommerce@moneybookers.com</small></td></tr>
</table>
<br />
'.$this->l('To view the last update of the detailed fees').'<a href="'.$landingPage.'"> <b>'.$this->l('Click here').'</b></a>
'.$this->l('To view the last update of the detailed fees').'<a href="'.$landingPage.'"> <b>'.$this->l('Click here').'</b></a>
<p align="left">
** '.$this->l('Moneybookers eWallet').'<br />
@@ -562,7 +562,7 @@ class MoneyBookers extends PaymentModule
$imgPath = __PS_BASE_URI__.'modules/moneybookers/logo-skrill.png';
return '<div style="text-align:center;"><img src="'.$imgPath.'" width=150 /></div>';
}
public function hookRightColumn($params)
{
return $this->_displayLogoBlock(self::RIGHT_COLUMN);
@@ -597,7 +597,7 @@ class MoneyBookers extends PaymentModule
{
$localMethods = Configuration::get('MB_LOCAL_METHODS');
$interMethods = Configuration::get('MB_INTER_METHODS');
$this->context->smarty->assign(array(
'display_mode' => (int)(Configuration::get('MB_DISPLAY_MODE')),
'local' => $localMethods ? explode('|', $localMethods) : array(),
@@ -662,11 +662,11 @@ class MoneyBookers extends PaymentModule
case _PS_OS_OUTOFSTOCK_:
$this->context->smarty->assign('status', 'ok');
break;
case _PS_OS_BANKWIRE_:
$this->context->smarty->assign('status', 'pending');
break;
case _PS_OS_ERROR_:
default:
$this->context->smarty->assign('status', 'failed');
@@ -677,4 +677,3 @@ class MoneyBookers extends PaymentModule
}
}