本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings类的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings类的具体用法?PHP c_ws_plugin__s2member_utils_strings怎么用?PHP c_ws_plugin__s2member_utils_strings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c_ws_plugin__s2member_utils_strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_template
/**
* Handles Return templates w/ response message.
*
* @package s2Member\Return_Templates
* @since 110720
*
* @param str $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
* @param str $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
* @param str $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
* @param str $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ("/")``.
* @return str The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
*/
public static function return_template($template = FALSE, $response = FALSE, $continue_html = FALSE, $continue_link = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_return_template", get_defined_vars());
unset($__refs, $__v);
$template = $template ? $template : "default";
$continue_link = $continue_link ? $continue_link : home_url("/");
$continue_html = $continue_html ? $continue_html : _x("Continue", "s2member-front", "s2member");
$response = $response ? $response : _x("Thank you. Please click the link below.", "s2member-front", "s2member");
$custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.php") ? TEMPLATEPATH . "/" . $template . "-return.php" : false;
$custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.html") ? TEMPLATEPATH . "/" . $template . "-return.html" : $custom_template;
$custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.php") ? WP_CONTENT_DIR . "/" . $template . "-return.php" : $custom_template;
$custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.html") ? WP_CONTENT_DIR . "/" . $template . "-return.html" : $custom_template;
$custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.php") ? TEMPLATEPATH . "/default-return.php" : $custom_template;
$custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.html") ? TEMPLATEPATH . "/default-return.html" : $custom_template;
$custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.php") ? WP_CONTENT_DIR . "/default-return.php" : $custom_template;
$custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.html") ? WP_CONTENT_DIR . "/default-return.html" : $custom_template;
$specific_template = $custom_template ? $custom_template : (file_exists($_default_specific_template = dirname(dirname(__FILE__)) . "/templates/returns/" . $template . "-return.php") ? $_default_specific_template : false);
$code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . "/templates/returns/default-return.php")));
$code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo("name"), "ws_plugin__s2member_during_return_template_head_" . ($specific_template ? basename($specific_template) : "default-return.php"));
$code = preg_replace("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_doctype_html_head", $doctype_html_head, get_defined_vars())), $code);
$code = preg_replace("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_header", sprintf(_x('[ %s ] <strong><em>says…</em></strong>', "s2member-front", "s2member"), esc_html($_SERVER["HTTP_HOST"])), get_defined_vars())), $code);
$code = preg_replace("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_response", $response, get_defined_vars())), $code);
$code = preg_replace("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_continue", '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
$code = preg_replace("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_support", sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', "s2member-front", "s2member"), esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_support_link"])), get_defined_vars())), $code);
$code = preg_replace("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_tracking", c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars());
}
示例2: 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.
}
示例3: register
/**
* Handles Registration Links.
*
* @package s2Member\Registrations
* @since 3.5
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after redirection.
*/
public static function register()
{
do_action("ws_plugin__s2member_before_register", get_defined_vars());
/**/
if (!empty($_GET["s2member_register"])) {
eval('while (@ob_end_clean ());');
/* First we end/clean any output buffers that may exist already. */
/**/
$msg_503 = _x('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
/**/
if (is_array($register = preg_split("/\\:\\.\\:\\|\\:\\.\\:/", c_ws_plugin__s2member_utils_encryption::decrypt(trim(stripslashes((string) $_GET["s2member_register"])))))) {
if (count($register) === 6 && $register[0] === "subscr_gateway_subscr_id_custom_item_number_time") {
if (is_numeric($register[5]) && $register[5] <= strtotime("now") && $register[5] >= strtotime("-" . apply_filters("ws_plugin__s2member_register_link_exp_time", "2 days", get_defined_vars()))) {
$_COOKIE["s2member_subscr_gateway"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[1]);
$_COOKIE["s2member_subscr_id"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[2]);
$_COOKIE["s2member_custom"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[3]);
$_COOKIE["s2member_item_number"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[4]);
/**/
if (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
status_header(200);
/* Send a 200 OK status header. */
header("Content-Type: text/html; charset=utf-8");
/* Content-Type with UTF-8. */
/**/
setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
/**/
do_action("ws_plugin__s2member_during_register", get_defined_vars());
/**/
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site() && ($location = c_ws_plugin__s2member_utils_urls::wp_signup_url())) {
echo '<script type="text/javascript">' . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
echo '</script>' . "\n";
} else {
if ($location = c_ws_plugin__s2member_utils_urls::wp_register_url()) {
echo '<script type="text/javascript">' . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
echo '</script>' . "\n";
}
}
exit;
/* Clean exit. The browser will now be redirected to ``$location``. */
} else {
status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
}
} else {
status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
}
} else {
status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
}
} else {
status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
}
}
/**/
do_action("ws_plugin__s2member_after_register", get_defined_vars());
}
示例4: 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 = FALSE, $fill = FALSE)
{
global $current_site, $current_blog;
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_ds(rtrim($current_site->domain . $current_site->path, "/") . "/"), $op) : preg_replace("/%%_op__current_site_domain_path\\/%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/") . "/"), $op);
$op = is_multisite() ? preg_replace("/%%_op__current_site_domain_path%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim($current_site->domain . $current_site->path, "/")), $op) : preg_replace("/%%_op__current_site_domain_path%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/")), $op);
$op = is_multisite() ? preg_replace("/%%_op__current_blog_domain_path\\/%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim($current_blog->domain . $current_blog->path, "/") . "/"), $op) : preg_replace("/%%_op__current_blog_domain_path\\/%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/") . "/"), $op);
$op = is_multisite() ? preg_replace("/%%_op__current_blog_domain_path%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim($current_blog->domain . $current_blog->path, "/")), $op) : preg_replace("/%%_op__current_blog_domain_path%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/")), $op);
$op = preg_replace("/%%_op__site_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/")), preg_replace("/%%_op__site_url\\/%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(site_url(), "/") . "/"), $op));
$op = preg_replace("/%%_op__home_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(home_url(), "/")), preg_replace("/%%_op__home_url\\/%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(rtrim(home_url(), "/") . "/"), $op));
$op = preg_replace("/%%_op__domain%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($_SERVER["HTTP_HOST"]), preg_replace("/%%_op__blog_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(get_bloginfo("name")), $op));
}
}
}
}
}
return $ops;
// Now return the $ops.
}
示例5: alipay_postvars
/**
* Get ``$_POST`` or ``$_REQUEST`` vars from AliPay.
*
* @package s2Member\AliPay
* @since 1.5
*
* @return array|bool An array of verified AliPay ``$_POST`` or ``$_REQUEST`` vars, else false.
*/
public static function alipay_postvars()
{
if (!empty($_REQUEST["notify_id"]) && !empty($_REQUEST["notify_type"]) && preg_match("/^trade_status_sync\$/i", $_REQUEST["notify_type"]) && !empty($_REQUEST["sign"])) {
$postvars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_REQUEST));
foreach ($postvars as $var => $value) {
if (preg_match("/^s2member_/", $var)) {
unset($postvars[$var]);
}
}
ksort($postvars) . reset($postvars);
$_q = "";
// Initialize unencoded query.
$gateway = "https://www.alipay.com/cooperate/gateway.do";
foreach ($postvars as $var => $value) {
if ($var && strlen($value) && !preg_match("/^(sign|sign_type)\$/", $var)) {
$_q .= ($_q ? "&" : "") . $var . "=" . $value;
}
}
if ($postvars["sign"] === md5($_q . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_security_code"]) && preg_match("/true\$/i", trim(c_ws_plugin__s2member_utils_urls::remote($gateway . "?service=notify_verify&partner=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_partner_id"]) . "¬ify_id=" . urlencode($postvars["notify_id"]), "", array("timeout" => 20))))) {
return $postvars;
} else {
// Nope.
return false;
}
} else {
// Nope.
return false;
}
}
示例6: sc_get_details
/**
* Handles the Shortcode for: `[s2Get /]`.
*
* @package s2Member\s2Get
* @since 3.5
*
* @attaches-to ``add_shortcode("s2Get");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return mixed Value of the requested data, or null on failure.
*
* @todo Prevent this routine from potentially returning objects/arrays?
*/
public static function sc_get_details($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details", get_defined_vars());
unset($__refs, $__v);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
// Force array; trim quote entities.
$attr = shortcode_atts(array("constant" => "", "user_field" => "", "user_option" => "", "user_id" => ""), $attr);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars());
unset($__refs, $__v);
if ($attr["constant"] && defined($attr["constant"])) {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match("/^S2MEMBER_/i", $attr["constant"])) {
$get = constant($attr["constant"]);
}
} else {
if ($attr["user_field"] && (is_user_logged_in() || $attr["user_id"])) {
$get = c_ws_plugin__s2member_utils_users::get_user_field($attr["user_field"], (int) $attr["user_id"]);
} else {
if ($attr["user_option"] && (is_user_logged_in() || $attr["user_id"])) {
$get = get_user_option($attr["user_option"], (int) $attr["user_id"]);
}
}
}
return apply_filters("ws_plugin__s2member_sc_get_details", isset($get) ? $get : null, get_defined_vars());
}
示例7: 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());
}
示例8: __construct
public function __construct()
{
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
echo '<div class="ws-menu-page-group" title="Pro API For Remote Operations">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-api-remote-operations-section">' . "\n";
echo '<h3>Pro API For Remote Operations (PHP scripting required)</h3>' . "\n";
echo '<p>With s2Member Pro installed, you have access to the s2Member Pro API For Remote Operations. This is made available for developers that wish to create User/Member accounts dynamically through custom scripts of their own. s2Member\'s Remote Operations API requires a secret API Key in order to POST authenticated requests to your installation of s2Member.</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h4>Remote Operations API: <strong>Your secret API Key</strong></h4>' . "\n";
echo '<input type="text" autocomplete="off" value="' . format_to_edit(c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen()) . '" style="width:99%;" />' . "\n";
echo '<p><em><strong class="ws-menu-page-hilite">Experimental:</strong> The Remote Operations API is currently in an experimental state. The Operations that are currently possible include: <code>auth_check_user</code>, <code>get_user</code>, <code>create_user</code>, <code>modify_user</code>, <code>delete_user</code>. In a future release of s2Member Pro, we will add further documentation and some additional Remote Operations to this API. Thanks for your patience.</em></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h4>Remote Operation: <code>auth_check_user</code> (authenticate existing Users/Members)</h4>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-auth-check-user.x-php"))))) . '</p>' . "\n";
echo '<h4>Remote Operation: <code>get_user</code> (retrieve data about existing Users/Members)</h4>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-get-user.x-php"))))) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h4>Remote Operation: <code>create_user</code> (or update existing Users/Members)</h4>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-create-user.x-php"))))) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h4>Remote Operation: <code>modify_user</code> (updates existing Users/Members)</h4>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-modify-user.x-php"))))) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<h4>Remote Operation: <code>delete_user</code> (deletes existing Users/Members)</h4>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-delete-user.x-php"))))) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>TIP:</strong> In addition to this documentation, you may also want to have a look at the <a href="http://www.s2member.com/codex/" target="_blank" rel="external">s2Member Codex</a>.<br />' . "\n";
echo '<strong>See Also:</strong> <a href="http://www.s2member.com/codex/stable/s2member/api_constants/package-summary/" target="_blank" rel="external">s2Member Codex -› API Constants</a>, and <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/" target="_blank" rel="external">s2Member Codex -› API Functions</a>.</p>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
}
}
示例9: sc_get_file
/**
* Handles the Shortcode for: `[s2File /]`.
*
* @package s2Member\s2File
* @since 110926
*
* @attaches-to ``add_shortcode("s2File");``
*
* @param array $attr An array of Attributes.
* @param str $content Content inside the Shortcode.
* @param str $shortcode The actual Shortcode name itself.
* @return str Value of requested File Download URL, streamer array element; or null on failure.
*/
public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_sc_get_file", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
/* Force array; trim quote entities. */
/**/
$attr = shortcode_atts(array("download" => "", "download_key" => "", "stream" => "", "inline" => "", "storage" => "", "remote" => "", "ssl" => "", "rewrite" => "", "rewrite_base" => "", "skip_confirmation" => "", "url_to_storage_source" => "", "count_against_user" => "", "check_user" => "", "get_streamer_json" => "", "get_streamer_array" => ""), $attr);
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_sc_get_file_after_shortcode_atts", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
$get_streamer_json = filter_var($attr["get_streamer_json"], FILTER_VALIDATE_BOOLEAN);
/* Getting streamer? */
$get_streamer_array = filter_var($attr["get_streamer_array"], FILTER_VALIDATE_BOOLEAN);
/* Streamer? */
$get_streamer_json = $get_streamer_array = $get_streamer_array || $get_streamer_json ? true : false;
/**/
foreach ($attr as $key => $value) {
/* Now we need to go through and a `file_` prefix to certain Attribute keys, for compatibility. */
if (strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base"))) {
$config["file_" . $key] = $value;
} else {
if (strlen($value) && !in_array($key, array("get_streamer_json", "get_streamer_array"))) {
/* Else, exclude? */
$config[$key] = $value;
}
}
}
/**/
unset($key, $value);
/* Ditch these now. We don't want these bleeding into Hooks/Filters anyway. */
/**/
if (!empty($config) && isset($config["file_download"])) {
$_get = c_ws_plugin__s2member_files::create_file_download_url($config, $get_streamer_array);
/**/
if ($get_streamer_array && $get_streamer_json && is_array($_get)) {
$get = json_encode($_get);
} else {
if ($get_streamer_array && $get_streamer_json) {
$get = "null";
} else {
if (!empty($_get)) {
/* Else ``$get``. */
$get = $_get;
}
}
}
/* Default return. */
}
/**/
return apply_filters("ws_plugin__s2member_sc_get_file", isset($get) ? $get : null, get_defined_vars());
}
示例10: sc_get_details
/**
* Handles the Shortcode for: `[s2Get /]`.
*
* @package s2Member\s2Get
* @since 3.5
*
* @attaches-to ``add_shortcode('s2Get');``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
*
* @return mixed Value of the requested data, or null on failure.
*/
public static function sc_get_details($attr = array(), $content = '', $shortcode = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_get_details', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
// Force array; trim quote entities.
$attr = shortcode_atts(array('constant' => '', 'user_field' => '', 'user_option' => '', 'user_id' => ''), $attr);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_get_details_after_shortcode_atts', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
if ($attr['constant'] && defined($attr['constant'])) {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match('/^S2MEMBER_/i', $attr['constant'])) {
$get = constant($attr['constant']);
}
} else {
if ($attr['user_field'] && (is_user_logged_in() || $attr['user_id'])) {
$get = c_ws_plugin__s2member_utils_users::get_user_field($attr['user_field'], (int) $attr['user_id']);
} else {
if ($attr['user_option'] && (is_user_logged_in() || $attr['user_id'])) {
$get = get_user_option($attr['user_option'], (int) $attr['user_id']);
}
}
}
if (isset($get) && (is_array($get) || is_object($get))) {
$_get_array = $get;
// Temporary variable.
$get = array();
// New empty array.
foreach ($_get_array as $_key_prop => $_value) {
if (is_scalar($_value)) {
// One dimension only.
$get[$_key_prop] = (string) $_value;
}
}
unset($_get_array, $_key_prop, $_value);
// Housekeeping.
$get = implode(', ', $get);
// Convert to a string now.
}
if (isset($get) && !is_scalar($get)) {
$get = '';
} else {
if (isset($get)) {
$get = (string) $get;
}
}
// Convert to a string.
return apply_filters('ws_plugin__s2member_sc_get_details', isset($get) ? $get : '', get_defined_vars());
}
示例11: recaptcha_script_tag
/**
* Builds a reCAPTCHA™ JavaScript `script` tag for display.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param string $theme Optional. The theme used in display. Defaults to `clean`.
* @param string $tabindex Optional. Value of `tabindex=""` attribute. Defaults to `-1`.
* @param string $error Optional. An error message to display.
* @return string HTML markup for JavaScript tag.
*/
public static function recaptcha_script_tag($theme = FALSE, $tabindex = FALSE, $error = FALSE)
{
$theme = $theme ? $theme : "clean";
$tabindex = strlen($tabindex) ? (int) $tabindex : -1;
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys();
$options = '<script type="text/javascript">' . "if(typeof RecaptchaOptions !== 'object'){ var RecaptchaOptions = {theme: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($theme) . "', lang: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["lang"]) . "', tabindex: " . $tabindex . " }; }" . '</script>' . "\n";
$no_tabindex_icons = '<script type="text/javascript">' . "if(typeof jQuery === 'function'){ jQuery('td a[id^=\"recaptcha\"]').removeAttr('tabindex'); }" . '</script>';
$adjustments = !apply_filters("c_ws_plugin__s2member_utils_tabindex_recaptcha_icons", false, get_defined_vars()) ? $no_tabindex_icons : "";
return $options . '<script type="text/javascript" src="' . esc_attr('https://www.google.com/recaptcha/api/challenge?k=' . urlencode($keys["public"])) . '' . ($error ? '&error=' . urlencode($error) : '') . '"></script>' . $adjustments;
}
示例12: __construct
public function __construct()
{
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
echo '<p><strong>S2MEMBER_PRO_VERSION</strong><br />This will always be a (string) with the current s2Member Pro version. Available since s2Member Pro v1.0. Dated versions began with s2Member Pro v110604.</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
} else {
echo '<p><strong>S2MEMBER_PRO_VERSION</strong><br />This will always be a (string) with the current s2Member Pro version. Available since s2Member Pro v1.0. Dated versions began with s2Member Pro v110604.</p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/pro-version.x-php")) . '</p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
}
}
示例13: js_w_globals
/**
* Adds Pro Add-on JavaScript.
*
* @package s2Member\CSS_JS
* @since 1.5
*
* @attaches-to ``add_action("ws_plugin__s2member_during_js_w_globals");``
*
* @param array $vars Expects array of defined variables, passed in by the Action Hook.
* @return null
*/
public static function js_w_globals($vars = FALSE)
{
$g = "var S2MEMBER_PRO_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PRO_VERSION) . "',";
$g = trim($g, " ,") . ";";
// Trim & add semicolon.
$u = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"];
$i = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images";
echo "\n" . $g . "\n";
// Add a line break before inclusion.
include_once dirname(dirname(__FILE__)) . "/s2member-pro-min.js";
return;
// Return unformity.
}
示例14: sc_s_badge
/**
* Handles the Shortcode for: `[s2Member-Security-Badge /]`.
*
* @package s2Member\Security_Badges
* @since 110524RC
*
* @attaches-to ``add_shortcode('s2Member-Security-Badge');``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
*
* @return string Resulting Security Badge code; HTML markup.
*/
public static function sc_s_badge($attr = array(), $content = '', $shortcode = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_s_badge', get_defined_vars());
unset($__refs, $__v);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
$attr = shortcode_atts(array('v' => '1'), $attr);
// One attribute.
$code = c_ws_plugin__s2member_utilities::s_badge_gen($attr['v'], FALSE, FALSE);
return apply_filters('ws_plugin__s2member_sc_s_badge', $code, get_defined_vars());
}
示例15: sc_s_badge
/**
* Handles the Shortcode for: `[s2Member-Security-Badge /]`.
*
* @package s2Member\Security_Badges
* @since 110524RC
*
* @attaches-to ``add_shortcode("s2Member-Security-Badge");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return string Resulting Security Badge code; HTML markup.
*/
public static function sc_s_badge($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_s_badge", get_defined_vars());
unset($__refs, $__v);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
$attr = shortcode_atts(array("v" => "1"), $attr);
// One attribute.
$code = c_ws_plugin__s2member_utilities::s_badge_gen($attr["v"], false, false);
return apply_filters("ws_plugin__s2member_sc_s_badge", $code, get_defined_vars());
}