/**
  * Resolution SMIL Files.
  *
  * @package s2Member\Shortcodes
  * @since 140814
  *
  * @see http://tools.ietf.org/html/rfc4536
  */
 public static function serve()
 {
     if (empty($_GET['s2member_rsf_file'])) {
         return;
     }
     // Nothing to do here.
     header('Content-Type: application/smil+xml; charset=UTF-8');
     while (@ob_end_clean()) {
     }
     // Clean any existing output buffers.
     $smil_file_id = trim(stripslashes((string) $_GET['s2member_rsf_file']));
     if (empty($_GET['s2member_rsf_file_ip']) || trim(stripslashes($_GET['s2member_rsf_file_ip'])) !== $_SERVER['REMOTE_ADDR']) {
         exit;
     }
     // Invalid and/or missing IP address.
     if (!c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER['REQUEST_URI'], TRUE, 86400)) {
         exit;
     }
     // Fail here. Invalid and/or expired SMIL file ID.
     if (!($smil_file = get_transient('s2m_rsf_' . $smil_file_id))) {
         exit;
     }
     // Fail here. Invalid and/or expired SMIL file ID.
     exit($smil_file);
 }
 /**
  * Get ``$_POST`` or ``$_REQUEST`` vars from PayPal.
  *
  * @package s2Member\PayPal
  * @since 3.5
  *
  * @return array|bool An array of verified ``$_POST`` or ``$_REQUEST`` variables, else false.
  */
 public static function paypal_postvars()
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_paypal_postvars", get_defined_vars());
     unset($__refs, $__v);
     /*
     Custom conditionals can be applied by filters.
     */
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     if (!($postvars = apply_filters("ws_plugin__s2member_during_paypal_postvars_conditionals", array(), get_defined_vars()))) {
         unset($__refs, $__v);
         if (!empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"])) {
             $postback["tx"] = $_GET["tx"];
             $postback["cmd"] = "_notify-synch";
             $postback["at"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"];
             $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
             if (preg_match("/^SUCCESS/i", $response = trim(c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/cgi-bin/webscr", $postback, array("timeout" => 20))))) {
                 foreach (preg_split("/[\r\n]+/", preg_replace("/^SUCCESS/i", "", $response)) as $varline) {
                     list($key, $value) = preg_split("/\\=/", $varline, 2);
                     if (strlen($key = trim($key)) && strlen($value = trim($value))) {
                         $postvars[$key] = trim(stripslashes(urldecode($value)));
                     }
                 }
                 if (!empty($postvars["charset"]) && function_exists("mb_convert_encoding")) {
                     foreach ($postvars as &$value) {
                         $value = @mb_convert_encoding($value, "UTF-8", $postvars["charset"] === "gb2312" ? "GBK" : $postvars["charset"]);
                     }
                 }
                 return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
             } else {
                 return false;
             }
         } else {
             if (!empty($_REQUEST) && is_array($postvars = stripslashes_deep($_REQUEST))) {
                 foreach ($postvars as $key => $value) {
                     if (preg_match("/^s2member_/", $key)) {
                         unset($postvars[$key]);
                     }
                 }
                 $postback = $postvars;
                 $postback["cmd"] = "_notify-validate";
                 $postvars = c_ws_plugin__s2member_utils_strings::trim_deep($postvars);
                 if (!empty($postvars["charset"]) && function_exists("mb_convert_encoding")) {
                     foreach ($postvars as &$value) {
                         $value = @mb_convert_encoding($value, "UTF-8", $postvars["charset"] === "gb2312" ? "GBK" : $postvars["charset"]);
                     }
                 }
                 $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
                 if (!empty($_REQUEST["s2member_paypal_proxy"]) && !empty($_REQUEST["s2member_paypal_proxy_verification"]) && $_REQUEST["s2member_paypal_proxy_verification"] === c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen()) {
                     return apply_filters("ws_plugin__s2member_paypal_postvars", array_merge($postvars, array("proxy_verified" => $_REQUEST["s2member_paypal_proxy"])), get_defined_vars());
                 } else {
                     if (empty($_POST) && !empty($_GET["s2member_paypal_proxy"]) && !empty($_GET["s2member_paypal_proxy_verification"]) && c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER["REQUEST_URI"], false, false, "s2member_paypal_proxy_verification")) {
                         return apply_filters("ws_plugin__s2member_paypal_postvars", array_merge($postvars, array("proxy_verified" => $_GET["s2member_paypal_proxy"])), get_defined_vars());
                     } else {
                         if (trim(strtolower(c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/cgi-bin/webscr", $postback, array("timeout" => 20)))) === "verified") {
                             return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
                         } else {
                             return false;
                         }
                     }
                 }
             } else {
                 return false;
             }
         }
     } else {
         unset($__refs, $__v);
         return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
     }
 }
 /**
  * Parses s2Vars passed through by ClickBank.
  *
  * @package s2Member\ClickBank
  * @since 111205
  *
  * @param str $cvendthru Expects the URL-encoded query string of s2Vars, including `_s2member_sig`.
  * @param str $type Optional. The type of ClickBank transaction. This deals with backward compatibility.
  * 	For SALE transactions, do NOT accept the older format. For others, remain backward compatible.
  * @return array Array of s2Vars. Possibly an empty array.
  */
 public static function clickbank_parse_s2vars($cvendthru = FALSE, $type = FALSE)
 {
     wp_parse_str((string) $cvendthru, $s2vars);
     $s2vars = c_ws_plugin__s2member_utils_strings::trim_deep($s2vars);
     foreach ($s2vars as $var => $value) {
         if (!in_array($var, array("cbskin", "cbfid", "cbur", "cbf", "tid", "vtid"), TRUE)) {
             // These may be included in a signature too.
             if (!preg_match("/^(?:s2_|_s2member_sig)/", $var)) {
                 // These will always be included in a signature.
                 unset($s2vars[$var]);
             }
         }
     }
     $is_sale = preg_match("/^(?:TEST_)?SALE\$/i", (string) $type);
     if (!$is_sale || c_ws_plugin__s2member_utils_urls::s2member_sig_ok(http_build_query($s2vars, null, "&"))) {
         return $s2vars;
     }
     return array();
 }
 function s2member_pro_paypal_s2p_v_query_ok($url_uri_query = FALSE, $ignore_time = FALSE, $exp_secs = FALSE)
 {
     $check_time = $ignore_time ? FALSE : TRUE;
     // Make this compatible with ``$check_time``.
     return c_ws_plugin__s2member_utils_urls::s2member_sig_ok($url_uri_query, $check_time, $exp_secs, "s2p-v");
 }
 function s2member_pro_authnet_s2p_v_query_ok($url_uri_query = FALSE, $ignore_time = FALSE, $exp_secs = FALSE)
 {
     $check_time = $ignore_time ? false : true;
     return c_ws_plugin__s2member_utils_urls::s2member_sig_ok($url_uri_query, $check_time, $exp_secs, "s2p-v");
 }
 /**
  * Parses s2Vars passed through by ClickBank.
  *
  * @package s2Member\ClickBank
  * @since 111205
  *
  * @param string $cvendthru Expects the URL-encoded query string of s2Vars, including `_s2member_sig`.
  * @param string $type Optional. The type of ClickBank transaction. This deals with backward compatibility.
  *   For SALE transactions, do NOT accept the older format. For others, remain backward compatible.
  *
  * @return array Array of s2Vars. Possibly an empty array.
  */
 public static function clickbank_parse_s2vars_v2_1($cvendthru = '', $type = '')
 {
     wp_parse_str((string) $cvendthru, $s2vars);
     $s2vars = c_ws_plugin__s2member_utils_strings::trim_deep($s2vars);
     foreach ($s2vars as $var => $value) {
         if (!in_array($var, array('cbskin', 'cbfid', 'cbur', 'cbf', 'tid', 'vtid'), TRUE)) {
             // These may be included in a signature too.
             if (!preg_match('/^(?:s2_|_s2member_sig)/', $var)) {
                 // These will always be included in a signature.
                 unset($s2vars[$var]);
             }
         }
     }
     $is_sale = preg_match('/^(?:TEST_)?SALE$/i', (string) $type);
     if (!$is_sale || c_ws_plugin__s2member_utils_urls::s2member_sig_ok(http_build_query($s2vars, NULL, '&'))) {
         return $s2vars;
     }
     // Looks good. Return ``$s2vars``.
     return array();
     // Default empty array.
 }
 /**
  * Handles Google® XML Checkout redirections.
  *
  * @package s2Member\Google
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection to Google® Checkout.
  */
 public static function google_co()
 {
     global $current_site, $current_blog;
     /**/
     if (!empty($_GET["s2member_pro_google_co"]) && c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER["REQUEST_URI"]) && !empty($_GET["co"]) && is_array($attr = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_GET["co"]))) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"]) {
         $attr = shortcode_atts(array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "anchor"), $attr);
         /**/
         $attr["tt"] = strtoupper($attr["tt"]);
         /* Term lengths absolutely must be provided in upper-case format. Only after running shortcode_atts(). */
         $attr["rt"] = strtoupper($attr["rt"]);
         /* Term lengths absolutely must be provided in upper-case format. Only after running shortcode_atts(). */
         $attr["rr"] = strtoupper($attr["rr"]);
         /* Must be provided in upper-case format. Numerical, or BN value. Only after running shortcode_atts(). */
         $attr["ccaps"] = strtolower($attr["ccaps"]);
         /* Custom Capabilities must be typed in lower-case format. Only after running shortcode_atts(). */
         $attr["rr"] = $attr["rt"] === "L" ? "BN" : $attr["rr"];
         /* Lifetime Subscriptions require Buy Now. Only after running shortcode_atts(). */
         $attr["rr"] = $attr["level"] === "*" ? "BN" : $attr["rr"];
         /* Independent Ccaps do NOT recur. Only after running shortcode_atts(). */
         $attr["rr"] = !$attr["tp"] && !$attr["rr"] ? "BN" : $attr["rr"];
         /* No Trial / non-recurring. Only after running shortcode_atts(). */
         /**/
         if ($attr["modify"] || $attr["cancel"]) {
             $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_sandbox"] ? "sandbox.google.com/checkout" : "checkout.google.com";
             /**/
             wp_redirect("https://" . $endpoint . "/");
         } else {
             if ($attr["sp"]) {
                 $attr["uniqid"] = uniqid();
                 /* Unique ID. */
                 $attr["referencing"] = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id();
                 /**/
                 $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
                 /* Combined "sp:ids:expiration hours". */
                 $attr["sp_access_link"] = c_ws_plugin__s2member_sp_access::sp_access_link_gen($attr["ids"], $attr["exp"]);
                 /**/
                 $xml = '<?xml version="1.0" encoding="UTF-8"?>';
                 $xml .= '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">';
                 $xml .= '<shopping-cart>';
                 $xml .= '<items>';
                 /**/
                 $xml .= '<item>';
                 /**/
                 $xml .= '<quantity>1</quantity>';
                 $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                 $xml .= '<item-description>(TID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Grants you immediate access.", "s2member-front", "s2member")) . '</item-description>';
                 $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                 /**/
                 $xml .= '<merchant-private-item-data>';
                 $xml .= '<s2_txn_id>s2-' . esc_html($attr["uniqid"]) . '</s2_txn_id>';
                 $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                 $xml .= '<s2_item_number>' . esc_html($attr["sp_ids_exp"]) . '</s2_item_number>';
                 $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                 $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                 $xml .= '</merchant-private-item-data>';
                 /**/
                 $xml .= '<digital-content>';
                 $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                 $xml .= '<description>' . esc_html($attr["desc"]) . '</description>';
                 $xml .= '<url>' . esc_html($attr["sp_access_link"]) . '</url>';
                 $xml .= '</digital-content>';
                 /**/
                 $xml .= '</item>';
                 /**/
                 $xml .= '</items>';
                 $xml .= '</shopping-cart>';
                 /**/
                 $xml .= '<checkout-flow-support>';
                 $xml .= '<merchant-checkout-flow-support>';
                 $xml .= '<edit-cart-url>' . esc_html(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) . '</edit-cart-url>';
                 $xml .= '<continue-shopping-url>' . esc_html($attr["sp_access_link"]) . '</continue-shopping-url>';
                 $xml .= '</merchant-checkout-flow-support>';
                 $xml .= '</checkout-flow-support>';
                 /**/
                 $xml .= '</checkout-shopping-cart>';
                 /**/
                 $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_sandbox"] ? "sandbox.google.com/checkout" : "checkout.google.com";
                 /**/
                 if (($xml = c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/api/checkout/v2/merchantCheckout/Merchant/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"], $xml, array_merge(c_ws_plugin__s2member_pro_google_utilities::google_api_headers(), array("timeout" => 20)))) && preg_match("/\\<redirect-url\\>(.+?)\\<\\/redirect-url\\>/i", preg_replace("/[\r\n\t]+/", "", $xml), $m) && ($google = $m[1])) {
                     wp_redirect(wp_specialchars_decode($google, ENT_QUOTES));
                 } else {
                     /* Display error message. */
                     echo strip_tags($xml);
                 }
             } else {
                 if ($attr["level"] === "*") {
                     $attr["uniqid"] = uniqid();
                     /* Unique ID. */
                     $attr["referencing"] = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id();
                     /**/
                     $attr["level_ccaps_eotper"] = $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                     $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                     /* Right-trim separators from this string so we don't have trailing colons. */
                     /**/
                     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
                     $xml .= '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">';
                     $xml .= '<shopping-cart>';
                     $xml .= '<items>';
                     /**/
                     $xml .= '<item>';
                     /**/
                     $xml .= '<quantity>1</quantity>';
                     $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                     $xml .= '<item-description>(TID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Grants you immediate access.", "s2member-front", "s2member")) . '</item-description>';
                     $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                     /**/
                     $xml .= '<merchant-private-item-data>';
                     $xml .= '<s2_txn_id>s2-' . esc_html($attr["uniqid"]) . '</s2_txn_id>';
                     $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                     $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                     $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                     $xml .= '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>';
                     $xml .= '</merchant-private-item-data>';
                     /**/
                     $xml .= '<digital-content>';
                     $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                     $xml .= '<description>' . esc_html(sprintf(_x('You now have access to:<br />%s<br />( <a href="%s">please log back in now</a> )', "s2member-front", "s2member"), $attr["desc"], esc_attr(wp_login_url()))) . '</description>';
                     $xml .= '<url>' . esc_html(wp_login_url()) . '</url>';
                     $xml .= '</digital-content>';
                     /**/
                     $xml .= '</item>';
                     /**/
                     $xml .= '</items>';
                     $xml .= '</shopping-cart>';
                     /**/
                     $xml .= '<checkout-flow-support>';
                     $xml .= '<merchant-checkout-flow-support>';
                     $xml .= '<edit-cart-url>' . esc_html(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) . '</edit-cart-url>';
                     $xml .= '<continue-shopping-url>' . esc_html(wp_login_url()) . '</continue-shopping-url>';
                     $xml .= '</merchant-checkout-flow-support>';
                     $xml .= '</checkout-flow-support>';
                     /**/
                     $xml .= '</checkout-shopping-cart>';
                     /**/
                     $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_sandbox"] ? "sandbox.google.com/checkout" : "checkout.google.com";
                     /**/
                     if (($xml = c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/api/checkout/v2/merchantCheckout/Merchant/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"], $xml, array_merge(c_ws_plugin__s2member_pro_google_utilities::google_api_headers(), array("timeout" => 20)))) && preg_match("/\\<redirect-url\\>(.+?)\\<\\/redirect-url\\>/i", preg_replace("/[\r\n\t]+/", "", $xml), $m) && ($google = $m[1])) {
                         wp_redirect(wp_specialchars_decode($google, ENT_QUOTES));
                     } else {
                         /* Display error message. */
                         echo strip_tags($xml);
                     }
                 } else {
                     if ($attr["rr"] === "BN" || !$attr["tp"] && !$attr["rr"]) {
                         $attr["uniqid"] = uniqid();
                         /* Unique ID. */
                         $attr["referencing"] = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id();
                         /**/
                         $attr["desc"] = !$attr["desc"] ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
                         /**/
                         $attr["level_ccaps_eotper"] = $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                         $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                         /* Right-trim separators from this string so we don't have trailing colons. */
                         /**/
                         $attr["register_access_link"] = c_ws_plugin__s2member_register_access::register_link_gen("google", "s2-" . $attr["uniqid"], $attr["custom"], $attr["level_ccaps_eotper"]);
                         /**/
                         $xml = '<?xml version="1.0" encoding="UTF-8"?>';
                         $xml .= '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">';
                         $xml .= '<shopping-cart>';
                         $xml .= '<items>';
                         /**/
                         $xml .= '<item>';
                         /**/
                         $xml .= '<quantity>1</quantity>';
                         $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                         $xml .= '<item-description>(TID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Grants you immediate access.", "s2member-front", "s2member")) . '</item-description>';
                         $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                         /**/
                         $xml .= '<merchant-private-item-data>';
                         $xml .= '<s2_txn_id>s2-' . esc_html($attr["uniqid"]) . '</s2_txn_id>';
                         $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                         $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                         $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                         $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                         $xml .= '</merchant-private-item-data>';
                         /**/
                         $xml .= '<digital-content>';
                         $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                         /**/
                         if ($attr["referencing"]) {
                             $xml .= '<description>' . esc_html(sprintf(_x('You\'ve been updated to:<br />%s<br />( <a href="%s">please log back in now</a> )', "s2member-front", "s2member"), $attr["desc"], esc_attr(wp_login_url()))) . '</description>';
                             $xml .= '<url>' . esc_html(wp_login_url()) . '</url>';
                         } else {
                             $xml .= '<description>' . esc_html(sprintf(_x('%s<br />( the next step is to Register a Username )', "s2member-front", "s2member"), $attr["desc"])) . '</description>';
                             $xml .= '<url>' . esc_html($attr["register_access_link"]) . '</url>';
                         }
                         /**/
                         $xml .= '</digital-content>';
                         /**/
                         $xml .= '</item>';
                         /**/
                         $xml .= '</items>';
                         $xml .= '</shopping-cart>';
                         /**/
                         $xml .= '<checkout-flow-support>';
                         $xml .= '<merchant-checkout-flow-support>';
                         $xml .= '<edit-cart-url>' . esc_html(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) . '</edit-cart-url>';
                         $xml .= '<continue-shopping-url>' . esc_html($attr["referencing"] ? wp_login_url() : $attr["register_access_link"]) . '</continue-shopping-url>';
                         $xml .= '</merchant-checkout-flow-support>';
                         $xml .= '</checkout-flow-support>';
                         /**/
                         $xml .= '</checkout-shopping-cart>';
                         /**/
                         $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_sandbox"] ? "sandbox.google.com/checkout" : "checkout.google.com";
                         /**/
                         if (($xml = c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/api/checkout/v2/merchantCheckout/Merchant/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"], $xml, array_merge(c_ws_plugin__s2member_pro_google_utilities::google_api_headers(), array("timeout" => 20)))) && preg_match("/\\<redirect-url\\>(.+?)\\<\\/redirect-url\\>/i", preg_replace("/[\r\n\t]+/", "", $xml), $m) && ($google = $m[1])) {
                             wp_redirect(wp_specialchars_decode($google, ENT_QUOTES));
                         } else {
                             /* Display error message. */
                             echo strip_tags($xml);
                         }
                     } else {
                         $attr["uniqid"] = uniqid();
                         /* Unique ID. */
                         $attr["referencing"] = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id();
                         /**/
                         $attr["desc"] = !$attr["desc"] ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
                         /**/
                         $attr["level_ccaps_eotper"] = $attr["level"] . ":" . $attr["ccaps"];
                         /* Actual Subscriptions will always end on their own. */
                         $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                         /* Clean any trailing separators from this string. */
                         /**/
                         $attr["periodicity"] = c_ws_plugin__s2member_pro_google_utilities::google_periodicity($attr["rp"] . " " . $attr["rt"]);
                         /* Google® periodicity. */
                         /**/
                         $attr["register_access_link"] = c_ws_plugin__s2member_register_access::register_link_gen("google", "s2-" . $attr["uniqid"], $attr["custom"], $attr["level_ccaps_eotper"]);
                         /**/
                         if ($attr["tp"]) {
                             $attr["start_time"] = c_ws_plugin__s2member_pro_google_utilities::google_start_time($attr["tp"] . " " . $attr["tt"]);
                             /**/
                             $xml = '<?xml version="1.0" encoding="UTF-8"?>';
                             $xml .= '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">';
                             $xml .= '<shopping-cart>';
                             $xml .= '<items>';
                             /**/
                             $xml .= '<item>';
                             /**/
                             $xml .= '<quantity>1</quantity>';
                             $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                             $xml .= $attr["ta"] < 0.01 ? '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("100% free trial. NO charge today.", "s2member-front", "s2member")) . '</item-description>' : '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("First payment for immediate access.", "s2member-front", "s2member")) . '</item-description>';
                             $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ta"]) . '</unit-price>';
                             /**/
                             $xml .= '<merchant-private-item-data>';
                             $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                             $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                             $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                             $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                             $xml .= '<s2_period1>' . esc_html($attr["tp"] . " " . $attr["tt"]) . '</s2_period1>';
                             $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                             $xml .= $attr["rr"] ? '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>' : '';
                             $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                             $xml .= '</merchant-private-item-data>';
                             /**/
                             $xml .= '<digital-content>';
                             $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                             $xml .= '<description>' . esc_html(_x("You'll receive an email confirmation within 15 minutes.", "s2member-front", "s2member")) . '</description>';
                             $xml .= '</digital-content>';
                             /**/
                             $xml .= '</item>';
                             /**/
                             $xml .= '<item>';
                             /**/
                             $xml .= '<quantity>1</quantity>';
                             $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                             $xml .= '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(sprintf(_x("Cancel at any time to avoid %s.", "s2member-front", "s2member"), !$attr["rr"] ? _x("this charge", "s2member-front", "s2member") : _x("charges", "s2member-front", "s2member"))) . '</item-description>';
                             $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">0.00</unit-price>';
                             /**/
                             $xml .= '<merchant-private-item-data>';
                             $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                             $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                             $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                             $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                             $xml .= '<s2_period1>' . esc_html($attr["tp"] . " " . $attr["tt"]) . '</s2_period1>';
                             $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                             $xml .= $attr["rr"] ? '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>' : '';
                             $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                             $xml .= '</merchant-private-item-data>';
                             /**/
                             $xml .= '<digital-content>';
                             $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                             /**/
                             if ($attr["referencing"]) {
                                 $xml .= '<description>' . esc_html(sprintf(_x('You\'ve been updated to:<br />%s<br />( <a href="%s">please log back in now</a> )', "s2member-front", "s2member"), $attr["desc"], esc_attr(wp_login_url()))) . '</description>';
                                 $xml .= '<url>' . esc_html(wp_login_url()) . '</url>';
                             } else {
                                 $xml .= '<description>' . esc_html(sprintf(_x('%s<br />( the next step is to Register a Username )', "s2member-front", "s2member"), $attr["desc"])) . '</description>';
                                 $xml .= '<url>' . esc_html($attr["register_access_link"]) . '</url>';
                             }
                             /**/
                             $xml .= '</digital-content>';
                             /**/
                             $xml .= '<subscription type="google" period="' . esc_attr($attr["periodicity"]) . '" start-date="' . esc_attr(date("Y-m-d", $attr["start_time"]) . "T00:00:00Z") . '">';
                             /**/
                             $xml .= '<payments>';
                             $xml .= '<subscription-payment' . (!$attr["rr"] ? ' times="1"' : '') . '>';
                             $xml .= '<maximum-charge currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</maximum-charge>';
                             $xml .= '</subscription-payment>';
                             $xml .= '</payments>';
                             /**/
                             $xml .= '<recurrent-item>';
                             /**/
                             $xml .= '<quantity>1</quantity>';
                             $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                             $xml .= '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Covers ongoing access.", "s2member-front", "s2member")) . '</item-description>';
                             $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                             /**/
                             $xml .= '<merchant-private-item-data>';
                             $xml .= '<s2_subscr_payment>1</s2_subscr_payment>';
                             $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                             $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                             $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                             $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                             $xml .= '<s2_period1>' . esc_html($attr["tp"] . " " . $attr["tt"]) . '</s2_period1>';
                             $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                             $xml .= $attr["rr"] ? '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>' : '';
                             $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                             $xml .= '</merchant-private-item-data>';
                             /**/
                             $xml .= '<digital-content>';
                             $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                             $xml .= '<description>' . esc_html($attr["desc"]) . '</description>';
                             $xml .= '<url>' . esc_html(home_url("/")) . '</url>';
                             $xml .= '</digital-content>';
                             /**/
                             $xml .= '</recurrent-item>';
                             /**/
                             $xml .= '</subscription>';
                             /**/
                             $xml .= '</item>';
                             /**/
                             $xml .= '</items>';
                             $xml .= '</shopping-cart>';
                             /**/
                             $xml .= '<checkout-flow-support>';
                             $xml .= '<merchant-checkout-flow-support>';
                             $xml .= '<edit-cart-url>' . esc_html(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) . '</edit-cart-url>';
                             $xml .= '<continue-shopping-url>' . esc_html($attr["referencing"] ? wp_login_url() : $attr["register_access_link"]) . '</continue-shopping-url>';
                             $xml .= '</merchant-checkout-flow-support>';
                             $xml .= '</checkout-flow-support>';
                             /**/
                             $xml .= '</checkout-shopping-cart>';
                         } else {
                             if (!$attr["tp"] && $attr["rr"]) {
                                 $attr["start_time"] = c_ws_plugin__s2member_pro_google_utilities::google_start_time($attr["rp"] . " " . $attr["rt"]);
                                 /**/
                                 $xml = '<?xml version="1.0" encoding="UTF-8"?>';
                                 $xml .= '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">';
                                 $xml .= '<shopping-cart>';
                                 $xml .= '<items>';
                                 /**/
                                 $xml .= '<item>';
                                 /**/
                                 $xml .= '<quantity>1</quantity>';
                                 $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                                 $xml .= '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("First payment for immediate access.", "s2member-front", "s2member")) . '</item-description>';
                                 $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                                 /**/
                                 $xml .= '<merchant-private-item-data>';
                                 $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                                 $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                                 $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                                 $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                                 $xml .= '<s2_period1>0 D</s2_period1>';
                                 /* There is no Trial Period. */
                                 $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                                 $xml .= '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>';
                                 $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                                 $xml .= '</merchant-private-item-data>';
                                 /**/
                                 $xml .= '<digital-content>';
                                 $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                                 $xml .= '<description>' . esc_html(_x("You'll receive an email confirmation within 15 minutes.", "s2member-front", "s2member")) . '</description>';
                                 $xml .= '</digital-content>';
                                 /**/
                                 $xml .= '</item>';
                                 /**/
                                 $xml .= '<item>';
                                 /**/
                                 $xml .= '<quantity>1</quantity>';
                                 $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                                 $xml .= '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Cancel at any time to avoid charges.", "s2member-front", "s2member")) . '</item-description>';
                                 $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">0.00</unit-price>';
                                 /**/
                                 $xml .= '<merchant-private-item-data>';
                                 $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                                 $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                                 $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                                 $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                                 $xml .= '<s2_period1>0 D</s2_period1>';
                                 /* There is no Trial Period. */
                                 $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                                 $xml .= '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>';
                                 $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                                 $xml .= '</merchant-private-item-data>';
                                 /**/
                                 $xml .= '<digital-content>';
                                 $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                                 /**/
                                 if ($attr["referencing"]) {
                                     $xml .= '<description>' . esc_html(sprintf(_x('You\'ve been updated to:<br />%s<br />( <a href="%s">please log back in now</a> )', "s2member-front", "s2member"), $attr["desc"], esc_attr(wp_login_url()))) . '</description>';
                                     $xml .= '<url>' . esc_html(wp_login_url()) . '</url>';
                                 } else {
                                     $xml .= '<description>' . esc_html(sprintf(_x('%s<br />( the next step is to Register a Username )', "s2member-front", "s2member"), $attr["desc"])) . '</description>';
                                     $xml .= '<url>' . esc_html($attr["register_access_link"]) . '</url>';
                                 }
                                 /**/
                                 $xml .= '</digital-content>';
                                 /**/
                                 $xml .= '<subscription type="google" period="' . esc_attr($attr["periodicity"]) . '" start-date="' . esc_attr(date("Y-m-d", $attr["start_time"]) . "T00:00:00Z") . '">';
                                 /**/
                                 $xml .= '<payments>';
                                 $xml .= '<subscription-payment>';
                                 $xml .= '<maximum-charge currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</maximum-charge>';
                                 $xml .= '</subscription-payment>';
                                 $xml .= '</payments>';
                                 /**/
                                 $xml .= '<recurrent-item>';
                                 /**/
                                 $xml .= '<quantity>1</quantity>';
                                 $xml .= '<item-name>' . esc_html($attr["desc"]) . '</item-name>';
                                 $xml .= '<item-description>(SID:s2-' . esc_html($attr["uniqid"]) . ') ' . esc_html(_x("Covers ongoing access.", "s2member-front", "s2member")) . '</item-description>';
                                 $xml .= '<unit-price currency="' . esc_attr($attr["cc"]) . '">' . esc_html($attr["ra"]) . '</unit-price>';
                                 /**/
                                 $xml .= '<merchant-private-item-data>';
                                 $xml .= '<s2_subscr_payment>1</s2_subscr_payment>';
                                 $xml .= '<s2_subscr_id>s2-' . esc_html($attr["uniqid"]) . '</s2_subscr_id>';
                                 $xml .= '<s2_custom>' . esc_html($attr["custom"]) . '</s2_custom>';
                                 $xml .= '<s2_customer_ip>' . esc_html($_SERVER["REMOTE_ADDR"]) . '</s2_customer_ip>';
                                 $xml .= '<s2_item_number>' . esc_html($attr["level_ccaps_eotper"]) . '</s2_item_number>';
                                 $xml .= '<s2_period1>0 D</s2_period1>';
                                 /* There is no Trial Period. */
                                 $xml .= '<s2_period3>' . esc_html($attr["rp"] . " " . $attr["rt"]) . '</s2_period3>';
                                 $xml .= '<s2_recurring>' . esc_html($attr["rr"]) . '</s2_recurring>';
                                 $xml .= $attr["referencing"] ? '<s2_referencing>' . esc_html($attr["referencing"]) . '</s2_referencing>' : '';
                                 $xml .= '</merchant-private-item-data>';
                                 /**/
                                 $xml .= '<digital-content>';
                                 $xml .= '<display-disposition>PESSIMISTIC</display-disposition>';
                                 $xml .= '<description>' . esc_html($attr["desc"]) . '</description>';
                                 $xml .= '<url>' . esc_html(home_url("/")) . '</url>';
                                 $xml .= '</digital-content>';
                                 /**/
                                 $xml .= '</recurrent-item>';
                                 /**/
                                 $xml .= '</subscription>';
                                 /**/
                                 $xml .= '</item>';
                                 /**/
                                 $xml .= '</items>';
                                 $xml .= '</shopping-cart>';
                                 /**/
                                 $xml .= '<checkout-flow-support>';
                                 $xml .= '<merchant-checkout-flow-support>';
                                 $xml .= '<edit-cart-url>' . esc_html(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) . '</edit-cart-url>';
                                 $xml .= '<continue-shopping-url>' . esc_html($attr["referencing"] ? wp_login_url() : $attr["register_access_link"]) . '</continue-shopping-url>';
                                 $xml .= '</merchant-checkout-flow-support>';
                                 $xml .= '</checkout-flow-support>';
                                 /**/
                                 $xml .= '</checkout-shopping-cart>';
                             }
                         }
                         /**/
                         $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_sandbox"] ? "sandbox.google.com/checkout" : "checkout.google.com";
                         /**/
                         if (($xml = c_ws_plugin__s2member_utils_urls::remote("https://" . $endpoint . "/api/checkout/v2/merchantCheckout/Merchant/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"], $xml, array_merge(c_ws_plugin__s2member_pro_google_utilities::google_api_headers(), array("timeout" => 20)))) && preg_match("/\\<redirect-url\\>(.+?)\\<\\/redirect-url\\>/i", preg_replace("/[\r\n\t]+/", "", $xml), $m) && ($google = $m[1])) {
                             wp_redirect(wp_specialchars_decode($google, ENT_QUOTES));
                         } else {
                             /* Display error message. */
                             echo strip_tags($xml);
                         }
                     }
                 }
             }
         }
         /**/
         exit;
         /* Clean exit. */
     }
 }
 /**
  * Parses s2Vars passed through by ClickBank®.
  *
  * @package s2Member\ClickBank
  * @since 111205
  *
  * @param str $cvendthru Expects the URL-encoded query string of s2Vars, including `_s2member_sig`.
  * @param str $type Optional. The type of ClickBank® transaction. This deals with backward compatibility.
  * 	For SALE transactions, do NOT accept the older format. For others, remain backward compatible.
  * @return array Array of s2Vars. Possibly an empty array.
  */
 public static function clickbank_parse_s2vars($cvendthru = FALSE, $type = FALSE)
 {
     wp_parse_str((string) $cvendthru, $s2vars);
     $s2vars = c_ws_plugin__s2member_utils_strings::trim_deep($s2vars);
     /**/
     foreach ($s2vars as $var => $value) {
         if (!preg_match("/^(?:s2_|_s2member_sig)/", $var)) {
             unset($s2vars[$var]);
         }
     }
     /**/
     $is_sale = preg_match("/^(?:TEST_)?SALE\$/i", (string) $type);
     if (!$is_sale || c_ws_plugin__s2member_utils_urls::s2member_sig_ok(http_build_query($s2vars))) {
         return $s2vars;
     }
     /**/
     return array();
 }
 public static function shortcode($attr = array(), $content = '', $shortcode = '')
 {
     $_g = stripslashes_deep($_GET);
     // Cleanup the query string vars.
     if (!isset($_g['_s2member_seeking']) || !is_array($_g['_s2member_seeking']) || empty($_SERVER['QUERY_STRING']) || !c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER['QUERY_STRING'])) {
         return '';
     }
     $valid_required_types = array('level', 'ccap', 'sp');
     $valid_seeking_types = array('page', 'post', 'catg', 'ptag', 'file', 'ruri');
     $valid_restriction_types = array('page', 'post', 'catg', 'ptag', 'file', 'ruri', 'ccap', 'sp', 'sys');
     $attr = shortcode_atts(array('seeking_type' => '', 'required_type' => '', 'required_value' => '', 'restriction_type' => ''), $attr, $shortcode);
     # ---------------------------------------------------------------------------------------------------
     if ($attr['seeking_type'] !== '' || $attr['required_type'] !== '' || $attr['restriction_type'] !== '') {
         $attr['seeking_type'] = array_unique(preg_split('/[|;,\\s]+/', $attr['seeking_type'], NULL, PREG_SPLIT_NO_EMPTY));
         $attr['required_type'] = array_unique(preg_split('/[|;,\\s]+/', $attr['required_type'], NULL, PREG_SPLIT_NO_EMPTY));
         $attr['required_value'] = array_unique(preg_split('/[|;,\\s]+/', $attr['required_value'], NULL, PREG_SPLIT_NO_EMPTY));
         $attr['restriction_type'] = array_unique(preg_split('/[|;,\\s]+/', $attr['restriction_type'], NULL, PREG_SPLIT_NO_EMPTY));
         if (array_intersect($attr['seeking_type'], $valid_seeking_types)) {
             if (empty($_g['_s2member_seeking']['type']) || !in_array($_g['_s2member_seeking']['type'], $attr['seeking_type'], TRUE)) {
                 return '';
             }
         }
         if (array_intersect($attr['required_type'], $valid_required_types)) {
             if (empty($_g['_s2member_req']['type']) || !in_array($_g['_s2member_req']['type'], $attr['required_type'], TRUE)) {
                 return '';
             }
             $required_type = $_g['_s2member_req']['type'];
             if (!empty($attr['required_value']) && (count($attr['required_type']) !== 1 || !in_array($_g['_s2member_req'][$required_type], $attr['required_value'], TRUE))) {
                 return '';
             }
         }
         if (array_intersect($attr['restriction_type'], $valid_restriction_types)) {
             if (empty($_g['_s2member_res']['type']) || !in_array($_g['_s2member_res']['type'], $attr['restriction_type'], TRUE)) {
                 return '';
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_seeking']['type'])) {
         $seeking_type_tag = '';
         // Initialize.
         // Let's give the replacement tags a name that's useful for building messages
         switch (strtolower($_g['_s2member_seeking']['type'])) {
             case 'page':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_page', 'Page', get_defined_vars());
                 break;
             case 'post':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_post', 'Post', get_defined_vars());
                 break;
             case 'catg':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_catg', 'Category', get_defined_vars());
                 break;
             case 'ptag':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_ptag', 'Tag', get_defined_vars());
                 break;
             case 'file':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_file', 'File', get_defined_vars());
                 break;
             case 'ruri':
                 $seeking_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_seeking_type_ruri', 'URI', get_defined_vars());
                 break;
         }
         $content = str_ireplace('%%SEEKING_TYPE%%', esc_html($seeking_type_tag), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_seeking']['page'])) {
         $content = str_ireplace('%%SEEKING_PAGE_ID%%', esc_html($_g['_s2member_seeking']['page']), $content);
     } else {
         if (!empty($_g['_s2member_seeking']['post'])) {
             $content = str_ireplace('%%SEEKING_POST_ID%%', esc_html($_g['_s2member_seeking']['post']), $content);
         } else {
             if (!empty($_g['_s2member_seeking']['catg'])) {
                 $content = str_ireplace('%%SEEKING_CAT_ID%%', esc_html($_g['_s2member_seeking']['catg']), $content);
             } else {
                 if (!empty($_g['_s2member_seeking']['ptag'])) {
                     $content = str_ireplace('%%SEEKING_TAG_ID%%', esc_html($_g['_s2member_seeking']['ptag']), $content);
                 } else {
                     if (!empty($_g['_s2member_seeking']['file'])) {
                         $content = str_ireplace('%%SEEKING_FILE%%', esc_html($_g['_s2member_seeking']['file']), $content);
                     } else {
                         if (!empty($_g['_s2member_seeking']['ruri'])) {
                             $content = str_ireplace('%%SEEKING_RURI%%', esc_html(base64_decode($_g['_s2member_seeking']['ruri'])), $content);
                         }
                     }
                 }
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_seeking']['_uri'])) {
         $content = str_ireplace('%%SEEKING_URI%%', esc_html(home_url(base64_decode($_g['_s2member_seeking']['_uri']))), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_req']['type'])) {
         $required_type_tag = '';
         // Initialize.
         // Let's give the replacement tags a name that's useful for building messages
         switch (strtolower($_g['_s2member_req']['type'])) {
             case 'level':
                 $required_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_required_type_level', 'Level', get_defined_vars());
                 break;
             case 'ccap':
                 $required_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_required_type_ccap', 'Capability', get_defined_vars());
                 break;
             case 'sp':
                 $required_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_required_type_sp', 'Specific Post/Page', get_defined_vars());
                 break;
         }
         $content = str_ireplace('%%REQUIRED_TYPE%%', esc_html($required_type_tag), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (isset($_g['_s2member_req']['level'])) {
         $content = str_ireplace('%%REQUIRED_LEVEL%%', esc_html($_g['_s2member_req']['level']), $content);
         if (!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $_g['_s2member_req']['level'] . '_label'])) {
             $content = str_ireplace('%%REQUIRED_LEVEL_LABEL%%', esc_html($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $_g['_s2member_req']['level'] . '_label']), $content);
         }
     } else {
         if (!empty($_g['_s2member_req']['ccap'])) {
             $content = str_ireplace('%%REQUIRED_CCAP%%', esc_html($_g['_s2member_req']['ccap']), $content);
         } else {
             if (!empty($_g['_s2member_req']['sp'])) {
                 $content = str_ireplace('%%REQUIRED_SP%%', esc_html($_g['_s2member_req']['sp']), $content);
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_res']['type'])) {
         $restriction_type_tag = '';
         // Initialize.
         // Let's give the replacement tags a name that's useful for building messages
         switch (strtolower($_g['_s2member_seeking']['type'])) {
             case 'page':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_page', 'Page', get_defined_vars());
                 break;
             case 'post':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_post', 'Post', get_defined_vars());
                 break;
             case 'catg':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_catg', 'Category', get_defined_vars());
                 break;
             case 'ptag':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_ptag', 'Tag', get_defined_vars());
                 break;
             case 'file':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_file', 'File', get_defined_vars());
                 break;
             case 'ruri':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_ruri', 'URI', get_defined_vars());
                 break;
             case 'ccap':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_ccap', 'Custom Capability', get_defined_vars());
                 break;
             case 'sp':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_sp', 'Specific Post/Page', get_defined_vars());
                 break;
             case 'sys':
                 $restriction_type_tag = apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_restriction_type_sys', 'Systematic', get_defined_vars());
                 break;
         }
         $content = str_ireplace('%%RESTRICTION_TYPE%%', esc_html($restriction_type_tag), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_seeking']['type']) && $_g['_s2member_seeking']['type'] == 'post') {
         $content = str_ireplace(array('%%POST_TITLE%%', '%%PAGE_TITLE%%'), get_the_title((int) $_g['_s2member_seeking']['post']), $content);
         $content = str_ireplace('%%POST_EXCERPT%%', c_ws_plugin__s2member_pro_sc_mop_vars_notice_in::get_excerpt((int) $_g['_s2member_seeking']['post']), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g['_s2member_seeking']['type']) && $_g['_s2member_seeking']['type'] == 'page') {
         $content = str_ireplace(array('%%POST_TITLE%%', '%%PAGE_TITLE%%'), get_the_title((int) $_g['_s2member_seeking']['page']), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     return apply_filters('c_ws_plugin__s2member_pro_sc_mop_vars_notice_content', do_shortcode($content), get_defined_vars());
 }
 public static function shortcode($attr = array(), $content = "", $shortcode = "")
 {
     $_g = stripslashes_deep($_GET);
     if (!isset($_g["_s2member_seeking"]) || !is_array($_g["_s2member_seeking"]) || empty($_SERVER["QUERY_STRING"]) || !c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER["QUERY_STRING"])) {
         return "";
     }
     $valid_required_types = array("level", "ccap", "sp");
     $valid_seeking_types = array("page", "post", "catg", "ptag", "file", "ruri");
     $valid_restriction_types = array("page", "post", "catg", "ptag", "file", "ruri", "ccap", "sp", "sys");
     $attr = shortcode_atts(array("seeking_type" => "", "required_type" => "", "restriction_type" => ""), $attr, $shortcode);
     # ---------------------------------------------------------------------------------------------------
     if ($attr["seeking_type"] !== "" || $attr["required_type"] !== "" || $attr["restriction_type"] !== "") {
         $attr["seeking_type"] = array_unique(preg_split('/[|;,\\s]+/', $attr["seeking_type"], NULL, PREG_SPLIT_NO_EMPTY));
         $attr["required_type"] = array_unique(preg_split('/[|;,\\s]+/', $attr["required_type"], NULL, PREG_SPLIT_NO_EMPTY));
         $attr["restricton_type"] = array_unique(preg_split('/[|;,\\s]+/', $attr["restricton_type"], NULL, PREG_SPLIT_NO_EMPTY));
         if (isset($attr["seeking_type"]) && array_intersect($attr["seeking_type"], $valid_seeking_types)) {
             if (empty($_g["_s2member_seeking"]["type"]) || !in_array($_g["_s2member_seeking"]["type"], $attr["seeking_type"], TRUE)) {
                 return "";
             }
         }
         if (isset($attr["required_type"]) && array_intersect($attr["required_type"], $valid_required_types)) {
             if (empty($_g["_s2member_req"]["type"]) || !in_array($_g["_s2member_req"]["type"], $attr["required_type"], TRUE)) {
                 return "";
             }
         }
         if (isset($attr["restriction_type"]) && array_intersect($attr["restriction_type"], $valid_restriction_types)) {
             if (empty($_g["_s2member_res"]["type"]) || !in_array($_g["_s2member_res"]["type"], $attr["restriction_type"], TRUE)) {
                 return "";
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_seeking"]["type"])) {
         $content = str_ireplace("%%SEEKING_TYPE%%", esc_html($_g["_s2member_seeking"]["type"]), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_seeking"]["page"])) {
         $content = str_ireplace("%%SEEKING_PAGE_ID%%", esc_html($_g["_s2member_seeking"]["page"]), $content);
     } else {
         if (!empty($_g["_s2member_seeking"]["post"])) {
             $content = str_ireplace("%%SEEKING_POST_ID%%", esc_html($_g["_s2member_seeking"]["post"]), $content);
         } else {
             if (!empty($_g["_s2member_seeking"]["catg"])) {
                 $content = str_ireplace("%%SEEKING_CAT_ID%%", esc_html($_g["_s2member_seeking"]["catg"]), $content);
             } else {
                 if (!empty($_g["_s2member_seeking"]["ptag"])) {
                     $content = str_ireplace("%%SEEKING_TAG_ID%%", esc_html($_g["_s2member_seeking"]["ptag"]), $content);
                 } else {
                     if (!empty($_g["_s2member_seeking"]["file"])) {
                         $content = str_ireplace("%%SEEKING_FILE%%", esc_html($_g["_s2member_seeking"]["file"]), $content);
                     } else {
                         if (!empty($_g["_s2member_seeking"]["ruri"])) {
                             $content = str_ireplace("%%SEEKING_RURI%%", esc_html(base64_decode($_g["_s2member_seeking"]["ruri"])), $content);
                         }
                     }
                 }
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_seeking"]["_uri"])) {
         $content = str_ireplace("%%SEEKING_URI%%", esc_html(site_url(base64_decode($_g["_s2member_seeking"]["_uri"]))), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_req"]["type"])) {
         $content = str_ireplace("%%REQUIRED_TYPE%%", esc_html($_g["_s2member_req"]["type"]), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (isset($_g["_s2member_req"]["level"])) {
         $content = str_ireplace("%%REQUIRED_LEVEL%%", esc_html($_g["_s2member_req"]["level"]), $content);
     } else {
         if (!empty($_g["_s2member_req"]["ccap"])) {
             $content = str_ireplace("%%REQUIRED_CCAP%%", esc_html($_g["_s2member_req"]["ccap"]), $content);
         } else {
             if (!empty($_g["_s2member_req"]["sp"])) {
                 $content = str_ireplace("%%REQUIRED_SP%%", esc_html($_g["_s2member_req"]["sp"]), $content);
             }
         }
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_res"]["type"])) {
         $content = str_ireplace("%%RESTRICTION_TYPE%%", esc_html($_g["_s2member_res"]["type"]), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_seeking"]["type"]) && $_g["_s2member_seeking"]["type"] == "post") {
         $content = str_ireplace(array("%%POST_TITLE%%", "%%PAGE_TITLE%%"), get_the_title((int) $_g["_s2member_seeking"]["post"]), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     if (!empty($_g["_s2member_seeking"]["type"]) && $_g["_s2member_seeking"]["type"] == "page") {
         $content = str_ireplace(array("%%POST_TITLE%%", "%%PAGE_TITLE%%"), get_the_title((int) $_g["_s2member_seeking"]["page"]), $content);
     }
     # ---------------------------------------------------------------------------------------------------
     return apply_filters("c_ws_plugin__s2member_pro_sc_mop_vars_notice_content", do_shortcode($content), get_defined_vars());
 }