PayPal Donations - Version 1.9.6

Version Description

Download this release

Release Info

Developer mra13
Plugin Icon 128x128 PayPal Donations
Version 1.9.6
Comparing to
See all releases

Code changes from version 1.9.4 to 1.9.6

paypal-donations.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.tipsandtricks-hq.com/paypal-donations-widgets-plugin
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
  Author: Tips and Tricks HQ, Johan Steen
7
  Author URI: https://www.tipsandtricks-hq.com/
8
- Version: 1.9.4
9
  License: GPLv2 or later
10
  Text Domain: paypal-donations
11
  */
@@ -38,9 +38,9 @@ class PayPalDonations
38
  // Define constant data arrays
39
  // -------------------------------------------------------------------------
40
  private $donate_buttons = array(
41
- 'small' => 'https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif',
42
- 'large' => 'https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif',
43
- 'cards' => 'https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif'
44
  );
45
  private $currency_codes = array(
46
  'AUD' => 'Australian Dollars (A $)',
@@ -145,11 +145,11 @@ class PayPalDonations
145
  add_filter('widget_text', 'do_shortcode');
146
  add_shortcode('paypal-donation', array(&$this,'paypalShortcode'));
147
  add_action('wp_head', array($this, 'addCss'), 999);
 
 
148
 
149
- add_action(
150
- 'widgets_init',
151
- create_function('', 'register_widget("PayPalDonations_Widget");')
152
- );
153
  }
154
 
155
  /**
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
  Author: Tips and Tricks HQ, Johan Steen
7
  Author URI: https://www.tipsandtricks-hq.com/
8
+ Version: 1.9.6
9
  License: GPLv2 or later
10
  Text Domain: paypal-donations
11
  */
38
  // Define constant data arrays
39
  // -------------------------------------------------------------------------
40
  private $donate_buttons = array(
41
+ 'small' => 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',
42
+ 'large' => 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif',
43
+ 'cards' => 'https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif'
44
  );
45
  private $currency_codes = array(
46
  'AUD' => 'Australian Dollars (A $)',
145
  add_filter('widget_text', 'do_shortcode');
146
  add_shortcode('paypal-donation', array(&$this,'paypalShortcode'));
147
  add_action('wp_head', array($this, 'addCss'), 999);
148
+ add_action('widgets_init', array($this, 'handle_widgets_init'));
149
+ }
150
 
151
+ public function handle_widgets_init(){
152
+ register_widget("PayPalDonations_Widget");
 
 
153
  }
154
 
155
  /**
paypal_utility.php CHANGED
@@ -37,35 +37,29 @@ function pp_donations_validate_paypl_ipn() {
37
  $value = urlencode($value);
38
  }
39
  $req .= "&$key=$value";
40
- }
41
-
42
 
43
  // Step 2: POST IPN data back to PayPal to validate
44
- $ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
45
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
46
- curl_setopt($ch, CURLOPT_POST, 1);
47
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
48
- curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
49
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
50
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
51
-
52
- if (!($res = curl_exec($ch))) {
53
- // error_log("Got " . curl_error($ch) . " when processing IPN data");
54
- curl_close($ch);
55
- exit;
56
- }
57
- curl_close($ch);
58
 
59
- // Inspect IPN validation result and act accordingly
60
- if (strcmp ($res, "VERIFIED") == 0) {
 
 
61
  // The IPN is verified, process it
62
  $ipn_validated = true;
63
- } else if (strcmp ($res, "INVALID") == 0) {
64
  // IPN invalid, log for manual investigation
65
- $ipn_validated = false;
66
  }
67
 
68
-
69
  if (!$ipn_validated) {
70
  // IPN validation failed. Email the admin to notify this event.
71
  $admin_email = get_bloginfo('admin_email');
37
  $value = urlencode($value);
38
  }
39
  $req .= "&$key=$value";
40
+ }
 
41
 
42
  // Step 2: POST IPN data back to PayPal to validate
43
+ $params = array(
44
+ 'body' => $req,
45
+ 'timeout' => 60,
46
+ 'httpversion' => '1.1',
47
+ 'compress' => false,
48
+ 'decompress' => false,
49
+ 'user-agent' => 'PayPal Donations Plugin/TTHQ'
50
+ );
 
 
 
 
 
 
51
 
52
+ $connection_url = 'https://www.paypal.com/cgi-bin/webscr';
53
+ $response = wp_safe_remote_post( $connection_url, $params );
54
+
55
+ if ( ! is_wp_error( $response ) && strstr( $response[ 'body' ], 'VERIFIED' ) ) {
56
  // The IPN is verified, process it
57
  $ipn_validated = true;
58
+ } else {
59
  // IPN invalid, log for manual investigation
60
+ $ipn_validated = false;
61
  }
62
 
 
63
  if (!$ipn_validated) {
64
  // IPN validation failed. Email the admin to notify this event.
65
  $admin_email = get_bloginfo('admin_email');
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Tips and Tricks HQ, artstorm
3
  Donate link: https://www.tipsandtricks-hq.com/paypal-donations-widgets-plugin
4
  Tags: paypal, donation, donations, shortcode, widget, donate, button, sidebar, paypal donation, payment
5
  Requires at least: 3.0
6
- Tested up to: 4.9
7
- Stable tag: 1.9.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,6 +14,8 @@ Easy, simple setup to add a PayPal Donation button as a Widget or with a shortco
14
 
15
  Adds a PayPal donation shortcode and sidebar Widget to WordPress. The options menu lets you setup you PayPal ID and a few other optional settings. You can choose which donation button you want to use or if you want to use your own button. You can also set an optional default purpose and reference which can be overridden on each inserted instance with the shortcode options or in the Widget settings. There is also options available for currency, localization of the button, custom payment page style and the return page.
16
 
 
 
17
  = Widget =
18
 
19
  In the Appearance -> Widgets you'll find the PayPal Donations widget. After adding it to your sidebar you can enter a title for the Widget, some descriptive text that will appear above the button and specify an optional purpose and reference for the donation button to override the default settings.
@@ -88,6 +90,12 @@ for questions, answers, support and feature requests.
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
91
  = version 1.9.4 =
92
  * Added a new filter that allows overriding of the paypal email address dynamically.
93
 
3
  Donate link: https://www.tipsandtricks-hq.com/paypal-donations-widgets-plugin
4
  Tags: paypal, donation, donations, shortcode, widget, donate, button, sidebar, paypal donation, payment
5
  Requires at least: 3.0
6
+ Tested up to: 5.7
7
+ Stable tag: 1.9.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  Adds a PayPal donation shortcode and sidebar Widget to WordPress. The options menu lets you setup you PayPal ID and a few other optional settings. You can choose which donation button you want to use or if you want to use your own button. You can also set an optional default purpose and reference which can be overridden on each inserted instance with the shortcode options or in the Widget settings. There is also options available for currency, localization of the button, custom payment page style and the return page.
16
 
17
+ https://www.youtube.com/watch?v=oNRrN9qvUxI
18
+
19
  = Widget =
20
 
21
  In the Appearance -> Widgets you'll find the PayPal Donations widget. After adding it to your sidebar you can enter a title for the Widget, some descriptive text that will appear above the button and specify an optional purpose and reference for the donation button to override the default settings.
90
 
91
  == Changelog ==
92
 
93
+ = version 1.9.6 =
94
+ * Updated the PayPal button image URLs to the new URLs to remove the auto-redirect on them.
95
+
96
+ = version 1.9.5 =
97
+ * Removed a deprecated function for PHP 7.2.1
98
+
99
  = version 1.9.4 =
100
  * Added a new filter that allows overriding of the paypal email address dynamically.
101
 
views/admin.php CHANGED
@@ -1,14 +1,16 @@
1
  <!-- Create a header in the default WordPress 'wrap' container -->
2
  <div class="wrap">
3
- <div id="icon-plugins" class="icon32"></div>
4
  <h2>PayPal Donations</h2>
5
 
6
- <div style="background:#FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
7
  <p>
8
  The usage instruction and video tutorial is available on the PayPal Donations plugin <a href="https://www.tipsandtricks-hq.com/paypal-donations-widgets-plugin" target="_blank">documentation page</a>.
9
  </p>
10
  <p>
11
- If you need a feature rich and sleek plugin for accepting PayPal donation and payment then check out our <a target="_blank" href="https://www.tipsandtricks-hq.com/wordpress-estore-plugin-complete-solution-to-sell-digital-products-from-your-wordpress-blog-securely-1059">WP eStore Plugin</a> (it comes with premium support). You can accept recurring payments with it also.
 
 
 
12
  </p>
13
  </div>
14
 
1
  <!-- Create a header in the default WordPress 'wrap' container -->
2
  <div class="wrap">
 
3
  <h2>PayPal Donations</h2>
4
 
5
+ <div style="background:#FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
6
  <p>
7
  The usage instruction and video tutorial is available on the PayPal Donations plugin <a href="https://www.tipsandtricks-hq.com/paypal-donations-widgets-plugin" target="_blank">documentation page</a>.
8
  </p>
9
  <p>
10
+ If you need a feature rich plugin for accepting PayPal donations and payments then check out our <a target="_blank" href="https://www.tipsandtricks-hq.com/wordpress-estore-plugin-complete-solution-to-sell-digital-products-from-your-wordpress-blog-securely-1059">WP eStore Plugin</a> (it comes with premium support). You can accept recurring payments with it also.
11
+ </p>
12
+ <p>
13
+ If you want to sell your products using PayPal's Express Checkout API, try our free <a href="https://wordpress.org/plugins/wp-express-checkout/" target="_blank">WP Express Checkout</a> plugin.
14
  </p>
15
  </div>
16
 
views/paypal-button.php CHANGED
@@ -37,7 +37,7 @@ if (isset($pd_options['new_tab'])) {
37
  $notify_url = site_url() . '/?ppd_paypal_ipn=process';
38
  $paypal_btn .= $indent.'<input type="hidden" name="notify_url" value="' .esc_url($notify_url). '" />'.PHP_EOL; // Notify URL
39
  }
40
-
41
  // More Settings
42
  if (isset($pd_options['return_method']))
43
  $paypal_btn .= $indent.'<input type="hidden" name="rm" value="' .esc_attr($pd_options['return_method']). '" />'.PHP_EOL;
@@ -55,12 +55,12 @@ if (isset($pd_options['new_tab'])) {
55
  if ( $pd_options['button'] != "custom" && !$button_url){
56
  $button_localized = apply_filters('pd_button_localized_value', $button_localized);
57
  $button_url = str_replace('en_US', $button_localized, $donate_buttons[$pd_options['button']]);
58
- }
59
  $paypal_btn .= $indent.'<input type="image" style="cursor: pointer;" src="' .esc_url($button_url). '" name="submit" alt="PayPal - The safer, easier way to pay online." />'.PHP_EOL;
60
 
61
  // PayPal stats tracking
62
  if (!isset($pd_options['disable_stats']) or $pd_options['disable_stats'] != true)
63
- $paypal_btn .= $indent.'<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />'.PHP_EOL;
64
  echo $paypal_btn;
65
  ?>
66
  </div>
37
  $notify_url = site_url() . '/?ppd_paypal_ipn=process';
38
  $paypal_btn .= $indent.'<input type="hidden" name="notify_url" value="' .esc_url($notify_url). '" />'.PHP_EOL; // Notify URL
39
  }
40
+
41
  // More Settings
42
  if (isset($pd_options['return_method']))
43
  $paypal_btn .= $indent.'<input type="hidden" name="rm" value="' .esc_attr($pd_options['return_method']). '" />'.PHP_EOL;
55
  if ( $pd_options['button'] != "custom" && !$button_url){
56
  $button_localized = apply_filters('pd_button_localized_value', $button_localized);
57
  $button_url = str_replace('en_US', $button_localized, $donate_buttons[$pd_options['button']]);
58
+ }
59
  $paypal_btn .= $indent.'<input type="image" style="cursor: pointer;" src="' .esc_url($button_url). '" name="submit" alt="PayPal - The safer, easier way to pay online." />'.PHP_EOL;
60
 
61
  // PayPal stats tracking
62
  if (!isset($pd_options['disable_stats']) or $pd_options['disable_stats'] != true)
63
+ $paypal_btn .= $indent.'<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />'.PHP_EOL;
64
  echo $paypal_btn;
65
  ?>
66
  </div>