Source Code Documentation


s2member\includes\classes\op-notices.inc.php


  1. <?php
  2. /**
  3. * Option panel notices.
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * (coded in the USA)
  8. *
  9. * Released under the terms of the GNU General Public License.
  10. * You should have received a copy of the GNU General Public License,
  11. * along with this software. In the main directory, see: /licensing/
  12. * If not, see: {@link http://www.gnu.org/licenses/}.
  13. *
  14. * @package s2Member\Option_Notices
  15. * @since 3.5
  16. */
  17. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  18. exit ("Do not access this file directly.");
  19.  
  20. if (!class_exists ("c_ws_plugin__s2member_op_notices"))
  21. {
  22. /**
  23. * Option panel notices.
  24. *
  25. * @package s2Member\Option_Notices
  26. * @since 3.5
  27. */
  28. class c_ws_plugin__s2member_op_notices
  29. {
  30. /**
  31. * Describes the General Option overrides for clarity.
  32. *
  33. * @package s2Member\Option_Notices
  34. * @since 3.5
  35. *
  36. * @attaches-to ``add_action("load-options-general.php");``
  37. *
  38. * @return null
  39. */
  40. public static function general_ops_notice ()
  41. {
  42. global $pagenow; // Need this global variable.
  43.  
  44. do_action ("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
  45.  
  46. if (is_blog_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) // Multisite does NOT provide these options.
  47. {
  48. $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>.<br />For further details, see: <code>s2Member -› General Options -› Open Registration</code>.";
  49.  
  50. $js = '<script type="text/javascript">';
  51. $js .= "jQuery('input#users_can_register, select#default_role').attr('disabled', 'disabled');";
  52. $js .= '</script>';
  53.  
  54. do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
  55.  
  56. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "blog:" . $pagenow);
  57. }
  58.  
  59. do_action ("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
  60.  
  61. return /* Return for uniformity. */;
  62. }
  63. /**
  64. * Describes the Multisite Option overrides for clarity.
  65. *
  66. * @package s2Member\Option_Notices
  67. * @since 3.5
  68. *
  69. * @attaches-to ``add_action("load-settings.php");``
  70. *
  71. * @return null
  72. */
  73. public static function multisite_ops_notice ()
  74. {
  75. global $pagenow; // Need this global variable.
  76.  
  77. do_action ("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
  78.  
  79. if (is_multisite () && is_network_admin () && in_array ($pagenow, array ("settings.php")) && !isset ($_GET["page"]))
  80. {
  81. $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <code>s2Member -› Multisite (Config)</code>.";
  82.  
  83. $js = '<script type="text/javascript">';
  84. $js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
  85. $js .= '</script>';
  86.  
  87. do_action ("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
  88.  
  89. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "network:" . $pagenow);
  90. }
  91.  
  92. do_action ("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
  93.  
  94. return /* Return for uniformity. */;
  95. }
  96. /**
  97. * Deals with Reading Option conflicts.
  98. *
  99. * @package s2Member\Option_Notices
  100. * @since 3.5
  101. *
  102. * @attaches-to ``add_action("load-options-reading.php");``
  103. *
  104. * @return null
  105. */
  106. public static function reading_ops_notice ()
  107. {
  108. global $pagenow; // Need this global variable.
  109.  
  110. do_action ("ws_plugin__s2member_before_reading_ops_notice", get_defined_vars ());
  111.  
  112. if (is_blog_admin () && $pagenow === "options-reading.php" && !isset ($_GET["page"]))
  113. {
  114. do_action ("ws_plugin__s2member_during_reading_ops_notice", get_defined_vars ()); // Now check for conflicts.
  115.  
  116. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
  117. && ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Home Page (i.e. static page) for WordPress®. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
  118. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
  119.  
  120. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]
  121. && ($notice = '<strong>NOTE:</strong> Your Login Welcome Page for s2Member is currently configured as your Home Page (i.e. static page) for WordPress®. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this.'))
  122. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
  123.  
  124. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_for_posts") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
  125. && ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Posts Page (i.e. static page) for WordPress®. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
  126. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
  127.  
  128. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (string)get_option ("page_for_posts") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]
  129. && ($notice = '<strong>NOTE:</strong> Your Login Welcome Page for s2Member is currently configured as your Posts Page (i.e. static page) for WordPress®. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this.'))
  130. c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
  131. }
  132.  
  133. do_action ("ws_plugin__s2member_after_reading_ops_notice", get_defined_vars ());
  134.  
  135. return /* Return for uniformity. */;
  136. }
  137. }
  138. }
  139. ?>

s2member\includes\classes\op-notices.inc.php

Source Code Documentation