本文整理汇总了PHP中c_ws_plugin__s2member_utilities::ver_checksum方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utilities::ver_checksum方法的具体用法?PHP c_ws_plugin__s2member_utilities::ver_checksum怎么用?PHP c_ws_plugin__s2member_utilities::ver_checksum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utilities
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utilities::ver_checksum方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 str $code The PayPal® Button Code before encryption.
* @param array $vars An array of defined variables in the scope of the calling Filter.
* @return str The Resulting PayPal® Button Code *( possibly encrypted, depending on configuration )*.
*/
public static function sc_paypal_button_encryption($code = FALSE, $vars = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_sc_paypal_button_encryption", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __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());
/**/
eval('$_code = $vars["_code"]; $attr = $vars["attr"];');
/* Let's unpack ( i.e. use shorter references ) to these two important vars. */
/**/
if ($cache && ($transient = "s2m_btn_" . md5($code . c_ws_plugin__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/" . _x("en_US", "s2member-front paypal-button-lang-code", "s2member") . "/i/btn/btn_xpressCheckout.gif";
/**/
$code = preg_replace("/\\<img[^\\>]+\\>/i", "", $code);
/* Remove the 1x1 pixel tracking image that PayPal® sticks in there. */
$code = preg_replace("/(\\<input)([^\\>]+)(\\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code);
/* Use XHTML! */
/**/
$code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
/**/
$code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal®" /></a>' : $code;
$code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
/**/
$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. */
}
示例2: doctype_html_head
/**
* Returns a DOCTYPE tag along with the HEAD section and title tag.
*
* This method should NOT be called upon until
* {@link s2Member\API_Constants\c_ws_plugin__s2member_constants::constants()}
* has been processed. We need access to: ``WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5``.
*
* @package s2Member\Utilities
* @since 110720
*
* @param str $doctype_html_head_title Optional. The title of the HTML document being generated.
* @param str $doctype_html_head_action Optional. An action Hook to process during HEAD generation.
* @return str A DOCTYPE tag along with the HEAD section and title tag, configured by parameters.
*/
public static function doctype_html_head($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE)
{
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
/* Loads s2Member only. */
/**/
ob_start();
/* Start output buffering here so we can "return" the output from this utility. */
/**/
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
/**/
echo '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
echo '<head>' . "\n";
/**/
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
/**/
echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-includes/js/jquery/jquery.js?ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum()))) . '"></script>' . "\n";
echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-includes/js/l10n.js?ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum()))) . '"></script>' . "\n";
/**/
echo '<script type="text/javascript">' . "var pwsL10n = {empty: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Strength indicator", "s2member-front", "s2member")) . "', short: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Very weak", "s2member-front", "s2member")) . "', bad: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Weak", "s2member-front", "s2member")) . "', good: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Medium", "s2member-front", "s2member")) . "', strong: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Strong", "s2member-front", "s2member")) . "', mismatch: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("Mismatch", "s2member-front", "s2member")) . "'}; try{convertEntities(pwsL10n);}catch(e){};</script>" . "\n";
echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-admin/js/password-strength-meter.js?ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum()))) . '"></script>' . "\n";
/**/
echo '<script type="text/javascript" src="' . esc_attr($s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode(WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5) . "&qcABC=1&ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum())) . '"></script>' . "\n";
/**/
echo '<link href="' . esc_attr($s2o . "?ws_plugin__s2member_css=1&qcABC=1&ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum())) . '" type="text/css" rel="stylesheet" media="all" />' . "\n";
/**/
if ($doctype_html_head_title) {
/* Add <title></title> tag? */
echo '<title>' . $doctype_html_head_title . '</title>' . "\n";
}
/**/
if ($doctype_html_head_action) {
/* Add content from Hook? */
do_action($doctype_html_head_action, get_defined_vars());
}
/**/
echo '</head>' . "\n";
/**/
return ob_get_clean();
}
示例3: doctype_html_head
/**
* Returns a DOCTYPE tag along with the HEAD section and title tag.
*
* This method should NOT be called upon until
* {@link s2Member\API_Constants\c_ws_plugin__s2member_constants::constants()}
* has been processed. We need access to: ``WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5``.
*
* @package s2Member\Utilities
* @since 110720
*
* @param string $doctype_html_head_title Optional. The title of the HTML document being generated.
* @param string $doctype_html_head_action Optional. An action Hook to process during HEAD generation.
* @return string A DOCTYPE tag along with the HEAD section and title tag, configured by parameters.
*/
public static function doctype_html_head($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE)
{
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
// Loads s2Member only.
ob_start();
// Start output buffering here so we can "return" the output from this utility.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . "\n";
echo '<link href="' . esc_attr($s2o . "?ws_plugin__s2member_css=1&qcABC=1&ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum())) . '" type="text/css" rel="stylesheet" media="all" />' . "\n";
echo '<script type="text/javascript" src="' . esc_attr(site_url("/wp-includes/js/jquery/jquery.js?ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum()))) . '"></script>' . "\n";
echo '<script type="text/javascript" src="' . esc_attr($s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode(WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5) . "&qcABC=1&ver=" . urlencode(c_ws_plugin__s2member_utilities::ver_checksum())) . '"></script>' . "\n";
if ($doctype_html_head_title) {
// Add <title></title> tag?
echo '<title>' . $doctype_html_head_title . '</title>' . "\n";
}
if ($doctype_html_head_action) {
// Add content from Hook?
do_action($doctype_html_head_action, get_defined_vars());
}
echo '</head>' . "\n";
return ob_get_clean();
}
示例4: add_admin_styles
/**
* Enqueue styles for administrative menu pages.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @attaches-to ``add_action('admin_print_styles');``
*/
public static function add_admin_styles()
{
do_action('ws_plugin__s2member_before_add_admin_styles', get_defined_vars());
if (!empty($_GET['page']) && preg_match('/ws-plugin--s2member-/', $_GET['page'])) {
wp_enqueue_style('thickbox');
wp_enqueue_style('ws-plugin--s2member-menu-pages', admin_url('admin.php?ws_plugin__s2member_menu_pages_css=' . urlencode(mt_rand()), is_ssl() ? 'https' : 'http'), array('thickbox'), c_ws_plugin__s2member_utilities::ver_checksum(), 'all');
do_action('ws_plugin__s2member_during_add_admin_styles', get_defined_vars());
}
do_action('ws_plugin__s2member_after_add_admin_styles', get_defined_vars());
}
示例5: constants
//.........这里部分代码省略.........
* ```
* <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; !>
* ```
* ———— Shortcode & JavaScript Equivalents ————
* ```
* [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]
*
* <script type="text/javascript">
* document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1);
* </script>
* ```
*
* @package s2Member\API_Constants
* @since 3.5
*
* @var string
*
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
*
* @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
*/
if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1')) {
define('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1', $c[] = 'Customer IP Address');
}
/**
* PayPal value for Payment Buttons with input name: `os1`.
*
* This auto-fills the `os1` value in PayPal Button Codes,
* with the Customer's IP Address, via ``$_SERVER['REMOTE_ADDR']``.
*
* These five API Constants are special.
* o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
* o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
*
* They are used by the PayPal Button Generator for s2Member.
*
* The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
*
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
* when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
*
* Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
* you won't even see these, because they're added internally by the Shortcode processor.
*
* The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
*
* Anyway, these five API Constants are just documented here for clarity;
* you probably won't use any of these directly; the Button Generator pops them in.
*
* ———— Quick PHP Code Sample ————
* ```
* <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; !>
* ```
* ———— Shortcode & JavaScript Equivalents ————
* ```
* [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]
*
* <script type="text/javascript">
* document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1);
* </script>
* ```
*
* @package s2Member\API_Constants
* @since 3.5
*
* @var string
*
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
*
* @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
*/
if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1')) {
define('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1', $c[] = (string) @$_SERVER['REMOTE_ADDR']);
}
/*
Allows other Constants to be calculated with their checksums included too.
*/
$c = apply_filters('ws_plugin__s2member_during_constants_c', $c, get_defined_vars());
/**
* Used internally by s2Member to compare the value of all API Constants at once.
*
* @package s2Member\API_Constants
* @since 3.5
*
* @var string
*/
if (!defined('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5')) {
define('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5', md5(serialize($c) . c_ws_plugin__s2member_utilities::ver_checksum()));
}
/*
Calls the after Hook. Do NOT set Constants here.
*/
do_action('ws_plugin__s2member_after_constants', get_defined_vars());
}
示例6: add_js_w_globals
/**
* Enqueues JS file for theme integration.
*
* Be sure s2Member's API Constants are already defined before firing this.
*
* @package s2Member\CSS_JS
* @since 3.5
*
* @attaches-to ``add_action('wp_print_scripts');``
*
* @return null After enqueuing JS for theme integration.
*/
public static function add_js_w_globals()
{
global $pagenow;
// Need this for comparisons.
do_action('ws_plugin__s2member_before_add_js_w_globals', get_defined_vars());
if (!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js() || is_user_admin() && $pagenow === 'profile.php' && !current_user_can('edit_users')) {
$s2o = $GLOBALS['WS_PLUGIN__']['s2member']['c']['s2o_url'];
if (is_user_logged_in()) {
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
// An MD5 hash based on global key => values.
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
// For instance, the global variables may change when a User who is logged-in changes their Profile.
wp_enqueue_script('ws-plugin--s2member', $s2o . '?ws_plugin__s2member_js_w_globals=' . urlencode($md5) . '&qcABC=1', array('jquery'), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
} else {
// This essentially creates 2 versions of the script. One while logged in & another when not.
wp_enqueue_script('ws-plugin--s2member', $s2o . '?ws_plugin__s2member_js_w_globals=1&qcABC=1', array('jquery'), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
}
do_action('ws_plugin__s2member_during_add_js_w_globals', get_defined_vars());
}
do_action('ws_plugin__s2member_after_add_js_w_globals', get_defined_vars());
}
示例7: add_js_w_globals
/**
* Enqueues JS file for theme integration.
*
* Be sure s2Member's API Constants are already defined before firing this.
*
* @package s2Member\CSS_JS
* @since 3.5
*
* @attaches-to ``add_action("wp_print_scripts");``
*
* @return null After enqueuing JS for theme integration.
*/
public static function add_js_w_globals()
{
global $pagenow;
do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars());
if (!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js() || is_user_admin() && $pagenow === "profile.php" && !current_user_can("edit_users")) {
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
if (is_user_logged_in()) {
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
// For instance, the global variables may change when a User who is logged-in changes their Profile.
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode($md5) . "&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
} else {
// This essentially creates 2 versions of the script. One while logged in & another when not.
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
}
do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars());
}
do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars());
return;
}
示例8: add_js_w_globals
/**
* Enqueues JS file for theme integration.
*
* Be sure s2Member's API Constants are already defined before firing this.
*
* @package s2Member\CSS_JS
* @since 3.5
*
* @attaches-to ``add_action("wp_print_scripts");``
*
* @return null After enqueuing JS for theme integration.
*/
public static function add_js_w_globals()
{
global $pagenow;
/* Need this for comparisons. */
/**/
do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars());
/**/
if (!is_admin() || is_user_admin() && $pagenow === "profile.php" && !current_user_can("edit_users")) {
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
/**/
if (is_user_logged_in()) {
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
/* An MD5 hash based on global key => values. */
/* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
/* For instance, the global variables may change when a User who is logged-in changes their Profile. */
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode($md5) . "&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
} else {
/* This essentially creates 2 versions of the script. One while logged in & another when not. */
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
}
/**/
do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars());
}
/**/
do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars());
/**/
return;
/* Return for uniformity. */
}
示例9: add_admin_styles
/**
* Enqueue styles for administrative menu pages.
*
* @package s2Member\Menu_Pages
* @since 3.5
*
* @attaches-to ``add_action("admin_print_styles");``
*
* @return null
*/
public static function add_admin_styles()
{
do_action("ws_plugin__s2member_before_add_admin_styles", get_defined_vars());
/**/
if (!empty($_GET["page"]) && preg_match("/ws-plugin--s2member-/", $_GET["page"])) {
wp_enqueue_style("thickbox");
wp_enqueue_style("ws-plugin--s2member-menu-pages", site_url("/?ws_plugin__s2member_menu_pages_css=" . urlencode(mt_rand())), array("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum(), "all");
/**/
do_action("ws_plugin__s2member_during_add_admin_styles", get_defined_vars());
}
/**/
do_action("ws_plugin__s2member_after_add_admin_styles", get_defined_vars());
/**/
return;
/* Return for uniformity. */
}