s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 131025

Version Description

= v131025 = (Maintenance Release) Upgrade immediately.

Download this release

Release Info

Developer WebSharks
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 131025
Comparing to
See all releases

Code changes from version 130816 to 131025

Files changed (161) hide show
  1. checksum.txt +1 -1
  2. images/add-icon.fla +0 -0
  3. images/arrow-down-icon.fla +0 -0
  4. images/arrow-up-icon.fla +0 -0
  5. images/bg.fla +0 -0
  6. images/brand-bg.fla +0 -0
  7. images/brand-bg.png +0 -0
  8. images/brand-dark.fla +0 -0
  9. images/brand-donations.fla +0 -0
  10. images/brand-favicon.fla +0 -0
  11. images/brand-favicon.png +0 -0
  12. images/brand-gradient-bg.fla +0 -0
  13. images/brand-icon.fla +0 -0
  14. images/brand-installation.fla +0 -0
  15. images/brand-kb.pspimage +0 -0
  16. images/brand-light.fla +0 -0
  17. images/brand-support.fla +0 -0
  18. images/brand-support.png +0 -0
  19. images/brand-tools.fla +0 -0
  20. images/brand-updates.fla +0 -0
  21. images/brand-upsell-pro.fla +0 -0
  22. images/brand-videos.fla +0 -0
  23. images/brand-xlink.fla +0 -0
  24. images/large-icon.fla +0 -0
  25. images/logo.fla +0 -0
  26. images/wordpress-dark.fla +0 -0
  27. images/wordpress-light.fla +0 -0
  28. includes/classes/auto-eots.inc.php +1 -1
  29. includes/classes/brute-force.inc.php +3 -5
  30. includes/classes/cache.inc.php +1 -1
  31. includes/classes/catgs-sp.inc.php +1 -1
  32. includes/classes/catgs.inc.php +1 -1
  33. includes/classes/constants.inc.php +65 -65
  34. includes/classes/custom-reg-fields.inc.php +4 -4
  35. includes/classes/email-configs.inc.php +5 -5
  36. includes/classes/files-in.inc.php +121 -121
  37. includes/classes/files.inc.php +6 -6
  38. includes/classes/installation.inc.php +4 -4
  39. includes/classes/list-servers.inc.php +12 -12
  40. includes/classes/login-checks.inc.php +209 -0
  41. includes/classes/login-redirects-r.inc.php +27 -11
  42. includes/classes/login-redirects.inc.php +12 -28
  43. includes/classes/menu-pages.inc.php +30 -39
  44. includes/classes/meta-box-saves.inc.php +2 -2
  45. includes/classes/meta-box-security.inc.php +2 -2
  46. includes/classes/meta-boxes.inc.php +2 -2
  47. includes/classes/mms-patches.inc.php +6 -6
  48. includes/classes/no-cache.inc.php +1 -1
  49. includes/classes/op-notices.inc.php +7 -7
  50. includes/classes/option-forces.inc.php +3 -3
  51. includes/classes/pages-sp.inc.php +2 -2
  52. includes/classes/pages.inc.php +2 -2
  53. includes/classes/paypal-notify-in-cart.inc.php +3 -3
  54. includes/classes/paypal-notify-in-express-checkout.inc.php +3 -3
  55. includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +3 -3
  56. includes/classes/paypal-notify-in-send-money.inc.php +3 -3
  57. includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +3 -3
  58. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +4 -4
  59. includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +3 -3
  60. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +6 -6
  61. includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +3 -3
  62. includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +4 -4
  63. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +5 -5
  64. includes/classes/paypal-notify-in-virtual-terminal.inc.php +3 -3
  65. includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +3 -3
  66. includes/classes/paypal-notify-in-web-accept-sp.inc.php +3 -3
  67. includes/classes/paypal-notify-in.inc.php +8 -8
  68. includes/classes/paypal-notify.inc.php +3 -3
  69. includes/classes/paypal-return-in-no-tx-data.inc.php +3 -3
  70. includes/classes/paypal-return-in-proxy-ty-email.inc.php +3 -3
  71. includes/classes/paypal-return-in-proxy-x-preview.inc.php +3 -3
  72. includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +4 -4
  73. includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +5 -5
  74. includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +3 -3
  75. includes/classes/paypal-return-in-web-accept-sp.inc.php +3 -3
  76. includes/classes/paypal-return-in.inc.php +9 -9
  77. includes/classes/paypal-return.inc.php +3 -3
  78. includes/classes/paypal-utilities.inc.php +34 -34
  79. includes/classes/posts-sp.inc.php +2 -2
  80. includes/classes/posts.inc.php +2 -2
  81. includes/classes/ptags-sp.inc.php +1 -1
  82. includes/classes/ptags.inc.php +1 -1
  83. includes/classes/querys.inc.php +8 -7
  84. includes/classes/register-access.inc.php +1 -1
  85. includes/classes/registration-times.inc.php +4 -4
  86. includes/classes/registrations.inc.php +8 -8
  87. includes/classes/roles-caps.inc.php +5 -5
  88. includes/classes/ruris-sp.inc.php +1 -1
  89. includes/classes/ruris.inc.php +1 -1
  90. includes/classes/sc-paypal-button-e.inc.php +11 -11
  91. includes/classes/sc-paypal-button-in.inc.php +7 -7
  92. includes/classes/security.inc.php +3 -3
  93. includes/classes/sp-access.inc.php +1 -1
  94. includes/classes/ssl.inc.php +1 -1
  95. includes/classes/systematics-sp.inc.php +12 -12
  96. includes/classes/systematics.inc.php +10 -10
  97. includes/classes/tracking-codes.inc.php +3 -3
  98. includes/classes/translations.inc.php +1 -1
  99. includes/classes/user-access.inc.php +2 -2
  100. includes/classes/user-deletions.inc.php +3 -3
  101. includes/classes/user-new-in.inc.php +4 -4
  102. includes/classes/user-notes.inc.php +2 -2
  103. includes/classes/user-securities.inc.php +3 -3
  104. includes/classes/users-list-in.inc.php +9 -9
  105. includes/classes/users-list.inc.php +2 -2
  106. includes/classes/utilities.inc.php +4 -4
  107. includes/classes/utils-captchas.inc.php +1 -1
  108. includes/classes/utils-conds.inc.php +5 -5
  109. includes/classes/utils-cur.inc.php +1 -1
  110. includes/classes/utils-dirs.inc.php +5 -5
  111. includes/classes/utils-encryption.inc.php +1 -1
  112. includes/classes/utils-gets.inc.php +4 -3
  113. includes/classes/utils-logs.inc.php +22 -22
  114. includes/classes/utils-s2o.inc.php +7 -7
  115. includes/classes/utils-time.inc.php +2 -2
  116. includes/classes/utils-urls.inc.php +5 -5
  117. includes/classes/utils-users.inc.php +25 -25
  118. includes/classes/wp-footer.inc.php +2 -2
  119. includes/codes.inc.php +1 -1
  120. includes/externals/mailchimp/nc-mcapi.inc.php +2 -2
  121. includes/externals/markdown/nc-markdown.inc.php +2 -2
  122. includes/functions/api-functions.inc.php +84 -84
  123. includes/functions/pluggables.inc.php +1 -1
  124. includes/hooks.inc.php +7 -1
  125. includes/jquery/jquery.json-ps/jquery.json-ps.js +1 -1
  126. includes/jquery/jquery.sprintf/jquery.sprintf.js +1 -1
  127. includes/jquery/jquery.ui-effects/jquery.ui-effects.js +1 -1
  128. includes/menu-pages/api-ops.inc.php +23 -23
  129. includes/menu-pages/down-ops.inc.php +104 -102
  130. includes/menu-pages/els-ops.inc.php +23 -23
  131. includes/menu-pages/gen-ops.inc.php +30 -30
  132. includes/menu-pages/info.inc.php +1 -1
  133. includes/menu-pages/integrations.inc.php +14 -14
  134. includes/menu-pages/js-c-warning.inc.php +2 -2
  135. includes/menu-pages/logs.inc.php +23 -23
  136. includes/menu-pages/menu-pages-s-min.js +1 -1
  137. includes/menu-pages/menu-pages-s.js +9 -9
  138. includes/menu-pages/menu-pages.css +17 -13
  139. includes/menu-pages/menu-pages.js +1 -1
  140. includes/menu-pages/mms-ops.inc.php +13 -13
  141. includes/menu-pages/paypal-buttons.inc.php +50 -50
  142. includes/menu-pages/paypal-ops.inc.php +59 -59
  143. includes/menu-pages/res-ops.inc.php +79 -16
  144. includes/menu-pages/scripting.inc.php +68 -68
  145. includes/menu-pages/start.inc.php +45 -40
  146. includes/menu-pages/trk-ops.inc.php +40 -40
  147. includes/s2member.css +8 -8
  148. includes/s2member.js +1 -1
  149. includes/syscon.inc.php +14 -6
  150. includes/templates/buttons/paypal-cancellation-button.php +1 -1
  151. includes/templates/buttons/paypal-ccaps-checkout-button.php +2 -2
  152. includes/templates/buttons/paypal-checkout-button.php +3 -3
  153. includes/templates/buttons/paypal-sp-checkout-button.php +2 -2
  154. includes/templates/cfg-files/s2member-files-no-gzip.php +2 -2
  155. includes/templates/cfg-files/s2member-files.php +2 -2
  156. includes/templates/options/paypal-membership-ccap-terms.php +1 -1
  157. includes/templates/options/paypal-membership-regular-terms.php +1 -1
  158. includes/translations/s2member.pot +275 -270
  159. readme.txt +25 -40
  160. s2member-o.php +4 -4
  161. s2member.php +22 -22
checksum.txt CHANGED
@@ -1 +1 @@
1
- a1483e3b04ff24591ddc65fac0e7b361
1
+ 14706c88153810667238a28523add0a9
images/add-icon.fla DELETED
Binary file
images/arrow-down-icon.fla DELETED
Binary file
images/arrow-up-icon.fla DELETED
Binary file
images/bg.fla DELETED
Binary file
images/brand-bg.fla DELETED
Binary file
images/brand-bg.png CHANGED
Binary file
images/brand-dark.fla DELETED
Binary file
images/brand-donations.fla DELETED
Binary file
images/brand-favicon.fla DELETED
Binary file
images/brand-favicon.png CHANGED
Binary file
images/brand-gradient-bg.fla DELETED
Binary file
images/brand-icon.fla DELETED
Binary file
images/brand-installation.fla DELETED
Binary file
images/brand-kb.pspimage DELETED
Binary file
images/brand-light.fla DELETED
Binary file
images/brand-support.fla DELETED
Binary file
images/brand-support.png CHANGED
Binary file
images/brand-tools.fla DELETED
Binary file
images/brand-updates.fla DELETED
Binary file
images/brand-upsell-pro.fla DELETED
Binary file
images/brand-videos.fla DELETED
Binary file
images/brand-xlink.fla DELETED
Binary file
images/large-icon.fla DELETED
Binary file
images/logo.fla DELETED
Binary file
images/wordpress-dark.fla DELETED
Binary file
images/wordpress-light.fla DELETED
Binary file
includes/classes/auto-eots.inc.php CHANGED
@@ -113,7 +113,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
113
{
114
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
115
116
- if (is_array ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process)))
117
{
118
foreach /* Go through the array of EOTS. We need to (demote|delete) each of them. */ ($eots as $eot)
119
{
113
{
114
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
115
116
+ if (is_array ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . esc_sql(strtotime ("now")) . "' LIMIT " . $per_process)))
117
{
118
foreach /* Go through the array of EOTS. We need to (demote|delete) each of them. */ ($eots as $eot)
119
{
includes/classes/brute-force.inc.php CHANGED
@@ -82,13 +82,11 @@ if (!class_exists ("c_ws_plugin__s2member_brute_force"))
82
83
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
84
{
85
- $exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
86
- // If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
87
-
88
- $about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
89
-
90
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
91
{
92
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
93
94
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
82
83
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
84
{
85
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
86
{
87
+ $exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
88
+ // If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
89
+ $about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
90
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
91
92
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
includes/classes/cache.inc.php CHANGED
@@ -90,7 +90,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
90
91
$cache_needs_updating = /* Flag for cache update. */ true;
92
}
93
- if /* Cache is also reset dynamically during back-end option updates. */ ($cache_needs_updating)
94
{
95
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
96
}
90
91
$cache_needs_updating = /* Flag for cache update. */ true;
92
}
93
+ if /* Cache is also reset dynamically during back-end option updates. */ (isset($cache_needs_updating) && $cache_needs_updating)
94
{
95
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
96
}
includes/classes/catgs-sp.inc.php CHANGED
@@ -47,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
47
{
48
$cat_uri = /* Get a full valid URI for this Category. */ c_ws_plugin__s2member_utils_urls::parse_uri (get_category_link ($cat_id));
49
50
- if /* Do NOT touch WordPress® Systematics. */ (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri))
51
{
52
$user = /* Current User's object. */(is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
53
47
{
48
$cat_uri = /* Get a full valid URI for this Category. */ c_ws_plugin__s2member_utils_urls::parse_uri (get_category_link ($cat_id));
49
50
+ if /* Do NOT touch WordPress Systematics. */ (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri))
51
{
52
$user = /* Current User's object. */(is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
53
includes/classes/catgs.inc.php CHANGED
@@ -45,7 +45,7 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
45
46
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
48
- if /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */ (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ())
49
{
50
$user = /* Current User's object. */ (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
51
45
46
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
48
+ if /* Do NOT touch WordPress Systematics. This excludes all WordPress Systematics. */ (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ())
49
{
50
$user = /* Current User's object. */ (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
51
includes/classes/constants.inc.php CHANGED
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
31
* Defines several API Constants for s2Member.
32
*
33
* These are also duplicated into the JavaScript API for s2Member.
34
- * Except for a few that would pose a security issue. Such as the PayPal® API Credentials;
35
* those are NOT included in the JavaScript API.
36
*
37
* @package s2Member\API_Constants
@@ -323,7 +323,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
323
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : "")));
324
/**
325
* The current User's Paid Subscription ID (when applicable);
326
- * otherwise, this will contain their WordPress® User ID.
327
*
328
* An empty string if NOT logged-in.
329
*
@@ -908,7 +908,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
908
if (!defined ("S2MEMBER_CURRENT_USER_REGISTRATION_IP"))
909
define ("S2MEMBER_CURRENT_USER_REGISTRATION_IP", ($c[] = (($user) ? (string)$registration_ip : "")));
910
/**
911
- * The current User's WordPress® User ID.
912
*
913
* This will be equal to `0` if NOT logged-in.
914
*
@@ -1510,7 +1510,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1510
/**
1511
* The URL, which logs the current User out of their account.
1512
*
1513
- * This is the value provided by WordPress®. It's the same as using ``wp_logout_url()``.
1514
*
1515
* ———— Quick PHP Code Sample ————
1516
* ```
@@ -1550,7 +1550,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1550
/**
1551
* The URL, where a User can log into their account.
1552
*
1553
- * This is the value provided by WordPress®. It's the same as using ``wp_login_url()``.
1554
*
1555
* ———— Quick PHP Code Sample ————
1556
* ```
@@ -1833,7 +1833,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1833
if (!defined ("S2MEMBER_REG_EMAIL_FROM_EMAIL"))
1834
define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
1835
/**
1836
- * Full URL to PayPal® IPN handler, provided by s2Member.
1837
*
1838
* ———— Quick PHP Code Sample ————
1839
* ```
@@ -1856,12 +1856,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1856
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
1857
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1858
*
1859
- * @see `Dashboard -› s2Member -› PayPal® Options -› IPN Integration`
1860
*/
1861
if (!defined ("S2MEMBER_PAYPAL_NOTIFY_URL"))
1862
define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = (string)site_url ("/?s2member_paypal_notify=1")));
1863
/**
1864
- * Full URL to PayPal® Auto-Return/PDT handler, provided by s2Member.
1865
*
1866
* ———— Quick PHP Code Sample ————
1867
* ```
@@ -1884,12 +1884,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1884
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
1885
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1886
*
1887
- * @see `Dashboard -› s2Member -› PayPal® Options -› Auto-Return/PDT Integration`
1888
*/
1889
if (!defined ("S2MEMBER_PAYPAL_RETURN_URL"))
1890
define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = (string)site_url ("/?s2member_paypal_return=1")));
1891
/**
1892
- * PayPal® Business Email Address; as configured by the site owner.
1893
*
1894
* ———— Quick PHP Code Sample ————
1895
* ```
@@ -1913,12 +1913,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1913
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
1914
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
1915
*
1916
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
1917
*/
1918
if (!defined ("S2MEMBER_PAYPAL_BUSINESS"))
1919
define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
1920
/**
1921
- * PayPal® endpoint domain (changes when Sandbox Mode is enabled).
1922
*
1923
* o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
1924
* o In Production Mode, this is: `www.paypal.com`.
@@ -1943,12 +1943,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1943
*
1944
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
1945
*
1946
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
1947
*/
1948
if (!defined ("S2MEMBER_PAYPAL_ENDPOINT"))
1949
define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
1950
/**
1951
- * PayPal® API endpoint domain (changes when Sandbox Mode is enabled).
1952
*
1953
* o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
1954
* o In Production Mode, this is: `api-3t.paypal.com`.
@@ -1973,12 +1973,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1973
*
1974
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
1975
*
1976
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
1977
*/
1978
if (!defined ("S2MEMBER_PAYPAL_API_ENDPOINT"))
1979
define ("S2MEMBER_PAYPAL_API_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")));
1980
/**
1981
- * PayPal® API Username; as configured by the site owner.
1982
*
1983
* ———— Quick PHP Code Sample ————
1984
* ```
@@ -2001,12 +2001,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2001
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2002
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2003
*
2004
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
2005
*/
2006
if (!defined ("S2MEMBER_PAYPAL_API_USERNAME"))
2007
define ("S2MEMBER_PAYPAL_API_USERNAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]));
2008
/**
2009
- * PayPal® API Password; as configured by the site owner.
2010
*
2011
* ———— Quick PHP Code Sample ————
2012
* ```
@@ -2029,12 +2029,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2029
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2030
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2031
*
2032
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
2033
*/
2034
if (!defined ("S2MEMBER_PAYPAL_API_PASSWORD"))
2035
define ("S2MEMBER_PAYPAL_API_PASSWORD", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]));
2036
/**
2037
- * PayPal® API Signature; as configured by the site owner.
2038
*
2039
* ———— Quick PHP Code Sample ————
2040
* ```
@@ -2057,12 +2057,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2057
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2058
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2059
*
2060
- * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
2061
*/
2062
if (!defined ("S2MEMBER_PAYPAL_API_SIGNATURE"))
2063
define ("S2MEMBER_PAYPAL_API_SIGNATURE", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]));
2064
/**
2065
- * PayPal® PDT Identity Token; as configured by the site owner.
2066
*
2067
* ———— Quick PHP Code Sample ————
2068
* ```
@@ -2084,14 +2084,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2084
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
2085
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
2086
*
2087
- * @see `Dashboard -› s2Member -› PayPal® Options -› Auto-Return/PDT Integration`
2088
*/
2089
if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
2090
define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
2091
/**
2092
- * PayPal® value for Payment Buttons with input name: `invoice`.
2093
*
2094
- * This can be used to auto-fill the `invoice` value in PayPal® Button Codes, with a unique Code~IP combination.
2095
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2096
*
2097
* Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
@@ -2106,20 +2106,20 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2106
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2107
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2108
*
2109
- * They are used by the PayPal® Button Generator for s2Member.
2110
*
2111
- * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2112
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2113
*
2114
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2115
- * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2116
*
2117
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2118
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2119
- * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2120
* you won't even see these, because they're added internally by the Shortcode processor.
2121
*
2122
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2123
*
2124
* Anyway, these five API Constants are just documented here for clarity;
2125
* you probably won't use any of these directly; the Button Generator pops them in.
@@ -2144,16 +2144,16 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2144
*
2145
* @see s2Member\API_Functions\s2member_value_for_pp_inv()
2146
*
2147
- * @see `Dashboard -› s2Member -› PayPal® Buttons`
2148
*/
2149
if (!defined ("S2MEMBER_VALUE_FOR_PP_INV"))
2150
define ("S2MEMBER_VALUE_FOR_PP_INV", uniqid () . "~" . S2MEMBER_CURRENT_USER_IP);
2151
/**
2152
- * PayPal® value for Payment Buttons with input name: `on0`.
2153
*
2154
- * Used in PayPal® Modification Buttons *(i.e. upgrades/downgrades)*.
2155
*
2156
- * This auto-fills the `on0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
2157
* this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
2158
* Otherwise, it will be set to a default value of: "Originating Domain".
2159
*
@@ -2164,20 +2164,20 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2164
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2165
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2166
*
2167
- * They are used by the PayPal® Button Generator for s2Member.
2168
*
2169
- * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2170
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2171
*
2172
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2173
- * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2174
*
2175
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2176
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2177
- * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2178
* you won't even see these, because they're added internally by the Shortcode processor.
2179
*
2180
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2181
*
2182
* Anyway, these five API Constants are just documented here for clarity;
2183
* you probably won't use any of these directly; the Button Generator pops them in.
@@ -2202,16 +2202,16 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2202
*
2203
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
2204
*
2205
- * @see `Dashboard -› s2Member -› PayPal® Buttons`
2206
*/
2207
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0"))
2208
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Referencing Customer ID" : "Originating Domain")));
2209
/**
2210
- * PayPal® value for Payment Buttons with input name: `os0`.
2211
*
2212
- * Used in PayPal® Modification Buttons *(i.e. upgrades/downgrades)*.
2213
*
2214
- * This auto-fills the `os0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
2215
* this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
2216
* Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *(the originating domain name)*.
2217
*
@@ -2222,20 +2222,20 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2222
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2223
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2224
*
2225
- * They are used by the PayPal® Button Generator for s2Member.
2226
*
2227
- * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2228
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2229
*
2230
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2231
- * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2232
*
2233
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2234
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2235
- * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2236
* you won't even see these, because they're added internally by the Shortcode processor.
2237
*
2238
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2239
*
2240
* Anyway, these five API Constants are just documented here for clarity;
2241
* you probably won't use any of these directly; the Button Generator pops them in.
@@ -2260,14 +2260,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2260
*
2261
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
2262
*
2263
- * @see `Dashboard -› s2Member -› PayPal® Buttons`
2264
*/
2265
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0"))
2266
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string)$_SERVER["HTTP_HOST"])));
2267
/**
2268
- * PayPal® value for Payment Buttons with input name: `on1`.
2269
*
2270
- * This auto-fills the `on1` value in PayPal® Button Codes.
2271
* This always contains the string: "Customer IP Address".
2272
*
2273
* These five API Constants are special.
@@ -2277,20 +2277,20 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2277
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2278
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2279
*
2280
- * They are used by the PayPal® Button Generator for s2Member.
2281
*
2282
- * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2283
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2284
*
2285
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2286
- * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2287
*
2288
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2289
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2290
- * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2291
* you won't even see these, because they're added internally by the Shortcode processor.
2292
*
2293
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2294
*
2295
* Anyway, these five API Constants are just documented here for clarity;
2296
* you probably won't use any of these directly; the Button Generator pops them in.
@@ -2315,14 +2315,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2315
*
2316
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
2317
*
2318
- * @see `Dashboard -› s2Member -› PayPal® Buttons`
2319
*/
2320
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1"))
2321
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1", ($c[] = "Customer IP Address" /* Via $_SERVER["REMOTE_ADDR"] below. */));
2322
/**
2323
- * PayPal® value for Payment Buttons with input name: `os1`.
2324
*
2325
- * This auto-fills the `os1` value in PayPal® Button Codes,
2326
* with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
2327
*
2328
* These five API Constants are special.
@@ -2332,20 +2332,20 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2332
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2333
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2334
*
2335
- * They are used by the PayPal® Button Generator for s2Member.
2336
*
2337
- * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2338
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2339
*
2340
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2341
- * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2342
*
2343
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2344
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2345
- * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2346
* you won't even see these, because they're added internally by the Shortcode processor.
2347
*
2348
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2349
*
2350
* Anyway, these five API Constants are just documented here for clarity;
2351
* you probably won't use any of these directly; the Button Generator pops them in.
@@ -2370,7 +2370,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2370
*
2371
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
2372
*
2373
- * @see `Dashboard -› s2Member -› PayPal® Buttons`
2374
*/
2375
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1"))
2376
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
31
* Defines several API Constants for s2Member.
32
*
33
* These are also duplicated into the JavaScript API for s2Member.
34
+ * Except for a few that would pose a security issue. Such as the PayPal API Credentials;
35
* those are NOT included in the JavaScript API.
36
*
37
* @package s2Member\API_Constants
323
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : "")));
324
/**
325
* The current User's Paid Subscription ID (when applicable);
326
+ * otherwise, this will contain their WordPress User ID.
327
*
328
* An empty string if NOT logged-in.
329
*
908
if (!defined ("S2MEMBER_CURRENT_USER_REGISTRATION_IP"))
909
define ("S2MEMBER_CURRENT_USER_REGISTRATION_IP", ($c[] = (($user) ? (string)$registration_ip : "")));
910
/**
911
+ * The current User's WordPress User ID.
912
*
913
* This will be equal to `0` if NOT logged-in.
914
*
1510
/**
1511
* The URL, which logs the current User out of their account.
1512
*
1513
+ * This is the value provided by WordPress. It's the same as using ``wp_logout_url()``.
1514
*
1515
* ———— Quick PHP Code Sample ————
1516
* ```
1550
/**
1551
* The URL, where a User can log into their account.
1552
*
1553
+ * This is the value provided by WordPress. It's the same as using ``wp_login_url()``.
1554
*
1555
* ———— Quick PHP Code Sample ————
1556
* ```
1833
if (!defined ("S2MEMBER_REG_EMAIL_FROM_EMAIL"))
1834
define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
1835
/**
1836
+ * Full URL to PayPal IPN handler, provided by s2Member.
1837
*
1838
* ———— Quick PHP Code Sample ————
1839
* ```
1856
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
1857
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1858
*
1859
+ * @see `Dashboard -› s2Member -› PayPal Options -› IPN Integration`
1860
*/
1861
if (!defined ("S2MEMBER_PAYPAL_NOTIFY_URL"))
1862
define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = (string)site_url ("/?s2member_paypal_notify=1")));
1863
/**
1864
+ * Full URL to PayPal Auto-Return/PDT handler, provided by s2Member.
1865
*
1866
* ———— Quick PHP Code Sample ————
1867
* ```
1884
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
1885
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1886
*
1887
+ * @see `Dashboard -› s2Member -› PayPal Options -› Auto-Return/PDT Integration`
1888
*/
1889
if (!defined ("S2MEMBER_PAYPAL_RETURN_URL"))
1890
define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = (string)site_url ("/?s2member_paypal_return=1")));
1891
/**
1892
+ * PayPal Business Email Address; as configured by the site owner.
1893
*
1894
* ———— Quick PHP Code Sample ————
1895
* ```
1913
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
1914
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
1915
*
1916
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
1917
*/
1918
if (!defined ("S2MEMBER_PAYPAL_BUSINESS"))
1919
define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
1920
/**
1921
+ * PayPal endpoint domain (changes when Sandbox Mode is enabled).
1922
*
1923
* o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
1924
* o In Production Mode, this is: `www.paypal.com`.
1943
*
1944
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
1945
*
1946
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
1947
*/
1948
if (!defined ("S2MEMBER_PAYPAL_ENDPOINT"))
1949
define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
1950
/**
1951
+ * PayPal API endpoint domain (changes when Sandbox Mode is enabled).
1952
*
1953
* o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
1954
* o In Production Mode, this is: `api-3t.paypal.com`.
1973
*
1974
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
1975
*
1976
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
1977
*/
1978
if (!defined ("S2MEMBER_PAYPAL_API_ENDPOINT"))
1979
define ("S2MEMBER_PAYPAL_API_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")));
1980
/**
1981
+ * PayPal API Username; as configured by the site owner.
1982
*
1983
* ———— Quick PHP Code Sample ————
1984
* ```
2001
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2002
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2003
*
2004
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
2005
*/
2006
if (!defined ("S2MEMBER_PAYPAL_API_USERNAME"))
2007
define ("S2MEMBER_PAYPAL_API_USERNAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]));
2008
/**
2009
+ * PayPal API Password; as configured by the site owner.
2010
*
2011
* ———— Quick PHP Code Sample ————
2012
* ```
2029
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2030
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2031
*
2032
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
2033
*/
2034
if (!defined ("S2MEMBER_PAYPAL_API_PASSWORD"))
2035
define ("S2MEMBER_PAYPAL_API_PASSWORD", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]));
2036
/**
2037
+ * PayPal API Signature; as configured by the site owner.
2038
*
2039
* ———— Quick PHP Code Sample ————
2040
* ```
2057
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2058
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2059
*
2060
+ * @see `Dashboard -› s2Member -› PayPal Options -› Account Details`
2061
*/
2062
if (!defined ("S2MEMBER_PAYPAL_API_SIGNATURE"))
2063
define ("S2MEMBER_PAYPAL_API_SIGNATURE", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]));
2064
/**
2065
+ * PayPal PDT Identity Token; as configured by the site owner.
2066
*
2067
* ———— Quick PHP Code Sample ————
2068
* ```
2084
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
2085
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
2086
*
2087
+ * @see `Dashboard -› s2Member -› PayPal Options -› Auto-Return/PDT Integration`
2088
*/
2089
if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
2090
define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
2091
/**
2092
+ * PayPal value for Payment Buttons with input name: `invoice`.
2093
*
2094
+ * This can be used to auto-fill the `invoice` value in PayPal Button Codes, with a unique Code~IP combination.
2095
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2096
*
2097
* Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
2106
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2107
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2108
*
2109
+ * They are used by the PayPal Button Generator for s2Member.
2110
*
2111
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2112
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2113
*
2114
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2115
+ * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2116
*
2117
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2118
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2119
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2120
* you won't even see these, because they're added internally by the Shortcode processor.
2121
*
2122
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2123
*
2124
* Anyway, these five API Constants are just documented here for clarity;
2125
* you probably won't use any of these directly; the Button Generator pops them in.
2144
*
2145
* @see s2Member\API_Functions\s2member_value_for_pp_inv()
2146
*
2147
+ * @see `Dashboard -› s2Member -› PayPal Buttons`
2148
*/
2149
if (!defined ("S2MEMBER_VALUE_FOR_PP_INV"))
2150
define ("S2MEMBER_VALUE_FOR_PP_INV", uniqid () . "~" . S2MEMBER_CURRENT_USER_IP);
2151
/**
2152
+ * PayPal value for Payment Buttons with input name: `on0`.
2153
*
2154
+ * Used in PayPal Modification Buttons *(i.e. upgrades/downgrades)*.
2155
*
2156
+ * This auto-fills the `on0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
2157
* this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
2158
* Otherwise, it will be set to a default value of: "Originating Domain".
2159
*
2164
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2165
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2166
*
2167
+ * They are used by the PayPal Button Generator for s2Member.
2168
*
2169
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2170
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2171
*
2172
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2173
+ * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2174
*
2175
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2176
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2177
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2178
* you won't even see these, because they're added internally by the Shortcode processor.
2179
*
2180
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2181
*
2182
* Anyway, these five API Constants are just documented here for clarity;
2183
* you probably won't use any of these directly; the Button Generator pops them in.
2202
*
2203
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
2204
*
2205
+ * @see `Dashboard -› s2Member -› PayPal Buttons`
2206
*/
2207
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0"))
2208
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Referencing Customer ID" : "Originating Domain")));
2209
/**
2210
+ * PayPal value for Payment Buttons with input name: `os0`.
2211
*
2212
+ * Used in PayPal Modification Buttons *(i.e. upgrades/downgrades)*.
2213
*
2214
+ * This auto-fills the `os0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
2215
* this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
2216
* Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *(the originating domain name)*.
2217
*
2222
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2223
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2224
*
2225
+ * They are used by the PayPal Button Generator for s2Member.
2226
*
2227
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2228
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2229
*
2230
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2231
+ * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2232
*
2233
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2234
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2235
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2236
* you won't even see these, because they're added internally by the Shortcode processor.
2237
*
2238
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2239
*
2240
* Anyway, these five API Constants are just documented here for clarity;
2241
* you probably won't use any of these directly; the Button Generator pops them in.
2260
*
2261
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
2262
*
2263
+ * @see `Dashboard -› s2Member -› PayPal Buttons`
2264
*/
2265
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0"))
2266
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string)$_SERVER["HTTP_HOST"])));
2267
/**
2268
+ * PayPal value for Payment Buttons with input name: `on1`.
2269
*
2270
+ * This auto-fills the `on1` value in PayPal Button Codes.
2271
* This always contains the string: "Customer IP Address".
2272
*
2273
* These five API Constants are special.
2277
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2278
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2279
*
2280
+ * They are used by the PayPal Button Generator for s2Member.
2281
*
2282
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2283
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2284
*
2285
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2286
+ * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2287
*
2288
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2289
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2290
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2291
* you won't even see these, because they're added internally by the Shortcode processor.
2292
*
2293
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2294
*
2295
* Anyway, these five API Constants are just documented here for clarity;
2296
* you probably won't use any of these directly; the Button Generator pops them in.
2315
*
2316
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
2317
*
2318
+ * @see `Dashboard -› s2Member -› PayPal Buttons`
2319
*/
2320
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1"))
2321
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1", ($c[] = "Customer IP Address" /* Via $_SERVER["REMOTE_ADDR"] below. */));
2322
/**
2323
+ * PayPal value for Payment Buttons with input name: `os1`.
2324
*
2325
+ * This auto-fills the `os1` value in PayPal Button Codes,
2326
* with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
2327
*
2328
* These five API Constants are special.
2332
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2333
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2334
*
2335
+ * They are used by the PayPal Button Generator for s2Member.
2336
*
2337
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2338
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2339
*
2340
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2341
+ * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2342
*
2343
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2344
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2345
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2346
* you won't even see these, because they're added internally by the Shortcode processor.
2347
*
2348
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2349
*
2350
* Anyway, these five API Constants are just documented here for clarity;
2351
* you probably won't use any of these directly; the Button Generator pops them in.
2370
*
2371
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
2372
*
2373
+ * @see `Dashboard -› s2Member -› PayPal Buttons`
2374
*/
2375
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1"))
2376
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
includes/classes/custom-reg-fields.inc.php CHANGED
@@ -160,7 +160,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
160
{
161
$gen = '<input type="checkbox" value="1"';
162
$gen .= (((string)$_value) ? ' checked="checked"' : '');
163
- $gen .= $common.' /><label for="'.esc_attr($_id_prefix.$field_id_class).'" style="display:inline !important; margin:0 !important;">'.$field["label"].'</label>';
164
}
165
}
166
else if($field["type"] === "pre_checkbox" && !empty($field["label"]))
@@ -172,7 +172,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
172
{
173
$gen = '<input type="checkbox" value="1"';
174
$gen .= ((!$_submission || (string)$_value) ? ' checked="checked"' : '');
175
- $gen .= $common.' /><label for="'.esc_attr($_id_prefix.$field_id_class).'" style="display:inline !important; margin:0 !important;">'.$field["label"].'</label>';
176
}
177
}
178
else if($field["type"] === "checkboxes" && !empty($field["options"]))
@@ -203,7 +203,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
203
$gen .= ($i > 0) ? $sep : ''; // Separators can be filtered above.
204
$gen .= '<input type="checkbox" value="'.esc_attr($option_value).'"';
205
$gen .= ((($option_default && !$_submission) || in_array($option_value, (array)$_value)) ? ' checked="checked"' : '');
206
- $gen .= $common_i.' /><label for="'.esc_attr($_id_prefix.$field_id_class."-".$i).'" class="'.esc_attr($opl).'" style="display:inline !important; margin:0 !important;">'.$option_label.'</label>';
207
}
208
}
209
}
@@ -235,7 +235,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
235
$gen .= ($i > 0) ? $sep : ''; // Separators can be filtered above.
236
$gen .= '<input type="radio" value="'.esc_attr($option_value).'"';
237
$gen .= ((($option_default && !$_submission) || $option_value === (string)$_value) ? ' checked="checked"' : '');
238
- $gen .= $common_i.' /><label for="'.esc_attr($_id_prefix.$field_id_class."-".$i).'" class="'.esc_attr($opl).'" style="display:inline !important; margin:0 !important;">'.$option_label.'</label>';
239
}
240
}
241
}
160
{
161
$gen = '<input type="checkbox" value="1"';
162
$gen .= (((string)$_value) ? ' checked="checked"' : '');
163
+ $gen .= $common.' /> <label for="'.esc_attr($_id_prefix.$field_id_class).'" style="display:inline !important; margin:0 !important;">'.$field["label"].'</label>';
164
}
165
}
166
else if($field["type"] === "pre_checkbox" && !empty($field["label"]))
172
{
173
$gen = '<input type="checkbox" value="1"';
174
$gen .= ((!$_submission || (string)$_value) ? ' checked="checked"' : '');
175
+ $gen .= $common.' /> <label for="'.esc_attr($_id_prefix.$field_id_class).'" style="display:inline !important; margin:0 !important;">'.$field["label"].'</label>';
176
}
177
}
178
else if($field["type"] === "checkboxes" && !empty($field["options"]))
203
$gen .= ($i > 0) ? $sep : ''; // Separators can be filtered above.
204
$gen .= '<input type="checkbox" value="'.esc_attr($option_value).'"';
205
$gen .= ((($option_default && !$_submission) || in_array($option_value, (array)$_value)) ? ' checked="checked"' : '');
206
+ $gen .= $common_i.' /> <label for="'.esc_attr($_id_prefix.$field_id_class."-".$i).'" class="'.esc_attr($opl).'" style="display:inline !important; margin:0 !important;">'.$option_label.'</label>';
207
}
208
}
209
}
235
$gen .= ($i > 0) ? $sep : ''; // Separators can be filtered above.
236
$gen .= '<input type="radio" value="'.esc_attr($option_value).'"';
237
$gen .= ((($option_default && !$_submission) || $option_value === (string)$_value) ? ' checked="checked"' : '');
238
+ $gen .= $common_i.' /> <label for="'.esc_attr($_id_prefix.$field_id_class."-".$i).'" class="'.esc_attr($opl).'" style="display:inline !important; margin:0 !important;">'.$option_label.'</label>';
239
}
240
}
241
}
includes/classes/email-configs.inc.php CHANGED
@@ -121,7 +121,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
121
remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
122
remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
123
124
- if /* If ``$all`` is true, remove ALL attached WordPress® Filters. */ ($all)
125
remove_all_filters ("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
126
127
do_action ("ws_plugin__s2member_after_email_config_release", get_defined_vars ());
@@ -129,7 +129,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
129
return /* Return for uniformity. */;
130
}
131
/**
132
- * Converts primitive Role names in emails sent by WordPress®.
133
*
134
* Only necessary with this particular email: `wpmu_signup_user_notification_email`.
135
*
@@ -168,7 +168,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
168
if (isset ($array["to"]) && !empty ($array["to"])) // Filter list of recipients?
169
// Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*.
170
// Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>.
171
- // Also supplements WordPress®. WordPress® currently does NOT support semicolon `;` delimitation, s2Member does.
172
$array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
173
174
return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
@@ -179,7 +179,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
179
* @package s2Member\Email_Configs
180
* @since 110707
181
*
182
- * @param str|int $user_id A numeric WordPress® User ID.
183
* @param str $user_pass Optional. A plain text version of the User's password.
184
* If omitted, a new password will be generated automatically.
185
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
@@ -209,7 +209,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
209
* @package s2Member\Email_Configs
210
* @since 110707
211
*
212
- * @param str|int $user_id A numeric WordPress® User ID.
213
* @param str $user_pass Optional. A plain text version of the User's password.
214
* If omitted, only the administrative notification will be sent.
215
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
121
remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
122
remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
123
124
+ if /* If ``$all`` is true, remove ALL attached WordPress Filters. */ ($all)
125
remove_all_filters ("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
126
127
do_action ("ws_plugin__s2member_after_email_config_release", get_defined_vars ());
129
return /* Return for uniformity. */;
130
}
131
/**
132
+ * Converts primitive Role names in emails sent by WordPress.
133
*
134
* Only necessary with this particular email: `wpmu_signup_user_notification_email`.
135
*
168
if (isset ($array["to"]) && !empty ($array["to"])) // Filter list of recipients?
169
// Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*.
170
// Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>.
171
+ // Also supplements WordPress. WordPress currently does NOT support semicolon `;` delimitation, s2Member does.
172
$array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
173
174
return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
179
* @package s2Member\Email_Configs
180
* @since 110707
181
*
182
+ * @param str|int $user_id A numeric WordPress User ID.
183
* @param str $user_pass Optional. A plain text version of the User's password.
184
* If omitted, a new password will be generated automatically.
185
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
209
* @package s2Member\Email_Configs
210
* @since 110707
211
*
212
+ * @param str|int $user_id A numeric WordPress User ID.
213
* @param str $user_pass Optional. A plain text version of the User's password.
214
* If omitted, only the administrative notification will be sent.
215
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
includes/classes/files-in.inc.php CHANGED
@@ -516,7 +516,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
516
*
517
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
518
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
519
- * @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player® & RTMP Protocol Examples`.
520
* @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
521
*
522
* @see s2Member\API_Functions\s2member_file_download_url()
@@ -628,13 +628,13 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
628
return apply_filters("ws_plugin__s2member_check_file_download_key", ((isset($valid) && $valid) ? true : false), get_defined_vars());
629
}
630
/**
631
- * Creates an Amazon® S3 HMAC-SHA1 signature.
632
*
633
* @package s2Member\Files
634
* @since 110524RC
635
*
636
* @param str $string Input string/data, to be signed by this routine.
637
- * @return str An HMAC-SHA1 signature for Amazon® S3.
638
*/
639
public static function amazon_s3_sign($string = FALSE)
640
{
@@ -643,7 +643,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
643
return c_ws_plugin__s2member_utils_strings::hmac_sha1_sign((string)$string, $s3c["secret_key"]);
644
}
645
/**
646
- * Creates an Amazon® S3 HMAC-SHA1 signature URL.
647
*
648
* @package s2Member\Files
649
* @since 110926
@@ -654,7 +654,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
654
* @param bool $ssl Is this resource file to be served via SSL, or no?
655
* @param str $basename The absolute basename of the resource file.
656
* @param str $mimetype The MIME content-type of the resource file.
657
- * @return str An HMAC-SHA1 signature URL for Amazon® S3.
658
*/
659
public static function amazon_s3_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
660
{
@@ -677,7 +677,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
677
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep (urlencode_deep(array("AWSAccessKeyId" => $s3c["access_key"], "Expires" => $s3c["expires"], "Signature" => $s3_signature))), $s3_url);
678
}
679
/**
680
- * Auto-configures an Amazon® S3 Bucket's ACLs.
681
*
682
* @package s2Member\Files
683
* @since 110926
@@ -693,7 +693,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
693
694
$cfc["distros_s3_access_id"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_s3_access_id"];
695
696
- if /* Must have Amazon® S3 Bucket/Keys. */($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
697
{
698
$s3_date = gmdate("D, d M Y H:i:s")." GMT";
699
$s3_location = ((strtolower($s3c["bucket"]) !== $s3c["bucket"])) ? "/".$s3c["bucket"]."/?acl" : "/?acl";
@@ -726,50 +726,50 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
726
$s3_args = array("method" => "PUT", "redirection" => 0, "body" => $s3_policy_xml, "headers" => array("Host" => $s3_domain, "Content-Type" => "text/xml", "Date" => $s3_date, "X-Amz-Acl" => "public-read", "Authorization" => "AWS ".$s3c["access_key"].":".$s3_signature));
727
728
if(($s3_response = c_ws_plugin__s2member_utils_urls::remote("https://".$s3_domain.$s3_location, false, array_merge($s3_args, array("timeout" => 20)), "array")) && $s3_response["code"] === 200)
729
- return /* Successfully configured Amazon® S3 Bucket ACLs and Policy. */ array("success" => true, "code" => null, "message" => null);
730
731
else if(isset($s3_response["code"], $s3_response["message"]))
732
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
733
- return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon® S3 Cross-Domain Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
734
735
else // Else, we use a default error code and message.
736
- return array("success" => false, "code" => -94, "message" => _x("Unable to update existing Amazon® S3 Cross-Domain Policy. Connection failed.", "s2member-admin", "s2member"));
737
}
738
else if(isset($s3_response["code"], $s3_response["message"]))
739
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
740
- return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon® S3 Bucket Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
741
742
else // Else, we use a default error code and message.
743
- return array("success" => false, "code" => -95, "message" => _x("Unable to update existing Amazon® S3 Bucket Policy. Connection failed.", "s2member-admin", "s2member"));
744
}
745
else if(isset($s3_response["code"], $s3_response["message"]))
746
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
747
- return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon® S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
748
749
else // Else, we use a default error code and message.
750
- return array("success" => false, "code" => -96, "message" => _x("Unable to update existing Amazon® S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
751
}
752
else // Else, we use a default error code and message.
753
- return array("success" => false, "code" => -97, "message" => _x("Unable to acquire/read existing Amazon® S3 Bucket ACLs. Unexpected response.", "s2member-admin", "s2member"));
754
}
755
else if(isset($s3_response["code"], $s3_response["message"]))
756
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
757
- return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
758
759
else // Else, we use a default error code and message.
760
- return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon® S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
761
}
762
else // Else, we use a default error code and message.
763
- return array("success" => false, "code" => -99, "message" => _x("Unable to auto-configure existing Amazon® S3 Bucket ACLs. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key.", "s2member-admin", "s2member"));
764
}
765
/**
766
- * Creates an Amazon® CloudFront HMAC-SHA1 signature.
767
*
768
* @package s2Member\Files
769
* @since 110926
770
*
771
* @param str $string Input string/data, to be signed by this routine.
772
- * @return str An HMAC-SHA1 signature for Amazon® CloudFront.
773
*/
774
public static function amazon_cf_sign($string = FALSE)
775
{
@@ -778,13 +778,13 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
778
return c_ws_plugin__s2member_utils_strings::hmac_sha1_sign((string)$string, ($cfc["secret_key"] = $s3c["secret_key"]));
779
}
780
/**
781
- * Creates an Amazon® CloudFront RSA-SHA1 signature.
782
*
783
* @package s2Member\Files
784
* @since 110926
785
*
786
* @param str $string Input string/data, to be signed by this routine.
787
- * @return str|bool An RSA-SHA1 signature for Amazon® CloudFront, else false on failure.
788
*/
789
public static function amazon_cf_rsa_sign($string = FALSE)
790
{
@@ -793,7 +793,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
793
return c_ws_plugin__s2member_utils_strings::rsa_sha1_sign((string)$string, $cfc["private_key"]);
794
}
795
/**
796
- * Creates an Amazon® CloudFront RSA-SHA1 signature URL.
797
*
798
* @package s2Member\Files
799
* @since 110926
@@ -804,7 +804,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
804
* @param bool $ssl Is this resource file to be served via SSL, or no?
805
* @param str $basename The absolute basename of the resource file.
806
* @param str $mimetype The MIME content-type of the resource file.
807
- * @return str An RSA-SHA1 signature URL for Amazon® CloudFront.
808
*/
809
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
810
{
@@ -819,7 +819,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
819
$cfc["expires"] = strtotime("+".apply_filters("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars()));
820
821
$cf_extn = /* Parses the file extension out so we can scan it in some special scenarios. */ strtolower(substr($file, strrpos($file, ".") + 1));
822
- $cf_ip_res = /* Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon® CloudFront sees. */ (c_ws_plugin__s2member_utils_conds::is_localhost()) ? false : true;
823
$cf_stream_extn_resource_exclusions = array_unique((array)apply_filters("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array("mp3" /* MP3 files should NOT include an extension in their resource reference. */), get_defined_vars()));
824
$cf_resource = ($stream) ? ((in_array($cf_extn, $cf_stream_extn_resource_exclusions)) ? substr($file, 0, strrpos($file, ".")) : $file) : "http".(($ssl) ? "s" : "")."://".(($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"])."/".$url_e_file;
825
$cf_url = ($stream) ? "rtmp".(($ssl) ? "e" : "")."://".(($cfc["distro_streaming_cname"]) ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"])."/cfx/st/".$file : "http".(($ssl) ? "s" : "")."://".(($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"])."/".$url_e_file;
@@ -832,7 +832,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
832
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"]))), $cf_url);
833
}
834
/**
835
- * Auto-configures Amazon® S3/CloudFront distros.
836
*
837
* @package s2Member\Files
838
* @since 110926
@@ -850,9 +850,9 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
850
$cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
851
$cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
852
853
- if /* We MUST have an Amazon® S3 Bucket and Keys. */($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
854
{
855
- if /* We MUST have Amazon® CloudFront Keys in order to auto-configure. */($cfc["private_key"] && $cfc["private_key_id"])
856
{
857
if(!$cfc["distro_downloads_id"] || ($cfc["distro_downloads_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro($cfc["distro_downloads_id"], "downloads")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)))
858
{
@@ -860,14 +860,14 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
860
$cf_distro_downloads_clear = /* Clear, ready for a new one. */ true;
861
862
else if($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
863
- return array("success" => false, "code" => -86, "message" => _x("Unable to delete existing Amazon® CloudFront Downloads Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
864
865
else if($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_downloads_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
866
$cf_distro_downloads_clear = /* Clear, ready for a new one. */ true;
867
868
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
869
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
870
- return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
871
872
if /* Successfully cleared? Ready for a new one? */(isset($cf_distro_downloads_clear) && $cf_distro_downloads_clear)
873
{
@@ -879,14 +879,14 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
879
$cf_distro_streaming_clear = /* Clear, ready for a new one. */ true;
880
881
else if($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
882
- return array("success" => false, "code" => -87, "message" => _x("Unable to delete existing Amazon® CloudFront Streaming Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
883
884
else if($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_streaming_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
885
$cf_distro_streaming_clear = /* Clear, ready for a new one. */ true;
886
887
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
888
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
889
- return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
890
891
if /* Successfully cleared? Ready for a new one? */(isset($cf_distro_streaming_clear) && $cf_distro_streaming_clear)
892
{
@@ -901,8 +901,8 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
901
$cf_distros_access_clear = /* Clear, ready for a new one. */ true;
902
903
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
904
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
905
- return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
906
907
if /* Successfully cleared? Ready for a new one? */(isset($cf_distros_access_clear) && $cf_distros_access_clear)
908
{
@@ -939,74 +939,74 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
939
$cfc = array_merge($cfc, array("distros_auto_config_status" => "configured"));
940
$cf_options = array("ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "configured");
941
c_ws_plugin__s2member_menu_pages::update_all_options( /* Now configured! */$cf_options, true, false, false, false, false);
942
- return /* Successfully configured Amazon® S3/CloudFront distros. */ array("success" => true, "code" => null, "message" => null);
943
}
944
if(isset($s3_response["code"], $s3_response["message"]))
945
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
946
- return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon® S3 ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
947
948
else // Else, we use a default error code and message.
949
- return array("success" => false, "code" => -88, "message" => _x("Unable to update existing Amazon® S3 ACLs. Connection failed.", "s2member-admin", "s2member"));
950
}
951
else if(isset($cf_response["code"], $cf_response["message"]))
952
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
953
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
954
955
else // Else, we use a default error code and message.
956
- return array("success" => false, "code" => -89, "message" => _x("Unable to create Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
957
}
958
else if(isset($cf_response["code"], $cf_response["message"]))
959
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
960
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
961
962
else // Else, we use a default error code and message.
963
- return array("success" => false, "code" => -90, "message" => _x("Unable to create Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
964
}
965
else if(isset($cf_response["code"], $cf_response["message"]))
966
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
967
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
968
969
else // Else, we use a default error code and message.
970
- return array("success" => false, "code" => -91, "message" => _x("Unable to create Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
971
}
972
else // Else, we use a default error code and message.
973
- return array("success" => false, "code" => -92, "message" => _x("Unable to clear existing Amazon® CloudFront Origin Access Identity.", "s2member-admin", "s2member"));
974
}
975
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
976
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
977
- return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
978
979
else // Else, we use a default error code and message.
980
- return array("success" => false, "code" => -93, "message" => _x("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
981
}
982
else // Else, we use a default error code and message.
983
- return array("success" => false, "code" => -94, "message" => _x("Unable to clear existing Amazon® CloudFront Streaming Distro.", "s2member-admin", "s2member"));
984
}
985
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
986
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
987
- return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
988
989
else // Else, we use a default error code and message.
990
- return array("success" => false, "code" => -95, "message" => _x("Unable to acquire existing Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
991
}
992
else // Else, we use a default error code and message.
993
- return array("success" => false, "code" => -96, "message" => _x("Unable to clear existing Amazon® CloudFront Downloads Distro.", "s2member-admin", "s2member"));
994
}
995
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
996
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
997
- return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
998
999
else // Else, we use a default error code and message.
1000
- return array("success" => false, "code" => -97, "message" => _x("Unable to acquire existing Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
1001
}
1002
else // Else, we use a default error code and message.
1003
- return array("success" => false, "code" => -98, "message" => _x("Unable to auto-configure Amazon® CloudFront Distros. Incomplete Amazon® CloudFront configuration options. Missing of one: Amazon® CloudFront Private Key-Pair-ID, or Private Key file contents.", "s2member-admin", "s2member"));
1004
}
1005
else // Else, we use a default error code and message.
1006
- return array("success" => false, "code" => -99, "message" => _x("Unable to auto-configure Amazon® S3/CloudFront Distros. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key. You must provide s2Member with an Amazon® S3 configuration before enabling CloudFront.", "s2member-admin", "s2member"));
1007
}
1008
/**
1009
- * Acquires an Amazon® S3/CloudFront Access Origin Identity.
1010
*
1011
* @package s2Member\Files
1012
* @since 110926
@@ -1038,21 +1038,21 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1038
if($cf_response["code"] === 200 && !empty($cf_response["headers"]["etag"]) && !empty($cf_response["body"]))
1039
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]));
1040
1041
- else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1042
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Existing Amazon® CloudFront Origin Access Identity NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1043
}
1044
else if(isset($cf_response["code"], $cf_response["message"]))
1045
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1046
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1047
1048
else // Else, we use a default error code and message.
1049
- return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1050
}
1051
else // Else, we use a default error code and message.
1052
- return array("success" => false, "code" => -99, "message" => _x("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Invalid Access ID.", "s2member-admin", "s2member"));
1053
}
1054
/**
1055
- * Deletes an Amazon® S3/CloudFront Access Origin Identity.
1056
*
1057
* @package s2Member\Files
1058
* @since 110926
@@ -1085,17 +1085,17 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1085
return /* Deleted successfully. */ array("success" => true, "code" => null, "message" => null);
1086
1087
else if(isset($cf_response["code"], $cf_response["message"]))
1088
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1089
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1090
1091
else // Else, we use a default error code and message.
1092
- return array("success" => false, "code" => -98, "message" => _x("Unable to delete existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1093
}
1094
else // Else, we use a default error code and message.
1095
- return array("success" => false, "code" => -99, "message" => _x("Unable to delete existing Amazon® CloudFront Origin Access Identity. Invalid Access ID, ETag, or XML config.", "s2member-admin", "s2member"));
1096
}
1097
/**
1098
- * Creates an Amazon® S3/CloudFront Access Origin Identity for all Distros.
1099
*
1100
* @package s2Member\Files
1101
* @since 110926
@@ -1127,17 +1127,17 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1127
return array("success" => true, "code" => null, "message" => null, "distros_access_id" => trim($cf_distros_access_id_tag[1]), "distros_s3_access_id" => trim($cf_distros_s3_access_id_tag[1]));
1128
1129
else // Else, we use a default error code and message.
1130
- return array("success" => false, "code" => -98, "message" => _x("Unable to create/read Amazon® CloudFront Origin Access Identity. Unexpected response.", "s2member-admin", "s2member"));
1131
}
1132
else if(isset($cf_response["code"], $cf_response["message"]))
1133
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1134
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1135
1136
else // Else, we use a default error code and message.
1137
- return array("success" => false, "code" => -99, "message" => _x("Unable to create Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1138
}
1139
/**
1140
- * Acquires an Amazon® S3/CloudFront Distro.
1141
*
1142
* @package s2Member\Files
1143
* @since 110926
@@ -1170,21 +1170,21 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1170
if($cf_response["code"] === 200 && !empty($cf_response["headers"]["etag"]) && !empty($cf_response["body"]))
1171
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]), "deployed" => ((stripos($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
1172
1173
- else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1174
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Existing Amazon® CloudFront Distro NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1175
}
1176
else if(isset($cf_response["code"], $cf_response["message"]))
1177
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1178
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1179
1180
else // Else, we use a default error code and message.
1181
- return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1182
}
1183
else // Else, we use a default error code and message.
1184
- return array("success" => false, "code" => -99, "message" => _x("Unable to acquire existing Amazon® CloudFront Distro. Invalid Distro ID and/or Distro type.", "s2member-admin", "s2member"));
1185
}
1186
/**
1187
- * Disables an Amazon® S3/CloudFront Distro.
1188
*
1189
* @package s2Member\Files
1190
* @since 110926
@@ -1222,23 +1222,23 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1222
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]), "deployed" => ((stripos($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
1223
1224
else if(isset($cf_response["code"], $cf_response["message"]))
1225
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1226
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to disable existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1227
1228
else // Else, we use a default error code and message.
1229
- return array("success" => false, "code" => -97, "message" => _x("Unable to disable existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1230
}
1231
else // Else, we use a default error code and message.
1232
- return array("success" => false, "code" => -98, "message" => _x("Existing Amazon® CloudFront Distro cannot be disabled at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1233
}
1234
else // Else, we use a default error code and message.
1235
return array("success" => true, "code" => null, "message" => null, "etag" => $distro_id_etag, "xml" => $distro_id_xml, "deployed" => ((stripos($distro_id_xml, "<Status>Deployed</Status>") !== false) ? true : false));
1236
}
1237
else // Else, we use a default error code and message.
1238
- return array("success" => false, "code" => -99, "message" => _x("Unable to disable existing Amazon® CloudFront Distro. Invalid Distro ID, ETag, or XML config.", "s2member-admin", "s2member"));
1239
}
1240
/**
1241
- * Deletes an Amazon® S3/CloudFront Distro.
1242
*
1243
* @package s2Member\Files
1244
* @since 110926
@@ -1277,38 +1277,38 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1277
return /* Deleted successfully. */ array("success" => true, "code" => null, "message" => null);
1278
1279
else if(isset($cf_response["code"], $cf_response["message"]))
1280
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1281
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1282
1283
else // Else, we use a default error code and message.
1284
- return array("success" => false, "code" => -94, "message" => _x("Unable to delete existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1285
}
1286
else if(isset($cf_response["success"], $cf_response["deployed"]) && $cf_response["success"] && !$cf_response["deployed"])
1287
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1288
- return array("success" => false, "code" => -95, "message" => _x("Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state after having been disabled by s2Member. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1289
1290
else if(isset($cf_response["code"], $cf_response["message"]))
1291
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1292
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to check status of existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1293
1294
else // Else, we use a default error code and message.
1295
- return array("success" => false, "code" => -96, "message" => _x("Unable to check status of existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1296
}
1297
else if(isset($cf_response["code"], $cf_response["message"]))
1298
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1299
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to disable existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1300
1301
else // Else, we use a default error code and message.
1302
- return array("success" => false, "code" => -97, "message" => _x("Unable to disable existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1303
}
1304
else // Else, we use a default error code and message.
1305
- return array("success" => false, "code" => -98, "message" => _x("Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1306
}
1307
else // Else, we use a default error code and message.
1308
- return array("success" => false, "code" => -99, "message" => _x("Unable to delete existing Amazon® CloudFront Distro. Invalid Distro ID or ETag.", "s2member-admin", "s2member"));
1309
}
1310
/**
1311
- * Creates an Amazon® S3/CloudFront Distro.
1312
*
1313
* @package s2Member\Files
1314
* @since 110926
@@ -1346,14 +1346,14 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1346
return array("success" => true, "code" => null, "message" => null, "distro_downloads_id" => trim($cf_distro_downloads_id_tag[1]), "distro_downloads_dname" => trim($cf_distro_downloads_dname_tag[1]));
1347
1348
else // Else, we use a default error code and message.
1349
- return array("success" => false, "code" => -97, "message" => _x("Unable to create/read Amazon® CloudFront Downloads Distro. Unexpected response.", "s2member-admin", "s2member"));
1350
}
1351
else if(isset($cf_response["code"], $cf_response["message"]))
1352
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1353
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1354
1355
else // Else, we use a default error code and message.
1356
- return array("success" => false, "code" => -98, "message" => _x("Unable to create Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
1357
}
1358
1359
else if /* Create a `streaming` Distro? A different XML schema. */($distro_type === "streaming")
@@ -1369,18 +1369,18 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
1369
return array("success" => true, "code" => null, "message" => null, "distro_streaming_id" => trim($cf_distro_streaming_id_tag[1]), "distro_streaming_dname" => trim($cf_distro_streaming_dname_tag[1]));
1370
1371
else // Else, we use a default error code and message.
1372
- return array("success" => false, "code" => -97, "message" => _x("Unable to create/read Amazon® CloudFront Streaming Distro. Unexpected response.", "s2member-admin", "s2member"));
1373
}
1374
else if(isset($cf_response["code"], $cf_response["message"]))
1375
- /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1376
- return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1377
1378
else // Else, we use a default error code and message.
1379
- return array("success" => false, "code" => -98, "message" => _x("Unable to create Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
1380
}
1381
}
1382
else // Else, we use a default error code and message.
1383
- return array("success" => false, "code" => -99, "message" => _x("Unable to create Amazon® CloudFront Distro. Invalid Distro type.", "s2member-admin", "s2member"));
1384
}
1385
}
1386
}
516
*
517
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
518
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
519
+ * @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
520
* @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
521
*
522
* @see s2Member\API_Functions\s2member_file_download_url()
628
return apply_filters("ws_plugin__s2member_check_file_download_key", ((isset($valid) && $valid) ? true : false), get_defined_vars());
629
}
630
/**
631
+ * Creates an Amazon S3 HMAC-SHA1 signature.
632
*
633
* @package s2Member\Files
634
* @since 110524RC
635
*
636
* @param str $string Input string/data, to be signed by this routine.
637
+ * @return str An HMAC-SHA1 signature for Amazon S3.
638
*/
639
public static function amazon_s3_sign($string = FALSE)
640
{
643
return c_ws_plugin__s2member_utils_strings::hmac_sha1_sign((string)$string, $s3c["secret_key"]);
644
}
645
/**
646
+ * Creates an Amazon S3 HMAC-SHA1 signature URL.
647
*
648
* @package s2Member\Files
649
* @since 110926
654
* @param bool $ssl Is this resource file to be served via SSL, or no?
655
* @param str $basename The absolute basename of the resource file.
656
* @param str $mimetype The MIME content-type of the resource file.
657
+ * @return str An HMAC-SHA1 signature URL for Amazon S3.
658
*/
659
public static function amazon_s3_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
660
{
677
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep (urlencode_deep(array("AWSAccessKeyId" => $s3c["access_key"], "Expires" => $s3c["expires"], "Signature" => $s3_signature))), $s3_url);
678
}
679
/**
680
+ * Auto-configures an Amazon S3 Bucket's ACLs.
681
*
682
* @package s2Member\Files
683
* @since 110926
693
694
$cfc["distros_s3_access_id"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_s3_access_id"];
695
696
+ if /* Must have Amazon S3 Bucket/Keys. */($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
697
{
698
$s3_date = gmdate("D, d M Y H:i:s")." GMT";
699
$s3_location = ((strtolower($s3c["bucket"]) !== $s3c["bucket"])) ? "/".$s3c["bucket"]."/?acl" : "/?acl";
726
$s3_args = array("method" => "PUT", "redirection" => 0, "body" => $s3_policy_xml, "headers" => array("Host" => $s3_domain, "Content-Type" => "text/xml", "Date" => $s3_date, "X-Amz-Acl" => "public-read", "Authorization" => "AWS ".$s3c["access_key"].":".$s3_signature));
727
728
if(($s3_response = c_ws_plugin__s2member_utils_urls::remote("https://".$s3_domain.$s3_location, false, array_merge($s3_args, array("timeout" => 20)), "array")) && $s3_response["code"] === 200)
729
+ return /* Successfully configured Amazon S3 Bucket ACLs and Policy. */ array("success" => true, "code" => null, "message" => null);
730
731
else if(isset($s3_response["code"], $s3_response["message"]))
732
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
733
+ return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon S3 Cross-Domain Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
734
735
else // Else, we use a default error code and message.
736
+ return array("success" => false, "code" => -94, "message" => _x("Unable to update existing Amazon S3 Cross-Domain Policy. Connection failed.", "s2member-admin", "s2member"));
737
}
738
else if(isset($s3_response["code"], $s3_response["message"]))
739
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
740
+ return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon S3 Bucket Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
741
742
else // Else, we use a default error code and message.
743
+ return array("success" => false, "code" => -95, "message" => _x("Unable to update existing Amazon S3 Bucket Policy. Connection failed.", "s2member-admin", "s2member"));
744
}
745
else if(isset($s3_response["code"], $s3_response["message"]))
746
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
747
+ return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
748
749
else // Else, we use a default error code and message.
750
+ return array("success" => false, "code" => -96, "message" => _x("Unable to update existing Amazon S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
751
}
752
else // Else, we use a default error code and message.
753
+ return array("success" => false, "code" => -97, "message" => _x("Unable to acquire/read existing Amazon S3 Bucket ACLs. Unexpected response.", "s2member-admin", "s2member"));
754
}
755
else if(isset($s3_response["code"], $s3_response["message"]))
756
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
757
+ return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
758
759
else // Else, we use a default error code and message.
760
+ return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
761
}
762
else // Else, we use a default error code and message.
763
+ return array("success" => false, "code" => -99, "message" => _x("Unable to auto-configure existing Amazon S3 Bucket ACLs. Incomplete Amazon S3 configuration options. Missing one of: Amazon S3 Bucket, Access Key, or Secret Key.", "s2member-admin", "s2member"));
764
}
765
/**
766
+ * Creates an Amazon CloudFront HMAC-SHA1 signature.
767
*
768
* @package s2Member\Files
769
* @since 110926
770
*
771
* @param str $string Input string/data, to be signed by this routine.
772
+ * @return str An HMAC-SHA1 signature for Amazon CloudFront.
773
*/
774
public static function amazon_cf_sign($string = FALSE)
775
{
778
return c_ws_plugin__s2member_utils_strings::hmac_sha1_sign((string)$string, ($cfc["secret_key"] = $s3c["secret_key"]));
779
}
780
/**
781
+ * Creates an Amazon CloudFront RSA-SHA1 signature.
782
*
783
* @package s2Member\Files
784
* @since 110926
785
*
786
* @param str $string Input string/data, to be signed by this routine.
787
+ * @return str|bool An RSA-SHA1 signature for Amazon CloudFront, else false on failure.
788
*/
789
public static function amazon_cf_rsa_sign($string = FALSE)
790
{
793
return c_ws_plugin__s2member_utils_strings::rsa_sha1_sign((string)$string, $cfc["private_key"]);
794
}
795
/**
796
+ * Creates an Amazon CloudFront RSA-SHA1 signature URL.
797
*
798
* @package s2Member\Files
799
* @since 110926
804
* @param bool $ssl Is this resource file to be served via SSL, or no?
805
* @param str $basename The absolute basename of the resource file.
806
* @param str $mimetype The MIME content-type of the resource file.
807
+ * @return str An RSA-SHA1 signature URL for Amazon CloudFront.
808
*/
809
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
810
{
819
$cfc["expires"] = strtotime("+".apply_filters("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars()));
820
821
$cf_extn = /* Parses the file extension out so we can scan it in some special scenarios. */ strtolower(substr($file, strrpos($file, ".") + 1));
822
+ $cf_ip_res = /* Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon CloudFront sees. */ (c_ws_plugin__s2member_utils_conds::is_localhost()) ? false : true;
823
$cf_stream_extn_resource_exclusions = array_unique((array)apply_filters("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array("mp3" /* MP3 files should NOT include an extension in their resource reference. */), get_defined_vars()));
824
$cf_resource = ($stream) ? ((in_array($cf_extn, $cf_stream_extn_resource_exclusions)) ? substr($file, 0, strrpos($file, ".")) : $file) : "http".(($ssl) ? "s" : "")."://".(($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"])."/".$url_e_file;
825
$cf_url = ($stream) ? "rtmp".(($ssl) ? "e" : "")."://".(($cfc["distro_streaming_cname"]) ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"])."/cfx/st/".$file : "http".(($ssl) ? "s" : "")."://".(($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"])."/".$url_e_file;
832
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"]))), $cf_url);
833
}
834
/**
835
+ * Auto-configures Amazon S3/CloudFront distros.
836
*
837
* @package s2Member\Files
838
* @since 110926
850
$cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
851
$cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
852
853
+ if /* We MUST have an Amazon S3 Bucket and Keys. */($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
854
{
855
+ if /* We MUST have Amazon CloudFront Keys in order to auto-configure. */($cfc["private_key"] && $cfc["private_key_id"])
856
{
857
if(!$cfc["distro_downloads_id"] || ($cfc["distro_downloads_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro($cfc["distro_downloads_id"], "downloads")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)))
858
{
860
$cf_distro_downloads_clear = /* Clear, ready for a new one. */ true;
861
862
else if($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
863
+ return array("success" => false, "code" => -86, "message" => _x("Unable to delete existing Amazon CloudFront Downloads Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
864
865
else if($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_downloads_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
866
$cf_distro_downloads_clear = /* Clear, ready for a new one. */ true;
867
868
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
869
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
870
+ return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
871
872
if /* Successfully cleared? Ready for a new one? */(isset($cf_distro_downloads_clear) && $cf_distro_downloads_clear)
873
{
879
$cf_distro_streaming_clear = /* Clear, ready for a new one. */ true;
880
881
else if($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
882
+ return array("success" => false, "code" => -87, "message" => _x("Unable to delete existing Amazon CloudFront Streaming Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
883
884
else if($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_streaming_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
885
$cf_distro_streaming_clear = /* Clear, ready for a new one. */ true;
886
887
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
888
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
889
+ return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
890
891
if /* Successfully cleared? Ready for a new one? */(isset($cf_distro_streaming_clear) && $cf_distro_streaming_clear)
892
{
901
$cf_distros_access_clear = /* Clear, ready for a new one. */ true;
902
903
else if(isset($cf_del_response["code"], $cf_del_response["message"]))
904
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
905
+ return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
906
907
if /* Successfully cleared? Ready for a new one? */(isset($cf_distros_access_clear) && $cf_distros_access_clear)
908
{
939
$cfc = array_merge($cfc, array("distros_auto_config_status" => "configured"));
940
$cf_options = array("ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "configured");
941
c_ws_plugin__s2member_menu_pages::update_all_options( /* Now configured! */$cf_options, true, false, false, false, false);
942
+ return /* Successfully configured Amazon S3/CloudFront distros. */ array("success" => true, "code" => null, "message" => null);
943
}
944
if(isset($s3_response["code"], $s3_response["message"]))
945
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
946
+ return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon S3 ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
947
948
else // Else, we use a default error code and message.
949
+ return array("success" => false, "code" => -88, "message" => _x("Unable to update existing Amazon S3 ACLs. Connection failed.", "s2member-admin", "s2member"));
950
}
951
else if(isset($cf_response["code"], $cf_response["message"]))
952
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
953
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
954
955
else // Else, we use a default error code and message.
956
+ return array("success" => false, "code" => -89, "message" => _x("Unable to create Amazon CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
957
}
958
else if(isset($cf_response["code"], $cf_response["message"]))
959
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
960
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
961
962
else // Else, we use a default error code and message.
963
+ return array("success" => false, "code" => -90, "message" => _x("Unable to create Amazon CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
964
}
965
else if(isset($cf_response["code"], $cf_response["message"]))
966
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
967
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
968
969
else // Else, we use a default error code and message.
970
+ return array("success" => false, "code" => -91, "message" => _x("Unable to create Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
971
}
972
else // Else, we use a default error code and message.
973
+ return array("success" => false, "code" => -92, "message" => _x("Unable to clear existing Amazon CloudFront Origin Access Identity.", "s2member-admin", "s2member"));
974
}
975
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
976
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
977
+ return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
978
979
else // Else, we use a default error code and message.
980
+ return array("success" => false, "code" => -93, "message" => _x("Unable to acquire existing Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
981
}
982
else // Else, we use a default error code and message.
983
+ return array("success" => false, "code" => -94, "message" => _x("Unable to clear existing Amazon CloudFront Streaming Distro.", "s2member-admin", "s2member"));
984
}
985
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
986
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
987
+ return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
988
989
else // Else, we use a default error code and message.
990
+ return array("success" => false, "code" => -95, "message" => _x("Unable to acquire existing Amazon CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
991
}
992
else // Else, we use a default error code and message.
993
+ return array("success" => false, "code" => -96, "message" => _x("Unable to clear existing Amazon CloudFront Downloads Distro.", "s2member-admin", "s2member"));
994
}
995
else if(isset($cf_get_response["code"], $cf_get_response["message"]))
996
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
997
+ return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
998
999
else // Else, we use a default error code and message.
1000
+ return array("success" => false, "code" => -97, "message" => _x("Unable to acquire existing Amazon CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
1001
}
1002
else // Else, we use a default error code and message.
1003
+ return array("success" => false, "code" => -98, "message" => _x("Unable to auto-configure Amazon CloudFront Distros. Incomplete Amazon CloudFront configuration options. Missing of one: Amazon CloudFront Private Key-Pair-ID, or Private Key file contents.", "s2member-admin", "s2member"));
1004
}
1005
else // Else, we use a default error code and message.
1006
+ return array("success" => false, "code" => -99, "message" => _x("Unable to auto-configure Amazon S3/CloudFront Distros. Incomplete Amazon S3 configuration options. Missing one of: Amazon S3 Bucket, Access Key, or Secret Key. You must provide s2Member with an Amazon S3 configuration before enabling CloudFront.", "s2member-admin", "s2member"));
1007
}
1008
/**
1009
+ * Acquires an Amazon S3/CloudFront Access Origin Identity.
1010
*
1011
* @package s2Member\Files
1012
* @since 110926
1038
if($cf_response["code"] === 200 && !empty($cf_response["headers"]["etag"]) && !empty($cf_response["body"]))
1039
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]));
1040
1041
+ else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1042
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Existing Amazon CloudFront Origin Access Identity NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1043
}
1044
else if(isset($cf_response["code"], $cf_response["message"]))
1045
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1046
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1047
1048
else // Else, we use a default error code and message.
1049
+ return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1050
}
1051
else // Else, we use a default error code and message.
1052
+ return array("success" => false, "code" => -99, "message" => _x("Unable to acquire existing Amazon CloudFront Origin Access Identity. Invalid Access ID.", "s2member-admin", "s2member"));
1053
}
1054
/**
1055
+ * Deletes an Amazon S3/CloudFront Access Origin Identity.
1056
*
1057
* @package s2Member\Files
1058
* @since 110926
1085
return /* Deleted successfully. */ array("success" => true, "code" => null, "message" => null);
1086
1087
else if(isset($cf_response["code"], $cf_response["message"]))
1088
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1089
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1090
1091
else // Else, we use a default error code and message.
1092
+ return array("success" => false, "code" => -98, "message" => _x("Unable to delete existing Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1093
}
1094
else // Else, we use a default error code and message.
1095
+ return array("success" => false, "code" => -99, "message" => _x("Unable to delete existing Amazon CloudFront Origin Access Identity. Invalid Access ID, ETag, or XML config.", "s2member-admin", "s2member"));
1096
}
1097
/**
1098
+ * Creates an Amazon S3/CloudFront Access Origin Identity for all Distros.
1099
*
1100
* @package s2Member\Files
1101
* @since 110926
1127
return array("success" => true, "code" => null, "message" => null, "distros_access_id" => trim($cf_distros_access_id_tag[1]), "distros_s3_access_id" => trim($cf_distros_s3_access_id_tag[1]));
1128
1129
else // Else, we use a default error code and message.
1130
+ return array("success" => false, "code" => -98, "message" => _x("Unable to create/read Amazon CloudFront Origin Access Identity. Unexpected response.", "s2member-admin", "s2member"));
1131
}
1132
else if(isset($cf_response["code"], $cf_response["message"]))
1133
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1134
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1135
1136
else // Else, we use a default error code and message.
1137
+ return array("success" => false, "code" => -99, "message" => _x("Unable to create Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1138
}
1139
/**
1140
+ * Acquires an Amazon S3/CloudFront Distro.
1141
*
1142
* @package s2Member\Files
1143
* @since 110926
1170
if($cf_response["code"] === 200 && !empty($cf_response["headers"]["etag"]) && !empty($cf_response["body"]))
1171
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]), "deployed" => ((stripos($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
1172
1173
+ else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1174
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Existing Amazon CloudFront Distro NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1175
}
1176
else if(isset($cf_response["code"], $cf_response["message"]))
1177
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1178
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1179
1180
else // Else, we use a default error code and message.
1181
+ return array("success" => false, "code" => -98, "message" => _x("Unable to acquire existing Amazon CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1182
}
1183
else // Else, we use a default error code and message.
1184
+ return array("success" => false, "code" => -99, "message" => _x("Unable to acquire existing Amazon CloudFront Distro. Invalid Distro ID and/or Distro type.", "s2member-admin", "s2member"));
1185
}
1186
/**
1187
+ * Disables an Amazon S3/CloudFront Distro.
1188
*
1189
* @package s2Member\Files
1190
* @since 110926
1222
return array("success" => true, "code" => null, "message" => null, "etag" => trim($cf_response["headers"]["etag"]), "xml" => trim($cf_response["body"]), "deployed" => ((stripos($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
1223
1224
else if(isset($cf_response["code"], $cf_response["message"]))
1225
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1226
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to disable existing Amazon CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1227
1228
else // Else, we use a default error code and message.
1229
+ return array("success" => false, "code" => -97, "message" => _x("Unable to disable existing Amazon CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1230
}
1231
else // Else, we use a default error code and message.
1232
+ return array("success" => false, "code" => -98, "message" => _x("Existing Amazon CloudFront Distro cannot be disabled at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1233
}
1234
else // Else, we use a default error code and message.
1235
return array("success" => true, "code" => null, "message" => null, "etag" => $distro_id_etag, "xml" => $distro_id_xml, "deployed" => ((stripos($distro_id_xml, "<Status>Deployed</Status>") !== false) ? true : false));
1236
}
1237
else // Else, we use a default error code and message.
1238
+ return array("success" => false, "code" => -99, "message" => _x("Unable to disable existing Amazon CloudFront Distro. Invalid Distro ID, ETag, or XML config.", "s2member-admin", "s2member"));
1239
}
1240
/**
1241
+ * Deletes an Amazon S3/CloudFront Distro.
1242
*
1243
* @package s2Member\Files
1244
* @since 110926
1277
return /* Deleted successfully. */ array("success" => true, "code" => null, "message" => null);
1278
1279
else if(isset($cf_response["code"], $cf_response["message"]))
1280
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1281
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1282
1283
else // Else, we use a default error code and message.
1284
+ return array("success" => false, "code" => -94, "message" => _x("Unable to delete existing Amazon CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1285
}
1286
else if(isset($cf_response["success"], $cf_response["deployed"]) && $cf_response["success"] && !$cf_response["deployed"])
1287
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1288
+ return array("success" => false, "code" => -95, "message" => _x("Existing Amazon CloudFront Distro cannot be deleted at this time. Still in a `pending` state after having been disabled by s2Member. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1289
1290
else if(isset($cf_response["code"], $cf_response["message"]))
1291
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1292
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to check status of existing Amazon CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1293
1294
else // Else, we use a default error code and message.
1295
+ return array("success" => false, "code" => -96, "message" => _x("Unable to check status of existing Amazon CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1296
}
1297
else if(isset($cf_response["code"], $cf_response["message"]))
1298
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1299
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to disable existing Amazon CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1300
1301
else // Else, we use a default error code and message.
1302
+ return array("success" => false, "code" => -97, "message" => _x("Unable to disable existing Amazon CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1303
}
1304
else // Else, we use a default error code and message.
1305
+ return array("success" => false, "code" => -98, "message" => _x("Existing Amazon CloudFront Distro cannot be deleted at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1306
}
1307
else // Else, we use a default error code and message.
1308
+ return array("success" => false, "code" => -99, "message" => _x("Unable to delete existing Amazon CloudFront Distro. Invalid Distro ID or ETag.", "s2member-admin", "s2member"));
1309
}
1310
/**
1311
+ * Creates an Amazon S3/CloudFront Distro.
1312
*
1313
* @package s2Member\Files
1314
* @since 110926
1346
return array("success" => true, "code" => null, "message" => null, "distro_downloads_id" => trim($cf_distro_downloads_id_tag[1]), "distro_downloads_dname" => trim($cf_distro_downloads_dname_tag[1]));
1347
1348
else // Else, we use a default error code and message.
1349
+ return array("success" => false, "code" => -97, "message" => _x("Unable to create/read Amazon CloudFront Downloads Distro. Unexpected response.", "s2member-admin", "s2member"));
1350
}
1351
else if(isset($cf_response["code"], $cf_response["message"]))
1352
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1353
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1354
1355
else // Else, we use a default error code and message.
1356
+ return array("success" => false, "code" => -98, "message" => _x("Unable to create Amazon CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
1357
}
1358
1359
else if /* Create a `streaming` Distro? A different XML schema. */($distro_type === "streaming")
1369
return array("success" => true, "code" => null, "message" => null, "distro_streaming_id" => trim($cf_distro_streaming_id_tag[1]), "distro_streaming_dname" => trim($cf_distro_streaming_dname_tag[1]));
1370
1371
else // Else, we use a default error code and message.
1372
+ return array("success" => false, "code" => -97, "message" => _x("Unable to create/read Amazon CloudFront Streaming Distro. Unexpected response.", "s2member-admin", "s2member"));
1373
}
1374
else if(isset($cf_response["code"], $cf_response["message"]))
1375
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
1376
+ return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1377
1378
else // Else, we use a default error code and message.
1379
+ return array("success" => false, "code" => -98, "message" => _x("Unable to create Amazon CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
1380
}
1381
}
1382
else // Else, we use a default error code and message.
1383
+ return array("success" => false, "code" => -99, "message" => _x("Unable to create Amazon CloudFront Distro. Invalid Distro type.", "s2member-admin", "s2member"));
1384
}
1385
}
1386
}
includes/classes/files.inc.php CHANGED
@@ -56,7 +56,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
56
*
57
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
58
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
59
- * @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player® & RTMP Protocol Examples`.
60
* @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
61
*
62
* @see s2Member\API_Functions\s2member_file_download_url()
@@ -66,7 +66,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
66
return c_ws_plugin__s2member_files_in::create_file_download_url($config, $get_streamer_array);
67
}
68
/**
69
- * Auto-configures an Amazon® S3 Bucket's ACLs.
70
*
71
* @package s2Member\Files
72
* @since 110926
@@ -79,7 +79,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
79
return c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls();
80
}
81
/**
82
- * Auto-configures Amazon® CloudFront distros.
83
*
84
* @package s2Member\Files
85
* @since 130209
@@ -178,7 +178,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
178
*
179
* @param obj $user Optional. A `WP_User` object. Defaults to the current User's object.
180
* @param str $not_counting_this_particular_file Optional. If you want to exclude a particular file,
181
- * relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *(when applicable)*.
182
* @param array $user_log Optional. Prevents another database connection *(i.e. the User's log does not need to be pulled again)*.
183
* @param array $user_arc Optional. Prevents another database connection *(i.e. the User's archive does not need to be pulled again)*.
184
* @return array An array with the following elements... File Downloads allowed for this User: (int)`allowed`, Download Period for this User in days: (int)`allowed_days`, Files downloaded by this User in the current Period: (int)`currently`, log of all Files downloaded in the current Period, with file names/dates: (array)`log`, archive of all Files downloaded in prior Periods, with file names/dates: (array)`archive`.
@@ -227,7 +227,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
227
* @package s2Member\Files
228
* @since 111026
229
*
230
- * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *(when applicable)*.
231
* @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
232
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
233
* @return int The total for this particular ``$file``, based on configuration of function arguments.
@@ -262,7 +262,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
262
* @package s2Member\Files
263
* @since 111026
264
*
265
- * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *(when applicable)*.
266
* @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
267
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
268
* @return int The total for this particular ``$file``, based on configuration of function arguments.
56
*
57
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
58
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
59
+ * @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
60
* @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
61
*
62
* @see s2Member\API_Functions\s2member_file_download_url()
66
return c_ws_plugin__s2member_files_in::create_file_download_url($config, $get_streamer_array);
67
}
68
/**
69
+ * Auto-configures an Amazon S3 Bucket's ACLs.
70
*
71
* @package s2Member\Files
72
* @since 110926
79
return c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls();
80
}
81
/**
82
+ * Auto-configures Amazon CloudFront distros.
83
*
84
* @package s2Member\Files
85
* @since 130209
178
*
179
* @param obj $user Optional. A `WP_User` object. Defaults to the current User's object.
180
* @param str $not_counting_this_particular_file Optional. If you want to exclude a particular file,
181
+ * relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
182
* @param array $user_log Optional. Prevents another database connection *(i.e. the User's log does not need to be pulled again)*.
183
* @param array $user_arc Optional. Prevents another database connection *(i.e. the User's archive does not need to be pulled again)*.
184
* @return array An array with the following elements... File Downloads allowed for this User: (int)`allowed`, Download Period for this User in days: (int)`allowed_days`, Files downloaded by this User in the current Period: (int)`currently`, log of all Files downloaded in the current Period, with file names/dates: (array)`log`, archive of all Files downloaded in prior Periods, with file names/dates: (array)`archive`.
227
* @package s2Member\Files
228
* @since 111026
229
*
230
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
231
* @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
232
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
233
* @return int The total for this particular ``$file``, based on configuration of function arguments.
262
* @package s2Member\Files
263
* @since 111026
264
*
265
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
266
* @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
267
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
268
* @return int The total for this particular ``$file``, based on configuration of function arguments.
includes/classes/installation.inc.php CHANGED
@@ -94,7 +94,7 @@ if(!class_exists("c_ws_plugin__s2member_installation"))
94
if(!$v || !version_compare($v, "110912", ">=") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === array("all"))
95
// s2Member v110912 changed the way the "all" option for Alternative Views was handled.
96
{
97
- $notice = '<strong>IMPORTANT:</strong> This version of s2Member® changes the way your <code>Alternative View Protections</code> work. Please review your options under: <code>s2Member -› Restriction Options -› Alternative View Protections</code>.';
98
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
99
}
100
@@ -102,10 +102,10 @@ if(!class_exists("c_ws_plugin__s2member_installation"))
102
{
103
c_ws_plugin__s2member_menu_pages::update_all_options(array("ws_plugin__s2member_gateway_debug_logs" => "0", "ws_plugin__s2member_gateway_debug_logs_extensive" => "0"), true, false, false, false, false);
104
105
- $notice = '<strong>IMPORTANT:</strong> This version of s2Member® disables s2Member\'s debug logging by default (for added security). Please see: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member® -› Log Files (Debug) -› Configuration</a> for further details.';
106
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
107
108
- $notice = '<strong>IMPORTANT / Regarding s2Member® Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member® Security Badge until you disable logging (and you MUST also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member® Security Badges</a> for further details. If you have existing s2Member® log files, you will need to delete those files from the server before your s2Member® Security Badge can be re-enabled. s2Member® stores log files here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code>. See also: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member® -› Log Files (Debug) -› Configuration</a> for further details.';
109
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
110
}
111
@@ -119,7 +119,7 @@ if(!class_exists("c_ws_plugin__s2member_installation"))
119
}
120
else // Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide.
121
{
122
- $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
123
124
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, "blog:users.php", false, false, true);
125
94
if(!$v || !version_compare($v, "110912", ">=") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === array("all"))
95
// s2Member v110912 changed the way the "all" option for Alternative Views was handled.
96
{
97
+ $notice = '<strong>IMPORTANT:</strong> This version of s2Member changes the way your <code>Alternative View Protections</code> work. Please review your options under: <code>s2Member -› Restriction Options -› Alternative View Protections</code>.';
98
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
99
}
100
102
{
103
c_ws_plugin__s2member_menu_pages::update_all_options(array("ws_plugin__s2member_gateway_debug_logs" => "0", "ws_plugin__s2member_gateway_debug_logs_extensive" => "0"), true, false, false, false, false);
104
105
+ $notice = '<strong>IMPORTANT:</strong> This version of s2Member disables s2Member\'s debug logging by default (for added security). Please see: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
106
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
107
108
+ $notice = '<strong>IMPORTANT / Regarding s2Member Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member Security Badge until you disable logging (and you MUST also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a> for further details. If you have existing s2Member log files, you will need to delete those files from the server before your s2Member Security Badge can be re-enabled. s2Member stores log files here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code>. See also: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
109
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
110
}
111
119
}
120
else // Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide.
121
{
122
+ $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
123
124
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, "blog:users.php", false, false, true);
125
includes/classes/list-servers.inc.php CHANGED
@@ -66,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
66
*
67
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
68
* @todo Add a separate option for mail debugging; or consolidate?
69
- * @todo Integrate AWeber® API (much like the MailChimp® API).
70
*/
71
public static function process_list_servers ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE, $double_opt_in = TRUE, $user_id = FALSE)
72
{
@@ -85,10 +85,10 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
85
86
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
87
{
88
- if /* Include the MailChimp® API Class here. */ (!class_exists ("NC_MCAPI"))
89
- include_once /* MailChimp® API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
90
91
- $mcapi = /* MailChimp® API (no-conflict). */ new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
92
93
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
94
{
@@ -155,7 +155,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
155
$aweber["pass_inclusion"] = (apply_filters ("ws_plugin__s2member_aweber_pass_inclusion", false, get_defined_vars ()) && $pass) ? "\nPass: " . $pass : false;
156
$buyer = ($fname || $lname) ? trim ($fname . " " . $lname) : /* Must have. AWeber's PayPal Email Parser chokes on an empty value. */ ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
157
158
- if ($aweber["wp_mail_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber® List ID converts to email address @aweber.com.
159
($aweber["wp_mail_sbj"] = apply_filters ("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ())), // These Filters make it possible to customize these emails.
160
($aweber["wp_mail_msg"] = apply_filters ("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ((is_multisite () && !is_main_site ()) ? $current_blog->domain . $current_blog->path : $_SERVER["HTTP_HOST"]) . "\nEMail Address: " . $email . "\nBuyer: " . $buyer . "\nFull Name: " . trim ($fname . " " . $lname) . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber["pass_inclusion"] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end.", get_defined_vars ())),
161
($aweber["wp_mail_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["bcc"]) ? "\r\nBcc: " . $aweber["bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
@@ -213,7 +213,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
213
*
214
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
215
* @todo Add a separate option for mail debugging; or consolidate?
216
- * @todo Integrate AWeber® API (much like the MailChimp® API).
217
*/
218
public static function process_list_server_removals ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_out = FALSE, $user_id = FALSE)
219
{
@@ -232,10 +232,10 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
232
233
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
234
{
235
- if /* Include the MailChimp® API Class here. */ (!class_exists ("NC_MCAPI"))
236
- include_once /* MailChimp® API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
237
238
- $mcapi = /* MailChimp® API (no-conflict). */ new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
239
240
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
241
{
@@ -281,8 +281,8 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
281
c_ws_plugin__s2member_email_configs::email_config (); // Email configs MUST be ON for removal requests.
282
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
283
284
- if ($aweber["wp_mail_removal_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber® List ID converts to email address @aweber.com.
285
- ($aweber["wp_mail_removal_sbj"] = apply_filters ("ws_plugin__s2member_aweber_removal_sbj", "REMOVE#" . $email . "#s2Member#" . $aweber["list_id"], get_defined_vars ())), // Bug fix. AWeber® does not like dots (possibly other chars) in the Ad Tracking field. Now using just: `s2Member`.
286
($aweber["wp_mail_removal_msg"] = "REMOVE"), ($aweber["wp_mail_removal_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["removal_bcc"]) ? "\r\nBcc: " . $aweber["removal_bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
287
$aweber["wp_mail_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
288
@@ -331,7 +331,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
331
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
332
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
333
*
334
- * @param int|str $user_id Required. A WordPress® User ID, numeric string or integer.
335
* @param array $vars Required. An array of defined variables passed by the calling Hook.
336
* @param str $event Required. A specific event that triggered this call from the Action Hook.
337
* @param str $event_spec Required. A specific event specification *(a broader classification)*.
66
*
67
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
68
* @todo Add a separate option for mail debugging; or consolidate?
69
+ * @todo Integrate AWeber API (much like the MailChimp API).
70
*/
71
public static function process_list_servers ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE, $double_opt_in = TRUE, $user_id = FALSE)
72
{
85
86
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
87
{
88
+ if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
89
+ include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
90
91
+ $mcapi = /* MailChimp API (no-conflict). */ new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
92
93
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
94
{
155
$aweber["pass_inclusion"] = (apply_filters ("ws_plugin__s2member_aweber_pass_inclusion", false, get_defined_vars ()) && $pass) ? "\nPass: " . $pass : false;
156
$buyer = ($fname || $lname) ? trim ($fname . " " . $lname) : /* Must have. AWeber's PayPal Email Parser chokes on an empty value. */ ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
157
158
+ if ($aweber["wp_mail_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
159
($aweber["wp_mail_sbj"] = apply_filters ("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ())), // These Filters make it possible to customize these emails.
160
($aweber["wp_mail_msg"] = apply_filters ("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ((is_multisite () && !is_main_site ()) ? $current_blog->domain . $current_blog->path : $_SERVER["HTTP_HOST"]) . "\nEMail Address: " . $email . "\nBuyer: " . $buyer . "\nFull Name: " . trim ($fname . " " . $lname) . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber["pass_inclusion"] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end.", get_defined_vars ())),
161
($aweber["wp_mail_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["bcc"]) ? "\r\nBcc: " . $aweber["bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
213
*
214
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
215
* @todo Add a separate option for mail debugging; or consolidate?
216
+ * @todo Integrate AWeber API (much like the MailChimp API).
217
*/
218
public static function process_list_server_removals ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_out = FALSE, $user_id = FALSE)
219
{
232
233
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
234
{
235
+ if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
236
+ include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
237
238
+ $mcapi = /* MailChimp API (no-conflict). */ new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
239
240
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
241
{
281
c_ws_plugin__s2member_email_configs::email_config (); // Email configs MUST be ON for removal requests.
282
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
283
284
+ if ($aweber["wp_mail_removal_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
285
+ ($aweber["wp_mail_removal_sbj"] = apply_filters ("ws_plugin__s2member_aweber_removal_sbj", "REMOVE#" . $email . "#s2Member#" . $aweber["list_id"], get_defined_vars ())), // Bug fix. AWeber does not like dots (possibly other chars) in the Ad Tracking field. Now using just: `s2Member`.
286
($aweber["wp_mail_removal_msg"] = "REMOVE"), ($aweber["wp_mail_removal_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["removal_bcc"]) ? "\r\nBcc: " . $aweber["removal_bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
287
$aweber["wp_mail_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
288
331
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
332
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
333
*
334
+ * @param int|str $user_id Required. A WordPress User ID, numeric string or integer.
335
* @param array $vars Required. An array of defined variables passed by the calling Hook.
336
* @param str $event Required. A specific event that triggered this call from the Action Hook.
337
* @param str $event_spec Required. A specific event specification *(a broader classification)*.
includes/classes/login-checks.inc.php ADDED
@@ -0,0 +1,209 @@