Пример #1
0
 /**
  * Calls method from helper file if exists or method from this class,
  * Additionally it Triggers plugin call for specific function in a format RApiHalFunctionName
  *
  * @param   string  $functionName  Function name
  *
  * @return mixed Result from callback function
  */
 public function triggerFunction($functionName)
 {
     $apiHelperClass = RApiPaymentHelper::getExtensionHelperObject($this->extensionName);
     $args = func_get_args();
     // Remove function name from arguments
     array_shift($args);
     // PHP 5.3 workaround
     $temp = array();
     foreach ($args as &$arg) {
         $temp[] =& $arg;
     }
     // We will add this instance of the object as last argument for manipulation in plugin and helper
     $temp[] =& $this;
     JFactory::getApplication()->triggerEvent('RApiRedpaymentBefore' . $functionName, array($functionName, $temp));
     // Checks if that method exists in helper file and executes it
     if (method_exists($apiHelperClass, $functionName)) {
         call_user_func_array(array($apiHelperClass, $functionName), $temp);
     }
     $result = call_user_func_array(array($this, $functionName), $temp);
     JFactory::getApplication()->triggerEvent('RApiRedpaymentAfter' . $functionName, $temp);
     return $result;
 }