Source Code Documentation


pro\s2member-pro\includes\classes\gateways.inc.php


  1. <?php
  2. /**
  3. * s2Member Pro Gateways.
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * (coded in the USA)
  8. *
  9. * This WordPress® plugin (s2Member Pro) is comprised of two parts:
  10. *
  11. * o (1) Its PHP code is licensed under the GPL license, as is WordPress®.
  12. * You should have received a copy of the GNU General Public License,
  13. * along with this software. In the main directory, see: /licensing/
  14. * If not, see: {@link http://www.gnu.org/licenses/}.
  15. *
  16. * o (2) All other parts of (s2Member Pro); including, but not limited to:
  17. * the CSS code, some JavaScript code, images, and design;
  18. * are licensed according to the license purchased.
  19. * See: {@link http://www.s2member.com/prices/}
  20. *
  21. * Unless you have our prior written consent, you must NOT directly or indirectly license,
  22. * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module;
  23. * or make an offer to do any of these things. All of these things are strictly
  24. * prohibited with part (2) of the s2Member Pro Module.
  25. *
  26. * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
  27. * (i.e. new features, bug fixes, updates, improvements); along with full access
  28. * to our video tutorial library: {@link http://www.s2member.com/videos/}
  29. *
  30. * @package s2Member\Gateways
  31. * @since 1.5
  32. */
  33. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  34. exit("Do not access this file directly.");
  35.  
  36. if (!class_exists ("c_ws_plugin__s2member_pro_gateways"))
  37. {
  38. /**
  39. * s2Member Pro Gateways.
  40. *
  41. * @package s2Member\Gateways
  42. * @since 1.5
  43. */
  44. class c_ws_plugin__s2member_pro_gateways
  45. {
  46. /**
  47. * Array of available Payment Gateways supported by s2Member Pro.
  48. *
  49. * @package s2Member\Gateways
  50. * @since 1.5
  51. *
  52. * @return array Array of available Payment Gateways.
  53. */
  54. public static function available_gateways () // Payment Gateways available.
  55. {
  56. $gateways = array ("alipay" => "<strong>AliPay®</strong> <em>(w/ Buttons)</em><br />&uarr; supports Buy Now transactions only.", "authnet" => "<strong>Authorize.Net®</strong> <em>(w/ Pro Forms)</em><br />&uarr; supports Buy Now &amp; Recurring Products.", "ccbill" => "<strong>ccBill®</strong> <em>(w/ Buttons)</em><br />&uarr; supports Buy Now &amp; Recurring Products.", "clickbank" => "<strong>ClickBank®</strong> <em>(w/ Buttons)</em><br />&uarr; supports Buy Now &amp; Recurring Products.", "google" => "<strong>Google® Checkout</strong> <em>(w/ Buttons)</em><br />&uarr; supports Buy Now &amp; Recurring Products.", "paypal" => "<strong>PayPal® Website Payments Pro</strong> <em>(w/ Pro Forms)</em><br />&uarr; supports Buy Now &amp; Recurring Products.");
  57.  
  58. return apply_filters ("ws_plugin__s2member_pro_available_gateways", $gateways, get_defined_vars ());
  59. }
  60. /**
  61. * Adds to the list of Payment Gateways in User Profile management panels.
  62. *
  63. * @package s2Member\Gateways
  64. * @since 1.5
  65. *
  66. * @attaches-to ``add_filter("ws_plugin__s2member_profile_s2member_subscr_gateways");``
  67. *
  68. * @param array $gateways Expects an array of Payment Gateways, passed through by the Filter.
  69. * @return array Array of Payment Gateways to appear in Profile editing panels.
  70. */
  71. public static function profile_subscr_gateways ($gateways = FALSE)
  72. {
  73. $available_gateways = array_keys (c_ws_plugin__s2member_pro_gateways::available_gateways ());
  74.  
  75. foreach (($others = array ("alipay" => "AliPay® (code: alipay)", "authnet" => "Authorize.Net® (code: authnet)", "ccbill" => "ccBill® (code: ccbill)", "clickbank" => "ClickBank® (code: clickbank)", "google" => "Google® Checkout (code: google)")) as $other => $gateway)
  76. if (!in_array ($other, $available_gateways))
  77. unset($others[$other]);
  78.  
  79. return apply_filters ("ws_plugin__s2member_pro_profile_subscr_gateways", array_unique (array_merge ((array)$gateways, $others)), get_defined_vars ());
  80. }
  81. /**
  82. * Loads Hooks/Functions/Codes for other Payment Gateways.
  83. *
  84. * @package s2Member\Gateways
  85. * @since 1.5
  86. *
  87. * @attaches-to ``add_action("ws_plugin__s2member_after_loaded");``
  88. *
  89. * @return null
  90. */
  91. public static function load_gateways () // Load Hooks/Functions/Codes for other Gateways.
  92. {
  93. foreach (array_keys (c_ws_plugin__s2member_pro_gateways::available_gateways ()) as $gateway)
  94. if (in_array ($gateway, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_gateways_enabled"]))
  95. {
  96. include_once dirname (dirname (__FILE__)) . "/separates/gateways/" . $gateway . "/" . $gateway . "-hooks.inc.php";
  97. include_once dirname (dirname (__FILE__)) . "/separates/gateways/" . $gateway . "/" . $gateway . "-funcs.inc.php";
  98. include_once dirname (dirname (__FILE__)) . "/separates/gateways/" . $gateway . "/" . $gateway . "-codes.inc.php";
  99. }
  100. return /* Return for uniformity. */;
  101. }
  102. }
  103. }
  104. ?>

pro\s2member-pro\includes\classes\gateways.inc.php

Source Code Documentation