本文整理汇总了PHP中c_ws_plugin__s2member_utils_urls类的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_urls类的具体用法?PHP c_ws_plugin__s2member_utils_urls怎么用?PHP c_ws_plugin__s2member_utils_urls使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c_ws_plugin__s2member_utils_urls类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: check_specific_ruri_level_access
/**
* Handles URI Level Access *(for specific URIs)*.
*
* @package s2Member\URIs
* @since 3.5
*
* @param string $uri A URI, or a full URL is also fine.
* @param bool $check_user Test permissions against the current User? Defaults to true.
*
* @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
*/
public static function check_specific_ruri_level_access($uri = '', $check_user = TRUE)
{
do_action('ws_plugin__s2member_before_check_specific_ruri_level_access', get_defined_vars());
$ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
$uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : FALSE;
$excluded = apply_filters('ws_plugin__s2member_check_specific_ruri_level_access_excluded', FALSE, get_defined_vars());
if (!$excluded && !empty($uri) && is_string($uri) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(NULL, $uri)) {
$user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
// Current User's object.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0'))) {
return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', array('s2member_level_req' => 0), get_defined_vars());
} else {
if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(NULL, $uri)) {
for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
// URIs configured at this Level?
foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', array('s2member_level_req' => $n), get_defined_vars());
}
}
}
}
}
}
do_action('ws_plugin__s2member_during_check_specific_ruri_level_access', get_defined_vars());
}
}
return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', NULL, get_defined_vars());
}
开发者ID:codeforest,项目名称:s2member,代码行数:42,代码来源:ruris-sp.inc.php
示例2: serve
/**
* Resolution SMIL Files.
*
* @package s2Member\Shortcodes
* @since 140814
*
* @see http://tools.ietf.org/html/rfc4536
*/
public static function serve()
{
if (empty($_GET['s2member_rsf_file'])) {
return;
}
// Nothing to do here.
header('Content-Type: application/smil+xml; charset=UTF-8');
while (@ob_end_clean()) {
}
// Clean any existing output buffers.
$smil_file_id = trim(stripslashes((string) $_GET['s2member_rsf_file']));
if (empty($_GET['s2member_rsf_file_ip']) || trim(stripslashes($_GET['s2member_rsf_file_ip'])) !== $_SERVER['REMOTE_ADDR']) {
exit;
}
// Invalid and/or missing IP address.
if (!c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER['REQUEST_URI'], TRUE, 86400)) {
exit;
}
// Fail here. Invalid and/or expired SMIL file ID.
if (!($smil_file = get_transient('s2m_rsf_' . $smil_file_id))) {
exit;
}
// Fail here. Invalid and/or expired SMIL file ID.
exit($smil_file);
}
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:33,代码来源:rsf-files-in.inc.php
示例3: recaptcha_code_validates
/**
* Verifies a reCAPTCHA™ code via Google®.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param str $challenge The value of `recaptcha_challenge_field` during form submisson.
* @param str $response The value of `recaptcha_response_field` during form submission.
* @return bool True if ``$response`` is valid, else false.
*/
public static function recaptcha_code_validates($challenge = FALSE, $response = FALSE)
{
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys();
$post_vars = array("privatekey" => $keys["private"], "remoteip" => $_SERVER["REMOTE_ADDR"], "challenge" => $challenge, "response" => $response);
/**/
return preg_match("/^true/i", trim(c_ws_plugin__s2member_utils_urls::remote("http://www.google.com/recaptcha/api/verify", $post_vars)));
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:17,代码来源:utils-captchas.inc.php
示例4: 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());
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:70,代码来源:register-in.inc.php
示例5: check_specific_ruri_level_access
/**
* Handles URI Level Access *(for specific URIs)*.
*
* @package s2Member\URIs
* @since 3.5
*
* @param string $uri A URI, or a full URL is also fine.
* @param bool $check_user Test permissions against the current User? Defaults to true.
* @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
*/
public static function check_specific_ruri_level_access($uri = FALSE, $check_user = TRUE)
{
do_action("ws_plugin__s2member_before_check_specific_ruri_level_access", get_defined_vars());
$uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : false;
$excluded = apply_filters("ws_plugin__s2member_check_specific_ruri_level_access_excluded", false, get_defined_vars());
if (!$excluded && !empty($uri) && is_string($uri) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $uri)) {
$user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
// Current User's object.
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => 0), get_defined_vars());
} else {
if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $uri)) {
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
// URIs configured at this Level?
foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
if ($str && preg_match("/" . preg_quote($str, "/") . "/", $uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => $n), get_defined_vars());
}
}
}
}
}
}
do_action("ws_plugin__s2member_during_check_specific_ruri_level_access", get_defined_vars());
}
}
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", null, get_defined_vars());
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:40,代码来源:ruris-sp.inc.php
示例6: google_return
/**
* Handles Google Return URL processing.
*
* @package s2Member\Google
* @since 131123
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after redirection.
*/
public static function google_return()
{
global $current_site, $current_blog;
if (!empty($_GET["s2member_pro_google_return"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"]) {
$google["s2member_log"][] = "Return URL processed on: " . date("D M j, Y g:i:s a T");
$google["s2member_log"][] = "Piping through s2Member's core/standard PayPal processor with `proxy_use` ( `ty-email` ).";
$google["s2member_log"][] = "Please check PayPal RTN logs for further processing details.";
$rtn_q = "&s2member_paypal_proxy=google&s2member_paypal_proxy_use=standard-emails,ty-email";
if (!empty($_GET["s2member_pro_google_return_success"])) {
$rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_google_return_success"])));
}
$rtn_r = home_url("/?s2member_pro_google_return&s2member_paypal_return=1" . $rtn_q);
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
$google["s2member_log"][] = $rtn_r;
wp_redirect($rtn_r);
$logt = c_ws_plugin__s2member_utilities::time_details();
$logv = c_ws_plugin__s2member_utilities::ver_details();
$logm = c_ws_plugin__s2member_utilities::mem_details();
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . @$_SERVER["HTTP_USER_AGENT"];
$log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
$log2 = is_multisite() && !is_main_site() ? "google-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "google-rtn.log";
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
if (is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files()) {
file_put_contents($logs_dir . "/" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($google, true)) . "\n\n", FILE_APPEND);
}
}
}
exit;
// Exit now.
}
}
开发者ID:codeforest,项目名称:s2member-pro,代码行数:42,代码来源:google-return-in.inc.php
示例7: check_specific_catg_level_access
/**
* Handles Category Level Access *( for specific Categories )*.
*
* @package s2Member\Categories
* @since 3.5
*
* @param int|str $cat_id Numeric Category ID.
* @param bool $check_user Test permissions against the current User? Defaults to true.
* @return null|array Non-empty array ( with details ) if access is denied, else null if access is allowed.
*/
public static function check_specific_catg_level_access($cat_id = FALSE, $check_user = TRUE)
{
do_action("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars());
/**/
$excluded = apply_filters("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars());
/**/
if (!$excluded && is_numeric($cat_id) && ($cat_id = (int) $cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
$cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_category_link($cat_id));
/* Get a full valid URI for this Category. */
/**/
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $cat_uri)) {
$user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
/* Current User's object. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => 0), get_defined_vars());
} else {
if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $cat_uri)) {
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, $catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) {
/* Check Category ancestry. */
foreach (preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg) {
if ($catg && cat_is_ancestor_of($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
}
}
}
}
}
}
/**/
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
/* URIs configured at this Level? */
/**/
foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
if ($str && preg_match("/" . preg_quote($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
}
}
}
}
}
}
/**/
do_action("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars());
}
}
/**/
return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars());
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:67,代码来源:catgs-sp.inc.php
示例8: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|float|string $a The amount, in ``$from``.
* @param string $from Three character currency code.
* @param string $to Three character currency code.
*
* @return string A numeric amount in ``$to``, after having been converted. Else false.
*/
public static function convert($a = 0, $from = '', $to = '')
{
if (is_numeric($a) && strlen($from) === 3 && strlen($to) === 3) {
$q = strtoupper($from . '-' . $to);
// Also need this to test the return value.
$endpoint = 'http://www.freecurrencyconverterapi.com/api/convert?q=' . urlencode($q) . '&compact=y';
if (($json = c_ws_plugin__s2member_utils_urls::remote($endpoint)) && is_object($json = json_decode($json)) && isset($json->{$q}->val) && is_float($conversion = (double) $a * (double) $json->{$q}->val)) {
return number_format($conversion, 2, '.', '');
}
}
return '';
// Default return value.
}
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:27,代码来源:utils-cur.inc.php
示例9: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|str $a The amount, in ``$from``.
* @param str $from A 3 character Currency Code.
* @param str $to A 3 character Currency Code.
* @return float|str|bool A numeric amount in ``$to``,
* after having been converted. Else false.
*
* @see http://www.techmug.com/ajax-currency-converter-with-google-api/
*/
public static function convert($a = FALSE, $from = FALSE, $to = FALSE)
{
if (is_numeric($a) && strlen($from = strtoupper($from)) === 3 && strlen($to = strtoupper($to)) === 3) {
$q = number_format($a, 2, ".", "") . $from . "=?" . $to;
$api = "http://www.google.com/ig/calculator?hl=en&q=" . urlencode($q);
if (($json = preg_replace('/([{,])\\s*([^"]+?)\\s*:/', '$1"$2":', c_ws_plugin__s2member_utils_urls::remote($api))) && is_array($json = json_decode($json, true)) && !empty($json["icc"]) && isset($json["rhs"]) && strlen($json["rhs"])) {
if (is_numeric($c_a = preg_replace("/ .*\$/", "", trim($json["rhs"]))) && $c_a >= 0) {
return number_format($c_a, 2, ".", "");
}
}
}
return false;
// Default return value.
}
开发者ID:donwea,项目名称:nhap.org,代码行数:30,代码来源:utils-cur.inc.php
示例10: sc_google_button
/**
* Shortcode `[s2Member-Pro-Google-Button /]`.
*
* @package s2Member\Google
* @since 1.5
*
* @attaches-to ``add_shortcode("s2Member-Pro-Google-Button");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return string The resulting Google Button Code; HTML markup.
*/
public static function sc_google_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
c_ws_plugin__s2member_no_cache::no_cache_constants(true);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
$jwt_attr = c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr));
$attr = shortcode_atts(array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "rrt" => "", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "anchor", "success" => "", "failure" => ""), $attr);
if ($attr["modify"] || $attr["cancel"]) {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-edit-button.png";
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-cancellation-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
$code = $attr["output"] === "anchor" ? $code : $code;
if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
$code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
}
unset($href, $url, $m);
} else {
if ($attr["sp"]) {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-sp-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
$code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
} else {
if ($attr["level"] === "*") {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-ccaps-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
$code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
} else {
$default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
$code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-checkout-button.php")));
$code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
$code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
$code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
$code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
$code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
}
}
}
return $code;
}
开发者ID:codeforest,项目名称:s2member-pro,代码行数:61,代码来源:google-button-in.inc.php
示例11: register_link_gen
/**
* Generates Registration Access Links.
*
* @package s2Member\Registrations
* @since 3.5
*
* @param string $subscr_gateway Payment Gateway associated with a Customer.
* @param string $subscr_id Unique Subscr. ID associated with Payment Gateway; associated with a Customer.
* @param string $custom Custom String value *(as supplied in Shortcode)*; must start with installation domain name.
* @param int|string $item_number An s2Member-generated `item_number` *( i.e., `1` for Level 1, or `level|ccaps|fixed-term`, or `sp|ids|expiration` )*.
* @param bool $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
*
* @return string|bool A Registration Access Link on success, else false on failure.
*/
public static function register_link_gen($subscr_gateway = '', $subscr_id = '', $custom = '', $item_number = '', $shrink = TRUE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_register_link_gen', get_defined_vars());
unset($__refs, $__v);
if ($subscr_gateway && is_string($subscr_gateway) && $subscr_id && is_string($subscr_id) && $custom && is_string($custom) && $item_number && (is_string($item_number) || is_numeric($item_number))) {
$register = c_ws_plugin__s2member_utils_encryption::encrypt('subscr_gateway_subscr_id_custom_item_number_time:.:|:.:' . $subscr_gateway . ':.:|:.:' . $subscr_id . ':.:|:.:' . $custom . ':.:|:.:' . $item_number . ':.:|:.:' . strtotime('now'));
$register_link = home_url('/?s2member_register=' . urlencode($register));
// Generate long URL/link.
if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($register_link))) {
$register_link = $shorter_url . '#' . $_SERVER['HTTP_HOST'];
}
}
return apply_filters('ws_plugin__s2member_register_link_gen', !empty($register_link) ? $register_link : FALSE, get_defined_vars());
}
开发者ID:codeforest,项目名称:s2member,代码行数:31,代码来源:register-access.inc.php
示例12: register_link_gen
/**
* Generates Registration Access Links.
*
* @package s2Member\Registrations
* @since 3.5
*
* @param string $subscr_gateway Payment Gateway associated with a Customer.
* @param string $subscr_id Unique Subscr. ID associated with Payment Gateway; associated with a Customer.
* @param string $custom Custom String value *(as supplied in Shortcode)*; must start with installation domain name.
* @param int|string $item_number An s2Member-generated `item_number` *( i.e. `1` for Level 1, or `level|ccaps|fixed-term`, or `sp|ids|expiration` )*.
* @param bool $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
* @return string|bool A Registration Access Link on success, else false on failure.
*/
public static function register_link_gen($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_register_link_gen", get_defined_vars());
unset($__refs, $__v);
if ($subscr_gateway && is_string($subscr_gateway) && $subscr_id && is_string($subscr_id) && $custom && is_string($custom) && $item_number && (is_string($item_number) || is_numeric($item_number))) {
$register = c_ws_plugin__s2member_utils_encryption::encrypt("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime("now"));
$register_link = site_url("/?s2member_register=" . urlencode($register));
// Generate long URL/link.
if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($register_link))) {
$register_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
}
}
return apply_filters("ws_plugin__s2member_register_link_gen", !empty($register_link) ? $register_link : false, get_defined_vars());
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:30,代码来源:register-access.inc.php
示例13: sp_access_link_gen
/**
* Generates Specific Post/Page Access links.
*
* @package s2Member\SP_Access
* @since 3.5
*
* @param string|int $sp_ids Comma-delimited list of Specific Post/Page IDs *(numerical)*.
* @param int|string $hours Optional. A numeric expiration time for this link, in hours. Defaults to `72`.
* @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API.
* @return str|bool A Specific Post/Page Access Link, or false on failure.
*/
public static function sp_access_link_gen($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars());
unset($__refs, $__v);
if ((is_string($sp_ids) || is_numeric($sp_ids)) && ($sp_ids = preg_replace("/[^0-9;,]/", "", $sp_ids)) && ($leading_id = preg_replace("/^([0-9]+).*\$/", "\$1", $sp_ids)) && is_numeric($hours)) {
$sp_access = c_ws_plugin__s2member_utils_encryption::encrypt("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime("now") . ":.:|:.:" . $hours);
$sp_access_link = add_query_arg("s2member_sp_access", urlencode($sp_access), get_permalink($leading_id));
// Generate long URL/link.
if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($sp_access_link))) {
$sp_access_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
}
}
return apply_filters("ws_plugin__s2member_sp_access_link_gen", !empty($sp_access_link) ? $sp_access_link : false, get_defined_vars());
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:28,代码来源:sp-access.inc.php
示例14: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|float|string $a The amount, in ``$from``.
* @param string $from Three character currency code.
* @param string $to Three character currency code.
*
* @return string A numeric amount in ``$to``, after having been converted. Else false.
*/
public static function convert($a = 0, $from = '', $to = '')
{
if (is_numeric($a) && strlen($from) === 3 && strlen($to) === 3) {
$regex = '/\\<span\\s+class\\s*\\=\\s*(?:["\'])?bld(?:["\'])?\\s*\\>(?P<conversion>[0-9.]+)\\s+' . preg_quote($to, '/') . '\\s*\\<\\/span\\>/i';
$endpoint = 'http://www.google.com/finance/converter?a=' . urlencode($a) . '&from=' . urlencode($from) . '&to=' . urlencode($to);
$prefix = 's2m_cur';
// Transient prefix.
$transient = $prefix . md5('s2member_cur_convert_' . $endpoint);
if (!($response = get_transient($transient))) {
$response = c_ws_plugin__s2member_utils_urls::remote($endpoint);
set_transient($transient, $response, DAY_IN_SECONDS / 2);
}
if ($response && preg_match($regex, $response, $m)) {
return number_format((double) $m['conversion'], 2, '.', '');
}
}
return '';
// Default return value.
}
开发者ID:adnandot,项目名称:intenseburn,代码行数:33,代码来源:utils-cur.inc.php
示例15: stripe_update
/**
* Handles processing of Pro-Form billing updates.
*
* @package s2Member\Stripe
* @since 140617
*
* @attaches-to ``add_action('init');``
*/
public static function stripe_update()
{
if (!empty($_POST['s2member_pro_stripe_update']['nonce']) && ($nonce = $_POST['s2member_pro_stripe_update']['nonce']) && wp_verify_nonce($nonce, 's2member-pro-stripe-update')) {
$GLOBALS['ws_plugin__s2member_pro_stripe_update_response'] = array();
// This holds the global response details.
$global_response =& $GLOBALS['ws_plugin__s2member_pro_stripe_update_response'];
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST['s2member_pro_stripe_update']));
$post_vars['attr'] = !empty($post_vars['attr']) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars['attr'])) : array();
$post_vars['attr'] = apply_filters('ws_plugin__s2member_pro_stripe_update_post_attr', $post_vars['attr'], get_defined_vars());
$post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
// Collect reCAPTCHA™ post vars.
if (!c_ws_plugin__s2member_pro_stripe_responses::stripe_form_attr_validation_errors($post_vars['attr'])) {
if (!($form_submission_validation_errors = c_ws_plugin__s2member_pro_stripe_responses::stripe_form_submission_validation_errors('update', $post_vars))) {
|
请发表评论