1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * @category Phoenix
16: * @package Phoenix_Moneybookers
17: * @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19: */
20: class Phoenix_Moneybookers_Block_Form extends Mage_Payment_Block_Form
21: {
22: /**
23: * Available locales for content URL generation
24: *
25: * @var array
26: */
27: protected $_supportedInfoLocales = array('de');
28:
29: /**
30: * Default locale for content URL generation
31: *
32: * @var string
33: */
34: protected $_defaultInfoLocale = 'en';
35:
36: /**
37: * Constructor. Set template.
38: */
39: protected function _construct()
40: {
41: parent::_construct();
42: $this->setTemplate('moneybookers/form.phtml');
43: }
44:
45: /**
46: * Return payment logo image src
47: *
48: * @param string $payment Payment Code
49: * @return string|bool
50: */
51: public function getPaymentImageSrc($payment)
52: {
53: if ($payment == 'moneybookers_obt') {
54: $payment .= '_'.$this->getInfoLocale();
55: }
56:
57: $imageFilename = Mage::getDesign()
58: ->getFilename('images' . DS . 'moneybookers' . DS . $payment, array('_type' => 'skin'));
59:
60: if (file_exists($imageFilename . '.png')) {
61: return $this->getSkinUrl('images/moneybookers/' . $payment . '.png');
62: } else if (file_exists($imageFilename . '.gif')) {
63: return $this->getSkinUrl('images/moneybookers/' . $payment . '.gif');
64: }
65:
66: return false;
67: }
68:
69: /**
70: * Return supported locale for information text
71: *
72: * @return string
73: */
74: public function getInfoLocale()
75: {
76: $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
77: if (!in_array($locale, $this->_supportedInfoLocales)) {
78: $locale = $this->_defaultInfoLocale;
79: }
80: return $locale;
81: }
82:
83: /**
84: * Return info URL for eWallet payment
85: *
86: * @return string
87: */
88: public function getWltInfoUrl()
89: {
90: $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
91: return 'http://www.moneybookers.com/app/?l=' . strtoupper($locale);
92: }
93: }
94: