0byt3m1n1
Path:
/
data
/
applications
/
aps
/
magento
/
1.1.3-2
/
standard
/
htdocs
/
app
/
code
/
core
/
Mage
/
Payment
/
Block
/
Form
/
[
Home
]
File: Cc.php
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_Payment * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Payment_Block_Form_Cc extends Mage_Payment_Block_Form { protected function _construct() { parent::_construct(); $this->setTemplate('payment/form/cc.phtml'); } /** * Retrieve payment configuration object * * @return Mage_Payment_Model_Config */ protected function _getConfig() { return Mage::getSingleton('payment/config'); } /** * Retrieve availables credit card types * * @return array */ public function getCcAvailableTypes() { $types = $this->_getConfig()->getCcTypes(); if ($method = $this->getMethod()) { $availableTypes = $method->getConfigData('cctypes'); if ($availableTypes) { $availableTypes = explode(',', $availableTypes); foreach ($types as $code=>$name) { if (!in_array($code, $availableTypes)) { unset($types[$code]); } } } } return $types; } /** * Retrieve credit card expire months * * @return array */ public function getCcMonths() { $months = $this->getData('cc_months'); if (is_null($months)) { $months[0] = $this->__('Month'); $months = array_merge($months, $this->_getConfig()->getMonths()); $this->setData('cc_months', $months); } return $months; } /** * Retrieve credit card expire years * * @return array */ public function getCcYears() { $years = $this->getData('cc_years'); if (is_null($years)) { $years = $this->_getConfig()->getYears(); $years = array(0=>$this->__('Year'))+$years; $this->setData('cc_years', $years); } return $years; } /** * Retrive has verification configuration * * @return boolean */ public function hasVerification() { if ($this->getMethod()) { $configData = $this->getMethod()->getConfigData('useccv'); if(is_null($configData)){ return true; } return (bool) $configData; } return true; } }