PayPal Buy Now Button - Version 1.0.0

Version Description

  • Initial release

=

Download this release

Release Info

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

Version 1.0.0

Files changed (4) hide show
  1. readme.txt +80 -0
  2. screenshot-1.jpg +0 -0
  3. screenshot-2.jpg +0 -0
  4. wp-ecommerce-paypal.php +555 -0
readme.txt ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP eCommerce PayPal ===
2
+ Contributors: scottpaterson
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A7FUMHD643QZ6
4
+ Tags: ecommerce, paypal, button, buy now, shortcode, buy now button, paypal button, paypal buy now button, paypal plugin, paypal plugin for wordpress
5
+ Author URI: https://wpplugin.org
6
+ Requires at least: 3.0
7
+ Tested up to: 4.1
8
+ Stable tag: 1.0.0
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ Convert your website to a eCommerce website and start selling your product in just a few minutes. No Coding Required.
13
+
14
+ == Description ==
15
+ = Overview =
16
+
17
+ * The **WP eCommerce PayPal** WordPress Plugin makes it easy to turn your WordPress site into an eCommmerce website.
18
+
19
+ * Simply install the plugin, enter your PayPal business information on the settings page, and place the shortcode anywhere on your site where you want the PayPal button to show.
20
+
21
+ * WP eCommerce PayPal works with any WordPress theme.
22
+
23
+
24
+ = WP eCommerce PayPal Features =
25
+
26
+ * Works with any WordPress Theme
27
+ * Each button has its own product name and price
28
+ * Built in support for 18 languages
29
+ * Built in support 25 currencies
30
+ * PayPal testing through SandBox
31
+ * Choose 3 different button types.
32
+ * Choose how the PayPal window opens
33
+ * Choose cancel payment url
34
+ * Choose succesful payment url
35
+
36
+ > #### WP eCommerce PayPal Pro
37
+ > WP eCommerce PayPal Pro comes with the following features.<br />
38
+ >
39
+ > Charge Tax<br />
40
+ > Charge Shipping & Handling<br />
41
+ > Apply a discount amount or discount rate percentage<br />
42
+ > Add a drop-down menu with different prices and options<br />
43
+ > Add item weight & weight unit<br />
44
+ > Add a custom button image<br />
45
+ > Add an Item ID or SKU<br />
46
+ > Option to disable customer prompt for a note <br />
47
+ > Change text for PayPal's Return to Merchant button <br />
48
+ > Change button size in shortcode <br />
49
+ >
50
+ > [Wp eCommerce PayPal Pro >>](https://wpplugin.org/wp-ecommerce-paypal/)
51
+
52
+ == Installation ==
53
+
54
+ 1. Upload `wp-ecommerce-paypal.zip` to the `/wp-content/plugins/` directory
55
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
56
+ 3. In your sidebar, select 'Settings -> WP eCommerce Paypal' and configure the settings.
57
+ 4. Place `[wpecpp name='Product name goes here' price='6.99']` in a post or page where you want your a PayPal button to show.
58
+
59
+ == Frequently Asked Questions ==
60
+
61
+ = How do I use this plugin =
62
+ To use this plugin, simply configure the settings on the settings page, then place the following shortcode on any page or post you want the PayPal button to show:
63
+ `[wpecpp name='Product name goes here' price='6.99']`
64
+
65
+ = Can I put more then one shortcode on the same post / page? =
66
+ Yes, there is no limit to the amount you can put on one post / page, or your entire site.
67
+
68
+ == Screenshots ==
69
+ 1. Sample item for sale with PayPal button
70
+ 2. Settings page
71
+
72
+ == Changelog ==
73
+
74
+ = 1.0.0 =
75
+ * Initial release
76
+
77
+ == Upgrade Notice ==
78
+
79
+ = 1.0.0 =
80
+ Initial release
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
wp-ecommerce-paypal.php ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: WP eCommerce PayPal
5
+ Plugin URI: https://wpplugin.org/wp-ecommerce-paypal/
6
+ Description: A simple and easy way to integrate PayPal into your WordPress website.
7
+ Author: Scott Paterson
8
+ Author URI: https://wpplugin.org
9
+ License: GPL2
10
+ Version: 1.0
11
+ */
12
+
13
+ /* Copyright 2014-2015 Scott Paterson
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ // plugin functions
38
+ wpecppl_WPeCommerceLite::init_WPeCommerceLite();
39
+
40
+ class wpecppl_WPeCommerceLite {
41
+ public static function init_WPeCommerceLite() {
42
+ register_activation_hook( __FILE__, array( __CLASS__, "wpecppl_activate" ));
43
+ register_deactivation_hook( __FILE__, array( __CLASS__, "wpecppl_deactivate" ));
44
+ register_uninstall_hook( __FILE__, array( __CLASS__, "wpecppl_uninstall" ));
45
+
46
+
47
+ $WPeCommerceLiteoptions = array(
48
+ 'currency' => '25',
49
+ 'language' => '3',
50
+ 'liveaccount' => '',
51
+ 'sandboxaccount' => '',
52
+ 'mode' => '2',
53
+ 'size' => '2',
54
+ 'opens' => '2',
55
+ 'cancel' => '',
56
+ 'return' => '',
57
+ );
58
+
59
+ add_option("WPeCommerceLiteoptions", $WPeCommerceLiteoptions);
60
+ }
61
+ function wpecppl_activate() {
62
+ }
63
+ function wpecppl_deactivate() {
64
+ }
65
+ function wpecppl_uninstall() {
66
+ delete_option("WPeCommerceLiteoptions");
67
+ }
68
+ }
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ // settings page menu link
80
+ add_action( "admin_menu", "wpecppl_plugin_menu" );
81
+
82
+ function wpecppl_plugin_menu() {
83
+ add_options_page( "WP eCommerce PayPal", "WP eCommerce PayPal", "manage_options", "wp-ecommerce-lite", "wpecppl_plugin_options" );
84
+ }
85
+
86
+ add_filter('plugin_action_links', 'myplugin_plugin_action_links', 10, 2);
87
+
88
+ function myplugin_plugin_action_links($links, $file) {
89
+ static $this_plugin;
90
+
91
+ if (!$this_plugin) {
92
+ $this_plugin = plugin_basename(__FILE__);
93
+ }
94
+
95
+ if ($file == $this_plugin) {
96
+ // The "page" query string value must be equal to the slug
97
+ // of the Settings admin page we defined earlier, which in
98
+ // this case equals "myplugin-settings".
99
+ $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=wp-ecommerce-lite">Settings</a>';
100
+ array_unshift($links, $settings_link);
101
+ }
102
+
103
+ return $links;
104
+ }
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ // view admin page
119
+ function wpecppl_plugin_options() {
120
+ if ( !current_user_can( "manage_options" ) ) {
121
+ wp_die( __( "You do not have sufficient permissions to access this page." ) );
122
+ }
123
+
124
+
125
+
126
+
127
+
128
+ echo "<table width='100%'><tr><td width='65%'>";
129
+ echo "<h1><label style='color: #0074A2;'>WP eCommerce PayPal Settings</label></h1>";
130
+
131
+ echo "<form method='post' action='".$_SERVER["REQUEST_URI"]."'>";
132
+
133
+
134
+ // save and update options
135
+ if (isset($_POST['update'])) {
136
+
137
+ $options['currency'] = $_POST['currency'];
138
+ $options['language'] = $_POST['language'];
139
+ $options['liveaccount'] = $_POST['liveaccount'];
140
+ $options['sandboxaccount'] = $_POST['sandboxaccount'];
141
+ $options['mode'] = $_POST['mode'];
142
+ $options['size'] = $_POST['size'];
143
+ $options['opens'] = $_POST['opens'];
144
+ $options['cancel'] = $_POST['cancel'];
145
+ $options['return'] = $_POST['return'];
146
+
147
+
148
+
149
+ update_option("WPeCommerceLiteoptions", $options);
150
+
151
+ echo "<br /><div class='updated'><p><strong>"; _e("Settings Updated."); echo "</strong></p></div>";
152
+
153
+ }
154
+
155
+
156
+ // get options
157
+ $options = get_option('WPeCommerceLiteoptions');
158
+ foreach ($options as $k => $v ) { $value[$k] = $v; }
159
+
160
+
161
+ echo "</td><td></td></tr><tr><td>";
162
+
163
+
164
+
165
+
166
+
167
+ // form
168
+ echo "<br /><hr>";
169
+ ?>
170
+
171
+ <h3><label style="color: #0074A2;">Usage</label></h3>
172
+ To use this plugin, put the shortcode <b>[wpecpp name='example product name' price='6.99']</b> in your page or post anywhere you want the PayPal button to show.
173
+ You can put the shortcode as many times as you want in a post or page, there is no limit.
174
+
175
+ <br /><br /><hr>
176
+ <h3><label style="color: #0074A2;">Language & Currency</label></h3>
177
+
178
+ <b>Language:</b>
179
+ <select name="language">
180
+ <option <?php if ($value['language'] == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
181
+ <option <?php if ($value['language'] == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
182
+ <option <?php if ($value['language'] == "3") { echo "SELECTED"; } ?> value="3">English</option>
183
+ <option <?php if ($value['language'] == "4") { echo "SELECTED"; } ?> value="4">French</option>
184
+ <option <?php if ($value['language'] == "5") { echo "SELECTED"; } ?> value="5">German</option>
185
+ <option <?php if ($value['language'] == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
186
+ <option <?php if ($value['language'] == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
187
+ <option <?php if ($value['language'] == "9") { echo "SELECTED"; } ?> value="8">Japanese</option>
188
+ <option <?php if ($value['language'] == "10") { echo "SELECTED"; } ?> value="9">Norwgian</option>
189
+ <option <?php if ($value['language'] == "11") { echo "SELECTED"; } ?> value="10">Polish</option>
190
+ <option <?php if ($value['language'] == "12") { echo "SELECTED"; } ?> value="11">Portuguese</option>
191
+ <option <?php if ($value['language'] == "13") { echo "SELECTED"; } ?> value="12">Russian</option>
192
+ <option <?php if ($value['language'] == "14") { echo "SELECTED"; } ?> value="13">Spanish</option>
193
+ <option <?php if ($value['language'] == "15") { echo "SELECTED"; } ?> value="14">Swedish</option>
194
+ <option <?php if ($value['language'] == "16") { echo "SELECTED"; } ?> value="15">Simplified Chinese -China only</option>
195
+ <option <?php if ($value['language'] == "17") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
196
+ <option <?php if ($value['language'] == "18") { echo "SELECTED"; } ?> value="18">Traditional Chinese - Taiwan only</option>
197
+ <option <?php if ($value['language'] == "19") { echo "SELECTED"; } ?> value="17">Turkish</option>
198
+ <option <?php if ($value['language'] == "20") { echo "SELECTED"; } ?> value="18">Thai</option>
199
+ </select>
200
+
201
+ PayPal currently supports 18 languages.
202
+ <br /><br />
203
+
204
+ <b>Currency:</b>
205
+ <select name="currency">
206
+ <option <?php if ($value['currency'] == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
207
+ <option <?php if ($value['currency'] == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
208
+ <option <?php if ($value['currency'] == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
209
+ <option <?php if ($value['currency'] == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
210
+ <option <?php if ($value['currency'] == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
211
+ <option <?php if ($value['currency'] == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
212
+ <option <?php if ($value['currency'] == "6") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
213
+ <option <?php if ($value['currency'] == "7") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
214
+ <option <?php if ($value['currency'] == "8") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
215
+ <option <?php if ($value['currency'] == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
216
+ <option <?php if ($value['currency'] == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
217
+ <option <?php if ($value['currency'] == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
218
+ <option <?php if ($value['currency'] == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
219
+ <option <?php if ($value['currency'] == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
220
+ <option <?php if ($value['currency'] == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
221
+ <option <?php if ($value['currency'] == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
222
+ <option <?php if ($value['currency'] == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
223
+ <option <?php if ($value['currency'] == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
224
+ <option <?php if ($value['currency'] == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
225
+ <option <?php if ($value['currency'] == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
226
+ <option <?php if ($value['currency'] == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
227
+ <option <?php if ($value['currency'] == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
228
+ <option <?php if ($value['currency'] == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
229
+ <option <?php if ($value['currency'] == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
230
+ <option <?php if ($value['currency'] == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
231
+ </select>
232
+ PayPal currently supports 25 currencies.
233
+ <br /><br /><hr>
234
+
235
+ <?php
236
+
237
+
238
+ echo "<h3><label style='color: #0074A2;'>PayPal Account</label></h3>";
239
+
240
+ echo "<b>Live Account: </b><input type='text' name='liveaccount' value='".$value['liveaccount']."'> Required";
241
+ echo "<br />Enter a valid Merchant account ID (strongly recommend) or PayPal account email address. All payments will go to this account.";
242
+ echo "<br /><br />You can find your Merchant account ID in your PayPal account under Profile -> My business info -> Merchant account ID";
243
+
244
+ echo "<br /><br />If you don't have a PayPal account, you can sign up for free at <a target='_blank' href='https://paypal.com'>PayPal</a>. <br /><br />";
245
+
246
+
247
+ echo "<b>Sandbox Account: </b><input type='text' name='sandboxaccount' value='".$value['sandboxaccount']."'> Optional";
248
+ 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.";
249
+ 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 />";
250
+
251
+ echo "<b>Sandbox Mode:</b>";
252
+ echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "1") { echo "checked='checked'"; } echo " type='radio' name='mode' value='1'>On (Sandbox mode)";
253
+ echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "2") { echo "checked='checked'"; } echo " type='radio' name='mode' value='2'>Off (Live mode)";
254
+
255
+ echo "<br /><br /><hr>";
256
+
257
+
258
+
259
+ echo "<h3><label style='color: #0074A2;'>Other</label></h3>";
260
+
261
+ echo "<table><tr><td valign='top'>";
262
+ echo "<b>Button Size and type:</b></td><td valign='top'>";
263
+ echo "<input "; if ($value['size'] == "1") { echo "checked='checked'"; } echo " type='radio' name='size' value='1'>Small <br /><img src='https://www.paypalobjects.com/en_US/i/btn/btn_buynow_SM.gif'></td><td valign='top'>";
264
+ echo "<input "; if ($value['size'] == "2") { echo "checked='checked'"; } echo " type='radio' name='size' value='2'>Big <br /><img src='https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif'></td><td>";
265
+ echo "<input "; if ($value['size'] == "3") { echo "checked='checked'"; } echo " type='radio' name='size' value='3'>Big with credit cards <br /><img src='https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif'></td></tr></table><br />";
266
+
267
+ echo "<b>PayPal opens in:</b>";
268
+ echo "&nbsp; &nbsp; <input "; if ($value['opens'] == "1") { echo "checked='checked'"; } echo " type='radio' name='opens' value='1'>Same page";
269
+ echo "&nbsp; &nbsp; <input "; if ($value['opens'] == "2") { echo "checked='checked'"; } echo " type='radio' name='opens' value='2'>New page<br /><br />";
270
+
271
+
272
+ $siteurl = get_site_url();
273
+
274
+ echo "<b>Cancel URL: </b>";
275
+ echo "<input type='text' name='cancel' value='".$value['cancel']."'> Optional <br />";
276
+ echo "If the customer goes to PayPal and clicks the cancel button, where do they go. Example: $siteurl/cancel. Max length: 1,024. <br /><br />";
277
+
278
+ echo "<b>Return URL: </b>";
279
+ echo "<input type='text' name='return' value='".$value['return']."'> Optional <br />";
280
+ echo "If the customer goes to PayPal and successfully pays, where are they redirected to after. Example: $siteurl/thankyou. Max length: 1,024. <br /><br />";
281
+
282
+ ?>
283
+ <hr>
284
+
285
+
286
+ <input type='hidden' name='update'><br />
287
+ <input type='submit' name='btn2' class='button-primary' value='Save Settings'>
288
+
289
+
290
+ </form>
291
+
292
+ </td><td width='5%'>
293
+ </td><td width='30%' valign='top'>
294
+
295
+ <div style="background-color:#fff;padding: 5px;border: 1px solid #0074A2;">
296
+
297
+ <center><h1><label style="color: #0074A2;">Get more sales!</label></h1></center>
298
+
299
+ <center><b>Upgrade to WP eCommerce PayPal Pro</b></center>
300
+
301
+ <br />
302
+
303
+ Pro Features: <br />
304
+ &#10004; Charge Tax <br />
305
+ &#10004; Charge Shipping & Handling<br />
306
+ &#10004; Apply a discount amount <br />
307
+ &#10004; Apply a discount percentage<br />
308
+ &#10004; Add a menu with different prices / options<br />
309
+ &#10004; Add item weight & weight unit<br />
310
+ &#10004; Add a custom button image<br />
311
+ &#10004; Add an Item ID or SKU<br />
312
+ &#10004; Option to disable customer note field<br />
313
+ &#10004; Change text for PayPal's Return to Merchant button<br />
314
+ &#10004; Change button size in shortcode<br />
315
+
316
+ <br />
317
+
318
+ <center><a target='_blank' href="https://wpplugin.org/wp-ecommerce-paypal/" class='button-primary'>Buy Now</a></center>
319
+
320
+ </div>
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ </td></tr></table>
329
+
330
+
331
+ <?php
332
+
333
+
334
+ }
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+ // shortcode
343
+
344
+ add_shortcode('wpecpp', 'wpecppl_options');
345
+
346
+
347
+ function wpecppl_options($atts) {
348
+
349
+ // get shortcode user fields
350
+ $atts = shortcode_atts(array('name' => 'Example Name','price' => '0.00'), $atts);
351
+
352
+ // get settings page values
353
+ $options = get_option('WPeCommerceLiteoptions');
354
+ foreach ($options as $k => $v ) { $value[$k] = $v; }
355
+
356
+
357
+ // live of test mode
358
+ if ($value['mode'] == "1") {
359
+ $account = $value['sandboxaccount'];
360
+ $path = "sandbox.paypal";
361
+ } elseif ($value['mode'] == "2") {
362
+ $account = $value['liveaccount'];
363
+ $path = "paypal";
364
+ }
365
+
366
+ // currency
367
+ if ($value['currency'] == "1") { $currency = "AUD"; }
368
+ if ($value['currency'] == "2") { $currency = "BRL"; }
369
+ if ($value['currency'] == "3") { $currency = "CAD"; }
370
+ if ($value['currency'] == "4") { $currency = "CZK"; }
371
+ if ($value['currency'] == "5") { $currency = "DKK"; }
372
+ if ($value['currency'] == "6") { $currency = "EUR"; }
373
+ if ($value['currency'] == "6") { $currency = "HKD"; }
374
+ if ($value['currency'] == "7") { $currency = "HUF"; }
375
+ if ($value['currency'] == "8") { $currency = "ILS"; }
376
+ if ($value['currency'] == "10") { $currency = "JPY"; }
377
+ if ($value['currency'] == "11") { $currency = "MYR"; }
378
+ if ($value['currency'] == "12") { $currency = "MXN"; }
379
+ if ($value['currency'] == "13") { $currency = "NOK"; }
380
+ if ($value['currency'] == "14") { $currency = "NZD"; }
381
+ if ($value['currency'] == "15") { $currency = "PHP"; }
382
+ if ($value['currency'] == "16") { $currency = "PLN"; }
383
+ if ($value['currency'] == "17") { $currency = "GBP"; }
384
+ if ($value['currency'] == "18") { $currency = "RUB"; }
385
+ if ($value['currency'] == "19") { $currency = "SGD"; }
386
+ if ($value['currency'] == "20") { $currency = "SEK"; }
387
+ if ($value['currency'] == "21") { $currency = "CHF"; }
388
+ if ($value['currency'] == "22") { $currency = "TWD"; }
389
+ if ($value['currency'] == "23") { $currency = "THB"; }
390
+ if ($value['currency'] == "24") { $currency = "TRY"; }
391
+ if ($value['currency'] == "25") { $currency = "USD"; }
392
+
393
+ // language
394
+ if ($value['language'] == "1") {
395
+ $language = "da_DK";
396
+ $image = "https://www.paypalobjects.com/da_DK/i/btn/btn_buynow_SM.gif";
397
+ $imageb = "https://www.paypalobjects.com/da_DK/i/btn/btn_buynow_LG.gif";
398
+ $imagecc = "https://www.paypalobjects.com/da_DK/DK/i/btn/btn_buynowCC_LG.gif";
399
+ } //Danish
400
+
401
+ if ($value['language'] == "2") {
402
+ $language = "nl_BE";
403
+ $image = "https://www.paypalobjects.com/nl_NL/NL/i/btn/btn_buynow_SM.gif";
404
+ $imageb = "https://www.paypalobjects.com/nl_NL/NL/i/btn/btn_buynow_LG.gif";
405
+ $imagecc = "https://www.paypalobjects.com/nl_NL/NL/i/btn/btn_buynowCC_LG.gif";
406
+ } //Dutch
407
+
408
+ if ($value['language'] == "3") {
409
+ $language = "US_EN";
410
+ $image = "https://www.paypalobjects.com/en_US/i/btn/btn_buynow_SM.gif";
411
+ $imageb = "https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif";
412
+ $imagecc = "https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif";
413
+ } //English
414
+
415
+ if ($value['language'] == "4") {
416
+ $language = "fr_CA";
417
+ $image = "https://www.paypalobjects.com/fr_CA/i/btn/btn_buynow_SM.gif";
418
+ $imageb = "https://www.paypalobjects.com/fr_CA/i/btn/btn_buynow_LG.gif";
419
+ $imagecc = "https://www.paypalobjects.com/fr_CA/i/btn/btn_buynowCC_LG.gif";
420
+ } //French
421
+
422
+ if ($value['language'] == "5") {
423
+ $language = "de_DE";
424
+ $image = "https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynow_SM.gif";
425
+ $imageb = "https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynow_LG.gif";
426
+ $imagecc = "https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynowCC_LG.gif";
427
+ } //German
428
+
429
+ if ($value['language'] == "6") {
430
+ $language = "he_IL";
431
+ $image = "https://www.paypalobjects.com/he_IL/i/btn/btn_buynow_SM.gif";
432
+ $imageb = "https://www.paypalobjects.com/he_IL/i/btn/btn_buynow_LG.gif";
433
+ $imagecc = "https://www.paypalobjects.com/he_IL/IL/i/btn/btn_buynowCC_LG.gif";
434
+ } //Hebrew
435
+
436
+ if ($value['language'] == "7") {
437
+ $language = "it_IT";
438
+ $image = "https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynow_SM.gif";
439
+ $imageb = "https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynow_LG.gif";
440
+ $imagecc = "https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif";
441
+ } //Italian
442
+
443
+ if ($value['language'] == "9") {
444
+ $language = "ja_JP";
445
+ $image = "https://www.paypalobjects.com/ja_JP/JP/i/btn/btn_buynow_SM.gif";
446
+ $imageb = "https://www.paypalobjects.com/ja_JP/JP/i/btn/btn_buynow_LG.gif";
447
+ $imagecc = "https://www.paypalobjects.com/ja_JP/JP/i/btn/btn_buynowCC_LG.gif";
448
+ } //Japanese
449
+
450
+ if ($value['language'] == "10") {
451
+ $language = "no_NO";
452
+ $image = "https://www.paypalobjects.com/no_NO/i/btn/btn_buynow_SM.gif";
453
+ $imageb = "https://www.paypalobjects.com/no_NO/i/btn/btn_buynow_LG.gif";
454
+ $imagecc = "https://www.paypalobjects.com/no_NO/NO/i/btn/btn_buynowCC_LG.gif";
455
+ } //Norwgian
456
+
457
+ if ($value['language'] == "11") {
458
+ $language = "pl_PL";
459
+ $image = "https://www.paypalobjects.com/pl_PL/PL/i/btn/btn_buynow_SM.gif";
460
+ $imageb = "https://www.paypalobjects.com/pl_PL/PL/i/btn/btn_buynow_LG.gif";
461
+ $imagecc = "https://www.paypalobjects.com/pl_PL/PL/i/btn/btn_buynowCC_LG.gif";
462
+ } //Polish
463
+
464
+ if ($value['language'] == "12") {
465
+ $language = "pt_BR";
466
+ $image = "https://www.paypalobjects.com/pt_PT/PT/i/btn/btn_buynow_SM.gif";
467
+ $imageb = "https://www.paypalobjects.com/pt_PT/PT/i/btn/btn_buynow_LG.gif";
468
+ $imagecc = "https://www.paypalobjects.com/pt_PT/PT/i/btn/btn_buynowCC_LG.gif";
469
+ } //Portuguese
470
+
471
+ if ($value['language'] == "13") {
472
+ $language = "ru_RU";
473
+ $image = "https://www.paypalobjects.com/ru_RU/i/btn/btn_buynow_SM.gif";
474
+ $imageb = "https://www.paypalobjects.com/ru_RU/i/btn/btn_buynow_LG.gif";
475
+ $imagecc = "https://www.paypalobjects.com/ru_RU/RU/i/btn/btn_buynowCC_LG.gif";
476
+ } //Russian
477
+
478
+ if ($value['language'] == "14") {
479
+ $language = "es_ES";
480
+ $image = "https://www.paypalobjects.com/es_ES/ES/i/btn/btn_buynow_SM.gif";
481
+ $imageb = "https://www.paypalobjects.com/es_ES/ES/i/btn/btn_buynow_LG.gif";
482
+ $imagecc = "https://www.paypalobjects.com/es_ES/ES/i/btn/btn_buynowCC_LG.gif";
483
+ } //Spanish
484
+
485
+ if ($value['language'] == "15") {
486
+ $language = "sv_SE";
487
+ $image = "https://www.paypalobjects.com/sv_SE/i/btn/btn_buynow_SM.gif";
488
+ $imageb = "https://www.paypalobjects.com/sv_SE/i/btn/btn_buynow_LG.gif";
489
+ $imagecc = "https://www.paypalobjects.com/sv_SE/SE/i/btn/btn_buynowCC_LG.gif";
490
+ } //Swedish
491
+
492
+ if ($value['language'] == "16") {
493
+ $language = "zh_CN";
494
+ $image = "https://www.paypalobjects.com/zh_XC/i/btn/btn_buynow_SM.gif";
495
+ $imageb = "https://www.paypalobjects.com/zh_XC/i/btn/btn_buynow_LG.gif";
496
+ $imagecc = "https://www.paypalobjects.com/zh_XC/C2/i/btn/btn_buynowCC_LG.gif";
497
+ } //Simplified Chinese - China
498
+
499
+ if ($value['language'] == "17") {
500
+ $language = "zh_HK";
501
+ $image = "https://www.paypalobjects.com/zh_HK/i/btn/btn_buynow_SM.gif";
502
+ $imageb = "https://www.paypalobjects.com/zh_HK/i/btn/btn_buynow_LG.gif";
503
+ $imagecc = "https://www.paypalobjects.com/zh_HK/HK/i/btn/btn_buynowCC_LG.gif";
504
+ } //Traditional Chinese - Hong Kong
505
+
506
+ if ($value['language'] == "18") {
507
+ $language = "zh_TW";
508
+ $image = "https://www.paypalobjects.com/zh_TW/TW/i/btn/btn_buynow_SM.gif";
509
+ $imageb = "https://www.paypalobjects.com/zh_TW/TW/i/btn/btn_buynow_LG.gif";
510
+ $imagecc = "https://www.paypalobjects.com/zh_TW/TW/i/btn/btn_buynowCC_LG.gif";
511
+ } //Traditional Chinese - Taiwan
512
+
513
+ if ($value['language'] == "19") {
514
+ $language = "tr_TR";
515
+ $image = "https://www.paypalobjects.com/tr_TR/i/btn/btn_buynow_SM.gif";
516
+ $imageb = "https://www.paypalobjects.com/tr_TR/i/btn/btn_buynow_LG.gif";
517
+ $imagecc = "https://www.paypalobjects.com/tr_TR/TR/i/btn/btn_buynowCC_LG.gif";
518
+ } //Turkish
519
+
520
+ if ($value['language'] == "20") {
521
+ $language = "th_TH";
522
+ $image = "https://www.paypalobjects.com/th_TH/i/btn/btn_buynow_SM.gif";
523
+ $imageb = "https://www.paypalobjects.com/th_TH/i/btn/btn_buynow_LG.gif";
524
+ $imagecc = "https://www.paypalobjects.com/th_TH/TH/i/btn/btn_buynowCC_LG.gif";
525
+ } //Thai
526
+
527
+ if ($value['size'] == "1") { $img = $image; }
528
+ if ($value['size'] == "2") { $img = $imageb; }
529
+ if ($value['size'] == "3") { $img = $imagecc; }
530
+
531
+ // window action
532
+ if ($value['opens'] == "1") { $target = ""; }
533
+ if ($value['opens'] == "2") { $target = "_blank"; }
534
+
535
+ $output = "";
536
+ $output .= "<form target='$target' action='https://www.$path.com/cgi-bin/webscr' method='post'>";
537
+ $output .= "<input type='hidden' name='cmd' value='_xclick' />";
538
+ $output .= "<input type='hidden' name='business' value='$account' />";
539
+ $output .= "<input type='hidden' name='item_name' value='". $atts['name'] ."' />";
540
+ $output .= "<input type='hidden' name='currency_code' value='$currency' />";
541
+ $output .= "<input type='hidden' name='amount' value='". $atts['price'] ."' />";
542
+ $output .= "<input type='hidden' name='lc' value='$language'>";
543
+ $output .= "<input type='hidden' name='return' value='". $value['return'] ."' />";
544
+ $output .= "<input type='hidden' name='cancel_return' value='". $value['cancel'] ."' />";
545
+ $output .= "<input type='image' src='$img' border='0' name='submit' alt='Make your payments with PayPal. It is free, secure, effective.'>";
546
+ $output .= "<img alt='' border='0' src='https://www.paypal.com/it_IT/i/scr/pixel.gif' width='1' height='1'>";
547
+ $output .= "</form>";
548
+
549
+ return $output;
550
+
551
+ }
552
+
553
+
554
+
555
+ ?>