PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 110815
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v110815
260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 120219 All 188 releases
s2member / includes / classes / menu-pages.inc.php

menu-pages.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 110815, at includes/classes/menu-pages.inc.php

677 lines 41.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Administrative menu pages.
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\Menu_Pages
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_menu_pages"))
21 {
22 /**
23 * Administrative menu pages.
24 *
25 * @package s2Member\Menu_Pages
26 * @since 3.5
27 */
28 class c_ws_plugin__s2member_menu_pages
29 {
30 /**
31 * Saves all options from any menu page.
32 *
33 * Can also be self-verified; and configured extensively with function parameters.
34 *
35 * @package s2Member\Menu_Pages
36 * @since 3.5
37 *
38 * @param array $new_options Optional. Force feed an array of new options. Defaults to ``$_POST`` vars.
39 * @param bool $verified Optional. Defaults to false. If true, ``wp_verify_nonce()`` is skipped in this routine.
40 * @param bool $update_other Optional. Defaults to true. If false, other option-dependent routines will not be processed.
41 * @param bool|array $display_notices Optional. Defaults to true. Can be false, or an array of certain notices that can be displayed.
42 * @param bool|array $enqueue_notices Optional. Defaults to false. Can be true, or an array of certain notices that should be enqueued.
43 * @param bool $request_refresh Optional. Defaults to false. If true, resulting `success` notice will include a link to refresh the menu page.
44 * @return bool True if options were updated successfully.
45 */
46 public static function update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE, $request_refresh = FALSE)
47 {
48 do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use `wp_verify_nonce()`. */
49 /**/
50 if ($verified || (!empty ($_POST["ws_plugin__s2member_options_save"]) && ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
51 {
52 $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Here we get all of the existing options. */
53 $new_options = (is_array ($new_options)) ? $new_options : ((!empty ($_POST)) ? stripslashes_deep ($_POST) : array ());
54 $new_options = c_ws_plugin__s2member_utils_strings::trim_deep ($new_options);
55 /**/
56 foreach ((array)$new_options as $key => $value) /* Looking for relevant keys. */
57 if (preg_match ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", $key))
58 /**/
59 if ($key === "ws_plugin__s2member_configured") /* Configured. */
60 {
61 update_option ("ws_plugin__s2member_configured", $value);
62 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = $value;
63 }
64 else /* Place this option into the array. Remove ws_plugin__s2member_. */
65 {
66 (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded. */
67 $key = preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key);
68 $options[$key] = $value; /* Overriding a possible existing option. */
69 }
70 /**/
71 $options["options_version"] = (string)($options["options_version"] + 0.001);
72 $options = ws_plugin__s2member_configure_options_and_their_defaults ($options);
73 /**/
74 eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
75 do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
76 unset ($__refs, $__v); /* Unset defined __refs, __v. */
77 /**/
78 update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
79 /**/
80 if ($update_other === true || in_array ("auto_eot_system", (array)$update_other)) /* Handle the Auto-EOT System now ( enable/disable ). */
81 ($options["auto_eot_system_enabled"] == 1) ? c_ws_plugin__s2member_auto_eots::add_auto_eot_system () : c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ();
82 /**/
83 if (($display_notices === true || in_array ("success", (array)$display_notices)) && ($notice = '<strong>Options saved.' . (($request_refresh) ? ' Please <a href="' . esc_attr ($_SERVER["REQUEST_URI"]) . '">refresh</a>.' : '') . '</strong>'))
84 ($enqueue_notices === true || in_array ("success", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*") : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice);
85 /**/
86 if ($_GET["page"] !== "ws-plugin--s2member-mms-ops") /* Do NOT display page-conflict-warnings on the Main Multisite Configuration panel. */
87 {
88 if (!$options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.'))
89 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
90 /**/
91 if ($options["login_welcome_page"] && $options["login_welcome_page"] === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page is the same as your Membership Options Page. Please correct this. See: <code>s2Member -> General Options -> Login Welcome Page</code>.'))
92 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
93 /**/
94 if ($options["membership_options_page"] && (string)get_option ("page_on_front") === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Membership Options Page 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. See: <code>WordPress® -> Reading Options</code>. Or change: <code>s2Member -> General Options -> Membership Options Page</code>.'))
95 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
96 /**/
97 if ($options["login_welcome_page"] && (string)get_option ("page_on_front") === $options["login_welcome_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page 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. See: <code>WordPress® -> Reading Options</code>. Or change: <code>s2Member -> General Options -> Login Welcome Page</code>.'))
98 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
99 /**/
100 if ($options["membership_options_page"] && (string)get_option ("page_for_posts") === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Membership Options Page 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. See: <code>WordPress® -> Reading Options</code>. Or change: <code>s2Member -> General Options -> Membership Options Page</code>.'))
101 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
102 /**/
103 if ($options["login_welcome_page"] && (string)get_option ("page_for_posts") === $options["login_welcome_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page 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. See: <code>WordPress® -> Reading Options</code>. Or change: <code>s2Member -> General Options -> Login Welcome Page</code>.'))
104 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
105 /**/
106 if ($options["file_download_limit_exceeded_page"] && $options["file_download_limit_exceeded_page"] === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>s2Member:</strong> Your Download Limit Exceeded Page is the same as your Membership Options Page. Please correct this. See: <code>s2Member -> Download Options</code>.'))
107 ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
108 }
109 /**/
110 $updated_all_options = true; /* Flag indicating this routine was indeed processed. */
111 }
112 /**/
113 do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ());
114 /**/
115 return isset ($updated_all_options) ? $updated_all_options : false;
116 }
117 /**
118 * Adds option menus / sub-menus.
119 *
120 * @package s2Member\Menu_Pages
121 * @since 3.5
122 *
123 * @attaches-to: ``add_action("admin_menu");``
124 *
125 * @return null
126 */
127 public static function add_admin_options ()
128 {
129 do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
130 /**/
131 add_filter ("plugin_action_links", "c_ws_plugin__s2member_menu_pages::_add_settings_link", 10, 2);
132 /**/
133 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
134 {
135 if ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) || apply_filters ("ws_plugin__s2member_during_add_admin_options_clear_right_side", false, get_defined_vars ()))
136 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array (); /* Clear right side. */
137 /**/
138 $menu = apply_filters ("ws_plugin__s2member_during_add_admin_options_menu_slug", "ws-plugin--s2member-start", get_defined_vars ());
139 /**/
140 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_menu_page", true, get_defined_vars ()))
141 add_menu_page ("s2Member®", "s2Member®", "create_users", $menu, "c_ws_plugin__s2member_menu_pages::start_page", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/brand-favicon.png");
142 /**/
143 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_start_page", true, get_defined_vars ()))
144 add_submenu_page ($menu, "s2Member Quick-Start Guide", "Quick-Start Guide", "create_users", "ws-plugin--s2member-start", "c_ws_plugin__s2member_menu_pages::start_page");
145 /**/
146 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_1", true, get_defined_vars ())) /* Divider. */
147 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
148 /**/
149 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_mms_ops_page", (!is_multisite () || is_main_site ()), get_defined_vars ()))
150 add_submenu_page ($menu, "s2Member Multisite Configuration", "Multisite (Config)", "create_users", "ws-plugin--s2member-mms-ops", "c_ws_plugin__s2member_menu_pages::mms_ops_page");
151 /**/
152 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_gen_ops_page", true, get_defined_vars ()))
153 add_submenu_page ($menu, "s2Member General Options", "General Options", "create_users", "ws-plugin--s2member-gen-ops", "c_ws_plugin__s2member_menu_pages::gen_ops_page");
154 /**/
155 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_res_ops_page", true, get_defined_vars ()))
156 add_submenu_page ($menu, "s2Member Restriction Options", "Restriction Options", "create_users", "ws-plugin--s2member-res-ops", "c_ws_plugin__s2member_menu_pages::res_ops_page");
157 /**/
158 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_down_ops_page", (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()), get_defined_vars ()))
159 add_submenu_page ($menu, "s2Member Download Options", "Download Options", "create_users", "ws-plugin--s2member-down-ops", "c_ws_plugin__s2member_menu_pages::down_ops_page");
160 /**/
161 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_2", true, get_defined_vars ())) /* Divider. */
162 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
163 /**/
164 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_new_user_page", true, get_defined_vars ())) /* Shortcut. */
165 add_submenu_page ($menu, "s2Member / Add A Member", "Add A Member", "create_users", "user-new.php");
166 /**/
167 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_browse_users_page", true, get_defined_vars ())) /* Shortcut. */
168 add_submenu_page ($menu, "s2Member / Browse Members", "Browse Members", "create_users", "users.php");
169 /**/
170 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_3", true, get_defined_vars ())) /* Divider. */
171 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
172 /**/
173 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_ops_page", true, get_defined_vars ()))
174 add_submenu_page ($menu, "s2Member PayPal Options", "PayPal® Options", "create_users", "ws-plugin--s2member-paypal-ops", "c_ws_plugin__s2member_menu_pages::paypal_ops_page");
175 /**/
176 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_buttons_page", true, get_defined_vars ()))
177 add_submenu_page ($menu, "s2Member PayPal® Buttons", "PayPal® Buttons", "create_users", "ws-plugin--s2member-paypal-buttons", "c_ws_plugin__s2member_menu_pages::paypal_buttons_page");
178 /**/
179 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_4", true, get_defined_vars ())) /* Divider. */
180 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
181 /**/
182 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_trk_ops_page", true, get_defined_vars ()))
183 add_submenu_page ($menu, "s2Member API / Tracking", "API / Tracking", "create_users", "ws-plugin--s2member-trk-ops", "c_ws_plugin__s2member_menu_pages::trk_ops_page");
184 /**/
185 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_els_ops_page", true, get_defined_vars ()))
186 add_submenu_page ($menu, "s2Member API / List Servers", "API / List Servers", "create_users", "ws-plugin--s2member-els-ops", "c_ws_plugin__s2member_menu_pages::els_ops_page");
187 /**/
188 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_api_ops_page", true, get_defined_vars ()))
189 add_submenu_page ($menu, "s2Member API / Notifications", "API / Notifications", "create_users", "ws-plugin--s2member-api-ops", "c_ws_plugin__s2member_menu_pages::api_ops_page");
190 /**/
191 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_scripting_page", true, get_defined_vars ()))
192 add_submenu_page ($menu, "s2Member API / Scripting", "API / Scripting", "create_users", "ws-plugin--s2member-scripting", "c_ws_plugin__s2member_menu_pages::scripting_page");
193 /**/
194 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_5", true, get_defined_vars ())) /* Divider. */
195 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
196 /**/
197 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_integrations_page", (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()), get_defined_vars ()))
198 add_submenu_page ($menu, "s2Member / Other Integrations", "Other Integrations", "create_users", "ws-plugin--s2member-integrations", "c_ws_plugin__s2member_menu_pages::integrations_page");
199 /**/
200 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_6", true, get_defined_vars ())) /* Divider. */
201 add_submenu_page ($menu, "-", '<div style="margin:1px 0 1px -5px; height:1px; line-height:1px; background:#CCCCCC;"></div>', "create_users", "#");
202 /**/
203 if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_info_page", (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()), get_defined_vars ()))
204 add_submenu_page ($menu, "s2Member Information", "s2Member Info", "create_users", "ws-plugin--s2member-info", "c_ws_plugin__s2member_menu_pages::info_page");
205 /**/
206 do_action ("ws_plugin__s2member_during_add_admin_options_additional_pages", get_defined_vars ());
207 }
208 /**/
209 do_action ("ws_plugin__s2member_after_add_admin_options", get_defined_vars ());
210 /**/
211 return; /* Return for uniformity. */
212 }
213 /**
214 * Adds network option menus / sub-menus.
215 *
216 * @package s2Member\Menu_Pages
217 * @since 3.5
218 *
219 * @attaches-to: ``add_action("network_admin_menu");``
220 *
221 * @return null
222 */
223 public static function add_network_admin_options ()
224 {
225 do_action ("ws_plugin__s2member_before_add_network_admin_options", get_defined_vars ());
226 /**/
227 if (apply_filters ("ws_plugin__s2member_during_add_network_admin_options_create_menu_items", true, get_defined_vars ()))
228 {
229 if ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) || apply_filters ("ws_plugin__s2member_during_add_network_admin_options_clear_right_side", false, get_defined_vars ()))
230 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array (); /* Clear right side. */
231 /**/
232 $menu = "ws-plugin--s2member-mms-ops"; /* Used below for nesting additional sub-menu pages. */
233 /**/
234 add_menu_page ("s2Member®", "s2Member®", "create_users", $menu, "c_ws_plugin__s2member_menu_pages::mms_ops_page", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/brand-favicon.png");
235 /**/
236 add_submenu_page ($menu, "s2Member Multisite ( Configuration )", "Multisite (Config)", "create_users", "ws-plugin--s2member-mms-ops", "c_ws_plugin__s2member_menu_pages::mms_ops_page");
237 /**/
238 if (apply_filters ("ws_plugin__s2member_during_add_network_admin_options_add_info_page", (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()), get_defined_vars ()))
239 add_submenu_page ($menu, "s2Member Information", "s2Member Info", "create_users", "ws-plugin--s2member-info", "c_ws_plugin__s2member_menu_pages::info_page");
240 /**/
241 do_action ("ws_plugin__s2member_during_add_network_admin_options_additional_pages", get_defined_vars ());
242 }
243 /**/
244 do_action ("ws_plugin__s2member_after_add_network_admin_options", get_defined_vars ());
245 /**/
246 return; /* Return for uniformity. */
247 }
248 /**
249 * A sort of callback function to add the settings link.
250 *
251 * @package s2Member\Menu_Pages
252 * @since 3.5
253 *
254 * @attaches-to: ``add_filter("plugin_action_links");``
255 *
256 * @param array $links Expects an existing array of links, passed in by the Filter.
257 * @param str $file Expects path to a plugin file. We need to test against this for s2Member.
258 * @return array An array of links, Filtered by this routine.
259 */
260 public static function _add_settings_link ($links = FALSE, $file = FALSE)
261 {
262 eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
263 do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
264 unset ($__refs, $__v); /* Unset defined __refs, __v. */
265 /**/
266 if (preg_match ("/" . preg_quote ($file, "/") . "$/", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
267 {
268 $settings = '<a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-gen-ops")) . '">Settings</a>';
269 array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
270 /**/
271 eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
272 do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
273 unset ($__refs, $__v); /* Unset defined __refs, __v. */
274 }
275 /**/
276 return apply_filters ("_ws_plugin__s2member_add_settings_link", $links, get_defined_vars ());
277 }
278 /**
279 * Enqueue scripts for administrative menu pages.
280 *
281 * @package s2Member\Menu_Pages
282 * @since 3.5
283 *
284 * @attaches-to: ``add_action("admin_print_scripts");``
285 *
286 * @return null
287 */
288 public static function add_admin_scripts ()
289 {
290 do_action ("ws_plugin__s2member_before_add_admin_scripts", get_defined_vars ());
291 /**/
292 if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
293 {
294 wp_enqueue_script ("jquery");
295 wp_enqueue_script ("thickbox");
296 wp_enqueue_script ("media-upload");
297 wp_enqueue_script ("jquery-ui-core");
298 wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-json-ps-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
299 wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), c_ws_plugin__s2member_utilities::ver_checksum ());
300 wp_enqueue_script ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_js=" . urlencode (mt_rand ())), array ("jquery", "thickbox", "media-upload", "jquery-json-ps", "jquery-ui-core", "jquery-ui-effects", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum ());
301 /**/
302 do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
303 }
304 /**/
305 do_action ("ws_plugin__s2member_after_add_admin_scripts", get_defined_vars ());
306 /**/
307 return; /* Return for uniformity. */
308 }
309 /**
310 * Enqueue styles for administrative menu pages.
311 *
312 * @package s2Member\Menu_Pages
313 * @since 3.5
314 *
315 * @attaches-to: ``add_action("admin_print_styles");``
316 *
317 * @return null
318 */
319 public static function add_admin_styles ()
320 {
321 do_action ("ws_plugin__s2member_before_add_admin_styles", get_defined_vars ());
322 /**/
323 if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
324 {
325 wp_enqueue_style ("thickbox");
326 wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
327 /**/
328 do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
329 }
330 /**/
331 do_action ("ws_plugin__s2member_after_add_admin_styles", get_defined_vars ());
332 /**/
333 return; /* Return for uniformity. */
334 }
335 /**
336 * Builds and handles the Quick Start page.
337 *
338 * @package s2Member\Menu_Pages
339 * @since 3.5
340 *
341 * @return null
342 */
343 public static function start_page ()
344 {
345 do_action ("ws_plugin__s2member_before_start_page", get_defined_vars ());
346 /**/
347 include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
348 /**/
349 do_action ("ws_plugin__s2member_after_start_page", get_defined_vars ());
350 /**/
351 return; /* Return for uniformity. */
352 }
353 /**
354 * Builds and handles the Main Multisite Options page.
355 *
356 * @package s2Member\Menu_Pages
357 * @since 3.5
358 *
359 * @return null
360 */
361 public static function mms_ops_page ()
362 {
363 do_action ("ws_plugin__s2member_before_mms_ops_page", get_defined_vars ());
364 /**/
365 if (c_ws_plugin__s2member_menu_pages::update_all_options ())
366 c_ws_plugin__s2member_mms_patches::mms_patches (true);
367 /**/
368 include_once dirname (dirname (__FILE__)) . "/menu-pages/mms-ops.inc.php";
369 /**/
370 do_action ("ws_plugin__s2member_after_mms_ops_page", get_defined_vars ());
371 /**/
372 return; /* Return for uniformity. */
373 }
374 /**
375 * Builds and handles the General Options page.
376 *
377 * @package s2Member\Menu_Pages
378 * @since 3.5
379 *
380 * @return null
381 */
382 public static function gen_ops_page ()
383 {
384 do_action ("ws_plugin__s2member_before_gen_ops_page", get_defined_vars ());
385 /**/
386 c_ws_plugin__s2member_menu_pages::update_all_options ();
387 /**/
388 include_once dirname (dirname (__FILE__)) . "/menu-pages/gen-ops.inc.php";
389 /**/
390 do_action ("ws_plugin__s2member_after_gen_ops_page", get_defined_vars ());
391 /**/
392 return; /* Return for uniformity. */
393 }
394 /**
395 * Builds and handles the Restriction Options page.
396 *
397 * @package s2Member\Menu_Pages
398 * @since 3.5
399 *
400 * @return null
401 */
402 public static function res_ops_page ()
403 {
404 do_action ("ws_plugin__s2member_before_res_ops_page", get_defined_vars ());
405 /**/
406 c_ws_plugin__s2member_menu_pages::update_all_options ();
407 /**/
408 include_once dirname (dirname (__FILE__)) . "/menu-pages/res-ops.inc.php";
409 /**/
410 do_action ("ws_plugin__s2member_after_res_ops_page", get_defined_vars ());
411 /**/
412 return; /* Return for uniformity. */
413 }
414 /**
415 * Builds and handles the Paypal Options page.
416 *
417 * @package s2Member\Menu_Pages
418 * @since 3.5
419 *
420 * @return null
421 */
422 public static function paypal_ops_page ()
423 {
424 do_action ("ws_plugin__s2member_before_paypal_ops_page", get_defined_vars ());
425 /**/
426 c_ws_plugin__s2member_menu_pages::update_all_options ();
427 /**/
428 $logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
429 /**/
430 if (!is_dir ($logs_dir) && is_writable (dirname (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir))))
431 mkdir ($logs_dir, 0777, true) . clearstatcache ();
432 /**/
433 $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] . "/.htaccess";
434 /**/
435 if (is_dir ($logs_dir) && is_writable ($logs_dir) && !file_exists ($htaccess))
436 file_put_contents ($htaccess, "deny from all") . clearstatcache ();
437 /**/
438 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) /* Logging enabled? */
439 {
440 if (!is_dir ($logs_dir)) /* If the security-enabled logs directory does not exist yet. */
441 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The security-enabled logs directory ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir)) . "</code> ) does not exist. Please create this directory manually &amp; make it writable ( chmod 777 ).", true);
442 /**/
443 else if (!is_writable ($logs_dir)) /* If the logs directory is not writable yet. */
444 c_ws_plugin__s2member_admin_notices::display_admin_notice ("Permissions error. The security-enabled logs directory ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir)) . "</code> ) is not writable. Please make this directory writable ( chmod 777 ).", true);
445 /**/
446 if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
447 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The .htaccess protection file ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess)) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
448 /**/
449 else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
450 c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess)) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
451 }
452 /**/
453 include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
454 /**/
455 do_action ("ws_plugin__s2member_after_paypal_ops_page", get_defined_vars ());
456 /**/
457 return; /* Return for uniformity. */
458 }
459 /**
460 * Builds and handles the Download Options page.
461 *
462 * @package s2Member\Menu_Pages
463 * @since 3.5
464 *
465 * @return null
466 */
467 public static function down_ops_page ()
468 {
469 do_action ("ws_plugin__s2member_before_down_ops_page", get_defined_vars ());
470 /**/
471 c_ws_plugin__s2member_menu_pages::update_all_options ();
472 /**/
473 if (!($using_amazon_s3_storage = 0) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"])
474 $using_amazon_s3_storage = true; /* Amazon® S3 storage has been configured! */
475 /**/
476 $files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
477 /**/
478 if (!is_dir ($files_dir) && is_writable (dirname (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir))))
479 mkdir ($files_dir, 0777, true) . clearstatcache ();
480 /**/
481 $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/.htaccess";
482 /**/
483 if (is_dir ($files_dir) && is_writable ($files_dir) && !file_exists ($htaccess))
484 file_put_contents ($htaccess, "deny from all") . clearstatcache ();
485 /**/
486 if (!$using_amazon_s3_storage && !is_dir ($files_dir)) /* If the security-enabled files directory does not exist yet. */
487 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The security-enabled files directory ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $files_dir)) . "</code> ) does not exist. Please create this directory manually.", true);
488 /**/
489 if (!$using_amazon_s3_storage && !file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
490 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The .htaccess protection file ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess)) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
491 /**/
492 else if (!$using_amazon_s3_storage && !preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
493 c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess)) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
494 /**/
495 include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
496 /**/
497 do_action ("ws_plugin__s2member_after_down_ops_page", get_defined_vars ());
498 /**/
499 return; /* Return for uniformity. */
500 }
501 /**
502 * Builds and handles the API Tracking options page.
503 *
504 * @package s2Member\Menu_Pages
505 * @since 3.5
506 *
507 * @return null
508 */
509 public static function trk_ops_page ()
510 {
511 do_action ("ws_plugin__s2member_before_trk_ops_page", get_defined_vars ());
512 /**/
513 c_ws_plugin__s2member_menu_pages::update_all_options ();
514 /**/
515 include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
516 /**/
517 do_action ("ws_plugin__s2member_after_trk_ops_page", get_defined_vars ());
518 /**/
519 return; /* Return for uniformity. */
520 }
521 /**
522 * Builds and handles the API List Server options page.
523 *
524 * @package s2Member\Menu_Pages
525 * @since 3.5
526 *
527 * @return null
528 */
529 public static function els_ops_page ()
530 {
531 do_action ("ws_plugin__s2member_before_els_ops_page", get_defined_vars ());
532 /**/
533 c_ws_plugin__s2member_menu_pages::update_all_options ();
534 /**/
535 include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
536 /**/
537 do_action ("ws_plugin__s2member_after_els_ops_page", get_defined_vars ());
538 /**/
539 return; /* Return for uniformity. */
540 }
541 /**
542 * Builds and handles the API Notifications page.
543 *
544 * @package s2Member\Menu_Pages
545 * @since 3.5
546 *
547 * @return null
548 */
549 public static function api_ops_page ()
550 {
551 do_action ("ws_plugin__s2member_before_api_ops_page", get_defined_vars ());
552 /**/
553 c_ws_plugin__s2member_menu_pages::update_all_options ();
554 /**/
555 include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
556 /**/
557 do_action ("ws_plugin__s2member_after_api_ops_page", get_defined_vars ());
558 /**/
559 return; /* Return for uniformity. */
560 }
561 /**
562 * Builds and handles the PayPal Button Generator page.
563 *
564 * @package s2Member\Menu_Pages
565 * @since 3.5
566 *
567 * @return null
568 */
569 public static function paypal_buttons_page ()
570 {
571 do_action ("ws_plugin__s2member_before_paypal_buttons_page", get_defined_vars ());
572 /**/
573 if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"] || !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"] || !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"])
574 c_ws_plugin__s2member_admin_notices::display_admin_notice ('Please configure <code>s2Member -> PayPal® Options</code> first. Once all of your PayPal® Options are configured; including your Email Address, API Username, Password, and Signature; return to this page &amp; generate your PayPal® Button(s).', true);
575 /**/
576 include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-buttons.inc.php";
577 /**/
578 do_action ("ws_plugin__s2member_after_paypal_buttons_page", get_defined_vars ());
579 /**/
580 return; /* Return for uniformity. */
581 }
582 /**
583 * Builds and handles the API Scripting page.
584 *
585 * @package s2Member\Menu_Pages
586 * @since 3.5
587 *
588 * @return null
589 */
590 public static function scripting_page ()
591 {
592 do_action ("ws_plugin__s2member_before_scripting_page", get_defined_vars ());
593 /**/
594 include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
595 /**/
596 do_action ("ws_plugin__s2member_after_scripting_page", get_defined_vars ());
597 /**/
598 return; /* Return for uniformity. */
599 }
600 /**
601 * Builds and handles the Integrations page.
602 *
603 * @package s2Member\Menu_Pages
604 * @since 3.5
605 *
606 * @return null
607 */
608 public static function integrations_page ()
609 {
610 do_action ("ws_plugin__s2member_before_integrations_page", get_defined_vars ());
611 /**/
612 if (!empty ($_POST["ws_plugin__s2member_bridge_bbpress"]) && ($nonce = $_POST["ws_plugin__s2member_bridge_bbpress"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-bridge-bbpress") && ($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))))
613 {
614 if (!empty ($_p["ws_plugin__s2member_bridge_bbpress_plugins_dir"]) && is_dir ($plugins_dir = untrailingslashit ($_p["ws_plugin__s2member_bridge_bbpress_plugins_dir"])))
615 {
616 if (is_writable ($plugins_dir)) /* This directory MUST be writable. */
617 {
618 if (preg_match ("/^Install/i", $_p["ws_plugin__s2member_bridge_bbpress_action"]))
619 {
620 $min = (string)$_p["ws_plugin__s2member_bridge_bbpress_min_level"];
621 $ovg = (string)$_p["ws_plugin__s2member_bridge_bbpress_ovg"];
622 /**/
623 if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($min), preg_replace ("/%%ovg%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($ovg), $file))) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
624 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
625 /**/
626 else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
627 c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or install manually.", true);
628 }
629 /**/
630 else if (preg_match ("/^Un-Install/i", $_p["ws_plugin__s2member_bridge_bbpress_action"]))
631 {
632 if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
633 {
634 if (!unlink ($plugins_dir . "/_s2member-bbpress-bridge.php")) /* Test return value of unlink. */
635 c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or un-install manually.", true);
636 /**/
637 else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
638 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been successfully <strong>uninstalled</strong>.");
639 }
640 else
641 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin is already un-installed.", true);
642 }
643 }
644 else
645 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The directory you specified is NOT writable. Please try again, or install manually.", true);
646 }
647 else
648 c_ws_plugin__s2member_admin_notices::display_admin_notice ("The directory you specified does NOT exist. Please try again, or install manually.", true);
649 }
650 /**/
651 include_once dirname (dirname (__FILE__)) . "/menu-pages/integrations.inc.php";
652 /**/
653 do_action ("ws_plugin__s2member_after_integrations_page", get_defined_vars ());
654 /**/
655 return; /* Return for uniformity. */
656 }
657 /**
658 * Builds and handles the s2Member Info page.
659 *
660 * @package s2Member\Menu_Pages
661 * @since 3.5
662 *
663 * @return null
664 */
665 public static function info_page ()
666 {
667 do_action ("ws_plugin__s2member_before_info_page", get_defined_vars ());
668 /**/
669 include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
670 /**/
671 do_action ("ws_plugin__s2member_after_info_page", get_defined_vars ());
672 /**/
673 return; /* Return for uniformity. */
674 }
675 }
676 }
677 ?>