Source Code Documentation


s2member-pro\includes\classes\paypal-extras.inc.php


  1. <?php
  2. /**
  3. * PayPal® Standard extras ( introduced by s2Member Pro ).
  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\PayPal
  31. * @since 110604
  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_paypal_extras"))
  37. {
  38. /**
  39. * PayPal® Standard extras ( introduced by s2Member Pro ).
  40. *
  41. * @package s2Member\PayPal
  42. * @since 110604
  43. */
  44. class c_ws_plugin__s2member_pro_paypal_extras
  45. {
  46. /**
  47. * Adds extra default Attributes for PayPal® Button Shortcodes.
  48. *
  49. * @package s2Member\PayPal
  50. * @since 110604
  51. *
  52. * @attaches-to ``add_filter("ws_plugin__s2member_sc_paypal_button_default_attrs");``
  53. *
  54. * @param array $default_attrs An array of default Attributes, passed through by the Filter.
  55. * @param array $vars An array of defined variables, passed through by the Filter.
  56. * @return array The array of ``$default_attrs``, after adding extras.
  57. */
  58. public static function paypal_button_default_attrs ($default_attrs = FALSE, $vars = FALSE)
  59. {
  60. return array_merge ((array)$default_attrs, array ("success" => ""));
  61. }
  62. /**
  63. * Cleans up extra Attributes in PayPal® Button Shortcodes.
  64. *
  65. * @package s2Member\PayPal
  66. * @since 110604
  67. *
  68. * @attaches-to ``add_action("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts");``
  69. *
  70. * @param array $vars An array of defined variables, passed in by the Action Hook.
  71. * @return null
  72. */
  73. public static function paypal_button_after_attrs ($vars = FALSE)
  74. {
  75. $attr = &$vars["__refs"]["attr"]; /* By reference. */
  76. /**/
  77. $attr["success"] = str_ireplace (array ("&#038;", "&amp;"), "&", $attr["success"]);
  78. /**/
  79. return; /* Return for uniformity. */
  80. }
  81. /**
  82. * Handles Success Return URL for PayPal® Button Shortcodes.
  83. *
  84. * @package s2Member\PayPal
  85. * @since 110604
  86. *
  87. * @attaches-to ``add_filter("ws_plugin__s2member_during_sc_paypal_button_success_return_url");``
  88. *
  89. * @param str $success_return_url The current Return URL, passed through by the Filter.
  90. * @param array $vars An array of defined variables, passed through by the Filter.
  91. * @return str The ``$success_return_url``, after possible modification.
  92. */
  93. public static function paypal_button_success_return_url ($success_return_url = FALSE, $vars = FALSE)
  94. {
  95. $attr = $vars["attr"]; /* Shortcode Attributes. */
  96. /**/
  97. if ($attr["success"]) /* Using a custom success return URL? */
  98. return ($success_return_url = add_query_arg ("s2member_paypal_return_success", rawurlencode ($attr["success"]), $success_return_url));
  99. /**/
  100. else /* Else default. */
  101. return $success_return_url;
  102. }
  103. }
  104. }
  105. ?>

s2member-pro\includes\classes\paypal-extras.inc.php

Source Code Documentation