pmpro_getGateway

What gateway should we be using?.

Description

pmpro_getGateway(); 

Usage

  1. if ( !function_exists( 'pmpro_getGateway' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_getGateway(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function pmpro_getGateway() 
  2. //grab from param or options 
  3. if (!empty($_REQUEST[gateway])) 
  4. $gateway = $_REQUEST[gateway]; //gateway passed as param 
  5. elseif (!empty($_REQUEST['review'])) 
  6. $gateway = "paypalexpress"; //if review param assume paypalexpress 
  7. else 
  8. $gateway = pmpro_getOption("gateway"); //get from options 
  9.  
  10. //set valid gateways - the activegatewayin the settings and anygatewayadded through the filter will be allowed 
  11. if(pmpro_getOption("gateway", true) == "paypal") 
  12. $valid_gateways = apply_filters("pmpro_valid_gateways", array("paypal", "paypalexpress")); 
  13. else 
  14. $valid_gateways = apply_filters("pmpro_valid_gateways", array(pmpro_getOption("gateway", true))); 
  15.  
  16. //make sure it's valid 
  17. if(!in_array($gateway, $valid_gateways)) 
  18. $gateway = false; 
  19.  
  20. //filter for good measure 
  21. $gateway = apply_filters('pmpro_get_gateway', $gateway, $valid_gateways); 
  22.  
  23. return $gateway;