コード例 #1
0
 /**
  * Builds the options panel for this Payment Gateway.
  *
  * @package optimizeMember\Menu_Pages
  * @since 140617
  */
 public static function stripe_ops_page()
 {
     c_ws_plugin__optimizemember_menu_pages::update_all_options();
     // Updates options.
     $logs_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'];
     if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__optimizemember_utils_dirs::strip_dir_app_data($logs_dir)))) {
         mkdir($logs_dir, 0777, TRUE) . clearstatcache();
     }
     $htaccess = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'] . '/.htaccess';
     $htaccess_contents = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['optimizemember']['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__']['optimizemember']['o']['gateway_debug_logs']) {
         if (!is_dir($logs_dir)) {
             // If the security-enabled logs directory does not exist yet.
             c_ws_plugin__optimizemember_admin_notices::display_admin_notice('The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('Permissions error. The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('The .htaccess protection file (<code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file (<code>' . esc_html(c_ws_plugin__optimizemember_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/stripe-ops.inc.php';
 }
コード例 #2
0
ファイル: utils-logs.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Logs HTTP communication (if enabled).
  *
  * @package optimizeMember\Utilities
  * @since 120212
  */
 public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
 {
     if (!$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs']) {
         return;
     }
     // Logging is NOT enabled in this case.
     $is_optimizemember = !empty($args['optimizemember']) || strpos($url, 'optimizemember') !== FALSE ? TRUE : FALSE;
     if (!$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs_extensive'] && !$is_optimizemember) {
         return;
     }
     // Extensive logging is NOT enabled in this case.
     global $current_site, $current_blog;
     // For Multisite support.
     $http_api_debug = array('state' => $state, 'transport_class' => $class, 'args' => $args, 'url' => $url, 'response' => $response);
     $logt = c_ws_plugin__optimizemember_utilities::time_details();
     $logv = c_ws_plugin__optimizemember_utilities::ver_details();
     $logm = c_ws_plugin__optimizemember_utilities::mem_details();
     $log4 = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n" . 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'];
     $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
     $log2 = is_multisite() && !is_main_site() ? 'http-api-debug-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'http-api-debug.log';
     $http_api_debug_conceal_private_info = c_ws_plugin__optimizemember_utils_logs::conceal_private_info(var_export($http_api_debug, TRUE));
     if (is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'])) {
         if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
             if ($GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs_extensive']) {
                 file_put_contents($logs_dir . '/wp-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
             if ($is_optimizemember) {
                 // Log optimizeMember HTTP connections separately.
                 file_put_contents($logs_dir . '/opm-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
         }
     }
 }
コード例 #3
0
 /**
  * Handles PayPal Button encryption.
  *
  * This uses the PayPal API. optimizeMember will NOT attempt to encrypt Buttons until there is at least a Business Email Address and API Username configured.
  * optimizeMember also maintains a log of communication with the PayPal API. If logging is enabled, check: `/wp-content/plugins/optimizemember-logs/paypal-api.log`.
  *
  * @package optimizeMember\PayPal
  * @since 3.5
  *
  * @param str $code The PayPal Button Code before encryption.
  * @param array $vars An array of defined variables in the scope of the calling Filter.
  * @return str The Resulting PayPal Button Code *( possibly encrypted, depending on configuration )*.
  */
 public static function sc_paypal_button_encryption($code = FALSE, $vars = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_sc_paypal_button_encryption", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_api_username"]) {
         $cache = apply_filters("ws_plugin__optimizemember_sc_paypal_button_encryption_cache", true, get_defined_vars());
         /**/
         eval('$_code = $vars["_code"]; $attr = $vars["attr"];');
         /* Let's unpack ( i.e. use shorter references ) to these two important vars. */
         /**/
         if ($cache && ($transient = "s2m_btn_" . md5($code . c_ws_plugin__optimizemember_utilities::ver_checksum())) && ($cache = get_transient($transient))) {
             $code = $cache;
         } else {
             if (is_array($inputs = c_ws_plugin__optimizemember_utils_forms::form_whips_2_array($_code)) && !empty($inputs)) {
                 $paypal = array("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => $attr["sp"] || $attr["rr"] === "BN" ? "BUYNOW" : "SUBSCRIBE");
                 /**/
                 $i = 0;
                 /* Initialize incremental variable counter. PayPal wants these numbered using L_BUTTONVAR{n}; where {n} starts at zero. */
                 foreach ($inputs as $input => $value) {
                     /* Now run through each of the input variables that we parsed from the Full Button Code */
                     if (!preg_match("/^cmd\$/i", $input)) {
                         /* The PayPal API method `BMCreateButton` expects (amount|a1|a3) to include 2 decimal places. */
                         if (preg_match("/^(amount|a1|a3)\$/i", $input)) {
                             $value = number_format($value, 2, ".", "");
                         }
                         /**/
                         $paypal["L_BUTTONVAR" . $i] = $input . "=" . $value;
                         $i++;
                         /* Increment variable counter. */
                     }
                 }
                 /**/
                 if (($paypal = c_ws_plugin__optimizemember_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"]) && !empty($paypal["WEBSITECODE"]) && ($code = $paypal["WEBSITECODE"])) {
                     $default_image = "https://www.paypal.com/" . _x("en_US", "s2member-front paypal-button-lang-code", "s2member") . "/i/btn/btn_xpressCheckout.gif";
                     /**/
                     $code = preg_replace("/\\<img[^\\>]+\\>/i", "", $code);
                     /* Remove the 1x1 pixel tracking image that PayPal sticks in there. */
                     $code = preg_replace("/(\\<input)([^\\>]+)(\\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code);
                     /* Use XHTML! */
                     /**/
                     $code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
                     /**/
                     $code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__optimizemember_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__optimizemember_utils_forms::form_whips_2_url($code) : $code;
                     /**/
                     $cache && $transient ? set_transient($transient, $code, apply_filters("ws_plugin__optimizemember_sc_paypal_button_encryption_cache_exp_time", 3600, get_defined_vars())) : null;
                     /* Caching? */
                 }
             }
         }
     }
     /* No WordPress Filters apply here. */
     /* Instead, use: `ws_plugin__optimizemember_sc_paypal_button`. */
     return $code;
     /* Button Code. Possibly w/ API encryption now. */
 }
コード例 #4
0
 /**
  * Applies custom Return Template Headers.
  *
  * @package optimizeMember\Return_Templates
  * @since 110720
  *
  * @attaches-to ``add_filter("ws_plugin__optimizemember_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__"]["optimizemember"]["o"]["pro_" . $vars["template"] . "_return_template_header"])) {
         $code = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_" . $vars["template"] . "_return_template_header"];
         $code = !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code;
         return $custom_header = $code;
     }
     /**/
     return $default_header;
 }
コード例 #5
0
 /**
  * Handles the Shortcode for: `[optimizeMember-Security-Badge /]`.
  *
  * @package optimizeMember\Security_Badges
  * @since 110524RC
  *
  * @attaches-to ``add_shortcode("optimizeMember-Security-Badge");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str Resulting Security Badge code; HTML markup.
  */
 public static function sc_s_badge($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_sc_s_badge", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $attr = c_ws_plugin__optimizemember_utils_strings::trim_qts_deep((array) $attr);
     /**/
     $attr = shortcode_atts(array("v" => "1"), $attr);
     /* One attribute. */
     /**/
     $code = c_ws_plugin__optimizemember_utilities::s_badge_gen($attr["v"], false, false);
     /**/
     return apply_filters("ws_plugin__optimizemember_sc_s_badge", $code, get_defined_vars());
 }
コード例 #6
0
ファイル: wp-footer.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Generates footer code, when/if configured.
  *
  * @package optimizeMember\WP_Footer
  * @since 110524RC
  *
  * @return null
  */
 public static function wp_footer_code()
 {
     do_action("ws_plugin__optimizemember_before_wp_footer_code", get_defined_vars());
     /**/
     if ($code = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["wp_footer_code"]) {
         if (is_multisite() && c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo do_shortcode($code) . "\n";
             /* No PHP here. */
         } else {
             echo do_shortcode(c_ws_plugin__optimizemember_utilities::evl($code));
         }
     }
     /**/
     do_action("ws_plugin__optimizemember_after_wp_footer_code", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #7
0
 /**
  * Handles Return templates w/ response message.
  *
  * @package optimizeMember\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)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_return_template", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
     /**/
     $doctype_html_head = c_ws_plugin__optimizemember_utils_html::doctype_html_head(get_bloginfo("name"), "ws_plugin__optimizemember_during_return_template_head_" . ($specific_template ? basename($specific_template) : "default-return.php"));
     $code = preg_replace("/%%doctype_html_head%%/i", c_ws_plugin__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_return_template_doctype_html_head", $doctype_html_head, get_defined_vars())), $code);
     /**/
     $code = preg_replace("/%%header%%/i", c_ws_plugin__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_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__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_return_template_response", $response, get_defined_vars())), $code);
     $code = preg_replace("/%%continue%%/i", c_ws_plugin__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_return_template_continue", '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
     $code = preg_replace("/%%support%%/i", c_ws_plugin__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_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__"]["optimizemember"]["o"]["reg_email_support_link"])), get_defined_vars())), $code);
     $code = preg_replace("/%%tracking%%/i", c_ws_plugin__optimizemember_utils_strings::esc_ds(apply_filters("ws_plugin__optimizemember_return_template_tracking", c_ws_plugin__optimizemember_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
     /**/
     return apply_filters("ws_plugin__optimizemember_return_template", $code, get_defined_vars());
 }
コード例 #8
0
 /**
  * Handles ccBill Return URL processing.
  *
  * @package optimizeMember\ccBill
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection.
  */
 public static function ccbill_return()
 {
     global $current_site, $current_blog;
     /**/
     if (!empty($_GET["optimizemember_pro_ccbill_return"]) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_client_id"]) {
         $ccbill["optimizemember_log"][] = "Return URL processed on: " . date("D M j, Y g:i:s a T");
         $ccbill["optimizemember_log"][] = "Piping through optimizeMember's core/standard PayPal processor with `proxy_use` ( `ty-email` ).";
         $ccbill["optimizemember_log"][] = "Please check PayPal RTN logs for further processing details.";
         /**/
         $rtn_q = "&optimizemember_paypal_proxy=ccbill&optimizemember_paypal_proxy_use=standard-emails,ty-email";
         if (!empty($_GET["optimizemember_pro_ccbill_return_success"])) {
             $rtn_q .= "&optimizemember_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["optimizemember_pro_ccbill_return_success"])));
         }
         /**/
         $rtn_r = site_url("/?optimizemember_pro_ccbill_return&optimizemember_paypal_return=1" . $rtn_q);
         $rtn_r = c_ws_plugin__optimizemember_utils_urls::add_optimizemember_sig($rtn_r, "optimizemember_paypal_proxy_verification");
         /**/
         $ccbill["optimizemember_log"][] = $rtn_r;
         /**/
         wp_redirect($rtn_r);
         /**/
         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "ccbill-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "ccbill-rtn.log";
         /**/
         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($ccbill, true) . "\n\n", FILE_APPEND);
                 }
             }
         }
         /**/
         exit;
         /* Exit now. */
     }
 }
コード例 #9
0
ファイル: utils-html.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Returns a DOCTYPE tag along with the HEAD section and title tag.
  *
  * This method should NOT be called upon until
  * {@link optimizeMember\API_Constants\c_ws_plugin__optimizemember_constants::constants()}
  * has been processed. We need access to: ``WS_PLUGIN__OPTIMIZEMEMBER_API_CONSTANTS_MD5``.
  *
  * @package optimizeMember\Utilities
  * @since 110720
  *
  * @param str $doctype_html_head_title Optional. The title of the HTML document being generated.
  * @param str $doctype_html_head_action Optional. An action Hook to process during HEAD generation.
  * @return str A DOCTYPE tag along with the HEAD section and title tag, configured by parameters.
  */
 public static function doctype_html_head($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE)
 {
     $s2o = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["s2o_url"];
     /* Loads optimizeMember only. */
     /**/
     ob_start();
     /* Start output buffering here so we can "return" the output from this utility. */
     /**/
     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
     /**/
     echo '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
     echo '<head>' . "\n";
     /**/
     echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
     /**/
     echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-includes/js/jquery/jquery.js?ver=" . urlencode(c_ws_plugin__optimizemember_utilities::ver_checksum()))) . '"></script>' . "\n";
     /**/
     echo '<script type="text/javascript">' . "var pwsL10n = {empty: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Strength indicator", "s2member-front", "s2member")) . "', short: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Very weak", "s2member-front", "s2member")) . "', bad: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Weak", "s2member-front", "s2member")) . "', good: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Medium", "s2member-front", "s2member")) . "', strong: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Strong", "s2member-front", "s2member")) . "', mismatch: '" . c_ws_plugin__optimizemember_utils_strings::esc_js_sq(_x("Mismatch", "s2member-front", "s2member")) . "'};</script>" . "\n";
     echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-includes/js/zxcvbn.min.js?ver=" . urlencode(c_ws_plugin__optimizemember_utilities::ver_checksum()))) . '"></script>' . "\n";
     echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-admin/js/password-strength-meter.js?ver=" . urlencode(c_ws_plugin__optimizemember_utilities::ver_checksum()))) . '"></script>' . "\n";
     /**/
     echo '<script type="text/javascript" src="' . esc_attr($s2o . "?ws_plugin__optimizemember_js_w_globals=" . urlencode(WS_PLUGIN__OPTIMIZEMEMBER_API_CONSTANTS_MD5) . "&amp;qcABC=1&amp;ver=" . urlencode(c_ws_plugin__optimizemember_utilities::ver_checksum())) . '"></script>' . "\n";
     /**/
     echo '<link href="' . esc_attr($s2o . "?ws_plugin__optimizemember_css=1&amp;qcABC=1&amp;ver=" . urlencode(c_ws_plugin__optimizemember_utilities::ver_checksum())) . '" type="text/css" rel="stylesheet" media="all" />' . "\n";
     /**/
     if ($doctype_html_head_title) {
         /* Add <title></title> tag? */
         echo '<title>' . $doctype_html_head_title . '</title>' . "\n";
     }
     /**/
     if ($doctype_html_head_action) {
         /* Add content from Hook? */
         do_action($doctype_html_head_action, get_defined_vars());
     }
     /**/
     echo '</head>' . "\n";
     /**/
     return ob_get_clean();
 }
コード例 #10
0
ファイル: paypal-forms.inc.php プロジェクト: JalpMi/v2contact
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page op-bsw-wizard op-bsw-content">' . "\n";
     /**/
     echo '<div class="op-bsw-header">';
     echo '<div class="op-logo"><img src="' . $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["dir_url"] . "/images/" . 'logo-optimizepress.png" alt="OptimizePress" height="50" class="animated flipInY"></div>';
     echo '</div>';
     echo '<div class="op-bsw-main-content inline-input-fields">';
     echo '<h2>OptimizeMember Pro / 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="Quick-Start Guide For PayPal Pro">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-pro-forms-guide-section">' . "\n";
     echo '<img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["dir_url"]) . '/images/large-icon.png" title="optimizeMember ( a Membership management system for WordPress )" alt="" style="float:right; margin:0 0 0 25px; border:0;" />' . "\n";
     echo '<h3>Quick-Start Guide For PayPal Pro Integration</h3>' . "\n";
     //echo '<p style="margin-bottom:0;"><strong>See also:</strong> This KB article: <a href="http://www.optimizepress.com/kb/pro-forms/" target="_blank" rel="external">optimizeMember Pro Forms</a>.</p>'."\n";
     //echo '<p style="margin-top:0;"><strong>See also:</strong> This KB article: <a href="http://www.optimizepress.com/kb/paypal-account-types/" target="_blank" rel="external">PayPal Compatibility (Account Types)</a>.</p>'."\n";
     echo '<p>The optimizeMember Pro Module makes it possible for optimizeMember to use PayPal Pro Forms ( instead of standard PayPal Buttons ). PayPal Pro Forms integrate seamlessly with WordPress Shortcodes. This allows you to keep Customers on your site at all times, and it consolidates the Checkout / Registration steps into a single form that you can dress up just the way you like. If you would like to take advantage of PayPal Pro integration, please supply your PayPal API Username, Password, and Signature. See <code>optimizeMember -> PayPal Options</code>.</p>' . "\n";
     echo '<p><em><strong>*PayPal Pro Integration*</strong> You will need a <a href="http://www.optimizepress.com/paypal" target="_blank" rel="external">PayPal Business Account, w/Pro Service</a>. PayPal Pro accounts require a formal application, along with a small monthly fee. Once you have a PayPal Pro account, you\'ll need access to your <a href="http://www.optimizepress.com/paypal-profile-api-access" target="_blank" rel="external">PayPal API Credentials</a>. Log into your PayPal Pro account, and navigate to <code>Profile -> API Access (or Request API Credentials)</code>. You\'ll choose <code>( Request API Signature )</code>.</em></p>' . "\n";
     echo '<p><em><strong>*Recurring Billing*</strong> If you plan to use any of the ( `Subscription` ) options in the Form Generators below, you will ALSO need <a href="http://www.optimizepress.com/paypal-pro-recurring-payments-faqs" target="_blank" rel="external">Recurring Billing</a> enabled for your PayPal Pro account. PayPal\'s Recurring Billing service for Pro accounts is <strong>required</strong> for all types of ( `Subscriptions` ), whether you intend for them to be recurring or not. However, it is NOT required for ( `Buy Now` ) functionality. The drop-down menus, in the sections below, have been marked ( `Subscription` ) and ( `Buy Now` ) just for this reason. This way you can see which options will require the use of PayPal\'s Recurring Billing service. PayPal will charge you a small monthly fee for their Recurring Billing service; which is an add-on for PayPal Pro accounts.</em></p>' . "\n";
     echo !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? '<p><em><strong>*Secure Server*</strong> In order to comply with PayPal and PCI Compliance policies, as set forth by major credit card companies; you will need to host all of your PayPal Pro Forms on an SSL enabled site. Please check with your hosting provider to ask about obtaining an SSL certificate for your domain. Please note... when you create PayPal Pro Forms with optimizeMember; you\'ll be supplied with WordPress Shortcodes, which you\'ll insert into Posts/Pages of your choosing. These special Posts/Pages will need to be displayed in SSL mode, using links that start with ( <code>https://</code> ). &mdash; You can skip the SSL certificate during Sandbox testing. SSL is not required until you officially go live. Once you\'re live, you can add the Custom Field <code>optimizemember_force_ssl = yes</code> to any Post/Page.</em></p>' . "\n" : '<p><em><strong>*Secure Server*</strong> In order to comply with PayPal and PCI Compliance policies, as set forth by major credit card companies; you will need to host all of your PayPal Pro Forms on an SSL enabled page. When you create PayPal Pro Forms with optimizeMember; you\'ll be supplied with WordPress Shortcodes, which you\'ll insert into Posts/Pages of your choosing. These special Posts/Pages will need to be displayed in SSL mode, using links that start with ( <code>https://</code> ). You can add the Custom Field <code>optimizemember_force_ssl = yes</code> to any Post/Page that contains a Pro Form Shortcode. This tells optimizeMember to force those special Posts/Pages to be viewed over SSL at all times; no matter what.</em></p>' . "\n";
     echo !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? '<p><em><strong>*SSL Compatibility*</strong> All themes available at <a href="http://www.optimizepress.com/" target="_blank" rel="external">optimizePress.com</a> include full support for SSL, as does WordPress itself. However, there are many themes/plugins that do NOT support SSL enabled Posts/Pages like they should. For this reason, you should be very careful when choosing a WordPress theme to use with optimizeMember Pro. Otherwise, your visitors could see the famous "Secure/Insecure" warnings in Internet Explorer browsers. With optimizeMember installed, you can add the Custom Field <code>optimizemember_force_ssl = yes</code> to any Post/Page. optimizeMember will buffer output on those special Posts/Pages, converting everything over to <code>https://</code> for you automatically, and forcing those specific Posts/Pages to be viewed over a secure SSL connection; so long as your server supports the https protocol.</em></p>' . "\n" : '';
     echo '<p><em><strong>*PayPal Pro is NOT Absolutely Required*</strong> optimizeMember is very flexible. It is now possible to integrate Pro Forms without a PayPal Pro account, whereby the enhanced Form Shortcodes that optimizeMember provides can be integrated ONLY with PayPal Express Checkout. In other words, if you get declined for PayPal Pro service, you can still use optimizeMember Pro Forms. Ask PayPal to activate Express Checkout for you. ( it\'s free ). Once Express Checkout is enabled, you will have access to your <a href="http://www.optimizepress.com/paypal-profile-api-access" target="_blank" rel="external">PayPal API Credentials</a>. Log into your PayPal account, and navigate to <code>Profile -> API Access (or Request API Credentials)</code>. You\'ll choose <code>( Request API Signature )</code>. Now ... here is the tricky part; whenever you generate a Pro Form Shortcode with optimizeMember, be sure to change  <code>accept="paypal,visa,mastercard,amex,discover,maestro,solo"</code> to just <code>accept="paypal"</code>; thereby excluding the on-site credit card processing functionality; which is available only with PayPal Pro.</em></p>' . "\n";
     echo '</div>' . "\n";
     /**/
     echo '</div>' . "\n";
     /**/
     echo '<div class="ws-menu-page-group" title="PayPal Pro / Free Registration Forms">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-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;">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
     $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-registration-form-shortcode.php")));
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr("0")), $ws_plugin__optimizemember_pro_temp_s);
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level0_label"])), $ws_plugin__optimizemember_pro_temp_s);
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__optimizemember_pro_temp_s);
     echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-registration-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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__"]["optimizemember"]["c"]["levels"]; $n++) {
         $labelText = ws_plugin__optimizemember_getMembershipLabel($n);
         echo '<div class="ws-menu-page-group" title="PayPal Pro Forms For Level ' . $labelText . ' Access">' . "\n";
         /**/
         echo '<div class="ws-menu-page-section ws-plugin--optimizemember-pro-level' . $n . '-forms-section">' . "\n";
         echo '<h3>Pro Form Generator For Level ' . $labelText . ' 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 optimizeMember 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, optimizeMember will automatically terminate their Membership privileges. optimizeMember makes extensive use of the PayPal IPN service. optimizeMember receives updates from PayPal behind-the-scene.</p>' . "\n";
         echo '<p><em>* 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;">' . "\n";
         echo '<p id="ws-plugin--optimizemember-pro-level' . $n . '-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-level' . $n . '-trial-period" value="0" size="6" /> <select id="ws-plugin--optimizemember-pro-level' . $n . '-trial-term">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-level' . $n . '-trial-amount" value="0.00" size="4" /></p>' . "\n";
         echo '<p><span id="ws-plugin--optimizemember-pro-level' . $n . '-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--optimizemember-pro-level' . $n . '-term">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/" . ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["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--optimizemember-pro-level' . $n . '-desc" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["optimizemember"]["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--optimizemember-pro-level' . $n . '-page-style" value="paypal" size="18" /> <select id="ws-plugin--optimizemember-pro-level' . $n . '-currency">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__optimizemember_pro_paypalFormGenerate(\'level' . $n . '\');" class="button-primary" /></p>' . "\n";
         echo '<p' . (is_multisite() && c_ws_plugin__optimizemember_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: optimizeMember -> 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 optimizeMember 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--optimizemember-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;">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
         $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-form-shortcode.php")));
         $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($n)), $ws_plugin__optimizemember_pro_temp_s);
         $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_label"])), $ws_plugin__optimizemember_pro_temp_s);
         $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__optimizemember_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-level' . $n . '-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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="PayPal Pro Billing Modification Forms">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-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, optimizeMember 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-scene, 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. optimizeMember\'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: <code>optimizeMember -> API Scripting</code>.</em></p>' . "\n";
     echo !is_multisite() || !c_ws_plugin__optimizemember_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;">' . "\n";
     /**/
     echo '<p>Modification: <select id="ws-plugin--optimizemember-pro-modification-level">' . "\n";
     /**/
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n++) {
         $labelText = ws_plugin__optimizemember_getMembershipLabel($n);
         echo '<optgroup label="Level ' . $labelText . '">' . "\n";
         echo '<option value="upgrade:' . $n . '">&uarr; Upgrade To Level ' . $labelText . '</option>' . "\n";
         echo $n < $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"] ? '<option value="downgrade:' . $n . '">&darr; Downgrade To Level ' . $labelText . '</option>' . "\n" : '';
         echo '</optgroup>' . "\n";
         /**/
         echo $n < $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"] ? '<option disabled="disabled"></option>' . "\n" : '';
     }
     /**/
     echo '</select></p>' . "\n";
     /**/
     echo '<p id="ws-plugin--optimizemember-pro-modification-trial-line">I\'ll offer the first <input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--optimizemember-pro-modification-trial-term">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-membership-trial-terms.php"))) . '</select> @ $<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-modification-trial-amount" value="0.00" size="4" /></p>' . "\n";
     echo '<p><span id="ws-plugin--optimizemember-pro-modification-trial-then">Then, </span>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--optimizemember-pro-modification-term">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/" . ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["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--optimizemember-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--optimizemember-pro-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--optimizemember-pro-modification-currency">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__optimizemember_pro_paypalFormGenerate(\'modification\');" class="button-primary" /></p>' . "\n";
     echo '<p' . (is_multisite() && c_ws_plugin__optimizemember_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: optimizeMember -> 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 optimizeMember 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--optimizemember-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;">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
     $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-checkout-form-shortcode.php")));
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr("1")), $ws_plugin__optimizemember_pro_temp_s);
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level1_label"])), $ws_plugin__optimizemember_pro_temp_s);
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__optimizemember_pro_temp_s);
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/\\/]\$/", 'modify="1" /]', $ws_plugin__optimizemember_pro_temp_s);
     /* Adds modify="1" to the end of the Shortcode. */
     echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-modification-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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__optimizemember_utils_conds::is_multisite_farm() || is_main_site()) {
         echo '<div class="ws-menu-page-group" title="PayPal Pro Capability (Buy Now) Forms">' . "\n";
         /**/
         echo '<div class="ws-menu-page-section ws-plugin--optimizemember-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: <code>optimizeMember -> API Scripting -> Custom Capabiities</code>.</p>' . "\n";
         echo '<p>With optimizeMember, 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 optimizeMember 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 optimizeMember 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 optimizeMember 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;">' . "\n";
         /**/
         echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--optimizemember-pro-ccap-term">' . trim(c_ws_plugin__optimizemember_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--optimizemember-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--optimizemember-pro-ccap-page-style" value="paypal" size="18" /> <select id="ws-plugin--optimizemember-pro-ccap-currency">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__optimizemember_pro_paypalCcapFormGenerate();" class="button-primary" /></p>' . "\n";
         echo '<p>Custom Capabilities ( comma-delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: optimizeMember -> 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 optimizeMember 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--optimizemember-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;">' . "\n";
         echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
         $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-ccaps-checkout-form-shortcode.php")));
         $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__optimizemember_pro_temp_s);
         echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-ccap-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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="PayPal Pro Billing Update Forms">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-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;">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
     $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-update-form-shortcode.php")));
     echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-update-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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="PayPal Pro Billing Cancellation Forms">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-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="https://www.x.com/" 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. optimizeMember is notified silently behind-the-scene, and will immediately cancel all future billing. optimizeMember will later terminate their account access, at the correct point in time. This works in conjunction with the optimizeMember Auto-EOT System. For further details, see: <code>optimizeMember -> PayPal Options -> EOT Behavior</code>.</em></p>' . "\n";
     /**/
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     /**/
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
     $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-cancellation-form-shortcode.php")));
     echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-cancellation-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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="PayPal Member Registration Access Links">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-pro-reg-links-section">' . "\n";
     echo '<h3>Registration Access Link Generator ( for Customer Service )</h3>' . "\n";
     echo '<p>optimizeMember 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 <code>optimizeMember -> Add A Member</code>. 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;">' . "\n";
     echo '<p>Paid Membership Level#: <select id="ws-plugin--optimizemember-pro-reg-link-level">' . "\n";
     for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n++) {
         $labelText = ws_plugin__optimizemember_getMembershipLabel($n);
         echo '<option value="' . $n . '">optimizeMember Level ' . $labelText . '</option>' . "\n";
     }
     echo '</select></p>' . "\n";
     echo '<p>Paid Subscr. ID: <input type="text" autocomplete="off" id="ws-plugin--optimizemember-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, optimizeMember 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--optimizemember-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__optimizemember_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__optimizemember_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__optimizemember_pro_paypalRegLinkGenerate();" class="button-primary" /> <img id="ws-plugin--optimizemember-pro-reg-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p' . (is_multisite() && c_ws_plugin__optimizemember_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: optimizeMember -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--optimizemember-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--optimizemember-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 optimizeMember 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--optimizemember-pro-reg-link" style="font-family:Consolas, monospace; 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="PayPal Specific Post/Page (Buy Now) Forms">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-pro-sp-forms-section">' . "\n";
     echo '<h3>Pro Form Generator For Specific Post/Page Forms</h3>' . "\n";
     echo '<p>optimizeMember 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. optimizeMember 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: <code>optimizeMember -> PayPal Options -> Specific Post/Page Email</code> ). 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 optimizeMember, 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: <code>optimizeMember -> Restriction Options -> Specific Post/Page Access</code>. 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 optimizeMember seamlessly. You can even Package Additional Posts/Pages together into one transaction.</p>' . "\n";
     echo '<p><em>* 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;">' . "\n";
     /**/
     echo '<p><select id="ws-plugin--optimizemember-pro-sp-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     /**/
     $ws_plugin__optimizemember_pro_temp_a_singulars = c_ws_plugin__optimizemember_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     /**/
     foreach ($ws_plugin__optimizemember_pro_temp_a_singulars as $ws_plugin__optimizemember_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__optimizemember_pro_temp_o->ID) . '">' . esc_html($ws_plugin__optimizemember_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 optimizeMember for Specific Post/Page Access yet. See: optimizeMember -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     /**/
     echo '<p><select id="ws-plugin--optimizemember-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__optimizemember_pro_temp_a_singulars as $ws_plugin__optimizemember_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__optimizemember_pro_temp_o->ID) . '">' . esc_html($ws_plugin__optimizemember_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 ( e.g. only one Access Link is needed, and optimizeMember 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* optimizeMember 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 optimizeMember for Specific Post/Page Access yet. See: optimizeMember -> 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--optimizemember-pro-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--optimizemember-pro-sp-hours">' . trim(c_ws_plugin__optimizemember_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--optimizemember-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--optimizemember-pro-sp-page-style" value="paypal" size="18" /> <select id="ws-plugin--optimizemember-pro-sp-currency">' . trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/paypal-currencies.php"))) . '</select> <input type="button" value="Generate Form Code" onclick="ws_plugin__optimizemember_pro_paypalSpFormGenerate();" class="button-primary" /></p>' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     /**/
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     /**/
     echo '<td>' . "\n";
     echo '<form onsubmit="return false;">' . "\n";
     echo '<strong>WordPress Shortcode:</strong> ( recommended for both the WordPress Visual &amp; HTML Editors )<br />' . "\n";
     $ws_plugin__optimizemember_pro_temp_s = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/paypal-sp-checkout-form-shortcode.php")));
     $ws_plugin__optimizemember_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__optimizemember_pro_temp_s);
     echo '<input type="text" autocomplete="off" id="ws-plugin--optimizemember-pro-sp-shortcode" value="' . format_to_edit($ws_plugin__optimizemember_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\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="PayPal Specific Post/Page Access Links">' . "\n";
     /**/
     echo '<div class="ws-menu-page-section ws-plugin--optimizemember-pro-sp-links-section">' . "\n";
     echo '<h3>Specific Post/Page Link Generator ( for Customer Service )</h3>' . "\n";
     echo '<p>optimizeMember automatically generates Specific Post/Page 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 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;">' . "\n";
     /**/
     echo '<p><select id="ws-plugin--optimizemember-pro-sp-link-leading-id">' . "\n";
     echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
     /**/
     $ws_plugin__optimizemember_pro_temp_a_singulars = c_ws_plugin__optimizemember_utils_gets::get_all_singulars_with_sp("exclude-conflicts");
     /**/
     foreach ($ws_plugin__optimizemember_pro_temp_a_singulars as $ws_plugin__optimizemember_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__optimizemember_pro_temp_o->ID) . '">' . esc_html($ws_plugin__optimizemember_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 optimizeMember for Specific Post/Page Access yet. See: optimizeMember -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     /**/
     echo '<p><select id="ws-plugin--optimizemember-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__optimizemember_pro_temp_a_singulars as $ws_plugin__optimizemember_pro_temp_o) {
         echo '<option value="' . esc_attr($ws_plugin__optimizemember_pro_temp_o->ID) . '">' . esc_html($ws_plugin__optimizemember_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 ( e.g. only one Access Link is needed, and optimizeMember 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* optimizeMember 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 optimizeMember for Specific Post/Page Access yet. See: optimizeMember -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
     /**/
     echo '<p><select id="ws-plugin--optimizemember-pro-sp-link-hours">' . trim(c_ws_plugin__optimizemember_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__optimizemember_pro_paypalSpLinkGenerate();" class="button-primary" /> <img id="ws-plugin--optimizemember-pro-sp-link-loading" src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
     echo '<p id="ws-plugin--optimizemember-pro-sp-link" style="font-family:Consolas, monospace; 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__optimizemember_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--optimizemember-pro-forms-success-section">' . "\n";
         echo '<h3>Custom Return URLs Upon Success ( optional, for developers )</h3>' . "\n";
         echo '<p>optimizeMember 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 optimizeMember, under: <code>optimizeMember -> API / Tracking</code>. In other words, if you don\'t use the <code>success=""</code> attribute in your Shortcode, optimizeMember 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--optimizemember-pro-forms-success-free-registration\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-pro-forms-success-free-registration" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;">' . "\n";
         echo '<li><code>%%role%%</code> = The Role ID <code>( subscriber, optimizemember_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.optimizepress.com/codex/stable/s2member/api_functions/package-functions/#src_doc_optimizemember_decrypt()" target="_blank" rel="external">optimizemember_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;">' . "\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> optimizeMember -> 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;">' . "\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--optimizemember-pro-forms-success-sales\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-pro-forms-success-sales" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;">' . "\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>%%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 `optimizeMember -> API Notifications -> Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
         echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. This value is <code>always > 0</code>, no matter what. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. The %%regular%% rate is always > 0. 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 optimizemember_decrypt().</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;">' . "\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> optimizeMember -> 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;">' . "\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--optimizemember-pro-forms-success-ccaps\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-pro-forms-success-ccaps" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;">' . "\n";
         echo '<li><code>%%txn_id%%</code> = The Payment Transaction ID, which is always unique for each payment received.</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 optimizemember_decrypt().</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;">' . "\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> optimizeMember -> 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;">' . "\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--optimizemember-pro-forms-success-sp-sales\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-pro-forms-success-sp-sales" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;">' . "\n";
         echo '<li><code>%%sp_access_url%%</code> = The full URL ( generated by optimizeMember ) 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>%%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 optimizemember_decrypt().</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;">' . "\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--optimizemember-pro-forms-success-cancellations-updates\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-pro-forms-success-cancellations-updates" style="display:none;">' . "\n";
         echo '<ul style="margin: 10px 0 10px 20px; list-style: disc outside;">' . "\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 optimizemember_decrypt().</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--optimizemember-pro-forms-success-verification\').toggle(); return false;" class="ws-dotted-link">open/close</a> )</h3>' . "\n";
         echo '<div id="ws-plugin--optimizemember-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 optimizeMember. 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 optimizeMember API Function: <code>optimizemember_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>optimizeMember 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__optimizemember_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/paypal-s2p-v-query-ok-1.x-php")) . '</p>' . "\n";
         echo '<p>optimizeMember will only verify a query string for up to 10 seconds. After 10 seconds, <code>optimizemember_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 optimizeMember, under: <code>optimizeMember -> API / Tracking</code>. 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>optimizemember_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__optimizemember_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. optimizeMember 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--optimizemember-pro-shortcode-attrs-section">' . "\n";
     echo '<h3>Shortcode Attributes ( Explained In Full Detail )</h3>' . "\n";
     echo '<p>When you generate a Form, optimizeMember 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, optimizeMember reads Attributes in your Shortcode. These Attributes will be pre-configured by one of optimizeMember\'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>' . "\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; optimizeMember 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; optimizeMember 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="clean"</code> When you set this Attribute, visitors must prove they\'re human by typing a <a href="http://en.wikipedia.org/wiki/CAPTCHA" target="_blank" rel="external">captcha/security code</a>. 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>. This service is powered by Google\'s reCaptcha system.</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__optimizemember_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://www.iso.org/iso/english_country_names_and_code_elements" target="_blank" rel="external">ISO-3166-1 specification</a>. If this is empty ( i.e. <code>""</code> ) optimizeMember 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. Not valid when <code>cancel="1"</code>.</li>' . "\n";
     echo '<li><code>dg="0"</code> The Digital Goods directive. optimizeMember will eventually be integrated with <a href="http://www.optimizepress.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>lc=""</code> Optional 2 character Locale Code <em>( i.e. Country Code )</em>. This controls the interface language used if/when 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. 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__optimizemember_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>, optimizeMember 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="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. 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>optimizeMember -> 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. 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__optimizemember_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__optimizemember_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> Please be aware that <code>D</code> = Days is NOT possible under PayPal Pro (Payflow Edition). If you are operating a PayPal Pro account, with the Payflow Edition, 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, every six months, or yearly.</li>' . "\n";
     echo '<li><code>rr="1"</code> Recurring directive. Only valid w/ Membership Level Access' . (is_multisite() && c_ws_plugin__optimizemember_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: optimizeMember -> PayPal Options )</em>.</li>' . "\n";
     echo '<li><code>rra="2"</code> Reattempt failed payments? Possible values: <code>0</code> = do NOT reattempt billing when/if a recurring payment fails; <code>1 or higher</code> = yes, DO reattempt billing when/if a recurring payment fails. With PayPal Pro integration, 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. With PayPal Pro integration, the value of this attribute also configures Max Failed Payments. So a setting of <code>rra="2"</code> means that you allow a maximum of 2 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__optimizemember_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__optimizemember_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>.</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>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 '</td>' . "\n";
     /**/
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__optimizemember_menu_pages_rs::display();
     echo '</td>' . "\n";
     /**/
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     /**/
     echo '</div>' . "\n";
     echo '</div>' . "\n";
 }
コード例 #11
0
ファイル: default.php プロジェクト: JalpMi/v2contact
 /**
  * shortcode parsing of membership file downloads element
  * @param array $atts
  * @param string $content
  * @return String
  */
 static function membership_download($atts, $content)
 {
     // Decode encoded chars
     $atts = op_urldecode($atts);
     extract(shortcode_atts(array('style' => 1), $atts));
     //</editor-fold>
     // some preliminary checks
     // creating member dir if it does not exist
     if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['files_dir'])) {
         if (is_writable(dirname(c_ws_plugin__optimizemember_utils_dirs::strip_dir_app_data($files_dir)))) {
             mkdir($files_dir, 0777, true);
         }
     }
     // creating .htaccess file if it does not exist!
     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__optimizemember_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['optimizemember']['c']['files_dir_htaccess']))));
         }
     }
     $content = do_shortcode(op_clean_shortcode_content($content));
     $content = op_process_asset_content($content);
     if (!empty($content)) {
         $html = '<ul class="downloadlist-' . $style . ' border">' . $content . '</ul>';
     } else {
         $html = '';
     }
     return $html;
 }
コード例 #12
0
 /**
  * Builds the options panel for this Payment Gateway.
  *
  * @package optimizeMember\Menu_Pages
  * @since 1.5
  *
  * @return null
  */
 public static function ccbill_ops_page()
 {
     c_ws_plugin__optimizemember_menu_pages::update_all_options();
     /**/
     $logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"];
     /**/
     if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__optimizemember_utils_dirs::strip_dir_app_data($logs_dir)))) {
         mkdir($logs_dir, 0777, true) . clearstatcache();
     }
     /**/
     $htaccess = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"] . "/.htaccess";
     $htaccess_contents = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["optimizemember"]["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__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
         if (!is_dir($logs_dir)) {
             /* If the security-enabled logs directory does not exist yet. */
             c_ws_plugin__optimizemember_admin_notices::display_admin_notice('The security-enabled logs directory ( <code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('Permissions error. The security-enabled logs directory ( <code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('The .htaccess protection file ( <code>' . esc_html(c_ws_plugin__optimizemember_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__optimizemember_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file ( <code>' . esc_html(c_ws_plugin__optimizemember_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/ccbill-ops.inc.php";
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #13
0
 /**
  * Logs Stripe API communication.
  *
  * @param string  $function Name of the caller.
  *
  * @param integer $input_time Input time.
  * @param mixed   $input_vars Input data/vars.
  *
  * @param integer $output_time Output time.
  * @param mixed   $output_vars Output data/vars.
  */
 public static function log_entry($function, $input_time, $input_vars, $output_time, $output_vars)
 {
     global $current_site, $current_blog;
     if (!$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs']) {
         return;
     }
     // Nothing to do in this case.
     $logt = c_ws_plugin__optimizemember_utilities::time_details();
     $logv = c_ws_plugin__optimizemember_utilities::ver_details();
     $logm = c_ws_plugin__optimizemember_utilities::mem_details();
     $log4 = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n" . 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'];
     $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
     $log2 = is_multisite() && !is_main_site() ? 'stripe-api-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'stripe-api.log';
     if (is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'])) {
         if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
             if ($log = '-------- Function/Caller: ( ' . $function . ' ) --------' . "\n") {
                 if ($log .= '-------- Input vars: ( ' . date(DATE_RFC822, $input_time) . ' ) --------' . "\n" . print_r($input_vars, TRUE) . "\n") {
                     if ($log .= '-------- Output string/vars: ( ' . date(DATE_RFC822, $output_time) . ' ) --------' . "\n" . print_r($output_vars, TRUE)) {
                         file_put_contents($logs_dir . '/' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__optimizemember_utils_logs::conceal_private_info($log) . "\n\n", FILE_APPEND);
                     }
                 }
             }
         }
     }
 }
コード例 #14
0
ファイル: querys.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Filter all WordPress queries.
  *
  * optimizeMember respects the query var: `suppress_filters`. 
  * If you need to make a query without it being Filtered, use  ``$wp_query->set ("suppress_filters", true);``.
  *
  * @package optimizeMember\Queries
  * @since 3.5
  *
  * @attaches-to ``add_action("pre_get_posts");``
  *
  * @param obj $wp_query Expects ``$wp_query`` by reference, from the Filter.
  * @param bool $force Optional. Defaults to false. If true, we bypass all standard conditions.
  * 	However, optimizeMember will NEVER bypass `supress_filters`.
  * @return null
  *
  * @todo For improved reliability, modify other query vars associated with exclusions/inclusions. Like `tag_slug__in`?
  * 	See: {@link http://codex.wordpress.org/Class_Reference/WP_Query#Parameters WP_Query#Parameters}
  * @todo Make it possible to force filtering, even when used in combination with Query Conditionals and ``get_posts()``, which auto-supresses.
  * 	Or, perhaps strengthen the existing ``$force`` parameter in this regard.
  */
 public static function query_level_access(&$wp_query = FALSE, $force = FALSE)
 {
     global $wpdb;
     /* Need this global DB object reference here. */
     static $initial_query = true;
     /* Tracks the initial query. */
     c_ws_plugin__optimizemember_querys::$current_wp_query =& $wp_query;
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_query_level_access", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     c_ws_plugin__optimizemember_querys::_query_level_access_sys($wp_query);
     /* Systematics. */
     /**/
     remove_filter("comment_feed_where", "c_ws_plugin__optimizemember_querys::_query_level_access_coms", 100, 2);
     remove_filter("wp_get_nav_menu_items", "c_ws_plugin__optimizemember_querys::_query_level_access_navs", 100);
     /**/
     if (is_object($wpdb) && is_object($wp_query) && (($o = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["filter_wp_query"]) || $force)) {
         if (!is_admin() || c_ws_plugin__optimizemember_querys::_is_admin_ajax_search($wp_query)) {
             $suppressing_filters = $wp_query->get("suppress_filters");
             /* Filter suppression on? */
             if (!$suppressing_filters && $force || !$suppressing_filters && in_array("all", $o) && !($initial_query && $wp_query->is_singular()) || !$suppressing_filters && (in_array("all", $o) || in_array("searches", $o)) && $wp_query->is_search() || !$suppressing_filters && (in_array("all", $o) || in_array("feeds", $o)) && $wp_query->is_feed() && !$wp_query->is_comment_feed() || !$suppressing_filters && (in_array("all", $o) || in_array("comment-feeds", $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed() || $suppressing_filters !== "n/a" && (in_array("all", $o) || in_array("nav-menus", $o)) && in_array("wp_get_nav_menu_items", $callers = isset($callers) ? $callers : c_ws_plugin__optimizemember_utilities::callers())) {
                 if (!$suppressing_filters && (in_array("all", $o) || in_array("comment-feeds", $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed()) {
                     add_filter("comment_feed_where", "c_ws_plugin__optimizemember_querys::_query_level_access_coms", 100, 2);
                 }
                 /**/
                 if ($suppressing_filters !== "n/a" && (in_array("all", $o) || in_array("nav-menus", $o))) {
                     /* Suppression irrelevant here. */
                     if (in_array("wp_get_nav_menu_items", $callers = isset($callers) ? $callers : c_ws_plugin__optimizemember_utilities::callers())) {
                         add_filter("wp_get_nav_menu_items", "c_ws_plugin__optimizemember_querys::_query_level_access_navs", 100);
                     }
                 }
                 /**/
                 if (is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID) || !($user = false)) {
                     if (!$user && ($_lwp = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["login_welcome_page"])) {
                         $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), array($_lwp))));
                         $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), array($_lwp))));
                     }
                     /**/
                     if (!$user && ($_dep = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["file_download_limit_exceeded_page"])) {
                         $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), array($_dep))));
                         $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), array($_dep))));
                     }
                     /**/
                     if (is_array($_ccaps = c_ws_plugin__optimizemember_utils_gets::get_unavailable_singular_ids_with_ccaps($user)) && !empty($_ccaps)) {
                         $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_ccaps)));
                         $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_ccaps)));
                     }
                     /**/
                     if (is_array($_drips = c_ws_plugin__optimizemember_utils_gets::get_unavailable_singular_ids_with_dripped_content($user)) && !empty($_drips)) {
                         $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_drips)));
                         $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_drips)));
                     }
                     /**/
                     if (is_array($_sps = c_ws_plugin__optimizemember_utils_gets::get_unavailable_singular_ids_with_sp()) && !empty($_sps)) {
                         $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_sps)));
                         $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_sps)));
                     }
                     unset($_lwp, $_dep, $_ccaps, $_sps, $_drips);
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_catgs"] === "all" && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                             $wp_query->set("category__in", array());
                             /* Include no other Categories. */
                             $wp_query->set("category__not_in", $_catgs = c_ws_plugin__optimizemember_utils_gets::get_all_category_ids());
                             $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__optimizemember_utils_gets::get_singular_ids_in_terms($_catgs))));
                             $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
                             break;
                             /* All Categories will be locked down. */
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_catgs"] && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                                 foreach ($_catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_catgs"]) as $_catg) {
                                     $_catgs = array_merge($_catgs, c_ws_plugin__optimizemember_utils_gets::get_all_child_category_ids($_catg));
                                 }
                                 /**/
                                 $wp_query->set("category__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("category__in")), $_catgs)));
                                 $wp_query->set("category__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("category__not_in")), $_catgs)));
                                 $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__optimizemember_utils_gets::get_singular_ids_in_terms($_catgs))));
                                 $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
                             }
                         }
                     }
                     unset($_catgs, $_catg, $_singulars);
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_ptags"] === "all" && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                             $wp_query->set("tag__in", array());
                             /* Include no other Tags. */
                             $wp_query->set("tag__not_in", $_tags = c_ws_plugin__optimizemember_utils_gets::get_all_tag_ids());
                             $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__optimizemember_utils_gets::get_singular_ids_in_terms($_tags))));
                             $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
                             break;
                             /* ALL Tags will be locked down. */
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_ptags"] && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                                 $_tags = c_ws_plugin__optimizemember_utils_gets::get_tags_converted_to_ids($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_ptags"]);
                                 /**/
                                 $wp_query->set("tag__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("tag__in")), $_tags)));
                                 $wp_query->set("tag__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("tag__not_in")), $_tags)));
                                 $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__optimizemember_utils_gets::get_singular_ids_in_terms($_tags))));
                                 $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
                             }
                         }
                     }
                     unset($_tags, $_tag, $_singulars);
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_posts"] === "all" && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                             $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_posts = c_ws_plugin__optimizemember_utils_gets::get_all_post_ids())));
                             $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_posts)));
                             break;
                             /* ALL Posts will be locked down. */
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_posts"] && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                                 foreach ($_posts = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_posts"]) as $_p) {
                                     if (strpos($_p, "all-") === 0 && preg_match("/^all-(.+)\$/", $_p, $_m)) {
                                         if (is_array($_p_of_type = c_ws_plugin__optimizemember_utils_gets::get_all_post_ids($_m[1])) && !empty($_p_of_type)) {
                                             $_posts = array_merge($_posts, $_p_of_type);
                                         }
                                     }
                                 }
                                 /**/
                                 $_posts = array_unique(c_ws_plugin__optimizemember_utils_arrays::force_integers($_posts));
                                 /**/
                                 $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_posts)));
                                 $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_posts)));
                             }
                         }
                     }
                     unset($_posts, $_p, $_m, $_p_of_type);
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_pages"] === "all" && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                             $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_pages = c_ws_plugin__optimizemember_utils_gets::get_all_page_ids())));
                             $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_pages)));
                             break;
                             /* ALL Pages will be locked down. */
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_pages"] && (!$user || !current_user_can("access_optimizemember_level" . $n))) {
                                 $_pages = c_ws_plugin__optimizemember_utils_arrays::force_integers(preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_pages"]));
                                 /**/
                                 $wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_pages)));
                                 $wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__optimizemember_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_pages)));
                             }
                         }
                     }
                     unset($_pages);
                 }
                 /**/
                 eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                 do_action("ws_plugin__optimizemember_during_query_level_access", get_defined_vars());
                 unset($__refs, $__v);
                 /* Unset defined __refs, __v. */
             }
         }
     }
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_after_query_level_access", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $initial_query = false;
     /* No longer. */
     /**/
     return;
     /* For uniformity. */
 }
コード例 #15
0
 /**
  * Connect to and process DataLink information for ccBill.
  *
  * optimizeMember's Auto EOT System must be enabled for this to work properly.
  *
  * If you have a HUGE userbase, increase the max IPNs per process.
  * But NOTE, this runs ``$per_process`` *( per Blog )* on a Multisite Network.
  * To increase, use: ``add_filter ("ws_plugin__optimizemember_pro_ccbill_datalink_ipns_per_process");``.
  *
  * @package optimizeMember\ccBill
  * @since 1.5
  *
  * @attaches-to ``add_action("ws_plugin__optimizemember_after_auto_eot_system");``
  *
  * @param array $vars Expects an array of defined variables passed in by the Action Hook.
  * @return null
  */
 public static function ccbill_datalink($vars = FALSE)
 {
     global $wpdb;
     global $current_site, $current_blog;
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_client_id"]) {
         $mst_time_10m_ago = time() - 6 * 3600 - 600;
         $datalink = "https://datalink.ccbill.com/data/main.cgi";
         /**/
         if (!($last = get_transient("s2m_" . md5("optimizemember_pro_ccbill_last_datalink"))) || $last < $mst_time_10m_ago - 86400) {
             $start = $last && $last >= $mst_time_10m_ago - (86400 + 43200) ? $last : $mst_time_10m_ago - 86400;
             $end = $last = $start + 86400 <= $mst_time_10m_ago ? $start + 86400 : $mst_time_10m_ago;
             /**/
             $dl_types = "REBILL" . ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_dl_cancellations"] || apply_filters("ws_plugin__optimizemember_pro_ccbill_datalink_pulls_cancellations", false) ? ",CANCELLATION" : "") . ",EXPIRE,REFUND,CHARGEBACK";
             $qvrs = array("startTime" => date("YmdHis", $start), "endTime" => date("YmdHis", $end), "transactionTypes" => $dl_types, "clientAccnum" => $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_client_sid"], "username" => $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_dl_user"], "password" => $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_ccbill_dl_pass"]);
             /**/
             if (($unprocessed_ipn_lines = trim(c_ws_plugin__optimizemember_utils_urls::remote($datalink = add_query_arg(urlencode_deep($qvrs), $datalink)))) && !preg_match("/^Error\\:/i", $unprocessed_ipn_lines)) {
                 $ccbill["optimizemember_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
                 /**/
                 set_transient("s2m_" . md5("optimizemember_pro_ccbill_last_datalink"), $last, 31556926);
                 /**/
                 $ccbill["optimizemember_log"][] = "Storing new DataLink IPNs into a Transient Queue.";
                 $ccbill["optimizemember_log"][] = $datalink;
                 $ccbill["optimizemember_log"][] = $unprocessed_ipn_lines;
                 /**/
                 set_transient("s2m_" . md5("optimizemember_pro_ccbill_datalink_ipns"), trim(trim(get_transient("s2m_" . md5("optimizemember_pro_ccbill_datalink_ipns"))) . "\n" . $unprocessed_ipn_lines), 31556926);
             } else {
                 if (!preg_match("/^Error\\:/i", $unprocessed_ipn_lines)) {
                     $ccbill["optimizemember_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
                     /**/
                     set_transient("s2m_" . md5("optimizemember_pro_ccbill_last_datalink"), $last, 31556926);
                     /**/
                     $ccbill["optimizemember_log"][] = "No new Datalink IPNs at this time: " . date("D M j, Y g:i:s a T");
                     $ccbill["optimizemember_log"][] = $datalink;
                     $ccbill["optimizemember_log"][] = $unprocessed_ipn_lines;
                 } else {
                     $ccbill["optimizemember_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
                     /**/
                     set_transient("s2m_" . md5("optimizemember_pro_ccbill_last_datalink"), $last, 31556926);
                     /**/
                     $ccbill["optimizemember_log"][] = "Recording DataLink error at: " . date("D M j, Y g:i:s a T");
                     $ccbill["optimizemember_log"][] = "Recording server IP address: " . $_SERVER["SERVER_ADDR"];
                     $ccbill["optimizemember_log"][] = $datalink;
                     $ccbill["optimizemember_log"][] = $unprocessed_ipn_lines;
                 }
             }
             /**/
             $logv = c_ws_plugin__optimizemember_utilities::ver_details();
             $logm = c_ws_plugin__optimizemember_utilities::mem_details();
             $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
             $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
             $log2 = is_multisite() && !is_main_site() ? "ccbill-dl-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "ccbill-dl.log";
             /**/
             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
                 if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                     if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                         file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($ccbill, true) . "\n\n", FILE_APPEND);
                     }
                 }
             }
         } else {
             if ($unprocessed_ipn_lines = trim(get_transient("s2m_" . md5("optimizemember_pro_ccbill_datalink_ipns")))) {
                 $per_process = apply_filters("ws_plugin__optimizemember_pro_ccbill_datalink_ipns_per_process", $vars["per_process"], get_defined_vars());
                 /**/
                 foreach ($unprocessed_lines = preg_split("/[\r\n]+/", $unprocessed_ipn_lines) as $line => $unprocessed_line) {
                     unset($ccbill, $processing, $processed, $ipn, $ipn_q, $log4, $_log4, $log2, $logs_dir);
                     /**/
                     if (($unprocessed_line = trim($unprocessed_line)) && ($counter = (int) $counter + 1)) {
                         $ccbill["optimizemember_log"][] = "DataLink IPN processed on: " . date("D M j, Y g:i:s a T");
                         /**/
                         $ccbill["dl_ipn"] = c_ws_plugin__optimizemember_utils_strings::trim_dq_deep(preg_split("/\",\"/", $unprocessed_line));
                         /**/
                         if (is_array($ccbill["dl_ipn_signup_vars"] = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(false, $ccbill["dl_ipn"][3]))) {
                             if (preg_match("/^REBILL\$/i", $ccbill["dl_ipn"][0])) {
                                 $ccbill["optimizemember_log"][] = "ccBill transaction identified as (SUBSCRIPTION PAYMENT).";
                                 $ccbill["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as txn_type (subscr_payment).";
                                 $ccbill["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                 /**/
                                 $processing = $processed = true;
                                 $ipn = array();
                                 /**/
                                 $ipn["txn_type"] = "subscr_payment";
                                 $ipn["subscr_id"] = $ccbill["dl_ipn_signup_vars"]["subscr_id"];
                                 /**/
                                 $ipn["custom"] = $ccbill["dl_ipn_signup_vars"]["custom"];
                                 /**/
                                 $ipn["txn_id"] = $ccbill["dl_ipn"][5];
                                 /**/
                                 $ipn["mc_gross"] = number_format($ccbill["dl_ipn"][6], 2, ".", "");
                                 $ipn["mc_currency"] = strtoupper("USD");
                                 $ipn["tax"] = number_format("0.00", 2, ".", "");
                                 /**/
                                 $ipn["payer_email"] = $ccbill["dl_ipn_signup_vars"]["payer_email"];
                                 $ipn["first_name"] = $ccbill["dl_ipn_signup_vars"]["first_name"];
                                 $ipn["last_name"] = $ccbill["dl_ipn_signup_vars"]["last_name"];
                                 /**/
                                 $ipn["option_name1"] = $ccbill["dl_ipn_signup_vars"]["option_name1"];
                                 $ipn["option_selection1"] = $ccbill["dl_ipn_signup_vars"]["option_selection1"];
                                 /**/
                                 $ipn["option_name2"] = $ccbill["dl_ipn_signup_vars"]["option_name2"];
                                 $ipn["option_selection2"] = $ccbill["dl_ipn_signup_vars"]["option_selection2"];
                                 /**/
                                 $ipn["item_number"] = $ccbill["dl_ipn_signup_vars"]["item_number"];
                                 $ipn["item_name"] = $ccbill["dl_ipn_signup_vars"]["item_name"];
                                 /**/
                                 $ipn_q = "&optimizemember_paypal_proxy=ccbill&optimizemember_paypal_proxy_use=standard-emails";
                                 $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                 /**/
                                 c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                             } else {
                                 if (preg_match("/^CANCELLATION\$/i", $ccbill["dl_ipn"][0])) {
                                     $ccbill["optimizemember_log"][] = "ccBill transaction identified as (SUBSCRIPTION CANCELLATION).";
                                     $ccbill["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as txn_type (subscr_cancel).";
                                     $ccbill["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                     /**/
                                     $processing = $processed = true;
                                     $ipn = array();
                                     /**/
                                     $ipn["txn_type"] = "subscr_cancel";
                                     $ipn["subscr_id"] = $ccbill["dl_ipn_signup_vars"]["subscr_id"];
                                     /**/
                                     $ipn["custom"] = $ccbill["dl_ipn_signup_vars"]["custom"];
                                     /**/
                                     $ipn["period1"] = $ccbill["dl_ipn_signup_vars"]["period1"];
                                     $ipn["period3"] = $ccbill["dl_ipn_signup_vars"]["period3"];
                                     /**/
                                     $ipn["payer_email"] = $ccbill["dl_ipn_signup_vars"]["payer_email"];
                                     $ipn["first_name"] = $ccbill["dl_ipn_signup_vars"]["first_name"];
                                     $ipn["last_name"] = $ccbill["dl_ipn_signup_vars"]["last_name"];
                                     /**/
                                     $ipn["option_name1"] = $ccbill["dl_ipn_signup_vars"]["option_name1"];
                                     $ipn["option_selection1"] = $ccbill["dl_ipn_signup_vars"]["option_selection1"];
                                     /**/
                                     $ipn["option_name2"] = $ccbill["dl_ipn_signup_vars"]["option_name2"];
                                     $ipn["option_selection2"] = $ccbill["dl_ipn_signup_vars"]["option_selection2"];
                                     /**/
                                     $ipn["item_number"] = $ccbill["dl_ipn_signup_vars"]["item_number"];
                                     $ipn["item_name"] = $ccbill["dl_ipn_signup_vars"]["item_name"];
                                     /**/
                                     $ipn_q = "&optimizemember_paypal_proxy=ccbill&optimizemember_paypal_proxy_use=standard-emails";
                                     $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                     /**/
                                     c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                                 } else {
                                     if (preg_match("/^EXPIRE\$/i", $ccbill["dl_ipn"][0])) {
                                         $ccbill["optimizemember_log"][] = "ccBill transaction identified as (SUBSCRIPTION EXPIRATION).";
                                         $ccbill["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as txn_type (subscr_eot).";
                                         $ccbill["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                         /**/
                                         $processing = $processed = true;
                                         $ipn = array();
                                         /**/
                                         $ipn["txn_type"] = "subscr_eot";
                                         $ipn["subscr_id"] = $ccbill["dl_ipn_signup_vars"]["subscr_id"];
                                         /**/
                                         $ipn["custom"] = $ccbill["dl_ipn_signup_vars"]["custom"];
                                         /**/
                                         $ipn["period1"] = $ccbill["dl_ipn_signup_vars"]["period1"];
                                         $ipn["period3"] = $ccbill["dl_ipn_signup_vars"]["period3"];
                                         /**/
                                         $ipn["payer_email"] = $ccbill["dl_ipn_signup_vars"]["payer_email"];
                                         $ipn["first_name"] = $ccbill["dl_ipn_signup_vars"]["first_name"];
                                         $ipn["last_name"] = $ccbill["dl_ipn_signup_vars"]["last_name"];
                                         /**/
                                         $ipn["option_name1"] = $ccbill["dl_ipn_signup_vars"]["option_name1"];
                                         $ipn["option_selection1"] = $ccbill["dl_ipn_signup_vars"]["option_selection1"];
                                         /**/
                                         $ipn["option_name2"] = $ccbill["dl_ipn_signup_vars"]["option_name2"];
                                         $ipn["option_selection2"] = $ccbill["dl_ipn_signup_vars"]["option_selection2"];
                                         /**/
                                         $ipn["item_number"] = $ccbill["dl_ipn_signup_vars"]["item_number"];
                                         $ipn["item_name"] = $ccbill["dl_ipn_signup_vars"]["item_name"];
                                         /**/
                                         $ipn_q = "&optimizemember_paypal_proxy=ccbill&optimizemember_paypal_proxy_use=standard-emails";
                                         $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                         /**/
                                         c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                                     } else {
                                         if (preg_match("/^(REFUND|CHARGEBACK)\$/i", $ccbill["dl_ipn"][0])) {
                                             $ccbill["optimizemember_log"][] = "ccBill transaction identified as (REFUND|CHARGEBACK).";
                                             $ccbill["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as payment_status (refunded|reversed).";
                                             $ccbill["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                             /**/
                                             $processing = $processed = true;
                                             $ipn = array();
                                             /**/
                                             $ipn["custom"] = $ccbill["dl_ipn_signup_vars"]["custom"];
                                             /**/
                                             $ipn["parent_txn_id"] = $ccbill["dl_ipn_signup_vars"]["subscr_id"];
                                             /**/
                                             $ipn["payment_status"] = preg_match("/^CHARGEBACK\$/i", $ccbill["dl_ipn"][0]) ? "reversed" : "refunded";
                                             $ipn["mc_fee"] = "-" . number_format("0.00", 2, ".", "");
                                             $ipn["mc_gross"] = "-" . number_format($ccbill["dl_ipn"][5], 2, ".", "");
                                             $ipn["mc_currency"] = strtoupper("USD");
                                             $ipn["tax"] = "-" . number_format("0.00", 2, ".", "");
                                             /**/
                                             $ipn["payer_email"] = $ccbill["dl_ipn_signup_vars"]["payer_email"];
                                             $ipn["first_name"] = $ccbill["dl_ipn_signup_vars"]["first_name"];
                                             $ipn["last_name"] = $ccbill["dl_ipn_signup_vars"]["last_name"];
                                             /**/
                                             $ipn["option_name1"] = $ccbill["dl_ipn_signup_vars"]["option_name1"];
                                             $ipn["option_selection1"] = $ccbill["dl_ipn_signup_vars"]["option_selection1"];
                                             /**/
                                             $ipn["option_name2"] = $ccbill["dl_ipn_signup_vars"]["option_name2"];
                                             $ipn["option_selection2"] = $ccbill["dl_ipn_signup_vars"]["option_selection2"];
                                             /**/
                                             $ipn["item_number"] = $ccbill["dl_ipn_signup_vars"]["item_number"];
                                             $ipn["item_name"] = $ccbill["dl_ipn_signup_vars"]["item_name"];
                                             /**/
                                             $ipn_q = "&optimizemember_paypal_proxy=ccbill&optimizemember_paypal_proxy_use=standard-emails";
                                             $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                             /**/
                                             c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                                         } else {
                                             if (!$processed) {
                                                 /* Here we add a message to the logs indicating the IPN was ignored; no action taken. */
                                                 $ccbill["optimizemember_log"][] = "Ignoring this DataLink IPN. It does NOT require any action on the part of optimizeMember.";
                                             }
                                         }
                                     }
                                 }
                             }
                         } else {
                             if (!$processed) {
                                 /* Here we add a message to the logs indicating that no IPN vars are available. */
                                 $ccbill["optimizemember_log"][] = "Ignoring this DataLink IPN. No IPN signup vars for Subscr. ID: " . $ccbill["dl_ipn"][3] . ".";
                             }
                         }
                         /**/
                         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
                         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
                         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
                         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
                         $log2 = is_multisite() && !is_main_site() ? "ccbill-dl-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "ccbill-dl-ipn.log";
                         /**/
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
                             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                                     file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($ccbill, true) . "\n\n", FILE_APPEND);
                                 }
                             }
                         }
                     }
                     /**/
                     unset($unprocessed_lines[$line]);
                     /* Remove this line and update the list of unprocessed IPN lines. */
                     set_transient("s2m_" . md5("optimizemember_pro_ccbill_datalink_ipns"), implode("\n", $unprocessed_lines), 31556926);
                     /**/
                     if ($counter >= $per_process) {
                         break;
                     }
                     /* Break the loop now. */
                 }
             }
         }
     }
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #16
0
 /**
  * Calls upon the PayPal PayFlow API, and returns the response.
  *
  * @package optimizeMember\PayPal
  * @since 120514
  *
  * @param array $post_vars An array of variables to send through the PayPal PayFlow API call.
  * @return array An array of variables returned by the PayPal PayFlow API.
  */
 public static function paypal_payflow_api_response($post_vars = FALSE)
 {
     global $current_site, $current_blog;
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_paypal_payflow_api_response", get_defined_vars());
     unset($__refs, $__v);
     /**/
     $url = "https://" . ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_sandbox"] ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com");
     /**/
     $post_vars = apply_filters("ws_plugin__optimizemember_paypal_payflow_api_post_vars", $post_vars, get_defined_vars());
     $post_vars = is_array($post_vars) ? $post_vars : array();
     /**/
     $post_vars["VERBOSITY"] = "MEDIUM";
     $post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_payflow_api_username"];
     $post_vars["PARTNER"] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_payflow_api_partner"];
     $post_vars["VENDOR"] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_payflow_api_vendor"];
     $post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_payflow_api_password"];
     /**/
     foreach ($post_vars as $_key => &$_value) {
         $_value = c_ws_plugin__optimizemember_paypal_utilities::paypal_payflow_api_nv_cleanup($_key, $_value);
     }
     unset($_key, $_value);
     /**/
     $input_time = date("D M j, Y g:i:s a T");
     /**/
     $nvp_post_vars = "";
     foreach ($post_vars as $_key => $_value) {
         $nvp_post_vars .= ($nvp_post_vars ? "&" : "") . $_key . "[" . strlen($_value) . "]=" . $_value;
     }
     unset($_key, $_value);
     /**/
     $nvp = trim(c_ws_plugin__optimizemember_utils_urls::remote($url, $nvp_post_vars, array("timeout" => 20, "headers" => array("Content-Type" => "text/namevalue"))));
     /**/
     $output_time = date("D M j, Y g:i:s a T");
     /**/
     wp_parse_str($nvp, $response);
     $response = c_ws_plugin__optimizemember_utils_strings::trim_deep($response);
     /**/
     if ($response["RESULT"] !== "0") {
         if (strlen($response["RESPMSG"])) {
             /* translators: Exclude `%2$s`. These are English details returned by PayPal. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__optimizemember_paypal_payflow_api_response`. */
             $response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["RESULT"], rtrim($response["RESPMSG"], "."));
         } else {
             $response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
         }
     } else {
         if (isset($response["TRXRESULT"]) && $response["TRXRESULT"] !== "0") {
             if (strlen($response["TRXRESPMSG"])) {
                 /* translators: Exclude `%2$s`. These are English details returned by PayPal. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__optimizemember_paypal_payflow_api_response`. */
                 $response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["TRXRESULT"], rtrim($response["TRXRESPMSG"], "."));
             } else {
                 $response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
             }
         }
     }
     /**/
     $logv = c_ws_plugin__optimizemember_utilities::ver_details();
     $logm = c_ws_plugin__optimizemember_utilities::mem_details();
     $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
     $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
     $log2 = is_multisite() && !is_main_site() ? "paypal-payflow-api-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-payflow-api.log";
     /**/
     if (isset($post_vars["ACCT"]) && strlen($post_vars["ACCT"]) > 4) {
         $post_vars["ACCT"] = str_repeat("*", strlen($post_vars["ACCT"]) - 4) . substr($post_vars["ACCT"], -4);
     }
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
         if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
             if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                 if ($log = "-------- Input vars: ( " . $input_time . " ) --------\n" . $nvp_post_vars . "\n" . var_export($post_vars, true) . "\n") {
                     if ($log .= "-------- Output string/vars: ( " . $output_time . " ) --------\n" . $nvp . "\n" . var_export($response, true)) {
                         file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . $log . "\n\n", FILE_APPEND);
                     }
                 }
             }
         }
     }
     /**/
     return apply_filters("ws_plugin__optimizemember_paypal_payflow_api_response", c_ws_plugin__optimizemember_paypal_utilities::_paypal_payflow_api_response_filters($response), get_defined_vars());
 }
コード例 #17
0
 /**
  * Handles PayPal Return URLs.
  *
  * @package optimizeMember\PayPal
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection.
  */
 public static function paypal_return()
 {
     global $current_site, $current_blog;
     /* For Multisite support. */
     /**/
     do_action("ws_plugin__optimizemember_before_paypal_return", get_defined_vars());
     /**/
     if (!empty($_GET["optimizemember_paypal_return"]) && ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_business"] || !empty($_GET["optimizemember_paypal_proxy"]))) {
         $paypal = array();
         // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
         if (!empty($_GET["optimizemember_paypal_proxy"]) && in_array($_GET["optimizemember_paypal_proxy"], array("alipay", "stripe", "authnet", "clickbank", "ccbill", "google"), TRUE)) {
             ${esc_html(trim(stripslashes($_GET["optimizemember_paypal_proxy"])))} =& $paypal;
         }
         // Internal alias by reference.
         $custom_success_redirection = !empty($_GET["optimizemember_paypal_return_success"]) ? esc_html(trim(stripslashes($_GET["optimizemember_paypal_return_success"]))) : false;
         $custom_success_redirection = $custom_success_redirection ? str_ireplace(array("&#038;", "&amp;"), "&", $custom_success_redirection) : $custom_success_redirection;
         /**/
         if (is_array($paypal = c_ws_plugin__optimizemember_paypal_utilities::paypal_postvars()) && ($_paypal = $paypal) && ($_paypal_s = serialize($_paypal))) {
             $paypal["optimizemember_log"][] = "Return-Data received on: " . date("D M j, Y g:i:s a T");
             $paypal["optimizemember_log"][] = "optimizeMember POST vars verified " . (!empty($paypal["proxy_verified"]) ? "with a Proxy Key" : "through a POST back to PayPal.");
             /**/
             $paypal["subscr_gateway"] = !empty($_GET["optimizemember_paypal_proxy"]) ? esc_html(trim(stripslashes($_GET["optimizemember_paypal_proxy"]))) : "paypal";
             /**/
             if (empty($_GET["optimizemember_paypal_proxy"]) || empty($_GET["optimizemember_paypal_proxy_use"]) || !preg_match("/ty-email/", $_GET["optimizemember_paypal_proxy_use"])) {
                 $payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)\$/i";
                 /**/
                 if (!empty($paypal["custom"]) && preg_match("/^" . preg_quote(preg_replace("/\\:([0-9]+)\$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", $paypal["custom"])) {
                     $paypal["optimizemember_log"][] = "optimizeMember originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
                     /**/
                     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                     if (!apply_filters("ws_plugin__optimizemember_during_paypal_return_conditionals", false, get_defined_vars())) {
                         unset($__refs, $__v);
                         /* Unset defined __refs, __v. */
                         /**/
                         if ($_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_web_accept_sp::cp(get_defined_vars())) {
                             $paypal = $_paypal_cp;
                         } else {
                             if ($_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_wa_ccaps_wo_level::cp(get_defined_vars())) {
                                 $paypal = $_paypal_cp;
                             } else {
                                 if ($_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_subscr_or_wa_w_level::cp(get_defined_vars())) {
                                     $paypal = $_paypal_cp;
                                 } else {
                                     if ($_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_subscr_modify_w_level::cp(get_defined_vars())) {
                                         $paypal = $_paypal_cp;
                                     } else {
                                         $paypal["optimizemember_log"][] = "Unexpected `txn_type/status`. The `txn_type/status` did not match a required action.";
                                         /**/
                                         $paypal["optimizemember_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
                                         /**/
                                         echo c_ws_plugin__optimizemember_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>ERROR:</strong> Unexpected <code>txn_type/status</code>.<br />The <code>txn_type/status</code> did not meet requirements.<br />Please contact Support for assistance.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                                     }
                                 }
                             }
                         }
                     } else {
                         /* Else a custom conditional has been applied by filters. */
                         unset($__refs, $__v);
                     }
                     /* Unset defined __refs, __v. */
                 } else {
                     $paypal["optimizemember_log"][] = "Unable to verify `\$_SERVER[\"HTTP_HOST\"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.";
                     /**/
                     $paypal["optimizemember_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
                     /**/
                     echo c_ws_plugin__optimizemember_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>ERROR:</strong> Unable to verify <code>$_SERVER["HTTP_HOST"]</code>.<br />Please contact Support for assistance.<br /><br />If you are the site owner, please check the <code>custom</code> value in your Button Code. It MUST start with your domain name.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                 }
             } else {
                 $paypal = $_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_proxy_ty_email::cp(get_defined_vars());
             }
         } else {
             if (!empty($_GET["optimizemember_paypal_proxy"]) && !empty($_GET["optimizemember_paypal_proxy_use"]) && preg_match("/x-preview/", $_GET["optimizemember_paypal_proxy_use"]) && ($paypal["subscr_gateway"] = esc_html(trim(stripslashes($_GET["optimizemember_paypal_proxy"]))))) {
                 $paypal = $_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_proxy_x_preview::cp(get_defined_vars());
             } else {
                 if (empty($_GET["tx"]) && empty($_GET["optimizemember_paypal_proxy"]) && ($paypal["subscr_gateway"] = "paypal")) {
                     $paypal = $_paypal_cp = c_ws_plugin__optimizemember_paypal_return_in_no_tx_data::cp(get_defined_vars());
                 } else {
                     $paypal["optimizemember_log"][] = "Unable to verify \$_POST vars. This is most likely related to an invalid configuration of optimizeMember, or a problem with server compatibility.";
                     $paypal["optimizemember_log"][] = "If you're absolutely SURE that your configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect/communicate with your Payment Gateway over an HTTPS connection.";
                     $paypal["optimizemember_log"][] = "optimizeMember uses the `WP_Http` class for remote connections; which will try to use `cURL` first, and then fall back on the `FOPEN` method when `cURL` is not available. On a Windows server, you may have to disable your `cURL` extension; and instead, set `allow_url_fopen = yes` in your php.ini file. The `cURL` extension (usually) does NOT support SSL connections on a Windows server.";
                     $paypal["optimizemember_log"][] = "Please see this thread: `http://www.optimizepress.com/forums/topic/ideal-server-configuration-for-optimizemember/` for details regarding the ideal server configuration for optimizeMember.";
                     $paypal["optimizemember_log"][] = var_export($_REQUEST, true);
                     /* Recording _POST + _GET vars for analysis and debugging. */
                     /**/
                     $paypal["optimizemember_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
                     /**/
                     echo c_ws_plugin__optimizemember_return_templates::return_template("default", _x('<strong>ERROR:</strong> Unable to verify <code>$_POST</code> vars.<br />Please contact Support for assistance.<br /><br />This is most likely related to an invalid configuration of optimizeMember, or a problem with server compatibility. If you are the site owner, and you\'re absolutely SURE that your configuration is valid, you may want to run some tests on your server, just to be sure <code>$_POST</code> variables are populated, and that your server is able to connect/communicate with your Payment Gateway over an HTTPS connection.<br /><br />optimizeMember uses the <code>WP_Http</code> class for remote connections; which will try to use <code>cURL</code> first, and then fall back on the <code>FOPEN</code> method when <code>cURL</code> is not available. On a Windows server, you may have to disable your <code>cURL</code> extension; and instead, set <code>allow_url_fopen = yes</code> in your php.ini file. The <code>cURL</code> extension (usually) does NOT support SSL connections on a Windows server.<br /><br />Please see <a href="http://www.optimizepress.com/forums/topic/ideal-server-configuration-for-optimizemember/" target="_blank">this thread</a> for details regarding the ideal server configuration for optimizeMember.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                 }
             }
         }
         /*
         Add RTN proxy ( when available ) to the ``$paypal`` array.
         */
         if (!empty($_GET["optimizemember_paypal_proxy"])) {
             $paypal["optimizemember_paypal_proxy"] = $_GET["optimizemember_paypal_proxy"];
         }
         /*
         Add IPN proxy use vars ( when available ) to the ``$paypal`` array.
         */
         if (!empty($_GET["optimizemember_paypal_proxy_use"])) {
             $paypal["optimizemember_paypal_proxy_use"] = $_GET["optimizemember_paypal_proxy_use"];
         }
         /*
         Also add RTN proxy self-verification ( when available ) to the ``$paypal`` array.
         */
         if (!empty($_GET["optimizemember_paypal_proxy_verification"])) {
             $paypal["optimizemember_paypal_proxy_verification"] = $_GET["optimizemember_paypal_proxy_verification"];
         }
         /*
         Also add RTN success redirection URL ( when available ) to the ``$paypal`` array.
         */
         if (!empty($_GET["optimizemember_paypal_return_success"])) {
             $paypal["optimizemember_paypal_return_success"] = $_GET["optimizemember_paypal_return_success"];
         }
         /*
         Also add RTN t and r Attributes ( when available ) to the ``$paypal`` array.
         */
         if (!empty($_GET["optimizemember_paypal_return_tra"])) {
             $paypal["optimizemember_paypal_return_tra"] = $_GET["optimizemember_paypal_return_tra"];
         }
         /*
         If debugging/logging is enabled; we need to append $paypal to the log file.
         	Logging now supports Multisite Networking as well.
         */
         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "paypal-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-rtn.log";
         /**/
         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($paypal, true) . "\n\n", FILE_APPEND);
                 }
             }
         }
         /**/
         eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
         do_action("ws_plugin__optimizemember_during_paypal_return", get_defined_vars());
         unset($__refs, $__v);
         /* Unset defined __refs, __v. */
         /**/
         exit;
         /* Clean exit. */
     }
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_after_paypal_return", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
 }
コード例 #18
0
ファイル: utilities.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Generates optimizeMember Security Badge.
  *
  * @package optimizeMember\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 optimizeMember 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__optimizemember_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. */
 }
コード例 #19
0
 /**
  * Shortcode `[optimizeMember-Pro-AuthNet-Form /]`.
  *
  * @package optimizeMember\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("optimizeMember-Pro-AuthNet-Form");``
  *
  * @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 Form Code, HTML markup.
  */
 public static function sc_authnet_form($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_pro_before_sc_authnet_form", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     c_ws_plugin__optimizemember_no_cache::no_cache_constants(true);
     /**/
     $attr = c_ws_plugin__optimizemember_utils_strings::trim_qts_deep((array) $attr);
     /**/
     $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", "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["rr"] = $attr["rt"] === "L" ? "BN" : $attr["rr"];
     $attr["rr"] = $attr["level"] === "*" ? "BN" : $attr["rr"];
     $attr["rr"] = !$attr["tp"] && !$attr["rr"] ? "BN" : $attr["rr"];
     $attr["cc"] = "USD";
     $attr["default_country_code"] = strtoupper($attr["default_country_code"]);
     $attr["success"] = c_ws_plugin__optimizemember_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"] = $_GET["s2p-coupon"] ? trim(strip_tags(stripslashes($_GET["s2p-coupon"]))) : $attr["coupon"];
     /**/
     $attr["singular"] = get_the_ID();
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_pro_before_sc_authnet_form_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     if ($attr["cancel"]) {
         $_p = c_ws_plugin__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
         /*
         Obtain a possible response and/or validation error.
         */
         $response = c_ws_plugin__optimizemember_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 Code", "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__optimizemember_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="optimizemember_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="optimizemember_pro_authnet_cancellation[attr]" id="s2member-pro-authnet-cancellation-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
         /*
         Get the form template.
         */
         $custom_template = file_exists(TEMPLATEPATH . "/authnet-cancellation-form.php") ? TEMPLATEPATH . "/authnet-cancellation-form.php" : false;
         $custom_template = file_exists(TEMPLATEPATH . "/authnet-cancellation-form.html") ? TEMPLATEPATH . "/authnet-cancellation-form.html" : $custom_template;
         $custom_template = $attr["template"] && file_exists(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
         $custom_template = $attr["template"] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
         /*
         Fill in the action.
         */
         $code = preg_replace("/%%action%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["REQUEST_URI"])), $code);
         /*
         Fill in the response.
         */
         $code = preg_replace("/%%response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($response["response"]), $code);
         /*
         Fill in the description.
         */
         $code = preg_replace("/%%description%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($attr["desc"]), $code);
         /*
         Fill the captcha section.
         */
         $code = preg_replace("/%%captcha%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($captcha), $code);
         /*
         Fill hidden inputs.
         */
         $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($hidden_inputs), $code);
         /**/
         eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
         do_action("ws_plugin__optimizemember_pro_during_sc_authnet_cancellation_form", get_defined_vars());
         unset($__refs, $__v);
         /* Unset defined __refs, __v. */
     } else {
         if ($attr["register"]) {
             $_p = c_ws_plugin__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
             /*
             Obtain a possible response and/or validation error.
             */
             $response = c_ws_plugin__optimizemember_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__"]["optimizemember"]["o"]["custom_reg_fields"]) {
                 /* Only display Custom Fields if configured. */
                 if ($fields_applicable = c_ws_plugin__optimizemember_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__"]["optimizemember"]["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__optimizemember_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "optimizemember_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, $_p["optimizemember_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 Code", "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__optimizemember_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__"]["optimizemember"]["o"]["custom_reg_opt_in"] && c_ws_plugin__optimizemember_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="optimizemember_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) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["custom_reg_opt_in"] == 1 || $_p["optimizemember_pro_authnet_registration"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="300" />' . "\n";
                 $opt_in .= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["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="optimizemember_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__"]["optimizemember"]["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__"]["optimizemember"]["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="optimizemember_pro_authnet_registration[attr]" id="s2member-pro-authnet-registration-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
             /*
             Get the form template.
             */
             $custom_template = file_exists(TEMPLATEPATH . "/authnet-registration-form.php") ? TEMPLATEPATH . "/authnet-registration-form.php" : false;
             $custom_template = file_exists(TEMPLATEPATH . "/authnet-registration-form.html") ? TEMPLATEPATH . "/authnet-registration-form.html" : $custom_template;
             $custom_template = $attr["template"] && file_exists(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
             $custom_template = $attr["template"] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
             /*
             Fill in the action.
             */
             $code = preg_replace("/%%action%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["REQUEST_URI"])), $code);
             /*
             Fill in the response.
             */
             $code = preg_replace("/%%response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($response["response"]), $code);
             /*
             Fill in the description.
             */
             $code = preg_replace("/%%description%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($attr["desc"]), $code);
             /*
             Fill in the registration section.
             */
             $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_registration"]["first_name"])), $code);
             $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_registration"]["last_name"])), $code);
             $code = preg_replace("/%%email_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_registration"]["email"])), $code);
             $code = preg_replace("/%%username_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_registration"]["username"])), $code);
             $code = preg_replace("/%%password1_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_registration"]["password1"])), $code);
             $code = preg_replace("/%%password2_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_registration"]["password2"])), $code);
             /*
             Fill in the custom fields section.
             */
             $code = preg_replace("/%%custom_fields%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($custom_fields), $code);
             /*
             Fill the captcha section.
             */
             $code = preg_replace("/%%captcha%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($captcha), $code);
             /*
             Fill the opt-in box.
             */
             $code = preg_replace("/%%opt_in%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($opt_in), $code);
             /*
             Fill hidden inputs.
             */
             $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($hidden_inputs), $code);
             /**/
             eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
             do_action("ws_plugin__optimizemember_pro_during_sc_authnet_registration_form", get_defined_vars());
             unset($__refs, $__v);
             /* Unset defined __refs, __v. */
         } else {
             if ($attr["update"]) {
                 $_p = c_ws_plugin__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
                 /*
                 Obtain a possible response and/or validation error.
                 */
                 $response = c_ws_plugin__optimizemember_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.
                 */
                 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="optimizemember_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["optimizemember_pro_authnet_update"]["card_type"]) && in_array(strtolower($_p["optimizemember_pro_authnet_update"]["card_type"]), $attr["accept"]) && $_p["optimizemember_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 country code options.
                 $country_default_by_currency = false. Authorize.Net always processes in USD, so the country is empty by default.
                 Authorize.Net always processes in USD. International transactions are converted automatically through banking institutions.
                 */
                 $country_default_by_currency = !$_p["optimizemember_pro_authnet_update"]["country"] && $attr["cc"] === "USD" ? "US" : $country_default_by_currency;
                 $country_default_by_currency = !$_p["optimizemember_pro_authnet_update"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                 $country_default_by_currency = !$_p["optimizemember_pro_authnet_update"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                 $country_default_by_currency = apply_filters("ws_plugin__optimizemember_pro_authnet_default_country", false, 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["optimizemember_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 Code", "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__optimizemember_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="optimizemember_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="optimizemember_pro_authnet_update[attr]" id="s2member-pro-authnet-update-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                 /*
                 Get the form template.
                 */
                 $custom_template = file_exists(TEMPLATEPATH . "/authnet-update-form.php") ? TEMPLATEPATH . "/authnet-update-form.php" : false;
                 $custom_template = file_exists(TEMPLATEPATH . "/authnet-update-form.html") ? TEMPLATEPATH . "/authnet-update-form.html" : $custom_template;
                 $custom_template = $attr["template"] && file_exists(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                 $custom_template = $attr["template"] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                 /*
                 Fill in the action.
                 */
                 $code = preg_replace("/%%action%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["REQUEST_URI"])), $code);
                 /*
                 Fill in the response.
                 */
                 $code = preg_replace("/%%response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($response["response"]), $code);
                 /*
                 Fill in the description.
                 */
                 $code = preg_replace("/%%description%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($attr["desc"]), $code);
                 /*
                 Fill in the billing method section.
                 */
                 $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($card_type_options), $code);
                 $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["card_number"])), $code);
                 $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["card_expiration"])), $code);
                 $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["card_verification"])), $code);
                 $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["card_start_date_issue_number"])), $code);
                 /*
                 Fill in the billing address section.
                 */
                 $code = preg_replace("/%%street_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["street"])), $code);
                 $code = preg_replace("/%%city_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["city"])), $code);
                 $code = preg_replace("/%%state_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["state"])), $code);
                 $code = preg_replace("/%%country_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($country_options), $code);
                 $code = preg_replace("/%%zip_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_update"]["zip"])), $code);
                 /*
                 Fill the captcha section.
                 */
                 $code = preg_replace("/%%captcha%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($captcha), $code);
                 /*
                 Fill hidden inputs.
                 */
                 $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($hidden_inputs), $code);
                 /**/
                 eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                 do_action("ws_plugin__optimizemember_pro_during_sc_authnet_update_form", get_defined_vars());
                 unset($__refs, $__v);
                 /* Unset defined __refs, __v. */
             } else {
                 if ($attr["sp"]) {
                     $_p = c_ws_plugin__optimizemember_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["optimizemember_pro_authnet_sp_checkout"]["coupon"] ? $_p["optimizemember_pro_authnet_sp_checkout"]["coupon"] : $attr["coupon"];
                     /*
                     Obtain a possible response and/or validation error.
                     */
                     $response = c_ws_plugin__optimizemember_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.
                     */
                     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="optimizemember_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["optimizemember_pro_authnet_sp_checkout"]["card_type"]) && in_array(strtolower($_p["optimizemember_pro_authnet_sp_checkout"]["card_type"]), $attr["accept"]) && $_p["optimizemember_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 country code options.
                     $country_default_by_currency = false. Authorize.Net always processes in USD, so the country is empty by default.
                     Authorize.Net always processes in USD. International transactions are converted automatically through banking institutions.
                     */
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "USD" ? "US" : $country_default_by_currency;
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_sp_checkout"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                     $country_default_by_currency = apply_filters("ws_plugin__optimizemember_pro_authnet_default_country", false, 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["optimizemember_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 Code", "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__optimizemember_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__"]["optimizemember"]["o"]["custom_reg_opt_in"] && c_ws_plugin__optimizemember_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="optimizemember_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) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["custom_reg_opt_in"] == 1 || $_p["optimizemember_pro_authnet_sp_checkout"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="400" />' . "\n";
                         $opt_in .= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["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="optimizemember_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__optimizemember_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 .= '<input type="hidden" name="optimizemember_pro_authnet_sp_checkout[attr]" id="s2member-pro-authnet-sp-checkout-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                     /*
                     Get the form template.
                     */
                     $custom_template = file_exists(TEMPLATEPATH . "/authnet-sp-checkout-form.php") ? TEMPLATEPATH . "/authnet-sp-checkout-form.php" : false;
                     $custom_template = file_exists(TEMPLATEPATH . "/authnet-sp-checkout-form.html") ? TEMPLATEPATH . "/authnet-sp-checkout-form.html" : $custom_template;
                     $custom_template = $attr["template"] && file_exists(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                     /*
                     Fill in the action.
                     */
                     $code = preg_replace("/%%action%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["REQUEST_URI"])), $code);
                     /*
                     Fill in the response.
                     */
                     $code = preg_replace("/%%response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($response["response"]), $code);
                     /*
                     Fill in the description.
                     */
                     $code = preg_replace("/%%description%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($attr["desc"]), $code);
                     /*
                     Fill in the coupon value.
                     */
                     $code = preg_replace("/%%coupon_response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(c_ws_plugin__optimizemember_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"], "response", array("affiliates-1px-response"))), $code);
                     $code = preg_replace("/%%coupon_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($attr["coupon"])), $code);
                     /*
                     Fill in the registration section.
                     */
                     $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_sp_checkout"]["first_name"])), $code);
                     $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_sp_checkout"]["last_name"])), $code);
                     $code = preg_replace("/%%email_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["email"])), $code);
                     /*
                     Fill in the billing method section.
                     */
                     $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($card_type_options), $code);
                     $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["card_number"])), $code);
                     $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["card_expiration"])), $code);
                     $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["card_verification"])), $code);
                     $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["card_start_date_issue_number"])), $code);
                     /*
                     Fill in the billing address section.
                     */
                     $code = preg_replace("/%%street_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["street"])), $code);
                     $code = preg_replace("/%%city_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["city"])), $code);
                     $code = preg_replace("/%%state_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["state"])), $code);
                     $code = preg_replace("/%%country_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($country_options), $code);
                     $code = preg_replace("/%%zip_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_sp_checkout"]["zip"])), $code);
                     /*
                     Fill the captcha section.
                     */
                     $code = preg_replace("/%%captcha%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($captcha), $code);
                     /*
                     Fill the opt-in box.
                     */
                     $code = preg_replace("/%%opt_in%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($opt_in), $code);
                     /*
                     Fill hidden inputs.
                     */
                     $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($hidden_inputs), $code);
                     /**/
                     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                     do_action("ws_plugin__optimizemember_pro_during_sc_authnet_sp_form", get_defined_vars());
                     unset($__refs, $__v);
                     /* Unset defined __refs, __v. */
                 } else {
                     $_p = c_ws_plugin__optimizemember_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["optimizemember_pro_authnet_checkout"]["coupon"] ? $_p["optimizemember_pro_authnet_checkout"]["coupon"] : $attr["coupon"];
                     /*
                     Obtain a possible response and/or validation error.
                     */
                     $response = c_ws_plugin__optimizemember_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.
                     */
                     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="optimizemember_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["optimizemember_pro_authnet_checkout"]["card_type"]) && in_array(strtolower($_p["optimizemember_pro_authnet_checkout"]["card_type"]), $attr["accept"]) && $_p["optimizemember_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 country code options.
                     $country_default_by_currency = false. Authorize.Net always processes in USD, so the country is empty by default.
                     Authorize.Net always processes in USD. International transactions are converted automatically through banking institutions.
                     */
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_checkout"]["country"] && $attr["cc"] === "USD" ? "US" : $country_default_by_currency;
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_checkout"]["country"] && $attr["cc"] === "CAD" ? "CA" : $country_default_by_currency;
                     $country_default_by_currency = !$_p["optimizemember_pro_authnet_checkout"]["country"] && $attr["cc"] === "GBP" ? "GB" : $country_default_by_currency;
                     $country_default_by_currency = apply_filters("ws_plugin__optimizemember_pro_authnet_default_country", false, 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["optimizemember_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__"]["optimizemember"]["o"]["custom_reg_fields"]) {
                         /* Only display Custom Fields if configured. */
                         if ($fields_applicable = c_ws_plugin__optimizemember_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__"]["optimizemember"]["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__optimizemember_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "optimizemember_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, $_p["optimizemember_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 Code", "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__optimizemember_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__"]["optimizemember"]["o"]["custom_reg_opt_in"] && c_ws_plugin__optimizemember_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="optimizemember_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) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["custom_reg_opt_in"] == 1 || $_p["optimizemember_pro_authnet_checkout"]["custom_fields"]["opt_in"] ? ' checked="checked"' : '') . ' tabindex="500" />' . "\n";
                         $opt_in .= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["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="optimizemember_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__"]["optimizemember"]["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__optimizemember_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 .= '<input type="hidden" name="optimizemember_pro_authnet_checkout[attr]" id="s2member-pro-authnet-checkout-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                     /*
                     Get the form template.
                     */
                     $custom_template = file_exists(TEMPLATEPATH . "/authnet-checkout-form.php") ? TEMPLATEPATH . "/authnet-checkout-form.php" : false;
                     $custom_template = file_exists(TEMPLATEPATH . "/authnet-checkout-form.html") ? TEMPLATEPATH . "/authnet-checkout-form.html" : $custom_template;
                     $custom_template = $attr["template"] && file_exists(TEMPLATEPATH . "/" . $attr["template"]) ? TEMPLATEPATH . "/" . $attr["template"] : $custom_template;
                     $custom_template = $attr["template"] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                     /*
                     Fill in the action.
                     */
                     $code = preg_replace("/%%action%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_SERVER["REQUEST_URI"])), $code);
                     /*
                     Fill in the response.
                     */
                     $code = preg_replace("/%%response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($response["response"]), $code);
                     /*
                     Fill in the description.
                     */
                     $code = preg_replace("/%%description%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($attr["desc"]), $code);
                     /*
                     Fill in the coupon value.
                     */
                     $code = preg_replace("/%%coupon_response%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(c_ws_plugin__optimizemember_pro_authnet_utilities::authnet_apply_coupon($attr, $attr["coupon"], "response", array("affiliates-1px-response"))), $code);
                     $code = preg_replace("/%%coupon_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($attr["coupon"])), $code);
                     /*
                     Fill in the registration section.
                     */
                     $code = preg_replace("/%%first_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_checkout"]["first_name"])), $code);
                     $code = preg_replace("/%%last_name_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($_p["optimizemember_pro_authnet_checkout"]["last_name"])), $code);
                     $code = preg_replace("/%%email_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["email"])), $code);
                     $code = preg_replace("/%%username_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["username"])), $code);
                     $code = preg_replace("/%%password1_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["password1"])), $code);
                     $code = preg_replace("/%%password2_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["password2"])), $code);
                     /*
                     Fill in the custom fields section.
                     */
                     $code = preg_replace("/%%custom_fields%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($custom_fields), $code);
                     /*
                     Fill in the billing method section.
                     */
                     $code = preg_replace("/%%card_type_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($card_type_options), $code);
                     $code = preg_replace("/%%card_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["card_number"])), $code);
                     $code = preg_replace("/%%card_expiration_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["card_expiration"])), $code);
                     $code = preg_replace("/%%card_verification_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["card_verification"])), $code);
                     $code = preg_replace("/%%card_start_date_issue_number_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["card_start_date_issue_number"])), $code);
                     /*
                     Fill in the billing address section.
                     */
                     $code = preg_replace("/%%street_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["street"])), $code);
                     $code = preg_replace("/%%city_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["city"])), $code);
                     $code = preg_replace("/%%state_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["state"])), $code);
                     $code = preg_replace("/%%country_options%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($country_options), $code);
                     $code = preg_replace("/%%zip_value%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(format_to_edit($_p["optimizemember_pro_authnet_checkout"]["zip"])), $code);
                     /*
                     Fill the captcha section.
                     */
                     $code = preg_replace("/%%captcha%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($captcha), $code);
                     /*
                     Fill the opt-in box.
                     */
                     $code = preg_replace("/%%opt_in%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($opt_in), $code);
                     /*
                     Fill hidden inputs.
                     */
                     $code = preg_replace("/%%hidden_inputs%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds($hidden_inputs), $code);
                     /*
                      * Custom button
                      */
                     if (!empty($content)) {
                         $code = preg_replace('/%%button_markup%%/', $content, $code);
                     } else {
                         $code = preg_replace("/%%button_markup%%/", sprintf('<input type="submit" id="s2member-pro-authnet-checkout-submit" class="s2member-pro-authnet-submit s2member-pro-authnet-checkout-submit" value="%s" tabindex="600" />', esc_attr(_x("Submit Form", "s2member-front", "s2member"))), $code);
                     }
                     /**/
                     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                     $attr["modify"] ? do_action("ws_plugin__optimizemember_pro_during_sc_authnet_modification_form", get_defined_vars()) : do_action("ws_plugin__optimizemember_pro_during_sc_authnet_form", get_defined_vars());
                     unset($__refs, $__v);
                     /* Unset defined __refs, __v. */
                 }
             }
         }
     }
     /**/
     $code = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', $code);
     return apply_filters("ws_plugin__optimizemember_pro_sc_authnet_form", $code, get_defined_vars());
 }
コード例 #20
0
 /**
  * Connect to and process cancellations/refunds/chargebacks/etc via Payflow.
  *
  * optimizeMember's Auto EOT System must be enabled for this to work properly.
  *
  * If you have a HUGE userbase, increase the max IPNs per process.
  * But NOTE, this runs ``$per_process`` *( per Blog )* on a Multisite Network.
  * To increase, use: ``add_filter ("ws_plugin__optimizemember_pro_payflow_ipns_per_process");``.
  *
  * @package optimizeMember\PayPal
  * @since 120514
  *
  * @attaches-to ``add_action("ws_plugin__optimizemember_after_auto_eot_system");``
  *
  * @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
  * @return null
  */
 public static function payflow_service($vars = FALSE)
 {
     global $wpdb;
     /* Need global DB obj. */
     global $current_site, $current_blog;
     /* For Multisite support. */
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_payflow_api_username"]) {
         $scan_time = apply_filters("ws_plugin__optimizemember_pro_payflow_status_scan_time", strtotime("-1 day"), get_defined_vars());
         $per_process = apply_filters("ws_plugin__optimizemember_pro_payflow_ipns_per_process", $vars["per_process"], get_defined_vars());
         /**/
         if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "optimizemember_subscr_gateway' AND `meta_value` = 'paypal' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "optimizemember_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
             foreach ($objs as $obj) {
                 if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
                     unset($paypal, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $ipn_q, $log4, $_log4, $log2, $logs_dir);
                     /**/
                     if (($subscr_id = get_user_option("optimizemember_subscr_id", $user_id)) && !get_user_option("optimizemember_auto_eot_time", $user_id)) {
                         if (is_array($ipn_sv = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(false, $subscr_id)) && ($paypal = c_ws_plugin__optimizemember_pro_paypal_utilities::payflow_get_profile($subscr_id)) && is_array($paypal["ipn_signup_vars"] = $ipn_sv)) {
                             if (preg_match("/expired/i", $paypal["STATUS"])) {
                                 $paypal["optimizemember_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
                                 /**/
                                 $paypal["optimizemember_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION EXPIRATION` ).";
                                 $paypal["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as `txn_type` ( `subscr_eot` ).";
                                 $paypal["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                 /**/
                                 $processing = $processed = true;
                                 $ipn = array();
                                 /* Reset. */
                                 /**/
                                 $ipn["txn_type"] = "subscr_eot";
                                 $ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
                                 /**/
                                 $ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
                                 /**/
                                 $ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
                                 $ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
                                 /**/
                                 $ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
                                 $ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
                                 $ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
                                 /**/
                                 $ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
                                 $ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
                                 /**/
                                 $ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
                                 $ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
                                 /**/
                                 $ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
                                 $ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
                                 /**/
                                 $ipn_q = "&optimizemember_paypal_proxy=paypal&optimizemember_paypal_proxy_use=pro-emails";
                                 $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                 /**/
                                 c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                             } else {
                                 if (preg_match("/(suspended|canceled|terminated|deactivated)/i", $paypal["STATUS"])) {
                                     $paypal["optimizemember_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
                                     /**/
                                     $paypal["optimizemember_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION " . strtoupper($paypal["STATUS"]) . "` ).";
                                     $paypal["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as `txn_type` ( `subscr_cancel` ).";
                                     $paypal["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                                     /**/
                                     $processing = $processed = true;
                                     $ipn = array();
                                     /* Reset. */
                                     /**/
                                     $ipn["txn_type"] = "subscr_cancel";
                                     $ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
                                     /**/
                                     $ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
                                     /**/
                                     $ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
                                     $ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
                                     /**/
                                     $ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
                                     $ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
                                     $ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
                                     /**/
                                     $ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
                                     $ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
                                     /**/
                                     $ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
                                     $ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
                                     /**/
                                     $ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
                                     $ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
                                     /**/
                                     $ipn_q = "&optimizemember_paypal_proxy=paypal&optimizemember_paypal_proxy_use=pro-emails";
                                     $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                                     /**/
                                     c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                                 } else {
                                     if (!$processed) {
                                         /* If nothing was processed, here we add a message to the logs indicating the status; which is being ignored. */
                                         $paypal["optimizemember_log"][] = "Ignoring this status ( `" . $paypal["STATUS"] . "` ). It does NOT require any action on the part of optimizeMember.";
                                     }
                                 }
                             }
                             /**/
                             $logv = c_ws_plugin__optimizemember_utilities::ver_details();
                             $logm = c_ws_plugin__optimizemember_utilities::mem_details();
                             $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
                             $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
                             $log2 = is_multisite() && !is_main_site() ? "paypal-payflow-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-payflow-ipn.log";
                             /**/
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
                                 if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                                     if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                                         file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($paypal, true) . "\n\n", FILE_APPEND);
                                     }
                                 }
                             }
                         }
                     }
                     /**/
                     update_user_option($user_id, "optimizemember_last_status_scan", time());
                     /**/
                     if ($counter >= $per_process) {
                         /* Only this many. */
                         break;
                     }
                     /* Break the loop now. */
                 }
             }
         }
     }
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #21
0
ファイル: translations.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Handles internal translations via `gettext` Filter.
  *
  * Important note. Because this routine also uses translation functionality by WordPress,
  * anything translated by this routine MUST be different, otherwise it will result in a recursive loop,
  * because the ``__()`` family of functions would be called upon recursively by this routine.
  *
  * If you're translating optimizeMember into a different language, your MO file for optimizeMember will automagically deal with
  * everything you see below. No worries. Just build your translation file for optimizeMember, and you're all set.
  *
  * @package optimizeMember\Translations
  * @since 3.5
  *
  * @attaches-to ``add_filter("gettext");``
  *
  * @param str $translated Expects already-translated string passed in by Filter.
  * @param str $original Expects original text string passed in by Filter.
  * @param str $domain Expects translation domain passed in by Filter.
  * @return str Translated string, possibly modified by this routine.
  */
 public static function translation_mangler($translated = FALSE, $original = FALSE, $domain = FALSE)
 {
     global $current_site, $current_blog;
     /* In support of Multisite Networking. */
     static $s = array();
     /* This static array optimizes all of these routines. */
     /**/
     if (isset($s["is_wp_login"]) && $s["is_wp_login"] || !isset($s["is_wp_login"]) && ($s["is_wp_login"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty($_REQUEST["action"]) && empty($_REQUEST["checkemail"]) ? true : false)) {
         if ($original === "Username") {
             $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("Username:"******"s2member-front", "s2member"), get_defined_vars());
         } else {
             if ($original === "Password") {
                 $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("My Password:"******"s2member-front", "s2member"), get_defined_vars());
             }
         }
     } else {
         if (isset($s["is_wp_login_register"]) && $s["is_wp_login_register"] || !isset($s["is_wp_login_register"]) && ($s["is_wp_login_register"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && !empty($_REQUEST["action"]) && $_REQUEST["action"] === "register" ? true : false)) {
             if ($original === "Username") {
                 $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("Username *", "s2member-front", "s2member"), get_defined_vars());
             } else {
                 if ($original === "Password") {
                     $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("Password *", "s2member-front", "s2member"), get_defined_vars());
                 } else {
                     if ($original === "E-mail") {
                         $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("Email Address *", "s2member-front", "s2member"), get_defined_vars());
                     }
                 }
             }
         } else {
             if (isset($s["is_wp_login_checkemail"]) && $s["is_wp_login_checkemail"] || !isset($s["is_wp_login_checkemail"]) && ($s["is_wp_login_checkemail"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty($_REQUEST["action"]) && !empty($_REQUEST["checkemail"]) && $_REQUEST["checkemail"] === "registered" ? true : false)) {
                 if ($original === "Registration complete. Please check your e-mail." && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["custom_reg_password"]) {
                     $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("Registration complete. Please log in.", "s2member-front", "s2member"), get_defined_vars());
                 }
             } else {
                 if (isset($s["is_user_new"]) && $s["is_user_new"] || !isset($s["is_user_new"]) && ($s["is_user_new"] = strpos($_SERVER["REQUEST_URI"], "/wp-admin/user-new.php") !== false ? true : false)) {
                     if ($original === "Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n" && !empty($_REQUEST["role"]) && preg_match("/^(subscriber|optimizemember_level[0-9]+)\$/", $_REQUEST["role"])) {
                         $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x("You have been invited to join `%1\$s` at\n%2\$s as a Member.\nPlease click the following link to confirm the invite:\n%4\$s\n", "s2member-front", "s2member"), get_defined_vars());
                     }
                 } else {
                     if (isset($s["is_wp_activate"]) && $s["is_wp_activate"] || !isset($s["is_wp_activate"]) && ($s["is_wp_activate"] = strpos($_SERVER["REQUEST_URI"], "/wp-activate.php") !== false ? true : false)) {
                         if ($original === 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>') {
                             $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x('Your account is now active. <a href="%1$s">Visit site</a> or <a href="%2$s">Log in</a>.', "s2member-front", "s2member"), get_defined_vars());
                         }
                     } else {
                         if (isset($s["is_wp_signup"]) && $s["is_wp_signup"] || !isset($s["is_wp_signup"]) && ($s["is_wp_signup"] = strpos($_SERVER["REQUEST_URI"], "/wp-signup.php") !== false ? true : false)) {
                             if ($original === "If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!") {
                                 $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", "", get_defined_vars());
                             } else {
                                 if ($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!") {
                                     if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
                                         $mms_options = c_ws_plugin__optimizemember_utilities::mms_options();
                                         $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__optimizemember_user_access::user_access_level($user)];
                                         $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                                         /**/
                                         $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                                         /* NOT less than zero. */
                                         $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                                         /**/
                                         $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . ($blogs_allowed > 1 ? '<br />' . sprintf(_nx('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
                                     }
                                 }
                             }
                         } else {
                             if (isset($s["is_bp_blog_creation"]) && $s["is_bp_blog_creation"] || !isset($s["is_bp_blog_creation"]) && ($s["is_bp_blog_creation"] = c_ws_plugin__optimizemember_utils_conds::bp_is_installed() && bp_is_create_blog() ? true : false)) {
                                 if ($original === "If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!") {
                                     $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", "", get_defined_vars());
                                 } else {
                                     if ($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!") {
                                         if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
                                             $mms_options = c_ws_plugin__optimizemember_utilities::mms_options();
                                             $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__optimizemember_user_access::user_access_level($user)];
                                             $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                                             /**/
                                             $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                                             /* NOT less than zero. */
                                             $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                                             /**/
                                             $translated = apply_filters("ws_plugin__optimizemember_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . ($blogs_allowed > 1 ? '<br />' . sprintf(_nx('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /**/
     return $translated;
     /* No Filters. */
 }
コード例 #22
0
ファイル: installation.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Activation routines for optimizeMember.
  *
  * @package optimizeMember\Installation
  * @since 3.5
  *
  * @return null
  */
 public static function activate($reactivation_reason = FALSE)
 {
     global $wpdb;
     /* Global database object reference. */
     global $current_site, $current_blog;
     /* Multisite. */
     /**/
     do_action("ws_plugin__optimizemember_before_activation", get_defined_vars());
     /**/
     c_ws_plugin__optimizemember_roles_caps::config_roles();
     /* Config Roles/Caps. */
     update_option("ws_plugin__optimizemember_activated_levels", $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]);
     /**/
     /*THIS LINE MOVE PRO FOLDER INTO RIGHT PLACE!*/
     //@rename($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["dir"].'/optimizeMember-pro', WP_PLUGIN_DIR.'/optimizeMember-pro');
     if (!is_dir($files_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["files_dir"])) {
         if (is_writable(dirname(c_ws_plugin__optimizemember_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__optimizemember_preserve_files_dir_htaccess", false, get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["files_dir_htaccess"]))));
         }
     }
     /**/
     c_ws_plugin__optimizemember_files::write_no_gzip_into_root_htaccess();
     /**/
     if (!is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
         if (is_writable(dirname(c_ws_plugin__optimizemember_utils_dirs::strip_dir_app_data($logs_dir)))) {
             mkdir($logs_dir, 0777, true);
         }
     }
     /**/
     if (is_dir($logs_dir) && is_writable($logs_dir)) {
         if (!file_exists($htaccess = $logs_dir . "/.htaccess") || !apply_filters("ws_plugin__optimizemember_preserve_logs_dir_htaccess", false, get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir_htaccess"]))));
         }
     }
     /**/
     !is_array(get_option("ws_plugin__optimizemember_cache")) ? update_option("ws_plugin__optimizemember_cache", array()) : null;
     !is_array(get_option("ws_plugin__optimizemember_notices")) ? update_option("ws_plugin__optimizemember_notices", array()) : null;
     !is_array(get_option("ws_plugin__optimizemember_options")) ? update_option("ws_plugin__optimizemember_options", array()) : null;
     !is_numeric(get_option("ws_plugin__optimizemember_configured")) ? update_option("ws_plugin__optimizemember_configured", "0") : null;
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["configured"]) {
         $v = get_option("ws_plugin__optimizemember_activated_version");
         /* Currently. */
         /**/
         if (!$v || !version_compare($v, "3.2", ">=")) {
             $like = "`meta_key` LIKE 's2member\\_%' AND `meta_key` NOT LIKE '%s2member\\_originating\\_blog%'";
             $wpdb->query("UPDATE `" . $wpdb->usermeta . "` SET `meta_key` = CONCAT('" . $wpdb->prefix . "', `meta_key`) WHERE " . $like);
         }
         /**/
         if (!$v || !version_compare($v, "3.2.5", ">=")) {
             $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\\_transient\\_%'");
         }
         /**/
         if (!$v || !version_compare($v, "3.2.6", ">=")) {
             $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 'optimizemember_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
         }
         /**/
         if (!$v || !version_compare($v, "110912", ">=") && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["filter_wp_query"] === array("all")) {
             //$notice = '<strong>IMPORTANT:</strong> This version of optimizeMember changes the way your <code>Alternative View Protections</code> work. Please review your options under: <code>optimizeMember -> Restriction Options -> Alternative View Protections</code>.<br />';
             $notice = '';
             c_ws_plugin__optimizemember_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--optimizemember-start", "blog|network:ws-plugin--optimizemember-mms-ops", "blog|network:ws-plugin--optimizemember-gen-ops", "blog|network:ws-plugin--optimizemember-res-ops"));
         }
         /**/
         $notice = '<strong>optimizeMember</strong> has been <strong>reactivated</strong>, with ' . ($reactivation_reason === "levels" ? '<code>' . esc_html($GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]) . '</code> Membership Levels' : 'the latest version') . '.<br />';
         $notice .= 'You now have version ' . esc_html(WS_PLUGIN__OPTIMIZEMEMBER_VERSION) . '. Your existing configuration remains.';
         /**/
         if (!is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site()) {
             /* No Changelog on a Multisite Blog Farm. */
             //$notice .= '<br />Have fun, <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--optimizemember-info#rm-changelog")).'">read the Changelog</a>, and make some money! :-)';
             /**/
             c_ws_plugin__optimizemember_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--optimizemember-start", "blog|network:ws-plugin--optimizemember-mms-ops", "blog|network:ws-plugin--optimizemember-gen-ops", "blog|network:ws-plugin--optimizemember-res-ops"));
         }
     } else {
         $notice = '<strong>Note:</strong> optimizeMember adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with optimizeMember, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
         /**/
         c_ws_plugin__optimizemember_admin_notices::enqueue_admin_notice($notice, "blog:users.php", false, false, true);
         /**/
         $notice = '<strong>optimizeMember</strong> v' . esc_html(WS_PLUGIN__OPTIMIZEMEMBER_VERSION) . ' has been <strong>activated</strong>. Nice work!<br />';
         $notice .= 'Have fun, <a href="' . esc_attr(admin_url("/admin.php?page=ws-plugin--optimizemember-start")) . '">read the Quick Start Guide</a>, and make some money! :-)';
         /**/
         c_ws_plugin__optimizemember_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--optimizemember-start", "blog|network:ws-plugin--optimizemember-mms-ops", "blog|network:ws-plugin--optimizemember-gen-ops", "blog|network:ws-plugin--optimizemember-res-ops"));
     }
     /**/
     if (is_multisite() && is_main_site()) {
         $wpdb->query("INSERT INTO `" . $wpdb->usermeta . "` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 'optimizemember_originating_blog', '" . esc_sql($current_site->blog_id) . "' FROM `" . $wpdb->users . "` WHERE `ID` NOT IN (SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 'optimizemember_originating_blog')");
         /**/
         $notice = '<strong>Multisite Network</strong> updated automatically by <strong>optimizeMember</strong> v' . esc_html(WS_PLUGIN__OPTIMIZEMEMBER_VERSION) . '.<br />';
         $notice .= 'You\'ll want to configure optimizeMember\'s Multisite options now.<br />';
         $notice .= 'In the Dashboard for your Main Site, see:<br />';
         $notice .= '<code>optimizeMember -> Multisite ( Config )</code>.';
         /**/
         c_ws_plugin__optimizemember_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--optimizemember-start", "blog|network:ws-plugin--optimizemember-mms-ops", "blog|network:ws-plugin--optimizemember-gen-ops", "blog|network:ws-plugin--optimizemember-res-ops"));
         /**/
         update_site_option("ws_plugin__optimizemember_options", (array) get_option("ws_plugin__optimizemember_options"));
         /**/
         update_option("ws_plugin__optimizemember_activated_mms_version", WS_PLUGIN__OPTIMIZEMEMBER_VERSION);
     }
     /**/
     update_option("ws_plugin__optimizemember_activated_version", WS_PLUGIN__OPTIMIZEMEMBER_VERSION);
     /**/
     do_action("ws_plugin__optimizemember_after_activation", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #23
0
 /**
  * Handles Authorize.Net IPN URL processing.
  *
  * @package optimizeMember\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after handling IPN processing.
  */
 public static function authnet_notify()
 {
     global $current_site, $current_blog;
     /* For Multisite support. */
     /**/
     if (!empty($_GET["optimizemember_pro_authnet_notify"]) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_authnet_api_login_id"]) {
         @ignore_user_abort(true);
         /* Continue processing even if/when connection is broken by the sender. */
         /**/
         if (is_array($authnet = c_ws_plugin__optimizemember_pro_authnet_utilities::authnet_postvars()) && ($_authnet = $authnet)) {
             $authnet["optimizemember_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
             $authnet["optimizemember_log"][] = "optimizeMember POST vars verified with Authorize.Net.";
             /**/
             if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && $authnet["x_response_code"] === "1") {
                 if (($_authnet = c_ws_plugin__optimizemember_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                     $authnet["optimizemember_log"][] = "Authorize.Net transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
                     $authnet["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal processor as `txn_type` ( `subscr_payment` ).";
                     $authnet["optimizemember_log"][] = "Please check PayPal IPN logs for further processing details.";
                     /**/
                     $processing = $processed = true;
                     $ipn = array();
                     /* Reset. */
                     /**/
                     $ipn["txn_type"] = "subscr_payment";
                     $ipn["subscr_id"] = $authnet["x_subscription_id"];
                     $ipn["txn_id"] = $authnet["x_trans_id"];
                     /**/
                     $ipn["custom"] = $authnet["s2_custom"];
                     /**/
                     $ipn["mc_gross"] = number_format($authnet["x_amount"], 2, ".", "");
                     $ipn["mc_currency"] = strtoupper("USD");
                     /* Auth.Net uses USD. */
                     $ipn["tax"] = number_format($authnet["x_tax"], 2, ".", "");
                     /**/
                     $ipn["payer_email"] = $authnet["x_email"];
                     $ipn["first_name"] = $authnet["x_first_name"];
                     $ipn["last_name"] = $authnet["x_last_name"];
                     /**/
                     $ipn["option_name1"] = "Referencing Customer ID";
                     $ipn["option_selection1"] = $authnet["x_subscription_id"];
                     /**/
                     $ipn["option_name2"] = "Customer IP Address";
                     $ipn["option_selection2"] = null;
                     /**/
                     $ipn["item_number"] = $authnet["s2_invoice"];
                     $ipn["item_name"] = $authnet["x_description"];
                     /**/
                     $ipn_q = "&optimizemember_paypal_proxy=authnet&optimizemember_paypal_proxy_use=pro-emails";
                     $ipn_q .= "&optimizemember_paypal_proxy_verification=" . urlencode(c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen());
                     /**/
                     c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                 } else {
                     $authnet["optimizemember_log"][] = "Authorize.Net transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
                     $authnet["optimizemember_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
                 }
             } else {
                 if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && preg_match("/^(2|3)\$/", $authnet["x_response_code"])) {
                     if (($_authnet = c_ws_plugin__optimizemember_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                         $authnet["optimizemember_log"][] = "Authorize.Net transaction identified as ( `ARB / FAILED PAYMENT` ).";
                         $authnet["optimizemember_log"][] = "optimizeMember does NOT respond to individual failed payment notifications.";
                         $authnet["optimizemember_log"][] = "When multiple consecutive payments fail, optimizeMember is notified via ARB services.";
                         $authnet["optimizemember_log"][] = "This does not require any action ( at the moment ) on the part of optimizeMember.";
                     } else {
                         $authnet["optimizemember_log"][] = "Authorize.Net transaction identified as ( `ARB / FAILED PAYMENT` ).";
                         $authnet["optimizemember_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
                     }
                 } else {
                     if (!$processed) {
                         /* If nothing was processed, here we add a message to the logs indicating the IPN was ignored. */
                         $authnet["optimizemember_log"][] = "Ignoring this IPN. The transaction does NOT require any action on the part of optimizeMember.";
                     }
                 }
             }
         } else {
             $authnet["optimizemember_log"][] = "Unable to verify POST vars. This is most likely related to an invalid Authorize.Net configuration. Please check: optimizeMember -> Authorize.Net Options.";
             $authnet["optimizemember_log"][] = "If you're absolutely SURE that your Authorize.Net configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to Authorize.Net over an HTTPS connection.";
             $authnet["optimizemember_log"][] = "optimizeMember uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows server.";
             $authnet["optimizemember_log"][] = var_export($_REQUEST, true);
             /* Recording _POST + _GET vars for analysis and debugging. */
         }
         /*
         If debugging/logging is enabled; we need to append $authnet to the log file.
         	Logging now supports Multisite Networking as well.
         */
         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "authnet-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "authnet-ipn.log";
         /**/
         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export($authnet, true) . "\n\n", FILE_APPEND);
                 }
             }
         }
         /**/
         status_header(200);
         /* Send a 200 OK status header. */
         header("Content-Type: text/plain; charset=utf-8");
         /* Content-Type text/plain with UTF-8. */
         eval('while (@ob_end_clean ());');
         /* End/clean all output buffers that may or may not exist. */
         /**/
         exit;
         /* Exit now. */
     }
 }
コード例 #24
0
 /**
  * Displays Capability Tracking Codes.
  *
  * These are stored inside optimizeMember's Transient Queue by the IPN processor.
  *
  * Tracking Codes are only displayed/processed one time.
  * optimizeMember will display Tracking Codes in (1) of these 3 locations:
  *
  * o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
  * o Otherwise, if possible, on the Login Form *( in the footer )* after returning from your Payment Gateway.
  * o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's next login.
  *
  * @package optimizeMember\Tracking
  * @since 110815
  *
  * @attaches-to ``add_action("login_footer");``
  * @attaches-to ``add_action("wp_footer");``
  * @also-called-by {@link optimizeMember\Tracking\c_ws_plugin__optimizemember_tracking_codes::generate_all_tracking_codes()}
  *
  * @return null After displaying possible Tracking Code(s).
  */
 public static function display_ccap_tracking_codes()
 {
     do_action("ws_plugin__optimizemember_before_display_ccap_tracking_codes", get_defined_vars());
     /**/
     if (!empty($_COOKIE["optimizemember_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__optimizemember_utils_encryption::decrypt($_COOKIE["optimizemember_tracking"])) || ($reg_cookies = c_ws_plugin__optimizemember_register_access::reg_cookies_ok()) && extract($reg_cookies) && ($subscr_or_txn_id = $subscr_id)) {
         if ($code = get_transient($transient = "s2m_" . md5("optimizemember_transient_ccap_tracking_codes_" . $subscr_or_txn_id))) {
             delete_transient($transient);
             /* Only display this ONE time. Delete transient immediately. */
             /**/
             echo '<img src="' . esc_attr(site_url("/?optimizemember_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
             /**/
             eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
             do_action("ws_plugin__optimizemember_during_display_ccap_tracking_codes", get_defined_vars());
             unset($__refs, $__v);
             /* Unset defined __refs, __v. */
             /**/
             if (is_multisite() && c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() && !is_main_site()) {
                 echo do_shortcode($code) . "\n";
                 /* No PHP here. */
             } else {
                 echo do_shortcode(c_ws_plugin__optimizemember_utilities::evl($code));
             }
         }
     }
     /**/
     do_action("ws_plugin__optimizemember_after_display_ccap_tracking_codes", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #25
0
ファイル: constants.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Defines several API Constants for optimizeMember.
  *
  * These are also duplicated into the JavaScript API for optimizeMember.
  * Except for a few that would pose a security issue. Such as the PayPal API Credentials;
  * those are NOT included in the JavaScript API.
  *
  * @package optimizeMember\API_Constants
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null
  */
 public static function constants()
 {
     do_action("ws_plugin__optimizemember_before_constants", get_defined_vars());
     /**/
     $links = c_ws_plugin__optimizemember_cache::cached_page_links();
     /**/
     $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID ? $user : false;
     /**/
     $level = c_ws_plugin__optimizemember_user_access::user_access_level($user);
     $file_downloads = c_ws_plugin__optimizemember_files::user_downloads($user);
     $login_redirection_url = c_ws_plugin__optimizemember_login_redirects::login_redirection_url($user);
     /**/
     $custom = $user ? get_user_option("optimizemember_custom", $user->ID) : "";
     $subscr_id = $user ? get_user_option("optimizemember_subscr_id", $user->ID) : "";
     $subscr_gateway = $user ? get_user_option("optimizemember_subscr_gateway", $user->ID) : "";
     $registration_ip = $user ? get_user_option("optimizemember_registration_ip", $user->ID) : "";
     $custom_fields = $user ? get_user_option("optimizemember_custom_fields", $user->ID) : array();
     $paid_registration_times = $user ? get_user_option("optimizemember_paid_registration_times", $user->ID) : array();
     $login_counter = $user ? (int) get_user_option("optimizemember_login_counter") : -1;
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_during_constants", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**
      * Current version of optimizeMember.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_VERSION; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_VERSION" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_VERSION);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\WS_PLUGIN__OPTIMIZEMEMBER_VERSION
      */
     if (!defined("OPTIMIZEMEMBER_VERSION")) {
         define("OPTIMIZEMEMBER_VERSION", $c[] = (string) WS_PLUGIN__OPTIMIZEMEMBER_VERSION);
     }
     /**
      * The number of times the current User has logged into your site.
      *
      * Negative `-1` through number of times logged-in.
      * Negative `-1` indicates they are NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_LOGIN_COUNTER; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_LOGIN_COUNTER" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_LOGIN_COUNTER);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 110720
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_login_counter")`
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_LOGIN_COUNTER")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_LOGIN_COUNTER", $c[] = (int) $login_counter);
     }
     /**
      * Is the current User logged-in at all.
      *
      * True if the current User IS logged-in, else false.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN)
      * 	echo 'You ARE logged in.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmIf constant(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN)]
      * 	You ARE logged-in.
      * [/opmIf]
      *
      * <script type="text/javascript">
      * 	if(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN)
      * 		document.write('You ARE logged-in.');
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see optimizeMember\API_Functions\is_user_not_logged_in()
      * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN", $c[] = $user ? true : false);
     }
     /**
      * Is the current User logged-in as a Member.
      *
      * True if the current User IS logged-in with a Membership Level greater than `0`, else false.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
      * 	echo 'You ARE logged in at Level #1 or higher.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmIf constant(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)]
      * 	You ARE logged in at Level #1 or higher.
      * [/opmIf]
      *
      * <script type="text/javascript">
      * 	if(OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
      * 		document.write('You ARE logged in at Level #1 or higher.');
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see optimizeMember\API_Functions\is_user_not_logged_in()
      * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
      *
      * @see optimizeMember\API_Functions\user_is()
      * @see optimizeMember\API_Functions\user_is_not()
      *
      * @see optimizeMember\API_Functions\current_user_is()
      * @see optimizeMember\API_Functions\current_user_is_not()
      * @see optimizeMember\API_Functions\current_user_is_for_blog()
      * @see optimizeMember\API_Functions\current_user_is_not_for_blog()
      *
      * @see optimizeMember\API_Functions\current_user_cannot()
      * @see optimizeMember\API_Functions\current_user_cannot_for_blog()
      * @see http://codex.wordpress.org/Function_Reference/user_can user_can()
      * @see http://codex.wordpress.org/Function_Reference/current_user_can current_user_can()
      * @see http://codex.wordpress.org/Function_Reference/current_user_can_for_blog current_user_can_for_blog()
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_access_role")`
      * @see `get_user_field("optimizemember_access_level")`
      * @see `get_user_field("optimizemember_access_label")`
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", $c[] = $user && $level >= 1 ? true : false);
     }
     /**
      * The current User's Membership Access Level.
      *
      * Negative `-1` through max Membership Level number.
      * Negative `-1` indicates they are NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_access_role")`
      * @see `get_user_field("optimizemember_access_level")`
      * @see `get_user_field("optimizemember_access_label")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL", $c[] = (int) $level);
     }
     /**
      * The current User's Membership Access Label.
      *
      * As configured by the site owner. Each Membership Level is associated with a Membership Label
      * *( i.e. Bronze, Silver, Gold, Platinum )*, or whatever the site owner has configured.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_access_role")`
      * @see `get_user_field("optimizemember_access_level")`
      * @see `get_user_field("optimizemember_access_label")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL", isset($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $level . "_label"]) ? $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $level . "_label"] : '');
     }
     /**
      * The current User's Paid Subscription ID ( when applicable ).
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_subscr_id")`
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option("optimizemember_subscr_id")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_CUSTOM
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID", $c[] = $user ? (string) $subscr_id : "");
     }
     /**
      * The current User's Paid Subscription ID ( when applicable );
      * otherwise, this will contain their WordPress User ID.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_subscr_or_wp_id")`
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option("optimizemember_subscr_id")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_CUSTOM
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", $c[] = $user ? $subscr_id ? (string) $subscr_id : (string) $user->ID : "");
     }
     /**
      * The current User's Paid Subscription Gateway Code ( when applicable ).
      *
      * Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
      *
      * An empty string if NOT logged-in, or if NOT a paying Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_subscr_gateway")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_CUSTOM
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option("optimizemember_subscr_gateway")`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY", $c[] = $user ? (string) $subscr_gateway : "");
     }
     /**
      * The current User's Custom String, associated with their Profile.
      *
      * For paying Members, this should always start with the installation domain name.
      * This is taken from the `custom=""` Attribute in your Button/Form Shortcode.
      *
      * Other pipe delimited values may follow the installation domain name, if configured by the site owner.
      * For instance, this might be equal to something like: `www.example.com|cv1|cv2|cv3`.
      *
      * An empty string if NOT logged-in, or if NOT a paying Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_CUSTOM; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_CUSTOM" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_CUSTOM);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_custom")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option("optimizemember_custom")`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_CUSTOM")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_CUSTOM", $c[] = $user ? (string) $custom : "");
     }
     /**
      * The current User's Registration Time.
      *
      * The Registration Time, is the time at which the Username was created for the account, that's it.
      * There's nothing special about this. This simply returns a {@link http://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_registration_time()
      *
      * @see optimizeMember\API_Functions\optimizemember_paid_registration_time()
      * @see `optimizemember_paid_registration_time("level1")`
      *
      * @see optimizeMember\API_Functions\get_user_field()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME", $c[] = $user && $user->user_registered ? (int) strtotime($user->user_registered) : 0);
     }
     /**
      * The current User's first Paid Registration Time; regardless of which paid Level they gained access to.
      *
      * **NOTE** A Paid Registration Time, is NOT necessarily related specifically to a Payment.
      * optimizeMember records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
      *
      * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
      * optimizeMember will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
      * optimizeMember monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
      * So, optimizeMember stores the first Time a Member reaches each Level of paid access; and optimizeMember does NOT care if they *actually* paid, or not.
      *
      * If the current User has never been at a paid Membership Level, this will be equal to `0`.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME);
      * </script>
      * ```
      *
      * If you need to know the last time an actual payment was received, please use ``get_user_option ("optimizemember_last_payment_time")``.
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_registration_time()
      *
      * @see optimizeMember\API_Functions\optimizemember_paid_registration_time()
      * @see `optimizemember_paid_registration_time("level1")`
      *
      * @see optimizeMember\API_Functions\get_user_field()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME", $c[] = $user && (int) $paid_registration_times["level"] ? (int) $paid_registration_times["level"] : 0);
     }
     /**
      * The number of days the current User has been a paid Member.
      *
      * **NOTE** This is calculated using the first Paid Registration Time.
      * A Paid Registration Time, is NOT necessarily related specifically to a Payment.
      * optimizeMember records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
      *
      * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
      * optimizeMember will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
      * optimizeMember monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
      * So, optimizeMember stores the first Time a Member reaches each Level of paid access; and optimizeMember does NOT care if they *actually* paid, or not.
      *
      * If the current User has never been at a paid Membership Level, this will be equal to `0`.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS);
      * </script>
      * ```
      *
      * If you need to know the last time an actual payment was received, please use ``get_user_option ("optimizemember_last_payment_time")``.
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_registration_time()
      *
      * @see optimizeMember\API_Functions\optimizemember_paid_registration_time()
      * @see `optimizemember_paid_registration_time("level1")`
      *
      * @see optimizeMember\API_Functions\get_user_field()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS", $c[] = $user && (int) $paid_registration_times["level"] ? (int) floor((strtotime("now") - (int) $paid_registration_times["level"]) / 86400) : 0);
     }
     /**
      * The number of days the current User has had an account, period.
      *
      * **NOTE** This is calculated with Registration Time.
      * The Registration Time, is the time at which the Username was created for the account, that's it.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_registration_time()
      *
      * @see optimizeMember\API_Functions\optimizemember_paid_registration_time()
      * @see `optimizemember_paid_registration_time("level1")`
      *
      * @see optimizeMember\API_Functions\get_user_field()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_DAYS", $c[] = $user && $user->user_registered ? (int) floor((strtotime("now") - strtotime($user->user_registered)) / 86400) : 0);
     }
     /**
      * The current User's Display Name.
      *
      * This is usually a name they prefer to be known by publicly.
      * Some Users/Members prefer to use their First Name as the Display Name, and keep their Last Name private.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("display_name")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME", $c[] = $user ? (string) $user->display_name : "");
     }
     /**
      * The current User's First Name.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("first_name")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME", $c[] = $user ? (string) $user->first_name : "");
     }
     /**
      * The current User's Last Name.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("last_name")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME", $c[] = $user ? (string) $user->last_name : "");
     }
     /**
      * The current User's Username.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_LOGIN; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_LOGIN" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_LOGIN);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("user_login")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_LOGIN")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_LOGIN", $c[] = $user ? (string) $user->user_login : "");
     }
     /**
      * The current User's Email Address.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_EMAIL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_EMAIL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_EMAIL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("user_email")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_EMAIL")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_EMAIL", $c[] = $user ? (string) $user->user_email : "");
     }
     /**
      * The current User's IP Address ( even if/when NOT logged-in ).
      *
      * This is the current IP Address, taken from ``$_SERVER["REMOTE_ADDR"]``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_IP; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_IP" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_IP);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_registration_ip")`
      * @see `get_user_field("ip")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
      * @see `$_SERVER["REMOTE_ADDR"]`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_IP")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_IP", $c[] = (string) $_SERVER["REMOTE_ADDR"]);
     }
     /**
      * IP Address the current User had during registration.
      *
      * This is the IP Address the User had at the time they registered.
      * It's useful when you need to know the original IP Address they used.
      * For instance, this is needed by some affiliate tracking systems; such as iDevAffiliate.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_registration_ip")`
      * @see `get_user_field("ip")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
      * @see `$_SERVER["REMOTE_ADDR"]`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP", $c[] = $user ? (string) $registration_ip : "");
     }
     /**
      * The current User's WordPress User ID.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("id")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_ID")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_ID", $c[] = $user ? (int) $user->ID : 0);
     }
     /**
      * The current User's fields, provided by optimizeMember.
      *
      * This holds a JSON-encoded array, containing these array keys:
      *
      * o `id` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ID}
      * o `ip` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_IP}
      * o `reg_ip` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP}
      * o `email` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_EMAIL}
      * o `login` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LOGIN}
      * o `first_name` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME}
      * o `last_name` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME}
      * o `display_name` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME}
      * o `subscr_id` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID}
      * o `subscr_or_wp_id` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
      * o `subscr_gateway` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY}
      * o `custom` = value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_CUSTOM}
      * o and any Custom Registration/Profile Fields configured by the site owner.
      *
      * This will be an empty JSON-encoded array if NOT logged-in.
      *
      * ———— Code Sample ( Using ``json_decode(JSON, true)`` ) ————
      * ```
      * <!php
      * $fields = json_decode(OPTIMIZEMEMBER_CURRENT_USER_FIELDS, true);
      * echo $fields["email"]; # The current User's Email Address.
      * echo $fields["my_unique_field_id"]; # A Custom Registration/Profile Field configured by the site owner.
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet user_field="id" /]
      * [opmGet user_field="ip" /]
      * [opmGet user_field="reg_ip" /]
      * [opmGet user_field="email" /]
      * [opmGet user_field="login" /]
      * [opmGet user_field="first_name" /]
      * [opmGet user_field="last_name" /]
      * [opmGet user_field="display_name" /]
      * [opmGet user_field="optimizemember_subscr_id" /]
      * [opmGet user_field="optimizemember_subscr_wp_id" /]
      * [opmGet user_field="optimizemember_subscr_gateway" /]
      * [opmGet user_field="optimizemember_custom" /]
      * [opmGet user_field="my_custom_field_id" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_FIELDS.id);
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_FIELDS.display_name);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_FIELDS")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_FIELDS", $c[] = $user ? json_encode(array_merge(array("id" => OPTIMIZEMEMBER_CURRENT_USER_ID, "ip" => OPTIMIZEMEMBER_CURRENT_USER_IP, "reg_ip" => OPTIMIZEMEMBER_CURRENT_USER_REGISTRATION_IP, "email" => OPTIMIZEMEMBER_CURRENT_USER_EMAIL, "login" => OPTIMIZEMEMBER_CURRENT_USER_LOGIN, "first_name" => OPTIMIZEMEMBER_CURRENT_USER_FIRST_NAME, "last_name" => OPTIMIZEMEMBER_CURRENT_USER_LAST_NAME, "display_name" => OPTIMIZEMEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => OPTIMIZEMEMBER_CURRENT_USER_CUSTOM), (array) $custom_fields)) : json_encode(array()));
     }
     /**
      * Indicates the number of unique Files the current User is allowed to download every X days.
      *
      * `0` means no access to File Downloads has been made available to the User.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", $c[] = (int) $file_downloads["allowed"]);
     }
     /**
      * Does the current User have access to unlimited File Downloads.
      *
      * A value of true means the current User's allowed downloads are >= `999999999`, and false means it is not.
      * This is useful if you are allowing unlimited ( i.e. `999999999+` ) Downloads on some Membership Levels.
      * You can display `Unlimited` instead of a numerical value.
      *
      * This will be false if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
      * 	echo 'You have access to unlimited downloads.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmIf constant(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)]
      * 	You have access to unlimited downloads.
      * [/opmIf]
      *
      * <script type="text/javascript">
      * 	if(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
      * 		document.write('You have access to unlimited downloads.');
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", $c[] = $file_downloads["allowed"] >= 999999999 ? true : false);
     }
     /**
      * Indicates the number of unique Files the current User has downloaded in the last X days.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @note This does NOT include File Downloads accessed with an Advanced File Download Key.
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", $c[] = (int) $file_downloads["currently"]);
     }
     /**
      * Indicates the X number of days, configured by the site owner; for the current User.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * You are allowed to download <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !> files, every <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
      * You've downloaded <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * You are allowed to download [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /] files, every [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
      * You've downloaded [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
      *
      * You are allowed to download <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
      * You've downloaded <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", $c[] = (int) $file_downloads["allowed_days"]);
     }
     /**
      * The configured Page ID, for the Download Limit Exceeded Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID")) {
         define("OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", $c[] = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["file_download_limit_exceeded_page"]);
     }
     /**
      * The configured Page ID, for the Membership Options Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Membership Options Page`
      */
     if (!defined("OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID")) {
         define("OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", $c[] = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["membership_options_page"]);
     }
     /**
      * The configured Page ID, for the Login Welcome Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Login Welcome Page`
      */
     if (!defined("OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID")) {
         define("OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID", $c[] = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["login_welcome_page"]);
     }
     /**
      * A URL, which leads to the Stand-Alone Profile Modification Page.
      *
      * This is always a reference to `/?optimizemember_profile=1` *( i.e. the Stand-Alone version )*.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Profile Modifications`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", $c[] = (string) site_url("/?optimizemember_profile=1"));
     }
     /**
      * A URL, which leads to the Download Limit Exceeded Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Download Limit Exceeded Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL")) {
         define("OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", $c[] = (string) $links["file_download_limit_exceeded_page"]);
     }
     /**
      * A URL, which leads to the Membership Options Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Membership Options Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Membership Options Page`
      */
     if (!defined("OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL")) {
         define("OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", $c[] = (string) $links["membership_options_page"]);
     }
     /* Signup page. */
     /**
      * The URL, which leads to the Login Welcome Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Login Welcome Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Login Welcome Page`
      */
     if (!defined("OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL")) {
         define("OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL", $c[] = $login_redirection_url ? (string) $login_redirection_url : (string) $links["login_welcome_page"]);
     }
     /**
      * The URL, which logs the current User out of their account.
      *
      * This is the value provided by WordPress. It's the same as using ``wp_logout_url()``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LOGOUT_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LOGOUT_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LOGOUT_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
      */
     if (!defined("OPTIMIZEMEMBER_LOGOUT_PAGE_URL")) {
         define("OPTIMIZEMEMBER_LOGOUT_PAGE_URL", $c[] = (string) wp_logout_url());
     }
     /* This triggers `wp_nonce_tick()`; watch out for dynamic changes. */
     /**
      * The URL, where a User can log into their account.
      *
      * This is the value provided by WordPress. It's the same as using ``wp_login_url()``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LOGIN_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LOGIN_PAGE_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LOGIN_PAGE_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGOUT_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
      */
     if (!defined("OPTIMIZEMEMBER_LOGIN_PAGE_URL")) {
         define("OPTIMIZEMEMBER_LOGIN_PAGE_URL", $c[] = (string) wp_login_url());
     }
     /* Will not trigger `wp_nonce_tick()`, no worries in this case. */
     /**
      * Each Membership Level ( Label ); as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``OPTIMIZEMEMBER_LEVEL0_LABEL`` = Free Subscriber
      * o Level #1 ``OPTIMIZEMEMBER_LEVEL1_LABEL`` = Bronze Member
      * o Level #2 ``OPTIMIZEMEMBER_LEVEL2_LABEL`` = Silver Member
      * o Level #3 ``OPTIMIZEMEMBER_LEVEL3_LABEL`` = Gold Member
      * o Level #4 ``OPTIMIZEMEMBER_LEVEL4_LABEL`` = Platinum Member
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LEVEL0_LABEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LEVEL0_LABEL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LEVEL0_LABEL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\get_user_field()
      * @see `get_user_field("optimizemember_access_role")`
      * @see `get_user_field("optimizemember_access_level")`
      * @see `get_user_field("optimizemember_access_label")`
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LABEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      *
      * @see `Dashboard -> optimizeMember -> General Options -> Membership Level ( Labels )`
      */
     for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n++) {
         if (!defined($OPTIMIZEMEMBER_LEVELn_LABEL = "OPTIMIZEMEMBER_LEVEL" . $n . "_LABEL")) {
             define($OPTIMIZEMEMBER_LEVELn_LABEL, $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_label"]);
         }
     }
     /**
      * File Downloads allowed at each Membership Level; as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``OPTIMIZEMEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #1 ``OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #2 ``OPTIMIZEMEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #3 ``OPTIMIZEMEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #4 ``OPTIMIZEMEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED`` = `0`
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n++) {
         if (!defined($OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = "OPTIMIZEMEMBER_LEVEL" . $n . "_FILE_DOWNLOADS_ALLOWED")) {
             define($OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED, $c[] = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_file_downloads_allowed"]);
         }
     }
     /**
      * File Download days, at each Membership Level; as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``OPTIMIZEMEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #1 ``OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #2 ``OPTIMIZEMEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #3 ``OPTIMIZEMEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #4 ``OPTIMIZEMEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * At Level #1, Members are allowed to download <!php echo OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; !> files, every <!php echo OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; !> days.
      * You are currently at Membership Level #<!php echo OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL; !>. You've downloaded <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * At Level #1, Members are allowed to download [opmGet constant="OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED" /] files, every [opmGet constant="OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS" /] days.
      * You are currently at Membership Level #[opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL" /]. You've downloaded [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
      *
      * At Level #1, Members are allowed to download <script type="text/javascript">document.write(OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(OPTIMIZEMEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS);</script> days.
      * You are currently at Membership Level #<script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_ACCESS_LEVEL);</script>. You've downloaded <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["levels"]; $n++) {
         if (!defined($OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = "OPTIMIZEMEMBER_LEVEL" . $n . "_FILE_DOWNLOADS_ALLOWED_DAYS")) {
             define($OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS, $c[] = (int) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["level" . $n . "_file_downloads_allowed_days"]);
         }
     }
     /**
      * Inline File Download extensions; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\optimizemember_user_downloads()
      * @see optimizeMember\API_Functions\optimizemember_total_downloads_of()
      * @see optimizeMember\API_Functions\optimizemember_total_unique_downloads_of()
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see `Dashboard -> optimizeMember -> Download Options`
      */
     if (!defined("OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS")) {
         define("OPTIMIZEMEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["file_download_inline_extensions"]);
     }
     /**
      * From: Name, for optimizeMember-specific emails; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL
      *
      * @see `Dashboard -> optimizeMember -> General Options`
      */
     if (!defined("OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME")) {
         define("OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["reg_email_from_name"]);
     }
     /**
      * From: Email Address, for optimizeMember-specific emails; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_REG_EMAIL_FROM_NAME
      *
      * @see `Dashboard -> optimizeMember -> General Options`
      */
     if (!defined("OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL")) {
         define("OPTIMIZEMEMBER_REG_EMAIL_FROM_EMAIL", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["reg_email_from_email"]);
     }
     /**
      * Full URL to PayPal IPN handler, provided by optimizeMember.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_RETURN_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> IPN Integration`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL")) {
         define("OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL", $c[] = (string) site_url("/?optimizemember_paypal_notify=1"));
     }
     /**
      * Full URL to PayPal Auto-Return/PDT handler, provided by optimizeMember.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_RETURN_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_RETURN_URL" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_PAYPAL_RETURN_URL);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Auto-Return/PDT Integration`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_RETURN_URL")) {
         define("OPTIMIZEMEMBER_PAYPAL_RETURN_URL", $c[] = (string) site_url("/?optimizemember_paypal_return=1"));
     }
     /**
      * PayPal Business Email Address; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_BUSINESS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_BUSINESS" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_PAYPAL_BUSINESS);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_USERNAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_PASSWORD
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_BUSINESS")) {
         define("OPTIMIZEMEMBER_PAYPAL_BUSINESS", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_business"]);
     }
     /**
      * PayPal endpoint domain ( changes when Sandbox Mode is enabled ).
      *
      * o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
      * o In Production Mode, this is: `www.paypal.com`.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_ENDPOINT; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_ENDPOINT" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_PAYPAL_ENDPOINT);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_ENDPOINT")) {
         define("OPTIMIZEMEMBER_PAYPAL_ENDPOINT", $c[] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com");
     }
     /**
      * PayPal API endpoint domain ( changes when Sandbox Mode is enabled ).
      *
      * o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
      * o In Production Mode, this is: `api-3t.paypal.com`.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_ENDPOINT
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT")) {
         define("OPTIMIZEMEMBER_PAYPAL_API_ENDPOINT", $c[] = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_sandbox"] ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com");
     }
     /**
      * PayPal API Username; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_API_USERNAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_API_USERNAME" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_BUSINESS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_PASSWORD
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_API_USERNAME")) {
         define("OPTIMIZEMEMBER_PAYPAL_API_USERNAME", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_api_username"]);
     }
     /**
      * PayPal API Password; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_API_PASSWORD; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_API_PASSWORD" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_BUSINESS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_USERNAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_API_PASSWORD")) {
         define("OPTIMIZEMEMBER_PAYPAL_API_PASSWORD", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_api_password"]);
     }
     /**
      * PayPal API Signature; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_BUSINESS
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_USERNAME
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_API_PASSWORD
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Account Details`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE")) {
         define("OPTIMIZEMEMBER_PAYPAL_API_SIGNATURE", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_api_signature"]);
     }
     /**
      * PayPal PDT Identity Token; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_RETURN_URL
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_PAYPAL_NOTIFY_URL
      *
      * @see `Dashboard -> optimizeMember -> PayPal Options -> Auto-Return/PDT Integration`
      */
     if (!defined("OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN")) {
         define("OPTIMIZEMEMBER_PAYPAL_PDT_IDENTITY_TOKEN", $c[] = (string) $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["paypal_identity_token"]);
     }
     /**
      * PayPal value for Payment Buttons with input name: `invoice`.
      *
      * This can be used to auto-fill the `invoice` value in PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link optimizeMember\API_Constants\WS_PLUGIN__OPTIMIZEMEMBER_API_CONSTANTS_MD5}.
      * It MUST be excluded, because the value of this particular API Constant will change too often *( i.e. it changes, depending on microtime )*.
      * So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
      * to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
      *
      * These five API Constants are special.
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_VALUE_FOR_PP_INV}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for optimizeMember.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * The `ON0/OS0` values, are how optimizeMember identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by optimizeMember's Button Generator.
      *
      * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
      * optimizeMember can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by optimizeMember to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_VALUE_FOR_PP_INV; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_VALUE_FOR_PP_INV" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_VALUE_FOR_PP_INV);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 110720
      *
      * @var str
      *
      * @see optimizeMember\API_Functions\optimizemember_value_for_pp_inv()
      *
      * @see `Dashboard -> optimizeMember -> PayPal Buttons`
      */
     if (!defined("OPTIMIZEMEMBER_VALUE_FOR_PP_INV")) {
         define("OPTIMIZEMEMBER_VALUE_FOR_PP_INV", uniqid() . "~" . OPTIMIZEMEMBER_CURRENT_USER_IP);
     }
     /**
      * PayPal value for Payment Buttons with input name: `on0`.
      *
      * Used in PayPal Modification Buttons *( i.e. upgrades/downgrades )*.
      *
      * This auto-fills the `on0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
      * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
      * Otherwise, it will be set to a default value of: "Originating Domain".
      *
      * These five API Constants are special.
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_VALUE_FOR_PP_INV}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for optimizeMember.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * The `ON0/OS0` values, are how optimizeMember identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by optimizeMember's Button Generator.
      *
      * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
      * optimizeMember can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by optimizeMember to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
      *
      * @see `Dashboard -> optimizeMember -> PayPal Buttons`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", $c[] = OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID ? "Referencing Customer ID" : "Originating Domain");
     }
     /**
      * PayPal value for Payment Buttons with input name: `os0`.
      *
      * Used in PayPal Modification Buttons *( i.e. upgrades/downgrades )*.
      *
      * This auto-fills the `os0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
      * this will auto-fill the value for the `os0` input variable, with the value of {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
      * Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *( the originating domain name )*.
      *
      * These five API Constants are special.
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_VALUE_FOR_PP_INV}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for optimizeMember.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * The `ON0/OS0` values, are how optimizeMember identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by optimizeMember's Button Generator.
      *
      * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
      * optimizeMember can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by optimizeMember to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
      *
      * @see `Dashboard -> optimizeMember -> PayPal Buttons`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", $c[] = OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID ? OPTIMIZEMEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string) $_SERVER["HTTP_HOST"]);
     }
     /**
      * PayPal value for Payment Buttons with input name: `on1`.
      *
      * This auto-fills the `on1` value in PayPal Button Codes.
      * This always contains the string: "Customer IP Address".
      *
      * These five API Constants are special.
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_VALUE_FOR_PP_INV}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for optimizeMember.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * The `ON0/OS0` values, are how optimizeMember identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by optimizeMember's Button Generator.
      *
      * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
      * optimizeMember can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by optimizeMember to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
      *
      * @see `Dashboard -> optimizeMember -> PayPal Buttons`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1", $c[] = "Customer IP Address");
     }
     /**
      * PayPal value for Payment Buttons with input name: `os1`.
      *
      * This auto-fills the `os1` value in PayPal Button Codes,
      * with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
      *
      * These five API Constants are special.
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_VALUE_FOR_PP_INV}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for optimizeMember.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link optimizeMember\API_Functions\optimizemember_value_for_pp_inv()} function should be used instead.
      *
      * The `ON0/OS0` values, are how optimizeMember identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by optimizeMember's Button Generator.
      *
      * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
      * optimizeMember can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by optimizeMember to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [opmGet constant="OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]
      *
      * <script type="text/javascript">
      * 	document.write(OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1);
      * </script>
      * ```
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      *
      * @see optimizeMember\API_Constants\OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
      *
      * @see `Dashboard -> optimizeMember -> PayPal Buttons`
      */
     if (!defined("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1")) {
         define("OPTIMIZEMEMBER_CURRENT_USER_VALUE_FOR_PP_OS1", $c[] = (string) $_SERVER["REMOTE_ADDR"]);
     }
     /*
     Allows other Constants to be calculated with their checksums included too.
     */
     $c = apply_filters("ws_plugin__optimizemember_during_constants_c", $c, get_defined_vars());
     /**
      * Used internally by optimizeMember to compare the value of all API Constants at once.
      *
      * @package optimizeMember\API_Constants
      * @since 3.5
      *
      * @var str
      */
     if (!defined("WS_PLUGIN__OPTIMIZEMEMBER_API_CONSTANTS_MD5")) {
         define("WS_PLUGIN__OPTIMIZEMEMBER_API_CONSTANTS_MD5", md5(serialize($c) . c_ws_plugin__optimizemember_utilities::ver_checksum()));
     }
     /*
     Calls the after Hook. Do NOT set Constants here.
     */
     do_action("ws_plugin__optimizemember_after_constants", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #26
0
 /**
  * Handles Stripe Webhook/IPN event processing.
  *
  * @package optimizeMember\Stripe
  * @since 140617
  *
  * @attaches-to ``add_action('init');``
  */
 public static function stripe_notify()
 {
     global $current_site, $current_blog;
     if (!empty($_GET['optimizemember_pro_stripe_notify']) && $GLOBALS['WS_PLUGIN__']['optimizemember']['o']['pro_stripe_api_secret_key']) {
         $stripe = array();
         // Initialize array of Webhook/IPN event data and s2Member log details.
         @ignore_user_abort(TRUE);
         // Continue processing even if/when connection is broken.
         require_once dirname(__FILE__) . '/stripe-sdk/lib/Stripe.php';
         Stripe::setApiKey($GLOBALS['WS_PLUGIN__']['optimizemember']['o']['pro_stripe_api_secret_key']);
         if (is_object($event = c_ws_plugin__optimizemember_pro_stripe_utilities::get_event()) && ($stripe['event'] = $event)) {
             switch ($event->type) {
                 case 'invoice.payment_succeeded':
                     // Subscription payments.
                     if (!empty($event->data->object) && ($stripe_invoice = $event->data->object) instanceof Stripe_Invoice && !empty($stripe_invoice->customer) && !empty($stripe_invoice->subscription) && ($stripe_invoice_total = number_format(c_ws_plugin__optimizemember_pro_stripe_utilities::cents_to_dollar_amount($stripe_invoice->total, $stripe_invoice->currency), 2, '.', '')) && is_object($stripe_subscription = c_ws_plugin__optimizemember_pro_stripe_utilities::get_customer_subscription($stripe_invoice->customer, $stripe_invoice->subscription)) && ($ipn_signup_vars = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(0, $stripe_subscription->id))) {
                         $processing = TRUE;
                         $ipn['txn_type'] = 'subscr_payment';
                         $ipn['txn_id'] = $stripe_invoice->id;
                         $ipn['txn_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['mc_gross'] = $stripe_invoice_total;
                         $ipn['mc_currency'] = strtoupper($stripe_invoice->currency);
                         $ipn['tax'] = number_format(0, 2, '.', '');
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['optimizemember_paypal_proxy'] = 'stripe';
                         $ipn['optimizemember_paypal_proxy_use'] = 'pro-emails';
                         $ipn['optimizemember_paypal_proxy_verification'] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__optimizemember_utils_urls::remote(site_url('/?optimizemember_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['optimizemember_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         if ($maybe_end_subscription = self::_maybe_end_subscription_after_payment($stripe_invoice->customer, $stripe_subscription)) {
                             $stripe['optimizemember_log'][] = $maybe_end_subscription;
                         }
                         $stripe['optimizemember_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through optimizeMember\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['optimizemember_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'invoice.payment_failed':
                     // Subscription payment failures.
                     if (!empty($event->data->object) && ($stripe_invoice = $event->data->object) instanceof Stripe_Invoice && !empty($stripe_invoice->customer) && !empty($stripe_invoice->subscription) && ($stripe_invoice_total = number_format(c_ws_plugin__optimizemember_pro_stripe_utilities::cents_to_dollar_amount($stripe_invoice->total, $stripe_invoice->currency), 2, '.', '')) && is_object($stripe_subscription = c_ws_plugin__optimizemember_pro_stripe_utilities::get_customer_subscription($stripe_invoice->customer, $stripe_invoice->subscription)) && ($ipn_signup_vars = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(0, $stripe_subscription->id))) {
                         $processing = TRUE;
                         $stripe['optimizemember_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         if ($maybe_end_subscription = self::_maybe_end_subscription_after_payment($stripe_invoice->customer, $stripe_subscription)) {
                             $stripe['optimizemember_log'][] = $maybe_end_subscription;
                         }
                         $stripe['optimizemember_log'][] = 'Ignoring `' . $event->type . '`. optimizeMember does NOT respond to individual payment failures; only to subscription cancellations.';
                         $stripe['optimizemember_log'][] = 'You may control the behavior(s) associated w/ subscription payment failures from your Stripe Dashboard please.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'customer.deleted':
                     // Customer deletions.
                     if (!empty($event->data->object) && ($stripe_customer = $event->data->object) instanceof Stripe_Customer && ($ipn_signup_vars = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(0, $stripe_customer->id))) {
                         $processing = TRUE;
                         $ipn['txn_type'] = 'subscr_eot';
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['optimizemember_paypal_proxy'] = 'stripe';
                         $ipn['optimizemember_paypal_proxy_use'] = 'pro-emails';
                         $ipn['optimizemember_paypal_proxy_verification'] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__optimizemember_utils_urls::remote(site_url('/?optimizemember_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['optimizemember_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['optimizemember_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through optimizeMember\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['optimizemember_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'customer.subscription.deleted':
                     // Customer subscription deletion.
                     if (!empty($event->data->object) && ($stripe_subscription = $event->data->object) instanceof Stripe_Subscription && ($ipn_signup_vars = c_ws_plugin__optimizemember_utils_users::get_user_ipn_signup_vars(0, $stripe_subscription->id))) {
                         $processing = TRUE;
                         $ipn['txn_type'] = 'subscr_eot';
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['optimizemember_paypal_proxy'] = 'stripe';
                         $ipn['optimizemember_paypal_proxy_use'] = 'pro-emails';
                         $ipn['optimizemember_paypal_proxy_verification'] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__optimizemember_utils_urls::remote(site_url('/?optimizemember_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['optimizemember_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['optimizemember_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through optimizeMember\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['optimizemember_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
             }
             if (empty($processing)) {
                 $stripe['optimizemember_log'][] = 'Ignoring this Webhook/IPN. The event does NOT require any action on the part of OptimizeMember.';
             }
         } else {
             $stripe['optimizemember_log'][] = 'Unable to verify Webhook/IPN event ID. This is most likely related to an invalid Stripe configuration. Please check: optimizeMember -› Stripe Options.';
             $stripe['optimizemember_log'][] = 'If you\'re absolutely SURE that your Stripe configuration is valid, you may want to run some tests on your server, just to be sure \\$_POST variables (and php://input) are populated; and that your server is able to connect to Stripe over an HTTPS connection.';
             $stripe['optimizemember_log'][] = 'optimizeMember uses the Stripe SDK for remote connections; which relies upon the cURL extension for PHP. Please make sure that your installation of PHP has the cURL extension; and that it\'s configured together with OpenSSL for HTTPS communication.';
             $stripe['optimizemember_log'][] = var_export($_REQUEST, TRUE) . "\n" . var_export(json_decode(@file_get_contents('php://input')), TRUE);
         }
         $logt = c_ws_plugin__optimizemember_utilities::time_details();
         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
         $log4 = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n" . 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? 'stripe-ipn-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'stripe-ipn.log';
         if ($GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs']) {
             if (is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'])) {
                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . '/' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__optimizemember_utils_logs::conceal_private_info(var_export($stripe, TRUE)) . "\n\n", FILE_APPEND);
                 }
             }
         }
         status_header(200);
         // Send a 200 OK status header.
         header('Content-Type: text/plain; charset=UTF-8');
         // Content-Type text/plain with UTF-8.
         while (@ob_end_clean()) {
         }
         // Clean any existing output buffers.
         exit;
         // Exit now.
     }
 }
コード例 #27
0
 /**
  * Shortcode `[optimizeMember-Pro-Stripe-Form /]`.
  *
  * @package optimizeMember\Stripe
  * @since 140617
  *
  * @attaches-to ``add_shortcode('optimizeMember-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 = '')
 {
     $raw_content = $content;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__optimizemember_pro_before_sc_stripe_form', get_defined_vars());
     unset($__refs, $__v);
     // Ditch these temporary vars.
     c_ws_plugin__optimizemember_no_cache::no_cache_constants(TRUE);
     $attr = c_ws_plugin__optimizemember_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('optimizeMember-Pro-Stripe-Form ', 'optimizeMember-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.01', 'rp' => '1', 'rt' => 'M', 'rr' => '1', 'rrt' => '', 'modify' => '0', 'cancel' => '0', 'sp' => '0', 'register' => '0', 'update' => '0', '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['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__optimizemember_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.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__optimizemember_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__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
         $response = c_ws_plugin__optimizemember_pro_stripe_responses::stripe_cancellation_response($attr);
         $_p = $response['response'] && !$response['error'] ? array() : $_p;
         if ($attr['captcha']) {
             $captcha = '<div id="optimizemember-pro-stripe-cancellation-form-captcha-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-cancellation-form-section optimizemember-pro-stripe-form-captcha-section optimizemember-pro-stripe-cancellation-form-captcha-section">' . "\n";
             $captcha .= '<div id="optimizemember-pro-stripe-cancellation-form-captcha-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-cancellation-form-section-title optimizemember-pro-stripe-form-captcha-section-title optimizemember-pro-stripe-cancellation-form-captcha-section-title">' . "\n";
             $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
             $captcha .= '</div>' . "\n";
             $captcha .= '<div id="optimizemember-pro-stripe-cancellation-form-captcha-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-cancellation-form-div optimizemember-pro-stripe-form-captcha-div optimizemember-pro-stripe-cancellation-form-captcha-div">' . "\n";
             $captcha .= '<label id="optimizemember-pro-stripe-cancellation-form-captcha-label" class="optimizemember-pro-stripe-form-captcha-label optimizemember-pro-stripe-cancellation-form-captcha-label">' . "\n";
             $captcha .= c_ws_plugin__optimizemember_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="optimizemember_pro_stripe_cancellation[nonce]" id="optimizemember-pro-stripe-cancellation-nonce" value="' . esc_attr(wp_create_nonce('optimizemember-pro-stripe-cancellation')) . '" />';
         $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_cancellation[attr]" id="optimizemember-pro-stripe-cancellation-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
         $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
         $custom_template = file_exists(TEMPLATEPATH . '/stripe-cancellation-form.php') ? TEMPLATEPATH . '/stripe-cancellation-form.php' : FALSE;
         $custom_template = file_exists(TEMPLATEPATH . '/stripe-cancellation-form.html') ? TEMPLATEPATH . '/stripe-cancellation-form.html' : $custom_template;
         $custom_template = $attr['template'] && file_exists(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
         $custom_template = $attr['template'] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
         $code = preg_replace('/%%action%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
         $code = preg_replace('/%%response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($response['response']), $code);
         $code = preg_replace('/%%description%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($attr['desc']), $code);
         $code = preg_replace('/%%captcha%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($captcha), $code);
         $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($hidden_inputs), $code);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__optimizemember_pro_during_sc_stripe_cancellation_form', get_defined_vars());
         unset($__refs, $__v);
         // Ditch these temporary vars.
     } else {
         if ($attr['register']) {
             $_p = c_ws_plugin__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
             $response = c_ws_plugin__optimizemember_pro_stripe_responses::stripe_registration_response($attr);
             $_p = $response['response'] && !$response['error'] ? array() : $_p;
             $custom_fields = '';
             // Initialize custom fields.
             if ($GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_fields']) {
                 // Only display Custom Fields if configured.
                 if ($fields_applicable = c_ws_plugin__optimizemember_custom_reg_fields::custom_fields_configured_at_level($attr['level'], 'registration')) {
                     $tabindex = 99;
                     // Start tabindex at 99 ( +1 below = 100 ).
                     $custom_fields = '<div id="optimizemember-pro-stripe-registration-form-custom-fields-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-registration-form-section optimizemember-pro-stripe-form-custom-fields-section optimizemember-pro-stripe-registration-form-custom-fields-section">' . "\n";
                     $custom_fields .= '<div id="optimizemember-pro-stripe-registration-form-custom-fields-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-registration-form-section-title optimizemember-pro-stripe-form-custom-fields-section-title optimizemember-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__']['optimizemember']['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="optimizemember-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-divider-section" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-registration-form-div optimizemember-pro-stripe-form-custom-reg-field-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' optimizemember-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="optimizemember-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-registration-form-div optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-div optimizemember-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                             $custom_fields .= '<label for="optimizemember-pro-stripe-registration-custom-reg-field-' . esc_attr($field_id_class) . '" id="optimizemember-pro-stripe-registration-form-custom-reg-field-' . $field_id_class . '-label" class="optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-label optimizemember-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__optimizemember_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'optimizemember_pro_stripe_registration[custom_fields][', 'optimizemember-pro-stripe-registration-custom-reg-field-', 'optimizemember-pro-stripe-custom-reg-field-' . $field_id_class . ' optimizemember-pro-stripe-registration-custom-reg-field-' . $field_id_class, '', $tabindex = $tabindex + 1, '', $_p, @$_p['optimizemember_pro_stripe_registration']['custom_fields'][$field_var], 'registration');
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     $custom_fields .= '</div>' . "\n";
                 }
             }
             if ($attr['captcha']) {
                 $captcha = '<div id="optimizemember-pro-stripe-registration-form-captcha-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-registration-form-section optimizemember-pro-stripe-form-captcha-section optimizemember-pro-stripe-registration-form-captcha-section">' . "\n";
                 $captcha .= '<div id="optimizemember-pro-stripe-registration-form-captcha-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-registration-form-section-title optimizemember-pro-stripe-form-captcha-section-title optimizemember-pro-stripe-registration-form-captcha-section-title">' . "\n";
                 $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                 $captcha .= '</div>' . "\n";
                 $captcha .= '<div id="optimizemember-pro-stripe-registration-form-captcha-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-registration-form-div optimizemember-pro-stripe-form-captcha-div optimizemember-pro-stripe-registration-form-captcha-div">' . "\n";
                 $captcha .= '<label id="optimizemember-pro-stripe-registration-form-captcha-label" class="optimizemember-pro-stripe-form-captcha-label optimizemember-pro-stripe-registration-form-captcha-label">' . "\n";
                 $captcha .= c_ws_plugin__optimizemember_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__']['optimizemember']['o']['custom_reg_opt_in'] && c_ws_plugin__optimizemember_list_servers::list_servers_integrated()) {
                 $opt_in = '<div id="optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-registration-form-div optimizemember-pro-stripe-form-custom-reg-field-opt-in-div optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in-div">' . "\n";
                 $opt_in .= '<label for="optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in" id="optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in-label" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in-label optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in-label">' . "\n";
                 $opt_in .= '<input type="checkbox" name="optimizemember_pro_stripe_registration[custom_fields][opt_in]" id="optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in optimizemember-pro-stripe-registration-form-custom-reg-field-opt-in" value="1"' . (empty($_p) && $GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_opt_in'] == 1 || @$_p['optimizemember_pro_stripe_registration']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="300" />' . "\n";
                 $opt_in .= $GLOBALS['WS_PLUGIN__']['optimizemember']['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="optimizemember_pro_stripe_registration[nonce]" id="optimizemember-pro-stripe-registration-nonce" value="' . esc_attr(wp_create_nonce('optimizemember-pro-stripe-registration')) . '" />';
             $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_names'] ? '<input type="hidden" id="optimizemember-pro-stripe-registration-names-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_password'] ? '<input type="hidden" id="optimizemember-pro-stripe-registration-password-not-required-or-not-possible" value="1" />' : '';
             $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_registration[attr]" id="optimizemember-pro-stripe-registration-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
             $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
             $custom_template = file_exists(TEMPLATEPATH . '/stripe-registration-form.php') ? TEMPLATEPATH . '/stripe-registration-form.php' : FALSE;
             $custom_template = file_exists(TEMPLATEPATH . '/stripe-registration-form.html') ? TEMPLATEPATH . '/stripe-registration-form.html' : $custom_template;
             $custom_template = $attr['template'] && file_exists(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
             $custom_template = $attr['template'] && file_exists(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__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
             $code = preg_replace('/%%action%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
             $code = preg_replace('/%%response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($response['response']), $code);
             $code = preg_replace('/%%options%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($option_selections), $code);
             $code = preg_replace('/%%description%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($attr['desc']), $code);
             $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_registration']['first_name'])), $code);
             $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_registration']['last_name'])), $code);
             $code = preg_replace('/%%email_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_registration']['email'])), $code);
             $code = preg_replace('/%%username_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_registration']['username'])), $code);
             $code = preg_replace('/%%password1_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_registration']['password1'])), $code);
             $code = preg_replace('/%%password2_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_registration']['password2'])), $code);
             $code = preg_replace('/%%custom_fields%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($custom_fields), $code);
             $code = preg_replace('/%%captcha%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($captcha), $code);
             $code = preg_replace('/%%opt_in%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($opt_in), $code);
             $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($hidden_inputs), $code);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action('ws_plugin__optimizemember_pro_during_sc_stripe_registration_form', get_defined_vars());
             unset($__refs, $__v);
             // Ditch these temporary vars.
         } else {
             if ($attr['update']) {
                 $_p = c_ws_plugin__optimizemember_utils_strings::trim_deep(stripslashes_deep($_POST));
                 $response = c_ws_plugin__optimizemember_pro_stripe_responses::stripe_update_response($attr);
                 $_p = $response['response'] && !$response['error'] ? array() : $_p;
                 if ($attr['captcha']) {
                     $captcha = '<div id="optimizemember-pro-stripe-update-form-captcha-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-update-form-section optimizemember-pro-stripe-form-captcha-section optimizemember-pro-stripe-update-form-captcha-section">' . "\n";
                     $captcha .= '<div id="optimizemember-pro-stripe-update-form-captcha-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-update-form-section-title optimizemember-pro-stripe-form-captcha-section-title optimizemember-pro-stripe-update-form-captcha-section-title">' . "\n";
                     $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                     $captcha .= '</div>' . "\n";
                     $captcha .= '<div id="optimizemember-pro-stripe-update-form-captcha-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-update-form-div optimizemember-pro-stripe-form-captcha-div optimizemember-pro-stripe-update-form-captcha-div">' . "\n";
                     $captcha .= '<label id="optimizemember-pro-stripe-update-form-captcha-label" class="optimizemember-pro-stripe-form-captcha-label optimizemember-pro-stripe-update-form-captcha-label">' . "\n";
                     $captcha .= c_ws_plugin__optimizemember_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="optimizemember_pro_stripe_update[nonce]" id="optimizemember-pro-stripe-update-nonce" value="' . esc_attr(wp_create_nonce('optimizemember-pro-stripe-update')) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_update[card_token]" id="optimizemember-pro-stripe-update-card-token" value="' . esc_attr(@$_p['optimizemember_pro_stripe_update']['card_token']) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_update[card_token_summary]" id="optimizemember-pro-stripe-update-card-token-summary" value="' . esc_attr(@$_p['optimizemember_pro_stripe_update']['card_token_summary']) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_update[attr]" id="optimizemember-pro-stripe-update-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                 $hidden_inputs .= '<input type="hidden" name="s2p-option" value="' . esc_attr((string) @$_REQUEST['s2p-option']) . '" />';
                 $custom_template = file_exists(TEMPLATEPATH . '/stripe-update-form.php') ? TEMPLATEPATH . '/stripe-update-form.php' : FALSE;
                 $custom_template = file_exists(TEMPLATEPATH . '/stripe-update-form.html') ? TEMPLATEPATH . '/stripe-update-form.html' : $custom_template;
                 $custom_template = $attr['template'] && file_exists(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                 $custom_template = $attr['template'] && file_exists(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-update-form.php'));
                 $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                 $code = preg_replace('/%%action%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                 $code = preg_replace('/%%response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($response['response']), $code);
                 $code = preg_replace('/%%description%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($attr['desc']), $code);
                 $code = preg_replace('/%%card_token%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_update']['card_token'])), $code);
                 $code = preg_replace('/%%card_token_summary%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_update']['card_token_summary'])), $code);
                 $code = preg_replace('/%%captcha%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($captcha), $code);
                 $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($hidden_inputs), $code);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__optimizemember_pro_during_sc_stripe_update_form', get_defined_vars());
                 unset($__refs, $__v);
                 // Ditch these temporary vars.
             } else {
                 if ($attr['sp']) {
                     $_p = c_ws_plugin__optimizemember_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['optimizemember_pro_stripe_sp_checkout']['coupon']) ? $_p['optimizemember_pro_stripe_sp_checkout']['coupon'] : $attr['coupon'];
                     $response = c_ws_plugin__optimizemember_pro_stripe_responses::stripe_sp_checkout_response($attr);
                     $_p = $response['response'] && !$response['error'] ? array() : $_p;
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'USD' ? 'US' : '';
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'CAD' ? 'CA' : $country_default_by_currency;
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_sp_checkout']['country'] && $attr['cc'] === 'GBP' ? 'GB' : $country_default_by_currency;
                     $country_default_by_currency = apply_filters('ws_plugin__optimizemember_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['optimizemember_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="optimizemember-pro-stripe-sp-checkout-form-captcha-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-sp-checkout-form-section optimizemember-pro-stripe-form-captcha-section optimizemember-pro-stripe-sp-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="optimizemember-pro-stripe-sp-checkout-form-captcha-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-sp-checkout-form-section-title optimizemember-pro-stripe-form-captcha-section-title optimizemember-pro-stripe-sp-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="optimizemember-pro-stripe-sp-checkout-form-captcha-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-sp-checkout-form-div optimizemember-pro-stripe-form-captcha-div optimizemember-pro-stripe-sp-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="optimizemember-pro-stripe-sp-checkout-form-captcha-label" class="optimizemember-pro-stripe-form-captcha-label optimizemember-pro-stripe-sp-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__optimizemember_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__']['optimizemember']['o']['custom_reg_opt_in'] && c_ws_plugin__optimizemember_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-sp-checkout-form-div optimizemember-pro-stripe-form-custom-reg-field-opt-in-div optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" id="optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-label" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in-label optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="optimizemember_pro_stripe_sp_checkout[custom_fields][opt_in]" id="optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in optimizemember-pro-stripe-sp-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p) && $GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_opt_in'] == 1 || @$_p['optimizemember_pro_stripe_sp_checkout']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="400" />' . "\n";
                         $opt_in .= $GLOBALS['WS_PLUGIN__']['optimizemember']['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="optimizemember_pro_stripe_sp_checkout[nonce]" id="optimizemember-pro-stripe-sp-checkout-nonce" value="' . esc_attr(wp_create_nonce('optimizemember-pro-stripe-sp-checkout')) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_sp_checkout[card_token]" id="optimizemember-pro-stripe-sp-checkout-card-token" value="' . esc_attr(@$_p['optimizemember_pro_stripe_sp_checkout']['card_token']) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_sp_checkout[card_token_summary]" id="optimizemember-pro-stripe-sp-checkout-card-token-summary" value="' . esc_attr(@$_p['optimizemember_pro_stripe_sp_checkout']['card_token_summary']) . '" />';
                     $hidden_inputs .= !$attr['accept_coupons'] ? '<input type="hidden" id="optimizemember-pro-stripe-sp-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !c_ws_plugin__optimizemember_pro_stripe_utilities::tax_may_apply() ? '<input type="hidden" id="optimizemember-pro-stripe-sp-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= ($cp_attr = c_ws_plugin__optimizemember_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'])) && $cp_attr['ta'] <= 0.0 && $cp_attr['ra'] <= 0.0 ? '<input type="hidden" id="optimizemember-pro-stripe-sp-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_sp_checkout[attr]" id="optimizemember-pro-stripe-sp-checkout-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                     $custom_template = file_exists(TEMPLATEPATH . '/stripe-sp-checkout-form.php') ? TEMPLATEPATH . '/stripe-sp-checkout-form.php' : FALSE;
                     $custom_template = file_exists(TEMPLATEPATH . '/stripe-sp-checkout-form.html') ? TEMPLATEPATH . '/stripe-sp-checkout-form.html' : $custom_template;
                     $custom_template = $attr['template'] && file_exists(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && file_exists(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-sp-checkout-form.php'));
                     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                     $code = preg_replace('/%%action%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                     $code = preg_replace('/%%response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($response['response']), $code);
                     $code = preg_replace('/%%options%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($option_selections), $code);
                     $code = preg_replace('/%%description%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($attr['desc']), $code);
                     $code = preg_replace('/%%coupon_response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(c_ws_plugin__optimizemember_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'], 'response', array('affiliates-1px-response'))), $code);
                     $code = preg_replace('/%%coupon_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit($attr['coupon'])), $code);
                     $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_sp_checkout']['first_name'])), $code);
                     $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_sp_checkout']['last_name'])), $code);
                     $code = preg_replace('/%%email_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_sp_checkout']['email'])), $code);
                     $code = preg_replace('/%%card_token%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_sp_checkout']['card_token'])), $code);
                     $code = preg_replace('/%%card_token_summary%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_sp_checkout']['card_token_summary'])), $code);
                     $code = preg_replace('/%%state_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_sp_checkout']['state'])), $code);
                     $code = preg_replace('/%%country_options%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace('/%%zip_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_sp_checkout']['zip'])), $code);
                     $code = preg_replace('/%%captcha%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($captcha), $code);
                     $code = preg_replace('/%%opt_in%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($opt_in), $code);
                     $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($hidden_inputs), $code);
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__optimizemember_pro_during_sc_stripe_sp_form', get_defined_vars());
                     unset($__refs, $__v);
                     // Ditch these temporary vars.
                 } else {
                     $_p = c_ws_plugin__optimizemember_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['optimizemember_pro_stripe_checkout']['coupon']) ? $_p['optimizemember_pro_stripe_checkout']['coupon'] : $attr['coupon'];
                     $response = c_ws_plugin__optimizemember_pro_stripe_responses::stripe_checkout_response($attr);
                     $_p = $response['response'] && !$response['error'] ? array() : $_p;
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_checkout']['country'] && $attr['cc'] === 'USD' ? 'US' : '';
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_checkout']['country'] && $attr['cc'] === 'CAD' ? 'CA' : $country_default_by_currency;
                     $country_default_by_currency = !@$_p['optimizemember_pro_stripe_checkout']['country'] && $attr['cc'] === 'GBP' ? 'GB' : $country_default_by_currency;
                     $country_default_by_currency = apply_filters('ws_plugin__optimizemember_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['optimizemember_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__']['optimizemember']['o']['custom_reg_fields']) {
                         // Only display Custom Fields if configured.
                         if ($fields_applicable = c_ws_plugin__optimizemember_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="optimizemember-pro-stripe-checkout-form-custom-fields-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-checkout-form-section optimizemember-pro-stripe-form-custom-fields-section optimizemember-pro-stripe-checkout-form-custom-fields-section">' . "\n";
                             $custom_fields .= '<div id="optimizemember-pro-stripe-checkout-form-custom-fields-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-checkout-form-section-title optimizemember-pro-stripe-form-custom-fields-section-title optimizemember-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__']['optimizemember']['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="optimizemember-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-divider-section" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-checkout-form-div optimizemember-pro-stripe-form-custom-reg-field-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . ' optimizemember-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="optimizemember-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-checkout-form-div optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-div optimizemember-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-div">' . "\n";
                                     $custom_fields .= '<label for="optimizemember-pro-stripe-checkout-custom-reg-field-' . esc_attr($field_id_class) . '" id="optimizemember-pro-stripe-checkout-form-custom-reg-field-' . $field_id_class . '-label" class="optimizemember-pro-stripe-form-custom-reg-field-' . $field_id_class . '-label optimizemember-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__optimizemember_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'optimizemember_pro_stripe_checkout[custom_fields][', 'optimizemember-pro-stripe-checkout-custom-reg-field-', 'optimizemember-pro-stripe-custom-reg-field-' . $field_id_class . ' optimizemember-pro-stripe-checkout-custom-reg-field-' . $field_id_class, '', $tabindex = $tabindex + 1, '', $_p, @$_p['optimizemember_pro_stripe_checkout']['custom_fields'][$field_var], 'registration');
                                     $custom_fields .= '</div>' . "\n";
                                 }
                             }
                             $custom_fields .= '</div>' . "\n";
                         }
                     }
                     if ($attr['captcha']) {
                         $captcha = '<div id="optimizemember-pro-stripe-checkout-form-captcha-section" class="optimizemember-pro-stripe-form-section optimizemember-pro-stripe-checkout-form-section optimizemember-pro-stripe-form-captcha-section optimizemember-pro-stripe-checkout-form-captcha-section">' . "\n";
                         $captcha .= '<div id="optimizemember-pro-stripe-checkout-form-captcha-section-title" class="optimizemember-pro-stripe-form-section-title optimizemember-pro-stripe-checkout-form-section-title optimizemember-pro-stripe-form-captcha-section-title optimizemember-pro-stripe-checkout-form-captcha-section-title">' . "\n";
                         $captcha .= _x('Security Code', 's2member-front', 's2member') . "\n";
                         $captcha .= '</div>' . "\n";
                         $captcha .= '<div id="optimizemember-pro-stripe-checkout-form-captcha-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-checkout-form-div optimizemember-pro-stripe-form-captcha-div optimizemember-pro-stripe-checkout-form-captcha-div">' . "\n";
                         $captcha .= '<label id="optimizemember-pro-stripe-checkout-form-captcha-label" class="optimizemember-pro-stripe-form-captcha-label optimizemember-pro-stripe-checkout-form-captcha-label">' . "\n";
                         $captcha .= c_ws_plugin__optimizemember_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__']['optimizemember']['o']['custom_reg_opt_in'] && c_ws_plugin__optimizemember_list_servers::list_servers_integrated()) {
                         $opt_in = '<div id="optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in-div" class="optimizemember-pro-stripe-form-div optimizemember-pro-stripe-checkout-form-div optimizemember-pro-stripe-form-custom-reg-field-opt-in-div optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in-div">' . "\n";
                         $opt_in .= '<label for="optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in" id="optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in-label" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in-label optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in-label">' . "\n";
                         $opt_in .= '<input type="checkbox" name="optimizemember_pro_stripe_checkout[custom_fields][opt_in]" id="optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in" class="optimizemember-pro-stripe-form-custom-reg-field-opt-in optimizemember-pro-stripe-checkout-form-custom-reg-field-opt-in" value="1"' . (empty($_p) && $GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_opt_in'] == 1 || @$_p['optimizemember_pro_stripe_checkout']['custom_fields']['opt_in'] ? ' checked="checked"' : '') . ' tabindex="500" />' . "\n";
                         $opt_in .= $GLOBALS['WS_PLUGIN__']['optimizemember']['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="optimizemember_pro_stripe_checkout[nonce]" id="optimizemember-pro-stripe-checkout-nonce" value="' . esc_attr(wp_create_nonce('optimizemember-pro-stripe-checkout')) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_checkout[card_token]" id="optimizemember-pro-stripe-checkout-card-token" value="' . esc_attr(@$_p['optimizemember_pro_stripe_checkout']['card_token']) . '" />';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_checkout[card_token_summary]" id="optimizemember-pro-stripe-checkout-card-token-summary" value="' . esc_attr(@$_p['optimizemember_pro_stripe_checkout']['card_token_summary']) . '" />';
                     $hidden_inputs .= !$attr['accept_coupons'] ? '<input type="hidden" id="optimizemember-pro-stripe-checkout-coupons-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['custom_reg_password'] ? '<input type="hidden" id="optimizemember-pro-stripe-checkout-password-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= !c_ws_plugin__optimizemember_pro_stripe_utilities::tax_may_apply() ? '<input type="hidden" id="optimizemember-pro-stripe-checkout-tax-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= ($cp_attr = c_ws_plugin__optimizemember_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'])) && $cp_attr['ta'] <= 0.0 && $cp_attr['ra'] <= 0.0 ? '<input type="hidden" id="optimizemember-pro-stripe-checkout-payment-not-required-or-not-possible" value="1" />' : '';
                     $hidden_inputs .= '<input type="hidden" name="optimizemember_pro_stripe_checkout[attr]" id="optimizemember-pro-stripe-checkout-attr" value="' . esc_attr(c_ws_plugin__optimizemember_utils_encryption::encrypt(serialize($attr))) . '" />';
                     $custom_template = file_exists(TEMPLATEPATH . '/stripe-checkout-form.php') ? TEMPLATEPATH . '/stripe-checkout-form.php' : FALSE;
                     $custom_template = file_exists(TEMPLATEPATH . '/stripe-checkout-form.html') ? TEMPLATEPATH . '/stripe-checkout-form.html' : $custom_template;
                     $custom_template = $attr['template'] && file_exists(TEMPLATEPATH . '/' . $attr['template']) ? TEMPLATEPATH . '/' . $attr['template'] : $custom_template;
                     $custom_template = $attr['template'] && file_exists(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-checkout-form.php'));
                     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__optimizemember_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__optimizemember_utilities::evl($code) : $code);
                     $code = preg_replace('/%%action%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr($_SERVER['REQUEST_URI'])), $code);
                     $code = preg_replace('/%%response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($response['response']), $code);
                     $code = preg_replace('/%%options%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($option_selections), $code);
                     $code = preg_replace('/%%description%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($attr['desc']), $code);
                     $code = preg_replace('/%%coupon_response%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(c_ws_plugin__optimizemember_pro_stripe_utilities::apply_coupon($attr, $attr['coupon'], 'response', array('affiliates-1px-response'))), $code);
                     $code = preg_replace('/%%coupon_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit($attr['coupon'])), $code);
                     $code = preg_replace('/%%first_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_checkout']['first_name'])), $code);
                     $code = preg_replace('/%%last_name_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_attr(@$_p['optimizemember_pro_stripe_checkout']['last_name'])), $code);
                     $code = preg_replace('/%%email_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['email'])), $code);
                     $code = preg_replace('/%%username_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['username'])), $code);
                     $code = preg_replace('/%%password1_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['password1'])), $code);
                     $code = preg_replace('/%%password2_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['password2'])), $code);
                     $code = preg_replace('/%%custom_fields%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($custom_fields), $code);
                     $code = preg_replace('/%%card_token%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_checkout']['card_token'])), $code);
                     $code = preg_replace('/%%card_token_summary%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(esc_html(@$_p['optimizemember_pro_stripe_checkout']['card_token_summary'])), $code);
                     $code = preg_replace('/%%state_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['state'])), $code);
                     $code = preg_replace('/%%country_options%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($country_options), $code);
                     $code = preg_replace('/%%zip_value%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs(format_to_edit(@$_p['optimizemember_pro_stripe_checkout']['zip'])), $code);
                     $code = preg_replace('/%%captcha%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($captcha), $code);
                     $code = preg_replace('/%%opt_in%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($opt_in), $code);
                     $code = preg_replace('/%%hidden_inputs%%/', c_ws_plugin__optimizemember_utils_strings::esc_refs($hidden_inputs), $code);
                     if (!empty($raw_content)) {
                         $code = preg_replace('/%%submit_button%%/', $raw_content, $code);
                     } else {
                         $button_code = '<button style="padding:15px;" type="submit" id="optimizemember-pro-stripe-checkout-submit" class="optimizemember-pro-stripe-submit optimizemember-pro-stripe-checkout-submit btn btn-primary" tabindex="600">' . esc_html(_x("Submit Form", "s2member-front", "s2member")) . '</button>';
                         $code = preg_replace('/%%submit_button%%/', $button_code, $code);
                     }
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     $attr['modify'] ? do_action('ws_plugin__optimizemember_pro_during_sc_stripe_modification_form', get_defined_vars()) : do_action('ws_plugin__optimizemember_pro_during_sc_stripe_form', get_defined_vars());
                     unset($__refs, $__v);
                     // Ditch these temporary vars.
                 }
             }
         }
     }
     return apply_filters('ws_plugin__optimizemember_pro_sc_stripe_form', $code, get_defined_vars());
 }
コード例 #28
0
 /**
  * Handles ClickBank® IPN URL processing.
  *
  * @package optimizeMember\ClickBank
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after handling the Notification.
  */
 public static function clickbank_notify()
 {
     global $current_site, $current_blog;
     if (!empty($_GET["optimizemember_pro_clickbank_notify"]) && $GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_clickbank_username"]) {
         @ignore_user_abort(true);
         // Continue processing even if/when connection is broken by the sender.
         if (is_array($clickbank = c_ws_plugin__optimizemember_pro_clickbank_utilities::clickbank_postvars()) && ($_clickbank = $clickbank)) {
             $clickbank["optimizemember_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
             $clickbank["optimizemember_log"][] = "optimizeMember POST vars verified with ClickBank®.";
             $s2vars = c_ws_plugin__optimizemember_pro_clickbank_utilities::clickbank_parse_s2vars($clickbank["cvendthru"], $clickbank["ctransaction"]);
             if (isset($s2vars["s2_p1"], $s2vars["s2_p3"]) && $s2vars["s2_p1"] === "0 D") {
                 $s2vars["s2_p1"] = $s2vars["s2_p3"];
             }
             $clickbank["s2vars"] = $s2vars;
             if (strcasecmp($clickbank["ccustfirstname"] . " " . $clickbank["ccustlastname"], $clickbank["ccustfullname"]) !== 0 && preg_match("/(?:[^ ]+)(?: +)(?:[^ ]+)/", $clickbank["ccustfullname"])) {
                 list($clickbank["ccustfirstname"], $clickbank["ccustlastname"]) = preg_split("/ +/", $clickbank["ccustfullname"], 2);
             }
             if (preg_match("/^(?:TEST_)?SALE\$/i", $clickbank["ctransaction"]) && preg_match("/^STANDARD\$/i", $clickbank["cprodtype"])) {
                 $clickbank["optimizemember_log"][] = "ClickBank® transaction identified as ( `SALE/STANDARD` ).";
                 $clickbank["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal® processor as `txn_type` ( `web_accept` ).";
                 $clickbank["optimizemember_log"][] = "Please check PayPal® IPN logs for further processing details.";
                 $processing = $processed = true;
                 $ipn = array();
                 // Reset.
                 $ipn["txn_type"] = "web_accept";
                 $ipn["txn_id"] = $clickbank["ctransreceipt"];
                 $ipn["custom"] = $s2vars["s2_custom"];
                 $ipn["mc_gross"] = number_format($clickbank["corderamount"] / 100, 2, ".", "");
                 $ipn["mc_currency"] = strtoupper($clickbank["ccurrency"]);
                 $ipn["tax"] = number_format("0.00", 2, ".", "");
                 $ipn["payer_email"] = $clickbank["ccustemail"];
                 $ipn["first_name"] = ucwords(strtolower($clickbank["ccustfirstname"]));
                 $ipn["last_name"] = ucwords(strtolower($clickbank["ccustlastname"]));
                 $ipn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
                 $ipn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
                 $ipn["option_name2"] = "Customer IP Address";
                 $ipn["option_selection2"] = $s2vars["s2_customer_ip"];
                 $ipn["item_number"] = $s2vars["s2_invoice"];
                 $ipn["item_name"] = $s2vars["s2_desc"];
                 $ipn["optimizemember_paypal_proxy"] = "clickbank";
                 $ipn["optimizemember_paypal_proxy_use"] = "standard-emails";
                 $ipn["optimizemember_paypal_proxy_verification"] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                 c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1"), $ipn, array("timeout" => 20));
             } else {
                 if (preg_match("/^(?:TEST_)?SALE\$/i", $clickbank["ctransaction"]) && preg_match("/^RECURRING\$/i", $clickbank["cprodtype"])) {
                     $clickbank["optimizemember_log"][] = "ClickBank® transaction identified as ( `SALE/RECURRING` ).";
                     $clickbank["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal® processor as `txn_type` ( `subscr_signup` ).";
                     $clickbank["optimizemember_log"][] = "Please check PayPal® IPN logs for further processing details.";
                     $processing = $processed = true;
                     $ipn = array();
                     // Reset.
                     $ipn["txn_type"] = "subscr_signup";
                     $ipn["subscr_id"] = $s2vars["s2_subscr_id"];
                     $ipn["recurring"] = $clickbank["cfuturepayments"] > 1 ? "1" : "0";
                     $ipn["txn_id"] = $clickbank["ctransreceipt"];
                     $ipn["custom"] = $s2vars["s2_custom"];
                     $ipn["period1"] = $s2vars["s2_p1"];
                     $ipn["period3"] = $s2vars["s2_p3"];
                     $ipn["mc_amount1"] = number_format($clickbank["corderamount"] / 100, 2, ".", "");
                     $ipn["mc_amount3"] = number_format($clickbank["crebillamnt"] / 100, 2, ".", "");
                     $ipn["mc_gross"] = preg_match("/^[1-9]/", $ipn["period1"]) ? $ipn["mc_amount1"] : $ipn["mc_amount3"];
                     $ipn["mc_currency"] = strtoupper($clickbank["ccurrency"]);
                     $ipn["tax"] = number_format("0.00", 2, ".", "");
                     $ipn["payer_email"] = $clickbank["ccustemail"];
                     $ipn["first_name"] = ucwords(strtolower($clickbank["ccustfirstname"]));
                     $ipn["last_name"] = ucwords(strtolower($clickbank["ccustlastname"]));
                     $ipn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
                     $ipn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
                     $ipn["option_name2"] = "Customer IP Address";
                     $ipn["option_selection2"] = $s2vars["s2_customer_ip"];
                     $ipn["item_number"] = $s2vars["s2_invoice"];
                     $ipn["item_name"] = $s2vars["s2_desc"];
                     $ipn["optimizemember_paypal_proxy"] = "clickbank";
                     $ipn["optimizemember_paypal_proxy_use"] = "standard-emails";
                     $ipn["optimizemember_paypal_proxy_use"] .= $ipn["mc_gross"] > 0 ? ",subscr-signup-as-subscr-payment" : "";
                     $ipn["optimizemember_paypal_proxy_verification"] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                     c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1"), $ipn, array("timeout" => 20));
                 } else {
                     if (preg_match("/^(?:TEST_)?BILL\$/i", $clickbank["ctransaction"]) && preg_match("/^RECURRING\$/i", $clickbank["cprodtype"])) {
                         $clickbank["optimizemember_log"][] = "ClickBank® transaction identified as ( `BILL/RECURRING` ).";
                         $clickbank["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal® processor as `txn_type` ( `subscr_payment` ).";
                         $clickbank["optimizemember_log"][] = "Please check PayPal® IPN logs for further processing details.";
                         $processing = $processed = true;
                         $ipn = array();
                         // Reset.
                         $ipn["txn_type"] = "subscr_payment";
                         $ipn["subscr_id"] = $s2vars["s2_subscr_id"];
                         $ipn["txn_id"] = $clickbank["ctransreceipt"];
                         $ipn["custom"] = $s2vars["s2_custom"];
                         $ipn["mc_gross"] = number_format($clickbank["corderamount"] / 100, 2, ".", "");
                         $ipn["mc_currency"] = strtoupper($clickbank["ccurrency"]);
                         $ipn["tax"] = number_format("0.00", 2, ".", "");
                         $ipn["payer_email"] = $clickbank["ccustemail"];
                         $ipn["first_name"] = ucwords(strtolower($clickbank["ccustfirstname"]));
                         $ipn["last_name"] = ucwords(strtolower($clickbank["ccustlastname"]));
                         $ipn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
                         $ipn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
                         $ipn["option_name2"] = "Customer IP Address";
                         $ipn["option_selection2"] = $s2vars["s2_customer_ip"];
                         $ipn["item_number"] = $s2vars["s2_invoice"];
                         $ipn["item_name"] = $s2vars["s2_desc"];
                         $ipn["optimizemember_paypal_proxy"] = "clickbank";
                         $ipn["optimizemember_paypal_proxy_use"] = "standard-emails";
                         $ipn["optimizemember_paypal_proxy_verification"] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1"), $ipn, array("timeout" => 20));
                     } else {
                         if (preg_match("/^(?:TEST_)?(?:RFND|CGBK|INSF)\$/i", $clickbank["ctransaction"])) {
                             $clickbank["optimizemember_log"][] = "ClickBank® transaction identified as ( `RFND|CGBK|INSF` ).";
                             $clickbank["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal® processor as `payment_status` ( `refunded|reversed` ).";
                             $clickbank["optimizemember_log"][] = "Please check PayPal® IPN logs for further processing details.";
                             $processing = $processed = true;
                             $ipn = array();
                             // Reset.
                             $ipn["payment_status"] = preg_match("/^(?:TEST_)?RFND\$/", $clickbank["ctransaction"]) ? "refunded" : "reversed";
                             $ipn["parent_txn_id"] = preg_match("/^RECURRING\$/i", $clickbank["cprodtype"]) && $s2vars["s2_subscr_id"] ? $s2vars["s2_subscr_id"] : $clickbank["ctransreceipt"];
                             $ipn["custom"] = $s2vars["s2_custom"];
                             $ipn["mc_fee"] = "-" . number_format("0.00", 2, ".", "");
                             $ipn["mc_gross"] = "-" . number_format(abs($clickbank["corderamount"]) / 100, 2, ".", "");
                             $ipn["mc_currency"] = strtoupper($clickbank["ccurrency"]);
                             $ipn["tax"] = "-" . number_format("0.00", 2, ".", "");
                             $ipn["payer_email"] = $clickbank["ccustemail"];
                             $ipn["first_name"] = ucwords(strtolower($clickbank["ccustfirstname"]));
                             $ipn["last_name"] = ucwords(strtolower($clickbank["ccustlastname"]));
                             $ipn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
                             $ipn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
                             $ipn["option_name2"] = "Customer IP Address";
                             $ipn["option_selection2"] = $s2vars["s2_customer_ip"];
                             $ipn["item_number"] = $s2vars["s2_invoice"];
                             $ipn["item_name"] = $s2vars["s2_desc"];
                             $ipn["optimizemember_paypal_proxy"] = "clickbank";
                             $ipn["optimizemember_paypal_proxy_use"] = "standard-emails";
                             $ipn["optimizemember_paypal_proxy_verification"] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                             c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1"), $ipn, array("timeout" => 20));
                         }
                     }
                 }
             }
             if (preg_match("/^(?:TEST_)?(?:SALE|BILL)\$/i", $clickbank["ctransaction"]) && preg_match("/^RECURRING\$/i", $clickbank["cprodtype"]) && (preg_match("/^COMPLETED\$/i", $clickbank["crebillstatus"]) || $clickbank["cfuturepayments"] <= 0) || preg_match("/^(?:TEST_)?CANCEL-REBILL\$/i", $clickbank["ctransaction"]) && preg_match("/^RECURRING\$/i", $clickbank["cprodtype"])) {
                 $clickbank["optimizemember_log"][] = "ClickBank® transaction identified as ( `RECURRING/COMPLETED` or `CANCEL-REBILL` ).";
                 $clickbank["optimizemember_log"][] = "IPN reformulated. Piping through optimizeMember's core/standard PayPal® processor as `txn_type` ( `subscr_cancel` ).";
                 $clickbank["optimizemember_log"][] = "Please check PayPal® IPN logs for further processing details.";
                 $processing = $processed = true;
                 $ipn = array();
                 // Reset.
                 $ipn["txn_type"] = "subscr_cancel";
                 $ipn["subscr_id"] = $s2vars["s2_subscr_id"];
                 $ipn["custom"] = $s2vars["s2_custom"];
                 $ipn["period1"] = $s2vars["s2_p1"];
                 $ipn["period3"] = $s2vars["s2_p3"];
                 $ipn["payer_email"] = $clickbank["ccustemail"];
                 $ipn["first_name"] = ucwords(strtolower($clickbank["ccustfirstname"]));
                 $ipn["last_name"] = ucwords(strtolower($clickbank["ccustlastname"]));
                 $ipn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
                 $ipn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
                 $ipn["option_name2"] = "Customer IP Address";
                 $ipn["option_selection2"] = $s2vars["s2_customer_ip"];
                 $ipn["item_number"] = $s2vars["s2_invoice"];
                 $ipn["item_name"] = $s2vars["s2_desc"];
                 $ipn["optimizemember_paypal_proxy"] = "clickbank";
                 $ipn["optimizemember_paypal_proxy_use"] = "standard-emails";
                 $ipn["optimizemember_paypal_proxy_verification"] = c_ws_plugin__optimizemember_paypal_utilities::paypal_proxy_key_gen();
                 c_ws_plugin__optimizemember_utils_urls::remote(site_url("/?optimizemember_paypal_notify=1"), $ipn, array("timeout" => 20));
             }
             if (!$processed) {
                 // If nothing was processed, here we add a message to the logs indicating the IPN was ignored.
                 $clickbank["optimizemember_log"][] = "Ignoring this IPN request. The transaction does NOT require any action on the part of optimizeMember.";
             }
         } else {
             $clickbank["optimizemember_log"][] = "Unable to verify POST vars. This is most likely related to an invalid ClickBank® configuration. Please check: optimizeMember -› ClickBank® Options.";
             $clickbank["optimizemember_log"][] = "If you're absolutely SURE that your ClickBank® configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to ClickBank® over an HTTPS connection.";
             $clickbank["optimizemember_log"][] = "optimizeMember uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows® server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows® server.";
             $clickbank["optimizemember_log"][] = var_export($_REQUEST, true);
             // Recording _POST + _GET vars for analysis and debugging.
         }
         /*
         If debugging/logging is enabled; we need to append $clickbank to the log file.
         	Logging now supports Multisite Networking as well.
         */
         $logt = c_ws_plugin__optimizemember_utilities::time_details();
         $logv = c_ws_plugin__optimizemember_utilities::ver_details();
         $logm = c_ws_plugin__optimizemember_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "clickbank-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "clickbank-ipn.log";
         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["gateway_debug_logs"]) {
             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["optimizemember"]["c"]["logs_dir"])) {
                 if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . "/" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__optimizemember_utils_logs::conceal_private_info(var_export($clickbank, true)) . "\n\n", FILE_APPEND);
                 }
             }
         }
         status_header(200);
         // Send a 200 OK status header.
         header("Content-Type: text/plain; charset=UTF-8");
         // Content-Type text/plain with UTF-8.
         while (@ob_end_clean()) {
         }
         // Clean any existing output buffers.
         exit;
         // Exit now.
     }
 }
コード例 #29
0
ファイル: sc-files-in.inc.php プロジェクト: JalpMi/v2contact
 /**
  * Handles the Shortcode for: `[opmStream /]`.
  *
  * @package optimizeMember\opmFile
  * @since 130119
  *
  * @attaches-to ``add_shortcode("opmStream");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str HTML markup that produces an audio/video stream for a specific player.
  */
 public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_sc_get_stream", get_defined_vars());
     unset($__refs, $__v);
     /**/
     $attr = c_ws_plugin__optimizemember_utils_strings::trim_qts_deep((array) $attr);
     /**/
     $attr = shortcode_atts(array("download" => "", "download_key" => "", "stream" => "yes", "inline" => "yes", "storage" => "", "remote" => "", "ssl" => "", "rewrite" => "yes", "rewrite_base" => "", "skip_confirmation" => "", "url_to_storage_source" => "yes", "count_against_user" => "yes", "check_user" => "yes", "file_download" => "", "player" => "jwplayer-v6-rtmp", "player_id" => "s2-stream-" . md5(uniqid("", TRUE)), "player_path" => "/jwplayer/jwplayer.js", "player_key" => "", "player_image" => "", "player_title" => "", "player_controls" => "yes", "player_height" => "270", "player_skin" => "", "player_stretching" => "uniform", "player_width" => "480", "player_autostart" => "no", "player_fallback" => "yes", "player_mute" => "no", "player_primary" => "flash", "player_repeat" => "no", "player_startparam" => "", "player_option_blocks" => ""), $attr);
     $attr["download"] = !empty($attr["file_download"]) ? $attr["file_download"] : $attr["download"];
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_sc_get_stream_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     /**/
     foreach ($attr as $key => $value) {
         if (strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base"))) {
             $config["file_" . $key] = $value;
         } else {
             if (strlen($value) && !in_array($key, array("file_download", "player")) && strpos($key, "player_") !== 0) {
                 $config[$key] = $value;
             }
         }
     }
     /**/
     unset($key, $value);
     /**/
     if (!empty($config) && isset($config["file_download"])) {
         $_get = c_ws_plugin__optimizemember_files::create_file_download_url($config, TRUE);
         /**/
         if (is_array($_get) && !empty($_get) && $attr["player"] && file_exists(dirname(dirname(__FILE__)) . "/templates/players/" . $attr["player"] . ".php") && $attr["player_id"] && $attr["player_path"]) {
             if (strpos($attr["player"], "jwplayer-v6") === 0) {
                 $get = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/players/" . $attr["player"] . ".php")));
                 /**/
                 $get = preg_replace("/%%streamer%%/", $_get["streamer"], $get);
                 $get = preg_replace("/%%prefix%%/", $_get["prefix"], $get);
                 $get = preg_replace("/%%file%%/", $_get["file"], $get);
                 $get = preg_replace("/%%url%%/", $_get["url"], $get);
                 /**/
                 $get = preg_replace("/%%player_id%%/", $attr["player_id"], $get);
                 $get = preg_replace("/%%player_path%%/", $attr["player_path"], $get);
                 $get = preg_replace("/%%player_key%%/", $attr["player_key"], $get);
                 /**/
                 $get = preg_replace("/%%player_image%%/", $attr["player_image"], $get);
                 $get = preg_replace("/%%player_title%%/", $attr["player_title"], $get);
                 /**/
                 $get = preg_replace("/%%player_controls%%/", filter_var($attr["player_controls"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_height%%/", (int) $attr["player_height"], $get);
                 $get = preg_replace("/%%player_skin%%/", $attr["player_skin"], $get);
                 $get = preg_replace("/%%player_stretching%%/", $attr["player_stretching"], $get);
                 $get = preg_replace("/%%player_width%%/", (int) $attr["player_width"], $get);
                 /**/
                 $get = preg_replace("/%%player_autostart%%/", filter_var($attr["player_autostart"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_fallback%%/", filter_var($attr["player_fallback"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_mute%%/", filter_var($attr["player_mute"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_primary%%/", $attr["player_primary"], $get);
                 $get = preg_replace("/%%player_repeat%%/", filter_var($attr["player_repeat"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_startparam%%/", $attr["player_startparam"], $get);
                 /**/
                 $get = preg_replace("/%%player_option_blocks%%/", strpos($attr["player_option_blocks"], ":") !== false ? $attr["player_option_blocks"] : base64_decode($attr["player_option_blocks"]), $get);
             }
         }
     }
     return apply_filters("ws_plugin__optimizemember_sc_get_stream", isset($get) ? $get : null, get_defined_vars());
 }
コード例 #30
0
 /**
  * Shortcode `[optimizeMember-Pro-Google-Button /]`.
  *
  * @package optimizeMember\Google
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("optimizeMember-Pro-Google-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 Google Button Code, HTML markup.
  */
 public static function sc_google_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     c_ws_plugin__optimizemember_no_cache::no_cache_constants(true);
     /**/
     $attr = c_ws_plugin__optimizemember_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" => "0.01", "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["rr"] = strtoupper($attr["rr"]);
     $attr["ccaps"] = strtolower($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"];
     /**/
     if ($attr["modify"] || $attr["cancel"]) {
         $default_image = $GLOBALS["WS_PLUGIN__"]["optimizemember_pro"]["c"]["dir_url"] . "/images/google-edit-button.png";
         /**/
         $code = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember_pro"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(site_url())), $code);
         /**/
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_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__optimizemember_utils_urls::n_amps($href);
         }
         /**/
         unset($href, $url, $m);
     } else {
         if ($attr["sp"]) {
             $default_image = "https://checkout.google.com/buttons/checkout.gif?merchant_id=" . urlencode($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_google_merchant_id"]) . "&amp;w=180&amp;h=46&amp;style=trans&amp;variant=text&amp;loc=" . urlencode(_x("en_US", "s2member-front google-button-lang-code", "s2member"));
             /**/
             $code = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember_pro"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(site_url())), $code);
             /**/
             foreach ($attr as $key => $val) {
                 $code = preg_replace("/%%" . preg_quote($key, "/") . "%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(urlencode($val)), $code);
             }
             /**/
             if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__optimizemember_utils_urls::n_amps($m[1]))) {
                 $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(c_ws_plugin__optimizemember_utils_urls::add_optimizemember_sig($url))) . '"', $code);
             }
             /**/
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_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__optimizemember_utils_urls::n_amps($href);
             }
             /**/
             unset($href, $url, $m);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = "https://checkout.google.com/buttons/checkout.gif?merchant_id=" . urlencode($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_google_merchant_id"]) . "&amp;w=180&amp;h=46&amp;style=trans&amp;variant=text&amp;loc=" . urlencode(_x("en_US", "s2member-front google-button-lang-code", "s2member"));
                 /**/
                 $code = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 /**/
                 foreach ($attr as $key => $val) {
                     $code = preg_replace("/%%" . preg_quote($key, "/") . "%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(urlencode($val)), $code);
                 }
                 /**/
                 if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__optimizemember_utils_urls::n_amps($m[1]))) {
                     $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(c_ws_plugin__optimizemember_utils_urls::add_optimizemember_sig($url))) . '"', $code);
                 }
                 /**/
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_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__optimizemember_utils_urls::n_amps($href);
                 }
                 /**/
                 unset($href, $url, $m);
             } else {
                 $default_image = "https://checkout.google.com/buttons/checkout.gif?merchant_id=" . urlencode($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["pro_google_merchant_id"]) . "&amp;w=180&amp;h=46&amp;style=trans&amp;variant=text&amp;loc=" . urlencode(_x("en_US", "s2member-front google-button-lang-code", "s2member"));
                 /**/
                 $code = trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-checkout-button.php")));
                 /*
                  * Custom button
                  */
                 if (!empty($content)) {
                     $code = preg_replace('/%%button_markup%%/', $content, $code);
                     $code = preg_replace('/%%url%%/', '%%wpurl%%/?optimizemember_pro_google_co=1&amp;co[level]=%%level%%&amp;co[ccaps]=%%ccaps%%&amp;co[desc]=%%desc%%&amp;co[cc]=%%cc%%&amp;co[custom]=%%custom%%&amp;co[ta]=%%ta%%&amp;co[tp]=%%tp%%&amp;co[tt]=%%tt%%&amp;co[ra]=%%ra%%&amp;co[rp]=%%rp%%&amp;co[rt]=%%rt%%&amp;co[rr]=%%rr%%&amp;co[image]=%%image%%&amp;co[output]=%%output%%', $code);
                 } else {
                     $code = preg_replace("/%%button_markup%%/", '<a href="%%wpurl%%/?optimizemember_pro_google_co=1&amp;co[level]=%%level%%&amp;co[ccaps]=%%ccaps%%&amp;co[desc]=%%desc%%&amp;co[cc]=%%cc%%&amp;co[custom]=%%custom%%&amp;co[ta]=%%ta%%&amp;co[tp]=%%tp%%&amp;co[tt]=%%tt%%&amp;co[ra]=%%ra%%&amp;co[rp]=%%rp%%&amp;co[rt]=%%rt%%&amp;co[rr]=%%rr%%&amp;co[image]=%%image%%&amp;co[output]=%%output%%"><img src="https://checkout.google.com/buttons/checkout.gif?w=180&amp;h=46&amp;style=trans&amp;variant=text&amp;loc=' . urlencode(_x("en_US", "s2member-front google-button-lang-code", "s2member")) . '" style="width:auto; height:auto; border:0;" alt="Google" /></a>', $code);
                 }
                 $code = preg_replace("/%%images%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($GLOBALS["WS_PLUGIN__"]["optimizemember_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(site_url())), $code);
                 /**/
                 foreach ($attr as $key => $val) {
                     $code = preg_replace("/%%" . preg_quote($key, "/") . "%%/", c_ws_plugin__optimizemember_utils_strings::esc_ds(urlencode($val)), $code);
                 }
                 /**/
                 if (preg_match('/ href\\="(.*?)"/', $code, $m) && ($url = c_ws_plugin__optimizemember_utils_urls::n_amps($m[1]))) {
                     $code = preg_replace('/ href\\=".*?"/', ' href="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr(c_ws_plugin__optimizemember_utils_urls::add_optimizemember_sig($url))) . '"', $code);
                 }
                 /*
                  * Only when there is no custom button
                  */
                 if (empty($content)) {
                     $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__optimizemember_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__optimizemember_utils_urls::n_amps($href);
                 }
                 /**/
                 unset($href, $url, $m);
             }
         }
     }
     /**/
     $code = preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', $code);
     return $code;
 }