Source Code Documentation


s2member.php

The main plugin file.

This file loads the plugin after checking PHP, WordPress® and other compatibility requirements.


  1. <?php
  2. /**
  3. * The main plugin file.
  4. *
  5. * This file loads the plugin after checking
  6. * PHP, WordPress® and other compatibility requirements.
  7. *
  8. * Copyright: © 2009-2011
  9. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  10. * (coded in the USA)
  11. *
  12. * Released under the terms of the GNU General Public License.
  13. * You should have received a copy of the GNU General Public License,
  14. * along with this software. In the main directory, see: /licensing/
  15. * If not, see: {@link http://www.gnu.org/licenses/}.
  16. *
  17. * @package s2Member
  18. * @since 1.0
  19. */
  20. /* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
  21.  
  22. Version: 130513
  23. Stable tag: 130513
  24.  
  25. SSL Compatible: yes
  26. bbPress® Compatible: yes
  27. WordPress® Compatible: yes
  28. BuddyPress® Compatible: yes
  29. WP® Multisite Compatible: yes
  30. Multisite Blog Farm Compatible: yes
  31.  
  32. PayPal® Standard Compatible: yes
  33. PayPal® Pro Compatible: yes w/s2Member® Pro
  34. Authorize.Net® Compatible: yes w/s2Member® Pro
  35. Google® Checkout Compatible: yes w/s2Member® Pro
  36. ClickBank® Compatible: yes w/s2Member® Pro
  37.  
  38. Tested up to: 3.6-alpha
  39. Requires at least: 3.3
  40.  
  41. Copyright: © 2009 WebSharks, Inc.
  42. License: GNU General Public License
  43. Contributors: WebSharks
  44.  
  45. Author: s2Member® / WebSharks, Inc.
  46. Author URI: http://www.s2member.com/
  47. Donate link: http://www.s2member.com/donate/
  48.  
  49. Text Domain: s2member
  50. Domain Path: /includes/translations
  51.  
  52. Plugin Name: s2Member® Framework
  53. Forum URI: http://www.s2member.com/forums/
  54. Plugin URI: http://www.s2member.com/framework/
  55. Privacy URI: http://www.s2member.com/privacy/
  56. Video Tutorials: http://www.s2member.com/videos/
  57. Pro Module / Home Page: http://www.s2member.com/
  58. Pro Module / Prices: http://www.s2member.com/prices/
  59. Pro Module / Auto-Update URL: http://www.s2member.com/
  60. PayPal Pro Integration: http://www.s2member.com/videos/ED70D90C6749DA3D/
  61. Professional Installation URI: http://www.s2member.com/professional-installation/
  62.  
  63. Description: s2Member®, a powerful (free) membership plugin for WordPress®. Protect/secure members only content with roles/capabilities.
  64. Tags: s2, s2member, s2 member, membership, users, user, members, member, subscribers, subscriber, members only, roles, capabilities, capability, register, signup, paypal, paypal pro, pay pal, authorize, authorize.net, google checkout, clickbank, click bank, buddypress, buddy press, bbpress, bb press, shopping cart, cart, checkout, ecommerce
  65.  
  66. -- end section for WordPress® parsing. ------------------------------------------------------------------------------- */
  67. if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
  68. exit("Do not access this file directly.");
  69. /**
  70. * The installed version of s2Member.
  71. *
  72. * @package s2Member
  73. * @since 3.0
  74. *
  75. * @var str
  76. */
  77. if(!defined("WS_PLUGIN__S2MEMBER_VERSION"))
  78. define("WS_PLUGIN__S2MEMBER_VERSION", "130513" /* !#distro-version#! */);
  79. /**
  80. * Minimum PHP version required to run s2Member.
  81. *
  82. * @package s2Member
  83. * @since 3.0
  84. *
  85. * @var str
  86. */
  87. if(!defined("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION"))
  88. define("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2" /* !#php-requires-at-least-version#! */);
  89. /**
  90. * Minimum WordPress® version required to run s2Member.
  91. *
  92. * @package s2Member
  93. * @since 3.0
  94. *
  95. * @var str
  96. */
  97. if(!defined("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION"))
  98. define("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.3" /* !#wp-requires-at-least-version#! */);
  99. /**
  100. * Minimum Pro version required by the Framework.
  101. *
  102. * @package s2Member
  103. * @since 3.0
  104. *
  105. * @var str
  106. */
  107. if(!defined("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION"))
  108. define("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "130513" /* !#distro-version#! */);
  109. /*
  110. Several compatibility checks.
  111. If all pass, load the s2Member plugin.
  112. */
  113. if(version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") && version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">=") && !isset($GLOBALS["WS_PLUGIN__"]["s2member"]))
  114. {
  115. $GLOBALS["WS_PLUGIN__"]["s2member"]["l"] = __FILE__;
  116. /*
  117. Hook before loaded.
  118. */
  119. do_action("ws_plugin__s2member_before_loaded");
  120. /*
  121. System configuraton.
  122. */
  123. include_once dirname(__FILE__)."/includes/syscon.inc.php";
  124. /*
  125. Hooks and Filters.
  126. */
  127. include_once dirname(__FILE__)."/includes/hooks.inc.php";
  128. /*
  129. Hook after system config & Hooks are loaded.
  130. */
  131. do_action("ws_plugin__s2member_config_hooks_loaded");
  132. /*
  133. Load a possible Pro module, if/when available.
  134. */
  135. if(apply_filters("ws_plugin__s2member_load_pro", true) && file_exists(dirname(__FILE__)."-pro/pro-module.php"))
  136. {
  137. include_once dirname(__FILE__)."-pro/pro-module.php";
  138. if(is_dir(WP_PLUGIN_DIR."/codestyling-localization") && !is_dir(dirname(__FILE__)."/s2member-pro") && function_exists("symlink"))
  139. {
  140. // Removing this for now. It causes problems during upgrades.
  141. //@symlink(dirname(__FILE__)."-pro", dirname(__FILE__)."/s2member-pro"); // For CS localization compatibility.
  142. //@chmod(dirname(__FILE__)."/s2member-pro", 0755);
  143. }
  144. }
  145. /*
  146. Configure options and their defaults.
  147. */
  148. ws_plugin__s2member_configure_options_and_their_defaults();
  149. /*
  150. Function includes.
  151. */
  152. include_once dirname(__FILE__)."/includes/funcs.inc.php";
  153. /*
  154. Include Shortcodes.
  155. */
  156. include_once dirname(__FILE__)."/includes/codes.inc.php";
  157. /*
  158. Hooks after loaded.
  159. */
  160. do_action("ws_plugin__s2member_loaded");
  161. do_action("ws_plugin__s2member_after_loaded");
  162. }
  163. /*
  164. Else NOT compatible. Do we need admin compatibility errors now?
  165. */
  166. else if(is_admin()) // Admin compatibility errors.
  167. {
  168. if(!version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">="))
  169. {
  170. add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need PHP v\' . WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
  171. }
  172. else if(!version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">="))
  173. {
  174. add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need WordPress® v\' . WS_PLUGIN__S2MEMBER_MIN_WP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
  175. }
  176. }
  177. ?>

s2member.php

Source Code Documentation