PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 110710
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v110710
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 / ssl.inc.php

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

72 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * SSL routines.
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\SSL
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_ssl"))
21 {
22 /**
23 * SSL routines.
24 *
25 * @package s2Member\SSL
26 * @since 3.5
27 */
28 class c_ws_plugin__s2member_ssl
29 {
30 /**
31 * Forces SSL on specific Posts/Pages, or any page for that matter.
32 *
33 * Triggered by Custom Field: `s2member_force_ssl = yes|port#`
34 *
35 * Triggered by: `?s2-ssl` or `?s2-ssl=yes|port#`.
36 *
37 * @package s2Member\SSL
38 * @since 3.5
39 *
40 * @attaches-to: ``add_action("init");``
41 * @attaches-to: ``add_action("template_redirect");``
42 *
43 * @return null Possibly exiting script execution after redirection to SSL variation.
44 */
45 public static function check_force_ssl () /* Forces SSL. */
46 {
47 global $post; /* We need the global ``$post`` variable here. */
48 static $forced = false; /* Only force SSL once. */
49 /**/
50 do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
51 /**/
52 if (!$forced) /* Only once. This is required, because it's processed on multiple Hooks. */
53 {
54 $s2_ssl_gv = apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
55 $_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|false)$/i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
56 $force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", $_g_s2_ssl, get_defined_vars ());
57 /**/
58 if ($force_ssl || (function_exists ("is_singular") && is_singular () && is_object ($post) && $post->ID && ($force_ssl = get_post_meta ($post->ID, "s2member_force_ssl", true))))
59 /**/
60 if (!preg_match ("/^(0|no|false)$/i", $force_ssl) && ($forced = true)) /* Make sure it's not a negative variation. */
61 {
62 c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); /* Call inner routine now. */
63 }
64 }
65 /**/
66 do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
67 /**/
68 return; /* Return for uniformity. */
69 }
70 }
71 }
72 ?>