s2Member v110815
Source Code: s2member-pro\includes\classes\gateways\alipay\alipay-button-in.inc.php
Docs updated: August 15, 2011, 4:16 pm
Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member-pro\includes\classes\gateways\alipay\alipay-button-in.inc.php ?php /** * Shortcode `[s2Member-Pro-AliPay-Button /]` ( inner processing routines ). * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * This WordPress® plugin ( s2Member Pro ) is comprised of two parts: * * o (1) Its PHP code is licensed under the GPL license, as is WordPress®. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * o (2) All other parts of ( s2Member Pro ); including, but not limited to: * the CSS code, some JavaScript code, images, and design; * are licensed according to the license purchased. * See: {@link http://www.s2member.com/prices/} * * Unless you have our prior written consent, you must NOT directly or indirectly license, * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module; * or make an offer to do any of these things. All of these things are strictly * prohibited with part (2) of the s2Member Pro Module. * * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com * ( i.e. new features, bug fixes, updates, improvements ); along with full access * to our video tutorial library: {@link http://www.s2member.com/videos/} * * @package s2Member\AliPay * @since 1.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_pro_alipay_button_in" ) ) { /** * Shortcode `[s2Member-Pro-AliPay-Button /]` ( inner processing routines ). * * @package s2Member\AliPay * @since 1.5 */ class c_ws_plugin__s2member_pro_alipay_button_in { /** * Shortcode `[s2Member-Pro-AliPay-Button /]`. * * @package s2Member\AliPay * @since 1.5 * * @attaches-to ``add_shortcode("s2Member-Pro-AliPay-Button");`` * * @param array $attr An array of Attributes. * @param str $content Content inside the Shortcode. * @param str $shortcode The actual Shortcode name itself. * @return str The resulting AliPay® Button Code, HTML markup. */ public static function sc_alipay_button ( $attr = FALSE , $content = FALSE , $shortcode = FALSE ) { c_ws_plugin__s2member_no_cache:: no_cache_constants ( true ) ; /* No caching on pages that contain this Button. */ /**/ $attr = c_ws_plugin__s2member_utils_strings:: trim_quot_deep ( ( array ) $attr ) ; /* Force array, and fix " in attrs. */ /**/ $attr = shortcode_atts ( array ( "ids" = "0" , "exp" = "72" , "level" = "1" , "ccaps" = "" , "desc" = "" , "custom" = $_SERVER [ "HTTP_HOST" ] , "ra" = "0.01" , "rp" = "1" , "rt" = "M" , "sp" = "0" , "success" = "" , "image" = "default" , "output" = "anchor" ) , $attr ) ; /**/ $attr [ "rt" ] = strtoupper ( $attr [ "rt" ] ) ; /* Term lengths absolutely must be provided in upper-case format. Only after running shortcode_atts(). */ $attr [ "ccaps" ] = strtolower ( $attr [ "ccaps" ] ) ; /* Custom Capabilities must be typed in lower-case format. Only after running shortcode_atts(). */ $attr [ "success" ] = str_ireplace ( array ( "&" , "&" ) , "&" , $attr [ "success" ] ) ; /* Convert ampersands. */ /**/ if ( $attr [ "sp" ] ) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */ { $default_image = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member_pro" ] [ "c" ] [ "dir_url" ] . "/images/alipay-button.gif" ; /* Default Image. */ /**/ $attr [ "sp_ids_exp" ] = "sp:" . $attr [ "ids" ] . ":" . $attr [ "exp" ] ; /* Combined "sp:ids:expiration hours". */ /**/ $code = trim ( file_get_contents ( dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) . "/templates/buttons/alipay-sp-checkout-button.html" ) ) ; $code = preg_replace ( "/%%images%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member_pro" ] [ "c" ] [ "dir_url" ] . "/images" ) ) , $code ) ; $code = preg_replace ( "/%%wpurl%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr ( site_url ( ) ) ) , $code ) ; /**/ $vars = array ( "service" = "create_direct_pay_by_user" , "payment_type" = 1 , "partner" = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "pro_alipay_partner_id" ] , "seller_email" = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "pro_alipay_seller_email" ] , /**/ "subject" = $_SERVER [ "HTTP_HOST" ] , "body" = $attr [ "desc" ] , "out_trade_no" = uniqid ( ) . "~" . $attr [ "sp_ids_exp" ] . ( ( $referencing = c_ws_plugin__s2member_utils_users:: get_user_subscr_or_wp_id ( ) ) ? "~" . $referencing : "" ) . "~" . $_SERVER [ "REMOTE_ADDR" ] , "extra_common_param" = $attr [ "custom" ] , "total_fee" = $attr [ "ra" ] , "paymethod" = "directPay" , /**/ "show_url" = home_url ( "/" ) , "return_url" = ( ( $attr [ "success" ] ) ? $attr [ "success" ] : site_url ( "/?s2member_pro_alipay_return=1" ) ) , "notify_url" = site_url ( "/" ) ) ; /**/ $code = preg_replace ( "/%%url%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr (c_ws_plugin__s2member_pro_alipay_utilities:: alipay_link_gen ( $vars ) ) ) , $code ) ; /**/ $code = $_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" ) ? $code : $code ; /* Buttons already anchor format. */ $code = ( $attr [ "output" ] === "url" ) ? c_ws_plugin__s2member_pro_alipay_utilities:: alipay_link_gen ( $vars ) : $code ; } else /* Otherwise, we'll process this Button normally, using the Membership routines. */ { $default_image = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member_pro" ] [ "c" ] [ "dir_url" ] . "/images/alipay-button.gif" ; /* Default Image. */ /**/ $attr [ "desc" ] = ( ! $attr [ "desc" ] ) ? $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $attr [ "level" ] . "_label" ] : $attr [ "desc" ] ; /**/ $attr [ "level_ccaps_eotper" ] = ( $attr [ "rt" ] !== "L" ) ? $attr [ "level" ] . ":" . $attr [ "ccaps" ] . ":" . $attr [ "rp" ] . " " . $attr [ "rt" ] : $attr [ "level" ] . ":" . $attr [ "ccaps" ] ; $attr [ "level_ccaps_eotper" ] = rtrim ( $attr [ "level_ccaps_eotper" ] , ":" ) ; /* Clean any trailing separators from this string. */ /**/ $code = trim ( file_get_contents ( dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) . "/templates/buttons/alipay-checkout-button.html" ) ) ; $code = preg_replace ( "/%%images%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member_pro" ] [ "c" ] [ "dir_url" ] . "/images" ) ) , $code ) ; $code = preg_replace ( "/%%wpurl%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr ( site_url ( ) ) ) , $code ) ; /**/ $vars = array ( "service" = "create_direct_pay_by_user" , "payment_type" = 1 , "partner" = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "pro_alipay_partner_id" ] , "seller_email" = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "pro_alipay_seller_email" ] , /**/ "subject" = $_SERVER [ "HTTP_HOST" ] , "body" = $attr [ "desc" ] , "out_trade_no" = uniqid ( ) . "~" . $attr [ "level_ccaps_eotper" ] . ( ( $referencing = c_ws_plugin__s2member_utils_users:: get_user_subscr_or_wp_id ( ) ) ? "~" . $referencing : "" ) . "~" . $_SERVER [ "REMOTE_ADDR" ] , "extra_common_param" = $attr [ "custom" ] , "total_fee" = $attr [ "ra" ] , "paymethod" = "directPay" , /**/ "show_url" = home_url ( "/" ) , "return_url" = ( ( $attr [ "success" ] && ! $referencing ) ? $attr [ "success" ] : site_url ( "/?s2member_pro_alipay_return=1" ) ) , "notify_url" = site_url ( "/" ) ) ; /**/ $code = preg_replace ( "/%%url%%/" , c_ws_plugin__s2member_utils_strings:: esc_ds ( esc_attr (c_ws_plugin__s2member_pro_alipay_utilities:: alipay_link_gen ( $vars ) ) ) , $code ) ; /**/ $code = $_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" ) ? $code : $code ; /* Buttons already anchor format. */ $code = ( $attr [ "output" ] === "url" ) ? c_ws_plugin__s2member_pro_alipay_utilities:: alipay_link_gen ( $vars ) : $code ; } /**/ return $code ; /* The completed Button Code. */ } } } ? [ full view ]s2member-pro\includes\classes\gateways\alipay\alipay-button-in.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)Statistics: Posted by System Robot — August 15th, 2011, 3:16 pm
]]>