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

login-redirects-r.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 120213, at includes/classes/login-redirects-r.inc.php

77 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Login redirect removals.
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\Login_Redirects
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_login_redirects_r"))
21 {
22 /**
23 * Login redirect removals.
24 *
25 * @package s2Member\Login_Redirects
26 * @since 3.5
27 */
28 class c_ws_plugin__s2member_login_redirects_r
29 {
30 /**
31 * Handles completely empty ``login_redirect`` values.
32 *
33 * Some plugins ( most notably BuddyPress v1.5 ) have a nasty habit of sending an empty ``$_REQUEST["redirect_to"]`` input field with login widgets.
34 * In the case of BuddyPress, it's own Filter against `login_redirect` will deal with empty values. However, since s2Member removes all Filters
35 * against `login_redirect` ( for compatibility ), we NEED this simple routine to check empty values, and default them to ``admin_url()``.
36 *
37 * @attaches-to ``add_filter("login_redirect");``
38 *
39 * @package s2Member\Login_Redirects
40 * @since 110926
41 *
42 * @param str $redirect_to Expects the current ``$redirect_to`` value, passed in by the Filter.
43 * @return str A non-empty string value. s2Member will NEVER allow this to be completely empty.
44 */
45 public static function _empty_login_redirect_filter ($redirect_to = FALSE)
46 {
47 return (empty ($redirect_to)) ? admin_url () : $redirect_to;
48 }
49 /**
50 * Removes all other ``login_redirect`` Filters to prevent conflicts with s2Member.
51 *
52 * @attaches-to ``add_action("init");``
53 *
54 * @package s2Member\Login_Redirects
55 * @since 3.5
56 *
57 * @return null
58 */
59 public static function remove_login_redirect_filters () /* Prevents conflicts. */
60 {
61 do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
62 /**/
63 if (!apply_filters ("ws_plugin__s2member_allow_other_login_redirect_filters", false, get_defined_vars ()))
64 {
65 remove_all_filters("login_redirect"); /* Removes all `login_redirect` Filters. */
66 add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_empty_login_redirect_filter");
67 /**/
68 do_action ("ws_plugin__s2member_during_remove_login_redirect_filters", get_defined_vars ());
69 }
70 /**/
71 do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
72 /**/
73 return; /* Return for uniformity. */
74 }
75 }
76 }
77 ?>