Location: PHPKode > projects > HikaShop > back/classes/payment.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
class hikashopPaymentClass extends hikashopClass{
	var $tables = array('payment');
	var $pkeys = array('payment_id');
	var $toggle = array('payment_published'=>'payment_id');
	function getPayments(&$order){
		static $usable_methods = null;
		if(is_null($usable_methods)){
			JPluginHelper::importPlugin( 'hikashoppayment' );
			$dispatcher =& JDispatcher::getInstance();
			$pluginClass = hikashop::get('class.plugins');
			$methods = $pluginClass->getMethods('payment');
			$max = 0;
			if(empty($methods)){
				$app =& JFactory::getApplication();
				$app->enqueueMessage('Please configure your payment methods');
			}else{
				$already = array();
				foreach($methods as $method){
					if(!empty($method->ordering) && $max<$method->ordering){
						$max=$method->ordering;
					}
				}
				foreach($methods as $k => $method){
					if(empty($method->ordering)){
						$max++;
						$methods[$k]->ordering=$max;
					}
					while(isset($already[$methods[$k]->ordering])){
						$max++;
						$methods[$k]->ordering=$max;
					}
					$already[$methods[$k]->ordering]=true;
				}
				$dispatcher->trigger( 'onPaymentDisplay', array( & $order,&$methods,&$usable_methods ) );
			}
			if(!empty($usable_methods)){
				ksort($usable_methods);
			}
		}
		return $usable_methods;
	}
}
Return current item: HikaShop