本文整理汇总了PHP中c_ws_plugin__s2member_utilities类的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utilities类的具体用法?PHP c_ws_plugin__s2member_utilities怎么用?PHP c_ws_plugin__s2member_utilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c_ws_plugin__s2member_utilities类的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: 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.
}
}
示例3: http_api_debug
/**
* Logs HTTP communication (if enabled).
*
* @package s2Member\Utilities
* @since 120212
*/
public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
{
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
return;
}
// Logging is NOT enabled in this case.
$is_s2member = !empty($args['s2member']) || strpos($url, 's2member') !== FALSE ? TRUE : FALSE;
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive'] && !$is_s2member) {
return;
}
// Extensive logging is NOT enabled in this case.
global $current_site, $current_blog;
// For Multisite support.
$http_api_debug = array('state' => $state, 'transport_class' => $class, 'args' => $args, 'url' => $url, 'response' => $response);
$logt = c_ws_plugin__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'] . "\n" . 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'];
$log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
$log2 = is_multisite() && !is_main_site() ? 'http-api-debug-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'http-api-debug.log';
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, TRUE));
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()) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive']) {
file_put_contents($logs_dir . '/wp-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
if ($is_s2member) {
// Log s2Member HTTP connections separately.
file_put_contents($logs_dir . '/s2-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
}
}
}
示例4: 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());
}
示例5: http_api_debug
/**
* Logs HTTP communication (if enabled).
*
* @package s2Member\Utilities
* @since 120212
*
* @return null Nothing.
*/
public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
{
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
return;
}
// Logging is NOT enabled in this case.
$is_s2member = !empty($args["s2member"]) || strpos($url, "s2member") !== false ? true : false;
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"] && !$is_s2member) {
return;
}
// Extensive logging is NOT enabled in this case.
global $current_site, $current_blog;
$http_api_debug = array("state" => $state, "transport_class" => $class, "args" => $args, "url" => $url, "response" => $response);
$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() ? "http-api-debug-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "http-api-debug.log";
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, true));
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()) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"]) {
file_put_contents($logs_dir . "/wp-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
if ($is_s2member) {
// Log s2Member HTTP connections separately.
file_put_contents($logs_dir . "/s2-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
}
}
}
示例6: 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. */
}
示例7: return_template_header
/**
* Applies custom Return Template Headers.
*
* @package s2Member\Return_Templates
* @since 110720
*
* @attaches-to ``add_filter('ws_plugin__s2member_return_template_header');``
*
* @param string $default_header The default header *(i.e., HTML code)*, passed through by the Filter.
* @param array $vars An array of defined variables, passed through by the Filter.
*
* @return string A custom Return Template Header, if configured, else the ``$default_header``.
*/
public static function return_template_header($default_header = '', $vars = array())
{
if (!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_' . $vars['template'] . '_return_template_header'])) {
$code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_' . $vars['template'] . '_return_template_header'];
$code = !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code;
return $custom_header = $code;
}
return $default_header;
}
示例8: return_template_header
/**
* Applies custom Return Template Headers.
*
* @package s2Member\Return_Templates
* @since 110720
*
* @attaches-to ``add_filter("ws_plugin__s2member_return_template_header");``
*
* @param str $default_header The default header *(i.e. HTML code)*, passed through by the Filter.
* @param array $vars An array of defined variables, passed through by the Filter.
* @return str A custom Return Template Header, if configured, else the ``$default_header``.
*/
public static function return_template_header($default_header = FALSE, $vars = FALSE)
{
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $vars["template"] . "_return_template_header"])) {
$code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $vars["template"] . "_return_template_header"];
$code = !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code;
return $custom_header = $code;
}
return $default_header;
}
示例9: wp_footer_code
/**
* Generates footer code, when/if configured.
*
* @package s2Member\WP_Footer
* @since 110524RC
*
* @return null
*/
public static function wp_footer_code()
{
do_action('ws_plugin__s2member_before_wp_footer_code', get_defined_vars());
if ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['wp_footer_code']) {
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
echo do_shortcode($code) . "\n";
} else {
echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
}
}
do_action('ws_plugin__s2member_after_wp_footer_code', get_defined_vars());
}
示例10: wp_footer_code
/**
* Generates footer code, when/if configured.
*
* @package s2Member\WP_Footer
* @since 110524RC
*
* @return null
*/
public static function wp_footer_code()
{
do_action("ws_plugin__s2member_before_wp_footer_code", get_defined_vars());
if ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["wp_footer_code"]) {
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
echo do_shortcode($code) . "\n";
} else {
echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
}
}
do_action("ws_plugin__s2member_after_wp_footer_code", get_defined_vars());
return;
}
示例11: 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());
}
示例12: 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());
}
示例13: log_entry
/**
* Logs an entry.
*
* @since 130315
* @package s2Member\Utilities
*
* @param string $slug The file name; i.e., a slug.
* e.g., `mailchimp-api`, `s2-http-api-debug`.
*
* @param mixed $data The data to log.
*/
public static function log_entry($slug, $data)
{
if (!($slug = trim((string) $slug))) {
return;
}
// Not possible.
if (!$data) {
return;
}
// Nothing to log.
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
return;
}
// Nothing to do; logging not enabled right now.
if (!is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])) {
return;
}
// Log directory does not exist at this time.
if (!is_writable($logs_dir)) {
return;
}
// Not writable.
$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 = '';
// Initialize.
if (is_multisite() && !is_main_site()) {
// Child blog in a multisite network?
$log4 .= $GLOBALS['current_blog']->domain . $GLOBALS['current_blog']->path . "\n";
}
$log4 .= @$_SERVER['HTTP_HOST'] . @$_SERVER['REQUEST_URI'] . "\n";
$log4 .= 'User-Agent: ' . @$_SERVER['HTTP_USER_AGENT'];
$log2 = $slug . '-api.log';
// Initialize.
if (is_multisite() && !is_main_site()) {
// Child blog in a multisite network?
$log2 = $slug . '-api-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', $GLOBALS['current_blog']->domain . $GLOBALS['current_blog']->path), '-') . '.log';
}
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(print_r($data, TRUE)) . "\n\n", FILE_APPEND);
// Append to an existing log file; if exists.
}
示例14: 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();
}
示例15: S2FilePicker_init
function S2FilePicker_init()
{
if (is_plugin_active('s2member/s2member.php')) {
/**/
if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'])) {
if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
mkdir($files_dir, 0777, true);
}
}
/**/
if (is_dir($files_dir) && is_writable($files_dir)) {
if (!file_exists($htaccess = $files_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', false, get_defined_vars())) {
file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']["s2member"]["c"]['files_dir_htaccess']))));
}
}
add_action('media_buttons', 'S2FilePicker_btn', 20);
add_action('media_upload_s2fpicker', 'S2FilePicker_media_upload_handler');
add_action('media_upload_type_S2FilePicker_frame', 'S2FilePicker_media_upload_content');
} else {
add_action('admin_notices', 'S2FilePicker_warning');
}
}