示例#1
0
 /**  
  * singleton function used to manage this object  
  *  
  * @param string $mode the mode of operation: live or test
  *  
  * @return object  
  * @static  
  *  
  */
 static function &singleton($mode = 'test', $component, &$paymentProcessor, &$paymentForm = null)
 {
     if (self::$_singleton === null) {
         $config =& CRM_Core_Config::singleton();
         $paymentClass = "CRM_{$component}_" . $paymentProcessor['class_name'];
         $classPath = str_replace('_', '/', $paymentClass) . '.php';
         require_once $classPath;
         self::$_singleton = eval('return ' . $paymentClass . '::singleton( $mode, $paymentProcessor );');
         if ($paymentForm !== null) {
             self::$_singleton->setForm($paymentForm);
         }
     }
     return self::$_singleton;
 }