Version Description
Download this release
Release Info
Developer | artstorm |
Plugin | PayPal Donations |
Version | 1.8.3 |
Comparing to | |
See all releases |
Code changes from version 1.8.2 to 1.8.3
- paypal-donations.php +1 -1
- readme.txt +7 -2
- src/PayPalDonations/Admin.php +31 -0
- src/PayPalDonations/View.php +7 -2
- views/paypal-button.php +16 -17
paypal-donations.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://johansteen.se/code/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 |
Author: Johan Steen
|
7 |
Author URI: http://johansteen.se/
|
8 |
-
Version: 1.8.
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: paypal-donations
|
11 |
|
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: Johan Steen
|
7 |
Author URI: http://johansteen.se/
|
8 |
+
Version: 1.8.3
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: paypal-donations
|
11 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: artstorm
|
|
3 |
Donate link: http://johansteen.se/donate/
|
4 |
Tags: paypal, donation, shortcode, widget, donate, button, sidebar
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -82,6 +82,11 @@ Contributions are appreciated and encouraged.
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
= Version 1.8.2 - 22 Mar 2014 =
|
86 |
* Adds the option to have PayPal open in a new tab.
|
87 |
|
3 |
Donate link: http://johansteen.se/donate/
|
4 |
Tags: paypal, donation, shortcode, widget, donate, button, sidebar
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 1.8.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= Version 1.8.3 - 11 Apr 2014 =
|
86 |
+
* Adds a Remove Line Feeds option on the Advanced tab, that makes the PayPal
|
87 |
+
form output not be affected if using a theme or a plugin that modifies
|
88 |
+
WordPress to start auto styling shortcodes/widgets.
|
89 |
+
|
90 |
= Version 1.8.2 - 22 Mar 2014 =
|
91 |
* Adds the option to have PayPal open in a new tab.
|
92 |
|
src/PayPalDonations/Admin.php
CHANGED
@@ -320,6 +320,20 @@ class PayPalDonations_Admin
|
|
320 |
'description' => ''
|
321 |
)
|
322 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
add_settings_field(
|
324 |
'set_checkout_language',
|
325 |
__('Enable Checkout Language', PayPalDonations::TEXT_DOMAIN),
|
@@ -598,6 +612,23 @@ class PayPalDonations_Admin
|
|
598 |
echo "<p class='description'>{$args['description']}</p>";
|
599 |
}
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
public function setCheckoutLangugageCallback($args)
|
602 |
{
|
603 |
$optionKey = PayPalDonations::OPTION_DB_KEY;
|
320 |
'description' => ''
|
321 |
)
|
322 |
);
|
323 |
+
add_settings_field(
|
324 |
+
'remove_lf',
|
325 |
+
__('Remove Line Feeds', PayPalDonations::TEXT_DOMAIN),
|
326 |
+
array($this, 'removeLfCallback'),
|
327 |
+
self::PAGE_SLUG,
|
328 |
+
'extras_section',
|
329 |
+
array(
|
330 |
+
'label_for' => 'remove_lf',
|
331 |
+
'description' => __(
|
332 |
+
'Enable this if your theme or a plugin adds autostyling to shortcodes/widgets.',
|
333 |
+
PayPalDonations::TEXT_DOMAIN
|
334 |
+
),
|
335 |
+
)
|
336 |
+
);
|
337 |
add_settings_field(
|
338 |
'set_checkout_language',
|
339 |
__('Enable Checkout Language', PayPalDonations::TEXT_DOMAIN),
|
612 |
echo "<p class='description'>{$args['description']}</p>";
|
613 |
}
|
614 |
|
615 |
+
public function removeLfCallback($args)
|
616 |
+
{
|
617 |
+
$optionKey = PayPalDonations::OPTION_DB_KEY;
|
618 |
+
$options = get_option($optionKey);
|
619 |
+
$checked = isset($options['remove_lf']) ?
|
620 |
+
$options['remove_lf'] :
|
621 |
+
false;
|
622 |
+
echo "<input type='checkbox' id='remove_lf' ";
|
623 |
+
echo "name='{$optionKey}[remove_lf]' value='1' ";
|
624 |
+
if ($checked) {
|
625 |
+
echo 'checked ';
|
626 |
+
}
|
627 |
+
echo "/>";
|
628 |
+
|
629 |
+
echo "<p class='description'>{$args['description']}</p>";
|
630 |
+
}
|
631 |
+
|
632 |
public function setCheckoutLangugageCallback($args)
|
633 |
{
|
634 |
$optionKey = PayPalDonations::OPTION_DB_KEY;
|
src/PayPalDonations/View.php
CHANGED
@@ -9,7 +9,7 @@ class PayPalDonations_View
|
|
9 |
{
|
10 |
/**
|
11 |
* Render a View.
|
12 |
-
*
|
13 |
* @param string $view View to render.
|
14 |
* @param array $data Data to be used within the view.
|
15 |
* @return string The processed view.
|
@@ -18,12 +18,17 @@ class PayPalDonations_View
|
|
18 |
{
|
19 |
// Handle data
|
20 |
($data) ? extract($data) : null;
|
21 |
-
|
22 |
ob_start();
|
23 |
include(plugin_dir_path(__FILE__).'../../views/'.$view.'.php');
|
24 |
$view = ob_get_contents();
|
25 |
ob_end_clean();
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
return $view;
|
28 |
}
|
29 |
}
|
9 |
{
|
10 |
/**
|
11 |
* Render a View.
|
12 |
+
*
|
13 |
* @param string $view View to render.
|
14 |
* @param array $data Data to be used within the view.
|
15 |
* @return string The processed view.
|
18 |
{
|
19 |
// Handle data
|
20 |
($data) ? extract($data) : null;
|
21 |
+
|
22 |
ob_start();
|
23 |
include(plugin_dir_path(__FILE__).'../../views/'.$view.'.php');
|
24 |
$view = ob_get_contents();
|
25 |
ob_end_clean();
|
26 |
|
27 |
+
// Optimize the view by removing linefeeds and multiple spaces
|
28 |
+
if (isset($pd_options['remove_lf'])) {
|
29 |
+
$view = trim(preg_replace('/\s+/', ' ', $view));
|
30 |
+
}
|
31 |
+
|
32 |
return $view;
|
33 |
}
|
34 |
}
|
views/paypal-button.php
CHANGED
@@ -1,39 +1,38 @@
|
|
1 |
<!-- Begin PayPal Donations by http://johansteen.se/ -->
|
2 |
-
<form
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
} ?>
|
8 |
-
>
|
9 |
<div class="paypal-donations">
|
10 |
<input type="hidden" name="cmd" value="_donations" />
|
11 |
<input type="hidden" name="business" value="<?php echo $pd_options['paypal_account']; ?>" />
|
12 |
<?php
|
13 |
# Build the button
|
14 |
$paypal_btn = '';
|
|
|
15 |
|
16 |
// Optional Settings
|
17 |
if ($pd_options['page_style'])
|
18 |
-
$paypal_btn .= '<input type="hidden" name="page_style" value="' .$pd_options['page_style']. '" />';
|
19 |
if ($return_page)
|
20 |
-
$paypal_btn .= '<input type="hidden" name="return" value="' .$return_page. '" />'; // Return Page
|
21 |
if ($purpose)
|
22 |
-
$paypal_btn .= apply_filters('paypal_donations_purpose_html', '<input type="hidden" name="item_name" value="' .$purpose. '" />'); // Purpose
|
23 |
if ($reference)
|
24 |
-
$paypal_btn .= '<input type="hidden" name="item_number" value="' .$reference. '" />'; // LightWave Plugin
|
25 |
if ($amount)
|
26 |
-
$paypal_btn .= '<input type="hidden" name="amount" value="' . apply_filters( 'paypal_donations_amount', $amount ) . '" />';
|
27 |
|
28 |
// More Settings
|
29 |
if (isset($pd_options['return_method']))
|
30 |
-
$paypal_btn .= '<input type="hidden" name="rm" value="' .$pd_options['return_method']. '" />';
|
31 |
if (isset($pd_options['currency_code']))
|
32 |
-
$paypal_btn .= '<input type="hidden" name="currency_code" value="' .$pd_options['currency_code']. '" />';
|
33 |
if (isset($pd_options['button_localized']))
|
34 |
{ $button_localized = $pd_options['button_localized']; } else { $button_localized = 'en_US'; }
|
35 |
if (isset($pd_options['set_checkout_language']) and $pd_options['set_checkout_language'] == true)
|
36 |
-
$paypal_btn .= '<input type="hidden" name="lc" value="' .$pd_options['checkout_language']. '" />';
|
37 |
|
38 |
// Settings not implemented yet
|
39 |
// $paypal_btn .= '<input type="hidden" name="amount" value="20" />';
|
@@ -41,11 +40,11 @@
|
|
41 |
// Get the button URL
|
42 |
if ( $pd_options['button'] != "custom" && !$button_url)
|
43 |
$button_url = str_replace('en_US', $button_localized, $donate_buttons[$pd_options['button']]);
|
44 |
-
$paypal_btn .= '<input type="image" src="' .$button_url. '" name="submit" alt="PayPal - The safer, easier way to pay online." />';
|
45 |
|
46 |
// PayPal stats tracking
|
47 |
if (!isset($pd_options['disable_stats']) or $pd_options['disable_stats'] != true)
|
48 |
-
$paypal_btn .= '<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />';
|
49 |
echo $paypal_btn;
|
50 |
?>
|
51 |
</div>
|
1 |
<!-- Begin PayPal Donations by http://johansteen.se/ -->
|
2 |
+
<form action="<?php echo apply_filters( 'paypal_donations_url', 'https://www.paypal.com/cgi-bin/webscr'); ?>" method="post"<?php
|
3 |
+
if ($pd_options['new_tab']) {
|
4 |
+
echo ' target="_blank"';
|
5 |
+
}
|
6 |
+
?>>
|
|
|
|
|
7 |
<div class="paypal-donations">
|
8 |
<input type="hidden" name="cmd" value="_donations" />
|
9 |
<input type="hidden" name="business" value="<?php echo $pd_options['paypal_account']; ?>" />
|
10 |
<?php
|
11 |
# Build the button
|
12 |
$paypal_btn = '';
|
13 |
+
$indent = str_repeat(" ", 8);
|
14 |
|
15 |
// Optional Settings
|
16 |
if ($pd_options['page_style'])
|
17 |
+
$paypal_btn .= $indent.'<input type="hidden" name="page_style" value="' .$pd_options['page_style']. '" />'.PHP_EOL;
|
18 |
if ($return_page)
|
19 |
+
$paypal_btn .= $indent.'<input type="hidden" name="return" value="' .$return_page. '" />'.PHP_EOL; // Return Page
|
20 |
if ($purpose)
|
21 |
+
$paypal_btn .= apply_filters('paypal_donations_purpose_html', $indent.'<input type="hidden" name="item_name" value="' .$purpose. '" />'.PHP_EOL); // Purpose
|
22 |
if ($reference)
|
23 |
+
$paypal_btn .= $indent.'<input type="hidden" name="item_number" value="' .$reference. '" />'.PHP_EOL; // LightWave Plugin
|
24 |
if ($amount)
|
25 |
+
$paypal_btn .= $indent.'<input type="hidden" name="amount" value="' . apply_filters( 'paypal_donations_amount', $amount ) . '" />'.PHP_EOL;
|
26 |
|
27 |
// More Settings
|
28 |
if (isset($pd_options['return_method']))
|
29 |
+
$paypal_btn .= $indent.'<input type="hidden" name="rm" value="' .$pd_options['return_method']. '" />'.PHP_EOL;
|
30 |
if (isset($pd_options['currency_code']))
|
31 |
+
$paypal_btn .= $indent.'<input type="hidden" name="currency_code" value="' .$pd_options['currency_code']. '" />'.PHP_EOL;
|
32 |
if (isset($pd_options['button_localized']))
|
33 |
{ $button_localized = $pd_options['button_localized']; } else { $button_localized = 'en_US'; }
|
34 |
if (isset($pd_options['set_checkout_language']) and $pd_options['set_checkout_language'] == true)
|
35 |
+
$paypal_btn .= $indent.'<input type="hidden" name="lc" value="' .$pd_options['checkout_language']. '" />'.PHP_EOL;
|
36 |
|
37 |
// Settings not implemented yet
|
38 |
// $paypal_btn .= '<input type="hidden" name="amount" value="20" />';
|
40 |
// Get the button URL
|
41 |
if ( $pd_options['button'] != "custom" && !$button_url)
|
42 |
$button_url = str_replace('en_US', $button_localized, $donate_buttons[$pd_options['button']]);
|
43 |
+
$paypal_btn .= $indent.'<input type="image" src="' .$button_url. '" name="submit" alt="PayPal - The safer, easier way to pay online." />'.PHP_EOL;
|
44 |
|
45 |
// PayPal stats tracking
|
46 |
if (!isset($pd_options['disable_stats']) or $pd_options['disable_stats'] != true)
|
47 |
+
$paypal_btn .= $indent.'<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />'.PHP_EOL;
|
48 |
echo $paypal_btn;
|
49 |
?>
|
50 |
</div>
|