Source Code Documentation


s2member-pro\includes\syscon.inc.php


  1. <?php
  2. /**
  3. * System configuration for s2Member Pro.
  4. *
  5. * **WARNING:** This is a system configuration file, please DO NOT EDIT this file directly.
  6. * Instead, use the plugin options panel in WordPress® to override these settings.
  7. *
  8. * Copyright: © 2009-2011
  9. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  10. * ( coded in the USA )
  11. *
  12. * This WordPress® plugin ( s2Member Pro ) is comprised of two parts:
  13. *
  14. * o (1) Its PHP code is licensed under the GPL license, as is WordPress®.
  15. * You should have received a copy of the GNU General Public License,
  16. * along with this software. In the main directory, see: /licensing/
  17. * If not, see: {@link http://www.gnu.org/licenses/}.
  18. *
  19. * o (2) All other parts of ( s2Member Pro ); including, but not limited to:
  20. * the CSS code, some JavaScript code, images, and design;
  21. * are licensed according to the license purchased.
  22. * See: {@link http://www.s2member.com/prices/}
  23. *
  24. * Unless you have our prior written consent, you must NOT directly or indirectly license,
  25. * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module;
  26. * or make an offer to do any of these things. All of these things are strictly
  27. * prohibited with part (2) of the s2Member Pro Module.
  28. *
  29. * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
  30. * ( i.e. new features, bug fixes, updates, improvements ); along with full access
  31. * to our video tutorial library: {@link http://www.s2member.com/videos/}
  32. *
  33. * @package s2Member
  34. * @since 1.0
  35. */
  36. if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
  37. exit("Do not access this file directly.");
  38. /*
  39. Determine the directory.
  40. */
  41. $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir"] = dirname(dirname(__FILE__));
  42. /*
  43. Determine the base directory name.
  44. */
  45. $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_base"] = basename(dirname(dirname(__FILE__)));
  46. /*
  47. Determine full URL to the directory this plugin resides in.
  48. */
  49. $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] = (stripos(__FILE__, WP_CONTENT_DIR) !== 0) ? /* Have to assume plugins dir? */
  50. plugins_url("/".basename(dirname(dirname(__FILE__)))) : /* Otherwise, this gives it a chance to live anywhere in the content dir. */
  51. content_url(preg_replace("/^(.*?)\/".preg_quote(basename(WP_CONTENT_DIR), "/")."/", "", str_replace(DIRECTORY_SEPARATOR, "/", dirname(dirname(__FILE__)))));
  52. /*
  53. Determine correct ``plugin_basename()`` here. WordPress® has a few issues with its ``plugin_basename()`` function across different platforms.
  54. */
  55. $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["plugin_basename"] = basename(dirname($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["l"]))."/".basename($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["l"]);
  56. /*
  57. Turn upsells & donations off in menu pages of back-end adminstrative panels.
  58. */
  59. $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array_merge($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"], array("upsell-pro" => false));
  60. /*
  61. Configure checksum time for both of the syscon.inc.php files.
  62. */
  63. $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] + filemtime(__FILE__);
  64. /*
  65. Configure the number of Membership Levels being used on this installation.
  66. */
  67. if(defined("MEMBERSHIP_LEVELS") && is_numeric(MEMBERSHIP_LEVELS))
  68. if(MEMBERSHIP_LEVELS >= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["min_levels"] && MEMBERSHIP_LEVELS <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["max_levels"])
  69. $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] = (int)MEMBERSHIP_LEVELS;
  70. /*
  71. Add some new default options for the Pro Module.
  72. */
  73. if(!function_exists("ws_plugin__s2member_pro_default_options"))
  74. {
  75. add_filter("ws_plugin__s2member_default_options", "ws_plugin__s2member_pro_default_options");
  76. /**
  77. * Configures default options array for s2Member Pro.
  78. *
  79. * **WARNING:** This is a system configuration function, please DO NOT EDIT this function directly.
  80. * Instead, use the plugin options panel in WordPress® to override these settings.
  81. *
  82. * @package s2Member
  83. * @since 1.0
  84. *
  85. * @param array $default_options Expects an array of default options passed in by the Filter.
  86. * @return array Merged with default options from the s2Member Framework.
  87. * All Pro options should be prefixed with `pro_`.
  88. */
  89. function ws_plugin__s2member_pro_default_options($default_options = array())
  90. {
  91. $pro_default_options = array( /* Defaults for the Pro Module. */
  92. /**/
  93. "pro_signup_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
  94. "pro_signup_email_subject" => _x("Congratulations! ( your membership has been approved )", "s2member-front", "s2member"),/**/
  95. "pro_signup_email_message" => sprintf(_x("Thanks %%%%first_name%%%%! Your membership has been approved.\n\n%%%%item_name%%%%\n\nSubscr. ID: %%%%subscr_id%%%%\nCharges today: $%%%%initial%%%%\nRecurring charges: $%%%%recurring/regular_cycle%%%%\n\nYour Username/Password will arrive shortly, in a separate email. If you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo("name")),/**/
  96. /**/
  97. "pro_sp_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
  98. "pro_sp_email_subject" => _x("Thank You! ( instructions for access )", "s2member-front", "s2member"),/**/
  99. "pro_sp_email_message" => sprintf(_x("Thanks %%%%first_name%%%%!\n\n%%%%item_name%%%%\n\nTransaction ID: %%%%txn_id%%%%\nCharges today: $%%%%amount%%%%\n\nYour order can be retrieved here:\n%%%%sp_access_url%%%%\n( link expires in %%%%sp_access_exp%%%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo("name")),/**/
  100. /**/
  101. "pro_coupon_codes" => "", /* There are NO Coupon Codes by default. */ "pro_default_tax" => "0.0%", "pro_tax_rates" => "",/**/
  102. "pro_affiliate_coupon_code_tracking_urls" => "", /* A line-delimited list of Coupon Code tracking URLs. */
  103. "pro_affiliate_coupon_code_suffix_chars" => "-A:", /* Chars indicating an Affiliate Coupon Code suffix. */
  104. "pro_login_welcome_page_otos" => "", /* A line-delimited list of Login Welcome Page offers. */
  105. /**/
  106. "pro_gateways_enabled" => array("paypal"), /* Defaults to PayPal® Pro. */
  107. "pro_paypal_checkout_rdp" => "0", "pro_paypal_return_template_header" => "",/**/
  108. "pro_alipay_seller_email" => "", "pro_alipay_partner_id" => "", "pro_alipay_security_code" => "", "pro_alipay_return_template_header" => "",/**/
  109. "pro_authnet_api_login_id" => "", "pro_authnet_api_trans_key" => "", "pro_authnet_api_salt_key" => "", "pro_authnet_sandbox" => "0",/**/
  110. "pro_ccbill_client_id" => "", "pro_ccbill_client_sid" => "0000", "pro_ccbill_form_name" => "", "pro_ccbill_dl_user" => "", "pro_ccbill_dl_pass" => "", "pro_ccbill_dl_cancellations" => "0", "pro_ccbill_salt_key" => "", "pro_ccbill_return_template_header" => "",/**/
  111. "pro_clickbank_username" => "", "pro_clickbank_clerk_key" => "", "pro_clickbank_developer_key" => "", "pro_clickbank_secret_key" => "", "pro_clickbank_return_template_header" => "",/**/
  112. "pro_google_merchant_id" => "", "pro_google_merchant_key" => "", "pro_google_sandbox" => "0",/**/
  113. /**/
  114. "pro_recaptcha_public_key" => "", "pro_recaptcha_private_key" => "");
  115. /**/
  116. return array_merge($default_options, $pro_default_options);
  117. }
  118. }
  119. /*
  120. Check/validate default options for the Pro Module.
  121. */
  122. if(!function_exists("ws_plugin__s2member_pro_options_before_checksum"))
  123. {
  124. add_filter("ws_plugin__s2member_options_before_checksum", "ws_plugin__s2member_pro_options_before_checksum");
  125. /**
  126. * Configures options array; while handling s2Member Pro options.
  127. *
  128. * **WARNING:** This is a system configuration function, please DO NOT EDIT this function directly.
  129. * Instead, use the plugin options panel in WordPress® to override these settings.
  130. *
  131. * @package s2Member
  132. * @since 1.0
  133. *
  134. * @param array $options Expects an array of options, by reference, passed in by the Filter.
  135. * ``$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]``, by reference.
  136. * @return array Merged with options from the s2Member Framework.
  137. * All Pro options should be prefixed with `pro_`.
  138. */
  139. function ws_plugin__s2member_pro_options_before_checksum(&$options = array())
  140. {
  141. $pro_default_options = ws_plugin__s2member_pro_default_options();
  142. /*
  143. Backward compatibility for "pro_paypal_default_tax"; renamed in v1.3.
  144. */
  145. if(isset($options["pro_paypal_default_tax"]))
  146. $options["pro_default_tax"] = $options["pro_paypal_default_tax"];
  147. /*
  148. Backward compatibility for "pro_paypal_tax_rates"; renamed in v1.3.
  149. */
  150. if(isset($options["pro_paypal_tax_rates"]))
  151. $options["pro_tax_rates"] = $options["pro_paypal_tax_rates"];
  152. /*
  153. Backward compatibility for "pro_other_gateways_enabled"; renamed in v1.5.
  154. */
  155. if(isset($options["pro_other_gateways_enabled"]) && is_array($options["pro_other_gateways_enabled"]))
  156. $options["pro_gateways_enabled"] = array_unique(array_merge($options["pro_other_gateways_enabled"], $pro_default_options["pro_gateways_enabled"]));
  157. /**/
  158. foreach($options /* $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] */ as $key => &$value)
  159. {
  160. if(isset($pro_default_options[$key]) || preg_match("/^pro_/", $key))
  161. {
  162. if(!isset($pro_default_options[$key]))
  163. unset($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
  164. /**/
  165. else if(preg_match("/^pro_(?:signup|sp)_email_recipients$/", $key) && !is_string($value))
  166. $value = $pro_default_options[$key];
  167. /**/
  168. else if(preg_match("/^pro_(?:signup|sp)_email_(?:subject|message)$/", $key) && (!is_string($value) || !strlen($value)))
  169. $value = $pro_default_options[$key];
  170. /**/
  171. else if(preg_match("/^pro_(?:coupon_codes|affiliate_coupon_code_(?:tracking_urls|suffix_chars))$/", $key) && (!is_string($value) || !strlen($value)))
  172. $value = $pro_default_options[$key];
  173. /**/
  174. else if($key === "pro_default_tax" && (!is_string($value) || !strlen($value)))
  175. $value = $pro_default_options[$key];
  176. /**/
  177. else if($key === "pro_tax_rates" && (!is_string($value) || !strlen($value)))
  178. $value = $pro_default_options[$key];
  179. /**/
  180. else if($key === "pro_login_welcome_page_otos" && (!is_string($value) || !strlen($value)))
  181. $value = $pro_default_options[$key];
  182. /**/
  183. else if($key === "pro_gateways_enabled" && !is_array($value))
  184. $value = $pro_default_options[$key];
  185. /**/
  186. else if($key === "pro_paypal_checkout_rdp" && (!is_string($value) || !is_numeric($value)))
  187. $value = $pro_default_options[$key];
  188. /**/
  189. else if($key === "pro_paypal_return_template_header" && (!is_string($value) || !strlen($value)))
  190. $value = $pro_default_options[$key];
  191. /**/
  192. else if(preg_match("/^pro_alipay_(?:seller_email|partner_id|security_code|return_template_header)$/", $key) && (!is_string($value) || !strlen($value)))
  193. $value = $pro_default_options[$key];
  194. /**/
  195. else if(preg_match("/^pro_authnet_(?:api_login_id|api_trans_key|api_salt_key)$/", $key) && (!is_string($value) || !strlen($value)))
  196. $value = $pro_default_options[$key];
  197. /**/
  198. else if(preg_match("/^pro_ccbill_(?:client_id|client_sid|form_name|dl_user|dl_pass|dl_cancellations|salt_key|return_template_header)$/", $key) && (!is_string($value) || !strlen($value)))
  199. $value = $pro_default_options[$key];
  200. /**/
  201. else if(preg_match("/^pro_clickbank_(?:username|clerk_key|developer_key|secret_key|return_template_header)$/", $key) && (!is_string($value) || !strlen($value)))
  202. $value = $pro_default_options[$key];
  203. /**/
  204. else if(preg_match("/^pro_google_(?:merchant_id|merchant_key)$/", $key) && (!is_string($value) || !strlen($value)))
  205. $value = $pro_default_options[$key];
  206. /**/
  207. else if(preg_match("/^pro_(?:google|authnet)_sandbox$/", $key) && (!is_string($value) || !is_numeric($value)))
  208. $value = $pro_default_options[$key];
  209. /**/
  210. else if(preg_match("/^pro_recaptcha_(?:public|private)_key$/", $key) && (!is_string($value) || !strlen($value)))
  211. $value = $pro_default_options[$key];
  212. }
  213. }
  214. /**/
  215. return $options; /* $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] by reference. */
  216. }
  217. }
  218. ?>

s2member-pro\includes\syscon.inc.php

Source Code Documentation