Changeset 670301
- Timestamp:
- 02/19/2013 02:11:36 PM (13 years ago)
- Location:
- paypal-pay-buy-donation-and-cart-buttons-shortcode
- Files:
-
- 4 added
- 3 edited
-
tags/1.5 (added)
-
tags/1.5/admin-settings.php (added)
-
tags/1.5/paypal-pay-buy-cart-buttons.php (added)
-
tags/1.5/readme.txt (added)
-
trunk/admin-settings.php (modified) (1 diff)
-
trunk/paypal-pay-buy-cart-buttons.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
paypal-pay-buy-donation-and-cart-buttons-shortcode/trunk/admin-settings.php
r666765 r670301 201 201 <em>Possible Values</em>: " " or "<br />"</p> 202 202 203 <p><strong>amount_prompt:</strong> <br> 204 (boolean) (optional) Setting to "1" will enable user to enter amount they would like to pay.<br> 205 <em>Possible Values</em>: 1 or 0</p> 206 203 207 <p><strong>echo_link:</strong> <br> 204 208 (boolean) (optional) Set to "1" for linked output<br> 209 <em>Possible Values</em>: 1 or 0</p> 210 211 <p><strong>open_new_window:</strong> <br> 212 (boolean) (optional) Set to "1" to open payment page in a new window<br> 205 213 <em>Possible Values</em>: 1 or 0</p> 206 214 -
paypal-pay-buy-donation-and-cart-buttons-shortcode/trunk/paypal-pay-buy-cart-buttons.php
r666770 r670301 4 4 Plugin URI: http://mohsinrasool.wordpress.com/2013/01/11/wordpress-shortcode-for-paypal-pay-buy-donation-and-cart-buttons/ 5 5 Description: Add a "paypal_button" shortcode to display pay now, buy now, donation and add to cart PayPal buttons with facility to customize they paypal checkout page. 6 Version: 1. 46 Version: 1.5 7 7 Author: Mohsin Rasool 8 8 Author URI: http://mohsinrasool.wordpress.com 9 9 License: GPL2 10 Copyright 2013 Mohsin Rasool (email : mohsin.rasool@gmail.com)11 10 12 11 This program is free software; you can redistribute it and/or modify … … 26 25 27 26 function wpdev_paypal_button($atts, $content = null) { 28 extract(shortcode_atts(array(27 $final_atts = shortcode_atts(array( 29 28 'type'=> get_option('wpdev_paypal_button_type'), 30 29 'email' => get_option('wpdev_paypal_button_email'), … … 32 31 'id' => '', 33 32 'amount' => '', 33 'amount_prompt' => 0, 34 34 'quantity' => '1', 35 35 'echo_link' => false, … … 43 43 'btn_text' => '', 44 44 'btn_url' => get_option('wpdev_paypal_button_custom_url'), 45 'open_new_window' => 0, 45 46 'add_note'=>get_option('wpdev_paypal_button_add_note'), 46 47 'thankyou_page_url'=> get_option('wpdev_paypal_button_thankyou_url'), … … 50 51 'checkout_bg_color' => get_option('wpdev_paypal_button_checkout_bg_color'), 51 52 'button_subtype' => '', 52 ), $atts)); 53 ), $atts); 54 extract($final_atts); 53 55 54 56 global $post; … … 156 158 } 157 159 else { 160 $rand = rand(111,999); 158 161 if(!empty($btn_url)) 159 162 $btn_src = $btn_url; … … 169 172 } 170 173 171 $output = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="paypal_button_form" >';174 $output = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="paypal_button_form" '.($open_new_window ? "target='_blank'": "").'>'; 172 175 foreach($paypal_values as $name =>$val){ 173 176 switch($name){ 174 177 case 'amount': 175 $output .= '<input type="hidden" class="paypal_amount" name="'.$name.'" value="'.$val.'">'; 178 179 if($amount_prompt) 180 $output .= '<input type="text" class="paypal_amount" name="'.$name.'" value="'.$val.'">'.html_entity_decode($field_sep); 181 else 182 $output .= '<input type="hidden" class="paypal_amount" name="'.$name.'" value="'.$val.'">'; 176 183 $output .= '<input type="hidden" class="temp_amount" name="temp_'.$name.'" value="'.$val.'">'; 177 184 break; … … 186 193 $quantity = explode('-',$quantity); 187 194 if(is_numeric($quantity[0]) && is_numeric($quantity[1]) && $quantity[0]<$quantity[1]) { 188 $output .= '<select name="'.$quantity_field.'" class="paypal_quantity">';195 $output .= '<select name="'.$quantity_field.'" onchange="return '. apply_filters('paypal_button_cal_amount','adjustPayPalQuantity'.$rand.'(this);').'" class="paypal_quantity">'; 189 196 for($i=$quantity[0]; $i<=$quantity[1]; $i++) 190 197 $output .= '<option value="'.$i.'"> '.$i.$quantity_txt_postfix.' </option>'; … … 197 204 $quantity = explode(',',$quantity); 198 205 if(count($quantity)>0) { 199 $output .= '<select name="'.$quantity_field.'" class="paypal_quantity">';206 $output .= '<select name="'.$quantity_field.'" onchange="return '. apply_filters('paypal_button_cal_amount','adjustPayPalQuantity'.$rand.'(this);').'" class="paypal_quantity">'; 200 207 for($i=0; $i<count($quantity); $i++){ 201 208 if(is_numeric($quantity[$i])) … … 213 220 214 221 if(!empty($quantity) && ($type=='donation' || $type=='donate') ){ 215 $rand = rand(111,999);216 222 $output .= ' 217 223 <input type="image" class="paypal_button_form_submit" src="'.$btn_src.'" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" 218 onclick="return adjustPayPalQuantity'.$rand.'(this);">219 <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">224 onclick="return '. apply_filters('paypal_button_cal_amount','adjustPayPalQuantity'.$rand.'(this);').'"> 225 <img alt="" style="border:0;display:none" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> 220 226 </form> 221 227 '; … … 224 230 <script type="text/javascript"> 225 231 function adjustPayPalQuantity'.$rand.'(elem){ 226 if(jQuery(elem).siblings(".paypal_quantity")) {227 var qty = jQuery(elem).siblings(".paypal_quantity").val();232 var qty = jQuery(elem).parent().find(".paypal_quantity").val(); 233 if(typeof qty != "undefined" && !isNaN(parseInt(qty))) { 228 234 var amount = jQuery(elem).siblings(".temp_amount").val(); 229 235 jQuery(elem).siblings(".paypal_amount").val(qty * amount); … … 243 249 } 244 250 245 return $output;251 return apply_filters('paypal_button_output',$output, $final_atts); 246 252 } 247 253 -
paypal-pay-buy-donation-and-cart-buttons-shortcode/trunk/readme.txt
r666277 r670301 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.5.1 7 Stable tag: 1. 47 Stable tag: 1.5 8 8 Author: Mohsin Rasool 9 9 License: GPLv2 … … 25 25 - **Allow buyer to add a note to order** 26 26 - **Select language of your button.** Supports 17 widely used languages 27 - **Both Admin generated amount (based on quantity) and user filled amount payments** 27 28 28 29 Possible usage of the plugin are as follows … … 74 75 Possible Values: " " or "<br />" 75 76 77 **amount_prompt**: 78 (boolean) (optional) Setting to "1" will enable user to enter amount they would like to pay. 79 Possible Values: 1 or 0 80 76 81 **echo_link**: 77 82 (boolean) (optional) Set to "1" for linked output 83 Possible Values: 1 or 0 84 85 **open_new_window**: 86 (boolean) (optional) Set to "1" to open payment page in a new window 78 87 Possible Values: 1 or 0 79 88 … … 157 166 == Changelog == 158 167 168 = 1.5 = 169 * Added filters 170 * Added feature to open payment page in a new window 171 * Added feature to allow for user entered payments. 172 159 173 = 1.4 = 160 174 * Added support for 17 languages for PayPal buttons. … … 179 193 == Upgrade Notice == 180 194 195 = 1.5 = 196 * Added filters 197 * Added feature to open payment page in a new window 198 * Added feature to allow for user entered payments. 199 181 200 = 1.4 = 182 201 * Added support for multilingual buttons.
Note: See TracChangeset
for help on using the changeset viewer.