Description
PayPal generated code for the buttons wasPay now – rather than Buy Now
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="herb@bobbingwide.com"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="item_name" value="An evening to Enjoy Discovering Wine"> <input type="hidden" name="item_number" value="EDW0128"> <input type="hidden" name="amount" value="25.00"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHostedGuest"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form>Donate
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="herb@bobbingwide.com"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="item_name" value="Bobbing Wide"> <input type="hidden" name="item_number" value="oik"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form>Add to cart
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="herb@bobbingwide.com"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="item_name" value="Find a ball tees"> <input type="hidden" name="item_number" value="FABT"> <input type="hidden" name="amount" value="4.99"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="button_subtype" value="products"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="tax_rate" value="0.000"> <input type="hidden" name="shipping" value="0.00"> <input type="hidden" name="add" value="1"> <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form>Note: Image locations are currently hardcoded for en_GB
Usage
bw_pp_shortcodes( $atts, $content, $tag );Parameters
- $atts
- ( mixed ) optional –
- $content
- ( mixed ) optional –
- $tag
- ( mixed ) optional –
Returns
voidSource
File name: oik/shortcodes/oik-paypal.phpLines:
1 to 100 of 164
function bw_pp_shortcodes( $atts=NULL, $content=null, $tag=null) { oik_require( "bobbforms.inc" ); // @TODO When the block is rendered then the default values are set if not already set. $bw_paypal_email = bw_array_get( $atts, "email", null ); if ( !$bw_paypal_email ) { $bw_paypal_email = bw_get_option( "paypal-email" ); } $atts['location'] = bw_array_get( $atts, "location", null ); if ( !$atts['location'] ) { $atts['location'] = bw_get_option( "paypal-country" ); } $bw_paypal_location = bw_array_get( $atts, "location", "GB" ); $atts['currency'] = bw_array_get( $atts, "currency", null ); if ( !$atts['currency'] ) { $atts['currency'] = bw_get_option( 'paypal-currency'); } $bw_paypal_currency = bw_array_get( $atts, "currency", 'GBP' ); // hardcoded at present $atts['productname'] = bw_array_get( $atts, "productname", "oik-plugin" ); $atts['sku'] = bw_array_get( $atts, "sku", "oik" ); $atts['type'] = bw_array_get( $atts, "type", "donate" ); $shipadd = bw_array_get( $atts, 'shipadd', 2 ); if (!is_numeric($shipadd)) $shipadd = '2'; // set up the common fields for the form $code = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">'; $code .= ihidden( "business", $bw_paypal_email ); $code .= ihidden( "lc", $bw_paypal_location ); $code .= ihidden( "currency_code", $bw_paypal_currency ); $code .= ihidden( "item_name", $atts['productname'] ); $code .= ihidden( "item_number", $atts['sku'] ); switch($atts['type']): case "pay": case "pay-noCC": $code .= ihidden( "cmd", "_xclick" ); $code .= ihidden( "amount", bw_array_get( $atts, 'amount', "0.00" ) ); $code .= ihidden( "button_subtype", "services" ); $code .= ihidden( "no_note", "0" ); if ( $atts['type'] === 'pay' ) { $code .= ihidden( "bn", "PP-BuyNowBF:btn_paynowCC_LG.gif:NonHostedGuest" ); $code.='<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">'; } else { $code .= ihidden( "bn", "PP-BuyNowBF:btn_paynow_LG.gif:NonHostedGuest" ); $code.= '<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">'; } // <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> // $code .= retimage( NULL, "https://www.paypal.com/en_GB/i/scr/pixel.gif", "", 1, 1 ); $code .= retetag( "form" ); break; case "buy": case "buy-noCC": /* Buy Now and Pay Now are very similar except for the buttons. This one doesn't show the CC (credit cards) */ $code .= ihidden( "cmd", "_xclick" ); $code .= ihidden( "amount", $atts['amount'] ); $code .= ihidden( "button_subtype", "services" ); $code .= ihidden( "no_note", "0" ); if ( $atts['type'] === 'buy') { $code .= ihidden( "bn", "PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" ); $code.='<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">'; } else { $code .= ihidden( "bn", "PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" ); $code.='<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">'; } // <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> // $code .= retimage( NULL, "https://www.paypal.com/en_GB/i/scr/pixel.gif", "", 1, 1 ); $code .= retetag( "form" ); break; case "donate": $code .= ihidden( "cmd", "_donations" ); $code .= ihidden( "no_note", "0" ); $code .= ihidden( "bn", "PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest" ); $code .= '<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">'; //$code .= retimage( NULL, "https://www.paypal.com/en_GB/i/scr/pixel.gif", "", 1, 1 ); $code .= retetag( "form" ); break; case "add": $code .= ihidden( "cmd", "_cart" ); $code .= ihidden( "amount", bw_array_get( $atts, 'amount', "0.00" ) ); $code .= ihidden( "button_subtype", "products" ); $code .= ihidden( "no_note", "0" );View on GitHub View on Trac
Invoked by
Calls
1 to 5 of 5
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_get_option() – Get the value of an option field
- ihidden() – Return a hidden input field for a form
- oik_require() – Invoke require_once on an oik include file or other file
- retetag() – Return an end tag
