PayPal Buy Now Button - Version 1.6.2

Version Description

  • Small bug fixes
Download this release

Release Info

Developer scottpaterson
Plugin Icon 128x128 PayPal Buy Now Button
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6 to 1.6.2

Files changed (2) hide show
  1. readme.txt +8 -2
  2. wp-ecommerce-paypal.php +20 -39
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ecommerce, paypal, button, buy now, shortcode, buy now button, paypal butt
5
  Author URI: https://wpplugin.org
6
  Requires at least: 3.0
7
  Tested up to: 4.1.1
8
- Stable tag: 1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -44,7 +44,7 @@ Convert your website to a eCommerce website and start selling your product in ju
44
  > Charge Shipping & Handling per item<br />
45
  > Show Price Beside Button <br />
46
  > Show Name Beside Button <br />
47
- > Set Quantity per items <br />
48
  > Apply a Fixed Discount per item <br />
49
  > Apply a Discount Rate per item<br />
50
  > Add an Item ID or SKU<br />
@@ -85,6 +85,9 @@ Yes, there is no limit to the amount you can put on one post / page, or your ent
85
 
86
  == Changelog ==
87
 
 
 
 
88
  = 1.6 =
89
  * New Buy Now Button
90
 
@@ -138,6 +141,9 @@ Yes, there is no limit to the amount you can put on one post / page, or your ent
138
 
139
  == Upgrade Notice ==
140
 
 
 
 
141
  = 1.6 =
142
  New Buy Now Button
143
 
5
  Author URI: https://wpplugin.org
6
  Requires at least: 3.0
7
  Tested up to: 4.1.1
8
+ Stable tag: 1.6.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
44
  > Charge Shipping & Handling per item<br />
45
  > Show Price Beside Button <br />
46
  > Show Name Beside Button <br />
47
+ > Set a Quantity per item <br />
48
  > Apply a Fixed Discount per item <br />
49
  > Apply a Discount Rate per item<br />
50
  > Add an Item ID or SKU<br />
85
 
86
  == Changelog ==
87
 
88
+ = 1.6.2 =
89
+ * Small bug fixes
90
+
91
  = 1.6 =
92
  * New Buy Now Button
93
 
141
 
142
  == Upgrade Notice ==
143
 
144
+ = 1.6.2 =
145
+ Small bug fixes
146
+
147
  = 1.6 =
148
  New Buy Now Button
149
 
wp-ecommerce-paypal.php CHANGED
@@ -7,7 +7,7 @@ Description: A simple and easy way to integrate PayPal into your WordPress websi
7
  Author: Scott Paterson
8
  Author URI: https://wpplugin.org
9
  License: GPL2
10
- Version: 1.6
11
  */
12
 
13
  /* Copyright 2014-2015 Scott Paterson
@@ -29,13 +29,14 @@ Version: 1.6
29
 
30
 
31
 
32
-
33
-
34
 
35
 
36
  // add media button for editor page
37
  if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) && $typenow != 'download' ) {
38
 
 
 
39
  add_action('media_buttons', 'wpecpp_add_my_media_button', 20);
40
  function wpecpp_add_my_media_button() {
41
  echo '<a href="#TB_inline?width=600&height=400&inlineId=wpecpp_popup_container" title="Easy PayPal Button" id="insert-my-media" class="button thickbox">Easy PayPal Button</a>';
@@ -70,7 +71,7 @@ window.send_to_editor('[wpecpp name="' + scname + '" price="' + scprice + '"' +
70
 
71
  <div id="wpecpp_popup_container" style="display:none;">
72
 
73
- <h2>Insert a Buy Now Button Shortcode</h2>
74
 
75
  <table><tr><td>
76
 
@@ -100,14 +101,11 @@ Optional</td><td></td></tr><tr><td>
100
 
101
 
102
 
103
-
104
-
105
  // plugin functions
106
  wpecpp_WPeCommerceLite::init_WPeCommerceLite();
107
 
108
  class wpecpp_WPeCommerceLite {
109
  public static function init_WPeCommerceLite() {
110
- register_activation_hook( __FILE__, array( __CLASS__, "wpecpp_activate" ));
111
  register_deactivation_hook( __FILE__, array( __CLASS__, "wpecpp_deactivate" ));
112
  register_uninstall_hook( __FILE__, array( __CLASS__, "wpecpp_uninstall" ));
113
 
@@ -135,8 +133,6 @@ $wpecpp_settingsoptions = array(
135
 
136
  add_option("wpecpp_settingsoptions", $wpecpp_settingsoptions);
137
  }
138
- function wpecpp_activate() {
139
- }
140
  function wpecpp_deactivate() {
141
  delete_option("wpecpp_my_plugin_notice_shown");
142
  }
@@ -187,8 +183,8 @@ function wpecpp_plugin_settings_link($links)
187
  {
188
  unset($links['edit']);
189
 
190
- $forum_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-ecommerce-paypal">' . __('Support', PTP_LOC) . '</a>';
191
- $premium_link = '<a href="https://wpplugin.org/easy-paypal-button/">' . __('Purchase Premium', PTP_LOC) . '</a>';
192
  array_push($links, $forum_link);
193
  array_push($links, $premium_link);
194
  return $links;
@@ -231,13 +227,6 @@ $options['size'] = $_POST['size'];
231
  $options['opens'] = $_POST['opens'];
232
  $options['cancel'] = $_POST['cancel'];
233
  $options['return'] = $_POST['return'];
234
- $options['note'] = $_POST['note'];
235
- $options['tax_rate'] = $_POST['tax_rate'];
236
- $options['tax'] = $_POST['tax'];
237
- $options['cbt'] = $_POST['cbt'];
238
- $options['upload_image'] = $_POST['upload_image'];
239
- $options['showprice'] = $_POST['showprice'];
240
- $options['showname'] = $_POST['showname'];
241
 
242
 
243
  update_option("wpecpp_settingsoptions", $options);
@@ -358,8 +347,10 @@ echo "<br /><br />If you don't have a PayPal account, you can sign up for free a
358
 
359
 
360
  echo "<b>Sandbox Account: </b><input type='text' name='sandboxaccount' value='".$value['sandboxaccount']."'> Optional";
361
- echo "<br />Enter a valid sandbox PayPal account email address. A Sandbox account is a fake account used for testing. This is useful to make sure your PayPal account and settings are working properly being going live.";
362
- echo "<br /><br />If you don't have a PayPal developer account, you can sign up for free at the <a target='_blank' href='https://developer.paypal.com/developer'>PayPal Developer</a> site. <br /><br />";
 
 
363
 
364
  echo "<b>Sandbox Mode:</b>";
365
  echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "1") { echo "checked='checked'"; } echo " type='radio' name='mode' value='1'>On (Sandbox mode)";
@@ -458,6 +449,9 @@ WPPlugin is an offical PayPal Partner. Various trademarks held by their respecti
458
  <center><label style="font-size:14pt;">With the Pro version you'll <br /> be able to: </label></center>
459
 
460
  <br />
 
 
 
461
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Charge Tax <br />
462
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Charge Shipping & Handling<br />
463
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Apply Discounts <br />
@@ -550,7 +544,7 @@ add_shortcode('wpecpp', 'wpecpp_options');
550
  function wpecpp_options($atts) {
551
 
552
  // get shortcode user fields
553
- $atts = shortcode_atts(array('name' => 'Example Name','price' => '0.00','discount_rate' => '','discount_amount' => '','weight' => '','shipping' => '','item_id' => '','size' => '','align' => ''), $atts);
554
 
555
  // get settings page values
556
  $options = get_option('wpecpp_settingsoptions');
@@ -763,18 +757,14 @@ if ($value['size'] == "5") { $img = $imagenew; }
763
  if ($value['opens'] == "1") { $target = ""; }
764
  if ($value['opens'] == "2") { $target = "_blank"; }
765
 
766
- // note action
767
- if ($value['note'] == "1") { $note = "0"; }
768
- if ($value['note'] == "2") { $note = "1"; }
769
-
770
- // weight unit
771
- if ($value['weight_unit'] == "1") { $weight_unit = "lbs"; }
772
- if ($value['weight_unit'] == "2") { $weight_unit = "kgs"; }
773
-
774
  // alignment
775
  if ($atts['align'] == "left") { $alignment = "style='float: left;'"; }
776
  if ($atts['align'] == "right") { $alignment = "style='float: right;'"; }
777
- if ($atts['align'] == "center") { $alignment = "style='margin-left: auto;margin-right: auto;width:107px'"; }
 
 
 
 
778
 
779
  $output = "";
780
  $output .= "<div $alignment>";
@@ -784,15 +774,6 @@ $output .= "<input type='hidden' name='business' value='$account' />";
784
  $output .= "<input type='hidden' name='item_name' value='". $atts['name'] ."' />";
785
  $output .= "<input type='hidden' name='currency_code' value='$currency' />";
786
  $output .= "<input type='hidden' name='amount' value='". $atts['price'] ."' />";
787
- $output .= "<input type='hidden' name='tax' value='". $value['tax'] ."' />";
788
- $output .= "<input type='hidden' name='tax_rate' value='". $value['tax_rate'] ."' />";
789
- $output .= "<input type='hidden' name='weight' value='". $atts['weight'] ."' />";
790
- $output .= "<input type='hidden' name='weight_unit' value='$weight_unit' />";
791
- $output .= "<input type='hidden' name='discount_amount' value='". $atts['discount_amount'] ."' />";
792
- $output .= "<input type='hidden' name='discount_rate' value='". $atts['discount_rate'] ."' />";
793
- $output .= "<input type='hidden' name='cbt' value='". $value['cbt'] ."' />";
794
- $output .= "<input type='hidden' name='shipping' value='". $atts['shipping'] ."' />";
795
- $output .= "<input type='hidden' name='item_number' value='". $atts['item_id'] ."' />";
796
  $output .= "<input type='hidden' name='lc' value='$language'>";
797
  $output .= "<input type='hidden' name='no_note' value='$note'>";
798
  $output .= "<input type='hidden' name='return' value='". $value['return'] ."' />";
7
  Author: Scott Paterson
8
  Author URI: https://wpplugin.org
9
  License: GPL2
10
+ Version: 1.6.2
11
  */
12
 
13
  /* Copyright 2014-2015 Scott Paterson
29
 
30
 
31
 
32
+ global $pagenow, $typenow;
 
33
 
34
 
35
  // add media button for editor page
36
  if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) && $typenow != 'download' ) {
37
 
38
+
39
+
40
  add_action('media_buttons', 'wpecpp_add_my_media_button', 20);
41
  function wpecpp_add_my_media_button() {
42
  echo '<a href="#TB_inline?width=600&height=400&inlineId=wpecpp_popup_container" title="Easy PayPal Button" id="insert-my-media" class="button thickbox">Easy PayPal Button</a>';
71
 
72
  <div id="wpecpp_popup_container" style="display:none;">
73
 
74
+ <h2>Insert a Buy Now Button</h2>
75
 
76
  <table><tr><td>
77
 
101
 
102
 
103
 
 
 
104
  // plugin functions
105
  wpecpp_WPeCommerceLite::init_WPeCommerceLite();
106
 
107
  class wpecpp_WPeCommerceLite {
108
  public static function init_WPeCommerceLite() {
 
109
  register_deactivation_hook( __FILE__, array( __CLASS__, "wpecpp_deactivate" ));
110
  register_uninstall_hook( __FILE__, array( __CLASS__, "wpecpp_uninstall" ));
111
 
133
 
134
  add_option("wpecpp_settingsoptions", $wpecpp_settingsoptions);
135
  }
 
 
136
  function wpecpp_deactivate() {
137
  delete_option("wpecpp_my_plugin_notice_shown");
138
  }
183
  {
184
  unset($links['edit']);
185
 
186
+ $forum_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-ecommerce-paypal">' . __('Support', 'PTP_LOC') . '</a>';
187
+ $premium_link = '<a target="_blank" href="https://wpplugin.org/easy-paypal-button/">' . __('Purchase Premium', 'PTP_LOC') . '</a>';
188
  array_push($links, $forum_link);
189
  array_push($links, $premium_link);
190
  return $links;
227
  $options['opens'] = $_POST['opens'];
228
  $options['cancel'] = $_POST['cancel'];
229
  $options['return'] = $_POST['return'];
 
 
 
 
 
 
 
230
 
231
 
232
  update_option("wpecpp_settingsoptions", $options);
347
 
348
 
349
  echo "<b>Sandbox Account: </b><input type='text' name='sandboxaccount' value='".$value['sandboxaccount']."'> Optional";
350
+ echo "<br />Enter a valid sandbox PayPal account email address. A Sandbox account is a PayPal accont with fake money used for testing. This is useful to make sure your PayPal account and settings are working properly being going live.";
351
+ echo "<br /><br />To create a Sandbox account, you first need a Developer Account. You can sign up for free at the <a target='_blank' href='https://www.paypal.com/webapps/merchantboarding/webflow/unifiedflow?execution=e1s2'>PayPal Developer</a> site. <br /><br />";
352
+
353
+ echo "Once you have made an account, create a Sandbox Business and Personal Account <a target='_blank' href='https://developer.paypal.com/webapps/developer/applications/accounts'>here</a>. Enter the Business acount email on this page and use the Personal account username and password to buy something on your site as a customer. <br /><br /><br />";
354
 
355
  echo "<b>Sandbox Mode:</b>";
356
  echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "1") { echo "checked='checked'"; } echo " type='radio' name='mode' value='1'>On (Sandbox mode)";
449
  <center><label style="font-size:14pt;">With the Pro version you'll <br /> be able to: </label></center>
450
 
451
  <br />
452
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Add a Dropdown Price Menu<br />
453
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Add a Dropdown Options Menu<br />
454
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Add Custom Text Fields<br />
455
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Charge Tax <br />
456
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Charge Shipping & Handling<br />
457
  <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div> Apply Discounts <br />
544
  function wpecpp_options($atts) {
545
 
546
  // get shortcode user fields
547
+ $atts = shortcode_atts(array('name' => 'Example Name','price' => '0.00','size' => '','align' => ''), $atts);
548
 
549
  // get settings page values
550
  $options = get_option('wpecpp_settingsoptions');
757
  if ($value['opens'] == "1") { $target = ""; }
758
  if ($value['opens'] == "2") { $target = "_blank"; }
759
 
 
 
 
 
 
 
 
 
760
  // alignment
761
  if ($atts['align'] == "left") { $alignment = "style='float: left;'"; }
762
  if ($atts['align'] == "right") { $alignment = "style='float: right;'"; }
763
+ if ($atts['align'] == "center") { $alignment = "style='margin-left: auto;margin-right: auto;width:170px'"; }
764
+
765
+ if (!isset($alignment)) { $alignment = ""; }
766
+
767
+ if (!isset($note)) { $note = ""; }
768
 
769
  $output = "";
770
  $output .= "<div $alignment>";
774
  $output .= "<input type='hidden' name='item_name' value='". $atts['name'] ."' />";
775
  $output .= "<input type='hidden' name='currency_code' value='$currency' />";
776
  $output .= "<input type='hidden' name='amount' value='". $atts['price'] ."' />";
 
 
 
 
 
 
 
 
 
777
  $output .= "<input type='hidden' name='lc' value='$language'>";
778
  $output .= "<input type='hidden' name='no_note' value='$note'>";
779
  $output .= "<input type='hidden' name='return' value='". $value['return'] ."' />";