$value) /* Find all keys contained within ``$new_options`` matching `^ws_plugin__s2member_`. */
if (strpos ($key, "ws_plugin__s2member_") === 0) /* A relevant ``$new_options`` key matching `^ws_plugin__s2member_`? */
/**/
if ($key === "ws_plugin__s2member_configured") /* s2Member is now configured ( according to these options )? */
($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = $value) . update_option ("ws_plugin__s2member_configured", $value);
/**/
else if (!is_array ($value) || (is_array ($value) && /* Updating an array? */ array_shift ($value) === "update-signal"))
$options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
/**/
unset ($key, $value); /* Unset these utility variables now. This prevents bleeding vars into Hooks/Filters that are of no use. */
/**/
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use ``wp_verify_nonce()``. */
unset ($__refs, $__v); /* Unset defined __refs, __v. */
/**/
$options = ws_plugin__s2member_configure_options_and_their_defaults (($options = array_merge ($options, array ("options_version" => (string)($options["options_version"] + 0.001)))));
update_option ("ws_plugin__s2member_options", $options) . ((is_multisite () && is_main_site ()) ? update_site_option ("ws_plugin__s2member_options", $options) : null) . update_option ("ws_plugin__s2member_cache", array ());
/**/
if ($update_other === true || in_array ("auto_eot_system", (array)$update_other)) /* Handle the Auto-EOT System now ( enable/disable ). */
($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 ();
/**/
if (($display_notices === true || in_array ("success", (array)$display_notices)) && ($notice = 'Options saved.' . (($request_refresh) ? ' Please refresh.' : '') . ''))
($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);
/**/
if (empty ($_GET["page"]) || $_GET["page"] !== "ws-plugin--s2member-mms-ops") /* Do NOT display page-conflict-warnings on the Main Multisite Configuration panel. */
{
if (!$options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = 'NOTE: s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: s2Member -> General Options -> Membership Options Page.'))
($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);
/**/
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 = 's2Member: Your Login Welcome Page is the same as your Membership Options Page. Please correct this. See: s2Member -> General Options -> Login Welcome Page.'))
($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);
/**/
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 = 's2Member: 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: WordPress® -> Reading Options. Or change: s2Member -> General Options -> Membership Options Page.'))
($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);
/**/
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 = 's2Member: 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: WordPress® -> Reading Options. Or change: s2Member -> General Options -> Login Welcome Page.'))
($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);
/**/
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 = 's2Member: 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: WordPress® -> Reading Options. Or change: s2Member -> General Options -> Membership Options Page.'))
($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);
/**/
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 = 's2Member: 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: WordPress® -> Reading Options. Or change: s2Member -> General Options -> Login Welcome Page.'))
($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);
/**/
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 = 's2Member: Your Download Limit Exceeded Page is the same as your Membership Options Page. Please correct this. See: s2Member -> Download Options.'))
($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);
}
/**/
$updated_all_options = true; /* Flag indicating this routine was processed successfully; and that all s2Member options have been updated successfully.*/
}
/**/
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use ``wp_verify_nonce()``. */
unset ($__refs, $__v); /* Unset defined __refs, __v. */
/**/
return apply_filters ("ws_plugin__s2member_update_all_options", (($updated_all_options) ? true : false), get_defined_vars ());
}
/**
* Adds option menus / sub-menus.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @attaches-to: ``add_action("admin_menu");``
*
* @return null
*/
public static function add_admin_options ()
{
do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
/**/
add_filter ("plugin_action_links", "c_ws_plugin__s2member_menu_pages::_add_settings_link", 10, 2);
/**/
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
{
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 ()))
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array (); /* Clear right side. */
/**/
$menu = apply_filters ("ws_plugin__s2member_during_add_admin_options_menu_slug", "ws-plugin--s2member-start", get_defined_vars ());
/**/
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_menu_page", true, get_defined_vars ()))
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");
/**/
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_start_page", true, get_defined_vars ()))
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");
/**/
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_divider_1", true, get_defined_vars ())) /* Divider. */
add_submenu_page ($menu, "-", '
' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($logs_dir)) . ' ) does not exist. Please create this directory manually & make it writable ( chmod 777 ).', true);
/**/
else if (!is_writable ($logs_dir)) /* If the logs directory is not writable yet. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('Permissions error. The security-enabled logs directory ( ' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($logs_dir)) . ' ) is not writable. Please make this directory writable ( chmod 777 ).', true);
/**/
if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The .htaccess protection file ( ' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . ' ) does not exist. Please create this file manually. Inside your .htaccess file, add this:' . esc_html ($htaccess_contents) . '', true); /**/ else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */ c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unprotected. The .htaccess protection file (
' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . ' ) does not contain deny from all. Inside your .htaccess file, add this:' . esc_html ($htaccess_contents) . '', true); } /**/ include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php"; /**/ do_action ("ws_plugin__s2member_after_paypal_ops_page", get_defined_vars ()); /**/ return; /* Return for uniformity. */ } /** * Builds and handles the Download Options page. * * @package s2Member\Menu_Pages * @since 3.5 * * @return null */ public static function down_ops_page () { do_action ("ws_plugin__s2member_before_down_ops_page", get_defined_vars ()); /**/ c_ws_plugin__s2member_menu_pages::update_all_options (); /**/ $files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]; /**/ if (!is_dir ($files_dir) && is_writable (dirname (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir)))) mkdir ($files_dir, 0777, true) . clearstatcache (); /**/ $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/.htaccess"; $htaccess_contents = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir_htaccess"]))); /**/ if (is_dir ($files_dir) && is_writable ($files_dir) && !file_exists ($htaccess)) file_put_contents ($htaccess, $htaccess_contents) . clearstatcache (); /**/ if (!is_dir ($files_dir)) /* If the security-enabled files directory does not exist yet. */ c_ws_plugin__s2member_admin_notices::display_admin_notice ('The security-enabled files directory (
' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($files_dir)) . ' ) does not exist. Please create this directory manually.', true);
/**/
if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The .htaccess protection file ( ' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . ' ) does not exist. Please create this file manually. Inside your .htaccess file, add this:' . esc_html ($htaccess_contents) . '', true); /**/ else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */ c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unprotected. The .htaccess protection file (
' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . ' ) does not contain deny from all. Inside your .htaccess file, add this:' . esc_html ($htaccess_contents) . '', true); /**/ if (!empty ($_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && ($nonce = $_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-amazon-cf-files-auto-configure-distros")) /**/ if (($amazon_cf_auto_configure_distros = c_ws_plugin__s2member_files_in::amazon_cf_auto_configure_distros ()) && $amazon_cf_auto_configure_distros["success"]) /* CNAME instructions here too. */ c_ws_plugin__s2member_admin_notices::display_admin_notice ('Amazon® CloudFront Distributions auto-configured successfully. Please allow 30 minutes for propagation.' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) ? '
' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' —» ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '' : '') . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) ? '' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' —» ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '' : ''));
/**/
else /* Else there was an error. We need to report this back to the site owner so they can understand what's going on. */
($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"] = true) . c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unable to auto-configure Amazon® CloudFront Distributions.' . esc_html ($amazon_cf_auto_configure_distros["code"]) . '. Error Message: ' . esc_html ($amazon_cf_auto_configure_distros["message"]) . '', true);
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
/**/
do_action ("ws_plugin__s2member_after_down_ops_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the API Tracking options page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function trk_ops_page ()
{
do_action ("ws_plugin__s2member_before_trk_ops_page", get_defined_vars ());
/**/
c_ws_plugin__s2member_menu_pages::update_all_options ();
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
/**/
do_action ("ws_plugin__s2member_after_trk_ops_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the API List Server options page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function els_ops_page ()
{
do_action ("ws_plugin__s2member_before_els_ops_page", get_defined_vars ());
/**/
c_ws_plugin__s2member_menu_pages::update_all_options ();
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
/**/
do_action ("ws_plugin__s2member_after_els_ops_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the API Notifications page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function api_ops_page ()
{
do_action ("ws_plugin__s2member_before_api_ops_page", get_defined_vars ());
/**/
c_ws_plugin__s2member_menu_pages::update_all_options ();
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
/**/
do_action ("ws_plugin__s2member_after_api_ops_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the PayPal Button Generator page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function paypal_buttons_page ()
{
do_action ("ws_plugin__s2member_before_paypal_buttons_page", get_defined_vars ());
/**/
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"])
c_ws_plugin__s2member_admin_notices::display_admin_notice ('Please configure s2Member -> PayPal® Options first. Once all of your PayPal® Options are configured; including your Email Address, API Username, Password, and Signature; return to this page & generate your PayPal® Button(s).', true);
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-buttons.inc.php";
/**/
do_action ("ws_plugin__s2member_after_paypal_buttons_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the API Scripting page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function scripting_page ()
{
do_action ("ws_plugin__s2member_before_scripting_page", get_defined_vars ());
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
/**/
do_action ("ws_plugin__s2member_after_scripting_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the Integrations page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function integrations_page ()
{
do_action ("ws_plugin__s2member_before_integrations_page", get_defined_vars ());
/**/
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))))
{
if (!empty ($_p["ws_plugin__s2member_bridge_bbpress_plugins_dir"]) && is_dir ($plugins_dir = untrailingslashit ($_p["ws_plugin__s2member_bridge_bbpress_plugins_dir"])))
{
if (is_writable ($plugins_dir)) /* This directory MUST be writable. */
{
if (preg_match ("/^Install/i", $_p["ws_plugin__s2member_bridge_bbpress_action"]))
{
$min = (string)$_p["ws_plugin__s2member_bridge_bbpress_min_level"];
$ovg = (string)$_p["ws_plugin__s2member_bridge_bbpress_ovg"];
/**/
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))
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The bbPress® Bridge/plugin has been installed successfully.');
/**/
else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unknown error. Please try again, or install manually.', true);
}
/**/
else if (preg_match ("/^Un-Install/i", $_p["ws_plugin__s2member_bridge_bbpress_action"]))
{
if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
{
if (!unlink ($plugins_dir . "/_s2member-bbpress-bridge.php")) /* Test return value of unlink. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unknown error. Please try again, or un-install manually.', true);
/**/
else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The bbPress® Bridge/plugin has been successfully uninstalled.');
}
else
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The bbPress® Bridge/plugin is already un-installed.', true);
}
}
else
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The directory you specified is NOT writable. Please try again, or install manually.', true);
}
else
c_ws_plugin__s2member_admin_notices::display_admin_notice ('The directory you specified does NOT exist. Please try again, or install manually.', true);
}
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/integrations.inc.php";
/**/
do_action ("ws_plugin__s2member_after_integrations_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
/**
* Builds and handles the s2Member Info page.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @return null
*/
public static function info_page ()
{
do_action ("ws_plugin__s2member_before_info_page", get_defined_vars ());
/**/
include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
/**/
do_action ("ws_plugin__s2member_after_info_page", get_defined_vars ());
/**/
return; /* Return for uniformity. */
}
}
}
?>