Source Code Documentation


pro\s2member-pro\pro-module.php


  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. * 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. * The installed version of s2Member Pro.
  40. *
  41. * @package s2Member
  42. * @since 1.0
  43. *
  44. * @var str
  45. */
  46. if(!defined("WS_PLUGIN__S2MEMBER_PRO_VERSION"))
  47. define("WS_PLUGIN__S2MEMBER_PRO_VERSION", "130513" /* !#distro-version#! */);
  48. /**
  49. * Minimum PHP version required to run s2Member Pro.
  50. *
  51. * @package s2Member
  52. * @since 1.0
  53. *
  54. * @var str
  55. */
  56. if(!defined("WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION"))
  57. define("WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION", "5.2" /* !#php-requires-at-least-version#! */);
  58. /**
  59. * Minimum WordPress® version required to run s2Member Pro.
  60. *
  61. * @package s2Member
  62. * @since 1.0
  63. *
  64. * @var str
  65. */
  66. if(!defined("WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION"))
  67. define("WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION", "3.3" /* !#wp-requires-at-least-version#! */);
  68. /**
  69. * Minimum Framework version required by s2Member Pro.
  70. *
  71. * @package s2Member
  72. * @since 1.0
  73. *
  74. * @var str
  75. */
  76. if(!defined("WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION"))
  77. define("WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION", "130513" /* !#distro-version#! */);
  78. /*
  79. Several compatibility checks.
  80. If all pass, load the s2Member plugin.
  81. */
  82. if(version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION, ">=") && version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION, ">=") && defined("WS_PLUGIN__S2MEMBER_VERSION") && defined("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION") && version_compare(WS_PLUGIN__S2MEMBER_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION, ">=") && version_compare(WS_PLUGIN__S2MEMBER_PRO_VERSION, WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION, ">=") && !isset($GLOBALS["WS_PLUGIN__"]["s2member_pro"]))
  83. {
  84. $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["l"] = __FILE__;
  85. /*
  86. Hook before loaded.
  87. */
  88. do_action("ws_plugin__s2member_pro_before_loaded");
  89. /*
  90. System configuraton.
  91. */
  92. include_once dirname(__FILE__)."/includes/syscon.inc.php";
  93. /*
  94. Hooks and Filters.
  95. */
  96. include_once dirname(__FILE__)."/includes/hooks.inc.php";
  97. /*
  98. Hook after system config & Hooks are loaded.
  99. */
  100. do_action("ws_plugin__s2member_pro_config_hooks_loaded");
  101. /*
  102. Function includes.
  103. */
  104. include_once dirname(__FILE__)."/includes/funcs.inc.php";
  105. /*
  106. Include Shortcodes.
  107. */
  108. include_once dirname(__FILE__)."/includes/codes.inc.php";
  109. /*
  110. Hooks after loaded.
  111. */
  112. do_action("ws_plugin__s2member_pro_loaded");
  113. do_action("ws_plugin__s2member_pro_after_loaded");
  114. }
  115. /*
  116. Else NOT compatible. Do we need admin compatibility errors now?
  117. */
  118. else if(is_admin()) // Admin compatibility errors.
  119. {
  120. if(!version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION, ">="))
  121. {
  122. add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need PHP v\' . WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION . \'+ to use the s2Member Pro Module.</p></div>\';'));
  123. }
  124. else if(!version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION, ">="))
  125. {
  126. add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need WordPress® v\' . WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION . \'+ to use the s2Member Pro Module.</p></div>\';'));
  127. }
  128. else if(!defined("WS_PLUGIN__S2MEMBER_VERSION") || !defined("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION") || !version_compare(WS_PLUGIN__S2MEMBER_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION, ">="))
  129. {
  130. add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>In order to load the s2Member Pro Module, you need the <a href="\' . c_ws_plugin__s2member_readmes::parse_readme_value ("Plugin URI") . \'" target="_blank">s2Member Framework</a>, v\' . WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION . \'+. It\\\'s free.</p></div>\';'));
  131. }
  132. else if(!version_compare /* They need to upgrade s2Member Pro? */(WS_PLUGIN__S2MEMBER_PRO_VERSION, WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION, ">=") && file_exists(dirname(__FILE__)."/includes/classes/upgrader.inc.php"))
  133. {
  134. include_once /* Include upgrader class. s2Member Pro autoload functionality will NOT be available in this scenario. Using ``include_once()``. */ dirname(__FILE__)."/includes/classes/upgrader.inc.php";
  135. add_action("admin_init", "c_ws_plugin__s2member_pro_upgrader::upgrade").add_action("all_admin_notices", create_function('', 'echo c_ws_plugin__s2member_pro_upgrader::wizard ();'));
  136. }
  137. }
  138. ?>

pro\s2member-pro\pro-module.php

Source Code Documentation