Пример #1
0
 /**
  * Handles Return templates w/ response message.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @param string $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
  * @param string $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
  * @param string $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
  * @param string $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ('/', 'http')``.
  *
  * @return string The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
  */
 public static function return_template($template = '', $response = '', $continue_html = '', $continue_link = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_return_template', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $template = $template ? $template : 'default';
     $continue_link = $continue_link ? $continue_link : home_url('/', 'http');
     $continue_html = $continue_html ? $continue_html : _x('Continue', 's2member-front', 's2member');
     $response = $response ? $response : _x('Thank you. Please click the link below.', 's2member-front', 's2member');
     $custom_template = is_file(TEMPLATEPATH . '/' . $template . '-return.php') ? TEMPLATEPATH . '/' . $template . '-return.php' : '';
     $custom_template = is_file(get_stylesheet_directory() . '/' . $template . '-return.php') ? get_stylesheet_directory() . '/' . $template . '-return.php' : $custom_template;
     $custom_template = is_file(WP_CONTENT_DIR . '/' . $template . '-return.php') ? WP_CONTENT_DIR . '/' . $template . '-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(TEMPLATEPATH . '/default-return.php') ? TEMPLATEPATH . '/default-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(get_stylesheet_directory() . '/default-return.php') ? get_stylesheet_directory() . '/default-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(WP_CONTENT_DIR . '/default-return.php') ? WP_CONTENT_DIR . '/default-return.php' : $custom_template;
     $specific_template = $custom_template ? $custom_template : (is_file($_default_specific_template = dirname(dirname(__FILE__)) . '/templates/returns/' . $template . '-return.php') ? $_default_specific_template : '');
     $code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . '/templates/returns/default-return.php')));
     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
     $doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo('name'), 'ws_plugin__s2member_during_return_template_head_' . ($specific_template ? basename($specific_template) : 'default-return.php'));
     $code = preg_replace('/%%doctype_html_head%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_doctype_html_head', $doctype_html_head, get_defined_vars())), $code);
     $code = preg_replace('/%%header%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_header', sprintf(_x('[ %s ] <strong><em>says&hellip;</em></strong>', 's2member-front', 's2member'), esc_html($_SERVER['HTTP_HOST'])), get_defined_vars())), $code);
     $code = preg_replace('/%%response%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_response', $response, get_defined_vars())), $code);
     $code = preg_replace('/%%continue%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_continue', '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
     $code = preg_replace('/%%support%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_support', sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', 's2member-front', 's2member'), esc_attr($GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_support_link'])), get_defined_vars())), $code);
     $code = preg_replace('/%%tracking%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_tracking', c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
     return apply_filters('ws_plugin__s2member_return_template', $code, get_defined_vars());
 }
Пример #2
0
 /**
  * Handles Return templates w/ response message.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @param str $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
  * @param str $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
  * @param str $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
  * @param str $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ("/")``.
  * @return str The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
  */
 public static function return_template($template = FALSE, $response = FALSE, $continue_html = FALSE, $continue_link = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_return_template", get_defined_vars());
     unset($__refs, $__v);
     $template = $template ? $template : "default";
     $continue_link = $continue_link ? $continue_link : home_url("/");
     $continue_html = $continue_html ? $continue_html : _x("Continue", "s2member-front", "s2member");
     $response = $response ? $response : _x("Thank you. Please click the link below.", "s2member-front", "s2member");
     $custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.php") ? TEMPLATEPATH . "/" . $template . "-return.php" : false;
     $custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.html") ? TEMPLATEPATH . "/" . $template . "-return.html" : $custom_template;
     $custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.php") ? WP_CONTENT_DIR . "/" . $template . "-return.php" : $custom_template;
     $custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.html") ? WP_CONTENT_DIR . "/" . $template . "-return.html" : $custom_template;
     $custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.php") ? TEMPLATEPATH . "/default-return.php" : $custom_template;
     $custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.html") ? TEMPLATEPATH . "/default-return.html" : $custom_template;
     $custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.php") ? WP_CONTENT_DIR . "/default-return.php" : $custom_template;
     $custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.html") ? WP_CONTENT_DIR . "/default-return.html" : $custom_template;
     $specific_template = $custom_template ? $custom_template : (file_exists($_default_specific_template = dirname(dirname(__FILE__)) . "/templates/returns/" . $template . "-return.php") ? $_default_specific_template : false);
     $code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . "/templates/returns/default-return.php")));
     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
     $doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo("name"), "ws_plugin__s2member_during_return_template_head_" . ($specific_template ? basename($specific_template) : "default-return.php"));
     $code = preg_replace("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_doctype_html_head", $doctype_html_head, get_defined_vars())), $code);
     $code = preg_replace("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_header", sprintf(_x('[ %s ] <strong><em>says&hellip;</em></strong>', "s2member-front", "s2member"), esc_html($_SERVER["HTTP_HOST"])), get_defined_vars())), $code);
     $code = preg_replace("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_response", $response, get_defined_vars())), $code);
     $code = preg_replace("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_continue", '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
     $code = preg_replace("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_support", sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', "s2member-front", "s2member"), esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_support_link"])), get_defined_vars())), $code);
     $code = preg_replace("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_tracking", c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
     return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars());
 }
 /**
  * Applies custom Return Template Headers.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @attaches-to ``add_filter('ws_plugin__s2member_return_template_header');``
  *
  * @param string $default_header The default header *(i.e., HTML code)*, passed through by the Filter.
  * @param array  $vars An array of defined variables, passed through by the Filter.
  *
  * @return string A custom Return Template Header, if configured, else the ``$default_header``.
  */
 public static function return_template_header($default_header = '', $vars = array())
 {
     if (!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_' . $vars['template'] . '_return_template_header'])) {
         $code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_' . $vars['template'] . '_return_template_header'];
         $code = !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code;
         return $custom_header = $code;
     }
     return $default_header;
 }
Пример #4
0
 /**
  * Applies custom Return Template Headers.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @attaches-to ``add_filter("ws_plugin__s2member_return_template_header");``
  *
  * @param str $default_header The default header *(i.e. HTML code)*, passed through by the Filter.
  * @param array $vars An array of defined variables, passed through by the Filter.
  * @return str A custom Return Template Header, if configured, else the ``$default_header``.
  */
 public static function return_template_header($default_header = FALSE, $vars = FALSE)
 {
     if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $vars["template"] . "_return_template_header"])) {
         $code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $vars["template"] . "_return_template_header"];
         $code = !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code;
         return $custom_header = $code;
     }
     return $default_header;
 }
Пример #5
0
 /**
  * Generates footer code, when/if configured.
  *
  * @package s2Member\WP_Footer
  * @since 110524RC
  *
  * @return null
  */
 public static function wp_footer_code()
 {
     do_action('ws_plugin__s2member_before_wp_footer_code', get_defined_vars());
     if ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['wp_footer_code']) {
         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo do_shortcode($code) . "\n";
         } else {
             echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
         }
     }
     do_action('ws_plugin__s2member_after_wp_footer_code', get_defined_vars());
 }
Пример #6
0
 /**
  * Generates footer code, when/if configured.
  *
  * @package s2Member\WP_Footer
  * @since 110524RC
  *
  * @return null
  */
 public static function wp_footer_code()
 {
     do_action("ws_plugin__s2member_before_wp_footer_code", get_defined_vars());
     if ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["wp_footer_code"]) {
         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo do_shortcode($code) . "\n";
         } else {
             echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
         }
     }
     do_action("ws_plugin__s2member_after_wp_footer_code", get_defined_vars());
     return;
 }
function S2FilePicker_init()
{
    if (is_plugin_active('s2member/s2member.php')) {
        /**/
        if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'])) {
            if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
                mkdir($files_dir, 0777, true);
            }
        }
        /**/
        if (is_dir($files_dir) && is_writable($files_dir)) {
            if (!file_exists($htaccess = $files_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', false, get_defined_vars())) {
                file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']["s2member"]["c"]['files_dir_htaccess']))));
            }
        }
        add_action('media_buttons', 'S2FilePicker_btn', 20);
        add_action('media_upload_s2fpicker', 'S2FilePicker_media_upload_handler');
        add_action('media_upload_type_S2FilePicker_frame', 'S2FilePicker_media_upload_content');
    } else {
        add_action('admin_notices', 'S2FilePicker_warning');
    }
}
function s2sfu_initialization()
{
    $active_plugins = get_option('active_plugins');
    $required_plugin = 's2member/s2member.php';
    if (in_array($required_plugin, $active_plugins)) {
        /**/
        if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'])) {
            if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
                mkdir($files_dir, 0777, true);
            }
        }
        /**/
        if (is_dir($files_dir) && is_writable($files_dir)) {
            if (!file_exists($htaccess = $files_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', false, get_defined_vars())) {
                file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']["s2member"]["c"]['files_dir_htaccess']))));
            }
        }
        add_action('media_buttons', 's2sfu_media_button', 20);
        add_action('media_upload_s2sfu', 's2sfu_media_upload_handler');
    } else {
        add_action('admin_notices', 's2sfu_warning');
    }
}
 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110815
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  *
  * @todo Optimize with ``empty()`` and ``isset()``.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal["txn_type"]) && preg_match("/^web_accept\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"])) && (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])) && (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && !empty($paypal["payer_email"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
             list($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split("/\\:/", $paypal["item_number"], 3);
             $paypal["ip"] = preg_match("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"] ? $paypal["option_selection2"] : "";
             $paypal["ip"] = !$paypal["ip"] && preg_match("/^[a-z0-9]+~[0-9\\.]+\$/i", $paypal["invoice"]) ? preg_replace("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
             if (preg_match("/(referenc|associat|updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) {
                 if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal["txn_id"], $paypal["option_selection1"])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     if (!$user->has_cap("administrator")) {
                         $processing = $during = true;
                         // Yes, we ARE processing this.
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps", get_defined_vars());
                         unset($__refs, $__v);
                         $fields = get_user_option("s2member_custom_fields", $user_id);
                         // These will be needed in the routines below.
                         $user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
                         // Original IP during Registration.
                         $user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
                         // Now merge conditionally.
                         if (is_multisite() && !is_user_member_of_blog($user_id)) {
                             add_existing_user_to_blog(array("user_id" => $user_id, "role" => get_option("default_role")));
                             $user = new WP_User($user_id);
                         }
                         if ($paypal["ccaps"] && preg_match("/^-all/", str_replace("+", "", $paypal["ccaps"]))) {
                             foreach ($user->allcaps as $cap => $cap_enabled) {
                                 if (preg_match("/^access_s2member_ccap_/", $cap)) {
                                     $user->remove_cap($ccap = $cap);
                                 }
                             }
                         }
                         if ($paypal["ccaps"] && preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) {
                             foreach (preg_split("/[\r\n\t\\s;,]+/", preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) as $ccap) {
                                 if (strlen($ccap = trim(strtolower(preg_replace("/[^a-z_0-9]/i", "", $ccap))))) {
                                     $user->add_cap("access_s2member_ccap_" . $ccap);
                                 }
                             }
                         }
                         if (!get_user_option("s2member_registration_ip", $user_id)) {
                             update_user_option($user_id, "s2member_registration_ip", $paypal["ip"]);
                         }
                         $paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
                         $sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_subject"];
                         // The same for standard and w/ Pro Forms.
                         $msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_message"];
                         // The same for standard and w/ Pro Forms.
                         $rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_recipients"];
                         // The same for standard and w/ Pro Forms.
                         if (($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $rec))) {
                             if (($rec = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $rec)) && ($rec = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $rec))) {
                                 if (($rec = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $rec)) && ($rec = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $rec))) {
                                     if (($rec = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"])), $rec)) && ($rec = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"])), $rec))) {
                                         if ($rec = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $rec)) {
                                             // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
                                             if ($rec = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $rec)) {
                                                 if (($rec = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $rec))) {
                                                     if (($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $rec)) && ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $rec))) {
                                                         if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $rec)) {
                                                             if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $rec)) {
                                                                 if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $rec)) {
                                                                     if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $rec)) {
                                                                         if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $rec)) {
                                                                             if (($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $sbj))) {
                                                                                 if (($sbj = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $sbj)) && ($sbj = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $sbj))) {
                                                                                     if (($sbj = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $sbj)) && ($sbj = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $sbj))) {
                                                                                         if (($sbj = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $sbj)) && ($sbj = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $sbj))) {
                                                                                             if ($sbj = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)) {
                                                                                                 if ($sbj = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $sbj)) {
                                                                                                     if (($sbj = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $sbj))) {
                                                                                                         if (($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $sbj)) && ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $sbj))) {
                                                                                                             if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $sbj)) {
                                                                                                                 if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $sbj)) {
                                                                                                                     if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $sbj)) {
                                                                                                                         if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $sbj)) {
                                                                                                                             if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $sbj)) {
                                                                                                                                 if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $msg))) {
                                                                                                                                     if (($msg = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $msg))) {
                                                                                                                                         if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
                                                                                                                                             if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
                                                                                                                                                 if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
                                                                                                                                                     if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
                                                                                                                                                         if (($msg = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $msg))) {
                                                                                                                                                             if (($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $msg)) && ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $msg))) {
                                                                                                                                                                 if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $msg)) {
                                                                                                                                                                     if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $msg)) {
                                                                                                                                                                         if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $msg)) {
                                                                                                                                                                             if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $msg)) {
                                                                                                                                                                                 if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $msg)) {
                                                                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                                                                             $rec = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $rec);
                                                                                                                                                                                             $sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $sbj);
                                                                                                                                                                                             $msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $msg);
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                     if (($rec = trim(preg_replace("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                                                                         }
                                                                                                                                                                                         foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
                                                                                                                                                                                             c_ws_plugin__s2member_email_configs::email_config() . wp_mail($recipient, apply_filters("ws_plugin__s2member_capabilities_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_capabilities_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                                                                         }
                                                                                                                                                                                         $paypal["s2member_log"][] = "Capability Confirmation Email sent to: " . $rec . ".";
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                             if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["subscr_id"])), $url))) {
                                 if (($url = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["txn_id"])), $url))) {
                                     if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
                                         if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
                                             if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
                                                 if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
                                                     if (($url = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["affiliate_id"])), $url))) {
                                                         if (($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->last_name)), $url))) {
                                                             if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($user->first_name . " " . $user->last_name))), $url)) {
                                                                 if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_email)), $url)) {
                                                                     if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_login)), $url)) {
                                                                         if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_reg_ip)), $url)) {
                                                                             if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_id)), $url)) {
                                                                                 if (is_array($fields) && !empty($fields)) {
                                                                                     foreach ($fields as $var => $val) {
                                                                                         if (!($url = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(maybe_serialize($val))), $url))) {
                                                                                             break;
                                                                                         }
                                                                                     }
                                                                                 }
                                                                                 if ($url = trim($url)) {
                                                                                     // Preserve remaining replacements.
                                                                                     // Because the parent routine may perform replacements too.
                                                                                     $paypal["s2member_paypal_proxy_return_url"] = $url;
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
                         }
                         if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                             foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url) {
                                 if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["subscr_id"])), $url))) {
                                     if (($url = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["txn_id"])), $url))) {
                                         if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
                                             if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
                                                 if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
                                                     if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
                                                         if (($url = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["affiliate_id"])), $url))) {
                                                             if (($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->last_name)), $url))) {
                                                                 if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($user->first_name . " " . $user->last_name))), $url)) {
                                                                     if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_email)), $url)) {
                                                                         if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_login)), $url)) {
                                                                             if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_reg_ip)), $url)) {
                                                                                 if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_id)), $url)) {
                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                         foreach ($fields as $var => $val) {
                                                                                             if (!($url = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(maybe_serialize($val))), $url))) {
                                                                                                 break;
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                     if ($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))) {
                                                                                         c_ws_plugin__s2member_utils_urls::remote($url);
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
                         }
                         if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                             $msg = $sbj = "(s2Member / API Notification Email) - Payment";
                             $msg .= "\n\n";
                             // Spacing in the message body.
                             $msg .= "subscr_id: %%subscr_id%%\n";
                             $msg .= "amount: %%amount%%\n";
                             $msg .= "txn_id: %%txn_id%%\n";
                             $msg .= "item_number: %%item_number%%\n";
                             $msg .= "item_name: %%item_name%%\n";
                             $msg .= "first_name: %%first_name%%\n";
                             $msg .= "last_name: %%last_name%%\n";
                             $msg .= "full_name: %%full_name%%\n";
                             $msg .= "payer_email: %%payer_email%%\n";
                             $msg .= "full_coupon_code: %%full_coupon_code%%\n";
                             $msg .= "coupon_code: %%coupon_code%%\n";
                             $msg .= "coupon_affiliate_id: %%coupon_affiliate_id%%\n";
                             $msg .= "user_first_name: %%user_first_name%%\n";
                             $msg .= "user_last_name: %%user_last_name%%\n";
                             $msg .= "user_full_name: %%user_full_name%%\n";
                             $msg .= "user_email: %%user_email%%\n";
                             $msg .= "user_login: %%user_login%%\n";
                             $msg .= "user_ip: %%user_ip%%\n";
                             $msg .= "user_id: %%user_id%%\n";
                             if (is_array($fields) && !empty($fields)) {
                                 foreach ($fields as $var => $val) {
                                     $msg .= $var . ": %%" . $var . "%%\n";
                                 }
                             }
                             $msg .= "cv0: %%cv0%%\n";
                             $msg .= "cv1: %%cv1%%\n";
                             $msg .= "cv2: %%cv2%%\n";
                             $msg .= "cv3: %%cv3%%\n";
                             $msg .= "cv4: %%cv4%%\n";
                             $msg .= "cv5: %%cv5%%\n";
                             $msg .= "cv6: %%cv6%%\n";
                             $msg .= "cv7: %%cv7%%\n";
                             $msg .= "cv8: %%cv8%%\n";
                             $msg .= "cv9: %%cv9%%";
                             if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $msg))) {
                                 if (($msg = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $msg))) {
                                     if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
                                         if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
                                             if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
                                                 if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
                                                     if (($msg = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $msg))) {
                                                         if (($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $msg)) && ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $msg))) {
                                                             if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $msg)) {
                                                                 if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $msg)) {
                                                                     if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $msg)) {
                                                                         if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $msg)) {
                                                                             if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $msg)) {
                                                                                 if (is_array($fields) && !empty($fields)) {
                                                                                     foreach ($fields as $var => $val) {
                                                                                         if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $msg))) {
                                                                                             break;
                                                                                         }
                                                                                     }
                                                                                 }
                                                                                 if ($sbj && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                     // Still have a ``$sbj`` and a ``$msg``?
                                                                                     foreach (c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient) {
                                                                                         wp_mail($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
                         }
                         if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                             if (($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $code))) {
                                 if (($code = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $code)) && ($code = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $code))) {
                                     if (($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $code))) {
                                         if (($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $code))) {
                                             if ($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $code)) {
                                                 if ($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $code)) {
                                                     if (($code = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $code)) && ($code = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $code)) && ($code = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $code))) {
                                                         if (($code = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $code)) && ($code = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $code))) {
                                                             if ($code = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $code)) {
                                                                 if ($code = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $code)) {
                                                                     if ($code = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $code)) {
                                                                         if ($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $code)) {
                                                                             if ($code = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $code)) {
                                                                                 if (is_array($fields) && !empty($fields)) {
                                                                                     foreach ($fields as $var => $val) {
                                                                                         if (!($code = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $code))) {
                                                                                             break;
                                                                                         }
                                                                                     }
                                                                                 }
                                                                                 if ($code = trim(preg_replace("/%%(.+?)%%/i", "", $code))) {
                                                                                     $paypal["s2member_log"][] = "Storing Payment Tracking Codes into a Transient Queue. These will be processed on-site.";
                                                                                     set_transient("s2m_" . md5("s2member_transient_ccap_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars());
                         unset($__refs, $__v);
                     } else {
                         $paypal["s2member_log"][] = "Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
                     }
                 } else {
                     $paypal["s2member_log"][] = "Unable to add new Capabilities. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
                 }
             } else {
                 $paypal["s2member_log"][] = "Unable to add new Capabilities. Missing User/Member details. Please check the `on0` and `os0` variables in your Button Code.";
             }
         } else {
             $paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
             $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_notify_after_new_ccaps", get_defined_vars());
         unset($__refs, $__v);
         return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", $paypal, get_defined_vars());
     } else {
         return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", false, get_defined_vars());
     }
 }
 /**
  * Handles the Shortcode for: `[s2Member-PayPal-Button /]`.
  *
  * @package s2Member\PayPal
  * @since 3.5
  *
  * @attaches-to ``add_shortcode("s2Member-PayPal-Button");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str The resulting PayPal Button Code.
  */
 public static function sc_paypal_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_paypal_button", get_defined_vars());
     unset($__refs, $__v);
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(apply_filters("ws_plugin__s2member_sc_paypal_button_default_attrs", array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "lc" => "", "lang" => "", "cc" => "USD", "dg" => "0", "ns" => "1", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "rrt" => "", "rra" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "button"), get_defined_vars()), $attr);
     $attr["modify"] = $attr["modify"] === "1" && (!is_user_logged_in() || !get_user_option("s2member_subscr_id")) && $attr["tp"] ? "0" : $attr["modify"];
     $attr["lc"] = strtoupper($attr["lc"]);
     $attr["tt"] = strtoupper($attr["tt"]);
     $attr["rt"] = strtoupper($attr["rt"]);
     $attr["rr"] = strtoupper($attr["rr"]);
     $attr["ccaps"] = strtolower($attr["ccaps"]);
     $attr["ccaps"] = str_replace(" ", "", $attr["ccaps"]);
     $attr["rr"] = $attr["rt"] === "L" ? "BN" : $attr["rr"];
     $attr["rr"] = $attr["level"] === "*" ? "BN" : $attr["rr"];
     $attr["ns"] = $attr["dg"] === "1" ? "1" : $attr["ns"];
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     if ($attr["cancel"]) {
         $default_image = "https://www.paypal.com/" . ($attr["lang"] ? $attr["lang"] : _x("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_unsubscribe_LG.gif";
         $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
         $code = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
         $code = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
         $code = $attr["output"] === "anchor" ? $code : $code;
         if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
             $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
         }
         unset($href, $url, $m);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_sc_paypal_cancellation_button", get_defined_vars());
         unset($__refs, $__v);
     } else {
         if ($attr["sp"]) {
             $default_image = "https://www.paypal.com/" . ($attr["lang"] ? $attr["lang"] : _x("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
             $paypal_on0_input_value = ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? "Referencing Customer ID" : "Originating Domain";
             $paypal_os0_input_value = $referencing ? $referencing : $_SERVER["HTTP_HOST"];
             $paypal_on1_input_value = "Customer IP Address";
             $paypal_os1_input_value = $_SERVER["REMOTE_ADDR"];
             $paypal_invoice_input_value = uniqid() . "~" . $_SERVER["REMOTE_ADDR"];
             $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
             $success_return_url = site_url("/?s2member_paypal_return=1");
             $success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars());
             $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
             $code = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
             $code = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
             $code = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(home_url("/"))), $code);
             $code = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url("/?s2member_paypal_notify=1"))), $code);
             $code = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($success_return_url)), $code);
             $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])), $code);
             $code = preg_replace('/ name\\="lc" value\\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["lc"])) . '"', $code);
             $code = preg_replace('/ name\\="no_shipping" value\\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ns"])) . '"', $code);
             $code = preg_replace('/ name\\="item_name" value\\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["desc"])) . '"', $code);
             $code = preg_replace('/ name\\="item_number" value\\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["sp_ids_exp"])) . '"', $code);
             $code = preg_replace('/ name\\="page_style" value\\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ps"])) . '"', $code);
             $code = preg_replace('/ name\\="currency_code" value\\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cc"])) . '"', $code);
             $code = preg_replace('/ name\\="custom" value\\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])) . '"', $code);
             $code = preg_replace('/ name\\="invoice" value\\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_invoice_input_value)) . '"', $code);
             $code = preg_replace('/ name\\="on0" value\\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on0_input_value)) . '"', $code);
             $code = preg_replace('/ name\\="os0" value\\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os0_input_value)) . '"', $code);
             $code = preg_replace('/ name\\="on1" value\\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on1_input_value)) . '"', $code);
             $code = preg_replace('/ name\\="os1" value\\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os1_input_value)) . '"', $code);
             $code = preg_replace('/ name\\="amount" value\\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ra"])) . '"', $code);
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
             $code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
             $code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_sc_paypal_sp_button", get_defined_vars());
             unset($__refs, $__v);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = "https://www.paypal.com/" . ($attr["lang"] ? $attr["lang"] : _x("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
                 $paypal_on0_input_value = ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? "Referencing Customer ID" : "Originating Domain";
                 $paypal_os0_input_value = $referencing ? $referencing : $_SERVER["HTTP_HOST"];
                 $paypal_on1_input_value = "Customer IP Address";
                 $paypal_os1_input_value = $_SERVER["REMOTE_ADDR"];
                 $paypal_invoice_input_value = uniqid() . "~" . $_SERVER["REMOTE_ADDR"];
                 $attr["level_ccaps_eotper"] = $attr["rr"] === "BN" && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $success_return_url = site_url("/?s2member_paypal_return=1");
                 $success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars());
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 $code = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
                 $code = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
                 $code = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(home_url("/"))), $code);
                 $code = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url("/?s2member_paypal_notify=1"))), $code);
                 $code = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($success_return_url)), $code);
                 $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])), $code);
                 $code = preg_replace('/ name\\="lc" value\\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["lc"])) . '"', $code);
                 $code = preg_replace('/ name\\="no_shipping" value\\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ns"])) . '"', $code);
                 $code = preg_replace('/ name\\="item_name" value\\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["desc"])) . '"', $code);
                 $code = preg_replace('/ name\\="item_number" value\\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["level_ccaps_eotper"])) . '"', $code);
                 $code = preg_replace('/ name\\="page_style" value\\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ps"])) . '"', $code);
                 $code = preg_replace('/ name\\="currency_code" value\\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cc"])) . '"', $code);
                 $code = preg_replace('/ name\\="custom" value\\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])) . '"', $code);
                 $code = preg_replace('/ name\\="invoice" value\\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_invoice_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="on0" value\\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on0_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="os0" value\\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os0_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="on1" value\\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on1_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="os1" value\\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os1_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="amount" value\\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ra"])) . '"', $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
                 $code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_sc_paypal_ccaps_button", get_defined_vars());
                 unset($__refs, $__v);
             } else {
                 $default_image = "https://www.paypal.com/" . ($attr["lang"] ? $attr["lang"] : _x("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
                 $paypal_on0_input_value = ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? "Referencing Customer ID" : "Originating Domain";
                 $paypal_os0_input_value = $referencing ? $referencing : $_SERVER["HTTP_HOST"];
                 $paypal_on1_input_value = "Customer IP Address";
                 $paypal_os1_input_value = $_SERVER["REMOTE_ADDR"];
                 $paypal_invoice_input_value = uniqid() . "~" . $_SERVER["REMOTE_ADDR"];
                 $attr["desc"] = !$attr["desc"] ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
                 $attr["level_ccaps_eotper"] = $attr["rr"] === "BN" && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $success_return_tra = array("ta" => $attr["ta"], "tp" => $attr["tp"], "tt" => $attr["tt"], "ra" => $attr["ra"], "rp" => $attr["rp"], "rt" => $attr["rt"], "rr" => $attr["rr"], "rrt" => $attr["rrt"], "rra" => $attr["rra"], "invoice" => $paypal_invoice_input_value, "checksum" => md5($paypal_invoice_input_value . $_SERVER["REMOTE_ADDR"] . $attr["level_ccaps_eotper"]));
                 $success_return_url = site_url("/?s2member_paypal_return=1");
                 $success_return_url = add_query_arg("s2member_paypal_return_tra", urlencode(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($success_return_tra))), $success_return_url);
                 $success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars());
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 $code = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
                 $code = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
                 $code = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"])), $code);
                 $code = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(home_url("/"))), $code);
                 // This brings them back to Front Page.
                 $code = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url("/?s2member_paypal_notify=1"))), $code);
                 $code = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($success_return_url)), $code);
                 $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])), $code);
                 $code = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["level"])), $code);
                 $code = preg_replace('/ \\<\\!--(\\<input type\\="hidden" name\\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\\="(.*?)" \\/\\>)--\\>/', " \$1", $code);
                 $code = $attr["rr"] === "BN" ? preg_replace('/ (\\<input type\\="hidden" name\\="cmd" value\\=")(.*?)(" \\/\\>)/', " \$1_xclick\$3", $code) : $code;
                 $code = $attr["rr"] === "BN" ? preg_replace('/ (\\<input type\\="hidden" name\\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\\="(.*?)" \\/\\>)/', " <!--\$1-->", $code) : $code;
                 $code = $attr["rr"] === "BN" || !$attr["tp"] ? preg_replace('/ (\\<input type\\="hidden" name\\="(a1|p1|t1)" value\\="(.*?)" \\/\\>)/', " <!--\$1-->", $code) : $code;
                 $code = $attr["rr"] !== "BN" ? preg_replace('/ (\\<input type\\="hidden" name\\="cmd" value\\=")(.*?)(" \\/\\>)/', " \$1_xclick-subscriptions\$3", $code) : $code;
                 $code = $attr["rr"] !== "BN" ? preg_replace('/ (\\<input type\\="hidden" name\\="amount" value\\="(.*?)" \\/\\>)/', " <!--\$1-->", $code) : $code;
                 $code = preg_replace('/ name\\="lc" value\\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["lc"])) . '"', $code);
                 $code = preg_replace('/ name\\="no_shipping" value\\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ns"])) . '"', $code);
                 $code = preg_replace('/ name\\="item_name" value\\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["desc"])) . '"', $code);
                 $code = preg_replace('/ name\\="item_number" value\\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["level_ccaps_eotper"])) . '"', $code);
                 $code = preg_replace('/ name\\="page_style" value\\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ps"])) . '"', $code);
                 $code = preg_replace('/ name\\="currency_code" value\\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cc"])) . '"', $code);
                 $code = preg_replace('/ name\\="custom" value\\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["custom"])) . '"', $code);
                 $code = preg_replace('/ name\\="invoice" value\\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_invoice_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="on0" value\\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on0_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="os0" value\\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os0_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="on1" value\\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_on1_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="os1" value\\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($paypal_os1_input_value)) . '"', $code);
                 $code = preg_replace('/ name\\="modify" value\\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["modify"])) . '"', $code);
                 $code = preg_replace('/ name\\="amount" value\\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ra"])) . '"', $code);
                 $code = preg_replace('/ name\\="src" value\\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["rr"])) . '"', $code);
                 $code = preg_replace('/ name\\="srt" value\\="(.*?)"/', ' name="srt" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["rrt"])) . '"', $code);
                 $code = preg_replace('/ name\\="sra" value\\="(.*?)"/', ' name="sra" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["rra"])) . '"', $code);
                 $code = preg_replace('/ name\\="a1" value\\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ta"])) . '"', $code);
                 $code = preg_replace('/ name\\="p1" value\\="(.*?)"/', ' name="p1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["tp"])) . '"', $code);
                 $code = preg_replace('/ name\\="t1" value\\="(.*?)"/', ' name="t1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["tt"])) . '"', $code);
                 $code = preg_replace('/ name\\="a3" value\\="(.*?)"/', ' name="a3" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["ra"])) . '"', $code);
                 $code = preg_replace('/ name\\="p3" value\\="(.*?)"/', ' name="p3" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["rp"])) . '"', $code);
                 $code = preg_replace('/ name\\="t3" value\\="(.*?)"/', ' name="t3" value="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["rt"])) . '"', $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
                 $code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 $attr["modify"] ? do_action("ws_plugin__s2member_during_sc_paypal_modification_button", get_defined_vars()) : do_action("ws_plugin__s2member_during_sc_paypal_button", get_defined_vars());
                 unset($__refs, $__v);
             }
         }
     }
     $code = c_ws_plugin__s2member_sc_paypal_button_e::sc_paypal_button_encryption($code, get_defined_vars());
     return apply_filters("ws_plugin__s2member_sc_paypal_button", $code, get_defined_vars());
 }
 /**
  * Generates s2Member Security Badge.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $v A variation number to display. Defaults to `1`.
  * @param bool $no_cache Defaults to false. If true, the HTML markup will contain query string params that prevent caching.
  * @param bool $display_on_failure. Defaults to false. True if we need to display the "NOT yet verified" version inside admin panels.
  * @return str HTML markup for display of s2Member Security Badge.
  */
 public static function s_badge_gen($v = "1", $no_cache = FALSE, $display_on_failure = FALSE)
 {
     if ($v && file_exists($template = dirname(dirname(__FILE__)) . "/templates/badges/s-badge.php")) {
         $badge = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($template)));
         $badge = preg_replace("/%%site_url%%/i", urlencode(site_url()), preg_replace("/%%v%%/i", (string) $v, $badge));
         $badge = preg_replace("/%%no_cache%%/i", $no_cache ? "&amp;no_cache=" . urlencode(mt_rand(0, PHP_INT_MAX)) : "", $badge);
         $badge = preg_replace("/%%display_on_failure%%/i", $display_on_failure ? "&amp;display_on_failure=1" : "", $badge);
     }
     /**/
     return !empty($badge) ? $badge : "";
     /* Return Security Badge. */
 }
 /**
  * Shortcode `[s2Member-Pro-Google-Button /]`.
  *
  * @package s2Member\Google
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("s2Member-Pro-Google-Button");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string The resulting Google Button Code; HTML markup.
  */
 public static function sc_google_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $jwt_attr = c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr));
     $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", "rrt" => "", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "anchor", "success" => "", "failure" => ""), $attr);
     if ($attr["modify"] || $attr["cancel"]) {
         $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-edit-button.png";
         $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
         $code = $attr["output"] === "anchor" ? $code : $code;
         if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
             $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
         }
         unset($href, $url, $m);
     } else {
         if ($attr["sp"]) {
             $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
             $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
             $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
             $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
                 $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
             } else {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
                 $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
             }
         }
     }
     return $code;
 }
Пример #13
0
 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = FALSE, $user_pass = FALSE, $notify = array("user", "admin"), $user_email = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_new_user_notification", get_defined_vars());
     unset($__refs, $__v);
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify)) {
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array("user", $notify) && $user_pass) {
             $fields = get_user_option("s2member_custom_fields", $user_id);
             $cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . " " . $user->last_name);
             $user_ip = $_SERVER["REMOTE_ADDR"];
             if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_subject"]) {
                 if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                         if ($sbj = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                             if ($sbj = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                 if ($sbj = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                     if ($sbj = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                         if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                             if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                 if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                     if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                         if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                             if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                 if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                     if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                         if (is_array($fields) && !empty($fields)) {
                                                                             foreach ($fields as $var => $val) {
                                                                                 if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                     break;
                                                                                 }
                                                                             }
                                                                         }
                                                                         if ($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_message"]) {
                                                                             if ($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) {
                                                                                 if ($msg = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                     if ($msg = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                         if ($msg = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                             if ($msg = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                 if ($msg = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                     if ($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                         if ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                             if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                 if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                     if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                         if ($msg = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                             if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                 if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                             if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                                                                 break;
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                     if (($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                         }
                                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($user->user_email, apply_filters("ws_plugin__s2member_welcome_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_welcome_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (in_array("admin", $notify)) {
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
                 $fields = get_user_option("s2member_custom_fields", $user_id);
                 $cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
                 $role = c_ws_plugin__s2member_user_access::user_access_role($user);
                 $label = c_ws_plugin__s2member_user_access::user_access_label($user);
                 $level = c_ws_plugin__s2member_user_access::user_access_level($user);
                 $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
                 $user->user_email = $user_email ? $user_email : $user->user_email;
                 $user_full_name = trim($user->first_name . " " . $user->last_name);
                 $user_ip = $_SERVER["REMOTE_ADDR"];
                 if ($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
                     if ($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)) {
                         if ($rec = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $rec)) {
                             if ($rec = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $rec)) {
                                 if ($rec = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $rec)) {
                                     if ($rec = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $rec)) {
                                         if ($rec = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $rec)) {
                                             if ($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name)), $rec)) {
                                                 if ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name)), $rec)) {
                                                     if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name)), $rec)) {
                                                         if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
                                                             if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
                                                                 if ($rec = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $rec)) {
                                                                     if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $rec)) {
                                                                         if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                 foreach ($fields as $var => $val) {
                                                                                     if (!($rec = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec))) {
                                                                                         break;
                                                                                     }
                                                                                 }
                                                                             }
                                                                             if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]) {
                                                                                 if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) {
                                                                                     if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                                                                                         if ($sbj = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                                                                                             if ($sbj = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                                                                                 if ($sbj = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                                                                                     if ($sbj = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                                                                                         if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                                                                                             if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                                                                                 if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                                                                                     if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                                                                                         if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                                                                             if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                                                                                 if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                                                                                     if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                                                                                         if (is_array($fields) && !empty($fields)) {
                                                                                                                                             foreach ($fields as $var => $val) {
                                                                                                                                                 if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                                                                                     break;
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                         if ($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_message"]) {
                                                                                                                                             if ($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) {
                                                                                                                                                 if ($msg = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                                                                                     if ($msg = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                                                                                         if ($msg = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                                                                                             if ($msg = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                                                                                 if ($msg = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                                                                                     if ($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                                                                                         if ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                                                                                             if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                                                                                 if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                                                                                     if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                                                                         if ($msg = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                                                                                             if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                                                                                 if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                                                                                             if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                                                                                                                                 break;
                                                                                                                                                                                                             }
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                     if (($rec = trim(preg_replace("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                                                                                             $rec = c_ws_plugin__s2member_utilities::evl($rec, get_defined_vars());
                                                                                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                                                                                         }
                                                                                                                                                                                                         foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
                                                                                                                                                                                                             wp_mail($recipient, apply_filters("ws_plugin__s2member_admin_new_user_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_admin_new_user_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($email_configs_were_on) {
             c_ws_plugin__s2member_email_configs::email_config();
         }
         return apply_filters("ws_plugin__s2member_new_user_notification", true, get_defined_vars());
     } else {
         return apply_filters("ws_plugin__s2member_new_user_notification", false, get_defined_vars());
     }
 }
Пример #14
0
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page">' . "\n";
     echo '<div class="ws-menu-page-toolbox">' . "\n";
     c_ws_plugin__s2member_menu_pages_tb::display();
     echo '</div>' . "\n";
     echo '<h2>Google Wallet Buttons</h2>' . "\n";
     echo '<table class="ws-menu-page-table">' . "\n";
     echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
     echo '<tr class="ws-menu-page-table-tr">' . "\n";
     echo '<td class="ws-menu-page-table-l">' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         echo '<div class="ws-menu-page-group" title="Buttons For Level #' . $n . ' Access">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-level' . $n . '-buttons-section">' . "\n";
         echo '<h3>Button Code Generator For Level #' . $n . ' Access</h3>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These Google Wallet Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their Membership, or fails to make payments on time, s2Member will automatically terminate their Membership privileges. s2Member makes extensive use of the Google Postback/IPN service. s2Member receives updates from Google behind-the-scene. <em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-pro-level' . $n . '-shortcode">' . "\n";
         echo 'Button Code<br />For Level #' . $n . ':<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-pro-level' . $n . '-button-prev"></div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p id="ws-plugin--s2member-pro-level' . $n . '-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-pro-level' . $n . '-trial-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-trial-amount" value="0.00" size="4" /></p>' . "\n";
         echo '<p><span id="ws-plugin--s2member-pro-level' . $n . '-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-level' . $n . '-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-membership-regular-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-desc" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]) . ' / description and pricing details here." size="73" /></p>' . "\n";
         echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-ccaps" size="40" /></p>' . "\n";
         echo '<p>Currency: <select id="ws-plugin--s2member-pro-level' . $n . '-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_googleButtonGenerate(\'level' . $n . '\');" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/google-checkout-button-shortcode.php")));
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($n)), $ws_plugin__s2member_pro_temp_s);
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_pro_temp_s);
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     echo '<div class="ws-menu-page-group" title="Modification/Cancellation Buttons">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-cancellation-buttons-section">' . "\n";
     echo '<h3>One Button Does It All For Modifications/Cancellations (copy/paste)</h3>' . "\n";
     echo '<p>Every Google Recurring Subscription can be modified by the Customer, or even cancelled by the Customer through Google Wallet. It\'s very simple. A Member clicks a Modification/Cancellation Button. This brings the Customer to a "Purchase History" screen inside their Google Wallet account. Here they\'ll have easy access to make any changes they like. When important changes occur (such as a cancellation), information regarding this event will be relayed back to s2Member through Google\'s Postback/IPN service. s2Member will react appropriately at that time.</p>' . "\n";
     echo '<p><em><strong>Understanding Cancellations:</strong> It\'s important to realize that a Cancellation is not an EOT (End Of Term). All that happens during a Cancellation event, is that billing is stopped, and it\'s understood that the Customer is going to lose access, at some point in the future. This does NOT mean, that access will be revoked immediately. A separate EOT event will automatically handle a (demotion or deletion) later, at the appropriate time; which could be several days, or even a year after the Cancellation took place.</em></p>' . "\n";
     echo '<p><em><strong>Some Hairy Details:</strong> There might be times whenever you notice that a Member\'s Subscription has been cancelled through Google Wallet... but, s2Member continues allowing the User access to your site as a paid Member. Please don\'t be confused by this... in 99.9% of these cases, the reason for this is legitimate. s2Member will only remove the User\'s Membership privileges when an EOT (End Of Term) is processed, a refund occurs, a chargeback occurs, or when a cancellation occurs - which would later result in a delayed Auto-EOT by s2Member.</em></p>' . "\n";
     echo '<p><em>s2Member will not process an EOT (End Of Term) until the User has completely used up the time they paid for. In other words, if a User signs up for a monthly Subscription on Jan 1st, and then cancels their Subscription on Jan 15th; technically, they should still be allowed to access the site for another 15 days, and then on Feb 1st, the time they paid for has completely elapsed. At that time, s2Member will remove their Membership privileges; by either demoting them to a Free Subscriber, or deleting their account from the system (based on your configuration). s2Member also calculates one extra day (24 hours) into its equation, just to make sure access is not removed sooner than a Customer might expect.</em></p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<th class="ws-menu-page-th-side">' . "\n";
     echo '<label for="ws-plugin--s2member-pro-cancellation-shortcode">' . "\n";
     echo 'Button Code<br />For Cancellations:<br /><br />' . "\n";
     echo '<div id="ws-plugin--s2member-pro-cancellation-button-prev">' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/google-cancellation-button.php")));
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/&amp;/", "&", $ws_plugin__s2member_pro_temp_s);
     // Match this with the JavaScript generator.
     echo preg_replace("/\\<a/", '<a target="_blank"', $ws_plugin__s2member_pro_temp_s);
     echo '</div>' . "\n";
     echo '</label>' . "\n";
     echo '</th>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p>No configuration necessary.</p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     echo '<td colspan="2">' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/google-cancellation-button-shortcode.php")));
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-cancellation-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
         echo '<div class="ws-menu-page-group" title="Capability (Buy Now) Buttons">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccap-buttons-section">' . "\n";
         echo '<h3>Button Code Generator For Independent Custom Capabilities</h3>' . "\n";
         echo '<p>This is VERY advanced. For further details, please check your Dashboard: <strong>s2Member → API Scripting → Custom Capabiities</strong>.</p>' . "\n";
         echo '<p>With s2Member, you can sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>(i.e., you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like)</em>. So this is quite flexible. Independent Custom Capabilities do NOT rely on any specific Membership Level. That\'s why s2Member refers to these as `Independent` Custom Capabilities, because you can sell Capabilities this way, through Buy Now functionality, and the Customer\'s Membership Level Access, along with any existing paid Subscription they may already have with you, will remain completely unaffected. That being said, if you intend to charge a recurring fee for Custom Capabilities, please use a <code>Membership Level# Button</code> instead; because Independent Custom Capabilities can only be sold through Buy Now functionality.</p>' . "\n";
         echo '<p>Independent Custom Capabilities are added to a Customer\'s account immediately after checkout, and the Customer will have the Custom Capabilities for as long as their Membership lasts, based on their primary Subscription with your site, and/or forever, if they have a Lifetime account with you. In other words, Independent Custom Capabilities will exist on the Customer\'s account forever, or until an EOT <em>(End Of Term)</em> occurs on their primary Subscription with you; in which case s2Member would demote or delete the Customer\'s account <em>(based on your EOT configuration)</em>, and all Custom Capabilities are removed as well.</p>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each set of Custom Capabilities that you plan to sell. Then press (Generate Button Code). These Google Wallet Buttons are customized to work with s2Member seamlessly. The Customer will be granted additional access to one or more Custom Capabilities that you specify; while the Customer\'s Membership Level Access and any existing paid Subscription they may already have with you, will remain completely unaffected.</p>' . "\n";
         echo '<p><em><strong>Important Note:</strong> Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button. Otherwise, post-processing of their transaction will fail to recognize the Customer\'s existing account within WordPress. Please display this Button only to Users/Members that are already logged into their account (perhaps in your Login Welcome Page for s2Member), or in another location where you can be absolutely sure that a User/Member is logged in. s2Member\'s Simple Conditionals could also be used to ensure a User/Member is logged in, by wrapping your Shortcode within a Conditional test. For further details, please see: <strong>s2Member → API Scripting → Simple Conditionals</strong>.</em></p>' . "\n";
         echo '<p><em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-pro-ccap-shortcode">' . "\n";
         echo 'Button Code<br />For Capabilities:<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-pro-ccap-button-prev"></div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-ccap-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-membership-ccap-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-desc" value="Description and pricing details here." size="73" /></p>' . "\n";
         echo '<p>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-ccap-ccaps" size="40" /></p>' . "\n";
         echo '<p>Currency: <select id="ws-plugin--s2member-pro-ccap-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_googleCcapButtonGenerate();" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/google-ccaps-checkout-button-shortcode.php")));
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     echo '<div class="ws-menu-page-group" title="Google Member Registration Access Links">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-reg-links-section">' . "\n";
     echo '<h3>Registration Access Link Generator (for Customer Service)</h3>' . "\n";
     echo '<p>s2Member automatically generates Registration Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Registration Access Link to be created manually, you can use this tool for that. Alternatively, you can create their account yourself/manually by going to <strong>Users → Add New</strong>. Either of these methods will work fine.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p>Paid Membership Level#: <select id="ws-plugin--s2member-pro-reg-link-level">' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         echo '<option value="' . $n . '">s2Member Level #' . $n . '</option>' . "\n";
     }
     echo '</select></p>' . "\n";
     echo '<p>Paid Subscr. ID: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-subscr-id" value="" size="50" /> <a href="#" onclick="alert(\'The Customer\\\'s Paid Subscr. ID (aka: a Google Wallet Order ID. This value can be obtained from inside your Google Wallet account. Each paying Customer MUST be associated with a unique Paid Subscr. ID. If the Customer is NOT associated with a Paid Subscr. ID, you will need to generate a unique value for this field on your own. But keep in mind, s2Member will be unable to maintain future communication with the Google IPN (i.e., Notification/Postback) service if this value does not reflect a real Paid Subscr. ID that exists in your Google Wallet transaction log.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p>Custom String Value: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-custom" value="' . esc_attr($_SERVER["HTTP_HOST"]) . '" size="30" /> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_googleRegLinkGenerate();" /> <img id="ws-plugin--s2member-pro-reg-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-ccaps" size="40" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" /></p>' . "\n";
     echo '<p>Fixed Term Length (for Buy Now transactions): <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-fixed-term" value="" size="10" /> <a href="#" onclick="alert(\'If the Customer purchased Membership through a Buy Now transaction (i.e., there is no Initial/Trial Period and no recurring charges for ongoing access), you may configure a Fixed Term Length in this field. This way the Customer\\\'s Membership Access is revoked by s2Member at the appropriate time. This will be a numeric value, followed by a space, then a single letter.\\n\\nHere are some examples:\\n\\n1 D (this means 1 Day)\\n1 W (this means 1 Week)\\n1 M (this means 1 Month)\\n1 Y (this means 1 Year)\\n1 L (this means 1 Lifetime)\'); return false;">[?]</a></p>' . "\n";
     echo '<p id="ws-plugin--s2member-pro-reg-link" class="monospace" style="display:none;"></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Specific Post/Page (Buy Now) Buttons">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-buttons-section">' . "\n";
     echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
     echo '<p>s2Member now supports an additional layer of functionality (very powerful), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" Buttons, and your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
     echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member can simply send an email to the Customer with a link (see: <strong>s2Member → Google Options → Specific Post/Page Email</strong>). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
     echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <strong>s2Member → Restriction Options → Specific Post/Page Access</strong>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
     echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Button Code). These Google Wallet Buttons are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction. <em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress Editor, wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<th class="ws-menu-page-th-side">' . "\n";
     echo '<label for="ws-plugin--s2member-pro-sp-shortcode">' . "\n";
     echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
     echo '<div id="ws-plugin--s2member-pro-sp-button-prev"></div>' . "\n";
     echo '</label>' . "\n";
     echo '</th>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
     echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-sp-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-sp-hours.php"))) . '</select></p>' . "\n";
     echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
     echo '<p>Currency: <select id="ws-plugin--s2member-pro-sp-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_googleSpButtonGenerate();" /></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     echo '<td colspan="2">' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/google-sp-checkout-button-shortcode.php")));
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Specific Post/Page Access Links">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-links-section">' . "\n";
     echo '<h3>Specific Post/Page Access Link Generator (for Customer Service)</h3>' . "\n";
     echo '<p>s2Member automatically generates a Specific Post/Page Access Link for your Customer after checkout; and it sends this link in a Confirmation Email to the customer. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Access Link to be created manually, you can use this tool for that.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-additional-ids" multiple="multiple" style="height:100px; min-width:450px;">' . "\n";
     echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/google-sp-hours.php"))) . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_googleSpLinkGenerate();" /> <img id="ws-plugin--s2member-pro-sp-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p id="ws-plugin--s2member-pro-sp-link" class="monospace" style="display:none;"></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Shortcode Attributes (Explained)">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-shortcode-attrs-section">' . "\n";
     echo '<h3>Shortcode Attributes (Explained In Full Detail)</h3>' . "\n";
     echo '<p>When you generate a Button Code, s2Member will make a <a href="http://s2member.com/r/shortcode-reference/" target="_blank" rel="external">Shortcode</a> available to you. Like most Shortcodes for WordPress, s2Member reads Attributes in your Shortcode. These Attributes will be pre-configured by one of s2Member\'s Button Generators automatically; so there really is nothing more you need to do. However, many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.</p>' . "\n";
     echo '<table class="form-table" style="margin-top:0;">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr style="padding-top:0;">' . "\n";
     echo '<td style="padding-top:0;">' . "\n";
     echo '<ul class="ws-menu-page-li-margins">' . "\n";
     echo '<li><code>cancel="0"</code> Cancellation Button. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Cancellation Button, <code>1</code> = this IS a Cancellation Button.</li>' . "\n";
     echo '<li><code>cc="USD"</code> 3 character Currency Code. Not valid when <code>modify|cancel="1"</code>. Google currently supports: <code>USD</code>, <code>EUR</code>, <code>CAD</code>, <code>GBP</code>, <code>AUD</code>, <code>HKD</code>, <code>JPY</code>, <code>DKK</code>, <code>NOK</code>, <code>SEK</code>. Note: Google automatically converts the billing currency you specify, to the currency that\'s been defined by your Google Wallet merchant account.</li>' . "\n";
     echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<li><code>ccaps="music,videos"</code> A comma-delimited list of Custom Capabilities. Only valid w/ Membership Level Access and/or Independent Custom Capabilities.</li>' . "\n" : '';
     echo '<li><code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '"</code> must start with your domain. Additional values can be piped in (ex: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3|etc"</code>). Not valid when <code>modify|cancel="1"</code>.</li>' . "\n";
     echo '<li><code>desc="Gold Membership"</code> A brief purchase Description. Not valid when <code>modify|cancel="1"</code>.</li>' . "\n";
     echo '<li><code>exp="72"</code> Access Expires (in hours). Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
     echo '<li><code>ids="14"</code> A Post/Page ID#, or a comma-delimited list of IDs. Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
     echo '<li><code>image="default"</code> Button Image Location. Possible values: <code>default</code> = use the default Google Wallet Button, <code>http://...</code> = location of your custom Image.</li>' . "\n";
     echo '<li><code>level="1"</code> Membership Level [1-4] <em>(or, up to the number of configured Levels)</em>. Only valid for Buttons providing paid Membership Level Access.' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' Or, with Independent Custom Capabilities this MUST be set to <code>level="*"</code>, and <code>ccaps=""</code> must NOT be empty <em>(i.e., <code>level="*" ccaps="music,videos"</code>)</em>.') . '</li>' . "\n";
     echo '<li><code>modify="0"</code> Modification Button. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Modification Button, <code>1</code> = this IS a Modification Button.</li>' . "\n";
     echo '<li><code>output="anchor"</code> Output Type. Possible values: <code>anchor</code> = Google Wallet Button (&lt;a&gt; anchor tag) URL w/ onclick handler, <code>url</code> = raw URL w/ possible ?query string (valid only for Modification/Cancellation Buttons). Note that <code>output="url"</code> is NOT valid for most Google Wallet Buttons because of their dependency on JavaScript. Using <code>output="url"</code> is valid only for Modification/Cancellation Buttons where a raw URL is possible.</li>' . "\n";
     echo '<li><code>ra="0.01"</code> Regular, Buy Now, and/or Recurring Amount. Must be &gt;= <code>0.01</code>. Not valid when <code>modify|cancel="1"</code>.</li>' . "\n";
     echo '<li><code>rp="1"</code> Regular Period. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Must be &gt;= <code>1</code> (ex: <code>1</code> Week, <code>2</code> Months, <code>1</code> Month, <code>3</code> Days). Please note—Google Wallet supports only the following recurring interval: <code>monthly</code>. Thus, this MUST be set to a value of <code>1</code> with a term of <code>M</code> if you intend for charges to recur. If you don\'t intend for charges to recur, you can set this to whatever you prefer.</li>' . "\n";
     echo '<li><code>rt="M"</code> Regular Term. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years, <code>L</code> = Lifetime. Please note—Google Wallet supports only the following recurring interval: <code>monthly</code>. Thus, this MUST be set to a value of <code>M</code> with a period of <code>1</code> if you intend for charges to recur. If you don\'t intend for charges to recur, you can set this to whatever you prefer.</li>' . "\n";
     echo '<li><code>rr="1"</code> Recurring directive. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>0</code> = non-recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>1</code> = recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>BN</code> = non-recurring "Buy Now" functionality, no Trial Period possible.</li>' . "\n";
     echo '<li><code>rrt=""</code> Recurring Times <em>(i.e., a fixed number of installments)</em>. Only valid w/ Membership Level Access. When unspecified, any recurring charges will remain ongoing until cancelled, or until payments start failing. If this is set to <code>1 or higher</code> the regular recurring charges will only continue for X billing cycles, depending on what you specify. This is only valid when <code>rr="1"</code> for recurring "Subscriptions". Please note that a fixed number of installments, also means a fixed period of access. If a Customer\'s billing is monthly, and you set <code>rrt="3"</code>, billing will continue for only 3 monthly installments. After that, billing would stop, and their access to the site would be revoked as well <em>(based on your EOT Behavior setting under: s2Member → Google Wallet Options)</em>.</li>' . "\n";
     echo '<li><code>sp="0"</code> Specific Post/Page Button. Possible values: <code>0</code> = this is NOT a Specific Post/Page Access Button, <code>1</code> = this IS a Specific Post/Page Access Button.</li>' . "\n";
     echo '<li><code>ta="0.00"</code> Trial Amount. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
     echo '<li><code>tp="0"</code> Trial Period. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
     echo '<li><code>tt="D"</code> Trial Term. Only valid w/ Membership Level Access. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years.</li>' . "\n";
     echo '</ul>' . "\n";
     echo '<hr />' . "\n";
     echo '<ul class="ws-menu-page-li-margins">' . "\n";
     echo '<li><code>success=""</code> Success Return URL <em>(optional)</em>. s2Member handles this automatically for you. However, if you would prefer to take control over the landing page after checkout <em>(i.e., your own custom Thank-You Page)</em>, you can. If supplied, this must be a full URL, starting with <code>http://</code>.</li>' . "\n";
     echo '<li><code>failure=""</code> Failure Return URL <em>(optional)</em>. s2Member handles this automatically for you. However, if you would prefer to take control over the landing page after a checkout failure <em>(i.e., your own custom Failure Page)</em>, you can. If supplied, this must be a full URL, starting with <code>http://</code>. <strong>Note:</strong> most site owners prefer to leave this empty; doing nothing in this scenario is often exactly what\'s expected by a customer.</li>' . "\n";
     echo '</ul>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '</td>' . "\n";
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__s2member_menu_pages_rs::display();
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
 }
Пример #15
0
 /**
  * Generates s2Member Security Badge.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string $v A variation number to display. Defaults to `1`.
  * @param bool   $no_cache Defaults to false. If true, the HTML markup will contain query string params that prevent caching.
  * @param bool   $display_on_failure . Defaults to false. True if we need to display the 'NOT yet verified' version inside admin panels.
  *
  * @return string HTML markup for display of s2Member Security Badge.
  */
 public static function s_badge_gen($v = '1', $no_cache = FALSE, $display_on_failure = FALSE)
 {
     if ($v && file_exists($template = dirname(dirname(__FILE__)) . '/templates/badges/s-badge.php')) {
         switch ((int) $v) {
             case 1:
                 // Variation number 1.
                 $width_height_attrs = 'width="200" height="55"';
                 $width_height_styles = 'width:200px; height:55px;';
                 break;
                 // Break switch loop.
             // Break switch loop.
             case 2:
                 // Variation number 2.
                 $width_height_attrs = 'width="180" height="58"';
                 $width_height_styles = 'width:180px; height:58px;';
                 break;
                 // Break switch loop.
             // Break switch loop.
             case 3:
                 // Variation number 3.
                 $width_height_attrs = 'width="80" height="15"';
                 $width_height_styles = 'width:80px; height:15px;';
                 break;
                 // Break switch loop.
             // Break switch loop.
             default:
                 // Default case handler.
                 $width_height_attrs = $width_height_styles = '';
                 break;
                 // Break switch loop.
         }
         $badge = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($template)));
         $badge = preg_replace('/%%v%%/i', (string) (int) $v, $badge);
         $badge = preg_replace('/%%site_url%%/i', urlencode(home_url()), $badge);
         $badge = preg_replace('/%%no_cache%%/i', $no_cache ? '&amp;no_cache=' . urlencode(mt_rand()) : '', $badge);
         $badge = preg_replace('/%%display_on_failure%%/i', $display_on_failure ? '&amp;display_on_failure=1' : '', $badge);
         $badge = preg_replace(array('/%%width_height_attrs%%/i', '/%%width_height_styles%%/i'), array($width_height_attrs, $width_height_styles), $badge);
     }
     return !empty($badge) ? $badge : '';
     // Return Security Badge.
 }
 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110815
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  *
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars, EXTR_OVERWRITE | EXTR_REFS);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal['txn_type']) && preg_match('/^web_accept$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_wo_level_regex'], $paypal['item_number'])) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status'])) && !empty($paypal['txn_id']) && !empty($paypal['payer_email']) && (!empty($paypal['txn_baid']) || ($paypal['txn_baid'] = $paypal['txn_id'])) && (!empty($paypal['txn_cid']) || ($paypal['txn_cid'] = $paypal['txn_id']))) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_before_new_ccaps', get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.';
             list($paypal['level'], $paypal['ccaps'], $paypal['eotper']) = preg_split('/\\:/', $paypal['item_number'], 3);
             $paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
             $paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
             $paypal['currency'] = strtoupper($paypal['mc_currency']);
             // Normalize input currency.
             $paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
             if (!empty($coupon['coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
                 $coupon_class = new c_ws_plugin__s2member_pro_coupons();
                 $coupon_class->update_uses($coupon['coupon_code']);
             }
             if (preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1']) {
                 if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['txn_id'], $paypal['option_selection1'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     if (!$user->has_cap('administrator')) {
                         $processing = $during = TRUE;
                         // Yes, we ARE processing this.
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action('ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps', get_defined_vars());
                         unset($__refs, $__v);
                         $fields = get_user_option('s2member_custom_fields', $user_id);
                         // These will be needed in the routines below.
                         $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                         // Original IP during Registration.
                         $user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
                         // Now merge conditionally.
                         if (is_multisite() && !is_user_member_of_blog($user_id)) {
                             add_existing_user_to_blog(array('user_id' => $user_id, 'role' => get_option('default_role')));
                             $user = new WP_User($user_id);
                         }
                         if ($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps']))) {
                             foreach ($user->allcaps as $cap => $cap_enabled) {
                                 if (preg_match('/^access_s2member_ccap_/', $cap)) {
                                     $user->remove_cap($ccap = $cap);
                                 }
                             }
                         }
                         if ($paypal['ccaps'] && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) {
                             foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap) {
                                 if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                                     $user->add_cap('access_s2member_ccap_' . $ccap);
                                 }
                             }
                         }
                         if (!get_user_option('s2member_registration_ip', $user_id)) {
                             update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
                         }
                         if (!empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
                             $user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
                             $user_coupons = array_unique(array_merge($user_coupons, (array) $coupon['full_coupon_code']));
                             update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
                         }
                         $paypal['s2member_log'][] = 's2Member Custom Capabilities updated w/ advanced update routines.';
                         $sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_subject'];
                         // The same for standard and w/ Pro-Forms.
                         $msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_message'];
                         // The same for standard and w/ Pro-Forms.
                         $rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_recipients'];
                         // The same for standard and w/ Pro-Forms.
                         if (($rec = c_ws_plugin__s2member_utils_strings::fill_cvs($rec, $paypal['custom'])) && ($rec = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $rec))) {
                             if (($rec = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $rec)) && ($rec = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $rec))) {
                                 if (($rec = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $rec)) && ($rec = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $rec))) {
                                     if (($rec = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $rec)) && ($rec = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $rec))) {
                                         if (($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec))) {
                                             if (($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec))) {
                                                 if ($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $rec)) {
                                                     // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
                                                     if ($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)) {
                                                         if (($rec = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $rec))) {
                                                             if (($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec))) {
                                                                 if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $rec)) {
                                                                     if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
                                                                         if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
                                                                             if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)) {
                                                                                 if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
                                                                                     if (($sbj = c_ws_plugin__s2member_utils_strings::fill_cvs($sbj, $paypal['custom'])) && ($sbj = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $sbj))) {
                                                                                         if (($sbj = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $sbj)) && ($sbj = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $sbj))) {
                                                                                             if (($sbj = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $sbj)) && ($sbj = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $sbj))) {
                                                                                                 if (($sbj = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $sbj)) && ($sbj = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $sbj))) {
                                                                                                     if (($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj))) {
                                                                                                         if (($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj))) {
                                                                                                             if ($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $sbj)) {
                                                                                                                 if ($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)) {
                                                                                                                     if (($sbj = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $sbj))) {
                                                                                                                         if (($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) && ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj))) {
                                                                                                                             if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $sbj)) {
                                                                                                                                 if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                                                                                                     if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                                                                                         if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $sbj)) {
                                                                                                                                             if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                                                                                                 if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $msg))) {
                                                                                                                                                     if (($msg = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $msg)) && ($msg = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $msg))) {
                                                                                                                                                         if (($msg = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $msg)) && ($msg = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $msg))) {
                                                                                                                                                             if (($msg = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $msg)) && ($msg = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $msg))) {
                                                                                                                                                                 if (($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg))) {
                                                                                                                                                                     if (($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg))) {
                                                                                                                                                                         if ($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $msg)) {
                                                                                                                                                                             if ($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)) {
                                                                                                                                                                                 if (($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg))) {
                                                                                                                                                                                     if (($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg))) {
                                                                                                                                                                                         if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $msg)) {
                                                                                                                                                                                             if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                                                                                                 if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                                                                                     if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)) {
                                                                                                                                                                                                         if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                                                                                                                                                 foreach ($fields as $var => $val) {
                                                                                                                                                                                                                     $rec = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec);
                                                                                                                                                                                                                     $sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj);
                                                                                                                                                                                                                     $msg = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg);
                                                                                                                                                                                                                 }
                                                                                                                                                                                                             }
                                                                                                                                                                                                             if (($rec = trim(preg_replace('/%%(.+?)%%/i', '', $rec))) && ($sbj = trim(preg_replace('/%%(.+?)%%/i', '', $sbj))) && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) {
                                                                                                                                                                                                                 if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                                                                                                     $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                                                                                                     $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                                                                                                 }
                                                                                                                                                                                                                 foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
                                                                                                                                                                                                                     c_ws_plugin__s2member_email_configs::email_config() . wp_mail($recipient, apply_filters('ws_plugin__s2member_capabilities_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_capabilities_email_msg', $msg, get_defined_vars()), 'From: "' . preg_replace('/"/', '"', $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '" <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>' . "\r\n" . 'Content-Type: text/plain; charset=UTF-8') . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                                                                                                 }
                                                                                                                                                                                                                 $paypal['s2member_log'][] = 'Capability Confirmation Email sent to: ' . $rec . '.';
                                                                                                                                                                                                             }
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($processing && $_REQUEST['s2member_paypal_proxy'] && ($url = $_REQUEST['s2member_paypal_proxy_return_url'])) {
                             if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url))) {
                                 if (($url = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_baid'])), $url)) && ($url = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_cid'])), $url))) {
                                     if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
                                         if (($url = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_gross'])), $url)) && ($url = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url))) {
                                             if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
                                                 if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
                                                     if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
                                                         if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
                                                             if (($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url))) {
                                                                 if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
                                                                     if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
                                                                         if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
                                                                             if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
                                                                                 if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
                                                                                     if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
                                                                                         if (is_array($fields) && !empty($fields)) {
                                                                                             foreach ($fields as $var => $val) {
                                                                                                 if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
                                                                                                     break;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         if ($url = trim($url)) {
                                                                                             // Preserve remaining replacements.
                                                                                             // Because the parent routine may perform replacements too.
                                                                                             $paypal['s2member_paypal_proxy_return_url'] = $url;
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal['s2member_log'][] = 'Capability Return, a Proxy Return URL is ready.';
                         }
                         if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) {
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) as $url) {
                                 if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url))) {
                                     if (($url = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_baid'])), $url)) && ($url = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_cid'])), $url))) {
                                         if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
                                             if (($url = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_gross'])), $url)) && ($url = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url))) {
                                                 if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
                                                     if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
                                                         if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
                                                             if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
                                                                 if (($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url))) {
                                                                     if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
                                                                         if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
                                                                             if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
                                                                                 if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
                                                                                     if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
                                                                                         if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
                                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                                 foreach ($fields as $var => $val) {
                                                                                                     if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
                                                                                                         break;
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                             if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
                                                                                                 c_ws_plugin__s2member_utils_urls::remote($url);
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal['s2member_log'][] = 'Payment Notification URLs have been processed.';
                         }
                         if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_recipients']) {
                             $msg = $sbj = '(s2Member / API Notification Email) - Payment';
                             $msg .= "\n\n";
                             // Spacing in the message body.
                             $msg .= 'currency: %%currency%%' . "\n";
                             $msg .= 'currency_symbol: %%currency_symbol%%' . "\n";
                             $msg .= 'amount: %%amount%%' . "\n";
                             $msg .= 'txn_id: %%txn_id%%' . "\n";
                             $msg .= 'txn_baid: %%txn_baid%%' . "\n";
                             $msg .= 'txn_cid: %%txn_cid%%' . "\n";
                             $msg .= 'item_number: %%item_number%%' . "\n";
                             $msg .= 'item_name: %%item_name%%' . "\n";
                             $msg .= 'first_name: %%first_name%%' . "\n";
                             $msg .= 'last_name: %%last_name%%' . "\n";
                             $msg .= 'full_name: %%full_name%%' . "\n";
                             $msg .= 'payer_email: %%payer_email%%' . "\n";
                             $msg .= 'full_coupon_code: %%full_coupon_code%%' . "\n";
                             $msg .= 'coupon_code: %%coupon_code%%' . "\n";
                             $msg .= 'coupon_affiliate_id: %%coupon_affiliate_id%%' . "\n";
                             $msg .= 'user_first_name: %%user_first_name%%' . "\n";
                             $msg .= 'user_last_name: %%user_last_name%%' . "\n";
                             $msg .= 'user_full_name: %%user_full_name%%' . "\n";
                             $msg .= 'user_email: %%user_email%%' . "\n";
                             $msg .= 'user_login: %%user_login%%' . "\n";
                             $msg .= 'user_ip: %%user_ip%%' . "\n";
                             $msg .= 'user_id: %%user_id%%' . "\n";
                             if (is_array($fields) && !empty($fields)) {
                                 foreach ($fields as $var => $val) {
                                     $msg .= $var . ': %%' . $var . '%%' . "\n";
                                 }
                             }
                             $msg .= 'cv0: %%cv0%%' . "\n";
                             $msg .= 'cv1: %%cv1%%' . "\n";
                             $msg .= 'cv2: %%cv2%%' . "\n";
                             $msg .= 'cv3: %%cv3%%' . "\n";
                             $msg .= 'cv4: %%cv4%%' . "\n";
                             $msg .= 'cv5: %%cv5%%' . "\n";
                             $msg .= 'cv6: %%cv6%%' . "\n";
                             $msg .= 'cv7: %%cv7%%' . "\n";
                             $msg .= 'cv8: %%cv8%%' . "\n";
                             $msg .= 'cv9: %%cv9%%';
                             if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $msg))) {
                                 if (($msg = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $msg)) && ($msg = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $msg))) {
                                     if (($msg = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $msg)) && ($msg = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $msg))) {
                                         if (($msg = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $msg)) && ($msg = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $msg))) {
                                             if (($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg))) {
                                                 if (($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg))) {
                                                     if ($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $msg)) {
                                                         if ($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)) {
                                                             if (($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg))) {
                                                                 if (($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg))) {
                                                                     if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $msg)) {
                                                                         if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                             if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                 if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)) {
                                                                                     if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                         if (is_array($fields) && !empty($fields)) {
                                                                                             foreach ($fields as $var => $val) {
                                                                                                 if (!($msg = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                     break;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         if ($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) {
                                                                                             // Still have a ``$sbj`` and a ``$msg``?
                                                                                             foreach (c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_recipients']) as $recipient) {
                                                                                                 wp_mail($recipient, apply_filters('ws_plugin__s2member_payment_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_payment_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             $paypal['s2member_log'][] = 'Payment Notification Emails have been processed.';
                         }
                         if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_tracking_codes'])) {
                             if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
                                 if (($code = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $code)) && ($code = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $code))) {
                                     if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
                                         if (($code = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $code)) && ($code = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
                                             if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
                                                 if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
                                                     if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
                                                         if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
                                                             if (($code = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $code)) && ($code = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $code)) && ($code = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $code))) {
                                                                 if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
                                                                     if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
                                                                         if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
                                                                             if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
                                                                                 if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
                                                                                     if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
                                                                                         if (is_array($fields) && !empty($fields)) {
                                                                                             foreach ($fields as $var => $val) {
                                                                                                 if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
                                                                                                     break;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
                                                                                             $paypal['s2member_log'][] = 'Storing Payment Tracking Codes into a Transient Queue. These will be processed on-site.';
                                                                                             set_transient('s2m_' . md5('s2member_transient_ccap_tracking_codes_' . $paypal['txn_id']), $code, 43200);
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action('ws_plugin__s2member_during_paypal_notify_during_new_ccaps', get_defined_vars());
                         unset($__refs, $__v);
                     } else {
                         $paypal['s2member_log'][] = 'Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.';
                     }
                 } else {
                     $paypal['s2member_log'][] = 'Unable to add new Capabilities. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.';
                 }
             } else {
                 $paypal['s2member_log'][] = 'Unable to add new Capabilities. Missing User/Member details. Please check the `on0` and `os0` variables in your Button Code.';
             }
         } else {
             $paypal['s2member_log'][] = 'Not processing. Duplicate IPN.';
             $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.';
             $paypal['s2member_log'][] = 'Duplicate IPN. Already processed. This IPN will be ignored.';
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_after_new_ccaps', get_defined_vars());
         unset($__refs, $__v);
         return apply_filters('c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level', $paypal, get_defined_vars());
     } else {
         return apply_filters('c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level', FALSE, get_defined_vars());
     }
 }
 /**
  * Shortcode `[s2Member-Pro-ClickBank-Button /]`.
  *
  * @package s2Member\ClickBank
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("s2Member-Pro-ClickBank-Button");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str The resulting ClickBank Button Code, HTML markup.
  */
 public static function sc_clickbank_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array("cbp" => "0", "cbskin" => "", "cbfid" => "", "cbur" => "", "cbf" => "auto", "ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "anchor"), $attr);
     $attr["tt"] = strtoupper($attr["tt"]);
     $attr["rt"] = strtoupper($attr["rt"]);
     $attr["ccaps"] = strtolower($attr["ccaps"]);
     $attr["ccaps"] = str_replace(" ", "", $attr["ccaps"]);
     $attr["rr"] = $attr["rt"] === "L" ? "0" : $attr["rr"];
     $attr["rr"] = $attr["level"] === "*" ? "0" : $attr["rr"];
     $attr["desc"] = str_replace("+", "plus", $attr["desc"]);
     // Workaround for a known bug @ ClickBank.
     // ClickBank will NOT properly parse `+` signs in URLs leading to (and returning from) ClickBank checkout forms.
     if ($attr["cbur"] && $attr["cbf"] === "auto" && !empty($_REQUEST["cbf"])) {
         $attr["cbf"] = esc_html((string) $_REQUEST["cbf"]);
     } else {
         if (!$attr["cbur"] || $attr["cbf"] === "auto") {
             $attr["cbf"] = "";
         }
     }
     if ($attr["modify"] || $attr["cancel"]) {
         $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/clickbank-edit-button.png";
         $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/clickbank-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
         $code = $attr["output"] === "anchor" ? $code : $code;
         if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
             $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
         }
         unset($href, $url, $m);
     } else {
         if ($attr["sp"]) {
             $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/clickbank-button.png";
             $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
             $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/clickbank-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
             $code = preg_replace("/%%item%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cbp"])), $code);
             $code = preg_replace("/%%vendor%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_clickbank_username"])), $code);
             $code = preg_replace("/%%invoice%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["sp_ids_exp"])), $code);
             $code = preg_replace("/%%desc%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["desc"])), $code);
             $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["custom"])), $code);
             $code = preg_replace("/%%cbskin%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbskin"])), $code);
             $code = preg_replace("/%%cbfid%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbfid"])), $code);
             $code = preg_replace("/%%cbur%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbur"])), $code);
             $code = preg_replace("/%%cbf%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbf"])), $code);
             $code = str_replace(array("&amp;cbskin=&amp;", "&amp;cbfid=&amp;", "&amp;cbur=&amp;", "&amp;cbf=&amp;"), "&amp;", $code);
             $code = preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_IP; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($_SERVER["REMOTE_ADDR"])), $code);
             $code = preg_replace("/%%referencing%%/", ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? c_ws_plugin__s2member_utils_strings::esc_ds("&amp;s2_referencing=" . urlencode($referencing)) : "", $code);
             if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__s2member_utils_urls::n_amps($m[1]))) {
                 $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(c_ws_plugin__s2member_utils_urls::add_s2member_sig($url))) . '"', $code);
             }
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
             $code = $attr["output"] === "anchor" ? $code : $code;
             if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
                 $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
             }
             unset($href, $url, $m);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/clickbank-button.png";
                 $attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/clickbank-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 $code = preg_replace("/%%item%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cbp"])), $code);
                 $code = preg_replace("/%%vendor%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_clickbank_username"])), $code);
                 $code = preg_replace("/%%invoice%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["level_ccaps_eotper"])), $code);
                 $code = preg_replace("/%%desc%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["desc"])), $code);
                 $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["custom"])), $code);
                 $code = preg_replace("/%%cbskin%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbskin"])), $code);
                 $code = preg_replace("/%%cbfid%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbfid"])), $code);
                 $code = preg_replace("/%%cbur%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbur"])), $code);
                 $code = preg_replace("/%%cbf%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbf"])), $code);
                 $code = str_replace(array("&amp;cbskin=&amp;", "&amp;cbfid=&amp;", "&amp;cbur=&amp;", "&amp;cbf=&amp;"), "&amp;", $code);
                 $code = !$attr["rr"] ? preg_replace("/&amp;s2_subscr_id\\=s2-\\<\\?php echo uniqid\\(\\); \\?\\>/", "", $code) : preg_replace("/\\<\\?php echo uniqid\\(\\); \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(uniqid())), $code);
                 $code = preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_IP; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($_SERVER["REMOTE_ADDR"])), $code);
                 $code = preg_replace("/%%referencing%%/", ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? c_ws_plugin__s2member_utils_strings::esc_ds("&amp;s2_referencing=" . urlencode($referencing)) : "", $code);
                 if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__s2member_utils_urls::n_amps($m[1]))) {
                     $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(c_ws_plugin__s2member_utils_urls::add_s2member_sig($url))) . '"', $code);
                 }
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? $code : $code;
                 if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
                     $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
                 }
                 unset($href, $url, $m);
             } else {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/clickbank-button.png";
                 $attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/clickbank-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 $code = preg_replace("/%%item%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["cbp"])), $code);
                 $code = preg_replace("/%%vendor%%/", c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_clickbank_username"])), $code);
                 $code = preg_replace("/%%invoice%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["level_ccaps_eotper"])), $code);
                 $code = preg_replace("/%%desc%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["desc"])), $code);
                 $code = preg_replace("/%%p1%%/", $attr["rr"] ? c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["tp"] . " " . $attr["tt"])) : "", $code);
                 $code = preg_replace("/%%p3%%/", $attr["rr"] ? c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["rp"] . " " . $attr["rt"])) : "", $code);
                 $code = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["custom"])), $code);
                 $code = preg_replace("/%%cbskin%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbskin"])), $code);
                 $code = preg_replace("/%%cbfid%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbfid"])), $code);
                 $code = preg_replace("/%%cbur%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbur"])), $code);
                 $code = preg_replace("/%%cbf%%/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($attr["cbf"])), $code);
                 $code = str_replace(array("&amp;cbskin=&amp;", "&amp;cbfid=&amp;", "&amp;cbur=&amp;", "&amp;cbf=&amp;"), "&amp;", $code);
                 $code = !$attr["rr"] ? preg_replace("/&amp;s2_subscr_id\\=s2-\\<\\?php echo uniqid\\(\\); \\?\\>/", "", $code) : preg_replace("/\\<\\?php echo uniqid\\(\\); \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(uniqid())), $code);
                 $code = preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_IP; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($_SERVER["REMOTE_ADDR"])), $code);
                 $code = preg_replace("/%%referencing%%/", ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) ? c_ws_plugin__s2member_utils_strings::esc_ds("&amp;s2_referencing=" . urlencode($referencing)) : "", $code);
                 if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__s2member_utils_urls::n_amps($m[1]))) {
                     $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr(c_ws_plugin__s2member_utils_urls::add_s2member_sig($url))) . '"', $code);
                 }
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? $code : $code;
                 if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
                     $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
                 }
                 unset($href, $url, $m);
             }
         }
     }
     return $code;
 }
Пример #18
0
 /**
  * Writes no GZIP rules into root `.htaccess` file.
  *
  * @package s2Member\Files
  * @since 120212
  *
  * @return bool True if successfull, else false on any type of failure.
  */
 public static function write_no_gzip_into_root_htaccess()
 {
     if (c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess()) {
         $start_line = "# BEGIN s2Member GZIP exclusions";
         $end_line = "# END s2Member GZIP exclusions";
         $htaccess = ABSPATH . ".htaccess";
         $ideally_position_before = "# BEGIN WordPress";
         $no_gzip = $start_line . "\n" . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_no_gzip_htaccess"]))) . "\n" . $end_line;
         if (file_exists($htaccess) && is_readable($htaccess) && is_writable($htaccess) && ($htaccess_contents = file_get_contents($htaccess)) !== false && is_string($htaccess_contents = trim($htaccess_contents))) {
             if (stripos($htaccess_contents, $ideally_position_before) !== false) {
                 $htaccess_contents = trim(str_ireplace($ideally_position_before, $no_gzip . "\n\n" . $ideally_position_before, $htaccess_contents));
             } else {
                 // Else, let's put it at the very top of the file by default.
                 $htaccess_contents = trim($no_gzip . "\n\n" . $htaccess_contents);
             }
             return file_put_contents($htaccess, $htaccess_contents);
         } else {
             if (!file_exists($htaccess) && is_writable(dirname($htaccess))) {
                 return file_put_contents($htaccess, $no_gzip);
             }
         }
     }
     return false;
 }
Пример #19
0
 /**
  * Shortcode `[s2Member-Pro-Stripe-Form /]`.
  *
  * @package s2Member\Stripe
  * @since 140617
  *
  * @attaches-to ``add_shortcode('s2Member-Pro-Stripe-Form');``
  *
  * @param array  $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  *
  * @return string The resulting Form Code, HTML markup.
  */
 public static function sc_stripe_form($attr, $content = '', $shortcode = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_pro_before_sc_stripe_form', get_defined_vars());
     unset($__refs, $__v);
     // Ditch these temporary vars.
     c_ws_plugin__s2member_no_cache::no_cache_constants(TRUE);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $options = array();
     // Initialize options to an empty array.
     $option_selections = '';
     // Initialize w/ no options.
     if ($content && ($content = strip_tags($content))) {
         // This allows for nested Pro-Form Shortcodes as options.
         $content = str_replace('s2Member-Pro-Stripe-Form ', 's2Member-Pro-Stripe-xFormOption ', $content);
     }
     if ($content && ($content_options = do_shortcode($content))) {
         foreach (preg_split('/\\s*\\|\\:\\:\\|\\s*/', $content_options, NULL, PREG_SPLIT_NO_EMPTY) as $_content_option_key => $_content_option) {
             $_content_option_id = $_content_option_key + 1;
             $options[$_content_option_id] = maybe_unserialize(trim($_content_option));
             if (!is_array($options[$_content_option_id])) {
                 unset($options[$_content_option_id]);
                 continue;
                 // Invalid option.
             }
             if (!empty($_REQUEST['s2p-option']) && (int) $_REQUEST['s2p-option'] === $_content_option_id) {
                 $options[$_content_option_id]['selected'] = TRUE;
             }
         }
         unset($_content_option_key, $_content_option, $_content_option_id);
         // Housekeeping.
         foreach ($options as $_option_id => $_option) {
             if (!empty($_option['selected'])) {
                 $attr = array_merge($attr, $_option);
                 $_selected_option_id = $_option_id;
             }
         }
         unset($_option_id, $_option);
         // Housekeeping.
         if (empty($_selected_option_id)) {
             foreach ($options as $_option_id => $_option) {
                 $attr = array_merge($attr, $_option);
                 break;
                 // Force a selected option (default).
             }
         }
         unset($_option_id, $_option, $_selected_option_id);
         // Housekeeping.
         foreach ($options as $_option_id => $_option) {
             // Build option selections.
             $option_selections .= '<option value="' . esc_attr($_option_id) . '"' . (!empty($_option['selected']) ? ' selected="selected"' : '') . '>' . esc_html($_option['desc']) . '</option>';
         }
         unset($_option_id, $_option);
         // Housekeeping.
     }
     $attr = shortcode_atts(array('ids' => '0', 'exp' => '72', 'level' => @$attr['register'] ? '0' : '1', 'ccaps' => '', 'desc' => '', 'cc' => 'USD', 'custom' => $_SERVER['HTTP_HOST'], 'ta' => '0', 'tp' => '0', 'tt' => 'D', 'ra' => '0.50', 'rp' => '1', 'rt' => 'M', 'rr' => '1', 'rrt' => '', 'modify' => '0', 'cancel' => '0', 'unsub' => '0', 'sp' => '0', 'register' => '0', 'update' => '0', 'accept' => $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_stripe_api_accept_bitcoin'] ? 'bitcoin' : '', 'coupon' => '', 'accept_coupons' => '0', 'default_country_code' => 'US', 'captcha' => '', 'template' => '', 'success' => ''), $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['cc'] = strtoupper($attr['cc']);
     // Must be provided in upper-case format. 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['ccaps'] = str_replace(' ', '', $attr['ccaps']);
     // Custom Capabilities should not have spaces.
     $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 require Buy Now. Only after running shortcode_atts().
     $attr['rr'] = !$attr['tp'] && !$attr['rr'] ? 'BN' : $attr['rr'];
     // No Trial / non-recurring. Only after running shortcode_atts().
     $attr['default_country_code'] = strtoupper($attr['default_country_code']);
     // This MUST be in uppercase format.
     $attr['success'] = c_ws_plugin__s2member_utils_urls::n_amps($attr['success']);
     // Normalize ampersands.
     $attr['coupon'] = !empty($_GET['s2p-coupon']) ? trim(strip_tags(stripslashes($_GET['s2p-coupon']))) : $attr['coupon'];
     $attr['singular'] = get_the_ID();
     // Collect the Singular ID for this Post/Page.
     $attr['accept'] = trim($attr['accept']) ? preg_split('/[;,]+/', preg_replace('/[' . "\r\n\t" . '\\s]+/', '', trim(strtolower($attr['accept'])))) : array();
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_pro_before_sc_stripe_form_after_shortcode_atts', get_defined_vars());
     unset($__refs, $__v);
     // Ditch these temporary vars.
     if ($attr['cancel']) {
         $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
         $response = c_ws_plugin__s2member_pro_stripe_responses::stripe_cancellation_response($attr);
         $_p = $response['response'] && !$response['error'] ? array() : $_p;
         if ($attr['captcha']) {
             $captcha = '<div id="s2member-pro-stripe-cancellation-form-captcha-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-cancellation-form-section s2member-pro-stripe-form-captcha-section s2member-pro-stripe-cancellation-form-captcha-section">' . "\n";
             $captcha .= '<div id="s2member-pro-stripe-cancellation-form-captcha-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-cancellation-form-section-title s2member-pro-stripe-form-captcha-section-title s2member-pro-stripe-cancellation-form-captcha-section-title">' . "\n";
             $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
             $captcha .= '</div>' . "\n";
             $captcha .= '<div id="s2member-pro-stripe-cancellation-form-captcha-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-cancellation-form-div s2member-pro-stripe-form-captcha-div s2member-pro-stripe-cancellation-form-captcha-div">' . "\n";
             $captcha .= '<label id="s2member-pro-stripe-cancellation-form-captcha-label" class="s2member-pro-stripe-form-captcha-label s2member-pro-stripe-cancellation-form-captcha-label">' . "\n";
             $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr['captcha'], 10) . "\n";
             $captcha .= '</label>' . "\n";
             $captcha .= '</div>' . "\n";
             $captcha .= '</div>' . "\n";
         } else {
             $captcha = '';
         }
         // Not applicable.
         $hidden_inputs = '<input type="hidden" name="s2member_pro_stripe_cancellation[nonce]" id="s2member-pro-stripe-cancellation-nonce" value="' . esc_attr(wp_create_nonce('s2member-pro-stripe-cancellation')) . '" />';
         $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_cancellation[attr]" id="s2member-pro-stripe-cancellation-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
         $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
         $custom_template = is_file(TEMPLATEPATH . '/stripe-cancellation-form.php') ? TEMPLATEPATH . '/stripe-cancellation-form.php' : '';
         $custom_template = is_file(get_stylesheet_directory() . '/stripe-cancellation-form.php') ? get_stylesheet_directory() . '/stripe-cancellation-form.php' : $custom_template;
         $custom_template = $attr['template'] && is_file(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
         $custom_template = $attr['template'] && is_file(get_stylesheet_directory() . '/' . $attr['template']) ? get_stylesheet_directory() . '/' . $attr['template'] : $custom_template;
         $custom_template = $attr['template'] && is_file(WP_CONTENT_DIR . '/' . $attr['template']) ? WP_CONTENT_DIR . '/' . $attr['template'] : $custom_template;
         $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/forms/stripe-cancellation-form.php'));
         $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
         $code = preg_replace('/%%action%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
         $code = preg_replace('/%%response%%/', c_ws_plugin__s2member_utils_strings::esc_refs($response['response']), $code);
         $code = preg_replace('/%%description%%/', c_ws_plugin__s2member_utils_strings::esc_refs($attr['desc']), $code);
         $code = preg_replace('/%%captcha%%/', c_ws_plugin__s2member_utils_strings::esc_refs($captcha), $code);
         $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_pro_during_sc_stripe_cancellation_form', get_defined_vars());
         unset($__refs, $__v);
         // Ditch these temporary vars.
     } else {
         if ($attr['register']) {
             $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
             $response = c_ws_plugin__s2member_pro_stripe_responses::stripe_registration_response($attr);
             $_p = $response['response'] && !$response['error'] ? array() : $_p;
             $custom_fields = '';
             // Initialize custom fields.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                 // Only display Custom Fields if configured.
                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($attr['level'], 'registration')) {
                     $tabindex = 99;
                     // Start tabindex at 99 ( +1 below = 100 ).
                     $custom_fields = '<div id="s2member-pro-stripe-registration-form-custom-fields-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-registration-form-section s2member-pro-stripe-form-custom-fields-section s2member-pro-stripe-registration-form-custom-fields-section">' . "\n";
                     $custom_fields .= '<div id="s2member-pro-stripe-registration-form-custom-fields-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-registration-form-section-title s2member-pro-stripe-form-custom-fields-section-title s2member-pro-stripe-registration-form-custom-fields-section-title">' . "\n";
                     $custom_fields .= _x('Additional Info', 's2member-front', 's2member') . "\n";
                     $custom_fields .= '</div>' . "\n";
                     foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                         if (in_array($field['id'], $fields_applicable)) {
                             $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                             $field_id_class = preg_replace('/_/', '-', $field_var);
                             if (!empty($field['section']) && $field['section'] === 'yes') {
                                 // Starts a new section?
                                 $custom_fields .= '<div id="s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-divider-section" class="s2member-pro-stripe-form-div s2member-pro-stripe-registration-form-div s2member-pro-stripe-form-custom-reg-field-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . '">' . (!empty($field['sectitle']) ? $field['sectitle'] : '') . '</div>';
                             }
                             $custom_fields .= '<div id="s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-registration-form-div s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-div s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                             $custom_fields .= '<label for="s2member-pro-stripe-registration-custom-reg-field-' . esc_attr($field_id_class) . '" id="s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-label" class="s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-label s2member-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-label">' . "\n";
                             $custom_fields .= '<span' . (preg_match('/^(checkbox|pre_checkbox)$/', $field['type']) ? ' style="display:none;"' : '') . '>' . $field['label'] . ($field['required'] === 'yes' ? ' *' : '') . '</span></label>' . (preg_match('/^(checkbox|pre_checkbox)$/', $field['type']) ? '' : '<br />') . "\n";
                             $custom_fields .= c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 's2member_pro_stripe_registration[custom_fields][', 's2member-pro-stripe-registration-custom-reg-field-', 's2member-pro-stripe-custom-reg-field-' . $field_id_class . ' s2member-pro-stripe-registration-custom-reg-field-' . $field_id_class, '', $tabindex = $tabindex + 1, '', @$_p['s2member_pro_stripe_registration'], @$_p['s2member_pro_stripe_registration']['custom_fields'][$field_var], 'registration');
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     $custom_fields .= '</div>' . "\n";
                 }
             }
             if ($attr['captcha']) {
                 $captcha = '<div id="s2member-pro-stripe-registration-form-captcha-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-registration-form-section s2member-pro-stripe-form-captcha-section s2member-pro-stripe-registration-form-captcha-section">' . "\n";
                 $captcha .= '<div id="s2member-pro-stripe-registration-form-captcha-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-registration-form-section-title s2member-pro-stripe-form-captcha-section-title s2member-pro-stripe-registration-form-captcha-section-title">' . "\n";
                 $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                 $captcha .= '</div>' . "\n";
                 $captcha .= '<div id="s2member-pro-stripe-registration-form-captcha-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-registration-form-div s2member-pro-stripe-form-captcha-div s2member-pro-stripe-registration-form-captcha-div">' . "\n";
                 $captcha .= '<label id="s2member-pro-stripe-registration-form-captcha-label" class="s2member-pro-stripe-form-captcha-label s2member-pro-stripe-registration-form-captcha-label">' . "\n";
                 $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr['captcha'], 200) . "\n";
                 $captcha .= '</label>' . "\n";
                 $captcha .= '</div>' . "\n";
                 $captcha .= '</div>' . "\n";
             } else {
                 $captcha = '';
             }
             // Not applicable.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                 $opt_in = '<div id="s2member-pro-stripe-registration-form-custom-reg-field-opt-in-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-registration-form-div s2member-pro-stripe-form-custom-reg-field-opt-in-div s2member-pro-stripe-registration-form-custom-reg-field-opt-in-div">' . "\n";
                 $opt_in .= '<label for="s2member-pro-stripe-registration-form-custom-reg-field-opt-in" id="s2member-pro-stripe-registration-form-custom-reg-field-opt-in-label" class="s2member-pro-stripe-form-custom-reg-field-opt-in-label s2member-pro-stripe-registration-form-custom-reg-field-opt-in-label">' . "\n";
                 $opt_in .= '<input type="checkbox" name="s2member_pro_stripe_registration[custom_fields][opt_in]" id="s2member-pro-stripe-registration-form-custom-reg-field-opt-in" class="s2member-pro-stripe-form-custom-reg-field-opt-in s2member-pro-stripe-registration-form-custom-reg-field-opt-in" value="1"' . (empty($_p['s2member_pro_stripe_registration']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] == 1 || @$_p['s2member_pro_stripe_registration']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="300" />' . "\n";
                 $opt_in .= $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label'] . "\n";
                 $opt_in .= '</label>' . "\n";
                 $opt_in .= '</div>' . "\n";
             } else {
                 $opt_in = '';
             }
             // Not applicable.
             $hidden_inputs = '<input type="hidden" name="s2member_pro_stripe_registration[nonce]" id="s2member-pro-stripe-registration-nonce" value="' . esc_attr(wp_create_nonce('s2member-pro-stripe-registration')) . '" />';
             $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'] ? '<input type="hidden" id="s2member-pro-stripe-registration-names-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password'] ? '<input type="hidden" id="s2member-pro-stripe-registration-password-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_registration[attr]" id="s2member-pro-stripe-registration-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
             $custom_template = is_file(TEMPLATEPATH . '/stripe-registration-form.php') ? TEMPLATEPATH . '/stripe-registration-form.php' : '';
             $custom_template = is_file(get_stylesheet_directory() . '/stripe-registration-form.php') ? get_stylesheet_directory() . '/stripe-registration-form.php' : $custom_template;
             $custom_template = $attr['template'] && is_file(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
             $custom_template = $attr['template'] && is_file(get_stylesheet_directory() . '/' . $attr['template']) ? get_stylesheet_directory() . '/' . $attr['template'] : $custom_template;
             $custom_template = $attr['template'] && is_file(WP_CONTENT_DIR . '/' . $attr['template']) ? WP_CONTENT_DIR . '/' . $attr['template'] : $custom_template;
             $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/forms/stripe-registration-form.php'));
             $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
             $code = preg_replace('/%%action%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
             $code = preg_replace('/%%response%%/', c_ws_plugin__s2member_utils_strings::esc_refs($response['response']), $code);
             $code = preg_replace('/%%options%%/', c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
             $code = preg_replace('/%%description%%/', c_ws_plugin__s2member_utils_strings::esc_refs($attr['desc']), $code);
             $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_registration']['first_name'])), $code);
             $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_registration']['last_name'])), $code);
             $code = preg_replace('/%%email_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_registration']['email'])), $code);
             $code = preg_replace('/%%username_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_registration']['username'])), $code);
             $code = preg_replace('/%%password1_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_registration']['password1'])), $code);
             $code = preg_replace('/%%password2_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_registration']['password2'])), $code);
             $code = preg_replace('/%%custom_fields%%/', c_ws_plugin__s2member_utils_strings::esc_refs($custom_fields), $code);
             $code = preg_replace('/%%captcha%%/', c_ws_plugin__s2member_utils_strings::esc_refs($captcha), $code);
             $code = preg_replace('/%%opt_in%%/', c_ws_plugin__s2member_utils_strings::esc_refs($opt_in), $code);
             $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action('ws_plugin__s2member_pro_during_sc_stripe_registration_form', get_defined_vars());
             unset($__refs, $__v);
             // Ditch these temporary vars.
         } else {
             if ($attr['update']) {
                 $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                 $response = c_ws_plugin__s2member_pro_stripe_responses::stripe_update_response($attr);
                 $_p = $response['response'] && !$response['error'] ? array() : $_p;
                 if ($attr['captcha']) {
                     $captcha = '<div id="s2member-pro-stripe-update-form-captcha-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-update-form-section s2member-pro-stripe-form-captcha-section s2member-pro-stripe-update-form-captcha-section">' . "\n";
                     $captcha .= '<div id="s2member-pro-stripe-update-form-captcha-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-update-form-section-title s2member-pro-stripe-form-captcha-section-title s2member-pro-stripe-update-form-captcha-section-title">' . "\n";
                     $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                     $captcha .= '</div>' . "\n";
                     $captcha .= '<div id="s2member-pro-stripe-update-form-captcha-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-update-form-div s2member-pro-stripe-form-captcha-div s2member-pro-stripe-update-form-captcha-div">' . "\n";
                     $captcha .= '<label id="s2member-pro-stripe-update-form-captcha-label" class="s2member-pro-stripe-form-captcha-label s2member-pro-stripe-update-form-captcha-label">' . "\n";
                     $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr['captcha'], 200) . "\n";
                     $captcha .= '</label>' . "\n";
                     $captcha .= '</div>' . "\n";
                     $captcha .= '</div>' . "\n";
                 } else {
                     $captcha = '';
                 }
                 // Not applicable.
                 $hidden_inputs = '<input type="hidden" name="s2member_pro_stripe_update[nonce]" id="s2member-pro-stripe-update-nonce" value="' . esc_attr(wp_create_nonce('s2member-pro-stripe-update')) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_update[source_token]" id="s2member-pro-stripe-update-source-token" value="' . esc_attr(@$_p['s2member_pro_stripe_update']['source_token']) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_update[source_token_summary]" id="s2member-pro-stripe-update-source-token-summary" value="' . esc_attr(@$_p['s2member_pro_stripe_update']['source_token_summary']) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_update[attr]" id="s2member-pro-stripe-update-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
                 $custom_template = is_file(TEMPLATEPATH . '/stripe-update-form.php') ? TEMPLATEPATH . '/stripe-update-form.php' : '';
                 $custom_template = is_file(get_stylesheet_directory() . '/stripe-update-form.php') ? get_stylesheet_directory() . '/stripe-update-form.php' : $custom_template;
                 $custom_template = $attr['template'] && is_file(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                 $custom_template = $attr['template'] && is_file(get_stylesheet_directory() . '/' . $attr['template']) ? get_stylesheet_directory() . '/' . $attr['template'] : $custom_template;
                 $custom_template = $attr['template'] && is_file(WP_CONTENT_DIR . '/' . $attr['template']) ? WP_CONTENT_DIR . '/' . $attr['template'] : $custom_template;
                 $custom_template_contents = $custom_template ? trim(file_get_contents($custom_template)) : '';
                 if ($custom_template_contents && stripos($custom_template_contents, '%%source_token_summary%%') === FALSE) {
                     $custom_template_contents = '';
                 }
                 // Custom template must be up-to-date.
                 $code = $custom_template_contents ? $custom_template_contents : trim(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/forms/stripe-update-form.php'));
                 $code = trim(!$custom_template_contents || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                 $code = preg_replace('/%%action%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                 $code = preg_replace('/%%response%%/', c_ws_plugin__s2member_utils_strings::esc_refs($response['response']), $code);
                 $code = preg_replace('/%%description%%/', c_ws_plugin__s2member_utils_strings::esc_refs($attr['desc']), $code);
                 $code = preg_replace('/%%source_token%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_update']['source_token'])), $code);
                 $code = preg_replace('/%%source_token_summary%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_update']['source_token_summary'])), $code);
                 $code = preg_replace('/%%captcha%%/', c_ws_plugin__s2member_utils_strings::esc_refs($captcha), $code);
                 $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__s2member_pro_during_sc_stripe_update_form', get_defined_vars());
                 unset($__refs, $__v);
                 // Ditch these temporary vars.
             } else {
                 if ($attr['sp']) {
                     $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                     $attr['sp_ids_exp'] = 'sp:' . $attr['ids'] . ':' . $attr['exp'];
                     // Combined `sp:ids:expiration hours`.
                     $attr['coupon'] = !empty($_p['s2member_pro_stripe_sp_checkout']['coupon']) ? $_p['s2member_pro_stripe_sp_checkout']['coupon'] : $attr['coupon'];
                     $response = c_ws_plugin__s2member_pro_stripe_responses::stripe_sp_checkout_response($attr);
                     $_p = $response['response'] && !$response['error'] ? array() : $_p;
                     $tax_may_apply = c_ws_plugin__s2member_pro_stripe_utilities::tax_may_apply();
                     // Tax may apply?
                     $cp_attr = $cp_buy_now_attr = c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($attr, $attr['coupon']);
                     // ↑ The discounted amounts, but before any tax calculations occur during checkout.
                     $is_buy_now = TRUE;
                     // Always true for Specific Post/Page Access transactions.
                     $is_buy_now_amount = $is_buy_now && $cp_buy_now_attr['ra'] > 0 ? number_format($cp_buy_now_attr['ra'], 2, '.', '') : '0.00';
                     $is_buy_now_currency = $is_buy_now ? $cp_buy_now_attr['cc'] : '';
                     // Note that Bitcoin can only be charged in USD at the present time.
                     $is_buy_now_amount_in_cents = $is_buy_now && $is_buy_now_amount > 0 ? (string) c_ws_plugin__s2member_pro_stripe_utilities::dollar_amount_to_cents($is_buy_now_amount, $is_buy_now_currency) : '0';
                     $is_buy_now_desc = $is_buy_now ? $cp_buy_now_attr['desc'] : '';
                     // This description is used for Bitcoin transaction; description for receiver.
                     $is_buy_now_bitcoin_accepted = $is_buy_now && $is_buy_now_amount_in_cents > 0 && $is_buy_now_currency === 'USD' && in_array('bitcoin', $cp_buy_now_attr['accept'], TRUE);
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'USD' ? 'US' : '';
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'CAD' ? 'CA' : $country_default_by_currency;
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'GBP' ? 'GB' : $country_default_by_currency;
                     $country_default_by_currency = apply_filters('ws_plugin__s2member_pro_stripe_default_country', $country_default_by_currency, get_defined_vars());
                     $default_country_v = $attr['default_country_code'] ? $attr['default_country_code'] : $country_default_by_currency;
                     $country_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (preg_split('/[' . "\r\n" . ']+/', file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . '/iso-3166-1.txt')) as $country) {
                         list($country_l, $country_v) = preg_split('/;/', $country, 2);
                         if ($country_l && $country_v) {
                             // Here we also check on the default pre-selected country; as determined above; based on currency.
                             $country_options .= '<option value="' . esc_attr(strtoupper($country_v)) . '"' . (@$_p['s2member_pro_stripe_sp_checkout']['country'] === $country_v || $default_country_v === $country_v ? ' selected="selected"' : '') . '>' . esc_html(ucwords(strtolower($country_l))) . '</option>';
                         }
                     }
                     if ($attr['captcha']) {
                         $captcha = '<div id="s2member-pro-stripe-sp-checkout-form-captcha-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-sp-checkout-form-section s2member-pro-stripe-form-captcha-section s2member-pro-stripe-sp-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="s2member-pro-stripe-sp-checkout-form-captcha-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-sp-checkout-form-section-title s2member-pro-stripe-form-captcha-section-title s2member-pro-stripe-sp-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="s2member-pro-stripe-sp-checkout-form-captcha-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-sp-checkout-form-div s2member-pro-stripe-form-captcha-div s2member-pro-stripe-sp-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="s2member-pro-stripe-sp-checkout-form-captcha-label" class="s2member-pro-stripe-form-captcha-label s2member-pro-stripe-sp-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr['captcha'], 300) . "\n";
                         $captcha .= '</label>' . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '</div>' . "\n";
                     } else {
                         $captcha = '';
                     }
                     // Not applicable.
                     /*
                     Build the opt-in checkbox.
                     */
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-sp-checkout-form-div s2member-pro-stripe-form-custom-reg-field-opt-in-div s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" id="s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-label" class="s2member-pro-stripe-form-custom-reg-field-opt-in-label s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="s2member_pro_stripe_sp_checkout[custom_fields][opt_in]" id="s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" class="s2member-pro-stripe-form-custom-reg-field-opt-in s2member-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p['s2member_pro_stripe_sp_checkout']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] == 1 || @$_p['s2member_pro_stripe_sp_checkout']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="400" />' . "\n";
                         $opt_in .= $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label'] . "\n";
                         $opt_in .= '</label>' . "\n";
                         $opt_in .= '</div>' . "\n";
                     } else {
                         $opt_in = '';
                     }
                     // Not applicable.
                     $hidden_inputs = '<input type="hidden" name="s2member_pro_stripe_sp_checkout[nonce]" id="s2member-pro-stripe-sp-checkout-nonce" value="' . esc_attr(wp_create_nonce('s2member-pro-stripe-sp-checkout')) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_sp_checkout[source_token]" id="s2member-pro-stripe-sp-checkout-source-token" value="' . esc_attr(@$_p['s2member_pro_stripe_sp_checkout']['source_token']) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_sp_checkout[source_token_summary]" id="s2member-pro-stripe-sp-checkout-source-token-summary" value="' . esc_attr(@$_p['s2member_pro_stripe_sp_checkout']['source_token_summary']) . '" />';
                     $hidden_inputs .= !$attr['accept_coupons'] ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !$tax_may_apply ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= $is_buy_now_amount <= 0 ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= $is_buy_now_amount > 0 ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-is-buy-now-amount" value="' . esc_attr($is_buy_now_amount) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_amount_in_cents > 0 ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-is-buy-now-amount-in-cents" value="' . esc_attr($is_buy_now_amount_in_cents) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_currency ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-is-buy-now-currency" value="' . esc_attr($is_buy_now_currency) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_desc ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-is-buy-now-desc" value="' . esc_attr($is_buy_now_desc) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_bitcoin_accepted ? '<input type="hidden" id="s2member-pro-stripe-sp-checkout-is-buy-now-bitcoin-accepted" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_sp_checkout[attr]" id="s2member-pro-stripe-sp-checkout-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                     $custom_template = is_file(TEMPLATEPATH . '/stripe-sp-checkout-form.php') ? TEMPLATEPATH . '/stripe-sp-checkout-form.php' : '';
                     $custom_template = is_file(get_stylesheet_directory() . '/stripe-sp-checkout-form.php') ? get_stylesheet_directory() . '/stripe-sp-checkout-form.php' : $custom_template;
                     $custom_template = $attr['template'] && is_file(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && is_file(get_stylesheet_directory() . '/' . $attr['template']) ? get_stylesheet_directory() . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && is_file(WP_CONTENT_DIR . '/' . $attr['template']) ? WP_CONTENT_DIR . '/' . $attr['template'] : $custom_template;
                     $custom_template_contents = $custom_template ? trim(file_get_contents($custom_template)) : '';
                     if ($custom_template_contents && stripos($custom_template_contents, '%%source_token_summary%%') === FALSE) {
                         $custom_template_contents = '';
                     }
                     // Custom template must be up-to-date.
                     $code = $custom_template_contents ? $custom_template_contents : trim(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/forms/stripe-sp-checkout-form.php'));
                     $code = trim(!$custom_template_contents || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                     $code = preg_replace('/%%action%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                     $code = preg_replace('/%%response%%/', c_ws_plugin__s2member_utils_strings::esc_refs($response['response']), $code);
                     $code = preg_replace('/%%options%%/', c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
                     $code = preg_replace('/%%description%%/', c_ws_plugin__s2member_utils_strings::esc_refs($attr['desc']), $code);
                     $code = preg_replace('/%%coupon_response%%/', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'], 'response', array('affiliates-1px-response'))), $code);
                     $code = preg_replace('/%%coupon_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit($attr['coupon'])), $code);
                     $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_sp_checkout']['first_name'])), $code);
                     $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_sp_checkout']['last_name'])), $code);
                     $code = preg_replace('/%%email_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_sp_checkout']['email'])), $code);
                     $code = preg_replace('/%%source_token%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_sp_checkout']['source_token'])), $code);
                     $code = preg_replace('/%%source_token_summary%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_sp_checkout']['source_token_summary'])), $code);
                     $code = preg_replace('/%%state_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_sp_checkout']['state'])), $code);
                     $code = preg_replace('/%%country_options%%/', c_ws_plugin__s2member_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace('/%%zip_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_sp_checkout']['zip'])), $code);
                     $code = preg_replace('/%%captcha%%/', c_ws_plugin__s2member_utils_strings::esc_refs($captcha), $code);
                     $code = preg_replace('/%%opt_in%%/', c_ws_plugin__s2member_utils_strings::esc_refs($opt_in), $code);
                     $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_pro_during_sc_stripe_sp_form', get_defined_vars());
                     unset($__refs, $__v);
                     // Ditch these temporary vars.
                 } else {
                     $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                     $attr['level_ccaps_eotper'] = $attr['rr'] === 'BN' && $attr['rt'] !== 'L' ? $attr['level'] . ':' . $attr['ccaps'] . ':' . $attr['rp'] . ' ' . $attr['rt'] : $attr['level'] . ':' . $attr['ccaps'];
                     $attr['level_ccaps_eotper'] = rtrim($attr['level_ccaps_eotper'], ':');
                     // Clean any trailing separators from this string.
                     $attr['coupon'] = !empty($_p['s2member_pro_stripe_checkout']['coupon']) ? $_p['s2member_pro_stripe_checkout']['coupon'] : $attr['coupon'];
                     $response = c_ws_plugin__s2member_pro_stripe_responses::stripe_checkout_response($attr);
                     $_p = $response['response'] && !$response['error'] ? array() : $_p;
                     $tax_may_apply = c_ws_plugin__s2member_pro_stripe_utilities::tax_may_apply();
                     // Tax may apply?
                     $cp_attr = $cp_buy_now_attr = c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($attr, $attr['coupon']);
                     // ↑ The discounted amounts, but before any tax calculations occur during checkout.
                     if ($cp_buy_now_attr['ra'] <= 0 && $cp_buy_now_attr['tp'] && $cp_buy_now_attr['ta'] > 0) {
                         $cp_buy_now_attr['tp'] = '0';
                         // Ditch the trial period completely.
                         $cp_buy_now_attr['ra'] = $cp_buy_now_attr['ta'];
                         // Use as regular amount.
                         $cp_buy_now_attr['ta'] = '0.00';
                         // Ditch this calculation now.
                     }
                     $is_buy_now = $cp_buy_now_attr['rr'] === 'BN' || !$cp_buy_now_attr['tp'] && !$cp_buy_now_attr['rr'];
                     $is_buy_now_amount = $is_buy_now && $cp_buy_now_attr['ra'] > 0 ? number_format($cp_buy_now_attr['ra'], 2, '.', '') : '0.00';
                     $is_buy_now_currency = $is_buy_now ? $cp_buy_now_attr['cc'] : '';
                     // Note that Bitcoin can only be charged in USD at the present time.
                     $is_buy_now_amount_in_cents = $is_buy_now && $is_buy_now_amount > 0 ? (string) c_ws_plugin__s2member_pro_stripe_utilities::dollar_amount_to_cents($is_buy_now_amount, $is_buy_now_currency) : '0';
                     $is_buy_now_desc = $is_buy_now ? $cp_buy_now_attr['desc'] : '';
                     // This description is used for Bitcoin transaction; description for receiver.
                     $is_buy_now_bitcoin_accepted = $is_buy_now && $is_buy_now_amount_in_cents > 0 && $is_buy_now_currency === 'USD' && in_array('bitcoin', $cp_buy_now_attr['accept'], TRUE);
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_checkout']['country'] && $attr['cc'] === 'USD' ? 'US' : '';
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_checkout']['country'] && $attr['cc'] === 'CAD' ? 'CA' : $country_default_by_currency;
                     $country_default_by_currency = !@$_p['s2member_pro_stripe_checkout']['country'] && $attr['cc'] === 'GBP' ? 'GB' : $country_default_by_currency;
                     $country_default_by_currency = apply_filters('ws_plugin__s2member_pro_stripe_default_country', $country_default_by_currency, get_defined_vars());
                     $default_country_v = $attr['default_country_code'] ? $attr['default_country_code'] : $country_default_by_currency;
                     $country_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (preg_split('/[' . "\r\n" . ']+/', file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . '/iso-3166-1.txt')) as $country) {
                         list($country_l, $country_v) = preg_split('/;/', $country, 2);
                         if ($country_l && $country_v) {
                             // Here we also check on the default pre-selected country; as determined above; based on currency.
                             $country_options .= '<option value="' . esc_attr(strtoupper($country_v)) . '"' . (@$_p['s2member_pro_stripe_checkout']['country'] === $country_v || $default_country_v === $country_v ? ' selected="selected"' : '') . '>' . esc_html(ucwords(strtolower($country_l))) . '</option>';
                         }
                     }
                     $custom_fields = '';
                     // Initialize custom fields.
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                         // Only display Custom Fields if configured.
                         if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($attr['level'] === '*' ? 'auto-detection' : $attr['level'], 'registration')) {
                             $tabindex = 99;
                             // Start tabindex at 99 (+1 below = 100).
                             $custom_fields = '<div id="s2member-pro-stripe-checkout-form-custom-fields-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-checkout-form-section s2member-pro-stripe-form-custom-fields-section s2member-pro-stripe-checkout-form-custom-fields-section">' . "\n";
                             $custom_fields .= '<div id="s2member-pro-stripe-checkout-form-custom-fields-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-checkout-form-section-title s2member-pro-stripe-form-custom-fields-section-title s2member-pro-stripe-checkout-form-custom-fields-section-title">' . "\n";
                             $custom_fields .= _x('Additional Info', 's2member-front', 's2member') . "\n";
                             $custom_fields .= '</div>' . "\n";
                             foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                                 if (in_array($field['id'], $fields_applicable)) {
                                     $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                                     $field_id_class = preg_replace('/_/', '-', $field_var);
                                     if (!empty($field['section']) && $field['section'] === 'yes') {
                                         // Starts a new section?
                                         $custom_fields .= '<div id="s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-divider-section" class="s2member-pro-stripe-form-div s2member-pro-stripe-checkout-form-div s2member-pro-stripe-form-custom-reg-field-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . '">' . (!empty($field['sectitle']) ? $field['sectitle'] : '') . '</div>';
                                     }
                                     $custom_fields .= '<div id="s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-checkout-form-div s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-div s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                                     $custom_fields .= '<label for="s2member-pro-stripe-checkout-custom-reg-field-' . esc_attr($field_id_class) . '" id="s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-label" class="s2member-pro-stripe-form-custom-reg-field-' . $field_id_class . '-label s2member-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-label">' . "\n";
                                     $custom_fields .= '<span' . (preg_match('/^(checkbox|pre_checkbox)$/', $field['type']) ? ' style="display:none;"' : '') . '>' . $field['label'] . ($field['required'] === 'yes' ? ' *' : '') . '</span></label>' . (preg_match('/^(checkbox|pre_checkbox)$/', $field['type']) ? '' : '<br />') . "\n";
                                     $custom_fields .= c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 's2member_pro_stripe_checkout[custom_fields][', 's2member-pro-stripe-checkout-custom-reg-field-', 's2member-pro-stripe-custom-reg-field-' . $field_id_class . ' s2member-pro-stripe-checkout-custom-reg-field-' . $field_id_class, '', $tabindex = $tabindex + 1, '', @$_p['s2member_pro_stripe_checkout'], @$_p['s2member_pro_stripe_checkout']['custom_fields'][$field_var], 'registration');
                                     $custom_fields .= '</div>' . "\n";
                                 }
                             }
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     if ($attr['captcha']) {
                         $captcha = '<div id="s2member-pro-stripe-checkout-form-captcha-section" class="s2member-pro-stripe-form-section s2member-pro-stripe-checkout-form-section s2member-pro-stripe-form-captcha-section s2member-pro-stripe-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="s2member-pro-stripe-checkout-form-captcha-section-title" class="s2member-pro-stripe-form-section-title s2member-pro-stripe-checkout-form-section-title s2member-pro-stripe-form-captcha-section-title s2member-pro-stripe-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="s2member-pro-stripe-checkout-form-captcha-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-checkout-form-div s2member-pro-stripe-form-captcha-div s2member-pro-stripe-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="s2member-pro-stripe-checkout-form-captcha-label" class="s2member-pro-stripe-form-captcha-label s2member-pro-stripe-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr['captcha'], 400) . "\n";
                         $captcha .= '</label>' . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '</div>' . "\n";
                     } else {
                         $captcha = '';
                     }
                     // Not applicable.
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="s2member-pro-stripe-checkout-form-custom-reg-field-opt-in-div" class="s2member-pro-stripe-form-div s2member-pro-stripe-checkout-form-div s2member-pro-stripe-form-custom-reg-field-opt-in-div s2member-pro-stripe-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="s2member-pro-stripe-checkout-form-custom-reg-field-opt-in" id="s2member-pro-stripe-checkout-form-custom-reg-field-opt-in-label" class="s2member-pro-stripe-form-custom-reg-field-opt-in-label s2member-pro-stripe-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="s2member_pro_stripe_checkout[custom_fields][opt_in]" id="s2member-pro-stripe-checkout-form-custom-reg-field-opt-in" class="s2member-pro-stripe-form-custom-reg-field-opt-in s2member-pro-stripe-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p['s2member_pro_stripe_checkout']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] == 1 || @$_p['s2member_pro_stripe_checkout']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="500" />' . "\n";
                         $opt_in .= $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label'] . "\n";
                         $opt_in .= '</label>' . "\n";
                         $opt_in .= '</div>' . "\n";
                     } else {
                         $opt_in = '';
                     }
                     // Not applicable.
                     $hidden_inputs = '<input type="hidden" name="s2member_pro_stripe_checkout[nonce]" id="s2member-pro-stripe-checkout-nonce" value="' . esc_attr(wp_create_nonce('s2member-pro-stripe-checkout')) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_checkout[source_token]" id="s2member-pro-stripe-checkout-source-token" value="' . esc_attr(@$_p['s2member_pro_stripe_checkout']['source_token']) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_checkout[source_token_summary]" id="s2member-pro-stripe-checkout-source-token-summary" value="' . esc_attr(@$_p['s2member_pro_stripe_checkout']['source_token_summary']) . '" />';
                     $hidden_inputs .= !$attr['accept_coupons'] ? '<input type="hidden" id="s2member-pro-stripe-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password'] ? '<input type="hidden" id="s2member-pro-stripe-checkout-password-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !$tax_may_apply ? '<input type="hidden" id="s2member-pro-stripe-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= $cp_attr['ta'] <= 0 && $cp_attr['ra'] <= 0 ? '<input type="hidden" id="s2member-pro-stripe-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= $is_buy_now_amount > 0 ? '<input type="hidden" id="s2member-pro-stripe-checkout-is-buy-now-amount" value="' . esc_attr($is_buy_now_amount) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_amount_in_cents > 0 ? '<input type="hidden" id="s2member-pro-stripe-checkout-is-buy-now-amount-in-cents" value="' . esc_attr($is_buy_now_amount_in_cents) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_currency ? '<input type="hidden" id="s2member-pro-stripe-checkout-is-buy-now-currency" value="' . esc_attr($is_buy_now_currency) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_desc ? '<input type="hidden" id="s2member-pro-stripe-checkout-is-buy-now-desc" value="' . esc_attr($is_buy_now_desc) . '" />' : '';
                     $hidden_inputs .= $is_buy_now_bitcoin_accepted ? '<input type="hidden" id="s2member-pro-stripe-checkout-is-buy-now-bitcoin-accepted" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_stripe_checkout[attr]" id="s2member-pro-stripe-checkout-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                     $custom_template = is_file(TEMPLATEPATH . '/stripe-checkout-form.php') ? TEMPLATEPATH . '/stripe-checkout-form.php' : '';
                     $custom_template = is_file(get_stylesheet_directory() . '/stripe-checkout-form.php') ? get_stylesheet_directory() . '/stripe-checkout-form.php' : $custom_template;
                     $custom_template = $attr['template'] && is_file(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && is_file(get_stylesheet_directory() . '/' . $attr['template']) ? get_stylesheet_directory() . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && is_file(WP_CONTENT_DIR . '/' . $attr['template']) ? WP_CONTENT_DIR . '/' . $attr['template'] : $custom_template;
                     $custom_template_contents = $custom_template ? trim(file_get_contents($custom_template)) : '';
                     if ($custom_template_contents && stripos($custom_template_contents, '%%source_token_summary%%') === FALSE) {
                         $custom_template_contents = '';
                     }
                     // Custom template must be up-to-date.
                     $code = $custom_template_contents ? $custom_template_contents : trim(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/forms/stripe-checkout-form.php'));
                     $code = trim(!$custom_template_contents || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                     $code = preg_replace('/%%action%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                     $code = preg_replace('/%%response%%/', c_ws_plugin__s2member_utils_strings::esc_refs($response['response']), $code);
                     $code = preg_replace('/%%options%%/', c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
                     $code = preg_replace('/%%description%%/', c_ws_plugin__s2member_utils_strings::esc_refs($attr['desc']), $code);
                     $code = preg_replace('/%%coupon_response%%/', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'], 'response', array('affiliates-1px-response'))), $code);
                     $code = preg_replace('/%%coupon_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit($attr['coupon'])), $code);
                     $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_checkout']['first_name'])), $code);
                     $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p['s2member_pro_stripe_checkout']['last_name'])), $code);
                     $code = preg_replace('/%%email_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['email'])), $code);
                     $code = preg_replace('/%%username_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['username'])), $code);
                     $code = preg_replace('/%%password1_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['password1'])), $code);
                     $code = preg_replace('/%%password2_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['password2'])), $code);
                     $code = preg_replace('/%%custom_fields%%/', c_ws_plugin__s2member_utils_strings::esc_refs($custom_fields), $code);
                     $code = preg_replace('/%%source_token%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_checkout']['source_token'])), $code);
                     $code = preg_replace('/%%source_token_summary%%/', c_ws_plugin__s2member_utils_strings::esc_refs(esc_html(@$_p['s2member_pro_stripe_checkout']['source_token_summary'])), $code);
                     $code = preg_replace('/%%state_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['state'])), $code);
                     $code = preg_replace('/%%country_options%%/', c_ws_plugin__s2member_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace('/%%zip_value%%/', c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p['s2member_pro_stripe_checkout']['zip'])), $code);
                     $code = preg_replace('/%%captcha%%/', c_ws_plugin__s2member_utils_strings::esc_refs($captcha), $code);
                     $code = preg_replace('/%%opt_in%%/', c_ws_plugin__s2member_utils_strings::esc_refs($opt_in), $code);
                     $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     $attr['modify'] ? do_action('ws_plugin__s2member_pro_during_sc_stripe_modification_form', get_defined_vars()) : do_action('ws_plugin__s2member_pro_during_sc_stripe_form', get_defined_vars());
                     unset($__refs, $__v);
                     // Ditch these temporary vars.
                 }
             }
         }
     }
     return apply_filters('ws_plugin__s2member_pro_sc_stripe_form', $code, get_defined_vars());
 }
Пример #20
0
 /**
  * Shortcode `[s2Member-Pro-AuthNet-Form /]`.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("s2Member-Pro-AuthNet-Form");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string The resulting Form Code, HTML markup.
  */
 public static function sc_authnet_form($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_pro_before_sc_authnet_form", get_defined_vars());
     unset($__refs, $__v);
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $options = array();
     // Initialize options to an empty array.
     $option_selections = '';
     // Initialize w/ no options.
     if ($content && ($content = strip_tags($content))) {
         // This allows for nested Pro-Form Shortcodes as options.
         $content = str_replace('s2Member-Pro-AuthNet-Form ', 's2Member-Pro-AuthNet-xFormOption ', $content);
     }
     if ($content && ($content_options = do_shortcode($content))) {
         foreach (preg_split('/\\s*\\|\\:\\:\\|\\s*/', $content_options, NULL, PREG_SPLIT_NO_EMPTY) as $_content_option_key => $_content_option) {
             $_content_option_id = $_content_option_key + 1;
             $options[$_content_option_id] = maybe_unserialize(trim($_content_option));
             if (!is_array($options[$_content_option_id])) {
                 unset($options[$_content_option_id]);
                 continue;
             }
             if (!empty($_REQUEST['s2p-option']) && (int) $_REQUEST['s2p-option'] === $_content_option_id) {
                 $options[$_content_option_id]['selected'] = TRUE;
             }
         }
         unset($_content_option_key, $_content_option, $_content_option_id);
         // Housekeeping.
         foreach ($options as $_option_id => $_option) {
             if (!empty($_option['selected'])) {
                 $attr = array_merge($attr, $_option);
                 $_selected_option_id = $_option_id;
             }
         }
         unset($_option_id, $_option);
         // Housekeeping.
         if (empty($_selected_option_id)) {
             foreach ($options as $_option_id => $_option) {
                 $attr = array_merge($attr, $_option);
                 break;
             }
         }
         // Force a selected option (default).
         unset($_option_id, $_option, $_selected_option_id);
         // Housekeeping.
         foreach ($options as $_option_id => $_option) {
             // Build option selections.
             $option_selections .= '<option value="' . esc_attr($_option_id) . '"' . (!empty($_option['selected']) ? ' selected="selected"' : '') . '>' . esc_html($_option['desc']) . '</option>';
         }
         unset($_option_id, $_option);
         // Housekeeping.
     }
     $attr = shortcode_atts(array("ids" => "0", "exp" => "72", "level" => @$attr["register"] ? "0" : "1", "ccaps" => "", "desc" => "", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "rrt" => "", "modify" => "0", "cancel" => "0", "unsub" => "0", "sp" => "0", "register" => "0", "update" => "0", "accept" => "visa,mastercard,amex,discover", "coupon" => "", "accept_coupons" => "0", "default_country_code" => "US", "captcha" => "", "template" => "", "success" => ""), $attr);
     $attr["tt"] = strtoupper($attr["tt"]);
     $attr["rt"] = strtoupper($attr["rt"]);
     $attr["rr"] = strtoupper($attr["rr"]);
     $attr["ccaps"] = strtolower($attr["ccaps"]);
     $attr["ccaps"] = str_replace(" ", "", $attr["ccaps"]);
     $attr["rr"] = $attr["rt"] === "L" ? "BN" : $attr["rr"];
     $attr["rr"] = $attr["level"] === "*" ? "BN" : $attr["rr"];
     $attr["rr"] = !$attr["tp"] && !$attr["rr"] ? "BN" : $attr["rr"];
     $attr["default_country_code"] = strtoupper($attr["default_country_code"]);
     $attr["success"] = c_ws_plugin__s2member_utils_urls::n_amps($attr["success"]);
     $attr["accept"] = trim($attr["accept"]) ? preg_split("/[;,]+/", preg_replace("/[\r\n\t\\s]+/", "", strtolower($attr["accept"]))) : array();
     $attr["accept"] = empty($attr["accept"]) ? array_merge($attr["accept"], array("visa")) : $attr["accept"];
     $attr["coupon"] = !empty($_GET["s2p-coupon"]) ? trim(strip_tags(stripslashes($_GET["s2p-coupon"]))) : $attr["coupon"];
     $attr["singular"] = get_the_ID();
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_pro_before_sc_authnet_form_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     if ($attr["cancel"]) {
         $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
         /*
         Obtain a possible response and/or validation error.
         */
         $response = c_ws_plugin__s2member_pro_authnet_responses::authnet_cancellation_response($attr);
         /*
         Empty post vars on successful response.
         */
         $_p = $response["response"] && !$response["error"] ? array() : $_p;
         /*
         Build the reCaptcha box via JavaScript.
         */
         if ($attr["captcha"]) {
             $captcha = '<div id="s2member-pro-authnet-cancellation-form-captcha-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-cancellation-form-section s2member-pro-authnet-form-captcha-section s2member-pro-authnet-cancellation-form-captcha-section">' . "\n";
             $captcha .= '<div id="s2member-pro-authnet-cancellation-form-captcha-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-cancellation-form-section-title s2member-pro-authnet-form-captcha-section-title s2member-pro-authnet-cancellation-form-captcha-section-title">' . "\n";
             $captcha .= _x("Security Verification", "s2member-front", "s2member") . "\n";
             $captcha .= '</div>' . "\n";
             $captcha .= '<div id="s2member-pro-authnet-cancellation-form-captcha-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-cancellation-form-div s2member-pro-authnet-form-captcha-div s2member-pro-authnet-cancellation-form-captcha-div">' . "\n";
             $captcha .= '<label id="s2member-pro-authnet-cancellation-form-captcha-label" class="s2member-pro-authnet-form-captcha-label s2member-pro-authnet-cancellation-form-captcha-label">' . "\n";
             $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr["captcha"], 10) . "\n";
             $captcha .= '</label>' . "\n";
             $captcha .= '</div>' . "\n";
             $captcha .= '</div>' . "\n";
         }
         /*
         Build the hidden input variables.
         */
         $hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_cancellation[nonce]" id="s2member-pro-authnet-cancellation-nonce" value="' . esc_attr(wp_create_nonce("s2member-pro-authnet-cancellation")) . '" />';
         $hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_cancellation[attr]" id="s2member-pro-authnet-cancellation-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
         $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
         /*
         Get the form template.
         */
         $custom_template = is_file(TEMPLATEPATH . "/authnet-cancellation-form.php") ? TEMPLATEPATH . "/authnet-cancellation-form.php" : '';
         $custom_template = is_file(get_stylesheet_directory() . "/authnet-cancellation-form.php") ? get_stylesheet_directory() . "/authnet-cancellation-form.php" : $custom_template;
         $custom_template = $attr["template"] && is_file(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
         $custom_template = $attr["template"] && is_file(get_stylesheet_directory() . "/" . $attr["template"]) ? get_stylesheet_directory() . "/" . $attr["template"] : $custom_template;
         $custom_template = $attr["template"] && is_file(WP_CONTENT_DIR . "/" . $attr["template"]) ? WP_CONTENT_DIR . "/" . $attr["template"] : $custom_template;
         $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/forms/authnet-cancellation-form.php"));
         $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
         /*
         Fill in the action.
         */
         $code = preg_replace("/%%action%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["REQUEST_URI"])), $code);
         /*
         Fill in the response.
         */
         $code = preg_replace("/%%response%%/", c_ws_plugin__s2member_utils_strings::esc_refs($response["response"]), $code);
         /*
         Fill in the description.
         */
         $code = preg_replace("/%%description%%/", c_ws_plugin__s2member_utils_strings::esc_refs($attr["desc"]), $code);
         /*
         Fill the captcha section.
         */
         $code = preg_replace("/%%captcha%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$captcha), $code);
         /*
         Fill hidden inputs.
         */
         $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_pro_during_sc_authnet_cancellation_form", get_defined_vars());
         unset($__refs, $__v);
     } else {
         if ($attr["register"]) {
             $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
             /*
             Obtain a possible response and/or validation error.
             */
             $response = c_ws_plugin__s2member_pro_authnet_responses::authnet_registration_response($attr);
             /*
             Empty post vars on successful response.
             */
             $_p = $response["response"] && !$response["error"] ? array() : $_p;
             /*
             Build all of the custom fields.
             */
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                 // Only display Custom Fields if configured.
                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($attr["level"], "registration")) {
                     $tabindex = 99;
                     // Start tabindex at 99 ( +1 below = 100 ).
                     $custom_fields = '<div id="s2member-pro-authnet-registration-form-custom-fields-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-registration-form-section s2member-pro-authnet-form-custom-fields-section s2member-pro-authnet-registration-form-custom-fields-section">' . "\n";
                     $custom_fields .= '<div id="s2member-pro-authnet-registration-form-custom-fields-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-registration-form-section-title s2member-pro-authnet-form-custom-fields-section-title s2member-pro-authnet-registration-form-custom-fields-section-title">' . "\n";
                     $custom_fields .= _x("Additional Info", "s2member-front", "s2member") . "\n";
                     $custom_fields .= '</div>' . "\n";
                     foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                         if (in_array($field["id"], $fields_applicable)) {
                             $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                             $field_id_class = preg_replace("/_/", "-", $field_var);
                             if (!empty($field["section"]) && $field["section"] === "yes") {
                                 // Starts a new section?
                                 $custom_fields .= '<div id="s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-divider-section" class="s2member-pro-authnet-form-div s2member-pro-authnet-registration-form-div s2member-pro-authnet-form-custom-reg-field-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . ' s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . ' s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div>';
                             }
                             $custom_fields .= '<div id="s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-registration-form-div s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-div s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                             $custom_fields .= '<label for="s2member-pro-authnet-registration-custom-reg-field-' . esc_attr($field_id_class) . '" id="s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-label" class="s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-label s2member-pro-authnet-registration-form-custom-reg-field-' . $field_id_class . '-label">' . "\n";
                             $custom_fields .= '<span' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? ' style="display:none;"' : '') . '>' . $field["label"] . ($field["required"] === "yes" ? ' *' : '') . '</span></label>' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? '' : '<br />') . "\n";
                             $custom_fields .= c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "s2member_pro_authnet_registration[custom_fields][", "s2member-pro-authnet-registration-custom-reg-field-", "s2member-pro-authnet-custom-reg-field-" . $field_id_class . " s2member-pro-authnet-registration-custom-reg-field-" . $field_id_class, "", $tabindex = $tabindex + 1, "", @$_p["s2member_pro_authnet_registration"], @$_p["s2member_pro_authnet_registration"]["custom_fields"][$field_var], "registration");
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     $custom_fields .= '</div>' . "\n";
                 }
             }
             /*
             Build the reCaptcha box via JavaScript.
             */
             if ($attr["captcha"]) {
                 $captcha = '<div id="s2member-pro-authnet-registration-form-captcha-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-registration-form-section s2member-pro-authnet-form-captcha-section s2member-pro-authnet-registration-form-captcha-section">' . "\n";
                 $captcha .= '<div id="s2member-pro-authnet-registration-form-captcha-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-registration-form-section-title s2member-pro-authnet-form-captcha-section-title s2member-pro-authnet-registration-form-captcha-section-title">' . "\n";
                 $captcha .= _x("Security Verification", "s2member-front", "s2member") . "\n";
                 $captcha .= '</div>' . "\n";
                 $captcha .= '<div id="s2member-pro-authnet-registration-form-captcha-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-registration-form-div s2member-pro-authnet-form-captcha-div s2member-pro-authnet-registration-form-captcha-div">' . "\n";
                 $captcha .= '<label id="s2member-pro-authnet-registration-form-captcha-label" class="s2member-pro-authnet-form-captcha-label s2member-pro-authnet-registration-form-captcha-label">' . "\n";
                 $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr["captcha"], 200) . "\n";
                 $captcha .= '</label>' . "\n";
                 $captcha .= '</div>' . "\n";
                 $captcha .= '</div>' . "\n";
             }
             /*
             Build the opt-in checkbox.
             */
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                 $opt_in = '<div id="s2member-pro-authnet-registration-form-custom-reg-field-opt-in-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-registration-form-div s2member-pro-authnet-form-custom-reg-field-opt-in-div s2member-pro-authnet-registration-form-custom-reg-field-opt-in-div">' . "\n";
                 $opt_in .= '<label for="s2member-pro-authnet-registration-form-custom-reg-field-opt-in" id="s2member-pro-authnet-registration-form-custom-reg-field-opt-in-label" class="s2member-pro-authnet-form-custom-reg-field-opt-in-label s2member-pro-authnet-registration-form-custom-reg-field-opt-in-label">' . "\n";
                 $opt_in .= '<input type="checkbox" name="s2member_pro_authnet_registration[custom_fields][opt_in]" id="s2member-pro-authnet-registration-form-custom-reg-field-opt-in" class="s2member-pro-authnet-form-custom-reg-field-opt-in s2member-pro-authnet-registration-form-custom-reg-field-opt-in" value="1"' . (empty($_p["s2member_pro_authnet_registration"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1 || @$_p["s2member_pro_authnet_registration"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="300" />' . "\n";
                 $opt_in .= $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
                 $opt_in .= '</label>' . "\n";
                 $opt_in .= '</div>' . "\n";
             }
             /*
             Build the hidden input variables.
             */
             $hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_registration[nonce]" id="s2member-pro-authnet-registration-nonce" value="' . esc_attr(wp_create_nonce("s2member-pro-authnet-registration")) . '" />';
             $hidden_inputs .= !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] ? '<input type="hidden" id="s2member-pro-authnet-registration-names-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] ? '<input type="hidden" id="s2member-pro-authnet-registration-password-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_registration[attr]" id="s2member-pro-authnet-registration-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
             /*
             Get the form template.
             */
             $custom_template = is_file(TEMPLATEPATH . "/authnet-registration-form.php") ? TEMPLATEPATH . "/authnet-registration-form.php" : '';
             $custom_template = is_file(get_stylesheet_directory() . "/authnet-registration-form.php") ? get_stylesheet_directory() . "/authnet-registration-form.php" : $custom_template;
             $custom_template = $attr["template"] && is_file(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
             $custom_template = $attr["template"] && is_file(get_stylesheet_directory() . "/" . $attr["template"]) ? get_stylesheet_directory() . "/" . $attr["template"] : $custom_template;
             $custom_template = $attr["template"] && is_file(WP_CONTENT_DIR . "/" . $attr["template"]) ? WP_CONTENT_DIR . "/" . $attr["template"] : $custom_template;
             $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/forms/authnet-registration-form.php"));
             $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
             /*
             Fill in the action.
             */
             $code = preg_replace("/%%action%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["REQUEST_URI"])), $code);
             /*
             Fill in the response.
             */
             $code = preg_replace("/%%response%%/", c_ws_plugin__s2member_utils_strings::esc_refs($response["response"]), $code);
             /*
             Fill in the option selections.
             */
             $code = preg_replace("/%%options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
             /*
             Fill in the description.
             */
             $code = preg_replace("/%%description%%/", c_ws_plugin__s2member_utils_strings::esc_refs($attr["desc"]), $code);
             /*
             Fill in the registration section.
             */
             $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_registration"]["first_name"])), $code);
             $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_registration"]["last_name"])), $code);
             $code = preg_replace("/%%email_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_registration"]["email"])), $code);
             $code = preg_replace("/%%username_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_registration"]["username"])), $code);
             $code = preg_replace("/%%password1_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_registration"]["password1"])), $code);
             $code = preg_replace("/%%password2_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_registration"]["password2"])), $code);
             /*
             Fill in the custom fields section.
             */
             $code = preg_replace("/%%custom_fields%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$custom_fields), $code);
             /*
             Fill the captcha section.
             */
             $code = preg_replace("/%%captcha%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$captcha), $code);
             /*
             Fill the opt-in box.
             */
             $code = preg_replace("/%%opt_in%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$opt_in), $code);
             /*
             Fill hidden inputs.
             */
             $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_pro_during_sc_authnet_registration_form", get_defined_vars());
             unset($__refs, $__v);
         } else {
             if ($attr["update"]) {
                 $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                 /*
                 Obtain a possible response and/or validation error.
                 */
                 $response = c_ws_plugin__s2member_pro_authnet_responses::authnet_update_response($attr);
                 /*
                 Empty post vars on successful response.
                 */
                 $_p = $response["response"] && !$response["error"] ? array() : $_p;
                 /*
                 Build the list of card type options.
                 */
                 $card_type_options = '';
                 // Initialize.
                 foreach (array("Visa" => _x("Visa", "s2member-front", "s2member"), "MasterCard" => _x("MasterCard", "s2member-front", "s2member"), "Discover" => _x("Discover", "s2member-front", "s2member"), "Amex" => _x("American Express", "s2member-front", "s2member")) as $card_type_v => $card_type_l) {
                     $card_type_options .= '<label for="s2member-pro-authnet-update-card-type-' . esc_attr(strtolower($card_type_v)) . '" id="s2member-pro-authnet-update-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label" class="s2member-pro-authnet-form-card-type-label s2member-pro-authnet-update-form-card-type-label s2member-pro-authnet-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label s2member-pro-authnet-update-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label' . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled' : '') . '">' . "\n" . '<input type="radio" aria-required="true" name="s2member_pro_authnet_update[card_type]" id="s2member-pro-authnet-update-card-type-' . esc_attr(strtolower($card_type_v)) . '" class="s2member-pro-authnet-card-type-' . esc_attr(strtolower($card_type_v)) . ' s2member-pro-authnet-update-card-type-' . esc_attr(strtolower($card_type_v)) . '" value="' . esc_attr($card_type_v) . '"' . (!empty($_p["s2member_pro_authnet_update"]["card_type"]) && in_array(strtolower($_p["s2member_pro_authnet_update"]["card_type"]), $attr["accept"]) && $_p["s2member_pro_authnet_update"]["card_type"] === $card_type_v ? ' checked="checked"' : '') . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled="disabled"' : '') . ' tabindex="10" />' . "\n" . '</label>';
                 }
                 /*
                 Build the list of expiration date options.
                 */
                 $card_expiration_month_options = '<option value=""></option>';
                 // Start with an empty option value.
                 $card_expiration_year_options = '<option value=""></option>';
                 // Start with an empty option value.
                 foreach (array("01" => _x("01 January", "s2member-front", "s2member"), "02" => _x("02 February", "s2member-front", "s2member"), "03" => _x("03 March", "s2member-front", "s2member"), "04" => _x("04 April", "s2member-front", "s2member"), "05" => _x("05 May", "s2member-front", "s2member"), "06" => _x("06 June", "s2member-front", "s2member"), "07" => _x("07 July", "s2member-front", "s2member"), "08" => _x("08 August", "s2member-front", "s2member"), "09" => _x("09 September", "s2member-front", "s2member"), "10" => _x("10 October", "s2member-front", "s2member"), "11" => _x("11 November", "s2member-front", "s2member"), "12" => _x("12 December", "s2member-front", "s2member")) as $month => $month_label) {
                     $card_expiration_month_options .= '<option value="' . esc_attr($month) . '"' . (@$_p["s2member_pro_authnet_update"]["card_expiration_month"] === (string) $month ? ' selected="selected"' : '') . '>' . esc_html($month_label) . '</option>';
                 }
                 unset($month, $month_label);
                 // Housekeeping.
                 for ($i = 0, $year = date("Y"); $i < 50; $i++) {
                     // Current year; and then go 50 years into the future.
                     $card_expiration_year_options .= '<option value="' . esc_attr($year + $i) . '"' . (@$_p["s2member_pro_authnet_update"]["card_expiration_year"] === (string) ($year + $i) ? ' selected="selected"' : '') . '>' . esc_html($year + $i) . '</option>';
                 }
                 unset($i, $year);
                 // Housekeeping.
                 /*
                 Build the list of country code options.
                 */
                 $country_default_by_currency = !@$_p["s2member_pro_authnet_update"]["country"] && $attr["cc"] === "USD" ? "US" : "";
                 $country_default_by_currency = !@$_p["s2member_pro_authnet_update"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                 $country_default_by_currency = !@$_p["s2member_pro_authnet_update"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                 $country_default_by_currency = apply_filters("ws_plugin__s2member_pro_authnet_default_country", $country_default_by_currency, get_defined_vars());
                 $default_country_v = $attr["default_country_code"] ? $attr["default_country_code"] : $country_default_by_currency;
                 $country_options = '<option value=""></option>';
                 // Start with an empty option value.
                 foreach (preg_split("/[\r\n]+/", file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/iso-3166-1.txt")) as $country) {
                     list($country_l, $country_v) = preg_split("/;/", $country, 2);
                     if ($country_l && $country_v) {
                         // Here we also check on the default pre-selected country; as determined above; based on currency.
                         $country_options .= '<option value="' . esc_attr(strtoupper($country_v)) . '"' . (@$_p["s2member_pro_authnet_update"]["country"] === $country_v || $default_country_v === $country_v ? ' selected="selected"' : '') . '>' . esc_html(ucwords(strtolower($country_l))) . '</option>';
                     }
                 }
                 /*
                 Build the reCaptcha box via JavaScript.
                 */
                 if ($attr["captcha"]) {
                     $captcha = '<div id="s2member-pro-authnet-update-form-captcha-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-update-form-section s2member-pro-authnet-form-captcha-section s2member-pro-authnet-update-form-captcha-section">' . "\n";
                     $captcha .= '<div id="s2member-pro-authnet-update-form-captcha-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-update-form-section-title s2member-pro-authnet-form-captcha-section-title s2member-pro-authnet-update-form-captcha-section-title">' . "\n";
                     $captcha .= _x("Security Verification", "s2member-front", "s2member") . "\n";
                     $captcha .= '</div>' . "\n";
                     $captcha .= '<div id="s2member-pro-authnet-update-form-captcha-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-update-form-div s2member-pro-authnet-form-captcha-div s2member-pro-authnet-update-form-captcha-div">' . "\n";
                     $captcha .= '<label id="s2member-pro-authnet-update-form-captcha-label" class="s2member-pro-authnet-form-captcha-label s2member-pro-authnet-update-form-captcha-label">' . "\n";
                     $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr["captcha"], 200) . "\n";
                     $captcha .= '</label>' . "\n";
                     $captcha .= '</div>' . "\n";
                     $captcha .= '</div>' . "\n";
                 }
                 /*
                 Build the hidden input variables.
                 */
                 $hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_update[nonce]" id="s2member-pro-authnet-update-nonce" value="' . esc_attr(wp_create_nonce("s2member-pro-authnet-update")) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_update[attr]" id="s2member-pro-authnet-update-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
                 /*
                 Get the form template.
                 */
                 $custom_template = is_file(TEMPLATEPATH . "/authnet-update-form.php") ? TEMPLATEPATH . "/authnet-update-form.php" : '';
                 $custom_template = is_file(get_stylesheet_directory() . "/authnet-update-form.php") ? get_stylesheet_directory() . "/authnet-update-form.php" : $custom_template;
                 $custom_template = $attr["template"] && is_file(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                 $custom_template = $attr["template"] && is_file(get_stylesheet_directory() . "/" . $attr["template"]) ? get_stylesheet_directory() . "/" . $attr["template"] : $custom_template;
                 $custom_template = $attr["template"] && is_file(WP_CONTENT_DIR . "/" . $attr["template"]) ? WP_CONTENT_DIR . "/" . $attr["template"] : $custom_template;
                 $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/forms/authnet-update-form.php"));
                 $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                 /*
                 Fill in the action.
                 */
                 $code = preg_replace("/%%action%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["REQUEST_URI"])), $code);
                 /*
                 Fill in the response.
                 */
                 $code = preg_replace("/%%response%%/", c_ws_plugin__s2member_utils_strings::esc_refs($response["response"]), $code);
                 /*
                 Fill in the description.
                 */
                 $code = preg_replace("/%%description%%/", c_ws_plugin__s2member_utils_strings::esc_refs($attr["desc"]), $code);
                 /*
                 Fill in the billing method section.
                 */
                 $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_type_options), $code);
                 $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["card_number"])), $code);
                 $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["card_expiration"])), $code);
                 $code = preg_replace("/%%card_expiration_month_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_month_options), $code);
                 $code = preg_replace("/%%card_expiration_year_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_year_options), $code);
                 $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["card_verification"])), $code);
                 $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["card_start_date_issue_number"])), $code);
                 /*
                 Fill in the billing address section.
                 */
                 $code = preg_replace("/%%street_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["street"])), $code);
                 $code = preg_replace("/%%city_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["city"])), $code);
                 $code = preg_replace("/%%state_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["state"])), $code);
                 $code = preg_replace("/%%country_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($country_options), $code);
                 $code = preg_replace("/%%zip_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_update"]["zip"])), $code);
                 /*
                 Fill the captcha section.
                 */
                 $code = preg_replace("/%%captcha%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$captcha), $code);
                 /*
                 Fill hidden inputs.
                 */
                 $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_pro_during_sc_authnet_update_form", get_defined_vars());
                 unset($__refs, $__v);
             } else {
                 if ($attr["sp"]) {
                     $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                     /*
                     Configure internal attributes.
                     */
                     $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
                     // Combined `sp:ids:expiration hours`.
                     $attr["coupon"] = @$_p["s2member_pro_authnet_sp_checkout"]["coupon"] ? $_p["s2member_pro_authnet_sp_checkout"]["coupon"] : $attr["coupon"];
                     /*
                     Obtain a possible response and/or validation error.
                     */
                     $response = c_ws_plugin__s2member_pro_authnet_responses::authnet_sp_checkout_response($attr);
                     /*
                     Empty post vars on successful response.
                     */
                     $_p = $response["response"] && !$response["error"] ? array() : $_p;
                     /*
                     Build the list of card type options.
                     */
                     $card_type_options = '<input type="radio" name="s2member_pro_authnet_sp_checkout[card_type]" id="s2member-pro-authnet-sp-checkout-card-type-free" class="s2member-pro-authnet-card-type-free s2member-pro-authnet-sp-checkout-card-type-free" value="Free" tabindex="-1" style="display:none;" />' . "\n";
                     foreach (array("Visa" => _x("Visa", "s2member-front", "s2member"), "MasterCard" => _x("MasterCard", "s2member-front", "s2member"), "Discover" => _x("Discover", "s2member-front", "s2member"), "Amex" => _x("American Express", "s2member-front", "s2member")) as $card_type_v => $card_type_l) {
                         $card_type_options .= '<label for="s2member-pro-authnet-sp-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" id="s2member-pro-authnet-sp-checkout-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label" class="s2member-pro-authnet-form-card-type-label s2member-pro-authnet-sp-checkout-form-card-type-label s2member-pro-authnet-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label s2member-pro-authnet-sp-checkout-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label' . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled' : '') . '">' . "\n" . '<input type="radio" aria-required="true" name="s2member_pro_authnet_sp_checkout[card_type]" id="s2member-pro-authnet-sp-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" class="s2member-pro-authnet-card-type-' . esc_attr(strtolower($card_type_v)) . ' s2member-pro-authnet-sp-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" value="' . esc_attr($card_type_v) . '"' . (!empty($_p["s2member_pro_authnet_sp_checkout"]["card_type"]) && in_array(strtolower($_p["s2member_pro_authnet_sp_checkout"]["card_type"]), $attr["accept"]) && $_p["s2member_pro_authnet_sp_checkout"]["card_type"] === $card_type_v ? ' checked="checked"' : '') . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled="disabled"' : '') . ' tabindex="100" />' . "\n" . '</label>';
                     }
                     /*
                     Build the list of expiration date options.
                     */
                     $card_expiration_month_options = '<option value=""></option>';
                     // Start with an empty option value.
                     $card_expiration_year_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (array("01" => _x("01 January", "s2member-front", "s2member"), "02" => _x("02 February", "s2member-front", "s2member"), "03" => _x("03 March", "s2member-front", "s2member"), "04" => _x("04 April", "s2member-front", "s2member"), "05" => _x("05 May", "s2member-front", "s2member"), "06" => _x("06 June", "s2member-front", "s2member"), "07" => _x("07 July", "s2member-front", "s2member"), "08" => _x("08 August", "s2member-front", "s2member"), "09" => _x("09 September", "s2member-front", "s2member"), "10" => _x("10 October", "s2member-front", "s2member"), "11" => _x("11 November", "s2member-front", "s2member"), "12" => _x("12 December", "s2member-front", "s2member")) as $month => $month_label) {
                         $card_expiration_month_options .= '<option value="' . esc_attr($month) . '"' . (@$_p["s2member_pro_authnet_sp_checkout"]["card_expiration_month"] === (string) $month ? ' selected="selected"' : '') . '>' . esc_html($month_label) . '</option>';
                     }
                     unset($month, $month_label);
                     // Housekeeping.
                     for ($i = 0, $year = date("Y"); $i < 50; $i++) {
                         // Current year; and then go 50 years into the future.
                         $card_expiration_year_options .= '<option value="' . esc_attr($year + $i) . '"' . (@$_p["s2member_pro_authnet_sp_checkout"]["card_expiration_year"] === (string) ($year + $i) ? ' selected="selected"' : '') . '>' . esc_html($year + $i) . '</option>';
                     }
                     unset($i, $year);
                     // Housekeeping.
                     /*
                     Build the list of country code options.
                     */
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "USD" ? "US" : "";
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                     $country_default_by_currency = apply_filters("ws_plugin__s2member_pro_authnet_default_country", $country_default_by_currency, get_defined_vars());
                     $default_country_v = $attr["default_country_code"] ? $attr["default_country_code"] : $country_default_by_currency;
                     $country_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (preg_split("/[\r\n]+/", file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/iso-3166-1.txt")) as $country) {
                         list($country_l, $country_v) = preg_split("/;/", $country, 2);
                         if ($country_l && $country_v) {
                             // Here we also check on the default pre-selected country; as determined above; based on currency.
                             $country_options .= '<option value="' . esc_attr(strtoupper($country_v)) . '"' . (@$_p["s2member_pro_authnet_sp_checkout"]["country"] === $country_v || $default_country_v === $country_v ? ' selected="selected"' : '') . '>' . esc_html(ucwords(strtolower($country_l))) . '</option>';
                         }
                     }
                     /*
                     Build the reCaptcha box via JavaScript.
                     */
                     if ($attr["captcha"]) {
                         $captcha = '<div id="s2member-pro-authnet-sp-checkout-form-captcha-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-sp-checkout-form-section s2member-pro-authnet-form-captcha-section s2member-pro-authnet-sp-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="s2member-pro-authnet-sp-checkout-form-captcha-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-sp-checkout-form-section-title s2member-pro-authnet-form-captcha-section-title s2member-pro-authnet-sp-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x("Security Verification", "s2member-front", "s2member") . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="s2member-pro-authnet-sp-checkout-form-captcha-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-sp-checkout-form-div s2member-pro-authnet-form-captcha-div s2member-pro-authnet-sp-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="s2member-pro-authnet-sp-checkout-form-captcha-label" class="s2member-pro-authnet-form-captcha-label s2member-pro-authnet-sp-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr["captcha"], 300) . "\n";
                         $captcha .= '</label>' . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '</div>' . "\n";
                     }
                     /*
                     Build the opt-in checkbox.
                     */
                     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-sp-checkout-form-div s2member-pro-authnet-form-custom-reg-field-opt-in-div s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in" id="s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in-label" class="s2member-pro-authnet-form-custom-reg-field-opt-in-label s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="s2member_pro_authnet_sp_checkout[custom_fields][opt_in]" id="s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in" class="s2member-pro-authnet-form-custom-reg-field-opt-in s2member-pro-authnet-sp-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p["s2member_pro_authnet_sp_checkout"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1 || @$_p["s2member_pro_authnet_sp_checkout"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="400" />' . "\n";
                         $opt_in .= $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
                         $opt_in .= '</label>' . "\n";
                         $opt_in .= '</div>' . "\n";
                     }
                     /*
                     Build the hidden input variables.
                     */
                     $hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_sp_checkout[nonce]" id="s2member-pro-authnet-sp-checkout-nonce" value="' . esc_attr(wp_create_nonce("s2member-pro-authnet-sp-checkout")) . '" />';
                     $hidden_inputs .= !$attr["accept_coupons"] ? '<input type="hidden" id="s2member-pro-authnet-sp-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !c_ws_plugin__s2member_pro_authnet_utilities::authnet_tax_may_apply() ? '<input type="hidden" id="s2member-pro-authnet-sp-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= ($cp_attr = c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"])) && $cp_attr["ta"] <= 0.0 && $cp_attr["ra"] <= 0.0 ? '<input type="hidden" id="s2member-pro-authnet-sp-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_sp_checkout[attr]" id="s2member-pro-authnet-sp-checkout-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                     /*
                     Get the form template.
                     */
                     $custom_template = is_file(TEMPLATEPATH . "/authnet-sp-checkout-form.php") ? TEMPLATEPATH . "/authnet-sp-checkout-form.php" : '';
                     $custom_template = is_file(get_stylesheet_directory() . "/authnet-sp-checkout-form.php") ? get_stylesheet_directory() . "/authnet-sp-checkout-form.php" : $custom_template;
                     $custom_template = $attr["template"] && is_file(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && is_file(get_stylesheet_directory() . "/" . $attr["template"]) ? get_stylesheet_directory() . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && is_file(WP_CONTENT_DIR . "/" . $attr["template"]) ? WP_CONTENT_DIR . "/" . $attr["template"] : $custom_template;
                     $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/forms/authnet-sp-checkout-form.php"));
                     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                     /*
                     Fill in the action.
                     */
                     $code = preg_replace("/%%action%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["REQUEST_URI"])), $code);
                     /*
                     Fill in the response.
                     */
                     $code = preg_replace("/%%response%%/", c_ws_plugin__s2member_utils_strings::esc_refs($response["response"]), $code);
                     /*
                     Fill in the option selections.
                     */
                     $code = preg_replace("/%%options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
                     /*
                     Fill in the description.
                     */
                     $code = preg_replace("/%%description%%/", c_ws_plugin__s2member_utils_strings::esc_refs($attr["desc"]), $code);
                     /*
                     Fill in the coupon value.
                     */
                     $code = preg_replace("/%%coupon_response%%/", c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"], "response", array("affiliates-1px-response"))), $code);
                     $code = preg_replace("/%%coupon_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit($attr["coupon"])), $code);
                     /*
                     Fill in the registration section.
                     */
                     $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_sp_checkout"]["first_name"])), $code);
                     $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_sp_checkout"]["last_name"])), $code);
                     $code = preg_replace("/%%email_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["email"])), $code);
                     /*
                     Fill in the billing method section.
                     */
                     $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_type_options), $code);
                     $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["card_number"])), $code);
                     $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["card_expiration"])), $code);
                     $code = preg_replace("/%%card_expiration_month_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_month_options), $code);
                     $code = preg_replace("/%%card_expiration_year_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_year_options), $code);
                     $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["card_verification"])), $code);
                     $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["card_start_date_issue_number"])), $code);
                     /*
                     Fill in the billing address section.
                     */
                     $code = preg_replace("/%%street_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["street"])), $code);
                     $code = preg_replace("/%%city_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["city"])), $code);
                     $code = preg_replace("/%%state_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["state"])), $code);
                     $code = preg_replace("/%%country_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace("/%%zip_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_sp_checkout"]["zip"])), $code);
                     /*
                     Fill the captcha section.
                     */
                     $code = preg_replace("/%%captcha%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$captcha), $code);
                     /*
                     Fill the opt-in box.
                     */
                     $code = preg_replace("/%%opt_in%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$opt_in), $code);
                     /*
                     Fill hidden inputs.
                     */
                     $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_pro_during_sc_authnet_sp_form", get_defined_vars());
                     unset($__refs, $__v);
                 } else {
                     $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
                     /*
                     Configure internal attributes.
                     */
                     $attr["level_ccaps_eotper"] = $attr["rr"] === "BN" && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                     $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                     // Clean any trailing separators from this string.
                     $attr["coupon"] = @$_p["s2member_pro_authnet_checkout"]["coupon"] ? $_p["s2member_pro_authnet_checkout"]["coupon"] : $attr["coupon"];
                     /*
                     Obtain a possible response and/or validation error.
                     */
                     $response = c_ws_plugin__s2member_pro_authnet_responses::authnet_checkout_response($attr);
                     /*
                     Empty post vars on successful response.
                     */
                     $_p = $response["response"] && !$response["error"] ? array() : $_p;
                     /*
                     Build the list of card type options.
                     */
                     $card_type_options = '<input type="radio" name="s2member_pro_authnet_checkout[card_type]" id="s2member-pro-authnet-checkout-card-type-free" class="s2member-pro-authnet-card-type-free s2member-pro-authnet-checkout-card-type-free" value="Free" tabindex="-1" style="display:none;" />' . "\n";
                     foreach (array("Visa" => _x("Visa", "s2member-front", "s2member"), "MasterCard" => _x("MasterCard", "s2member-front", "s2member"), "Discover" => _x("Discover", "s2member-front", "s2member"), "Amex" => _x("American Express", "s2member-front", "s2member")) as $card_type_v => $card_type_l) {
                         $card_type_options .= '<label for="s2member-pro-authnet-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" id="s2member-pro-authnet-checkout-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label" class="s2member-pro-authnet-form-card-type-label s2member-pro-authnet-checkout-form-card-type-label s2member-pro-authnet-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label s2member-pro-authnet-checkout-form-card-type-' . esc_attr(strtolower($card_type_v)) . '-label' . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled' : '') . '">' . "\n" . '<input type="radio" aria-required="true" name="s2member_pro_authnet_checkout[card_type]" id="s2member-pro-authnet-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" class="s2member-pro-authnet-card-type-' . esc_attr(strtolower($card_type_v)) . ' s2member-pro-authnet-checkout-card-type-' . esc_attr(strtolower($card_type_v)) . '" value="' . esc_attr($card_type_v) . '"' . (!empty($_p["s2member_pro_authnet_checkout"]["card_type"]) && in_array(strtolower($_p["s2member_pro_authnet_checkout"]["card_type"]), $attr["accept"]) && $_p["s2member_pro_authnet_checkout"]["card_type"] === $card_type_v ? ' checked="checked"' : '') . (!in_array(strtolower($card_type_v), $attr["accept"]) ? ' disabled="disabled"' : '') . ' tabindex="200" />' . "\n" . '</label>';
                     }
                     /*
                     Build the list of expiration date options.
                     */
                     $card_expiration_month_options = '<option value=""></option>';
                     // Start with an empty option value.
                     $card_expiration_year_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (array("01" => _x("01 January", "s2member-front", "s2member"), "02" => _x("02 February", "s2member-front", "s2member"), "03" => _x("03 March", "s2member-front", "s2member"), "04" => _x("04 April", "s2member-front", "s2member"), "05" => _x("05 May", "s2member-front", "s2member"), "06" => _x("06 June", "s2member-front", "s2member"), "07" => _x("07 July", "s2member-front", "s2member"), "08" => _x("08 August", "s2member-front", "s2member"), "09" => _x("09 September", "s2member-front", "s2member"), "10" => _x("10 October", "s2member-front", "s2member"), "11" => _x("11 November", "s2member-front", "s2member"), "12" => _x("12 December", "s2member-front", "s2member")) as $month => $month_label) {
                         $card_expiration_month_options .= '<option value="' . esc_attr($month) . '"' . (@$_p["s2member_pro_authnet_checkout"]["card_expiration_month"] === (string) $month ? ' selected="selected"' : '') . '>' . esc_html($month_label) . '</option>';
                     }
                     unset($month, $month_label);
                     // Housekeeping.
                     for ($i = 0, $year = date("Y"); $i < 50; $i++) {
                         // Current year; and then go 50 years into the future.
                         $card_expiration_year_options .= '<option value="' . esc_attr($year + $i) . '"' . (@$_p["s2member_pro_authnet_checkout"]["card_expiration_year"] === (string) ($year + $i) ? ' selected="selected"' : '') . '>' . esc_html($year + $i) . '</option>';
                     }
                     unset($i, $year);
                     // Housekeeping.
                     /*
                     Build the list of country code options.
                     */
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_checkout"]["country"] && $attr["cc"] === "USD" ? "US" : "";
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_checkout"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                     $country_default_by_currency = !@$_p["s2member_pro_authnet_checkout"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                     $country_default_by_currency = apply_filters("ws_plugin__s2member_pro_authnet_default_country", $country_default_by_currency, get_defined_vars());
                     $default_country_v = $attr["default_country_code"] ? $attr["default_country_code"] : $country_default_by_currency;
                     $country_options = '<option value=""></option>';
                     // Start with an empty option value.
                     foreach (preg_split("/[\r\n]+/", file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/iso-3166-1.txt")) as $country) {
                         list($country_l, $country_v) = preg_split("/;/", $country, 2);
                         if ($country_l && $country_v) {
                             // Here we also check on the default pre-selected country; as determined above; based on currency.
                             $country_options .= '<option value="' . esc_attr(strtoupper($country_v)) . '"' . (@$_p["s2member_pro_authnet_checkout"]["country"] === $country_v || $default_country_v === $country_v ? ' selected="selected"' : '') . '>' . esc_html(ucwords(strtolower($country_l))) . '</option>';
                         }
                     }
                     /*
                     Build all of the custom fields.
                     */
                     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                         // Only display Custom Fields if configured.
                         if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($attr["level"] === "*" ? "auto-detection" : $attr["level"], "registration")) {
                             $tabindex = 99;
                             // Start tabindex at 99 ( +1 below = 100 ).
                             $custom_fields = '<div id="s2member-pro-authnet-checkout-form-custom-fields-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-checkout-form-section s2member-pro-authnet-form-custom-fields-section s2member-pro-authnet-checkout-form-custom-fields-section">' . "\n";
                             $custom_fields .= '<div id="s2member-pro-authnet-checkout-form-custom-fields-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-checkout-form-section-title s2member-pro-authnet-form-custom-fields-section-title s2member-pro-authnet-checkout-form-custom-fields-section-title">' . "\n";
                             $custom_fields .= _x("Additional Info", "s2member-front", "s2member") . "\n";
                             $custom_fields .= '</div>' . "\n";
                             foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                                 if (in_array($field["id"], $fields_applicable)) {
                                     $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                                     $field_id_class = preg_replace("/_/", "-", $field_var);
                                     if (!empty($field["section"]) && $field["section"] === "yes") {
                                         // Starts a new section?
                                         $custom_fields .= '<div id="s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-divider-section" class="s2member-pro-authnet-form-div s2member-pro-authnet-checkout-form-div s2member-pro-authnet-form-custom-reg-field-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . ' s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . ' s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div>';
                                     }
                                     $custom_fields .= '<div id="s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-checkout-form-div s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-div s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                                     $custom_fields .= '<label for="s2member-pro-authnet-checkout-custom-reg-field-' . esc_attr($field_id_class) . '" id="s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-label" class="s2member-pro-authnet-form-custom-reg-field-' . $field_id_class . '-label s2member-pro-authnet-checkout-form-custom-reg-field-' . $field_id_class . '-label">' . "\n";
                                     $custom_fields .= '<span' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? ' style="display:none;"' : '') . '>' . $field["label"] . ($field["required"] === "yes" ? ' *' : '') . '</span></label>' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? '' : '<br />') . "\n";
                                     $custom_fields .= c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "s2member_pro_authnet_checkout[custom_fields][", "s2member-pro-authnet-checkout-custom-reg-field-", "s2member-pro-authnet-custom-reg-field-" . $field_id_class . " s2member-pro-authnet-checkout-custom-reg-field-" . $field_id_class, "", $tabindex = $tabindex + 1, "", @$_p["s2member_pro_authnet_checkout"], @$_p["s2member_pro_authnet_checkout"]["custom_fields"][$field_var], "registration");
                                     $custom_fields .= '</div>' . "\n";
                                 }
                             }
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     /*
                     Build the reCaptcha box via JavaScript.
                     */
                     if ($attr["captcha"]) {
                         $captcha = '<div id="s2member-pro-authnet-checkout-form-captcha-section" class="s2member-pro-authnet-form-section s2member-pro-authnet-checkout-form-section s2member-pro-authnet-form-captcha-section s2member-pro-authnet-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="s2member-pro-authnet-checkout-form-captcha-section-title" class="s2member-pro-authnet-form-section-title s2member-pro-authnet-checkout-form-section-title s2member-pro-authnet-form-captcha-section-title s2member-pro-authnet-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x("Security Verification", "s2member-front", "s2member") . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="s2member-pro-authnet-checkout-form-captcha-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-checkout-form-div s2member-pro-authnet-form-captcha-div s2member-pro-authnet-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="s2member-pro-authnet-checkout-form-captcha-label" class="s2member-pro-authnet-form-captcha-label s2member-pro-authnet-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__s2member_utils_captchas::recaptcha_script_tag($attr["captcha"], 400) . "\n";
                         $captcha .= '</label>' . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '</div>' . "\n";
                     }
                     /*
                     Build the opt-in checkbox.
                     */
                     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="s2member-pro-authnet-checkout-form-custom-reg-field-opt-in-div" class="s2member-pro-authnet-form-div s2member-pro-authnet-checkout-form-div s2member-pro-authnet-form-custom-reg-field-opt-in-div s2member-pro-authnet-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="s2member-pro-authnet-checkout-form-custom-reg-field-opt-in" id="s2member-pro-authnet-checkout-form-custom-reg-field-opt-in-label" class="s2member-pro-authnet-form-custom-reg-field-opt-in-label s2member-pro-authnet-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="s2member_pro_authnet_checkout[custom_fields][opt_in]" id="s2member-pro-authnet-checkout-form-custom-reg-field-opt-in" class="s2member-pro-authnet-form-custom-reg-field-opt-in s2member-pro-authnet-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p["s2member_pro_authnet_checkout"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1 || @$_p["s2member_pro_authnet_checkout"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="500" />' . "\n";
                         $opt_in .= $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
                         $opt_in .= '</label>' . "\n";
                         $opt_in .= '</div>' . "\n";
                     }
                     /*
                     Build the hidden input variables.
                     */
                     $hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_checkout[nonce]" id="s2member-pro-authnet-checkout-nonce" value="' . esc_attr(wp_create_nonce("s2member-pro-authnet-checkout")) . '" />';
                     $hidden_inputs .= !$attr["accept_coupons"] ? '<input type="hidden" id="s2member-pro-authnet-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] ? '<input type="hidden" id="s2member-pro-authnet-checkout-password-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !c_ws_plugin__s2member_pro_authnet_utilities::authnet_tax_may_apply() ? '<input type="hidden" id="s2member-pro-authnet-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= ($cp_attr = c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"])) && $cp_attr["ta"] <= 0.0 && $cp_attr["ra"] <= 0.0 ? '<input type="hidden" id="s2member-pro-authnet-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_checkout[attr]" id="s2member-pro-authnet-checkout-attr" value="' . esc_attr(c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr))) . '" />';
                     /*
                     Get the form template.
                     */
                     $custom_template = is_file(TEMPLATEPATH . "/authnet-checkout-form.php") ? TEMPLATEPATH . "/authnet-checkout-form.php" : '';
                     $custom_template = is_file(get_stylesheet_directory() . "/authnet-checkout-form.php") ? get_stylesheet_directory() . "/authnet-checkout-form.php" : $custom_template;
                     $custom_template = $attr["template"] && is_file(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && is_file(get_stylesheet_directory() . "/" . $attr["template"]) ? get_stylesheet_directory() . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && is_file(WP_CONTENT_DIR . "/" . $attr["template"]) ? WP_CONTENT_DIR . "/" . $attr["template"] : $custom_template;
                     $code = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/forms/authnet-checkout-form.php"));
                     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
                     /*
                     Fill in the action.
                     */
                     $code = preg_replace("/%%action%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["REQUEST_URI"])), $code);
                     /*
                     Fill in the response.
                     */
                     $code = preg_replace("/%%response%%/", c_ws_plugin__s2member_utils_strings::esc_refs($response["response"]), $code);
                     /*
                     Fill in the option selections.
                     */
                     $code = preg_replace("/%%options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($option_selections), $code);
                     /*
                     Fill in the description.
                     */
                     $code = preg_replace("/%%description%%/", c_ws_plugin__s2member_utils_strings::esc_refs($attr["desc"]), $code);
                     /*
                     Fill in the coupon value.
                     */
                     $code = preg_replace("/%%coupon_response%%/", c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"], "response", array("affiliates-1px-response"))), $code);
                     $code = preg_replace("/%%coupon_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit($attr["coupon"])), $code);
                     /*
                     Fill in the registration section.
                     */
                     $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_checkout"]["first_name"])), $code);
                     $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(@$_p["s2member_pro_authnet_checkout"]["last_name"])), $code);
                     $code = preg_replace("/%%email_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["email"])), $code);
                     $code = preg_replace("/%%username_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["username"])), $code);
                     $code = preg_replace("/%%password1_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["password1"])), $code);
                     $code = preg_replace("/%%password2_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["password2"])), $code);
                     /*
                     Fill in the custom fields section.
                     */
                     $code = preg_replace("/%%custom_fields%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$custom_fields), $code);
                     /*
                     Fill in the billing method section.
                     */
                     $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_type_options), $code);
                     $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["card_number"])), $code);
                     $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["card_expiration"])), $code);
                     $code = preg_replace("/%%card_expiration_month_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_month_options), $code);
                     $code = preg_replace("/%%card_expiration_year_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($card_expiration_year_options), $code);
                     $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["card_verification"])), $code);
                     $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["card_start_date_issue_number"])), $code);
                     /*
                     Fill in the billing address section.
                     */
                     $code = preg_replace("/%%street_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["street"])), $code);
                     $code = preg_replace("/%%city_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["city"])), $code);
                     $code = preg_replace("/%%state_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["state"])), $code);
                     $code = preg_replace("/%%country_options%%/", c_ws_plugin__s2member_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace("/%%zip_value%%/", c_ws_plugin__s2member_utils_strings::esc_refs(format_to_edit(@$_p["s2member_pro_authnet_checkout"]["zip"])), $code);
                     /*
                     Fill the captcha section.
                     */
                     $code = preg_replace("/%%captcha%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$captcha), $code);
                     /*
                     Fill the opt-in box.
                     */
                     $code = preg_replace("/%%opt_in%%/", c_ws_plugin__s2member_utils_strings::esc_refs(@$opt_in), $code);
                     /*
                     Fill hidden inputs.
                     */
                     $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__s2member_utils_strings::esc_refs($hidden_inputs), $code);
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     $attr["modify"] ? do_action("ws_plugin__s2member_pro_during_sc_authnet_modification_form", get_defined_vars()) : do_action("ws_plugin__s2member_pro_during_sc_authnet_form", get_defined_vars());
                     unset($__refs, $__v);
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_pro_sc_authnet_form", $code, get_defined_vars());
 }
 /**
  * Handles IP Restrictions.
  *
  * IP address details are stored as Transients.
  *
  * @package s2Member\IP_Restrictions
  * @since 3.5
  *
  * @param string $ip IP Address.
  * @param string $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
  * @return bool True if IP Restrictions are OK, otherwise this function will exit script execution after issuing a warning.
  */
 public static function ip_restrictions_ok($ip = FALSE, $restriction = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars());
     unset($__refs, $__v);
     if (!apply_filters("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars()) && !apply_filters("ws_plugin__s2member_disable_specific_ip_restriction", false, get_defined_vars()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] && $restriction && is_string($restriction) && ($processing = true)) {
         $prefix = "s2m_ipr_";
         $transient_entries = $prefix . md5("s2member_ip_restrictions_" . $restriction . "_entries");
         $transient_security_breach = $prefix . md5("s2member_ip_restrictions_" . $restriction . "_security_breach");
         // If you add Filters, use a string compatible with PHP's strtotime() function.
         $concurrency = apply_filters("ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip", "30 days");
         $entries = is_array($entries = get_transient($transient_entries)) ? $entries : array();
         foreach ($entries as $_entry => $_time) {
             if ($_time < strtotime("-" . $concurrency)) {
                 unset($entries[$_entry]);
             }
         }
         $ip = $ip && is_string($ip) ? $ip : "empty";
         $entries[$ip] = strtotime("now");
         set_transient($transient_entries, $entries, 2 * (strtotime("+" . $concurrency) - strtotime("now")));
         if (get_transient($transient_security_breach)) {
             c_ws_plugin__s2member_no_cache::no_cache_constants(true);
             status_header(503);
             wp_clear_auth_cookie();
             header("Content-Type: text/html; charset=UTF-8");
             while (@ob_end_clean()) {
             }
             // Clean any existing output buffers.
             $custom_template = is_file(TEMPLATEPATH . "/" . "ip-restrictions.php") ? TEMPLATEPATH . "/" . "ip-restrictions.php" : '';
             $custom_template = is_file(get_stylesheet_directory() . "/" . "ip-restrictions.php") ? get_stylesheet_directory() . "/" . "ip-restrictions.php" : $custom_template;
             $custom_template = is_file(WP_CONTENT_DIR . "/" . "ip-restrictions.php") ? WP_CONTENT_DIR . "/" . "ip-restrictions.php" : $custom_template;
             $msg_503 = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(__FILE__)) . "/templates/errors/ip-restrictions.php"));
             $msg_503 = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($msg_503) : $msg_503);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
             unset($__refs, $__v);
             exit($msg_503);
         } else {
             if (count($entries) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"]) {
                 c_ws_plugin__s2member_no_cache::no_cache_constants(true);
                 set_transient($transient_security_breach, 1, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
                 status_header(503);
                 wp_clear_auth_cookie();
                 header("Content-Type: text/html; charset=UTF-8");
                 while (@ob_end_clean()) {
                 }
                 // Clean any existing output buffers.
                 $custom_template = is_file(TEMPLATEPATH . "/" . "ip-restrictions.php") ? TEMPLATEPATH . "/" . "ip-restrictions.php" : '';
                 $custom_template = is_file(get_stylesheet_directory() . "/" . "ip-restrictions.php") ? get_stylesheet_directory() . "/" . "ip-restrictions.php" : $custom_template;
                 $custom_template = is_file(WP_CONTENT_DIR . "/" . "ip-restrictions.php") ? WP_CONTENT_DIR . "/" . "ip-restrictions.php" : $custom_template;
                 $msg_503 = trim(file_get_contents($custom_template ? $custom_template : dirname(dirname(__FILE__)) . "/templates/errors/ip-restrictions.php"));
                 $msg_503 = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($msg_503) : $msg_503);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
                 unset($__refs, $__v);
                 exit($msg_503);
             } else {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
                 unset($__refs, $__v);
                 return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
             }
         }
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
     unset($__refs, $__v);
     return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
 }
 /**
  * Builds the options panel for this Payment Gateway.
  *
  * @package s2Member\Menu_Pages
  * @since 1.5
  *
  * @return null
  */
 public static function alipay_ops_page()
 {
     c_ws_plugin__s2member_menu_pages::update_all_options();
     // Updates options.
     $logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
     if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) {
         mkdir($logs_dir, 0777, true) . clearstatcache();
     }
     $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] . "/.htaccess";
     $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir_htaccess"])));
     if (is_dir($logs_dir) && is_writable($logs_dir) && !file_exists($htaccess)) {
         file_put_contents($htaccess, $htaccess_contents) . clearstatcache();
     }
     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
         if (!is_dir($logs_dir)) {
             // If the security-enabled logs directory does not exist yet.
             c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) does not exist. Please create this directory manually &amp; 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', true);
             }
         }
     }
     include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/menu-pages/alipay-ops.inc.php";
     return;
 }
Пример #23
0
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page">' . "\n";
     echo '<div class="ws-menu-page-toolbox">' . "\n";
     c_ws_plugin__s2member_menu_pages_tb::display();
     echo '</div>' . "\n";
     echo '<h2>Download Options</h2>' . "\n";
     echo '<table class="ws-menu-page-table">' . "\n";
     echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
     echo '<tr class="ws-menu-page-table-tr">' . "\n";
     echo '<td class="ws-menu-page-table-l">' . "\n";
     echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
     echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-options-save")) . '" />' . "\n";
     echo '<input type="hidden" name="ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" id="ws-plugin--s2member-amazon-cf-files-distros-auto-config-status" value="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"]) . '" />' . "\n";
     echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
     do_action("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars());
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_restrictions", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_restrictions", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Basic Download Restrictions">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
         echo '<h3>File Download Restrictions (required, if providing access to protected files)</h3>' . "\n";
         echo '<p>If your Membership offering allows access to restricted files, you\'ll want to configure these options.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_restrictions", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><strong>Upload restricted files to this security-enabled directory:</strong><br /><code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code></p>' . "\n";
         echo '<p>- Now, you can link to any protected file, using this special format:<br />&nbsp;&nbsp;<code>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download</strong> = file, relative to the /' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory. In other words, just the file name.</em></small></p>' . "\n";
         echo '<p>- Or, use: <code>[s2File download="example-file.zip" /]</code> <em>(easier Shortcode if you prefer)</em><br />&nbsp;&nbsp;<small><em><strong>Shortcode equivalent:</strong> <code>[s2File /]</code> produces the entire URL for you, easier.</em></small></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p>s2Member will allow access to these protected files, based on the configuration you specify below. Repeated downloads of the same exact file are NOT tabulated against the totals below. Once a file has been downloaded, future downloads of the same exact file, by the same exact Member will not be counted against them. In other words, if a Member downloads the same file three times, the system only counts that as one unique download. In addition, multiple variations of popular media formats are only counted once. This is because many site owners provide multiple download options to their Users/Members, for compatibility purposes. Files that have the same exact name, with one of these extensions, will only be counted ONE time: <code>' . esc_html(implode(",", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"])) . '</code>.</p>' . "\n";
         echo '<p>s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain <code>s2member_file_download</code> or <code>s2member-files</code>. Whenever a logged-in Member clicks a link that contains <code>s2member_file_download</code> or <code>s2member-files</code>, the system will politely ask the user to confirm the download using a very intuitive JavaScript confirmation prompt, which contains specific details about your configured download limitations. This way your Members will be aware of how many files they\'ve downloaded in the current period; and they\'ll be able to make a conscious decision about whether to proceed with a specific download or not. If you want to suppress this JavaScript confirmation prompt, you can add this to the end of your links: <code>&amp;s2member_skip_confirmation</code>. Shortcode alternative: <code>[s2File skip_confirmation="yes" /]</code>.</p>' . "\n";
         echo '<p><em>* The above only applies to Users who are logged in as Members. For all other visitors in the general public, the <code>?s2member_file_download</code> links will redirect them your Membership Options Page, so that new visitors can signup, in order to gain access, by becoming a Member. You may also want to have a look down below at s2Member\'s "Advanced Download Restrictions", which provides a greater degree of flexibility.</em></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
             echo '<tr>' . "\n";
             echo '<th style="padding-top:0;">' . "\n";
             echo '<label for="ws-plugin--s2member-level' . $n . '-file-downloads-allowed">' . "\n";
             echo $n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? 'File Downloads ( Highest Level #' . $n . ' ):' . "\n" : 'File Downloads (Level #' . $n . ' Or Higher):' . "\n";
             echo '</label>' . "\n";
             echo '</th>' . "\n";
             echo '</tr>' . "\n";
             echo '<tr>' . "\n";
             echo '<td>' . "\n";
             echo '<input type="text" maxlength="9" autocomplete="off" name="ws_plugin__s2member_level' . $n . '_file_downloads_allowed" id="ws-plugin--s2member-level' . $n . '-file-downloads-allowed" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"]) . '" style="width:200px;" /> every <input type="text" maxlength="3" autocomplete="off" name="ws_plugin__s2member_level' . $n . '_file_downloads_allowed_days" id="ws-plugin--s2member-level' . $n . '-file-downloads-allowed-days" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"]) . '" style="width:200px;" onkeyup="if(this.value > 365){ alert(\'(365 days is the maximum).\\nThis keeps the logs optimized.\'); this.value = 365; }" /> day(s).<br />' . "\n";
             echo 'Only this many unique downloads will be permitted every X day(s), at ' . ($n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? 'highest Level #' . $n : 'Level #' . $n . ' or higher') . '.<br />' . "\n";
             echo '<em>* To allow UNLIMITED downloads, use: <code>999999999</code> (i.e. <code>999999999</code> = unlimited).</em>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<tr><td><div class="ws-menu-page-hr" style="margin:10px 0 10px 0;"></div></td></tr>' : '';
         }
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_restrictions", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_limit_exceeded_page", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_limit_exceeded_page", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Download Limit Exceeded Page">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-limit-exceeded-page-section">' . "\n";
         echo '<h3>Download Limit Exceeded Page (required, if providing access to protected files)</h3>' . "\n";
         echo '<p>This Page will be shown when/if a Member reaches their download limit, based on your configuration of <strong>Basic Download Restrictions</strong> above. This Page should be created by you, in WordPress. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads, and why they might have reached this Page.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_limit_exceeded_page", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
         echo 'Download Limit Exceeded Page:' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<select name="ws_plugin__s2member_file_download_limit_exceeded_page" id="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
         echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
         foreach ($ws_plugin__s2member_temp_a = array_merge((array) get_pages()) as $ws_plugin__s2member_temp_o) {
             echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '"' . ($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] ? ' selected="selected"' : '') . '>' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
         }
         echo '</select><br />' . "\n";
         echo 'We recommend the following title: <code>Download Limit Exceeded</code>.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_limit_exceeded_page", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_advanced_restrictions", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_advanced_restrictions", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Advanced Download Restrictions">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
         echo '<h3>Advanced Download Restrictions (optional, for greater flexibility)</h3>' . "\n";
         echo '<p>By default, s2Member uses your Basic Download Restrictions, as configured above. However, you can force s2Member to allow File Downloads, using an extra query string parameter: <code>&amp;s2member_file_download_key=[Key]</code>. A File Download `Key` is passed through this parameter; it tells s2Member to allow the download of this particular file, regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may or may not have configured above. The creation of a File Download `Key`, requires a small PHP code snippet. In order to use PHP scripting inside your Posts/Pages, you\'ll need to install this handy plugin (<a href="http://wordpress.org/extend/plugins/ezphp/" target="_blank" rel="external">ezPHP</a>). There is also a Shortcode equivalent, which does NOT require PHP at all, as seen below.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_advanced_restrictions", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '<code>&amp;s2member_file_download_key=&lt;?php echo s2member_file_download_key("example-file.zip"); ?&gt;</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download_key</strong> = &lt;?php echo s2member_file_download_key("file, relative to the /' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory"); ?&gt;</em></small></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '<code>&amp;s2member_file_download_key=[s2Key file_download="example-file.zip" /]</code><br />&nbsp;&nbsp;<small><em><strong>Shortcode equivalent:</strong> <code>[s2Key file_download="example-file.zip" /]</code></em></small></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><code>[s2File download="example-file.zip" download_key="true" /]</code> <em>(Key is auto-generated in this case)</em><br />&nbsp;&nbsp;<small><em><strong>Shortcode equivalent:</strong> <code>[s2File /]</code> produces the entire URL, no need to generate a Key yourself.</em></small></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p>The function <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_file_download_key()" target="_blank" rel="external">s2member_file_download_key()</a>, is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces <em>(at the time it is produced)</em>, will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let\'s take a quick look at what <code>s2member_file_download_key()</code> actually produces.</p>' . "\n";
         echo '<p><code>s2member_file_download_key("example-file.zip")</code> = a site-specific hash of: <code>date("Y-m-d").$_SERVER["REMOTE_ADDR"].$_SERVER["HTTP_USER_AGENT"].$file</code></p>' . "\n";
         echo '<p>When <code>s2member_file_download_key = <em>a valid Key</em></code>, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member\'s file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.</p>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_advanced_restrictions", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_inline_extensions", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_inline_extensions", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Inline File Extensions">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-inline-extensions-section">' . "\n";
         echo '<h3>Inline File Extensions (optional, for content-disposition)</h3>' . "\n";
         echo '<p>There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected files, as downloadable attachments. Meaning, visitors will be given a file download prompt. Otherwise known as <code>Content-Disposition: attachment</code>. In some cases though, you may wish to serve files inline. For example, PDF files and images should usually be served inline. When you serve a file inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.</p>' . "\n";
         echo '<p>Using the field below, you can list all of the extensions that you want s2Member to serve inline (ex: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm</code>). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an <code>exe</code> file inline. So only specify extensions that can, and should be displayed inline by a web browser. Alternatively, if you would rather handle this on a case-by-case basis, you can simply add the following to the end of your download links: <code>&amp;s2member_file_inline=yes</code>. Shortcode alternative: <code>[s2File download="example-file.zip" inline="yes" /]</code>.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_inline_extensions", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-file-download-inline-extensions">' . "\n";
         echo 'Default Inline File Extensions (comma-delimited):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_file_download_inline_extensions" id="ws-plugin--s2member-file-download-inline-extensions" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]) . '" /><br />' . "\n";
         echo 'Inline extensions, comma-delimited. Ex: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm</code>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_inline_extensions", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_remote_authorization", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_remote_authorization", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Remote Auth / Podcasting">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-remote-authorization-section">' . "\n";
         echo '<h3>Remote Header Authorization (optional)</h3>' . "\n";
         echo '<p>This can be enabled on a case-by-case basis. Just add this to the end of your download links: <code>&amp;s2member_file_remote=yes</code>. Shortcode alternative: <code>[s2File download="example-file.zip" remote="yes" /]</code>.</p>' . "\n";
         echo '<p>Remote Header Authorization allows access to file downloads through an entirely different approach. Instead of asking the Member to log into your site through a browser, a Member will be prompted automatically, to log in through HTTP Header Authorization prompts; which is the same technique used in more traditional security systems via .htaccess files. In other words, Remote Header Authorization makes it possible for your Members to access files through remote applications that may NOT use a browser. This is often the case when a Member needs to access protected files through a software client like iTunes; typical with podcasts. See <a href="http://www.s2member.com/videos/71F49478D6983A9C/" target="_blank" rel="external">tutorial video here</a> for details about how to setup a Podcast for iTunes.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_remote_authorization", get_defined_vars());
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_remote_authorization", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_amazon_s3", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_s3", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Amazon S3/CDN Storage Option"' . (!empty(c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"]) ? ' default-state="open"' : '') . '>' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-amazon-s3-section">' . "\n";
         echo '<h3>Amazon S3/CDN Storage &amp; Delivery (optional)</h3>' . "\n";
         echo '<a href="http://aws.amazon.com/s3/" target="_blank"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
         echo '<p>Please note, all of this is optional. s2Member can be configured here to ONLY use Amazon S3 <em>(i.e. without Amazon CloudFront)</em>. Or, s2Member can be configured to use BOTH Amazon S3 and Amazon CloudFront together. If you want to use Amazon S3 Storage, but you don\'t care about Amazon CloudFront, feel free to leave the entire Amazon CloudFront section empty. The configuration options in the Amazon CloudFront section are ONLY required if you are planning to use both Amazon S3 and Amazon CloudFront together.</p>' . "\n";
         echo '<p>Amazon Simple Storage Service (<a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon S3</a>). Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives developers access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon uses to run its own global network of web sites. s2Member has been integrated with Amazon S3, so that <em>(if you wish)</em>, instead of using the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon S3 Bucket.</p>' . "\n";
         echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon S3 Bucket; and the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Inline Extensions, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon S3 Bucket as a CDN <em>(i.e. Content Delivery Network)</em> instead of the local <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory.</p>' . "\n";
         echo '<p>s2Member assumes that you\'re creating a new Amazon S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser <em>(i.e. <code>http://your-bucket-name.s3.amazonaws.com/</code>)</em>, you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon interface</a>. Or, some people prefer to use this popular Firefox extension (<a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a>).</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_s3", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member uses "Digitally Signed URLs", authenticated by the Amazon S3 API. Documented for developers <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html" target="_blank" rel="external">here</a>. To put it simply, s2Member will generate Amazon S3 URLs (internally); which allow Customers temporary access to specific files inside your S3 Bucket. s2Member\'s Digitally Signed URLs leading to Amazon S3, give a Customer 24 hours to connect to the file inside your S3 Bucket. This connection period of 24 hours is largely irrelevant when used in combination with s2Member, because access is renewed for another 24 hours each time you make a file available to a User/Member, and they are authenticated by your configuration of s2Member. This connection period of 24 hours is just a secondary line of defense to further prevent the possibility of link sharing. If you need to change this connection timeout of <code>24 hours</code> for some reason (not likely), you can use this WordPress Filter: <code>ws_plugin__s2member_amazon_s3_file_expires_time</code>.</em></p>' . "\n";
         echo '<p><em><strong>Linking To Protected Files:</strong> Nothing changes. s2Member\'s integration with Amazon S3 serves protected files through the same links that all s2Member site owners use. For example, you might use: <code>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '</code>, where <strong>s2member_file_download</strong> = the file, relative to the root of your Amazon S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon S3 URL, which allows them access to a particular file via Amazon S3. For further details, please review this section of your Dashboard: <code>s2Member -› Download Options -› Basic Download Restrictions</code>. Also see: <code>s2Member -› Download Options -› Advanced Mod-Rewrite Linkage</code>.</em></p>' . "\n";
         echo '<p><em><strong>Content Type, Disposition &amp; Inline Files:</strong> The query string parameter <code>&amp;s2member_file_inline=yes</code> DOES work for files served directly through Amazon S3. s2Member DOES have control over the <code>Content-Type</code> and <code>Content-Disposition</code> headers for files being served through Amazon S3. However, Amazon CloudFront servers do NOT automatically determine the MIME type for the objects they serve. If you integrate both Amazon S3 and CloudFront, s2Member will NOT have control over headers. Therefore, when you upload a file to your Amazon S3 Bucket, you should set its Content-Type header. Again, with the Amazon S3/CloudFront combination, you MUST configure headers yourself (such as <code>Content-Type: video/webm</code>, or <code>Content-Disposition: inline|attachment</code>) that you want Amazon CloudFront to send for a particular file. It\'s quite easy. You do this by setting <code>Properties -› Metadata (i.e. headers)</code> on a per-file basis, from inside your Amazon S3 Management Console. In short, when you upload a file to your Amazon S3 Bucket, if you want that file to be served a certain way, be sure to configure its <code>Properties -› Metadata</code> accordingly.</em></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th style="padding-top:0;">' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-s3-files-bucket">' . "\n";
         echo 'Amazon S3 File Bucket Name (where protected files are):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_bucket" id="ws-plugin--s2member-amazon-s3-files-bucket" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"]) . '" /><br />' . "\n";
         echo 'Your Amazon S3 Bucket will be used, instead of the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory.<br />' . "\n";
         echo 'Please type the name of your Bucket. Ex: <code>mys3bucket</code>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-s3-files-access-key">' . "\n";
         echo 'Amazon Access Key (Access Key ID):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="password" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_access_key" id="ws-plugin--s2member-amazon-s3-files-access-key" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]) . '" /><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Access Keys</code>.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-s3-files-secret-key">' . "\n";
         echo 'Amazon Secret Key (Secret Access Key):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="password" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_secret_key" id="ws-plugin--s2member-amazon-s3-files-secret-key" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"]) . '" /><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Access Keys (leading to: Legacy Security Credentials)</code>.<br />' . "\n";
         echo 'Amazon is deprecating Secret Access Keys, but they ARE still required for digitally signed URLs.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_s3", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_amazon_cf", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_cf", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Amazon S3/CloudFront CDN Storage Option"' . (!empty(c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"]) ? ' default-state="open"' : '') . '>' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-amazon-cf-section">' . "\n";
         echo '<h3>Amazon S3/CloudFront CDN Storage &amp; Delivery (optional)</h3>' . "\n";
         echo '<a href="http://aws.amazon.com/cloudfront/" target="_blank"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
         echo '<p>Please note, all of this is optional. s2Member can be configured to ONLY use Amazon S3 <em>(i.e. without Amazon CloudFront)</em>. Or, s2Member can be configured to use BOTH Amazon S3 and Amazon CloudFront together. If you don\'t want to use Amazon CloudFront, please leave this entire section empty. The configuration options in this section are ONLY required if you are planning to use both Amazon S3 and Amazon CloudFront together.</p>' . "\n";
         echo '<p>Amazon Simple Storage Service (<a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon S3</a>) combined with <a href="http://aws.amazon.com/cloudfront/" target="_blank" rel="external">Amazon CloudFront</a>. Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Services <em>(i.e. Amazon S3 Storage)</em> to give developers and businesses an easy way to distribute content to end users with low latency, and with high data transfer speeds. Amazon CloudFront delivers your static and streaming content using a global network of edge locations. Requests for your Amazon S3 Bucket Objects <em>(i.e. your protected files)</em> are automatically routed to the nearest edge location, so content is delivered with the best possible performance. s2Member has been integrated with both Amazon S3 and with Amazon CloudFront. So <em>(if you wish)</em>, instead of using the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon S3 Bucket and serve them via Amazon CloudFront. But again, please understand, the configuration options in this section are ONLY required if you\'re going to use both Amazon S3 &amp; CloudFront together.</p>' . "\n";
         echo '<p><strong>One of the great things about Amazon CloudFront</strong>, is its ability to <strong>stream/seek media files</strong> in the truest sense of the word. For sites delivering protected <em>FLV/MP4/OGG/WEBM</em> and other streaming audio/video file types over the <em>RTMP</em> protocol, Amazon CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon S3 and Amazon CloudFront together, please review the section below regarding <code>JW Player &amp; RTMP Protocol Examples</code>. s2Member will automatically serve your protected files over the <em>RTMP</em> protocol using an Amazon CloudFront Streaming Distribution.</p>' . "\n";
         echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon S3 Bucket; and the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon S3 Bucket, automatically connecting it to both of the Amazon CloudFront Distributions, which s2Member auto-configures for you <em>(see below)</em>. In this way, s2Member uses Amazon CloudFront as a CDN <em>(i.e. Content Delivery Network)</em> for your protected files.</p>' . "\n";
         echo '<p>s2Member assumes that you\'re creating a new Amazon S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser <em>(i.e. <code>http://your-bucket-name.s3.amazonaws.com/</code>)</em>, you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon interface</a>. Or, some people prefer to use this popular Firefox extension (<a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a>). You will also need to enable CloudFront inside your Web Services account at Amazon. Don\'t worry about creating or configuring any CloudFront Distributions, s2Member will auto-create and auto-configure those for you, allowing you to serve protected files.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_cf", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member\'s auto-configuration routines for Amazon CloudFront (below), are designed to create &amp; configure various components on your Amazon Web Services account, which are all requirements for you to <a href="http://docs.amazonwebservices.com/AmazonCloudFront/2010-11-01/DeveloperGuide/index.html?HowToPrivateContent.html" target="_blank" rel="external">serve protected files through the Amazon S3/CloudFront combination</a>. These components include: an Origin Access Identity, read permissions for the Origin Access Identity, and two private content Distributions. One private content Distribution for file downloads, and another private content Distribution for streaming media files; both connected to and sourced by your Amazon S3 Bucket. In addition, s2Member will automatically configure an ACL &amp; Policy (i.e. permissions) on your Amazon S3 Bucket to make sure your protected object/files are NOT available to the public.</em></p>' . "\n";
         echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member uses "Digitally Signed URLs", authenticated by the Amazon CloudFront API. Documented for developers <a href="http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html" target="_blank" rel="external">here</a>. To put it simply, s2Member will generate Amazon CloudFront URLs (internally); which allow Customers temporary access to specific files inside your S3 Bucket — via CloudFront Distributions. s2Member\'s Digitally Signed URLs leading to Amazon S3/CloudFront, give a Customer 24 hours to connect to the file inside your S3 Bucket. This connection period of 24 hours is largely irrelevant when used in combination with s2Member, because access is renewed for another 24 hours each time you make a file available to a User/Member, and they are authenticated by your configuration of s2Member. This connection period of 24 hours is just a secondary line of defense to further prevent the possibility of link sharing. If you need to change this connection timeout of <code>24 hours</code> for some reason (not likely), you can use this WordPress Filter: <code>ws_plugin__s2member_amazon_cf_file_expires_time</code>.</em></p>' . "\n";
         echo '<p><em><strong>Linking To Protected Files:</strong> RTMP streams are special, but nothing else changes. s2Member\'s integration with Amazon S3/CloudFront serves protected files through the same links that all s2Member site owners use. For example, you might use: <code>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '</code>, where <strong>s2member_file_download</strong> = the file, relative to the root of your Amazon S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon CloudFront URL, which allows them access to a particular file via Amazon CloudFront. For further details, please review this section of your Dashboard: <code>s2Member -› Download Options -› Basic Download Restrictions</code>. Also see: <code>s2Member -› Download Options -› Advanced Mod-Rewrite Linkage</code>. If you\'re streaming audio/video files over the RTMP protocol, please review the section below: <code>JW Player &amp; RTMP Protocol Examples</code>.</em></p>' . "\n";
         echo '<p><em><strong>Content Type, Disposition &amp; Inline Files:</strong> An IMPORTANT issue. The query string parameter <code>&amp;s2member_file_inline=yes</code> does NOTHING for files served via Amazon CloudFront. s2Member has NO control over the <code>Content-Type</code> and/or <code>Content-Disposition</code> headers for a file being served through Amazon CloudFront, and CloudFront servers do NOT automatically determine the MIME type for the objects they serve. Therefore, when you upload a file to your Amazon S3 Bucket, you should set its Content-Type header. That is, you MUST configure headers yourself (such as <code>Content-Type: video/webm</code>, or <code>Content-Disposition: inline|attachment</code>) that you want Amazon CloudFront to send for a particular file. It\'s quite easy. You do this by setting <code>Properties -› Metadata (i.e. headers)</code> on a per-file basis, from inside your Amazon S3 Management Console. In short, when you upload a file to your Amazon S3 Bucket, if you want that file to be served a certain way, be sure to configure its <code>Properties -› Metadata</code> accordingly.</em></p>' . "\n";
         echo stripos(PHP_OS, "win") === 0 && c_ws_plugin__s2member_utils_conds::is_localhost() ? '<p><em><strong>Localhost Developers:</strong> s2Member\'s Amazon CloudFront integration requires the <a href="http://php.net/manual/en/function.openssl-sign.php" target="_blank" rel="external">openssl_sign()</a> function in PHP so it can digitially sign CloudFront URLs. This function is sometimes problematic on localhost servers such as WAMP &amp; EasyPHP. We recommend installing <a href="http://www.slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="external">this lightweight alternative for Windows</a> while you\'re developing. s2Member will automatically find it here: <code>C:\\OpenSSL-Win[32/64]\\bin\\openssl.exe</code>.' . (file_exists("c:\\openssl-win32\\bin\\openssl.exe") || file_exists("c:\\openssl-win64\\bin\\openssl.exe") ? ' <strong class="ws-menu-page-hilite">( s2Member has detected that OpenSSL-Win[32/64] IS installed in the correct location, thank you! )</strong>' : ' <strong class="ws-menu-page-hilite">(s2Member has detected that OpenSSL-Win[32/64] is NOT currently available)</strong>') . '</em></p>' . "\n" : '';
         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"] === "configured") {
             echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon CloudFront Distributions are: ( ALREADY configured! )</strong></em>' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"] ? '<br /><em class="ws-menu-page-hilite">Downloads Distribution CNAME:</em> <em><code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '</code></em>' : '') . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"] ? '<br /><em class="ws-menu-page-hilite">Streaming Distribution CNAME:</em> <em><code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '</code></em>' : '') . '</p>' . "\n";
         } else {
             if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"]) {
                 echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon CloudFront Distributions are: (NOT yet auto-configured).</strong></em></p>' . "\n";
             }
         }
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th style="padding-top:0;">' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-id">' . "\n";
         echo 'Amazon CloudFront Key Pair ID (your Key Pair ID):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_cf_files_private_key_id" id="ws-plugin--s2member-amazon-cf-files-private-key-id" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" data-s-prev-config-value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" /><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Key Pairs</code>.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-entry">' . "\n";
         echo 'Amazon CloudFront Private Key (contents of your <code>pk-[***].pem</code> file):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="hidden" name="ws_plugin__s2member_amazon_cf_files_private_key" id="ws-plugin--s2member-amazon-cf-files-private-key" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '" data-s-prev-config-value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '" />' . "\n";
         echo '<textarea name="ws_plugin__s2member_amazon_cf_files_private_key_entry" id="ws-plugin--s2member-amazon-cf-files-private-key-entry" rows="3" wrap="off" spellcheck="false" class="monospace">' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '</textarea><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Key Pairs</code>.<br />' . "\n";
         echo '<em>* Note, s2Member needs your <strong>Private Key file</strong>, NOT your Public Key file.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros">' . "\n";
         echo 'Auto-Configure your Amazon S3/CloudFront combination?' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="checkbox" name="ws_plugin__s2member_amazon_cf_files_auto_configure_distros" id="ws-plugin--s2member-amazon-cf-files-auto-configure-distros" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-amazon-cf-files-auto-configure-distros")) . '"' . (!empty(c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros"><strong>Yes</strong>, automatically configure my Amazon CloudFront Distributions &amp; Amazon S3 ACLs for me.</label><br />' . "\n";
         echo '<em>s2Member will auto-configure and/or delete &amp; re-configure your Amazon CloudFront Distributions for you.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="checkbox" name="ws_plugin__s2member_amazon_cf_files_auto_configure_distros_w_cnames" id="ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames")) . '"' . (!empty(c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames"><strong>Yes</strong>, I want s2Member to auto-configure using custom CNAMES that I\'ll setup.</label><br />' . "\n";
         echo '<em>* Optional, do NOT check this box unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '<div id="ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames" style="display:none;">' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-downloads-distro-cname">' . "\n";
         echo 'Amazon CloudFront CNAME for File Downloads (optional):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_cf_files_distro_downloads_cname" id="ws-plugin--s2member-amazon-cf-files-downloads-distro-cname" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . '" /><br />' . "\n";
         echo 'Example: <code>s2-file-downloads.' . esc_html(c_ws_plugin__s2member_utils_urls::parse_url(site_url(), PHP_URL_HOST)) . '</code>.<br />' . "\n";
         echo '<em>* Optional, do NOT fill this in unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-streaming-distro-cname">' . "\n";
         echo 'Amazon CloudFront CNAME for Streaming Files (optional):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_cf_files_distro_streaming_cname" id="ws-plugin--s2member-amazon-cf-files-streaming-distro-cname" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . '" /><br />' . "\n";
         echo 'Example: <code>s2-streaming-files.' . esc_html(c_ws_plugin__s2member_utils_urls::parse_url(site_url(), PHP_URL_HOST)) . '</code>.<br />' . "\n";
         echo '<em>* Optional, do NOT fill this in unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_cf", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_rtmp_streaming", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_rtmp_streaming", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="JW Player v6 &amp; RTMP Protocol Examples">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-rtmp-streaming-section">' . "\n";
         echo '<h3>JW Player v6 &amp; RTMP Protocol Examples</h3>' . "\n";
         echo '<a href="http://www.longtailvideo.com/players/" target="_blank"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/jwplayer-logo.png" class="ws-menu-page-right" style="width:179px; height:58px; border:0; border-radius:3px; background:#FFFFFF; padding:15px;" alt="." /></a>' . "\n";
         echo '<p>While it is possible to serve audio/video files protected by s2Member, without needing to integrate Amazon S3 or CloudFront; we DO highly recommend that you integrate both Amazon S3 and Amazon CloudFront in order to maximize speed and compatibility across various viewing platforms. That being said, there are code samples below that will serve audio/video files both with and without Amazon S3/CloudFront. You can also check the <a href="' . esc_attr(c_ws_plugin__s2member_readmes::parse_readme_value("Forum URI")) . '" target="_blank" rel="external">s2Member Support Forums</a> for tips/tricks if you like.</p>' . "\n";
         echo '<p><strong>One of the great things about Amazon CloudFront</strong>, is its ability to <strong>stream/seek media files</strong> in the truest sense of the word. For sites delivering protected <em>FLV/MP4/OGG/WEBM</em> and other streaming audio/video file types over the <em>RTMP</em> protocol, Amazon CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon S3 and Amazon CloudFront together, please review the code samples below. s2Member can automatically serve your protected files over the <em>RTMP</em> protocol using an Amazon CloudFront Streaming Distribution.</p>' . "\n";
         echo '<p><strong>See also:</strong> This KB article: <a href="http://www.s2member.com/kb/jwplayer-s2stream-shortcodes/" target="_blank" rel="external">JW Player w/ <code>[s2Stream /]</code> Shortcodes</a>.</p>' . "\n";
         if (stripos(wp_get_theme(), 'infocus') !== FALSE) {
             echo '<p><strong>Note:</strong> It appears that you\'re using the inFocus WordPress theme. If you experience trouble with the shortcodes below, try wrapping the shortcode in <code>[raw][/raw]</code> tags (e.g., <code>[raw][s2Stream ... /][/raw]</code>).</p>' . "\n";
         }
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_rtmp_streaming", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3><code>[s2Stream /]</code> Video Shortcode Examples (recommended — it\'s the easiest way)</h3>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4\').toggle(); return false;" class="ws-dotted-link">JW Player (MP4 file, via Rewrite URLs. Amazon S3/CloudFront NOT required)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Works with any audio/video file. This does NOT require s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp4.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4-rtmp\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP4, via s2Member\'s Amazon S3/CloudFront integration)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4-rtmp" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Streams with the RTMP protocol, plus there is a full download fallback of the MP4 source file if streaming is not possible on a particular device.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp4-rtmp.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4-rtmp-only\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP4 only, via s2Member\'s Amazon S3/CloudFront integration)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp4-rtmp-only" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Streams with the RTMP protocol only, with no access to the source file, only to the RTMP stream.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp4-rtmp-only.x-php")) . '</p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3><code>[s2Stream /]</code> Audio Shortcode Examples (recommended — it\'s the easiest way)</h3>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3\').toggle(); return false;" class="ws-dotted-link">JW Player (MP3 file, via Rewrite URLs. Amazon S3/CloudFront NOT required)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Works with any audio/video file. This does NOT require s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp3.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3-rtmp\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP3, via s2Member\'s Amazon S3/CloudFront integration)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3-rtmp" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Streams with the RTMP protocol, plus there is a full download fallback of the MP3 source file if streaming is not possible on a particular device.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp3-rtmp.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3-rtmp-only\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP3 only, via s2Member\'s Amazon S3/CloudFront integration)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-s2stream-mp3-rtmp-only" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />Streams with the RTMP protocol only, with no access to the source file, only to the RTMP stream.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-s2stream-mp3-rtmp-only.x-php")) . '</p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>PHP Code Examples (for more advanced integrations via PHP — in WordPress themes)</h3>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-standard-mp4\').toggle(); return false;" class="ws-dotted-link">JW Player (MP4 file, via Rewrite URLs. Amazon S3/CloudFront NOT required)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-standard-mp4" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This does NOT require s2Member to be integrated with Amazon S3/CloudFront.<br />Also see: <code>s2Member -› Download Options -› Advanced Mod Rewrite Linkage</code>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-standard-mp4.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP4, via s2Member\'s Amazon S3/CloudFront integration)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br />Also see: <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/" target="_blank" rel="external">s2Member Codex -› API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-streaming-mp4.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-sca\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP4, via s2Member\'s JSON/Shortcode alternative)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-sca" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br />Also see: <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/" target="_blank" rel="external">s2Member Codex -› API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-streaming-mp4-sca.x-php")) . '</p>' . "\n";
         echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-webm\').toggle(); return false;" class="ws-dotted-link">JW Player (RTMP streaming MP4, advanced w/ multiple fallbacks)</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-webm" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon S3/CloudFront.<br />Also see: <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/" target="_blank" rel="external">s2Member Codex -› API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/jwplayer-streaming-mp4-webm.x-php")) . '</p>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_rtmp_streaming", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_rewrite_linkage", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_rewrite_linkage", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Advanced Mod-Rewrite Linkage">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-rewrite-linkage-section">' . "\n";
         echo '<h3>Advanced Mod-Rewrite Linkage</h3>' . "\n";
         echo '<p>s2Member automatically creates <code>mod_rewrite</code> rules inside your <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, which provide additional flexibility in the way protected files can be served to your Customers. With s2Member\'s <code>mod_rewrite</code> rules, it is now possible to link directly to a protected file, avoiding the use of query string variables <em>(it\'s completely optional though, i.e. NOT required)</em>.</p>' . "\n";
         echo '<p>This new flexibility may come in handy for site owners serving files through media playback devices that have issues with query string variables. For instance, it is now possible to link to an s2Member-protected file directly, like this: <code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/example-file.zip</code> instead of <code>... /?s2member_file_download=example-file.zip</code>. Either way works, but the direct link might be easier for some.</p>' . "\n";
         echo '<p>It is also possible to pass query string parameters through a direct link:<br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/example-file.zip?s2member_file_inline=yes&amp;s2member_file_download_key=[key]</code>.</p>' . "\n";
         echo '<p>That being said, s2Member\'s <code>mod_rewrite</code> rules allow for more advanced control over s2Member-specific parameters.</p>' . "\n";
         echo '<p>For example, you could just do this for inline files:<br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline</strong>/example-file.zip</code></p>' . "\n";
         echo '<p>Or, if you really want to get advanced, you could do something like this:<br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-[yes|no]/s2member-file-download-key-[key]</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-yes/s2member-file-download-key-xS54df5ER4d5x</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-yes/s2member-skip-confirmation</strong>/example-file.zip</code></p>' . "\n";
         echo '<p>Or even this, if you\'re using Remote Header Authorization:<br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-remote</strong>/example-file.zip</code></p>' . "\n";
         echo '<p>Specifying storage location option dynamically:<br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-[local|s3|cf]</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-cf</strong>/example-cloudfront-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-s3/s2member-file-inline</strong>/example-s3-file.html</code></p>' . "\n";
         echo '<p><em>* Note, the order of your s2Member-specific parameters with Advanced Mod-Rewrite Linkage is irrelevant. Feel free to add/remove, or even change the order. Everything discussed here is also Multisite compatible. Everything discussed here is also compatible when/if combined with Amazon S3/CDN Storage. However, NONE of this will work on servers that do NOT support <code>mod_rewrite</code>. Almost all web servers do though.</em></p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_rewrite_linkage", get_defined_vars());
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_rewrite_linkage", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_shortcode_attrs", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_shortcode_attrs", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Shortcode Attributes &amp; API Functions (Explained)">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-shortcode-attrs-section">' . "\n";
         echo '<h3>Shortcode Attributes &amp; API Functions (Explained In Full Detail)</h3>' . "\n";
         echo '<p>s2Member makes <a href="http://codex.wordpress.org/Shortcode_API#Overview" target="_blank" rel="external">Shortcodes</a> available to you, which allow you to generate File Download URLs and/or File Download Keys. Like most Shortcodes for WordPress, s2Member reads Attributes in your Shortcode. Many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_shortcode_attrs", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h4 style="margin:0;"><code>[s2File /]</code> &amp; <code>[s2Stream /]</code> Shortcode Attributes:</h4>' . "\n";
         echo '<p style="margin:0;"><strong>See also:</strong> API Function <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_file_download_url()" target="_blank" rel="external">s2member_file_download_url()</a> for PHP integration.</p>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr style="padding-top:0;">' . "\n";
         echo '<td style="padding-top:0;">' . "\n";
         echo '<ul>' . "\n";
         echo '<li><code>download="file.zip"</code> Location of the file, relative to the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory; or, relative to the root of your Amazon S3 Bucket, when applicable.</li>' . "\n";
         echo '<li><code>download_key="no"</code> Defaults to <code>no</code>. If <code>download_key="1|on|yes|true|ip-forever|universal"</code>, s2Member will return a URL with an s2Member-generated File Download Key. You don\'t need to generate the File Download Key yourself, s2Member does it for you. If you set <code>download_key="ip-forever"</code>, the File Download Key that s2Member generates will last forever, for a specific IP Address; otherwise, by default, all File Download Keys expire after 24 hours automatically. If you set <code>download_key="universal"</code>, s2Member will generate a File Download Key that is good for anyone/everyone forever, with NO restrictions on who/where/when a file is accessed <em>(e.g. be careful with this one)</em>.</li>' . "\n";
         echo '<li><code>stream="no"</code> Defaults to <code>no</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>stream="1|on|yes|true"</code>, s2Member will return a URL containing a parameter/directive, which forces the File Download to take place over the RTMP protocol if at all possible. This ONLY works when/if s2Member is configured to run with both Amazon S3/CloudFront. Please note however, it\'s better to use the example code provided in the section above, regarding: <code>JW Player and the RTMP Protocol</code>. Also note, if <code>get_streamer_json="1|on|yes|true"</code>, s2Member will automatically force <code>stream="yes"</code> for you.</li>' . "\n";
         echo '<li><code>inline=""</code> Defaults to <code>[empty]</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>inline="1|on|yes|true"</code>, s2Member will serve the file inline, instead of as an actual File Download. If empty, s2Member will look at your <code>Inline File Extensions</code> configuration above, and serve the file inline; if, and only if, its extension matches one found in your configuration. By default, s2Member serves all files as attachments <em>(i.e. downloads)</em>, except in the case of the <code>[s2Stream /]</code> Shortcode where this defaults to <code>yes</code>. Please read the section above regarding <code>Inline File Extensions</code> for further details. Also note, this Shortcode Attribute does NOTHING for files served via Amazon CloudFront. See the tech-notes listed in the Amazon CloudFront section for further details and workarounds.</li>' . "\n";
         echo '<li><code>storage=""</code> Defaults to <code>[empty]</code>. If <code>storage="local|s3|cf"</code>, s2Member will serve the file from a specific source location, based on the value of this Shortcode Attribute. For example, if you\'ve configured Amazon S3 and/or CloudFront; but, there are a few files that you want to upload locally to the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory; you can force s2Member to serve a file from local storage by setting <code>storage="local"</code> explicitly.</li>' . "\n";
         echo '<li><code>remote="no"</code> Defaults to <code>no</code>. If <code>remote="1|on|yes|true"</code>, s2Member will authenticate access to the File Download via Remote Header Authorization, instead of through your web site. This is similar to <code>.htaccess</code> protection routines of yester-year</code>. Please check the <code>Remote Authorization and Podcasting</code> section for further details about how this works.</li>' . "\n";
         echo '<li><code>ssl=""</code> Defaults to <code>[empty]</code>. If <code>ssl="1|on|yes|true"</code>, s2Member will generate a File Download URL with an SSL protocol <em>(i.e. the URL will start with <code>https://</code> or <code>rtmpe://</code>)</em>. If empty, s2Member will only generate a File Download URL with an SSL protocol, when/if the Post/Page/URL firing the Shortcode itself, is also being viewed over SSL. Otherwise, s2Member will use a non-SSL protocol by default.</li>' . "\n";
         echo '<li><code>rewrite="no"</code> Defaults to <code>no</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>rewrite="1|on|yes|true"</code>, s2Member will generate a File Download URL that takes full advantage of s2Member\'s Advanced Mod Rewrite functionality. If you\'re running an Apache web server, or another server that supports <code>mod_rewrite</code>, we highly recommend turning this on. s2Member\'s <code>mod_rewrite</code> URLs do NOT contain query string parameters, making them more portable/compatible with other software applications and/or plugins for WordPress. If you\'re integrating with JW Player, you MUST use <code>rewrite="yes"</code>.</li>' . "\n";
         echo '<li><code>rewrite_base=""</code> Defaults to <code>[empty]</code>. If <code>rewrite_base="' . esc_attr(site_url("/")) . '"</code>, s2Member will generate a File Download URL that takes full advantage of s2Member\'s Advanced Mod Rewrite functionality, and it will use the rewrite base URL as a prefix. This could be useful on some WordPress installations that use advanced directory structures. It could also be useful for site owners using virtual directories that point to <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code>. Note, if <code>rewrite_base</code> is set, s2Member will automatically force <code>rewrite="yes"</code> for you.</li>' . "\n";
         echo '<li><code>skip_confirmation="no"</code> Defaults to <code>no</code>. If <code>skip_confirmation="1|on|yes|true"</code>, s2Member will generate a File Download URL which contains a directive, telling s2Member NOT to introduce any JavaScript confirmation prompts on your site, for this File Download URL. Please note, s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain <code>s2member_file_download</code> or <code>s2member-files</code>. Whenever a logged-in Member clicks a link that contains <code>s2member_file_download</code> or <code>s2member-files</code>, the system will politely ask the User to confirm the download using a very intuitive JavaScript confirmation prompt, which contains specific details about your configured download limitations. This way your Members will be aware of how many files they\'ve downloaded in the current period; and they\'ll be able to make a conscious decision about whether to proceed with a specific download or not.</li>' . "\n";
         echo '<li><code>url_to_storage_source="no"</code> Defaults to <code>no</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>url_to_storage_source="1|on|yes|true"</code>, s2Member will generate a File Download URL which points directly to the storage source. This is only functional with Amazon S3 and/or CloudFront integrations. If you create a URL that points directly to the storage source <em>(i.e. points directly to Amazon S3 or CloudFront)</em>, s2Member will NOT be able to further authenticate the current User/Member; and, s2Member will NOT be able to count the File Download against the current User\'s account record, because the URL being generated does not pass back through s2Member at all, it points directly to the storage source. For this reason, if you set <code>url_to_storage_source="true"</code>, you should also set <code>check_user="******"</code> and <code>count_against_user="******"</code>, telling s2Member to authenticate the current User, and if authenticated, count this File Download URL against the current User\'s account record in real-time <em>(i.e. as the URL is being generated) </em>, while it still has a chance to do so. This Shortcode Attribute is useful when you stream files over the RTMP protocol; where an <code>http://</code> URL is not feasible. It also helps in situations where a 3rd-party software application will not work as intended, with s2Member\'s internal redirection to Amazon S3/CloudFront files. Important, when <code>check_user="******"</code> and/or <code>count_against_user="******"</code>, the Shortcode will return an empty and/or null object value in situations where the current User/Member does NOT have access to the file.</li>' . "\n";
         echo '<li><code>count_against_user="******"</code> Defaults to <code>no</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>count_against_user="******"</code>, it will automatically force <code>check_user="******"</code> as well. In other words, s2Member will authenticate the current User, and if authenticated, count this File Download URL against the current User\'s account record in real-time <em>(i.e. as the URL is being generated) </em>. This is off by default with the <code>[s2File /]</code> Shortcode. By default, s2Member will simply generate a File Download URL, and upon a User/Member clicking the URL, s2Member will authenticate the User/Member at that time, count the File Download against their account record, and serve the File Download. In other words, under normal circumstances, there is no reason to set <code>check_user="******"</code> and/or <code>count_against_user="******"</code> when generating the URL itself. However, this is a useful Shortcode Attribute when <code>url_to_storage_source="true"</code>. Please note, when <code>check_user="******"</code> and/or <code>count_against_user="******"</code>, the Shortcode will return an empty and/or null object value in situations where the current User/Member does NOT have access to the file.</li>' . "\n";
         echo '<li><code>check_user="******"</code> Defaults to <code>no</code> with <code>[s2File /]</code> Shortcode. Defaults to <code>yes</code> with <code>[s2Stream /]</code> Shortcode. If <code>check_user="******"</code>, s2Member will authenticate the current User before allowing the File Download URL to be generated. This is off by default with the <code>[s2File /]</code> Shortcode. By default, s2Member will simply generate a File Download URL, and upon a User/Member clicking the URL, s2Member will authenticate the User/Member at that time, and serve the File Download to the User/Member. In other words, under normal circumstances, there is no reason to set <code>check_user="******"</code> and/or <code>count_against_user="******"</code> when generating the URL itself. However, this IS a useful Shortcode Attribute when <code>url_to_storage_source="true"</code>. Please note, when <code>check_user="******"</code> and/or <code>count_against_user="******"</code>, the Shortcode will return an empty and/or null object value in situations where the current User/Member does NOT have access to the file.</li>' . "\n";
         echo '<li><code>get_streamer_json="no"</code> Defaults to <code>no</code>. N/A with <code>[s2Stream /]</code> Shortcode. If <code>get_streamer_json="1|on|yes|true"</code>, the <code>[s2File /]</code> Shortcode will return a JSON object for JavaScript notation, making it possible to integrate the <code>[s2File /]</code> Shortcode into JavaScript routines that configure streaming media players. For further details, please review the section above: <code>JW Player &amp; RTMP Protocol Examples</code>. Note, if you set <code>get_streamer_json="true"</code>, s2Member will automatically force <code>url_to_storage_source="true"</code> and <code>stream="true"</code>. For that reason, you should carefully review the details and warning above regarding <code>url_to_storage_source</code>. If you set <code>get_streamer_json="true"</code>, you should also set <code>check_user="******"</code> and <code>count_against_user="******"</code>.</li>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_shortcode_attrs_s2file_lis", get_defined_vars());
         echo '</ul>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h4 style="margin:0;">Additional <code>[s2Stream /]</code> Shortcode Attributes:</h4>' . "\n";
         echo '<p style="margin:0;"><strong>See also:</strong> This KB article: <a href="http://www.s2member.com/kb/jwplayer-s2stream-shortcodes/" target="_blank" rel="external">JW Player w/ <code>[s2Stream /]</code> Shortcodes</a>.</p>' . "\n";
         echo '<p style="margin:0;"><strong>See also:</strong> API Function <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_file_download_url()" target="_blank" rel="external">s2member_file_download_url()</a> for PHP integration.</p>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr style="padding-top:0;">' . "\n";
         echo '<td style="padding-top:0;">' . "\n";
         echo '<ul>' . "\n";
         echo '<li><code>file_download="video.mp4"</code> Location of the audio/video file, relative to the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory; or, relative to the root of your Amazon S3 Bucket, when applicable.</li>' . "\n";
         echo '<li><code>player="jwplayer-v6-rtmp"</code> Required. Current supported players in this Shortcode include: <code>jwplayer-v6</code> (works with any audio/video file, and you do NOT need to have Amazon  S3 or CloudFront integrated for this to work), <code>jwplayer-v6-rtmp</code> (streams with the RTMP protocol, plus there is a full download fallback of the source file if streaming is not possible on a particular device; this requires both Amazon S3 and CloudFront integration), <code>jwplayer-v6-rtmp-only</code> (streams with the RTMP protocol only, with no access to the source file, only to the RTMP stream; this requires both Amazon S3 and CloudFront integration).</li>' . "\n";
         echo '<li><code>player_id=""</code> Optional. HTML div ID for the audio/video player. Defaults to a unique ID generated by s2Member for each instance of your Shortcode.</li>' . "\n";
         echo '<li><code>player_path="/jwplayer/jwplayer.js"</code> Required. Path to the player\'s JavaScript file (ex: <code>/jwplayer/jwplayer.js</code> — you should upload the <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">/jwplayer</a> folder to the root of your web directory).</li>' . "\n";
         echo '<li><code>player_{setting}=""</code> Optional. Any additional configuration attributes supported by your audio/video player, prefixed with <code>player_</code>. For JW Player v6, see <a href="http://www.longtailvideo.com/support/jw-player/28839/embedding-the-player" target="_blank" rel="external">this article please</a>. Examples: <code>player_width="480"</code>, <code>player_height="270"</code>, <code>player_title="My Video"</code>, <code>player_description="A video about something."</code>, <code>player_image="http://www.example.com/wp-content/uploads/video-preview.jpg"</code>, <code>player_mediaid="video_ei0wsx23"</code>, <code>player_autostart="true"</code>, <code>player_skin="/jwplayer/my-skin.xml"</code>, <code>player_key="my-license-key"</code>, <code>player_captions="{file:\'/assets/captions-en.vtt\',label:\'English\'}"</code> (<em>With <a href="http://www.longtailvideo.com/support/jw-player/28845/adding-video-captions" target="_blank" rel="external">Captions</a>, you can exclude the square array brackets to avoid Shortcode parsing issues. s2Member will automatically wrap your Caption objects with square array brackets.</em>). Please note that "Advanced Options Blocks" listed on <a href="http://www.longtailvideo.com/support/jw-player/28839/embedding-the-player" target="_blank" rel="external">this page</a> are NOT supported here. For those, please use: <code>player_option_blocks=""</code> (see below).</li>' . "\n";
         echo '<li><code>player_option_blocks=""</code> Optional. Any "Advanced Option Blocks" supported by your audio/video player. For JW Player v6, see <a href="http://www.longtailvideo.com/support/jw-player/28839/embedding-the-player" target="_blank" rel="external">this article please</a>. Here are some examples: <code>player_option_blocks="sharing:{}"</code>, <code>player_option_blocks="sharing:{}, logo: {file: \'/logo.png\', link: \'http://example.com\'}"</code>. Or: <code>player_option_blocks="c2hhcmluZzoge30="</code> (base64 encoded version of <code>sharing:{}</code>). Please note that "Advanced Options Blocks" can be defined in plain text or with a <a href="http://www.base64encode.org/" target="_blank" rel="external">base64 encoded string</a>. Advanced Option Blocks are JavaScript objects with properties. If you have trouble defining JavaScript object properties inside a Shortcode Attribute, please use <a href="http://www.base64encode.org/" target="_blank" rel="external">this tool</a> to base64 encode your Advanced Option Blocks, so that you end up with a string that\'s compatible with Shortcode Attributes.</li>' . "\n";
         echo '<li>Please check the <strong>Shortcode Attributes</strong> Tab in <a href="http://www.s2member.com/kb/jwplayer-s2stream-shortcodes/#using-s2stream-shortcodes" target="_blank" rel="external">this KB article</a> for further details on everything here.</li>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_shortcode_attrs_s2stream_lis", get_defined_vars());
         echo '</ul>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h4 style="margin:0;"><code>[s2Key /]</code> Shortcode Attributes:</h4>' . "\n";
         echo '<p style="margin:0;"><strong>See also:</strong> API Function <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_file_download_key()" target="_blank" rel="external">s2member_file_download_key()</a> for PHP integration.</p>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr style="padding-top:0;">' . "\n";
         echo '<td style="padding-top:0;">' . "\n";
         echo '<ul>' . "\n";
         echo '<li><code>file_download="file.zip"</code> Location of the file, relative to the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory; or, relative to the root of your Amazon S3 Bucket, when applicable.</li>' . "\n";
         echo '<li><code>directive=""</code> Defaults to <code>[empty]</code>. If <code>directive="ip-forever|universal"</code>, s2Member will return a special File Download Key. If you set <code>directive="ip-forever"</code>, the File Download Key that s2Member generates will last forever, for a specific IP Address; otherwise, by default, all File Download Keys expire after 24 hours automatically. If you set <code>directive="universal"</code>, s2Member will generate a File Download Key that is good for anyone/everyone forever, with NO restrictions on who/where/when a file is accessed <em>(e.g. be careful with this one)</em>.</li>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_shortcode_attrs_s2key_lis", get_defined_vars());
         echo '</ul>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_shortcode_attrs", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_gzip_conflicts", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_gzip_conflicts", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Preventing GZIP Conflicts On Server">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-gzip-conflicts-section">' . "\n";
         echo '<h3>Preventing GZIP Conflicts On Server (Instructions)</h3>' . "\n";
         echo '<p>Protected files served by s2Member through PHP scripts, are already compressed. Therefore, <a href="http://code.google.com/speed/articles/gzip.html" target="_blank" rel="nofollow external xlink">GZIP compression</a> is not needed during protected file delivery. Some web servers (i.e. Apache, LiteSpeed, and similar) include GZIP compression rules through server-side extensions, like <code>mod_deflate</code> for example. While s2Member encourages the use of extensions like <code>mod_deflate</code>, it is best to disable GZIP automatically (i.e. temporarily) during s2Member\'s delivery of a protected file through a PHP script. This avoids conflicts on the server which might otherwise lead to corrupted file downloads. s2Member makes a valiant effort to accomplish this via PHP, all on its own. However, it never hurts to add this section of code to the root <code>.htaccess</code> file for your WordPress installation. Optional, but highly recommended.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_gzip_conflicts", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p style="margin:0; font-weight:bold;">s2Member automatically adds this to your <code>.htaccess</code> file upon activation of the plugin.</p>' . "\n";
         echo '<p style="margin:0;">The following <code>mod_rewrite</code> rule goes inside this file: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path(ABSPATH . ".htaccess")) . '</code></p>' . "\n";
         echo '<pre class="code"><code>' . esc_html(trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_no_gzip_htaccess"])))) . '</code></pre>';
         echo '<p><strong>* Tip:</strong> this covers all types of integration with s2Member File Downloads, even if you\'re using s2Member\'s Advanced Mod Rewrite Linkage.</p>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_gzip_conflicts", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_custom_capability_files", !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site(), get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_custom_capability_files", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Custom Capability &amp; Member Level Files">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-capability-files-section">' . "\n";
         echo '<h3>Restricting Files, Based On Custom Capabilities</h3>' . "\n";
         echo '<p>If you\'re NOT familiar with Custom Capabilities yet, please read: <code>Dashboard -› s2Member -› API Scripting -› Custom Capability Packages</code>. Once you understand the basic concept of Custom Capabilities &amp; Protected File Downloads, you\'ll see that (by default) s2Member does NOT handle File Download Protection with respect to Custom Capabilities. That\'s where Custom Capability Sub-directories come in.</p>' . "\n";
         echo '<p>You can create Custom Capability Sub-directories under: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code>. For instance, if you have a Custom Capability <code>music</code>, you can place protected files that should ONLY be accessible to Members with <code>access_s2member_ccap_music</code>, inside: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/</code>. Some examples are provided below.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_custom_capability_files", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><strong>Custom Capabilities:</strong> (music,videos)</p>' . "\n";
         echo '<p>Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos</code></p>' . "\n";
         echo '<p>Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/file.mp3</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos/file.avi</code></p>' . "\n";
         echo '<p>Now, here are some link examples, using Custom Capability Sub-directories:</p>' . "\n";
         echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/ccap-file-downloads.x-php")) . '</p>' . "\n";
         echo '<p><em>These links will ONLY work for Members who are logged-in, with the proper Capabilities.</em></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><strong>Membership Levels:</strong> (this also works fine)</p>' . "\n";
         echo '<p>Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4</code></p>' . "\n";
         echo '<p>Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0/tiger.doc</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1/zebra.pdf</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2/elephant.doc</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3/rhino.pdf</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4/lion.doc</code></p>' . "\n";
         echo '<p>Now, here are some link examples, using Member Level Sub-directories:</p>' . "\n";
         echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/level-file-downloads.x-php")) . '</p>' . "\n";
         echo '<p><em>These links will ONLY work for Members who are logged-in, with an adequate Membership Level.</em></p>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_custom_capability_files", get_defined_vars());
     }
     do_action("ws_plugin__s2member_during_down_ops_page_after_left_sections", get_defined_vars());
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<p class="submit"><input type="submit" value="Save All Changes" /></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__s2member_menu_pages_rs::display();
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
 }
Пример #24
0
 /**
  * Writes no GZIP rules into root `.htaccess` file.
  *
  * @package s2Member\Files
  * @since 120212
  *
  * @return bool True if successfull, else false on any type of failure.
  */
 public static function write_no_gzip_into_root_htaccess()
 {
     if (c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess()) {
         $start_line = '# BEGIN s2Member GZIP exclusions';
         // Beginning line for this entry.
         $end_line = '# END s2Member GZIP exclusions';
         // Identifying end line for this entry.
         $htaccess = ABSPATH . '.htaccess';
         // Location of this `.htaccess` file we need to write in.
         $ideally_position_before = '# BEGIN WordPress';
         // Ideally, we can position before this entry.
         $no_gzip = $start_line . "\n" . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_no_gzip_htaccess']))) . "\n" . $end_line;
         if (file_exists($htaccess) && is_readable($htaccess) && is_writable($htaccess) && ($htaccess_contents = file_get_contents($htaccess)) !== FALSE && is_string($htaccess_contents = trim($htaccess_contents))) {
             if (stripos($htaccess_contents, $ideally_position_before) !== FALSE) {
                 $htaccess_contents = trim(str_ireplace($ideally_position_before, $no_gzip . "\n\n" . $ideally_position_before, $htaccess_contents));
             } else {
                 $htaccess_contents = trim($no_gzip . "\n\n" . $htaccess_contents);
             }
             // Else, let's put it at the very top of the file by default.
             return file_put_contents($htaccess, $htaccess_contents);
         } else {
             if (!file_exists($htaccess) && is_writable(dirname($htaccess))) {
                 return file_put_contents($htaccess, $no_gzip);
             }
         }
     }
     return FALSE;
     // Default return `FALSE`.
 }
Пример #25
0
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page">' . "\n";
     echo '<div class="ws-menu-page-toolbox">' . "\n";
     c_ws_plugin__s2member_menu_pages_tb::display();
     echo '</div>' . "\n";
     echo '<h2>PayPal Buttons</h2>' . "\n";
     echo '<table class="ws-menu-page-table">' . "\n";
     echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
     echo '<tr class="ws-menu-page-table-tr">' . "\n";
     echo '<td class="ws-menu-page-table-l">' . "\n";
     do_action("ws_plugin__s2member_during_paypal_buttons_page_before_left_sections", get_defined_vars());
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         if (($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_levelN_buttons = "ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_level" . $n . "_buttons") && apply_filters($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_levelN_buttons, true, get_defined_vars())) {
             if ($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_levelN_buttons = "ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_level" . $n . "_buttons") {
                 do_action($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_levelN_buttons, get_defined_vars());
             }
             echo '<div class="ws-menu-page-group" title="PayPal Buttons For Level #' . $n . ' Access">' . "\n";
             echo '<div class="ws-menu-page-section ws-plugin--s2member-level' . $n . '-buttons-section">' . "\n";
             echo '<h3>Button Code Generator For Level #' . $n . ' Access</h3>' . "\n";
             echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their Membership, or fails to make payments on time, s2Member will automatically terminate their Membership privileges. s2Member makes extensive use of the PayPal IPN service. s2Member receives updates from PayPal behind-the-scene.</p>' . "\n";
             echo '<p><em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
             if ($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_levelN_buttons = "ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level" . $n . "_buttons") {
                 do_action($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_levelN_buttons, get_defined_vars());
             }
             echo '<table class="form-table">' . "\n";
             echo '<tbody>' . "\n";
             echo '<tr>' . "\n";
             echo '<th class="ws-menu-page-th-side">' . "\n";
             echo '<label for="ws-plugin--s2member-level' . $n . '-shortcode">' . "\n";
             echo 'Button Code<br />For Level #' . $n . ':<br /><br />' . "\n";
             echo '<div id="ws-plugin--s2member-level' . $n . '-button-prev"></div>' . "\n";
             echo '</label>' . "\n";
             echo '</th>' . "\n";
             echo '<td>' . "\n";
             echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
             echo '<p id="ws-plugin--s2member-level' . $n . '-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level' . $n . '-trial-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-trial-amount" value="0.00" size="4" /></p>' . "\n";
             echo '<p><span id="ws-plugin--s2member-level' . $n . '-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level' . $n . '-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-regular-terms.php"))) . '</select></p>' . "\n";
             echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level' . $n . '-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level' . $n . '\');" /></p>' . "\n";
             echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-desc" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]) . ' / description and pricing details here." size="73" /></p>' . "\n";
             echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-ccaps" size="40" /></p>' . "\n";
             echo '</form>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             echo '<tr>' . "\n";
             echo '<td colspan="2">' . "\n";
             echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
             if ($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_levelN_buttons_before_shortcode = "ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level" . $n . "_buttons_before_shortcode") {
                 do_action($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_levelN_buttons_before_shortcode, get_defined_vars());
             }
             echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
             $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.php")));
             $ws_plugin__s2member_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($n)), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
             echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-level' . $n . '-shortcode" value="' . format_to_edit($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" />' . "\n";
             echo '<div' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '><br />' . "\n";
             echo '<strong>Resulting PayPal Button Code:</strong> (ultimately, your Shortcode will produce this snippet)<br />' . "\n";
             echo '<textarea id="ws-plugin--s2member-level' . $n . '-button" rows="8" wrap="off" onclick="this.select ();">';
             $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
             $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($n)), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/"))), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_notify=1"))), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_return=1"))), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
             $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
             echo format_to_edit($ws_plugin__s2member_temp_s);
             echo '</textarea><br />' . "\n";
             echo '&uarr; <em>This <span class="ws-menu-page-hilite">may contain PHP code too</span>; so be careful if you use this.</em>' . "\n";
             echo '</div>' . "\n";
             echo '</form>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             echo '</tbody>' . "\n";
             echo '</table>' . "\n";
             echo '</div>' . "\n";
             echo '</div>' . "\n";
             if ($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_levelN_buttons = "ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_level" . $n . "_buttons") {
                 do_action($ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_levelN_buttons, get_defined_vars());
             }
         }
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_modification_buttons", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_modification_buttons", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Subscr Modification Buttons">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-modification-buttons-section">' . "\n";
         echo '<h3>Button Code Generator For Subscription Modifications</h3>' . "\n";
         echo '<p>If you\'d like to give your Members <em>(and/or your Free Subscribers)</em> the ability to modify their billing plan, by switching to a more expensive option, or a less expensive option; generate a new PayPal Modification Button here. Configure the updated Level, pricing, terms, etc. Then, make that new Modification Button available to Members who are logged into their existing account with you. For example, you might want to insert a "Level #2" Upgrade Button into your Login Welcome Page, which would up-sell existing Level #1 Members to a more expensive plan that you offer.</p>' . "\n";
         echo '<p><em><strong>Important Note:</strong> Modification Buttons should be displayed to existing Users/Members, and they should be logged-in, BEFORE clicking this Button. Otherwise, post-processing of their transaction will fail to recognize the Customer\'s existing account within WordPress. Please display this Button only to Users/Members that are already logged into their account (perhaps in your Login Welcome Page for s2Member), or in another location where you can be absolutely sure that a User/Member is logged in. s2Member\'s Simple Conditionals could also be used to ensure a User/Member is logged in, by wrapping your Shortcode within a Conditional test. For further details, please see: <strong>s2Member ⥱ API Scripting ⥱ Simple Conditionals</strong>.</em></p>' . "\n";
         echo '<p><em><strong>Modification Process:</strong> When you send a Member to PayPal using a Subscription Modification Button, PayPal will ask them to login. Once they\'re logged in, instead of being able to signup for a new Membership, PayPal will provide them with the ability to upgrade and/or downgrade their existing Membership with you, by allowing them to switch to the Membership Plan that was specified in the Subscription Modification Button. PayPal handles this nicely, and you\'ll be happy to know that s2Member has been pre-configured to deal with this scenario as well, so that everything remains automated. Their Membership Access Level will either be promoted, or demoted, based on the actions they took at PayPal during the modification process. Once an existing Member completes their Subscription Modification at PayPal, they\'ll be brought back to their Login Welcome Page, instead of to the registration screen.</em></p>' . "\n";
         echo '<p><em><strong>Also Works For Free Subscribers:</strong> Although a Free Subscriber does not have an existing PayPal Subscription, s2Member is capable of adapting to this scenario gracefully. Just make sure that your existing Free Subscribers <em>(the ones who wish to upgrade)</em> pay for their Membership through a Modification Button generated by s2Member. That will allow them to continue using their existing account with you. In other words, they can keep their existing Username <em>(and anything already associated with that Username)</em>, rather than being forced to re-register after checkout.</em></p>' . "\n";
         echo '<p><em><strong>Make It More User-Friendly:</strong> You can make the Subscription Modification Process, more user-friendly, by setting up a <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can tell s2Member to use that Page Style whenever you generate your Button Code.\'); return false;">Custom Page Style at PayPal</a>, specifically for Subscription Modification Buttons. Use a custom header image, with a brief explanation to the Customer. Something like, "Log into PayPal", "You can Modify your Subscription!".</em></p>' . "\n";
         echo '<p><em><strong>Integrating Conditionals:</strong> Since each Modification Button is configured for a specific Level, you may want to create multiple Modification Buttons, one for each combination you intend to make available. s2Member\'s API Conditionals can help you display the proper Button to each Customer, based on the status of their existing account. For further details, see: <strong>s2Member ⥱ API Scripting</strong>.</em></p>' . "\n";
         echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<p><em><strong>Independent Custom Capabilities:</strong> If you just want to sell an existing Member new Custom Capabilities, without affecting their paid Subscription in any way, please see the next Button Generator: <code>Capability (Buy Now) Buttons</code>. Independent Capability Buttons facilitate Buy Now functionality, specifically for Custom Capabilities, without affecting the Customer\'s primary Subscription and Membership Level Access.</em></p>' . "\n" : '';
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_modification_buttons", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-modification-shortcode">' . "\n";
         echo 'Button Code<br />For Modifications:<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-modification-button-prev"></div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>Modification: <select id="ws-plugin--s2member-modification-level">' . "\n";
         for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
             echo '<optgroup label="Level #' . $n . '">' . "\n";
             echo '<option value="upgrade:' . $n . '">&uarr; Upgrade To Level #' . $n . '</option>' . "\n";
             echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<option value="downgrade:' . $n . '">&darr; Downgrade To Level #' . $n . '</option>' . "\n" : '';
             echo '</optgroup>' . "\n";
             echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<option disabled="disabled"></option>' . "\n" : '';
         }
         echo '</select></p>' . "\n";
         echo '<p id="ws-plugin--s2member-modification-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--s2member-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-modification-trial-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--s2member-modification-trial-amount" value="0.00" size="4" /></p>' . "\n";
         echo '<p><span id="ws-plugin--s2member-modification-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-modification-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-regular-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-modification-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'modification\');" /></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-modification-desc" value="Description and pricing details here." size="73" /></p>' . "\n";
         echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-modification-ccaps" size="40" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_modification_buttons_before_shortcode", get_defined_vars());
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr("1")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%level_label%% /", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/\\/]\$/", 'modify="1" /]', $ws_plugin__s2member_temp_s);
         // Adds modify="1" to the end of the Shortcode.
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-modification-shortcode" value="' . format_to_edit($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" />' . "\n";
         echo '<div' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '><br />' . "\n";
         echo '<strong>Resulting PayPal Button Code:</strong> (ultimately, your Shortcode will produce this snippet)<br />' . "\n";
         echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();">';
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
         $ws_plugin__s2member_temp_s = preg_replace('/name\\="modify" value\\="(.*?)"/', 'name="modify" value="1"', $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr("1")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%level_label%% /", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_notify=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_return=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
         echo format_to_edit($ws_plugin__s2member_temp_s);
         echo '</textarea><br />' . "\n";
         echo '&uarr; <em>This <span class="ws-menu-page-hilite">may contain PHP code too</span>; so be careful if you use this.</em>' . "\n";
         echo '</div>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_modification_buttons", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_ccap_buttons", !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site(), get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_ccap_buttons", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Capability (Buy Now) Buttons">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-ccap-buttons-section">' . "\n";
         echo '<h3>Button Code Generator For Independent Custom Capabilities</h3>' . "\n";
         echo '<p>This is VERY advanced. For further details, please check your Dashboard: <strong>s2Member ⥱ API Scripting ⥱ Custom Capabiities</strong>.</p>' . "\n";
         echo '<p>With s2Member, you can sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>(i.e., you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like)</em>. So this is quite flexible. Independent Custom Capabilities do NOT rely on any specific Membership Level. That\'s why s2Member refers to these as `Independent` Custom Capabilities, because you can sell Capabilities this way, through Buy Now functionality, and the Customer\'s Membership Level Access, along with any existing paid Subscription they may already have with you, will remain completely unaffected. That being said, if you intend to charge a recurring fee for Custom Capabilities, please use a <code>Subscr. Modification Button</code> instead; because Independent Custom Capabilities can only be sold through Buy Now functionality.</p>' . "\n";
         echo '<p>Independent Custom Capabilities are added to a Customer\'s account immediately after checkout, and the Customer will have the Custom Capabilities for as long as their Membership lasts, based on their primary Subscription with your site, and/or forever, if they have a Lifetime account with you. In other words, Independent Custom Capabilities will exist on the Customer\'s account forever, or until an EOT <em>(End Of Term)</em> occurs on their primary Subscription with you; in which case s2Member would demote or delete the Customer\'s account <em>(based on your EOT configuration)</em>, and all Custom Capabilities are removed as well.</p>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each set of Custom Capabilities that you plan to sell. Then press (Generate Button Code). These special PayPal Buttons are customized to work with s2Member seamlessly. The Customer will be granted additional access to one or more Custom Capabilities that you specify; while the Customer\'s Membership Level Access and any existing paid Subscription they may already have with you, will remain completely unaffected.</p>' . "\n";
         echo '<p><em><strong>Important Note:</strong> Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button. Otherwise, post-processing of their transaction will fail to recognize the Customer\'s existing account within WordPress. Please display this Button only to Users/Members that are already logged into their account (perhaps in your Login Welcome Page for s2Member), or in another location where you can be absolutely sure that a User/Member is logged in. s2Member\'s Simple Conditionals could also be used to ensure a User/Member is logged in, by wrapping your Shortcode within a Conditional test. For further details, please see: <strong>s2Member ⥱ API Scripting ⥱ Simple Conditionals</strong>.</em></p>' . "\n";
         echo '<p><em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress Editor. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_ccap_buttons", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-ccap-shortcode">' . "\n";
         echo 'Button Code<br />For Capabilities:<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-ccap-button-prev"></div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-ccap-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-ccap-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-ccap-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-ccap-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalCcapButtonGenerate();" /></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-ccap-desc" value="Description and pricing details here." size="73" /></p>' . "\n";
         echo '<p>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-ccap-ccaps" size="40" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_ccap_buttons_before_shortcode", get_defined_vars());
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-ccaps-checkout-button-shortcode.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-ccap-shortcode" value="' . format_to_edit($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" />' . "\n";
         echo '<div' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '><br />' . "\n";
         echo '<strong>Resulting PayPal Button Code:</strong> (ultimately, your Shortcode will produce this snippet)<br />' . "\n";
         echo '<textarea id="ws-plugin--s2member-ccap-button" rows="8" wrap="off" onclick="this.select ();">';
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_notify=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_return=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
         echo format_to_edit($ws_plugin__s2member_temp_s);
         echo '</textarea><br />' . "\n";
         echo '&uarr; <em>This <span class="ws-menu-page-hilite">may contain PHP code too</span>; so be careful if you use this.</em>' . "\n";
         echo '</div>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_ccap_buttons", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_cancellation_buttons", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_cancellation_buttons", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Subscr Cancellation Buttons">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-cancellation-buttons-section">' . "\n";
         echo '<h3>One Button Does It All For Cancellations (copy/paste)</h3>' . "\n";
         echo '<p>Since all recurring charges are associated with a PayPal Subscription; and every PayPal Subscription is associated with a PayPal Account; your Members will always have a PayPal Account of their own, which is tied to their Membership with you. So... a Member can simply log into their own PayPal account and cancel their Subscription(s) with you at anytime, all on their own. However, some Customers do not realize this. So, if you would like to make it clearer (easier) for Members to cancel their own Subscription(s), you can provide this Cancellation Button for them on your Login Welcome Page, or somewhere in the support section of your website. Note... you don\'t have to use this Cancellation Button at all, if you don\'t want to. It\'s completely optional.</p>' . "\n";
         echo '<p><em><strong>Cancellation Process:</strong> Very simple. A Member clicks the Cancellation Button. PayPal asks them to log into their PayPal account. Once they\'re logged in, PayPal will display a list of all active Subscriptions they have with you. They choose which ones they want to cancel, and s2Member is notified silently behind-the-scenes, through the PayPal IPN service.</em></p>' . "\n";
         echo '<p><em><strong>Understanding Cancellations:</strong> It\'s important to realize that a Cancellation is not an EOT (End Of Term). All that happens during a Cancellation event, is that billing is stopped, and it\'s understood that the Customer is going to lose access, at some point in the future. This does NOT mean, that access will be revoked immediately. A separate EOT event will automatically handle a (demotion or deletion) later, at the appropriate time; which could be several days, or even a year after the Cancellation took place.</em></p>' . "\n";
         echo '<p><em><strong>Some Hairy Details:</strong> There might be times whenever you notice that a Member\'s Subscription has been cancelled through PayPal... but, s2Member continues allowing the User access to your site as a paid Member. Please don\'t be confused by this... in 99.9% of these cases, the reason for this is legitimate. s2Member will only remove the User\'s Membership privileges when an EOT (End Of Term) is processed, a refund occurs, a chargeback occurs, or when a cancellation occurs - which would later result in a delayed Auto-EOT by s2Member.</em></p>' . "\n";
         echo '<p><em>s2Member will not process an EOT (End Of Term) until the User has completely used up the time they paid for. In other words, if a User signs up for a monthly Subscription on Jan 1st, and then cancels their Subscription on Jan 15th; technically, they should still be allowed to access the site for another 15 days, and then on Feb 1st, the time they paid for has completely elapsed. At that time, s2Member will remove their Membership privileges; by either demoting them to a Free Subscriber, or deleting their account from the system (based on your configuration). s2Member also calculates one extra day (24 hours) into its equation, just to make sure access is not removed sooner than a Customer might expect.</em></p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_cancellation_buttons", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-cancellation-shortcode">' . "\n";
         echo 'Button Code<br />For Cancellations:<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-cancellation-button-prev">' . "\n";
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-cancellation-button.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
         echo preg_replace("/\\<a/", '<a target="_blank"', $ws_plugin__s2member_temp_s);
         echo '</div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>No configuration necessary.</p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_cancellation_buttons_before_shortcode", get_defined_vars());
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-cancellation-button-shortcode.php")));
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-cancellation-shortcode" value="' . format_to_edit($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" />' . "\n";
         echo '<div' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '><br />' . "\n";
         echo '<strong>Resulting PayPal Button Code:</strong> (ultimately, your Shortcode will produce this snippet)<br />' . "\n";
         echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();">';
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-cancellation-button.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
         echo format_to_edit($ws_plugin__s2member_temp_s);
         echo '</textarea><br />' . "\n";
         echo '&uarr; <em>This <span class="ws-menu-page-hilite">may contain PHP code too</span>; so be careful if you use this.</em>' . "\n";
         echo '</div>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_cancellation_buttons", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_reg_links", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_reg_links", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Member Registration Access Links">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-reg-links-section">' . "\n";
         echo '<h3>Registration Access Link Generator (for Customer Service)</h3>' . "\n";
         echo '<p>s2Member automatically generates Registration Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Registration Access Link to be created manually, you can use this tool for that. Alternatively, you can create their account yourself/manually by going to <strong>Users ⥱ Add New</strong>. Either of these methods will work fine.</p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_reg_links", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>Paid Membership Level#: <select id="ws-plugin--s2member-reg-link-level" style="min-width:200px;">' . "\n";
         for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
             echo '<option value="' . $n . '">s2Member Level #' . $n . '</option>' . "\n";
         }
         echo '</select></p>' . "\n";
         echo '<p>Paid Subscr. ID: <input type="text" autocomplete="off" id="ws-plugin--s2member-reg-link-subscr-id" value="" size="50" /> <a href="#" onclick="alert(\'The Customer\\\'s Paid Subscr. ID (aka: Recurring Profile ID, Transaction ID) must be unique. This value can be obtained from inside your PayPal account under the History tab. Each paying Customer MUST be associated with a unique Paid Subscr. ID. If the Customer is NOT associated with a Paid Subscr. ID, you will need to generate a unique value for this field on your own. But keep in mind, s2Member will be unable to maintain future communication with the PayPal IPN (i.e., Notification) service if this value does not reflect a real Paid Subscr. ID that exists in your PayPal History log.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
         echo '<p>Custom String Value: <input type="text" autocomplete="off" id="ws-plugin--s2member-reg-link-custom" value="' . esc_attr($_SERVER["HTTP_HOST"]) . '" size="30" /> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_paypalRegLinkGenerate();" /> <img id="ws-plugin--s2member-reg-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
         echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-reg-link-ccaps" size="40" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" /></p>' . "\n";
         echo '<p>Fixed Term Length (for Buy Now transactions): <input type="text" autocomplete="off" id="ws-plugin--s2member-reg-link-fixed-term" value="" size="10" /> <a href="#" onclick="alert(\'If the Customer purchased Membership through a Buy Now transaction (i.e., there is no Initial/Trial Period and no recurring charges for ongoing access), you may configure a Fixed Term Length in this field. This way the Customer\\\'s Membership Access is automatically revoked by s2Member at the appropriate time. This will be a numeric value, followed by a space, then a single letter.\\n\\nHere are some examples:\\n\\n1 D (this means 1 Day)\\n1 W (this means 1 Week)\\n1 M (this means 1 Month)\\n1 Y (this means 1 Year)\\n1 L (this means 1 Lifetime)\'); return false;">[?]</a></p>' . "\n";
         echo '<p id="ws-plugin--s2member-reg-link" style="display:none;"></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_reg_links", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_sp_buttons", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_sp_buttons", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Specific Post/Page (Buy Now) Buttons">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-buttons-section">' . "\n";
         echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
         echo '<p>s2Member now supports an additional layer of functionality (very powerful), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" Buttons, and your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
         echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link (see: <strong>s2Member ⥱ PayPal Options ⥱ Specific Post/Page Email</strong>). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
         echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <strong>s2Member ⥱ Restriction Options ⥱ Specific Post/Page Access</strong>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Button Code). These special PayPal Buttons are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction.</p>' . "\n";
         echo '<p><em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress Editor. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_buttons", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th class="ws-menu-page-th-side">' . "\n";
         echo '<label for="ws-plugin--s2member-sp-shortcode">' . "\n";
         echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
         echo '<div id="ws-plugin--s2member-sp-button-prev"></div>' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p><select id="ws-plugin--s2member-sp-leading-id">' . "\n";
         echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
         $ws_plugin__s2member_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
         foreach ($ws_plugin__s2member_temp_a_singulars as $ws_plugin__s2member_temp_o) {
             echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
         }
         echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member ⥱ Restriction Options ⥱ Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
         echo '<p><select id="ws-plugin--s2member-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
         echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
         foreach ($ws_plugin__s2member_temp_a_singulars as $ws_plugin__s2member_temp_o) {
             echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
         }
         echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member ⥱ Restriction Options ⥱ Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
         echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-sp-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-sp-hours.php"))) . '</select></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-sp-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
         echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-sp-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-sp-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalSpButtonGenerate();" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td colspan="2">' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_buttons_before_shortcode", get_defined_vars());
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-sp-checkout-button-shortcode.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-sp-shortcode" value="' . format_to_edit($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" />' . "\n";
         echo '<div' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '><br />' . "\n";
         echo '<strong>Resulting PayPal Button Code:</strong> (ultimately, your Shortcode will produce this snippet)<br />' . "\n";
         echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();">';
         $ws_plugin__s2member_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
         $ws_plugin__s2member_temp_s = preg_replace("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_notify=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url("/?s2member_paypal_return=1"))), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $ws_plugin__s2member_temp_s);
         $ws_plugin__s2member_temp_s = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $ws_plugin__s2member_temp_s);
         echo format_to_edit($ws_plugin__s2member_temp_s);
         echo '</textarea><br />' . "\n";
         echo '&uarr; <em>This <span class="ws-menu-page-hilite">may contain PHP code too</span>; so be careful if you use this.</em>' . "\n";
         echo '</div>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_sp_buttons", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_sp_links", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_sp_links", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="PayPal Specific Post/Page Access Links">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-links-section">' . "\n";
         echo '<h3>Specific Post/Page Access Link Generator (for Customer Service)</h3>' . "\n";
         echo '<p>s2Member automatically generates Specific Post/Page Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Access Link to be created manually, you can use this tool for that.</p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_links", get_defined_vars());
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p><select id="ws-plugin--s2member-sp-link-leading-id">' . "\n";
         echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
         $ws_plugin__s2member_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
         foreach ($ws_plugin__s2member_temp_a_singulars as $ws_plugin__s2member_temp_o) {
             echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
         }
         echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member ⥱ Restriction Options ⥱ Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
         echo '<p><select id="ws-plugin--s2member-sp-link-additional-ids" multiple="multiple" style="height:100px; min-width:450px;">' . "\n";
         echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
         foreach ($ws_plugin__s2member_temp_a_singulars as $ws_plugin__s2member_temp_o) {
             echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
         }
         echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member ⥱ Restriction Options ⥱ Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
         echo '<p><select id="ws-plugin--s2member-sp-link-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-sp-hours.php"))) . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_paypalSpLinkGenerate();" /> <img id="ws-plugin--s2member-sp-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
         echo '<p id="ws-plugin--s2member-sp-link" style="display:none;"></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_sp_links", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_shortcode_attrs", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_shortcode_attrs", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Shortcode Attributes (Explained)">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-shortcode-attrs-section">' . "\n";
         echo '<h3>Shortcode Attributes (Explained In Full Detail)</h3>' . "\n";
         echo '<p>When you generate a Button Code, s2Member will make a <a href="http://codex.wordpress.org/Shortcode_API#Overview" target="_blank" rel="external">Shortcode</a> available to you. Like most Shortcodes for WordPress, s2Member reads Attributes in your Shortcode. These Attributes will be pre-configured by one of s2Member\'s Button Generators automatically; so there really is nothing more you need to do. However, many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.</p>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_shortcode_attrs", get_defined_vars());
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr style="padding-top:0;">' . "\n";
         echo '<td style="padding-top:0;">' . "\n";
         echo '<ul class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>cancel="0"</code> Cancellation Button. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Cancellation Button, <code>1</code> = this IS a Cancellation Button.</li>' . "\n";
         echo '<li><code>cc="USD"</code> 3 character Currency Code. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<li><code>ccaps="music,videos"</code> A comma-delimited list of Custom Capabilities. Only valid w/ Membership Level Access and/or Independent Custom Capabilities.</li>' . "\n" : '';
         echo '<li><code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '"</code> must start with your domain. Additional values can be piped in (ex: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3|etc"</code>). Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>desc="Gold Membership"</code> A brief purchase Description. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>dg="0"</code> The Digital Goods directive. s2Member will eventually be integrated with <a href="http://www.s2member.com/paypal-express-co-digitals" target="_blank" rel="external">Digital Goods</a> for inline Express Checkout. But for now, this should always be <code>0</code>.</li>' . "\n";
         echo '<li><code>exp="72"</code> Access Expires (in hours). Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>ids="14"</code> A Post/Page ID#, or a comma-delimited list of IDs. Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>image="default"</code> Button Image Location. Possible values: <code>default</code> = use the default PayPal Button, <code>http://...</code> = location of your custom Image.</li>' . "\n";
         echo '<li><code>lang=""</code> Optional 5 character Button Language Code <em>(ake: Locale Code—ex: <code>en_US</code>)</em>. This controls the interface language of the PayPal Button itself. If unspecified, the language defaults to English (i.e., <code>en_US</code>; or to the value set by an optional MO translation file; which translates s2Member overall). See <a href="https://cms.paypal.com/mx/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration#id089QD0O0TX4__id08AH904I0YK" target="_blank" rel="external">this list of possible Locale Codes</a>.</li>' . "\n";
         echo '<li><code>lc=""</code> Optional 2 character Country/Locale Code <em>(i.e., Country Code—ex: <code>US</code>)</em>. This controls the interface language used at PayPal during checkout. If unspecified, the language is determined by PayPal when possible, defaulting to <code>US</code> <em>english</em> when not possible. See <a href="https://cms.paypal.com/mx/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration#id089QD0O0TX4__id08AH904I0YK" target="_blank" rel="external">this list of possible Country Codes</a>. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>level="1"</code> Membership Level [1-4] <em>(or, up to the number of configured Levels)</em>. Only valid for Buttons providing paid Membership Level Access.' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' Or, with Independent Custom Capabilities this MUST be set to <code>level="*"</code>, and <code>ccaps=""</code> must NOT be empty <em>(i.e., <code>level="*" ccaps="music,videos"</code>)</em>.') . '</li>' . "\n";
         echo '<li><code>modify="0"</code> Modification directive. Only valid w/ Membership Level Access. Possible values: <code>0</code> = allows Customers to only create a new Subscription, <code>1</code> = allows Customers to modify their current Subscription or sign up for a new one, <code>2</code> = allows Customers to only modify their current Subscription.</li>' . "\n";
         echo '<li><code>ns="1"</code> The <em>no_shipping</em> directive. Possible values: <code>0</code> = prompt for an address, but do not require one, <code>1</code> = do not prompt for a shipping address, <code>2</code> = prompt for an address, and require one. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>output="button"</code> Output Type. Possible values: <code>button</code> = PayPal Button w/hidden inputs, <code>anchor</code> = PayPal Button (  &lt;a&gt; anchor tag ) URL w/ ?query string, <code>url</code> = raw URL w/ ?query string.</li>' . "\n";
         echo '<li><code>ps="paypal"</code> PayPal checkout Page Style. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>ra="0.01"</code> Regular, Buy Now, and/or Recurring Amount. Must be &gt;= <code>0.01</code>. Not valid when <code>cancel="1"</code>.</li>' . "\n";
         echo '<li><code>rp="1"</code> Regular Period. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Must be &gt;= <code>1</code> (ex: <code>1</code> Week, <code>2</code> Months, <code>1</code> Month, <code>3</code> Days).</li>' . "\n";
         echo '<li><code>rt="M"</code> Regular Term. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years, <code>L</code> = Lifetime.</li>' . "\n";
         echo '<li><code>rr="1"</code> Recurring directive. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>0</code> = non-recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>1</code> = recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>BN</code> = non-recurring "Buy Now" functionality, no Trial Period possible.</li>' . "\n";
         echo '<li><code>rrt=""</code> Recurring Times <em>(i.e., a fixed number of installments)</em>. Only valid w/ Membership Level Access. When unspecified, any recurring charges will remain ongoing until cancelled, or until payments start failing. If this is set to <code>1 or higher</code> the regular recurring charges will only continue for X billing cycles, depending on what you specify. This is only valid when <code>rr="1"</code> for recurring "Subscriptions". Please note that a fixed number of installments, also means a fixed period of access. If a Customer\'s billing is monthly, and you set <code>rrt="3"</code>, billing will continue for only 3 monthly installments. After that, billing would stop, and their access to the site would be revoked as well <em>(based on your EOT Behavior setting under: s2Member ⥱ PayPal Options)</em>.</li>' . "\n";
         echo '<li><code>rra="1"</code> Reattempt failed payments? Possible values: <code>0</code> = do NOT reattempt billing when/if a recurring payment fails; <code>1</code> = yes, DO reattempt billing when/if a recurring payment fails. With PayPal Standard integration, PayPal will retry a maximum of 2 times when you set <code>rra="1"</code>; after that, a Subscription would be terminated due to Max Failed Payments having been reached. PayPal Standard integration does NOT make it possible to configure Max Failed Payments, it simply defaults to a value of <code>2</code> whenever <code>rra="1"</code>, indicating that you DO want to retry failed payments.</li>' . "\n";
         echo '<li><code>sp="0"</code> Specific Post/Page Button. Possible values: <code>0</code> = this is NOT a Specific Post/Page Access Button, <code>1</code> = this IS a Specific Post/Page Access Button.</li>' . "\n";
         echo '<li><code>ta="0.00"</code> Trial Amount. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
         echo '<li><code>tp="0"</code> Trial Period. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
         echo '<li><code>tt="D"</code> Trial Term. Only valid w/ Membership Level Access. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years.</li>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_shortcode_attrs_lis", get_defined_vars());
         echo '</ul>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_shortcode_attrs", get_defined_vars());
     }
     do_action("ws_plugin__s2member_during_paypal_buttons_page_after_left_sections", get_defined_vars());
     echo '</td>' . "\n";
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__s2member_menu_pages_rs::display();
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
 }
 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  *
  * @todo Optimize with ``empty()`` and ``isset()``.
  */
 public static function cp($vars = array())
 {
     extract($vars, EXTR_OVERWRITE | EXTR_REFS);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal["txn_type"]) && preg_match("/^web_accept\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"])) && (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])) && !empty($paypal["payer_email"]) && !empty($paypal["txn_id"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.";
             list(, $paypal["sp_ids"], $paypal["hours"]) = preg_split("/\\:/", $paypal["item_number"], 3);
             $paypal["ip"] = preg_match("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"] ? $paypal["option_selection2"] : "";
             $paypal["ip"] = !$paypal["ip"] && preg_match("/^[a-z0-9]+~[0-9\\.]+\$/i", $paypal["invoice"]) ? preg_replace("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
             if (($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($paypal["sp_ids"], $paypal["hours"])) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                 $processing = $during = true;
                 // Yes, we ARE processing this.
                 if (preg_match("/(referenc|associat)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) {
                     // Associating this purchase with a Member?
                     if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal["option_selection1"], $paypal["option_selection1"])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                         $sp_references = (array) get_user_option("s2member_sp_references", $user_id);
                         $_sp_reference = array("time" => time(), "ids" => $paypal["sp_ids"], "hours" => $paypal["hours"], "url" => $sp_access_url);
                         $sp_references = c_ws_plugin__s2member_utils_arrays::array_unique(array_merge($sp_references, $_sp_reference));
                         update_user_option($user_id, "s2member_sp_references", $sp_references);
                         $paypal["s2member_log"][] = "Specific Post/Page ~ Sale associated with User ID: " . $user_id . ".";
                     }
                 }
                 $sbj = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_REQUEST["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"]) ? "pro_" : "") . "sp_email_subject"]);
                 $sbj = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours"))), $sbj);
                 $msg = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_REQUEST["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"]) ? "pro_" : "") . "sp_email_message"]);
                 $msg = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours"))), $msg);
                 $rec = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_REQUEST["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"]) ? "pro_" : "") . "sp_email_recipients"]);
                 $rec = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours"))), $rec);
                 if (($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $rec))) {
                     if ($rec = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $rec)) {
                         // Full amount of the payment, before fee is subtracted.
                         if (($rec = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $rec)) && ($rec = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $rec))) {
                             if (($rec = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"])), $rec)) && ($rec = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"])), $rec))) {
                                 if ($rec = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $rec)) {
                                     // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
                                     if ($rec = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $rec)) {
                                         if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $rec)) {
                                             if (($rec = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $rec))) {
                                                 if (($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $sbj))) {
                                                     if ($sbj = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $sbj)) {
                                                         // Full amount of the payment, before fee is subtracted.
                                                         if (($sbj = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $sbj)) && ($sbj = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $sbj))) {
                                                             if (($sbj = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $sbj)) && ($sbj = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $sbj))) {
                                                                 if ($sbj = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)) {
                                                                     if ($sbj = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $sbj)) {
                                                                         if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $sbj)) {
                                                                             if (($sbj = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $sbj))) {
                                                                                 if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $msg))) {
                                                                                     if ($msg = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) {
                                                                                         // Full amount of the payment, before fee is subtracted.
                                                                                         if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
                                                                                             if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
                                                                                                 if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
                                                                                                     if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
                                                                                                         if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $msg)) {
                                                                                                             if (($msg = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $msg))) {
                                                                                                                 if (($rec = trim(preg_replace("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                         $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                         $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                     }
                                                                                                                     foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
                                                                                                                         // Go through a possible list of recipients.
                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($recipient, apply_filters("ws_plugin__s2member_sp_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_sp_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                     }
                                                                                                                     $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . $rec . ".";
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                     foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"]) as $url) {
                         if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rawurlencode($sp_access_url)), $url))) {
                             if ($url = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours")))), $url)) {
                                 if (($url = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["txn_id"])), $url))) {
                                     if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
                                         if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
                                             if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
                                                 if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
                                                     if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["ip"])), $url)) {
                                                         if (($url = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["affiliate_id"])), $url))) {
                                                             if ($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))) {
                                                                 c_ws_plugin__s2member_utils_urls::remote($url);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification URLs have been processed.";
                 }
                 if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                     $msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Sale";
                     $msg .= "\n\n";
                     // Spacing in the message body.
                     $msg .= "sp_access_url: %%sp_access_url%%\n";
                     $msg .= "sp_access_exp: %%sp_access_exp%%\n";
                     $msg .= "amount: %%amount%%\n";
                     $msg .= "txn_id: %%txn_id%%\n";
                     $msg .= "item_number: %%item_number%%\n";
                     $msg .= "item_name: %%item_name%%\n";
                     $msg .= "first_name: %%first_name%%\n";
                     $msg .= "last_name: %%last_name%%\n";
                     $msg .= "full_name: %%full_name%%\n";
                     $msg .= "payer_email: %%payer_email%%\n";
                     $msg .= "user_ip: %%user_ip%%\n";
                     $msg .= "full_coupon_code: %%full_coupon_code%%\n";
                     $msg .= "coupon_code: %%coupon_code%%\n";
                     $msg .= "coupon_affiliate_id: %%coupon_affiliate_id%%\n";
                     $msg .= "cv0: %%cv0%%\n";
                     $msg .= "cv1: %%cv1%%\n";
                     $msg .= "cv2: %%cv2%%\n";
                     $msg .= "cv3: %%cv3%%\n";
                     $msg .= "cv4: %%cv4%%\n";
                     $msg .= "cv5: %%cv5%%\n";
                     $msg .= "cv6: %%cv6%%\n";
                     $msg .= "cv7: %%cv7%%\n";
                     $msg .= "cv8: %%cv8%%\n";
                     $msg .= "cv9: %%cv9%%";
                     if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($sp_access_url), $msg))) {
                         if ($msg = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours"))), $msg)) {
                             if (($msg = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $msg))) {
                                 if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
                                     if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
                                         if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
                                             if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
                                                 if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $msg)) {
                                                     if (($msg = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $msg)) && ($msg = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $msg))) {
                                                         if ($sbj && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                             // Still have a ``$sbj`` and a ``$msg``?
                                                             foreach (c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"]) as $recipient) {
                                                                 wp_mail($recipient, apply_filters("ws_plugin__s2member_sp_sale_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_sp_sale_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification Emails have been processed.";
                 }
                 if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                     if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rawurlencode($sp_access_url)), $url))) {
                         if ($url = preg_replace("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(c_ws_plugin__s2member_utils_time::approx_time_difference(time(), strtotime("+" . $paypal["hours"] . " hours")))), $url)) {
                             if (($url = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["txn_id"])), $url))) {
                                 if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
                                     if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
                                         if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
                                             if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
                                                 if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["ip"])), $url)) {
                                                     if (($url = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["affiliate_id"])), $url))) {
                                                         if ($url = trim($url)) {
                                                             // Preserve Remaining replacements.
                                                             // Because the parent routine may perform replacements too.
                                                             $paypal["s2member_paypal_proxy_return_url"] = $url;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $paypal["s2member_log"][] = "Specific Post/Page Return, a Proxy Return URL is ready.";
                 }
                 if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                     if (($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $code)) && ($code = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $code))) {
                         if (($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $code))) {
                             if (($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $code))) {
                                 if ($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $code)) {
                                     if ($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $code)) {
                                         if ($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $code)) {
                                             if (($code = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $code)) && ($code = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $code)) && ($code = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $code))) {
                                                 if ($code = trim(preg_replace("/%%(.+?)%%/i", "", $code))) {
                                                     $paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue. These will be processed on-site.";
                                                     set_transient("s2m_" . md5("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars());
                 unset($__refs, $__v);
             } else {
                 $paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
             }
         } else {
             $paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.";
             $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars());
         unset($__refs, $__v);
         return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", $paypal, get_defined_vars());
     } else {
         return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", false, get_defined_vars());
     }
 }
Пример #27
0
 /**
  * Builds and handles the Logs page.
  *
  * @package s2Member\Menu_Pages
  * @since 120310
  */
 public static function logs_page()
 {
     do_action('ws_plugin__s2member_before_logs_page', get_defined_vars());
     c_ws_plugin__s2member_menu_pages::update_all_options();
     c_ws_plugin__s2member_menu_pages::archive_logs_start_fresh();
     c_ws_plugin__s2member_menu_pages::delete_logs_start_fresh();
     $logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'];
     if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) {
         mkdir($logs_dir, 0777, TRUE) . clearstatcache();
     }
     $htaccess = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'] . '/.htaccess';
     $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess'])));
     if (is_dir($logs_dir) && is_writable($logs_dir) && !file_exists($htaccess)) {
         file_put_contents($htaccess, $htaccess_contents) . clearstatcache();
     }
     if (!is_dir($logs_dir)) {
         // If the security-enabled logs directory does not exist yet.
         c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) does not exist. Please create this directory manually &amp; 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', 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 (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', TRUE);
         }
     }
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
         // Logging disabled?
         c_ws_plugin__s2member_admin_notices::display_admin_notice('Logging is currently disabled by your configuration.');
     }
     include_once dirname(dirname(__FILE__)) . '/menu-pages/logs.inc.php';
     do_action('ws_plugin__s2member_after_logs_page', get_defined_vars());
 }
 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  *
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars, EXTR_OVERWRITE | EXTR_REFS);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal['txn_type']) && preg_match('/^subscr_modify$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number'])) && !empty($paypal['subscr_id']) && !empty($paypal['payer_email']) && (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id'])) && (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id']))) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_modify', get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `subscr_modify` ).';
             list($paypal['level'], $paypal['ccaps']) = preg_split('/\\:/', $paypal['item_number'], 2);
             $paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
             $paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
             $paypal['period1'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
             // Defaults to '0 D' (zero days).
             $paypal['mc_amount1'] = strlen($paypal['mc_amount1']) && $paypal['mc_amount1'] > 0 ? $paypal['mc_amount1'] : '0.00';
             // '0.00'.
             $paypal['initial_term'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
             // Defaults to '0 D' (zero days).
             $paypal['initial'] = strlen($paypal['mc_amount1']) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['mc_amount1'] : $paypal['mc_amount3'];
             $paypal['regular'] = $paypal['mc_amount3'];
             // This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal.
             $paypal['regular_term'] = $paypal['period3'];
             // This is just set to keep a standard; this way both initial_term & regular_term are available.
             $paypal['recurring'] = $paypal['recurring'] ? $paypal['mc_amount3'] : '0';
             // If non-recurring, this should be zero, otherwise Regular.
             $paypal['currency'] = strtoupper($paypal['mc_currency']);
             // Normalize input currency.
             $paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
             $ipn_signup_vars = $paypal;
             unset($ipn_signup_vars['s2member_log']);
             // Create array of IPN signup vars w/o s2member_log.
             if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                 if (!$user->has_cap('administrator')) {
                     $processing = $modifying = $during = TRUE;
                     // Yes, we ARE processing this.
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify', get_defined_vars());
                     do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), 'ipn-upgrade-downgrade', 'modification', 's2member_level' . $paypal['level']);
                     unset($__refs, $__v);
                     $fields = get_user_option('s2member_custom_fields', $user_id);
                     // These will be needed in the routines below.
                     $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                     // Original IP during Registration.
                     $user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
                     // Now merge conditionally.
                     if (is_multisite() && !is_user_member_of_blog($user_id)) {
                         add_existing_user_to_blog(array('user_id' => $user_id, 'role' => 's2member_level' . $paypal['level']));
                         $user = new WP_User($user_id);
                     }
                     $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                     if ($current_role !== 's2member_level' . $paypal['level']) {
                         // Only if we need to.
                         $user->set_role('s2member_level' . $paypal['level']);
                     }
                     // (upgrade/downgrade)
                     if ($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps']))) {
                         foreach ($user->allcaps as $cap => $cap_enabled) {
                             if (preg_match('/^access_s2member_ccap_/', $cap)) {
                                 $user->remove_cap($ccap = $cap);
                             }
                         }
                     }
                     if ($paypal['ccaps'] && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) {
                         foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap) {
                             if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                                 $user->add_cap('access_s2member_ccap_' . $ccap);
                             }
                         }
                     }
                     update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
                     update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
                     update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
                     update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
                     update_user_option($user_id, 's2member_custom', $paypal['custom']);
                     if (!get_user_option('s2member_registration_ip', $user_id)) {
                         update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
                     }
                     update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
                     delete_user_option($user_id, 's2member_file_download_access_log');
                     delete_user_option($user_id, 's2member_auto_eot_time');
                     $pr_times = get_user_option('s2member_paid_registration_times', $user_id);
                     $pr_times['level'] = !$pr_times['level'] ? time() : $pr_times['level'];
                     // Preserves existing.
                     $pr_times['level' . $paypal['level']] = !$pr_times['level' . $paypal['level']] ? time() : $pr_times['level' . $paypal['level']];
                     update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
                     // Update now.
                     c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\\:/');
                     c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\\. ID @ time of demotion\\:/');
                     $paypal['s2member_log'][] = 's2Member Level/Capabilities updated on Subscription modification.';
                     $sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_subject'];
                     // The same for standard and w/ Pro-Forms.
                     $msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_message'];
                     // The same for standard and w/ Pro-Forms.
                     $rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_recipients'];
                     // The same for standard and w/ Pro-Forms.
                     if (($rec = c_ws_plugin__s2member_utils_strings::fill_cvs($rec, $paypal['custom'])) && ($rec = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $rec))) {
                         if (($rec = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $rec)) && ($rec = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $rec))) {
                             if (($rec = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $rec)) && ($rec = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $rec))) {
                                 if (($rec = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $rec)) && ($rec = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $rec))) {
                                     if (($rec = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $rec)) && ($rec = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $rec))) {
                                         if (($rec = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $rec)) && ($rec = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $rec))) {
                                             if (($rec = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $rec)) && ($rec = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $rec))) {
                                                 if (($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec))) {
                                                     if (($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec))) {
                                                         if ($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $rec)) {
                                                             // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
                                                             if ($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)) {
                                                                 if (($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec))) {
                                                                     if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $rec)) {
                                                                         if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
                                                                             if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
                                                                                 if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)) {
                                                                                     if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
                                                                                         if (($sbj = c_ws_plugin__s2member_utils_strings::fill_cvs($sbj, $paypal['custom'])) && ($sbj = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $sbj))) {
                                                                                             if (($sbj = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $sbj)) && ($sbj = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $sbj))) {
                                                                                                 if (($sbj = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $sbj)) && ($sbj = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $sbj))) {
                                                                                                     if (($sbj = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $sbj)) && ($sbj = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $sbj))) {
                                                                                                         if (($sbj = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $sbj)) && ($sbj = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $sbj))) {
                                                                                                             if (($sbj = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $sbj)) && ($sbj = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $sbj))) {
                                                                                                                 if (($sbj = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $sbj)) && ($sbj = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $sbj))) {
                                                                                                                     if (($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj))) {
                                                                                                                         if (($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj))) {
                                                                                                                             if ($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $sbj)) {
                                                                                                                                 if ($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)) {
                                                                                                                                     if (($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) && ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj))) {
                                                                                                                                         if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $sbj)) {
                                                                                                                                             if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                                                                                                                 if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                                                                                                     if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $sbj)) {
                                                                                                                                                         if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                                                                                                             if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg))) {
                                                                                                                                                                 if (($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg))) {
                                                                                                                                                                     if (($msg = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $msg)) && ($msg = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $msg))) {
                                                                                                                                                                         if (($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg))) {
                                                                                                                                                                             if (($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg))) {
                                                                                                                                                                                 if (($msg = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $msg)) && ($msg = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $msg))) {
                                                                                                                                                                                     if (($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg)) && ($msg = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $msg))) {
                                                                                                                                                                                         if (($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg))) {
                                                                                                                                                                                             if (($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg))) {
                                                                                                                                                                                                 if ($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $msg)) {
                                                                                                                                                                                                     if ($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)) {
                                                                                                                                                                                                         if (($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg))) {
                                                                                                                                                                                                             if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $msg)) {
                                                                                                                                                                                                                 if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                                                                                                                     if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                                                                                                         if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)) {
                                                                                                                                                                                                                             if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                                                                                                                 if (is_array($fields) && !empty($fields)) {
                                                                                                                                                                                                                                     foreach ($fields as $var => $val) {
                                                                                                                                                                                                                                         $rec = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec);
                                                                                                                                                                                                                                         $sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj);
                                                                                                                                                                                                                                         $msg = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg);
                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                 if (($rec = trim(preg_replace('/%%(.+?)%%/i', '', $rec))) && ($sbj = trim(preg_replace('/%%(.+?)%%/i', '', $sbj))) && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) {
                                                                                                                                                                                                                                     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                                                                                                                         $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                                                                                                                         $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                     foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
                                                                                                                                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($recipient, apply_filters('ws_plugin__s2member_modification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_modification_email_msg', $msg, get_defined_vars()), 'From: "' . preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '" <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>' . "\r\n" . 'Content-Type: text/plain; charset=UTF-8') . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                     $paypal['s2member_log'][] = 'Modification Confirmation Email sent to: ' . $rec . '.';
                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                             }
                                                                                                                                                                                                                         }
                                                                                                                                                                                                                     }
                                                                                                                                                                                                                 }
                                                                                                                                                                                                             }
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls']) {
                         foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls']) as $url) {
                             if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url))) {
                                 if (($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url))) {
                                     if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
                                         if (($url = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial'])), $url)) && ($url = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular'])), $url)) && ($url = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['recurring'])), $url))) {
                                             if (($url = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial_term'])), $url)) && ($url = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular_term'])), $url))) {
                                                 if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
                                                     if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
                                                         if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
                                                             if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
                                                                 if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
                                                                     if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
                                                                         if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
                                                                             if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
                                                                                 if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
                                                                                     if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
                                                                                         if (is_array($fields) && !empty($fields)) {
                                                                                             foreach ($fields as $var => $val) {
                                                                                                 if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
                                                                                                     break;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
                                                                                             c_ws_plugin__s2member_utils_urls::remote($url);
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         $paypal['s2member_log'][] = 'Modification Notification URLs have been processed.';
                     }
                     if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_recipients']) {
                         $msg = $sbj = '(s2Member / API Notification Email) - Modification';
                         $msg .= "\n\n";
                         // Spacing in the message body.
                         $msg .= 'subscr_id: %%subscr_id%%' . "\n";
                         $msg .= 'subscr_baid: %%subscr_baid%%' . "\n";
                         $msg .= 'subscr_cid: %%subscr_cid%%' . "\n";
                         $msg .= 'currency: %%currency%%' . "\n";
                         $msg .= 'currency_symbol: %%currency_symbol%%' . "\n";
                         $msg .= 'initial: %%initial%%' . "\n";
                         $msg .= 'regular: %%regular%%' . "\n";
                         $msg .= 'recurring: %%recurring%%' . "\n";
                         $msg .= 'initial_term: %%initial_term%%' . "\n";
                         $msg .= 'regular_term: %%regular_term%%' . "\n";
                         $msg .= 'item_number: %%item_number%%' . "\n";
                         $msg .= 'item_name: %%item_name%%' . "\n";
                         $msg .= 'first_name: %%first_name%%' . "\n";
                         $msg .= 'last_name: %%last_name%%' . "\n";
                         $msg .= 'full_name: %%full_name%%' . "\n";
                         $msg .= 'payer_email: %%payer_email%%' . "\n";
                         $msg .= 'user_first_name: %%user_first_name%%' . "\n";
                         $msg .= 'user_last_name: %%user_last_name%%' . "\n";
                         $msg .= 'user_full_name: %%user_full_name%%' . "\n";
                         $msg .= 'user_email: %%user_email%%' . "\n";
                         $msg .= 'user_login: %%user_login%%' . "\n";
                         $msg .= 'user_ip: %%user_ip%%' . "\n";
                         $msg .= 'user_id: %%user_id%%' . "\n";
                         if (is_array($fields) && !empty($fields)) {
                             foreach ($fields as $var => $val) {
                                 $msg .= $var . ': %%' . $var . '%%' . "\n";
                             }
                         }
                         $msg .= 'cv0: %%cv0%%' . "\n";
                         $msg .= 'cv1: %%cv1%%' . "\n";
                         $msg .= 'cv2: %%cv2%%' . "\n";
                         $msg .= 'cv3: %%cv3%%' . "\n";
                         $msg .= 'cv4: %%cv4%%' . "\n";
                         $msg .= 'cv5: %%cv5%%' . "\n";
                         $msg .= 'cv6: %%cv6%%' . "\n";
                         $msg .= 'cv7: %%cv7%%' . "\n";
                         $msg .= 'cv8: %%cv8%%' . "\n";
                         $msg .= 'cv9: %%cv9%%';
                         if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg))) {
                             if (($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg))) {
                                 if (($msg = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $msg)) && ($msg = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $msg))) {
                                     if (($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg)) && ($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg))) {
                                         if (($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg))) {
                                             if (($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg))) {
                                                 if (($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg))) {
                                                     if ($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $msg)) {
                                                         if ($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)) {
                                                             if (($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg))) {
                                                                 if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $msg)) {
                                                                     if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                         if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                             if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)) {
                                                                                 if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                         foreach ($fields as $var => $val) {
                                                                                             if (!($msg = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                 break;
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                     if ($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) {
                                                                                         // Still have a ``$sbj`` and a ``$msg``?
                                                                                         foreach (c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_recipients']) as $recipient) {
                                                                                             wp_mail($recipient, apply_filters('ws_plugin__s2member_modification_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_modification_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         $paypal['s2member_log'][] = 'Modification Notification Emails have been processed.';
                     }
                     if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_tracking_codes'])) {
                         if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code))) {
                             if (($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code))) {
                                 if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
                                     if (($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code))) {
                                         if (($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code))) {
                                             if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
                                                 if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
                                                     if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
                                                         if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
                                                             if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
                                                                 if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
                                                                     if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
                                                                         if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
                                                                             if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
                                                                                 if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                         foreach ($fields as $var => $val) {
                                                                                             if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
                                                                                                 break;
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                     if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
                                                                                         $paypal['s2member_log'][] = 'Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.';
                                                                                         set_transient('s2m_' . md5('s2member_transient_modification_tracking_codes_' . $paypal['subscr_id']), $code, 43200);
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_paypal_notify_during_subscr_modify', get_defined_vars());
                     unset($__refs, $__v);
                 } else {
                     $paypal['s2member_log'][] = 'Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.';
                 }
             } else {
                 $paypal['s2member_log'][] = 'Unable to modify Subscription. Could not get the existing User ID from the DB.';
             }
         } else {
             $paypal['s2member_log'][] = 'Not processing. Duplicate IPN.';
             $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `subscr_modify` ).';
             $paypal['s2member_log'][] = 'Duplicate IPN. Already processed. This IPN will be ignored.';
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_after_subscr_modify', get_defined_vars());
         unset($__refs, $__v);
         return apply_filters('c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level', $paypal, get_defined_vars());
     } else {
         return apply_filters('c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level', FALSE, get_defined_vars());
     }
 }
Пример #29
0
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page">' . "\n";
     echo '<div class="ws-menu-page-toolbox">' . "\n";
     c_ws_plugin__s2member_menu_pages_tb::display();
     echo '</div>' . "\n";
     echo '<h2>PayPal Pro-Forms</h2>' . "\n";
     echo '<table class="ws-menu-page-table">' . "\n";
     echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
     echo '<tr class="ws-menu-page-table-tr">' . "\n";
     echo '<td class="ws-menu-page-table-l">' . "\n";
     echo '<div class="ws-menu-page-group" title="PayPal Pro Requirements">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-requirements-section">' . "\n";
     echo '<h3>Is "PayPal Payments Pro" required for me to use Pro-Forms?</h3>' . "\n";
     echo '<p>Yes, PayPal Payments Pro is required for Pro-Forms. However, there are some exceptions to that rule.</p>' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h4>PayPal Payments Pro is Absolutely Required:</h4>' . "\n";
     echo '<ul>' . "\n";
     echo '	<li>For you to accept on-site credit card payments via Pro-Forms; i.e., not just PayPal Express Checkout.</li>' . "\n";
     echo '	<li>For Cancelation, Billing Update, and Billing Modification Pro-Forms to work as expected in all cases.</li>' . "\n";
     echo '	<li>Generally speaking, for you to take full advantage of everything that Pro-Forms can do; and to have them all work as originally intended.</li>' . "\n";
     echo '</ul>' . "\n";
     echo '<p><em><strong>See also:</strong> <a href="https://s2member.com/kb-article/supported-paypal-account-types/" target="_blank" rel="external">Supported PayPal Account Types</a></em></p>' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h4>PayPal Payments Pro is NOT Required (Exceptions):</h4>' . "\n";
     echo '<ul>' . "\n";
     echo '	<li>For you to introduce Free Registration Pro-Forms. In fact, you can use Free Registration Pro-Forms w/o even configuring PayPal API credentials.</li>' . "\n";
     echo '	<li>For you to accept PayPal Express Checkout only (not ideal). See: <a href="https://s2member.com/kb-article/do-s2member-pro-forms-work-with-paypal-standard-i-e-without-paypal-pro/" target="_blank" rel="external">this KB article</a> for details and important limitations.</li>' . "\n";
     echo '	<li style="font-style:italic;">If you integrate with Stripe™ instead (free, most popular). See: <a href="https://s2member.com/kb-article/does-s2member-integrate-w-stripe-bitcoin/" target="_blank" rel="external">Does s2Member Pro integrate w/ Stripe? Bitcoin?</a></li>' . "\n";
     echo '</ul>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Free Registration Forms">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-registration-forms-section">' . "\n";
     echo '<h3>One Form Does It All For Free Registrations (copy/paste)</h3>' . "\n";
     echo '<p>Whenever a visitor registers without paying, they\'ll automatically become a Free Subscriber, at Level #0.</p>' . "\n";
     echo '<p><em><strong>Note:</strong> the use of this particular Form will override your Open Registration configuration. In other words, making this Form available is the same as turning Open Registration <code>(on)</code>. One of the benefits to this functionality, is that it makes it possible for you to integrate this Free Registration Form in creative ways (i.e., making it available ONLY under certain circumstances); while still leaving Open Registration <code>(off)</code> throughout the rest of the site.</em></p>' . "\n";
     echo '<p><em><strong>Tip (optional):</strong> It is also possible to change the <code>level="0"</code> Attribute to something other than the default Level #0 (Free Subscriber). For example, if you need to, you can change it to <code>level="1"</code>, attach Custom Capabilities with the <code>ccaps=""</code> Attribute, and even limit this access to a certain timeframe with <code>tp="30" tt="D"</code> (i.e., 30 Days). So this Form is very flexible. It can be used to allow free access to just about any aspect of your service. For more information on Attributes, please see the section below: Shortcode Attributes (Explained).</em></p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-registration-form-shortcode.php")));
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr("0")), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"])), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-registration-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         echo '<div class="ws-menu-page-group" title="Forms For Level #' . $n . ' Access">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-level' . $n . '-forms-section">' . "\n";
         echo '<h3>Pro-Form Generator For Level #' . $n . ' Access</h3>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Form Code). These special PayPal Forms are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their Membership, or fails to make payments on time, s2Member will automatically terminate their Membership privileges. s2Member makes extensive use of the PayPal IPN service. s2Member receives updates from PayPal behind-the-scene.</p>' . "\n";
         echo '<p><em><strong>Please note:</strong> forms are NOT saved here. This is only a Form Generator. Once you\'ve generated your Form, copy/paste it into any Post/Page you like. You\'ll want to provide your visitors with a link to the Post/Page where this Form is located. We suggest placing a link to this Form on your Membership Options Page. That way your visitors can get registered &amp; checkout!</em></p>' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p id="ws-plugin--s2member-pro-level' . $n . '-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-pro-level' . $n . '-trial-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-trial-amount" value="0.00" size="4" /></p>' . "\n";
         echo '<p><span id="ws-plugin--s2member-pro-level' . $n . '-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-level' . $n . '-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"] ? "payflow" : "paypal") . "-membership-regular-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-desc" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]) . ' / description and pricing details here." size="68" /></p>' . "\n";
         echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nWith PayPal Pro integration, this is only applied to PayPal Express Checkout pages; when/if a Customer chooses PayPal as the Payment Method.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-pro-level' . $n . '-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__s2member_pro_paypalFormGenerate(\'level' . $n . '\');" /></p>' . "\n";
         echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-ccaps" size="40" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-form-shortcode.php")));
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($n)), $ws_plugin__s2member_pro_temp_s);
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_pro_temp_s);
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     echo '<div class="ws-menu-page-group" title="Billing Modification Forms">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-modification-forms-section">' . "\n";
     echo '<h3>Pro-Form Generator For Billing Modifications</h3>' . "\n";
     echo '<p>If you\'d like to give your Members (and/or your Free Subscribers) the ability to change (modify) their billing plan; you can generate a new PayPal Modification Form here. Configure the updated Level, pricing, terms, etc. Then, make that new Modification Form available to Members who are logged into their existing account with you. For example, you might want to insert a "Level #2" Upgrade link into your Login Welcome Page, which would up-sell existing Level #1 Members to a more expensive plan that you offer.</p>' . "\n";
     echo '<p><em><strong>Modification Process:</strong> Very simple. A Member clicks a link to a special Post/Page, which contains a Modification Form you\'ve generated. The Member fills in their billing information. After a successful form submission, s2Member will update the status of their account to the Level, pricing, and terms that you configure below. If the Member already has an existing paid Subscription with you, that paid Subscription will be cancelled automatically behind-the-scenes, and a new paid Subscription will be created to replace the old one. Again, the new paid Subscription is based on the Level, pricing, and terms that you specify below. If you need to give Customers some sort of grace period when/if they upgrade to a more expensive plan, please feel free to handle this through the application of free days, or with special pricing configured below.</em></p>' . "\n";
     echo '<p><em><strong>Integrating Conditionals:</strong> Since each Modification Form is configured for a specific Level, you may want to create multiple Modification Forms, one for each combination you intend to make available. s2Member\'s API Conditionals can help you display the proper Form to each Customer, based on the status of their existing account. For further details, see: <strong>s2Member → API Scripting</strong>.</em></p>' . "\n";
     echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<p><em><strong>Independent Custom Capabilities:</strong> If you just want to sell an existing Member new Custom Capabilities, without affecting their paid Subscription in any way, please see the next Form Generator: <code>Capability (Buy Now) Forms</code>. Independent Capability Forms facilitate Buy Now functionality, specifically for Custom Capabilities, without affecting the Customer\'s primary Subscription and Membership Level Access.</em></p>' . "\n" : '';
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p>Modification: <select id="ws-plugin--s2member-pro-modification-level">' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         echo '<optgroup label="Level #' . $n . '">' . "\n";
         echo '<option value="upgrade:' . $n . '">&uarr; Upgrade To Level #' . $n . '</option>' . "\n";
         echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<option value="downgrade:' . $n . '">&darr; Downgrade To Level #' . $n . '</option>' . "\n" : '';
         echo '</optgroup>' . "\n";
         echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<option disabled="disabled"></option>' . "\n" : '';
     }
     echo '</select></p>' . "\n";
     echo '<p id="ws-plugin--s2member-pro-modification-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-pro-modification-trial-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-trial-amount" value="0.00" size="4" /></p>' . "\n";
     echo '<p><span id="ws-plugin--s2member-pro-modification-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-modification-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"] ? "payflow" : "paypal") . "-membership-regular-terms.php"))) . '</select></p>' . "\n";
     echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
     echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nWith PayPal Pro integration, this is only applied to PayPal Express Checkout pages; when/if a Customer chooses PayPal as the Payment Method.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-pro-modification-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__s2member_pro_paypalFormGenerate(\'modification\');" /></p>' . "\n";
     echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-modification-ccaps" size="40" /></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-form-shortcode.php")));
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr("1")), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"])), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
     $ws_plugin__s2member_pro_temp_s = preg_replace("/\\/]\$/", 'modify="1" /]', $ws_plugin__s2member_pro_temp_s);
     // Adds modify="1" to the end of the Shortcode.
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-modification-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
         echo '<div class="ws-menu-page-group" title="Capability (Buy Now) Forms">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccap-forms-section">' . "\n";
         echo '<h3>Pro-Form Generator For Independent Custom Capabilities</h3>' . "\n";
         echo '<p>This is VERY advanced. For further details, please check your Dashboard: <strong>s2Member → API Scripting → Custom Capabiities</strong>.</p>' . "\n";
         echo '<p>With s2Member, you can sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>(i.e., you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like)</em>. So this is quite flexible. Independent Custom Capabilities do NOT rely on any specific Membership Level. That\'s why s2Member refers to these as `Independent` Custom Capabilities, because you can sell Capabilities this way, through Buy Now functionality, and the Customer\'s Membership Level Access, along with any existing paid Subscription they may already have with you, will remain completely unaffected. That being said, if you intend to charge a recurring fee for Custom Capabilities, please use a <code>Billing Modification Form</code> instead; because Independent Custom Capabilities can only be sold through Buy Now functionality.</p>' . "\n";
         echo '<p>Independent Custom Capabilities are added to a Customer\'s account immediately after checkout, and the Customer will have the Custom Capabilities for as long as their Membership lasts, based on their primary Subscription with your site, and/or forever, if they have a Lifetime account with you. In other words, Independent Custom Capabilities will exist on the Customer\'s account forever, or until an EOT <em>(End Of Term)</em> occurs on their primary Subscription with you; in which case s2Member would demote or delete the Customer\'s account <em>(based on your EOT configuration)</em>, and all Custom Capabilities are removed as well.</p>' . "\n";
         echo '<p>Very simple. All you do is customize the form fields provided, for each set of Custom Capabilities that you plan to sell. Then press (Generate Form Code). These special PayPal Forms are customized to work with s2Member seamlessly. The Customer will be granted additional access to one or more Custom Capabilities that you specify; while the Customer\'s Membership Level Access and any existing paid Subscription they may already have with you, will remain completely unaffected.</p>' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-ccap-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-ccap-terms.php"))) . '</select></p>' . "\n";
         echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
         echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nWith PayPal Pro integration, this is only applied to PayPal Express Checkout pages; when/if a Customer chooses PayPal as the Payment Method.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-pro-ccap-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__s2member_pro_paypalCcapFormGenerate();" /></p>' . "\n";
         echo '<p>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-ccap-ccaps" size="40" /></p>' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
         $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-ccaps-checkout-form-shortcode.php")));
         $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     echo '<div class="ws-menu-page-group" title="Billing Update Forms">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-update-forms-section">' . "\n";
     echo '<h3>One Form Does It All For Billing Updates (copy/paste)</h3>' . "\n";
     echo '<p>An Update Form can be provided to existing Members, as a way for them to update their billing information; without modifying their existing paid Subscription in any way. For instance, a Customer may need to update their billing information, because their credit card is expiring, or because they moved their bank account.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-update-form-shortcode.php")));
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-update-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Billing Cancellation Forms">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-cancellation-forms-section">' . "\n";
     echo '<h3>One Form Does It All For Cancellations (copy/paste)</h3>' . "\n";
     echo '<p>According to PayPal\'s policy on recurring billing, you MUST provide each and every Customer with an easy to way to cancel future charges. Generating a Cancellation Form here, and making that Form available to all Customers is our recommendation. For further details and legalities, please visit the <a href="http://s2member.com/r/paypal-developer-network/" target="_blank" rel="external">PayPal Developer Network</a>.</p>' . "\n";
     echo '<p><em><strong>Cancellation Process:</strong> Very simple. A Member clicks a link to a Post/Page that contains a Cancellation Form you\'ve generated. The Member clicks the Submit button to confirm the cancellation. s2Member is notified silently behind-the-scenes, and will immediately cancel all future billing. s2Member will later terminate their account access, at the correct point in time. This works in conjunction with the s2Member Auto-EOT System. For further details, see: <strong>s2Member → PayPal Options → EOT Behavior</strong>.</em></p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-cancellation-form-shortcode.php")));
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-cancellation-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Member Registration Access Links">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-reg-links-section">' . "\n";
     echo '<h3>Registration Access Link Generator (for Customer Service)</h3>' . "\n";
     echo '<p>s2Member Pro-Forms consolidate the Registration/Checkout process into a single-step solution, so it is unlikely that you will ever need this tool. That being said, if you DO need to deal with a Customer Service issue that requires a simple paid Registration Access Link to be created manually, you can use this tool for that. Alternatively, you can create their account yourself/manually by going to <strong>Users → Add New</strong>. Either of these methods will work fine.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p>Paid Membership Level#: <select id="ws-plugin--s2member-pro-reg-link-level">' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
         echo '<option value="' . $n . '">s2Member Level #' . $n . '</option>' . "\n";
     }
     echo '</select></p>' . "\n";
     echo '<p>Paid Subscr. ID: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-subscr-id" value="" size="50" /> <a href="#" onclick="alert(\'The Customer\\\'s Paid Subscr. ID (aka: Recurring Profile ID, Transaction ID) must be unique. This value can be obtained from inside your PayPal account in the History tab. Each paying Customer MUST be associated with a unique Paid Subscr. ID. If the Customer is NOT associated with a Paid Subscr. ID, you will need to generate a unique value for this field on your own. But keep in mind, s2Member will be unable to maintain future communication with the PayPal IPN (i.e., Notification) service if this value does not reflect a real Paid Subscr. ID that exists in your PayPal History log.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p>Custom String Value: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-custom" value="' . esc_attr($_SERVER["HTTP_HOST"]) . '" size="30" /> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_paypalRegLinkGenerate();" /> <img id="ws-plugin--s2member-pro-reg-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member → API Scripting → Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-ccaps" size="40" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" /></p>' . "\n";
     echo '<p>Fixed Term Length (for Buy Now transactions): <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-fixed-term" value="" size="10" /> <a href="#" onclick="alert(\'If the Customer purchased Membership through a Buy Now transaction (i.e., there is no Initial/Trial Period and no recurring charges for ongoing access), you may configure a Fixed Term Length in this field. This way the Customer\\\'s Membership Access is revoked by s2Member at the appropriate time. This will be a numeric value, followed by a space, then a single letter.\\n\\nHere are some examples:\\n\\n1 D (this means 1 Day)\\n1 W (this means 1 Week)\\n1 M (this means 1 Month)\\n1 Y (this means 1 Year)\\n1 L (this means 1 Lifetime)\'); return false;">[?]</a></p>' . "\n";
     echo '<p id="ws-plugin--s2member-pro-reg-link" class="monospace" style="display:none;"></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Specific Post/Page (Buy Now) Forms">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-forms-section">' . "\n";
     echo '<h3>Pro-Form Generator For Specific Post/Page Forms</h3>' . "\n";
     echo '<p>s2Member now supports an additional layer of functionality (very powerful), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" functionality. Your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
     echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link (see: <strong>s2Member → PayPal Options → Specific Post/Page Email</strong>). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
     echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <strong>s2Member → Restriction Options → Specific Post/Page Access</strong>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
     echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Form Code). These special PayPal Forms are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction.</p>' . "\n";
     echo '<p><em><strong>Please note:</strong> forms are NOT saved here. This is only a Form Generator. Once you\'ve generated your Form, copy/paste it into any Post/Page you like. You\'ll want to provide your visitors with a link to the Post/Page where this Form is located.</em></p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
     echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-sp-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-sp-hours.php"))) . '</select></p>' . "\n";
     echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
     echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal account. PayPal allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal, you can enter that Page Style here.\\n\\nWith PayPal Pro integration, this is only applied to PayPal Express Checkout pages; when/if a Customer chooses PayPal as the Payment Method.\'); return false;" tabindex="-1">[?]</a>: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-pro-sp-currency">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__s2member_pro_paypalSpFormGenerate();" /></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual &amp; HTML Editors)<br />' . "\n";
     $ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-sp-checkout-form-shortcode.php")));
     $ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
     echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Specific Post/Page Access Links">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-links-section">' . "\n";
     echo '<h3>Specific Post/Page Access Link Generator (for Customer Service)</h3>' . "\n";
     echo '<p>s2Member automatically generates Specific Post/Page Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Access Link to be created manually, you can use this tool for that.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\\n\\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-additional-ids" multiple="multiple" style="height:100px; min-width:450px;">' . "\n";
     echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
     foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
     }
     echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page (they\\\'ll land on your Leading Post/Page after checkout), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically (i.e., only one Access Link is needed, and s2Member generates this automatically). However, you will STILL need to design your Leading Post/Page (which is what a Customer will actually land on), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     echo '<p><select id="ws-plugin--s2member-pro-sp-link-hours">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-sp-hours.php"))) . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_paypalSpLinkGenerate();" /> <img id="ws-plugin--s2member-pro-sp-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p id="ws-plugin--s2member-pro-sp-link" class="monospace" style="display:none;"></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
         echo '<div class="ws-menu-page-group" title="Custom Return URLs Upon Success">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-forms-success-section">' . "\n";
         echo '<h3>Custom Return URLs Upon Success (optional, for developers)</h3>' . "\n";
         echo '<p>s2Member Pro opens the door for Custom Return URLs upon success. You can add a special attribute to any Form Shortcode (<code>success="/my-thank-you-page/"</code>). This makes it possible to integrate PayPal Pro-Forms in very creative ways; and even receive/verify Replacement Code variables, as needed. For example, (<code>success="/my-thank-you-page/?subscr_id=%%subscr_id%%"</code>).</p>' . "\n";
         echo '<p><em>A Custom Return URL is 100% optional. In fact, if you only need to obtain details for the purpose of tracking sales, you should just use the simpler API Tracking methods provided by s2Member, under: <strong>s2Member → API / Tracking</strong>. In other words, if you don\'t use the <code>success=""</code> attribute in your Shortcode, s2Member will handle things gracefully, all on its own. So using a Custom Return URL is only necessary when you need advanced customization for one reason or another.</em></p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Free Registration Forms (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-free-registration\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-free-registration" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%role%%</code> = The Role ID <code>(subscriber, s2member_level[0-9]+, administrator, editor, author, contributor)</code>.</li>' . "\n";
         echo '<li><code>%%level%%</code> = The Level number <code>(0, 1, 2, 3, 4)</code>. (<em>deprecated, no longer recommended; use <code>%%role%%</code></em>)</li>' . "\n";
         echo '<li><code>%%ccaps%%</code> = Custom Capabilities. Ex: <code>music,videos,free_gift</code> (<em>in comma-delimited format</em>).</li>' . "\n";
         echo '<li><code>%%auto_eot_time%%</code> = Auto-EOT Time (if applicable). Ex: <code>1299925670</code> (<em>unix timestamp</em>).</li>' . "\n";
         echo '<li><code>%%user_first_name%%</code> = The First Name of the Member who registered their Username.</li>' . "\n";
         echo '<li><code>%%user_last_name%%</code> = The Last Name of the Member who registered their Username.</li>' . "\n";
         echo '<li><code>%%user_full_name%%</code> = The Full Name (First &amp; Last) of the Member who registered their Username.</li>' . "\n";
         echo '<li><code>%%user_email%%</code> = The Email Address of the Member who registered their Username.</li>' . "\n";
         echo '<li><code>%%user_login%%</code> = The Username the Member selected during registration.</li>' . "\n";
         echo '<li><code>%%user_pass%%</code> = The Password selected or generated during registration.</li>' . "\n";
         echo '<li><code>%%user_ip%%</code> = The User\'s IP Address, via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>' . "\n";
         echo '<li><code>%%user_id%%</code> = A unique WordPress User ID generated during registration.</li>' . "\n";
         echo '<li><code>%%response%%</code> = Deprecated. Use <code>%%s_response%%</code>. A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like.</li>' . "\n";
         echo '<li><code>%%s_response%%</code> = A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like. Value is encrypted. Use <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_decrypt()" target="_blank" rel="external">s2member_decrypt()</a>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Registration/Profile Fields are also supported here:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
         echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
         echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
         echo '<li><em><code>%%etc, etc...%%</code> <strong>see:</strong> s2Member → General Options → Registration/Profile Fields</em>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
         echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />' . "\n";
         echo '<em>(The campaign (i.e., christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />' . "\n";
         echo '<code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|christmas-promo"</code>' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Membership Sales / Signups &amp; Modifications (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-sales\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-sales" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%subscr_id%%</code> = The PayPal Subscription ID, which remains constant throughout any &amp; all future payments. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the purchase. PayPal does not provide a specific Subscription ID for Buy Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring (i.e., there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%subscr_baid%%</code> = Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. This is the Subscription\'s Billing Agreement ID, which remains constant throughout any &amp; all future payments. [ <a href="#" onclick="alert(\'Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. In all other cases, the %%subscr_baid%% is simply set to the %%subscr_id%% value; i.e., it is a duplicate of %%subscr_id%% in most cases.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%currency%%</code> = Three-character currency code (uppercase); e.g., <code>USD</code></li>' . "\n";
         echo '<li><code>%%currency_symbol%%</code> = Currency code symbol; e.g., <code>$</code></li>' . "\n";
         echo '<li><code>%%initial%%</code> = The Initial Fee charged during signup. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. Even if that amount is 0.\\n\\nIf a Customer signs up, under the terms of a 100% Free Trial Period, this will be 0. So be careful using %%initial%% when you offer a 100% Free Trial Period, because a $0.00 sale amount could cause havoc with affiliate programs.\\n\\nIf you\\\'re offering a 100% Free Trial Period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `s2Member → API Notifications → Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. If you offer something 100% free, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% &amp; %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased the Membership Subscription.</li>' . "\n";
         echo '<li><code>%%last_name%%</code> = The Last Name of the Customer who purchased the Membership Subscription.</li>' . "\n";
         echo '<li><code>%%full_name%%</code> = The Full Name (First &amp; Last) of the Customer who purchased the Membership Subscription.</li>' . "\n";
         echo '<li><code>%%payer_email%%</code> = The Email Address of the Customer who purchased the Membership Subscription.</li>' . "\n";
         echo '<li><code>%%item_number%%</code> = The Item Number (colon separated <code><em>level:custom_capabilities:fixed term</em></code>) for the Membership Subscription.</li>' . "\n";
         echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item Number).</li>' . "\n";
         echo '<li><code>%%initial_term%%</code> = This is the term length of the Initial Period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D (this means 1 Day)\\n%%initial_term%% = 1 W (this means 1 Week)\\n%%initial_term%% = 1 M (this means 1 Month)\\n%%initial_term%% = 1 Y (this means 1 Year)\\n\\nThe Initial Period never recurs, so this only lasts for the term length specified, then it is over.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%regular_term%%</code> = This is the term length of the Regular Period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D (this means 1 Day)\\n%%regular_term%% = 1 W (this means 1 Week)\\n%%regular_term%% = 1 M (this means 1 Month)\\n%%regular_term%% = 1 Y (this means 1 Year)\\n%%regular_term%% = 1 L (this means 1 Lifetime)\\n\\nThe Regular Term is usually recurring. So the Regular Term value represents the period (or duration) of each recurring period. If %%recurring%% = 0, then the Regular Term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their Membership privileges are going to last after the %%initial_term%% has expired, if there was an Initial Term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%modification%%</code> = <code>1</code> if/when a Billing Modification has just taken place; otherwise <code>0</code> indicates a new Customer.</li>' . "\n";
         echo '<li><code>%%user_first_name%%</code> = The First Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_last_name%%</code> = The Last Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_full_name%%</code> = The Full Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_email%%</code> = The Email Address associated with their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_login%%</code> = The Username associated with their account. The Customer created this during registration.</li>' . "\n";
         echo '<li><code>%%user_ip%%</code> = The Customer\'s original IP Address, during checkout/registration via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>' . "\n";
         echo '<li><code>%%user_id%%</code> = A unique WordPress User ID that references this account in the WordPress database.</li>' . "\n";
         echo '<li><code>%%response%%</code> = Deprecated. Use <code>%%s_response%%</code>. A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like.</li>' . "\n";
         echo '<li><code>%%s_response%%</code> = A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like. Value is encrypted. Use <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_decrypt()" target="_blank" rel="external">s2member_decrypt()</a>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Coupon Replacement Codes:</strong>' . "\n";
         echo '<ul class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code—if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (i.e., the full Coupon Code).</li>' . "\n";
         echo '<li><code>%%coupon_code%%</code> = A Coupon Code—if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
         echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e., the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Registration/Profile Fields are also supported here:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
         echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
         echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
         echo '<li><em><code>%%etc, etc...%%</code> <strong>see:</strong> s2Member → General Options → Registration/Profile Fields</em>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
         echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />' . "\n";
         echo '<em>(The campaign (i.e., christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />' . "\n";
         echo '<code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|christmas-promo"</code>' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Independent Custom Capability Sales (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-ccaps\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-ccaps" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%txn_id%%</code> = The Payment Transaction ID, which is always unique for each payment received.</li>' . "\n";
         echo '<li><code>%%currency%%</code> = Three-character currency code (uppercase); e.g., <code>USD</code></li>' . "\n";
         echo '<li><code>%%currency_symbol%%</code> = Currency code symbol; e.g., <code>$</code></li>' . "\n";
         echo '<li><code>%%amount%%</code> = The Amount of the payment. Most affiliate programs calculate commissions from this.</li>' . "\n";
         echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased the Independent Custom Capabilities.</li>' . "\n";
         echo '<li><code>%%last_name%%</code> = The Last Name of the Customer who purchased the Independent Custom Capabilities.</li>' . "\n";
         echo '<li><code>%%full_name%%</code> = The Full Name (First &amp; Last) of the Customer who purchased the Independent Custom Capabilities.</li>' . "\n";
         echo '<li><code>%%payer_email%%</code> = The Email Address of the Customer who purchased the Independent Custom Capabilities.</li>' . "\n";
         echo '<li><code>%%item_number%%</code> = The Item Number (colon separated <code><em>*level:custom_capabilities:fixed term</em></code>) that the payment is for. [ <a href="#" onclick="alert(\'With Independent Custom Capabilities, the `level` portion of this string will be an asterisk ( `*` ), since the Membership Level is irrelevant, and remains `as it was`.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item Number).</li>' . "\n";
         echo '<li><code>%%user_first_name%%</code> = The First Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_last_name%%</code> = The Last Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_full_name%%</code> = The Full Name listed on their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_email%%</code> = The Email Address associated with their User account. This might be different than what is on file with your Payment Gateway.</li>' . "\n";
         echo '<li><code>%%user_login%%</code> = The Username associated with their account. The Customer created this during registration.</li>' . "\n";
         echo '<li><code>%%user_ip%%</code> = The Customer\'s original IP Address, during checkout/registration via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>' . "\n";
         echo '<li><code>%%user_id%%</code> = A unique WordPress User ID that references this account in the WordPress database.</li>' . "\n";
         echo '<li><code>%%response%%</code> = Deprecated. Use <code>%%s_response%%</code>. A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like.</li>' . "\n";
         echo '<li><code>%%s_response%%</code> = A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, it might contain a link to the login page. You don\'t have to use this. You can generate your own response if you like. Value is encrypted. Use <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_decrypt()" target="_blank" rel="external">s2member_decrypt()</a>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Coupon Replacement Codes:</strong>' . "\n";
         echo '<ul class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code—if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (i.e., the full Coupon Code).</li>' . "\n";
         echo '<li><code>%%coupon_code%%</code> = A Coupon Code—if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
         echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e., the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Registration/Profile Fields are also supported here:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
         echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
         echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
         echo '<li><em><code>%%etc, etc...%%</code> <strong>see:</strong> s2Member → General Options → Registration/Profile Fields</em>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
         echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />' . "\n";
         echo '<em>(The campaign (i.e., christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />' . "\n";
         echo '<code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|christmas-promo"</code>' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Specific Post/Page Transactions (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-sp-sales\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-sp-sales" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%sp_access_url%%</code> = The full URL (generated by s2Member) where the Customer can gain access.</li>' . "\n";
         echo '<li><code>%%sp_access_exp%%</code> = Human readable expiration for <code>%%sp_access_url%%</code>. Ex: <em>(link expires in <code>%%sp_access_exp%%</code>)</em>.</li>' . "\n";
         echo '<li><code>%%txn_id%%</code> = The PayPal Transaction ID. PayPal assigns a unique identifier for every purchase.</li>' . "\n";
         echo '<li><code>%%currency%%</code> = Three-character currency code (uppercase); e.g., <code>USD</code></li>' . "\n";
         echo '<li><code>%%currency_symbol%%</code> = Currency code symbol; e.g., <code>$</code></li>' . "\n";
         echo '<li><code>%%amount%%</code> = The full Amount of the sale. Most affiliate programs calculate commissions from this.</li>' . "\n";
         echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>%%last_name%%</code> = The Last Name of the Customer who purchased Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>%%full_name%%</code> = The Full Name (First &amp; Last) of the Customer who purchased Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>%%payer_email%%</code> = The Email Address of the Customer who purchased Specific Post/Page Access.</li>' . "\n";
         echo '<li><code>%%user_ip%%</code> = The Customer\'s IP Address, detected during checkout via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>' . "\n";
         echo '<li><code>%%item_number%%</code> = The Item Number. Ex: <code><em>sp:13,24,36:72</em></code> (translates to: <code><em>sp:comma-delimited IDs:expiration hours</em></code>).</li>' . "\n";
         echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item Number).</li>' . "\n";
         echo '<li><code>%%response%%</code> = Deprecated. Use <code>%%s_response%%</code>. A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, a link to the Specific Post/Page. You don\'t have to use this. You can generate your own response if you like.</li>' . "\n";
         echo '<li><code>%%s_response%%</code> = A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, a link to the Specific Post/Page. You don\'t have to use this. You can generate your own response if you like. Value is encrypted. Use <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_decrypt()" target="_blank" rel="external">s2member_decrypt()</a>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Coupon Replacement Codes:</strong>' . "\n";
         echo '<ul class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code—if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (i.e., the full Coupon Code).</li>' . "\n";
         echo '<li><code>%%coupon_code%%</code> = A Coupon Code—if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
         echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e., the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
         echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />' . "\n";
         echo '<em>(The campaign (i.e., christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />' . "\n";
         echo '<code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|christmas-promo"</code>' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Cancellations &amp; Billing Updates (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-cancellations-updates\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-cancellations-updates" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;" class="ws-menu-page-li-margins">' . "\n";
         echo '<li><code>%%response%%</code> = Deprecated. Use <code>%%s_response%%</code>. A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, a link back to their account page. You don\'t have to use this. You can generate your own response if you like.</li>' . "\n";
         echo '<li><code>%%s_response%%</code> = A successful response message that *would* have been displayed to the Customer, had they NOT been redirected to your Custom Return URL upon success. This may contain some basic HTML. For instance, a link back to their account page. You don\'t have to use this. You can generate your own response if you like. Value is encrypted. Use <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_decrypt()" target="_blank" rel="external">s2member_decrypt()</a>.</li>' . "\n";
         echo '</ul>' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Verify The Integrity Of Replacement Codes (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-forms-success-verification\').toggle(); return false;" class="ws-dotted-link">open/close</a>)</h3>' . "\n";
         echo '<div id="ws-plugin--s2member-pro-forms-success-verification" style="display:none;">' . "\n";
         echo '<p>If you know a little PHP, you can verify the integrity of the Replacement Codes returned by s2Member. This is important, because in this particular situation, Replacement Codes are passed publicly in the query string of your Custom Return URL. In other words, a Customer could manually change one of the values; like the dollar amounts. For this reason, you should always verify the integrity of the details being returned to any processing routines that receive this information. In the PHP code for your Custom Return URL, you can use this s2Member API Function: <code>s2member_pro_paypal_s2p_v_query_ok()</code>.</p>' . "\n";
         echo '<p>Here are some examples:</p>' . "\n";
         echo '<p>1. <strong>Shortcode attribute:</strong> <code>success="/thank-you/?subscr_id=%%subscr_id%%&amp;initial=%%initial%%&amp;regular=%%regular%%"</code></p>' . "\n";
         echo '<p>2. <strong>s2Member returns Customer to:</strong> <code>/thank-you/?subscr_id=123&amp;initial=0.00&amp;regular=24.95&amp;s2p-v=234098234-23409sdfs234sd234209sdf</code></p>' . "\n";
         echo '<p>3. <strong>Now, in your Custom Return Page, you will need to do this before trusting anything:</strong></p>' . "\n";
         echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/paypal-s2p-v-query-ok-1.x-php")) . '</p>' . "\n";
         echo '<p>s2Member will only verify a query string for up to 10 seconds. After 10 seconds, <code>s2member_pro_paypal_s2p_v_query_ok()</code> will always return <code>false</code>, even if the integrity of the query string is valid. This prevents a Customer from bookmarking your Return URL; thereby causing duplicate commissions; in case you\'re using it for tracking purposes.</p>' . "\n";
         echo '<p>Again, if you only need to obtain details for the purpose of tracking sales, you should just use the simpler API Tracking methods provided by s2Member, under: <strong>s2Member → API / Tracking</strong>. The API Tracking methods are specifically designed for tracking sales, exactly ONE time for each Customer.</p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><em>If it is your intention to allow Customers to bookmark your Custom Return URL, you can still do that. Just be aware that <code>s2member_pro_paypal_s2p_v_query_ok()</code> will return <code>false</code> after the first 10 seconds. If you want to verify after 10 seconds, you can pass a second argument to the function, like this:</em></p>' . "\n";
         echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/paypal-s2p-v-query-ok-2.x-php")) . '</p>' . "\n";
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<h3>Could a Customer change the timestamp in the URL?</h3>' . "\n";
         echo '<p>Based on the structure of the URL, it would appear possible; however, it\'s NOT. s2Member uses an advanced checksum.</p>' . "\n";
         echo '<h3>Can I get rid of the <code>s2p-v</code> variable?</h3>' . "\n";
         echo '<p>No, this variable is always passed to your Custom Return URL, it\'s for important verification purposes.</p>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     echo '<div class="ws-menu-page-group" title="Shortcode Attributes (Explained)">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-shortcode-attrs-section">' . "\n";
     echo '<h3>Shortcode Attributes (Explained In Full Detail)</h3>' . "\n";
     echo '<p>When you generate a Form, s2Member will make a <a href="http://s2member.com/r/shortcode-reference/" target="_blank" rel="external">Shortcode</a> available to you. Like most Shortcodes for WordPress, s2Member reads Attributes in your Shortcode. These Attributes will be pre-configured by one of s2Member\'s Form Generators automatically; so there really is nothing more you need to do. However, many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.</p>' . "\n";
     echo '<table class="form-table" style="margin-top:0;">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr style="padding-top:0;">' . "\n";
     echo '<td style="padding-top:0;">' . "\n";
     echo '<ul class="ws-menu-page-li-margins">' . "\n";
     echo '<li><code>accept="paypal,visa,mastercard,amex,discover,maestro,solo"</code> Accepted Billing Methods. A comma-delimited list of Billing Methods you want to accept. Due to a PayPal policy, you may NOT exclude PayPal from this list; s2Member won\'t let you. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>accept_via_paypal="paypal"</code> Accepted Billing via PayPal. A comma-delimited list of Billing Methods you want to accept through PayPal, as opposed to processing them on-site. Due to a PayPal policy, you may NOT exclude PayPal from this list; s2Member won\'t let you. <strong>Tip:</strong> If you don\'t have a PayPal Pro account, you can set <code>accept="paypal"</code>, or set <code>accept_via_paypal="paypal,visa,mastercard,amex,discover,maestro,solo"</code>. With one or both of these configurations, all you need is a PayPal Standard account with Express Checkout <em>(which is free)</em>. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>accept_coupons="1"</code> Accept Coupons? Possible values: <code>0</code> = do NOT accept Coupons on this particular Form; <code>1</code> = DO accept Coupon Codes on this particular Form.</li>' . "\n";
     echo '<li><code>cancel="0"</code> Cancellation Form. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Cancellation Form, <code>1</code> = this IS a Cancellation Form.</li>' . "\n";
     echo '<li><code>captcha=""</code> When you set this Attribute, visitors must prove they\'re human by typing a <a href="http://s2member.com/r/captcha-reference/" target="_blank" rel="external">captcha/security code</a>. This service is powered by Google\'s reCaptcha system. Possible values: <code>0</code> = do NOT require a captcha code on this Form; <code>clean</code> = DO require a captcha code on this Form; using the <code>clean</code> theme style. Possible theme styles include: <code>red</code>, <code>white</code>, <code>clean</code>, and <code>blackglass</code>. Or, if you supplied reCaptcha v2 keys in your s2Member General Options (i.e., you are using reCaptcha v2), this must be <code>light</code> or <code>dark</code>.</li>' . "\n";
     echo '<li><code>cc="USD"</code> 3 character Currency Code. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<li><code>ccaps="music,videos"</code> A comma-delimited list of Custom Capabilities. Only valid w/ Membership Level Access and/or Independent Custom Capabilities.</li>' . "\n" : '';
     echo '<li><code>coupon="SAVE-10"</code> Default/pre-filled Coupon Code. This is optional, and the Coupon Code (if supplied) must exist in your Coupon Code configuration.</li>' . "\n";
     echo '<li><code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '"</code> must start with your domain. Additional values can be piped in (ex: <code>custom="' . esc_html($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3|etc"</code>). Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>default_country_code="US"</code> If you set this 2-character value, it will pre-configure the default Country that is selected in the drop-down menu for Checkout and Billing Update Forms. This MUST be an uppercase country code, following the <a href="http://s2member.com/r/iso-3166/" target="_blank" rel="external">ISO-3166-1 specification</a>. If this is empty(i.e., <code>""</code>) s2Member will set the default country code automatically; based on currency. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>desc="Gold Membership @ $29/mo"</code> A brief purchase Description. This can be as long as you like. However, all descriptions passed through PayPal APIs are truncated automatically to 60 characters max (i.e., the maximum allowed length for PayPal descriptions is 60 characters). Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>dg="0"</code> The Digital Goods directive. s2Member will eventually be integrated with <a href="http://s2member.com/r/paypal-express-checkout-digitals/" target="_blank" rel="external">Digital Goods</a> for inline Express Checkout. But for now, this should always be <code>0</code>.</li>' . "\n";
     echo '<li><code>exp="72"</code> Access Expires (in hours). Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
     echo '<li><code>ids="14"</code> A Post/Page ID#, or a comma-delimited list of IDs. Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
     echo '<li><code>lang=""</code> Optional 5 character Button Language Code <em>(ake: Locale Code—ex: <code>en_US</code>)</em>. This controls the interface language of the PayPal Express Checkout Button itself. If unspecified, the language defaults to English (i.e., <code>en_US</code>; or to the value set by an optional MO translation file; which translates s2Member overall). See <a href="http://s2member.com/r/paypal-locale-codes/" target="_blank" rel="external">this list of possible Locale Codes</a>.</li>' . "\n";
     echo '<li><code>lc=""</code> Optional 2 character Country/Locale Code <em>(i.e., Country Code—ex: <code>US</code>)</em>. This controls the interface language used when/if a Customer chooses PayPal Express Checkout as their payment method. If unspecified, the language is determined by PayPal Express Checkout when possible, defaulting to <code>US</code> <em>english</em> when not possible. See <a href="http://s2member.com/r/paypal-locale-codes/" target="_blank" rel="external">this list of possible Country Codes</a>. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>level="1"</code> Membership Level [1-4] <em>(or, up to the number of configured Levels)</em>. Only valid for Forms providing Membership Level Access, which includes Free Registration Forms too. Free Registration Forms allow a value of <code>level="0"</code> whenever <code>register="1"</code> for Free Registration. In addition, Free Registration Forms will also allow visitors to register for free, even at higher Levels if you wish. Free Registration Forms will accept any value [0-4] <em>(or, up to the number of configured Levels)</em>.' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' With Independent Custom Capabilities this MUST be set to <code>level="*"</code>, and <code>ccaps=""</code> must NOT be empty <em>(i.e., <code>level="*" ccaps="music,videos"</code>)</em>.') . '</li>' . "\n";
     echo '<li><code>modify="0"</code> Modification directive. Only valid w/ Membership Level Access. Possible values: <code>0</code> = allows Customers to modify their current Subscription or sign up for a new one, <code>1</code> = allows Customers to only modify their current Subscription. When <code>modify="1"</code>, s2Member will force a Customer to be logged-in before they can fill out the Form (very handy). This is slightly different than PayPal "Button" Codes; there is no "2" option for "Forms"; only <code>0</code> &amp; <code>1</code> are valid values.</li>' . "\n";
     echo '<li><code>ns="0"</code> The <em>no_shipping</em> directive. Possible values: <code>0</code> = prompt for an address, but do not require one, <code>1</code> = do not prompt for a shipping address, <code>2</code> = prompt for an address, and require one. Applies only to PayPal Express Checkout; because Pro-Forms do not ask for a Shipping Address. However, you may request a Shipping Address by creating Custom Fields under: <em>s2Member → General Options → Registration/Profile Fields</em>. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>ps="paypal"</code> PayPal checkout Page Style. Applies only to PayPal Express Checkout. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>register="0"</code> Free Registration Form. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Free Registration Form, <code>1</code> = this IS a Free Registration Form.</li>' . "\n";
     echo '<li><code>ra="0.01"</code> Regular, Buy Now, and/or Recurring Amount. Can also be <code>0.00</code> to provide free access. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>rp="1"</code> Regular Period. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Must be &gt;= <code>1</code> (ex: <code>1</code> Week, <code>2</code> Months, <code>1</code> Month, <code>3</code> Days).—<strong>NOTICE (regarding Payflow):</strong> If you are operating a PayPal Pro (Payflow Edition) account, please take note. Payflow supports ONLY a specific set of recurring intervals. Pro-Forms integrated with the Payflow API can be configured to charge: weekly, bi-weekly, monthly, quarterly, semi-yearly or yearly.</li>' . "\n";
     echo '<li><code>rt="M"</code> Regular Term. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years, <code>L</code> = Lifetime.—<strong>NOTICE (regarding Payflow):</strong> If you are operating a PayPal Pro (Payflow Edition) account, please take note. Payflow supports ONLY a specific set of recurring intervals. Pro-Forms integrated with the Payflow API can be configured to charge: weekly, bi-weekly, monthly, quarterly, semi-yearly or yearly.</li>' . "\n";
     echo '<li><code>rr="1"</code> Recurring directive. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>0</code> = non-recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>1</code> = recurring "Subscription" with possible Trial Period for free, or at a different Trial Amount; <code>BN</code> = non-recurring "Buy Now" functionality, no Trial Period possible.</li>' . "\n";
     echo '<li><code>rrt=""</code> Recurring Times <em>(i.e., a fixed number of installments)</em>. Only valid w/ Membership Level Access. When unspecified, any recurring charges will remain ongoing until cancelled, or until payments start failing. If this is set to <code>1 or higher</code> the regular recurring charges will only continue for X billing cycles, depending on what you specify. This is only valid when <code>rr="1"</code> for recurring "Subscriptions". Please note that a fixed number of installments, also means a fixed period of access. If a Customer\'s billing is monthly, and you set <code>rrt="3"</code>, billing will continue for only 3 monthly installments. After that, billing would stop, and their access to the site would be revoked as well <em>(based on your EOT Behavior setting under: s2Member → PayPal Options)</em>. <strong>IMPORTANT NOTE:</strong> If you don\'t offer a trial period; i.e., the first charge occurs when a customer completes checkout, you should set this to the number of <em>additional</em> payments, and NOT to the total number. For instance, if I want to charge the customer a total of 3 times, and one of those charges occurs when they complete checkout, I set should this to <code>rrt="2"</code> for a grand total of three all together.</li>' . "\n";
     echo '<li><code>rra="2"</code> Reattempt billing when/if a recurring payment fails; exactly X number of times; and then automatically suspend the customer\'s account (i.e., the customer loses access). By default, PayPal will retry a maximum of 2 times whenever <code>rra="2"</code>; after that, a Subscription would be terminated due to Max Failed Payments having been reached. The value of this attribute configures Max Failed Payments. A setting of <code>rra="2"</code> means that you allow a maximum of 2 failed payments. Setting <code>rra="0"</code> means that you allow an infinite number of failed payments.</li>' . "\n";
     echo '<li><code>sp="0"</code> Specific Post/Page Form. Possible values: <code>0</code> = this is NOT a Specific Post/Page Access Form, <code>1</code> = this IS a Specific Post/Page Access Form.</li>' . "\n";
     echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<li><code>success=""</code> 100% optional. This can be used to create a Custom Return URL on success. Please see the sub-section above titled: <em>Custom Return URLs on Success</em>.</li>' . "\n" : '';
     echo !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? '<li><code>template=""</code> 100% optional. This can be a custom template file that exists inside your WordPress theme directory. For example: <code>template="checkout.php"</code>. Please see <a href="http://s2member.com/kb-article/can-i-customize-pro-forms/" target="_blank" rel="external">this KB article</a> for further details.</li>' . "\n" : '';
     echo '<li><code>ta="0.00"</code> Trial Amount. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
     echo '<li><code>tp="0"</code> Trial Period. Only valid w/ Membership Level Access. Must be <code>0</code> when <code>rt="L"</code> or when <code>rr="BN"</code>.</li>' . "\n";
     echo '<li><code>tt="D"</code> Trial Term. Only valid w/ Membership Level Access. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years.</li>' . "\n";
     echo '<li><code>unsub="0"</code> Unsubscribe user? Only valid when <code>cancel="1"</code>. Possible values: <code>0</code> = do NOT unsubscribe (wait until an EOT occurs), <code>1</code> = yes, unusbscribe user immediately; i.e., when they submit the cancellation form. <em>NOTE: Just to clarify, this pertains to List Servers that you\'ve configured with s2Member. Setting <code>unsub="1"</code> will cause the user to be unsubscribed from a mailing list (if they are currently subscribed).</em></li>' . "\n";
     echo '<li><code>update="0"</code> Billing Update Form. Only valid w/ Membership Level Access. Possible values: <code>0</code> = this is NOT a Billing Update Form, <code>1</code> = this IS a Billing Update Form.</li>' . "\n";
     echo '</ul>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-group" title="Wrapping Multiple Shortcodes as Checkout Options">' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-form-options-section">' . "\n";
     echo '<h3>Wrapping Multiple Shortcodes as "Checkout Options"</h3>' . "\n";
     echo '<p>If you would like to offer a single Pro-Form w/ multiple "Checkout Options", it\'s quite easy. Generate each of your Pro-Form Shortcodes the same as you normally would (using some of the Pro-Form Generators on this page). Then, you can simply wrap them all inside another Pro-Form Shortcode (as seen below). For instance, if you generate two Pro-Form Shortcodes (or you have multiple Pro-Form Shortcodes on-site already); you can simply take those and wrap them inside another Pro-Form Shortcode and it consolidates all the Pro-Form Shortcodes into a single Pro-Form with multiple "Checkout Options" (i.e., it creates a drop-down menu for your customers to choose from). The following is a VERY simple example.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<pre class="code">';
     echo '<code>';
     echo '[s2Member-Pro-PayPal-Form]' . "\n";
     echo "\t" . '[s2Member-Pro-PayPal-Form /]' . "\n";
     echo "\t" . '[s2Member-Pro-PayPal-Form /]' . "\n";
     echo '[/s2Member-Pro-PayPal-Form]';
     echo '</code>';
     echo '</pre>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h3>How do "Checkout Options" work behind-the-scenes?</h3>' . "\n";
     echo '<p>Given this simple example (as seen below); s2Member will first take the primary default Shortcode Attributes (from the top-level parent Shortcode); and then it merges those together with Shortcode Attributes from a particular Checkout Option (i.e., a child). The one s2Member merges with is based on the currently selected Checkout Option (i.e., the Checkout Option selected by your customer).</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<pre class="code">';
     echo '<code>';
     echo '[s2Member-Pro-PayPal-Form rp="1" rt="M" rr="1" accept_coupons="1"]' . "\n";
     echo "\t" . '[s2Member-Pro-PayPal-Form level="1" desc="Option 1 ($10.00)" ra="10.00" /]' . "\n";
     echo "\t" . '[s2Member-Pro-PayPal-Form level="2" desc="Option 2 ($20.00)" ra="20.00" /]' . "\n";
     echo "\t" . '[s2Member-Pro-PayPal-Form level="3" desc="Option 3 ($30.00)" ra="30.00" /]' . "\n";
     echo '[/s2Member-Pro-PayPal-Form]';
     echo '</code>';
     echo '</pre>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '<p style="font-style:italic;">In this example, the default checkout Level is 1 (because the default Checkout Option is always the first Checkout Option); but that can change depending on which Checkout Option is selected by the customer. All of these Checkout Options will be associated with different prices; and each Checkout Option will provide access to a different Membership Level. The customer may choose which one they would like to pay for and gain access to.</p>' . "\n";
     echo '<p style="font-style:italic;">All of these Checkout Options will allow a Coupon Code; because that\'s an absolute default Shortcode Attribute (in this particular example); which is not overwritten by any of the children. All of these Checkout Options will charge the customer on a recurring basis (once each month); because those are absolute default Shortcode Attributes (in this particular example) i.e., <code>rp="1" rt="M" rr="1"</code>; which are not overwritten by any of the children.</p>' . "\n";
     echo '<p style="font-style:italic;">~ You\'ll be happy to know that ANY Shortcode Attribute can be declared (and/or overridden); in any of these tags. There is no special subset of restricted Shortcode Attributes in any of these; you can do whatever you like once you understand how this works. In addition, this works for Specific Post/Page Access, Buy Now Access, Recurring Access; etc. You can even mix these together if you like. Just wrap all of your Pro-Form Shortcodes with another Pro-Form Shortcode :-)</p>' . "\n";
     echo '</div>' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h3>Linking To A Pro-Form w/ Multiple "Checkout Options"</h3>' . "\n";
     echo '<p>It is also possible to link to a Pro-Form and pre-select a specific Checkout Option that appears in the list. Starting from the first Checkout Option in the list (we call this Checkout Option 1) you can choose which Checkout Option number you want to have selected by default. This is accomplished by linking to any Post/Page on your site which contains a Pro-Form Shortcode; and then adding the <code>?s2p-option=</code> variable onto the end of that URL (as seen below).</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo 'This example would pre-select option 2.' . "\n";
     echo '<pre class="code">';
     echo '<code>';
     echo 'http://www.example.com/my-checkout-form/?s2p-option=2';
     echo '</code>';
     echo '</pre>' . "\n";
     echo 'The absolute default Checkout Option is always the first one (Checkout Option 1).<br />' . "\n";
     echo 'This would pre-select option 1 (but this is NOT necessary, because it\'s the default already).' . "\n";
     echo '<pre class="code">';
     echo '<code>';
     echo 'http://www.example.com/my-checkout-form/?s2p-option=1';
     echo '</code>';
     echo '</pre>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '</td>' . "\n";
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__s2member_menu_pages_rs::display();
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
 }
 /**
  * Shortcode `[s2Member-Pro-ccBill-Button /]`.
  *
  * @package s2Member\ccBill
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("s2Member-Pro-ccBill-Button");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string The resulting ccBill Button Code, HTML markup.
  */
 public static function sc_ccbill_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $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" => "2.95", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "sub_account" => "", "form" => "", "output" => "anchor"), $attr);
     $attr["tt"] = strtoupper($attr["tt"]);
     $attr["rt"] = strtoupper($attr["rt"]);
     $attr["ccaps"] = strtolower($attr["ccaps"]);
     $attr["ccaps"] = str_replace(" ", "", $attr["ccaps"]);
     $attr["rr"] = $attr["rt"] === "L" ? "0" : $attr["rr"];
     $attr["rr"] = $attr["level"] === "*" ? "0" : $attr["rr"];
     if ($attr["rr"] && ($attr["ta"] <= 0 || $attr["tp"] <= 0 || !$attr["tt"])) {
         eval('$attr["ta"] = $attr["ra"]; $attr["tp"] = $attr["rp"]; $attr["tt"] = $attr["rt"];');
     }
     if ($attr["modify"] || $attr["cancel"]) {
         $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-edit-button.png";
         $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
         $code = $attr["output"] === "anchor" ? $code : $code;
         if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
             $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
         }
         unset($href, $url, $m);
     } else {
         if ($attr["sp"]) {
             $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
             $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
             $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
             $vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => round($attr["exp"] / 24), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_desc" => $attr["desc"], "s2_invoice" => $attr["sp_ids_exp"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
             if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
                 $vars["s2_referencing"] = $referencing;
             }
             $code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
             $code = $attr["output"] === "anchor" ? $code : $code;
             $code = $attr["output"] === "url" ? $url : $code;
             unset($href, $url, $m);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
                 $attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 $vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
                 if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
                     $vars["s2_referencing"] = $referencing;
                 }
                 $code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? $code : $code;
                 $code = $attr["output"] === "url" ? $url : $code;
                 unset($href, $url, $m);
             } else {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
                 $attr["desc"] = !$attr["desc"] ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
                 $attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
                 $attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 if (!$attr["rr"]) {
                     $vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_p1" => "0 D", "s2_p3" => $attr["rp"] . " " . $attr["rt"], "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
                 } else {
                     // Otherwise, we need to include both an Initial and Regular/Recurring period. This will ALWAYS recur.
                     $vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ta"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["tp"], $attr["tt"]), "formRecurringPrice" => $attr["ra"], "formRecurringPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "formRebills" => "99", "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_p1" => $attr["tp"] . " " . $attr["tt"], "s2_p3" => $attr["rp"] . " " . $attr["rt"], "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
                 }
                 if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
                     $vars["s2_referencing"] = $referencing;
                 }
                 $code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
                 $code = $attr["output"] === "anchor" ? $code : $code;
                 $code = $attr["output"] === "url" ? $url : $code;
                 unset($href, $url, $m);
             }
         }
     }
     return $code;
 }