PayPal Donations - Version 1.3

Version Description

Download this release

Release Info

Developer artstorm
Plugin Icon 128x128 PayPal Donations
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

Files changed (2) hide show
  1. paypal-donations.php +12 -3
  2. readme.txt +4 -1
paypal-donations.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PayPal Donations
4
  Plugin URI: http://coding.cglounge.com/wordpress-plugins/paypal-donations/
5
  Description: Easy and simple setup and insertion of PayPal donate buttons with a shortcode or through a sidebar Widget. Donation purpose can be set for each button. A few other customization options are available as well.
6
- Version: 1.2
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: paypal-donations
@@ -110,21 +110,23 @@ class paypal_donations {
110
  extract(shortcode_atts(array(
111
  'purpose' => '',
112
  'reference' => '',
 
113
  ), $atts));
114
 
115
- return $this->generate_html($purpose, $reference);
116
  }
117
 
118
  /**
119
  * Generate the PayPal button HTML code
120
  *
121
  */
122
- function generate_html($purpose = null, $reference = null) {
123
  $pd_options = get_option($this->plugin_options);
124
 
125
  // Set overrides for purpose and reference if defined
126
  $purpose = (!$purpose) ? $pd_options['purpose'] : $purpose;
127
  $reference = (!$reference) ? $pd_options['reference'] : $reference;
 
128
 
129
  # Build the button
130
  $paypal_btn = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">';
@@ -141,6 +143,8 @@ class paypal_donations {
141
  $paypal_btn .= '<input type="hidden" name="item_name" value="' .$purpose. '" />'; // Purpose
142
  if ($reference)
143
  $paypal_btn .= '<input type="hidden" name="item_number" value="' .$reference. '" />'; // LightWave Plugin
 
 
144
 
145
  // More Settings
146
  if (isset($pd_options['currency_code']))
@@ -192,6 +196,7 @@ class paypal_donations {
192
  $pd_options['button'] = trim( $_POST['button'] );
193
  $pd_options['button_url'] = trim( $_POST['button_url'] );
194
  $pd_options['currency_code'] = trim( $_POST['currency_code'] );
 
195
  update_option($this->plugin_options, $pd_options);
196
  $this->admin_message( __( 'The PayPal Donations settings have been updated.', 'paypal-donations' ) );
197
  }
@@ -235,6 +240,10 @@ class paypal_donations {
235
  <h3><?php _e( 'Defaults', 'paypal-donations' ) ?></h3>
236
  <table class="form-table">
237
  <tr valign="top">
 
 
 
 
238
  <th scope="row"><label for="purpose"><?php _e( 'Purpose', 'paypal-donations' ) ?></label></th>
239
  <td><input name="purpose" type="text" id="purpose" value="<?php echo $pd_options['purpose']; ?>" class="regular-text" /><span class="setting-description"><br/><?php _e( 'The default purpose of a donation (Optional).', 'paypal-donations' ) ?></span></td>
240
  </tr>
3
  Plugin Name: PayPal Donations
4
  Plugin URI: http://coding.cglounge.com/wordpress-plugins/paypal-donations/
5
  Description: Easy and simple setup and insertion of PayPal donate buttons with a shortcode or through a sidebar Widget. Donation purpose can be set for each button. A few other customization options are available as well.
6
+ Version: 1.3
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: paypal-donations
110
  extract(shortcode_atts(array(
111
  'purpose' => '',
112
  'reference' => '',
113
+ 'amount' => '',
114
  ), $atts));
115
 
116
+ return $this->generate_html($purpose, $reference, $amount);
117
  }
118
 
119
  /**
120
  * Generate the PayPal button HTML code
121
  *
122
  */
123
+ function generate_html($purpose = null, $reference = null, $amount = null) {
124
  $pd_options = get_option($this->plugin_options);
125
 
126
  // Set overrides for purpose and reference if defined
127
  $purpose = (!$purpose) ? $pd_options['purpose'] : $purpose;
128
  $reference = (!$reference) ? $pd_options['reference'] : $reference;
129
+ $amount = (!$amount) ? $pd_options['amount'] : $amount;
130
 
131
  # Build the button
132
  $paypal_btn = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">';
143
  $paypal_btn .= '<input type="hidden" name="item_name" value="' .$purpose. '" />'; // Purpose
144
  if ($reference)
145
  $paypal_btn .= '<input type="hidden" name="item_number" value="' .$reference. '" />'; // LightWave Plugin
146
+ if ($amount)
147
+ $paypal_btn .= '<input type="hidden" name="amount" value="' .$amount. '" />';
148
 
149
  // More Settings
150
  if (isset($pd_options['currency_code']))
196
  $pd_options['button'] = trim( $_POST['button'] );
197
  $pd_options['button_url'] = trim( $_POST['button_url'] );
198
  $pd_options['currency_code'] = trim( $_POST['currency_code'] );
199
+ $pd_options['amount'] = trim( $_POST['amount'] );
200
  update_option($this->plugin_options, $pd_options);
201
  $this->admin_message( __( 'The PayPal Donations settings have been updated.', 'paypal-donations' ) );
202
  }
240
  <h3><?php _e( 'Defaults', 'paypal-donations' ) ?></h3>
241
  <table class="form-table">
242
  <tr valign="top">
243
+ <th scope="row"><label for="amount"><?php _e( 'Amount', 'paypal-donations' ) ?></label></th>
244
+ <td><input name="amount" type="text" id="amount" value="<?php echo $pd_options['amount']; ?>" class="regular-text" /><span class="setting-description"><br/><?php _e( 'The default amount for a donation (Optional).', 'paypal-donations' ) ?></span></td>
245
+ </tr>
246
+ <tr valign="top">
247
  <th scope="row"><label for="purpose"><?php _e( 'Purpose', 'paypal-donations' ) ?></label></th>
248
  <td><input name="purpose" type="text" id="purpose" value="<?php echo $pd_options['purpose']; ?>" class="regular-text" /><span class="setting-description"><br/><?php _e( 'The default purpose of a donation (Optional).', 'paypal-donations' ) ?></span></td>
249
  </tr>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://coding.cglounge.com/wordpress-plugins/paypal-donations/#pint
4
  Tags: paypal, donation, shortcode, widget, donate, button, sidebar
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
- Stable tag: 1.2
8
 
9
  Easy and simple setup and insertion of PayPal donate buttons with a shortcode or through a sidebar Widget. Donation purpose can be set for each button. A few other customization options are available as well.
10
 
@@ -57,6 +57,9 @@ Please visit [PayPal Donations' Comments](http://coding.cglounge.com/wordpress-p
57
 
58
  == Changelog ==
59
 
 
 
 
60
  = Version 1.2 - 18 June 2009 =
61
  * Added a sidebar Widget (WordPress 2.8 or newer)
62
 
4
  Tags: paypal, donation, shortcode, widget, donate, button, sidebar
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
+ Stable tag: 1.3
8
 
9
  Easy and simple setup and insertion of PayPal donate buttons with a shortcode or through a sidebar Widget. Donation purpose can be set for each button. A few other customization options are available as well.
10
 
57
 
58
  == Changelog ==
59
 
60
+ = Version 1.3 - 8 July 2009 =
61
+ * Added an option to set a default donation amount.
62
+
63
  = Version 1.2 - 18 June 2009 =
64
  * Added a sidebar Widget (WordPress 2.8 or newer)
65