本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::esc_refs方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::esc_refs方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::esc_refs怎么用?PHP c_ws_plugin__s2member_utils_strings::esc_refs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::esc_refs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: op_replace
/**
* Handles s2Member option Replacement Codes.
*
* @package s2Member\Utilities
* @since 110815
*
* @param array $ops An array of s2Member options, or an option value array.
* @param bool $fill Optional. If true, Replacement Codes are filled, else false.
*
* @return mixed The end result, after handling Replacement Codes.
*/
public static function op_replace($ops = array(), $fill = FALSE)
{
global $current_site, $current_blog;
// Multisite.
if (is_array($ops) && !empty($ops)) {
foreach ($ops as &$op) {
if (is_array($op) && !empty($op)) {
// Array?
$op = c_ws_plugin__s2member_pro_utils_ops::op_replace($op, $fill);
} else {
if (is_string($op) && !$fill) {
$op = is_multisite() ? preg_replace('/' . preg_quote(rtrim($current_site->domain . $current_site->path, '/') . '/', '/') . '/', '%%_op__current_site_domain_path/%%', $op) : $op;
$op = is_multisite() ? preg_replace('/' . preg_quote(rtrim($current_site->domain . $current_site->path, '/'), '/') . '/', '%%_op__current_site_domain_path%%', $op) : $op;
$op = is_multisite() ? preg_replace('/' . preg_quote(rtrim($current_blog->domain . $current_blog->path, '/') . '/', '/') . '/', '%%_op__current_blog_domain_path/%%', $op) : $op;
$op = is_multisite() ? preg_replace('/' . preg_quote(rtrim($current_blog->domain . $current_blog->path, '/'), '/') . '/', '%%_op__current_blog_domain_path%%', $op) : $op;
$op = preg_replace('/' . preg_quote(rtrim(site_url(), '/'), '/') . '/', '%%_op__site_url%%', preg_replace('/' . preg_quote(rtrim(site_url(), '/') . '/', '/') . '/', '%%_op__site_url/%%', $op));
$op = preg_replace('/' . preg_quote(rtrim(home_url(), '/'), '/') . '/', '%%_op__home_url%%', preg_replace('/' . preg_quote(rtrim(home_url(), '/') . '/', '/') . '/', '%%_op__home_url/%%', $op));
$op = preg_replace('/' . preg_quote($_SERVER['HTTP_HOST'], '/') . '/i', '%%_op__domain%%', get_bloginfo('name') ? preg_replace('/' . preg_quote(get_bloginfo('name'), '/') . '/', '%%_op__blog_name%%', $op) : $op);
} else {
if (is_string($op) && $fill) {
$op = is_multisite() ? preg_replace('/%%_op__current_site_domain_path\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim($current_site->domain . $current_site->path, '/') . '/'), $op) : preg_replace('/%%_op__current_site_domain_path\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/') . '/'), $op);
$op = is_multisite() ? preg_replace('/%%_op__current_site_domain_path%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim($current_site->domain . $current_site->path, '/')), $op) : preg_replace('/%%_op__current_site_domain_path%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/')), $op);
$op = is_multisite() ? preg_replace('/%%_op__current_blog_domain_path\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim($current_blog->domain . $current_blog->path, '/') . '/'), $op) : preg_replace('/%%_op__current_blog_domain_path\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/') . '/'), $op);
$op = is_multisite() ? preg_replace('/%%_op__current_blog_domain_path%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim($current_blog->domain . $current_blog->path, '/')), $op) : preg_replace('/%%_op__current_blog_domain_path%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/')), $op);
$op = preg_replace('/%%_op__site_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(site_url(), '/')), preg_replace('/%%_op__site_url\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(site_url(), '/') . '/'), $op));
$op = preg_replace('/%%_op__home_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/')), preg_replace('/%%_op__home_url\\/%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(rtrim(home_url(), '/') . '/'), $op));
$op = preg_replace('/%%_op__domain%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($_SERVER['HTTP_HOST']), preg_replace('/%%_op__blog_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(get_bloginfo('name')), $op));
}
}
}
}
}
return $ops;
// Now return the $ops.
}
示例2: return_template
/**
* Handles Return templates w/ response message.
*
* @package s2Member\Return_Templates
* @since 110720
*
* @param string $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
* @param string $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
* @param string $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
* @param string $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ('/', 'http')``.
*
* @return string The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
*/
public static function return_template($template = '', $response = '', $continue_html = '', $continue_link = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_return_template', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$template = $template ? $template : 'default';
$continue_link = $continue_link ? $continue_link : home_url('/', 'http');
$continue_html = $continue_html ? $continue_html : _x('Continue', 's2member-front', 's2member');
$response = $response ? $response : _x('Thank you. Please click the link below.', 's2member-front', 's2member');
$custom_template = is_file(TEMPLATEPATH . '/' . $template . '-return.php') ? TEMPLATEPATH . '/' . $template . '-return.php' : '';
$custom_template = is_file(get_stylesheet_directory() . '/' . $template . '-return.php') ? get_stylesheet_directory() . '/' . $template . '-return.php' : $custom_template;
$custom_template = is_file(WP_CONTENT_DIR . '/' . $template . '-return.php') ? WP_CONTENT_DIR . '/' . $template . '-return.php' : $custom_template;
$custom_template = !$custom_template && is_file(TEMPLATEPATH . '/default-return.php') ? TEMPLATEPATH . '/default-return.php' : $custom_template;
$custom_template = !$custom_template && is_file(get_stylesheet_directory() . '/default-return.php') ? get_stylesheet_directory() . '/default-return.php' : $custom_template;
$custom_template = !$custom_template && is_file(WP_CONTENT_DIR . '/default-return.php') ? WP_CONTENT_DIR . '/default-return.php' : $custom_template;
$specific_template = $custom_template ? $custom_template : (is_file($_default_specific_template = dirname(dirname(__FILE__)) . '/templates/returns/' . $template . '-return.php') ? $_default_specific_template : '');
$code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . '/templates/returns/default-return.php')));
$code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo('name'), 'ws_plugin__s2member_during_return_template_head_' . ($specific_template ? basename($specific_template) : 'default-return.php'));
$code = preg_replace('/%%doctype_html_head%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_doctype_html_head', $doctype_html_head, get_defined_vars())), $code);
$code = preg_replace('/%%header%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_header', sprintf(_x('[ %s ] <strong><em>says…</em></strong>', 's2member-front', 's2member'), esc_html($_SERVER['HTTP_HOST'])), get_defined_vars())), $code);
$code = preg_replace('/%%response%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_response', $response, get_defined_vars())), $code);
$code = preg_replace('/%%continue%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_continue', '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
$code = preg_replace('/%%support%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_support', sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', 's2member-front', 's2member'), esc_attr($GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_support_link'])), get_defined_vars())), $code);
$code = preg_replace('/%%tracking%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_tracking', c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
return apply_filters('ws_plugin__s2member_return_template', $code, get_defined_vars());
}
示例3: sc_paypal_button_encryption
/**
* Handles PayPal Button encryption.
*
* This uses the PayPal API. s2Member will NOT attempt to encrypt Buttons until there is at least a Business Email Address and API Username configured.
* s2Member also maintains a log of communication with the PayPal API. If logging is enabled, check: `/wp-content/plugins/s2member-logs/paypal-api.log`.
*
* @package s2Member\PayPal
* @since 3.5
*
* @param string $code The PayPal Button Code before encryption.
* @param array $vars An array of defined variables in the scope of the calling Filter.
* @return string The Resulting PayPal Button Code *(possibly encrypted, depending on configuration)*.
*/
public static function sc_paypal_button_encryption($code = FALSE, $vars = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_paypal_button_encryption", get_defined_vars());
unset($__refs, $__v);
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) {
$cache = apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache", true, get_defined_vars());
$_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__s2member_utilities::ver_checksum())) && ($cache = get_transient($transient))) {
$code = $cache;
} else {
if (is_array($inputs = c_ws_plugin__s2member_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__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"]) && !empty($paypal["WEBSITECODE"]) && ($code = $paypal["WEBSITECODE"])) {
$default_image = "https://www.paypal.com/" . ($attr["lang"] ? $attr["lang"] : _x("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
$code = preg_replace("/\\<img[^\\>]+\\>/i", "", $code);
// Remove 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__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
$code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
$cache && $transient ? set_transient($transient, $code, apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache_exp_time", 3600, get_defined_vars())) : null;
// Caching?
}
}
}
}
// No WordPress Filters apply here.
// Instead, use: `ws_plugin__s2member_sc_paypal_button`.
return $code;
// Button Code. Possibly w/ API encryption now.
}
示例4: sc_ccbill_button
/**
* Shortcode `[s2Member-Pro-ccBill-Button /]`.
*
* @package s2Member\ccBill
* @since 1.5
*
* @attaches-to ``add_shortcode("s2Member-Pro-ccBill-Button");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return string The resulting ccBill Button Code, HTML markup.
*/
public static function sc_ccbill_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
c_ws_plugin__s2member_no_cache::no_cache_constants(true);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
$attr = shortcode_atts(array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "2.95", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "sub_account" => "", "form" => "", "output" => "anchor"), $attr);
$attr["tt"] = strtoupper($attr["tt"]);
$attr["rt"] = strtoupper($attr["rt"]);
$attr["ccaps"] = strtolower($attr["ccaps"]);
$attr["ccaps"] = str_replace(" ", "", $attr["ccaps"]);
$attr["rr"] = $attr["rt"] === "L" ? "0" : $attr["rr"];
$attr["rr"] = $attr["level"] === "*" ? "0" : $attr["rr"];
if ($attr["rr"] && ($attr["ta"] <= 0 || $attr["tp"] <= 0 || !$attr["tt"])) {
eval('$attr["ta"] = $attr["ra"]; $attr["tp"] = $attr["rp"]; $attr["tt"] = $attr["rt"];');
}
if ($attr["modify"] || $attr["cancel"]) {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-edit-button.png";
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-cancellation-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? $code : $code;
if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
$code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
}
unset($href, $url, $m);
} else {
if ($attr["sp"]) {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
$attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"];
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-sp-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => round($attr["exp"] / 24), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_desc" => $attr["desc"], "s2_invoice" => $attr["sp_ids_exp"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
$vars["s2_referencing"] = $referencing;
}
$code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? $code : $code;
$code = $attr["output"] === "url" ? $url : $code;
unset($href, $url, $m);
} else {
if ($attr["level"] === "*") {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
$attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
$attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-ccaps-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
$vars["s2_referencing"] = $referencing;
}
$code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? $code : $code;
$code = $attr["output"] === "url" ? $url : $code;
unset($href, $url, $m);
} else {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/ccbill-button.png";
$attr["desc"] = !$attr["desc"] ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
$attr["level_ccaps_eotper"] = !$attr["rr"] && $attr["rt"] !== "L" ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
$attr["level_ccaps_eotper"] = rtrim($attr["level_ccaps_eotper"], ":");
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/ccbill-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
if (!$attr["rr"]) {
$vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ra"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_p1" => "0 D", "s2_p3" => $attr["rp"] . " " . $attr["rt"], "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
} else {
// Otherwise, we need to include both an Initial and Regular/Recurring period. This will ALWAYS recur.
$vars = array("clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $attr["sub_account"] ? $attr["sub_account"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "formName" => $attr["form"] ? $attr["form"] : $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"], "formPrice" => $attr["ta"], "formPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["tp"], $attr["tt"]), "formRecurringPrice" => $attr["ra"], "formRecurringPeriod" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_per_term_2_days($attr["rp"], $attr["rt"]), "formRebills" => "99", "currencyCode" => c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_numr($attr["cc"]), "s2_p1" => $attr["tp"] . " " . $attr["tt"], "s2_p3" => $attr["rp"] . " " . $attr["rt"], "s2_desc" => $attr["desc"], "s2_invoice" => $attr["level_ccaps_eotper"], "s2_custom" => $attr["custom"], "s2_customer_ip" => $_SERVER["REMOTE_ADDR"]);
}
if ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id()) {
$vars["s2_referencing"] = $referencing;
}
$code = preg_replace("/%%url%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($url = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_link_gen($vars))), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? $code : $code;
$code = $attr["output"] === "url" ? $url : $code;
unset($href, $url, $m);
}
}
}
return $code;
}
示例5: cp
//.........这里部分代码省略.........
update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
update_user_option($user_id, 's2member_custom', $paypal['custom']);
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
}
if (!empty($ipn_signup_vars)) {
// We should have these from the routines above.
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
}
delete_user_option($user_id, 's2member_file_download_access_log');
if ((preg_match('/^web_accept$/i', $paypal['txn_type']) || $paypal['initial'] <= 0 && $paypal['regular'] <= 0) && $paypal['eotper']) {
// Don't update this in the return routine. Leave this for the IPN routine.
// EOT Times might be extended, and we don't want the IPN routine to extend an already-extended EOT Time.
$eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time('', '', '', $paypal['eotper'], '', get_user_option('s2member_auto_eot_time', $user_id));
$paypal['s2member_log'][] = 'Automatic EOT (End Of Term) Time will be set to: ' . date('D M j, Y g:i:s a T', $eot_time) . '.';
} else {
// Otherwise, we need to clear the Auto-EOT Time.
delete_user_option($user_id, 's2member_auto_eot_time');
}
$pr_times = get_user_option('s2member_paid_registration_times', $user_id);
$pr_times['level'] = !$pr_times['level'] ? time() : $pr_times['level'];
// Preserve existing.
$pr_times['level' . $paypal['level']] = !$pr_times['level' . $paypal['level']] ? time() : $pr_times['level' . $paypal['level']];
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\\:/');
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\\. ID @ time of demotion\\:/');
$paypal['s2member_log'][] = 's2Member Level/Capabilities updated w/ advanced update routines.';
setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['subscr_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.';
if ($processing && $tracking_properties && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code))) {
if (($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code))) {
if (($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
// Custom Registration/Profile Fields.
if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
break;
}
}
}
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_modification_tracking_codes_' . $paypal['subscr_id']), $code, 43200);
}
}
}
}
}
}
}
示例6: fill_login_redirect_rc_vars
/**
* Fills Replacement Codes in Special Redirection URLs.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @param string $url A URL with possible Replacement Codes in it.
* @param object $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
*
* @return string|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
*/
public static function fill_login_redirect_rc_vars($url = '', $user = NULL, $root_returns_false = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_fill_login_redirect_rc_vars', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$url = (string) $url;
// Force ``$url`` to a string value.
$orig_url = $url;
// Record the original URL that was passed in.
$user = (is_object($user) || is_object($user = wp_get_current_user())) && !empty($user->ID) ? $user : NULL;
$user_id = $user ? (string) $user->ID : '';
$user_login = $user ? (string) strtolower($user->user_login) : '';
$user_nicename = $user ? (string) strtolower($user->user_nicename) : '';
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode('-', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option('s2member_login_counter', $user_id) : '-1';
$url = preg_replace('/%%current_user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_login)), $url);
$url = preg_replace('/%%current_user_nicename%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_nicename)), $url);
$url = preg_replace('/%%current_user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url);
$url = preg_replace('/%%current_user_level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_level)), $url);
$url = preg_replace('/%%current_user_role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_role)), $url);
$url = preg_replace('/%%current_user_ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_ccaps)), $url);
$url = preg_replace('/%%current_user_logins%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_logins)), $url);
if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, FALSE)) || !empty($parse['path']) && strpos($parse['path'], '//') !== FALSE)) {
$url = home_url('/');
}
// Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e., with `//` ).
if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
// Used by s2Member's security gate.
$url = FALSE;
}
// In case we need to return false on root URLs (i.e., don't protect the Home Page inadvertently).
return apply_filters('ws_plugin__s2member_fill_login_redirect_rc_vars', $url, get_defined_vars());
}
示例7: __construct
//.........这里部分代码省略.........
echo '<p><strong>A very simple way to drip content; via the <a href="http://www.s2member.com/kb/s2drip-shortcode/" target="_blank" rel="external"><code>[s2Drip]</code></a> Shortcode:</strong></p>' . "\n";
if (!c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
echo '<p><em><strong class="ws-menu-page-hilite">NOTE: the use of <code>[s2Drip]</code> requires s2Member Pro.</strong></em></p>' . "\n";
}
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/s2drip-example1.x-php")) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>To drip content using <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>:</strong></p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/current-user-paid-registration-days-dripping.x-php")) . '</p>' . "\n";
echo '<p><em>There are more examples on this page, under the sub-section "s2Member PHP/API Constants". You\'ll see that s2Member provides you with access to several PHP/API Constants, which will assist you in dripping content. Some of the most relevant API Constants include: <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</code>; and there are many others.</em></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h3>Very Advanced Content Dripping (some PHP required)</h3>' . "\n";
echo '<p>If you plan on dripping content in VERY advanced ways, you can tap into s2Member\'s recorded history of all Paid Registration Times. (i.e. <code>' . esc_html('<?php $time = s2member_paid_registration_time("level1"); ?>') . '</code>) will give you a timestamp at which a Member first paid for Level#1 access. If they\'ve never paid for Level#1 access, the function will return 0. s2Member keeps a recorded history of timestamps associated with each Level that a Member gains access to, throughout the lifetime of their account.</p>' . "\n";
echo '<p><strong>Here is the function documentation for PHP/WordPress developers:</strong></p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/s2member-paid-registration-time.x-php")) . '</p>' . "\n";
echo '<p><strong>Here are some actual examples that should give you some ideas:</strong></p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/s2member-paid-registration-time-examples.x-php")) . '</p>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_after_api_advanced_dripping", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_scripting_page_during_left_sections_display_profile_modifications", !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site(), get_defined_vars())) {
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_before_profile_modifications", get_defined_vars());
echo '<div class="ws-menu-page-group" title="Member Profile Modifications">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-profile-modifications-section">' . "\n";
echo '<h3>Giving Members The Ability To Modify Their Profile</h3>' . "\n";
echo '<p>s2Member can be configured to redirect Members away from the <a href="' . esc_attr(admin_url("/profile.php")) . '" target="_blank" rel="external">default Profile Editing Panel</a> that is built into WordPress. When/if a Member attempts to access the default Profile Editing Panel, they\'ll instead, be redirected to the Login Welcome Page that you\'ve configured through s2Member. <strong>Why would I redirect?</strong> Unless you\'ve made some drastic modifications to your WordPress installation, the default Profile Editing Panel that ships with WordPress, is NOT really suited for public access, even by a Member. See: <code>s2Member -› General Options -› Profile Modifications</code>.</p>' . "\n";
echo '<p>So instead of using this default Profile Editing Panel; s2Member creates an added layer of functionality, on top of WordPress. It does this by providing you (as the site owner), with a special Shortcode: <code>[s2Member-Profile /]</code> that you can place into your Login Welcome Page, or any Post/Page for that matter (even into a Text Widget). This Shortcode produces an Inline Profile Editing Form that supports all aspects of s2Member, including Password changes; and any Custom Registration/Profile Fields that you\'ve configured with s2Member.</p>' . "\n";
echo '<p>Alternatively, s2Member also gives you the ability to send your Members to a <a href="' . esc_attr(site_url("/?s2member_profile=1")) . '" target="_blank" rel="external">special Stand-Alone version</a>. This Stand-Alone version has been designed (with a bare-bones format), intentionally. This makes it possible for you to <a href="#" onclick="if(!window.open(\'' . site_url("/?s2member_profile=1") . '\', \'_popup\', \'width=600,height=400,left=100,screenX=100,top=100,screenY=100,location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1\')) alert(\'Please disable popup blockers and try again!\'); return false;" rel="external">open it up in a popup window</a>, or embed it into your Login Welcome Page using an IFRAME. Code samples are provided below.</p>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_during_profile_modifications", get_defined_vars());
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>Shortcode:</strong> for an Inline Profile Modification Form:<br />' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit('[s2Member-Profile /]') . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> (standard link tag):</p>' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit(preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_refs(site_url("/?s2member_profile=1")), file_get_contents(dirname(__FILE__) . "/code-samples/current-user-profile-modification-page-url-1-ops.x-php"))) . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> (open the link in a popup window):</p>' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit(preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_refs(site_url("/?s2member_profile=1")), file_get_contents(dirname(__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.x-php"))) . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> (embed the Form with an IFRAME tag):</p>' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit(preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_refs(site_url("/?s2member_profile=1")), file_get_contents(dirname(__FILE__) . "/code-samples/current-user-profile-modification-page-url-3-ops.x-php"))) . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_after_profile_modifications", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_scripting_page_during_left_sections_display_api_constants", true, get_defined_vars())) {
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_before_api_constants", get_defined_vars());
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
echo '<div class="ws-menu-page-group" title="s2Get / s2Member API Constants">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-api-constants-section">' . "\n";
echo '<h3>Using s2Get w/ s2Member API Constants</h3>' . "\n";
echo '<p>A Constant, is an identifier (a name) for a simple value. Below is a comprehensive list that includes all of the defined Constants available to you. We recommend using some of these Constants in the creation of your Login Welcome Page; which is described in the s2Member General Options Panel. These are NOT required, but you can get pretty creative with your Login Welcome Page if you know how to use the <code>[s2Get constant="" /]</code> Shortcode for WordPress.</p>' . "\n";
echo '<p>For example, you might use <code>[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]</code> to display the type of Membership a Customer has.</em></p>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_during_api_constants_farm", get_defined_vars());
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>S2MEMBER_VERSION</strong><br />This will always be a (string) with the current s2Member version. Available since s2Member 3.0. Dated versions began with s2Member v110604.</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>S2MEMBER_CURRENT_USER_LOGIN_COUNTER</strong><br />This will always be (int) <code>-1</code> or higher <em>(representing the number of times a User/Member has logged into your site)</em>. <code>-1</code> if no User is logged in. <code>0</code> if the current User has NEVER logged in.</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN</strong><br />This will always be (bool) true or false. True if a User/Member is currently logged in with an Access Level >= 0.</p>' . "\n";
echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER</strong><br />This will always be (bool) true or false. True if a Member is currently logged in with an Access Level >= 1.</p>' . "\n";
echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</strong><br />This will always be (int) <code>-1</code> thru <code>4</code> <em>(or, up to the total number Membership Levels you\'ve configured)</em>. <code>-1</code> if not logged in. <code>0</code> if logged in as a Free Subscriber.</p>' . "\n";
echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
echo '<p>* A Member with Level 4 access, will also be able to access Levels 0, 1, 2 & 3.<br />* A Member with Level 3 access, will also be able to access Levels 0, 1 & 2.<br />* A Member with Level 2 access, will also be able to access Levels 0 & 1.<br />* A Member with Level 1 access, will also be able to access Level 0.<br />* A Subscriber with Level 0 access, will ONLY be able to access Level 0.<br />* A public Visitor will have NO access to protected content.</p>' . "\n";
echo '<p><em>* WordPress Subscribers are at Membership Level 0. If you\'re allowing Open Registration, Subscribers will be at Level 0 (a Free Subscriber). WordPress Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
示例8: __construct
//.........这里部分代码省略.........
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_membership_options_page", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_gen_ops_page_during_left_sections_display_profile_modifications", TRUE, get_defined_vars())) {
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_before_profile_modifications", get_defined_vars());
echo '<div class="ws-menu-page-group" title="Member Profile Modifications">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-profile-modifications-section">' . "\n";
echo '<h3>Giving Members The Ability To Modify Their Profile</h3>' . "\n";
echo '<p>s2Member can be configured to redirect Members away from the <a href="' . esc_attr(admin_url("/profile.php")) . '" target="_blank" rel="external">default Profile Editing Panel</a> that is built into WordPress. When/if a Member attempts to access the default Profile Editing Panel, they\'ll instead, be redirected to the Login Welcome Page that you\'ve configured through s2Member. <strong>Why would I redirect?</strong> Unless you\'ve made some drastic modifications to your WordPress installation, the default Profile Editing Panel that ships with WordPress, is NOT really suited for public access, even by a Member.</p>' . "\n";
echo '<p>So instead of using this default Profile Editing Panel; s2Member creates an added layer of functionality, on top of WordPress. It does this by providing you <em>(as the site owner)</em>, with a special Shortcode: <code>[s2Member-Profile /]</code> that you can place into your Login Welcome Page, or any Post/Page for that matter <em>(even into a Text Widget)</em>. This Shortcode produces an Inline Profile Editing Form that supports all aspects of s2Member, including Password changes; and any Custom Registration/Profile Fields that you\'ve configured with s2Member.</p>' . "\n";
echo '<p>Alternatively, s2Member also gives you the ability to send your Members to a <a href="' . esc_attr(site_url("/?s2member_profile=1")) . '" target="_blank" rel="external">special Stand-Alone version</a>. This Stand-Alone version has been designed <em>(with a bare-bones format)</em>, intentionally. This makes it possible for you to <a href="#" onclick="if(!window.open(\'' . site_url("/?s2member_profile=1") . '\', \'_popup\', \'width=600,height=400,left=100,screenX=100,top=100,screenY=100,location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1\')) alert(\'Please disable popup blockers and try again!\'); return false;" rel="external">open it up in a popup window</a>, or embed it into your Login Welcome Page using an IFRAME. Code samples are provided below.</p>' . "\n";
echo c_ws_plugin__s2member_utils_conds::bp_is_installed() ? '<p><em><strong>BuddyPress:</strong> BuddyPress already provides Users/Members with a Profile Editing Panel, powered by your theme. If you\'ve configured Custom Registration/Profile Fields with s2Member, you can also enable s2Member\'s Profile Field integration with BuddyPress (recommended). For further details, see: <code>s2Member -› General Options -› Registration/Profile Fields</code>.</em></p>' . "\n" : '';
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_during_profile_modifications", get_defined_vars());
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<th>' . "\n";
echo '<label for="ws-plugin--s2member-force-admin-lockouts">' . "\n";
echo 'Redirect Members away from the Default Profile Panel?' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<select name="ws_plugin__s2member_force_admin_lockouts" id="ws-plugin--s2member-force-admin-lockouts">' . "\n";
echo '<option value="0"' . (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"] ? ' selected="selected"' : '') . '>No (I want to use the WordPress default methodologies)</option>' . "\n";
echo '<option value="1"' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"] ? ' selected="selected"' : '') . '>Yes (redirect to Login Welcome Page; locking all /wp-admin/ areas)</option>' . "\n";
echo '</select><br />' . "\n";
echo 'Recommended setting (<code>Yes</code>). <em><strong>*Note*</strong> When this is set to (<code>Yes</code>), s2Member will take an initiative to further safeguard ALL <code>/wp-admin/</code> areas of your installation; not just the Default Profile Panel.</em>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>Shortcode (copy/paste)</strong>, for an Inline Profile Modification Form:<br />' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit('[s2Member-Profile /]') . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '<p style="margin-top:20px;"><strong>Stand-Alone (copy/paste)</strong>, for popup window:</p>' . "\n";
echo '<p><input type="text" autocomplete="off" value="' . format_to_edit(preg_replace("/\\<\\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \\?\\>/", c_ws_plugin__s2member_utils_strings::esc_refs(site_url("/?s2member_profile=1")), file_get_contents(dirname(__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.x-php"))) . '" class="monospace" onclick="this.select ();" /></p>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_profile_modifications", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_gen_ops_page_during_left_sections_display_url_shortening", TRUE, get_defined_vars())) {
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_before_url_shortening", get_defined_vars());
echo '<div class="ws-menu-page-group" title="URL Shortening Service Preference">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-url-shortening-section">' . "\n";
echo '<h3>URL Shortening Service API (Preference)</h3>' . "\n";
echo '<p>In a few special cases, long URLs generated by s2Member, containing encrypted authentication details, will be shortened; using one of the URL Shortening APIs <em>(listed below)</em>. A shortened URL prevents issues with VERY long links becoming corrupted by a Customer\'s email application. For instance, the Signup Confirmation Email that s2Member sends out to a new paying Customer, may contain a link which is shortened to prevent corruption by email applications. By default, s2Member uses the tinyURL API, which has proven itself to be the most reliable. However, in cases where an API service call fails, s2Member will automatically use one or more of its other APIs as a backup. The option below, allows you to configure which URL Shortening API s2Member should try first <em>(i.e. the one you prefer)</em>.</p>' . "\n";
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_during_url_shortening", get_defined_vars());
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<th>' . "\n";
echo '<label for="ws-plugin--s2member-default-url-shortener">' . "\n";
echo 'URL Shortening Service API (Preference):' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<select name="ws_plugin__s2member_default_url_shortener" id="ws-plugin--s2member-default-url-shortener">' . "\n";
echo '<option value="tiny_url"' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"] === "tiny_url" ? ' selected="selected"' : '') . '>tinyurl.com (free tinyURL API service)</option>' . "\n";
echo '<option value="goo_gl"' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"] === "goo_gl" ? ' selected="selected"' : '') . '>goo.gl (free Google URL Shortening API service)</option>' . "\n";
echo '</select>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<th>' . "\n";
echo '<label for="ws-plugin--s2member-default-custom-str-url-shortener">' . "\n";
echo 'Custom URL Shortening Service API (Optional/Advanced):' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_default_custom_str_url_shortener" id="ws-plugin--s2member-default-custom-str-url-shortener" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"]) . '" /><br />' . "\n";
echo 'Your own custom URL <code>(i.e. GET request)</code>, with <code>%%s2_long_url%%</code> Replacement Code. [ <a href="#" onclick="alert(\'s2Member makes it possible for advanced site owners to use a custom URL shortening service they prefer, over the ones currently pre-integrated with s2Member. In order for this to work, your URL shortening service MUST support basic GET requests through its API (sometimes referred to as a REST or NVP API). In addition, your URL shortening service MUST be capable of returning a simple URL in the response that s2Member receives, as a result of s2Member processing the GET request you formulate. See example below.\\n\\nBitly example GET request with format=txt:\\nhttp://api.bitly.com/v3/shorten?login=demo&apiKey=2d71bf07&format=txt&longUrl=%%s2_long_url%%\\n(s2Member expects a shortened URL in the response from Bitly)\\n\\n* If you configure s2Member to use your own custom URL shortening service, s2Member will try your configuration first, and if anything fails, it will fall back on its own pre-integrated backups. When configuring your URL for the GET request, s2Member makes two Replacement Codes available:\\n\\n%%s2_long_url%% = The full URL that needs to be shortened (raw URL-encoded).\\n%%s2_long_url_md5%% = An MD5 hash of the full URL (might be useful in some APIs).\\n\\n* If you have any trouble getting your URL shortening service integrated with s2Member in this way, you might take a look at this WordPress Filter ( `ws_plugin__s2member_url_shorten` ), which s2Member makes available for advanced circumstances. Search s2Member\\\'s source code for `ws_plugin__s2member_url_shorten`.\'); return false;" tabindex="-1">click for details</a> ]<br />' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_url_shortening", get_defined_vars());
}
do_action("ws_plugin__s2member_during_gen_ops_page_after_left_sections", get_defined_vars());
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p class="submit"><input type="submit" value="Save All Changes" /></p>' . "\n";
echo '</form>' . "\n";
echo '</td>' . "\n";
echo '<td class="ws-menu-page-table-r">' . "\n";
c_ws_plugin__s2member_menu_pages_rs::display();
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
}
示例9: auto_eot_system
/**
* Processed by WP_Cron; this handles Auto-EOTs *(EOT = End Of Term)*.
*
* If you have a HUGE userbase, increase the max EOTs per process.
* But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
* To increase, use: ``add_filter ('ws_plugin__s2member_auto_eot_system_per_process');``.
*
* This function makes an important Hook available: `ws_plugin__s2member_after_auto_eot_system`.
* This Hook is used by some of s2Member Pro's Gateway integrations; allowing CRON processing
* to run for important communications; which poll Payment Gateway APIs for possible EOTs.
*
* @package s2Member\Auto_EOT_System
* @since 3.5
*
* @param int $per_process Number of database records to process each time.
* Can also be Filtered with `ws_plugin__s2member_auto_eot_system_per_process`.
*
* @return null
*/
public static function auto_eot_system($per_process = 6)
{
global $wpdb;
/** @var $wpdb \wpdb */
global $current_site, $current_blog;
include_once ABSPATH . 'wp-admin/includes/admin.php';
@set_time_limit(0);
// Make time for processing a larger userbase.
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_auto_eot_system', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled']) {
$per_process = apply_filters('ws_plugin__s2member_auto_eot_system_per_process', $per_process, get_defined_vars());
if (is_array($eots = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . esc_sql(strtotime("now")) . "' LIMIT " . $per_process))) {
foreach ($eots as $eot) {
if (($user_id = $eot->ID) && is_object($user = new WP_User($user_id)) && $user->ID) {
$auto_eot_time = get_user_option('s2member_auto_eot_time', $user_id);
delete_user_option($user_id, 's2member_last_auto_eot_time');
delete_user_option($user_id, 's2member_auto_eot_time');
if (!$user->has_cap('administrator')) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_eot_behavior'] === 'demote') {
$eot_del_type = 'auto-eot-cancellation-expiration-demotion';
// Set EOT/Del type.
$custom = get_user_option('s2member_custom', $user_id);
$subscr_gateway = get_user_option('s2member_subscr_gateway', $user_id);
$subscr_id = get_user_option('s2member_subscr_id', $user_id);
$subscr_baid = get_user_option('s2member_subscr_baid', $user_id);
$subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
$fields = get_user_option('s2member_custom_fields', $user_id);
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
$ipn_signup_vars = get_user_option('s2member_ipn_signup_vars', $user_id);
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role('subscriber');
$existing_role = c_ws_plugin__s2member_user_access::user_access_role($user);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_auto_eot_system_during_before_demote', get_defined_vars());
do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), $eot_del_type, 'modification', $demotion_role);
do_action('ws_plugin__s2member_during_collective_eots', $user_id, get_defined_vars(), $eot_del_type, 'modification');
unset($__refs, $__v);
// Housekeeping.
if ($existing_role !== $demotion_role) {
$user->set_role($demotion_role);
}
if (apply_filters('ws_plugin__s2member_remove_ccaps_during_eot_events', (bool) $GLOBALS['WS_PLUGIN__']['s2member']['o']['eots_remove_ccaps'], get_defined_vars())) {
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match('/^access_s2member_ccap_/', $cap)) {
$user->remove_cap($ccap = $cap);
}
}
}
delete_user_option($user_id, 's2member_subscr_gateway');
delete_user_option($user_id, 's2member_subscr_id');
delete_user_option($user_id, 's2member_subscr_baid');
delete_user_option($user_id, 's2member_subscr_cid');
delete_user_option($user_id, 's2member_ipn_signup_vars');
if (!apply_filters('ws_plugin__s2member_preserve_paid_registration_times', TRUE)) {
delete_user_option($user_id, 's2member_paid_registration_times');
}
delete_user_option($user_id, 's2member_last_status_scan');
delete_user_option($user_id, 's2member_first_payment_txn_id');
delete_user_option($user_id, 's2member_last_payment_time');
delete_user_option($user_id, 's2member_last_auto_eot_time');
delete_user_option($user_id, 's2member_auto_eot_time');
delete_user_option($user_id, 's2member_file_download_access_log');
delete_user_option($user_id, 's2member_authnet_payment_failures');
update_user_option($user_id, 's2member_last_auto_eot_time', $auto_eot_time);
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Demoted by s2Member: ' . date('D M j, Y g:i a T'));
if ($subscr_gateway && $subscr_id) {
// Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Paid Subscr. ID @ time of demotion: ' . $subscr_gateway . ' → ' . $subscr_id);
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls'] && is_array($cv = preg_split('/\\|/', $custom))) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) as $url) {
// Handle EOT Notifications.
if (($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode('auto-eot-cancellation-expiration-demotion')), $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_id)), $url))) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
//.........这里部分代码省略.........
示例10: cp
/**
* s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
*
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
*/
public static function cp($vars = array())
{
extract($vars, EXTR_OVERWRITE | EXTR_REFS);
if (!empty($paypal['txn_type']) && preg_match('/^web_accept$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['sp_access_item_number_regex'], $paypal['item_number'])) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status'])) && !empty($paypal['txn_id']) && (!empty($paypal['txn_baid']) || ($paypal['txn_baid'] = $paypal['txn_id'])) && (!empty($paypal['txn_cid']) || ($paypal['txn_cid'] = $paypal['txn_id']))) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_return_before_sp_access', get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_rtn = 's2m_rtn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10)) {
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.';
list(, $paypal['sp_ids'], $paypal['hours']) = preg_split('/\\:/', $paypal['item_number'], 3);
$paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
$paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
$paypal['ip'] = !$paypal['ip'] && $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : $paypal['ip'];
$paypal['currency'] = strtoupper($paypal['mc_currency']);
// Normalize input currency.
$paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($paypal['sp_ids'], $paypal['hours'], FALSE)) {
$processing = $during = TRUE;
// Yes, we ARE processing this.
setcookie('s2member_sp_tracking', $s2member_sp_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['txn_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_sp_tracking', $s2member_sp_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_sp_tracking'] = $s2member_sp_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `web_accept` ) for Specific Post/Page Access.';
if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['sp_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $code)) && ($code = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
if (($code = preg_replace('/%%txn_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $code)) && ($code = preg_replace('/%%txn_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $code)) {
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Specific Post/Page Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_sp_tracking_codes_' . $paypal['txn_id']), $code, 43200);
}
}
}
}
}
}
}
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_return_during_sp_access', get_defined_vars());
unset($__refs, $__v);
if (apply_filters('ws_plugin__s2member_immediate_sp_access_redirection', FALSE, get_defined_vars())) {
$paypal['s2member_log'][] = 'Redirecting Customer immediately to the Specific Post/Page.';
wp_redirect($sp_access_url);
// Immediate redirection to Specific Post/Page.
} else {
if ($custom_success_redirection) {
$paypal['s2member_log'][] = 'Redirecting Customer to a custom URL on success: ' . $custom_success_redirection;
wp_redirect($custom_success_redirection);
} else {
$paypal['s2member_log'][] = 'Redirecting Customer to the Specific Post/Page (after displaying a thank-you message).';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], _x('<strong>Thank You! Your transaction has been approved.</strong>', 's2member-front', 's2member'), _x('Continue (Click Here)', 's2member-front', 's2member'), $sp_access_url);
}
}
} else {
$paypal['s2member_log'][] = 'Unable to generate Specific Post/Page Access Link. Does your Leading Post/Page still exist?';
$paypal['s2member_log'][] = 'Redirecting Customer to the Home Page (after displaying an error message).';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], _x('<strong>ERROR:</strong> Unable to generate Access Link.<br />Please contact Support for assistance.', 's2member-front', 's2member'), _x('Back To Home Page', 's2member-front', 's2member'), home_url('/'));
}
} else {
$paypal['s2member_log'][] = 'Page Expired. Duplicate Return-Data.';
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.';
$paypal['s2member_log'][] = 'Page Expired. Instructing customer to check their email for further details about how to obtain access to what they purchased.';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], '<strong>' . _x('Thank you! Please check your email for further details regarding your purchase.', 's2member-front', 's2member') . '</strong>', _x('Return to Home Page', 's2member-front', 's2member'), home_url('/'));
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_return_after_sp_access', get_defined_vars());
unset($__refs, $__v);
return apply_filters('c_ws_plugin__s2member_paypal_return_in_web_accept_sp', $paypal, get_defined_vars());
} else {
return apply_filters('c_ws_plugin__s2member_paypal_return_in_web_accept_sp', FALSE, get_defined_vars());
}
}
示例11: __construct
public function __construct()
{
echo '<div class="wrap ws-menu-page">' . "\n";
echo '<div class="ws-menu-page-toolbox">' . "\n";
c_ws_plugin__s2member_menu_pages_tb::display();
echo '</div>' . "\n";
echo '<h2>AliPay Buttons</h2>' . "\n";
echo '<table class="ws-menu-page-table">' . "\n";
echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
echo '<tr class="ws-menu-page-table-tr">' . "\n";
echo '<td class="ws-menu-page-table-l">' . "\n";
for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
echo '<div class="ws-menu-page-group" title="AliPay Buttons For Level #' . $n . ' Access">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-level' . $n . '-buttons-section">' . "\n";
echo '<h3>Button Code Generator For Level #' . $n . ' Access</h3>' . "\n";
echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special AliPay Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. s2Member makes extensive use of the AliPay IPN service. s2Member receives updates from AliPay behind-the-scene. <em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back & re-generate a new one.</em></p>' . "\n";
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<th class="ws-menu-page-th-side">' . "\n";
echo '<label for="ws-plugin--s2member-pro-level' . $n . '-shortcode">' . "\n";
echo 'Button Code<br />For Level #' . $n . ':<br /><br />' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '<td>' . "\n";
echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-level' . $n . '-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/alipay-membership-regular-terms.php"))) . '</select></p>' . "\n";
echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-desc" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]) . ' / description and pricing details here." size="73" /></p>' . "\n";
echo '<p' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? ' style="display:none;"' : '') . '>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-ccaps" size="40" /></p>' . "\n";
echo '<p><input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_alipayButtonGenerate(\'level' . $n . '\');" /></p>' . "\n";
echo '</form>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td colspan="2">' . "\n";
echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual & HTML Editors)<br />' . "\n";
$ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/alipay-checkout-button-shortcode.php")));
$ws_plugin__s2member_pro_temp_s = preg_replace("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($n)), $ws_plugin__s2member_pro_temp_s);
$ws_plugin__s2member_pro_temp_s = preg_replace("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_pro_temp_s);
$ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
echo '</form>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
}
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
echo '<div class="ws-menu-page-group" title="AliPay Capability (Buy Now) Buttons">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccap-buttons-section">' . "\n";
echo '<h3>Button Code Generator For Independent Custom Capabilities</h3>' . "\n";
echo '<p>This is VERY advanced. For further details, please check your Dashboard: <strong>s2Member ⥱ API Scripting ⥱ Custom Capabiities</strong>.</p>' . "\n";
echo '<p>With s2Member, you can sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>(i.e., you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like)</em>. So this is quite flexible. Independent Custom Capabilities do NOT rely on any specific Membership Level. That\'s why s2Member refers to these as `Independent` Custom Capabilities, because you can sell Capabilities this way, through Buy Now functionality, and the Customer\'s Membership Level Access, along with any existing paid access they may already have with you, will remain completely unaffected.</p>' . "\n";
echo '<p>Independent Custom Capabilities are added to a Customer\'s account immediately after checkout, and the Customer will have the Custom Capabilities for as long as their Membership lasts, based on their primary Subscription with your site, and/or forever, if they have a Lifetime account with you. In other words, Independent Custom Capabilities will exist on the Customer\'s account forever, or until an EOT <em>(End Of Term)</em> occurs on their primary Subscription with you; in which case s2Member would demote or delete the Customer\'s account <em>(based on your EOT configuration)</em>, and all Custom Capabilities are removed as well.</p>' . "\n";
echo '<p>Very simple. All you do is customize the form fields provided, for each set of Custom Capabilities that you plan to sell. Then press (Generate Button Code). These special AliPay Buttons are customized to work with s2Member seamlessly. The Customer will be granted additional access to one or more Custom Capabilities that you specify; while the Customer\'s Membership Level Access and any existing paid Subscription they may already have with you, will remain completely unaffected.</p>' . "\n";
echo '<p><em><strong>Important Note:</strong> Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button. Otherwise, post-processing of their transaction will fail to recognize the Customer\'s existing account within WordPress. Please display this Button only to Users/Members that are already logged into their account (perhaps in your Login Welcome Page for s2Member), or in another location where you can be absolutely sure that a User/Member is logged in. s2Member\'s Simple Conditionals could also be used to ensure a User/Member is logged in, by wrapping your Shortcode within a Conditional test. For further details, please see: <strong>s2Member ⥱ API Scripting ⥱ Simple Conditionals</strong>.</em></p>' . "\n";
echo '<p><em><strong>Please note:</strong> buttons are NOT saved here. This is only a Button Generator. If you lose your Button Code, you\'ll need to come back & re-generate a new one.</em></p>' . "\n";
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<th class="ws-menu-page-th-side">' . "\n";
echo '<label for="ws-plugin--s2member-pro-ccap-shortcode">' . "\n";
echo 'Button Code<br />For Capabilities:<br /><br />' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '<td>' . "\n";
echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-ccap-term">' . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/options/alipay-membership-ccap-terms.php"))) . '</select></p>' . "\n";
echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-desc" value="Description and pricing details here." size="73" /></p>' . "\n";
echo '<p>Custom Capabilities (comma-delimited) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member ⥱ API Scripting ⥱ Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-ccap-ccaps" size="40" /></p>' . "\n";
echo '<p><input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_alipayCcapButtonGenerate();" /></p>' . "\n";
echo '</form>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td colspan="2">' . "\n";
echo '<form onsubmit="return false;" autocomplete="off">' . "\n";
echo '<strong>WordPress Shortcode:</strong> (recommended for both the WordPress Visual & HTML Editors)<br />' . "\n";
$ws_plugin__s2member_pro_temp_s = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(__FILE__)) . "/templates/shortcodes/alipay-ccaps-checkout-button-shortcode.php")));
$ws_plugin__s2member_pro_temp_s = preg_replace("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-shortcode" value="' . format_to_edit($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" class="monospace" />' . "\n";
echo '</form>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
}
echo '<div class="ws-menu-page-group" title="AliPay Member Registration Access Links">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-reg-links-section">' . "\n";
echo '<h3>Registration Access Link Generator (for Customer Service)</h3>' . "\n";
echo '<p>s2Member automatically generates Registration Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Registration Access Link to be created manually, you can use this tool for that. Alternatively, you can create their account yourself/manually by going to <strong>Users ⥱ Add New</strong>. Either of these methods will work fine.</p>' . "\n";
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
//.........这里部分代码省略.........
示例12: parse_replacement_codes
/**
* Parses user replacement codes.
*
* @package s2Member\Shortcodes
* @since 140504
*
* @param string $string The string to parse.
* @param WP_User $user A WordPress `WP_User` object instance.
*
* @return string Parsed `$string` value.
*
* @note This is used by shortcode template files.
*/
public static function parse_replacement_codes($string, $user)
{
if (($string = (string) $string) && $user instanceof WP_User && $user->exists()) {
$string = str_ireplace('%%ID%%', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->ID)), $string);
$string = str_ireplace('%%username%%', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $string);
$string = str_ireplace('%%nicename%%', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_nicename)), $string);
$string = str_ireplace('%%display_name%%', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->display_name)), $string);
$string = str_ireplace('%%email%%', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $string);
$string = str_ireplace('%%md5.email%%', urlencode(md5(trim(strtolower($user->user_email)))), $string);
}
return preg_replace('/%%(.+?)%%/', '', $string);
}
示例13: cp
//.........这里部分代码省略.........
}
}
}
update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
update_user_option($user_id, 's2member_custom', $paypal['custom']);
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
}
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
delete_user_option($user_id, 's2member_file_download_access_log');
if ((preg_match('/^web_accept$/i', $paypal['txn_type']) || $paypal['initial'] <= 0 && $paypal['regular'] <= 0) && $paypal['eotper']) {
update_user_option($user_id, 's2member_auto_eot_time', $eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time('', '', '', $paypal['eotper'], '', get_user_option('s2member_auto_eot_time', $user_id)));
$paypal['s2member_log'][] = 'Automatic EOT (End Of Term) Time set to: ' . date('D M j, Y g:i:s a T', $eot_time) . '.';
} else {
delete_user_option($user_id, 's2member_auto_eot_time');
}
$pr_times = get_user_option('s2member_paid_registration_times', $user_id);
$pr_times['level'] = !$pr_times['level'] ? time() : $pr_times['level'];
// Preserve existing.
$pr_times['level' . $paypal['level']] = !$pr_times['level' . $paypal['level']] ? time() : $pr_times['level' . $paypal['level']];
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\\:/');
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\\. ID @ time of demotion\\:/');
$paypal['s2member_log'][] = 's2Member Level/Capabilities updated w/ advanced update routines.';
$sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_subject'];
// The same for standard and w/ Pro Forms.
$msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_message'];
// The same for standard and w/ Pro Forms.
$rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_recipients'];
// The same for standard and w/ Pro Forms.
if (($rec = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $rec))) {
if (($rec = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $rec)) && ($rec = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $rec))) {
if (($rec = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $rec)) && ($rec = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $rec))) {
if (($rec = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $rec)) && ($rec = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $rec))) {
if (($rec = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $rec)) && ($rec = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $rec))) {
if (($rec = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $rec)) && ($rec = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $rec))) {
if (($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec))) {
if (($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec))) {
if ($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $rec)) {
// **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
if ($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)) {
if (($rec = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $rec))) {
if (($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec))) {
if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $rec)) {
if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)) {
if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
if (($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $sbj))) {
if (($sbj = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $sbj)) && ($sbj = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $sbj))) {
if (($sbj = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $sbj)) && ($sbj = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $sbj))) {
if (($sbj = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $sbj)) && ($sbj = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $sbj))) {
if (($sbj = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $sbj)) && ($sbj = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $sbj))) {
if (($sbj = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $sbj)) && ($sbj = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $sbj))) {
if (($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj))) {
if (($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj))) {
if ($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $sbj)) {
if ($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)) {
if (($sbj = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $sbj))) {
if (($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) && ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj))) {
if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $sbj)) {
if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
示例14: apply
//.........这里部分代码省略.........
if (!$attr['sp'] && $attr['tp'] && $coupon['directive'] === 'ra-only') {
$coupon_applies = TRUE;
$p = $attr['ta'] / 100 * $coupon['percentage_discount'];
$ta = number_format($attr['ta'], 2, '.', '');
$ta = $ta >= 0.0 ? $ta : '0.00';
$p = $attr['ra'] / 100 * $coupon['percentage_discount'];
$ra = number_format($attr['ra'] - $p, 2, '.', '');
$ra = $ra >= 0.0 ? $ra : '0.00';
$desc = sprintf(_x('Discount: %s off. (Now: %s, then %s)', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ta, $attr['tp'] . ' ' . $attr['tt']) . $tx, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']));
$response = sprintf(_x('<div>Discount: <strong>%s off</strong>. (Now: <strong>%s, then %s</strong>)</div>', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ta, $attr['tp'] . ' ' . $attr['tt']) . $tx, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']));
} else {
if (!$attr['sp'] && $attr['tp'] && !$coupon['directive']) {
$coupon_applies = TRUE;
$p = $attr['ta'] / 100 * $coupon['percentage_discount'];
$ta = number_format($attr['ta'] - $p, 2, '.', '');
$ta = $ta >= 0.0 ? $ta : '0.00';
$p = $attr['ra'] / 100 * $coupon['percentage_discount'];
$ra = number_format($attr['ra'] - $p, 2, '.', '');
$ra = $ra >= 0.0 ? $ra : '0.00';
$desc = sprintf(_x('Discount: %s off. (Now: %s, then %s)', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ta, $attr['tp'] . ' ' . $attr['tt']) . $tx, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']));
$response = sprintf(_x('<div>Discount: <strong>%s off</strong>. (Now: <strong>%s, then %s</strong>)</div>', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ta, $attr['tp'] . ' ' . $attr['tt']) . $tx, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']));
} else {
if (!$attr['sp'] && !$attr['tp'] && $coupon['directive'] === 'ra-only') {
$coupon_applies = TRUE;
$p = $attr['ta'] / 100 * $coupon['percentage_discount'];
$ta = number_format($attr['ta'], 2, '.', '');
$ta = $ta >= 0.0 ? $ta : '0.00';
$p = $attr['ra'] / 100 * $coupon['percentage_discount'];
$ra = number_format($attr['ra'] - $p, 2, '.', '');
$ra = $ra >= 0.0 ? $ra : '0.00';
$desc = sprintf(_x('Discount: %s off. (Now: %s)', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']) . $tx);
$response = sprintf(_x('<div>Discount: <strong>%s off</strong>. (Now: <strong>%s</strong>)</div>', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']) . $tx);
} else {
if (!$attr['sp'] && !$attr['tp'] && !$coupon['directive']) {
$coupon_applies = TRUE;
$p = $attr['ta'] / 100 * $coupon['percentage_discount'];
$ta = number_format($attr['ta'] - $p, 2, '.', '');
$ta = $ta >= 0.0 ? $ta : '0.00';
$p = $attr['ra'] / 100 * $coupon['percentage_discount'];
$ra = number_format($attr['ra'] - $p, 2, '.', '');
$ra = $ra >= 0.0 ? $ra : '0.00';
$desc = sprintf(_x('Discount: %s off. (Now: %s)', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']) . $tx);
$response = sprintf(_x('<div>Discount: <strong>%s off</strong>. (Now: <strong>%s</strong>)</div>', 's2member-front', 's2member'), number_format($coupon['percentage_discount'], 0) . $ps, $cs . c_ws_plugin__s2member_utils_time::amount_period_term($ra, $attr['rp'] . ' ' . $attr['rt'], $attr['rr']) . $tx);
} else {
// Otherwise, we need a default response to display.
$response = _x('<div>Sorry, your discount code is not applicable.</div>', 's2member-front', 's2member');
}
}
}
}
}
}
} else {
// Else there was no discount applied at all.
$response = sprintf(_x('<div>Discount: <strong>%s0.00 off</strong>.</div>', 's2member-front', 's2member'), $cs);
}
}
if ($coupon_applies) {
$attr['ta'] = $ta < 0.5 ? '0.00' : $ta;
// Apply new amount for the initial/period.
$attr['ra'] = $ra < 0.5 ? '0.00' : $ra;
// Apply new amount for the regular/recurring period.
$attr['desc'] = sprintf(_x('%1$s ~ ORIGINALLY: %2$s', 's2member-front', 's2member'), $desc, $attr['desc']);
if ($affiliate_id && empty($_COOKIE['idev']) && (in_array('affiliates-silent-post', $process) || in_array('affiliates-1px-response', $process))) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_affiliate_coupon_code_tracking_urls'], NULL, PREG_SPLIT_NO_EMPTY) as $_url) {
if ($_url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($full_coupon_code)), $_url)) {
if ($_url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon_code)), $_url)) {
if ($_url = preg_replace('/%%(?:coupon_affiliate_id|affiliate_id)%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($affiliate_id)), $_url)) {
if ($_url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($_SERVER['REMOTE_ADDR'])), $_url)) {
if ($_url = trim(preg_replace('/%%(.+?)%%/i', '', $_url))) {
if (!($_r = 0) && ($_url = preg_replace('/^silent-php\\|/i', '', $_url, 1, $_r)) && $_r && in_array('affiliates-silent-post', $process)) {
c_ws_plugin__s2member_utils_urls::remote($_url, FALSE, array('blocking' => FALSE));
} else {
if (!($_r = 0) && ($_url = preg_replace('/^img-1px\\|/i', '', $_url, 1, $_r)) && $_r && in_array('affiliates-1px-response', $process)) {
if (!empty($response) && $return === 'response') {
// Now, we MUST also have a `$response`, and MUST be returning `$response`.
$response .= "\n" . '<img src="' . esc_attr($_url) . '" style="width:0; height:0; border:0;" alt="" />';
}
}
}
}
}
}
}
}
}
}
unset($_url, $_r);
// Just a little housekeeping here. Unset these variables.
}
} else {
$response = _x('<div>Sorry, your discount code is N/A, invalid or expired.</div>', 's2member-front', 's2member');
}
}
$attr['_coupon_applies'] = isset($coupon_applies) && $coupon_applies ? '1' : '0';
$attr['_coupon_code'] = isset($coupon_applies, $coupon_code) && $coupon_applies ? $coupon_code : '';
$attr['_full_coupon_code'] = isset($coupon_applies, $full_coupon_code) && $coupon_applies ? $full_coupon_code : '';
$attr['_coupon_affiliate_id'] = isset($coupon_applies, $affiliate_id) && $coupon_applies && empty($_COOKIE['idev']) ? $affiliate_id : '';
return $return === 'response' ? !empty($response) ? $response : '' : $attr;
}
示例15: configure_user_registration
//.........这里部分代码省略.........
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
$field_id_class = preg_replace("/_/", "-", $field_var);
if (isset($_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var])) {
$fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
}
}
}
unset($field, $field_var, $field_id_class);
// Housekeeping.
if (!empty($fields)) {
// Only if NOT empty.
update_user_option($user_id, "s2member_custom_fields", $fields);
}
if ($level > 0) {
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
$pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
$pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
// Update now.
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars());
unset($__refs, $__v);
}
}
}
if ($processed === "yes") {
if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"]) {
foreach (preg_split("/[\r\n\t]+/", $urls) as $url) {
// Notify each of the URLs.
if ($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) {
if ($url = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($role)), $url)) {
if ($url = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($level)), $url)) {
if ($url = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ccaps)), $url)) {
if ($url = preg_replace("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($auto_eot_time)), $url)) {
if ($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($fname)), $url)) {
if ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($lname)), $url)) {
if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($name)), $url)) {
if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($email)), $url)) {
if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($login)), $url)) {
if ($url = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($pass)), $url)) {
if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ip)), $url)) {
if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
foreach ($fields as $var => $val) {
// Custom Fields.
if (!($url = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
if ($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
}
}