PayPal Donation - Version 1.3.2

Version Description

  • 10/14/21
  • Fix - Security Issues
Download this release

Release Info

Developer scottpaterson
Plugin Icon 128x128 PayPal Donation
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

easy-paypal-donation.php CHANGED
@@ -1,103 +1,103 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /*
6
- Plugin Name: Accept Donations with PayPal
7
- Plugin URI: https://wpplugin.org/downloads/paypal-donation-pro/
8
- Description: A simple and easy way to accept PayPal donations on your website.
9
- Tags: donation, donate, donations, charity, paypal, paypal donation, ecommerce, gateway, payment, paypal button, paypal donation, paypal donate, paypal payment, paypal plugin
10
- Author: Scott Paterson
11
- Author URI: https://wpplugin.org
12
- License: GPL2
13
- Version: 1.3.1
14
- */
15
-
16
- /* Copyright 2014-2021 Scott Paterson
17
-
18
- This program is free software; you can redistribute it and/or modify
19
- it under the terms of the GNU General Public License as published by
20
- the Free Software Foundation; either version 2 of the License, or
21
- (at your option) any later version.
22
-
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
-
28
- You should have received a copy of the GNU General Public License
29
- along with this program; if not, write to the Free Software
30
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31
- */
32
-
33
- //// variables
34
- // plugin function = wpedon
35
- // shortcode = wpedon
36
- $plugin_basename = plugin_basename(__FILE__);
37
-
38
-
39
- //// plugin functions
40
- wpedon_wpeasydonation::init_wpedonwpeasydonation();
41
-
42
- class wpedon_wpeasydonation {
43
- public static function init_wpedonwpeasydonation() {
44
- register_deactivation_hook( __FILE__, array( __CLASS__, "wpedon_deactivate" ));
45
- register_uninstall_hook( __FILE__, array( __CLASS__, "wpedon_uninstall" ));
46
-
47
- $wpedon_settingsoptions = array(
48
- 'currency' => '25',
49
- 'language' => '3',
50
- 'liveaccount' => '',
51
- 'sandboxaccount' => '',
52
- 'mode' => '2',
53
- 'size' => '2',
54
- 'opens' => '2',
55
- 'no_note' => '1',
56
- 'no_shipping' => '1',
57
- 'cancel' => '',
58
- 'return' => '',
59
- 'note' => '1',
60
- 'upload_image' => '',
61
- );
62
-
63
- add_option("wpedon_settingsoptions", $wpedon_settingsoptions);
64
- }
65
-
66
- function wpedon_deactivate() {
67
- delete_option("wpedon_notice_shown");
68
- }
69
-
70
- function wpedon_uninstall() {
71
- }
72
- }
73
-
74
- //// plugin includes
75
-
76
- // private settings page
77
- include_once ('includes/private_functions.php');
78
-
79
- // private button inserter
80
- include_once ('includes/private_button_inserter.php');
81
-
82
- // private orders page
83
- include_once ('includes/private_orders.php');
84
-
85
- // private buttons page
86
- include_once ('includes/private_buttons.php');
87
-
88
- // private settings page
89
- include_once ('includes/private_settings.php');
90
-
91
- // public shortcode
92
- include_once ('includes/public_shortcode.php');
93
-
94
- // private filters
95
- include_once ('includes/private_filters.php');
96
-
97
- // private widget
98
- include_once ('includes/private_widget.php');
99
-
100
- // public ipn
101
- include_once ('includes/public_ipn.php');
102
-
103
  ?>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ /*
6
+ Plugin Name: Accept Donations with PayPal
7
+ Plugin URI: https://wpplugin.org/downloads/paypal-donation-pro/
8
+ Description: A simple and easy way to accept PayPal donations on your website.
9
+ Tags: donation, donate, donations, charity, paypal, paypal donation, ecommerce, gateway, payment, paypal button, paypal donation, paypal donate, paypal payment, paypal plugin
10
+ Author: Scott Paterson
11
+ Author URI: https://wpplugin.org
12
+ License: GPL2
13
+ Version: 1.3.2
14
+ */
15
+
16
+ /* Copyright 2014-2021 Scott Paterson
17
+
18
+ This program is free software; you can redistribute it and/or modify
19
+ it under the terms of the GNU General Public License as published by
20
+ the Free Software Foundation; either version 2 of the License, or
21
+ (at your option) any later version.
22
+
23
+ This program is distributed in the hope that it will be useful,
24
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ GNU General Public License for more details.
27
+
28
+ You should have received a copy of the GNU General Public License
29
+ along with this program; if not, write to the Free Software
30
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31
+ */
32
+
33
+ //// variables
34
+ // plugin function = wpedon
35
+ // shortcode = wpedon
36
+ $plugin_basename = plugin_basename(__FILE__);
37
+
38
+
39
+ //// plugin functions
40
+ wpedon_wpeasydonation::init_wpedonwpeasydonation();
41
+
42
+ class wpedon_wpeasydonation {
43
+ public static function init_wpedonwpeasydonation() {
44
+ register_deactivation_hook( __FILE__, array( __CLASS__, "wpedon_deactivate" ));
45
+ register_uninstall_hook( __FILE__, array( __CLASS__, "wpedon_uninstall" ));
46
+
47
+ $wpedon_settingsoptions = array(
48
+ 'currency' => '25',
49
+ 'language' => '3',
50
+ 'liveaccount' => '',
51
+ 'sandboxaccount' => '',
52
+ 'mode' => '2',
53
+ 'size' => '2',
54
+ 'opens' => '2',
55
+ 'no_note' => '1',
56
+ 'no_shipping' => '1',
57
+ 'cancel' => '',
58
+ 'return' => '',
59
+ 'note' => '1',
60
+ 'upload_image' => '',
61
+ );
62
+
63
+ add_option("wpedon_settingsoptions", $wpedon_settingsoptions);
64
+ }
65
+
66
+ function wpedon_deactivate() {
67
+ delete_option("wpedon_notice_shown");
68
+ }
69
+
70
+ function wpedon_uninstall() {
71
+ }
72
+ }
73
+
74
+ //// plugin includes
75
+
76
+ // private settings page
77
+ include_once ('includes/private_functions.php');
78
+
79
+ // private button inserter
80
+ include_once ('includes/private_button_inserter.php');
81
+
82
+ // private orders page
83
+ include_once ('includes/private_orders.php');
84
+
85
+ // private buttons page
86
+ include_once ('includes/private_buttons.php');
87
+
88
+ // private settings page
89
+ include_once ('includes/private_settings.php');
90
+
91
+ // public shortcode
92
+ include_once ('includes/public_shortcode.php');
93
+
94
+ // private filters
95
+ include_once ('includes/private_filters.php');
96
+
97
+ // private widget
98
+ include_once ('includes/private_widget.php');
99
+
100
+ // public ipn
101
+ include_once ('includes/public_ipn.php');
102
+
103
  ?>
includes/private_button_inserter.php CHANGED
@@ -1,116 +1,114 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- add_action('init', 'wpedon_button_media_buttons_init');
6
-
7
- function wpedon_button_media_buttons_init() {
8
- global $pagenow, $typenow;
9
-
10
- // add media button for editor page
11
- if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) && $typenow != 'download' ) {
12
-
13
- add_action('admin_footer', 'wpedon_button_add_inline_popup_content');
14
- add_action('media_buttons', 'wpedon_button_add_my_media_button', 20);
15
-
16
- // button
17
- function wpedon_button_add_my_media_button() {
18
- echo '<a href="#TB_inline?width=600&height=500&inlineId=wpedon_popup_container" title="Insert a PayPal Donation Button" id="insert-my-media" class="button thickbox">PayPal Donation Button</a>';
19
- }
20
-
21
- // popup
22
- function wpedon_button_add_inline_popup_content() {
23
- ?>
24
-
25
-
26
- <script type="text/javascript">
27
- function wpedon_button_InsertShortcode() {
28
-
29
- var id = document.getElementById("wpedon_button_id").value;
30
- var wpedon_alignmentc = document.getElementById("wpedon_align");
31
- var wpedon_alignmentb = wpedon_alignmentc.options[wpedon_alignmentc.selectedIndex].value;
32
-
33
- if(id == "No buttons found.") { alert("Error: Please select an existing button from the dropdown or make a new one."); return false; }
34
- if(id == "") { alert("Error: Please select an existing button from the dropdown or make a new one."); return false; }
35
-
36
- if(wpedon_alignmentb == "none") { var wpedon_alignment = ""; } else { var wpedon_alignment = ' align="' + wpedon_alignmentb + '"'; };
37
-
38
- window.send_to_editor('[wpedon id="' + id + '"' + wpedon_alignment + ']');
39
-
40
- document.getElementById("wpedon_button_id").value = "";
41
- wpedon_alignmentc.selectedIndex = null;
42
- }
43
- </script>
44
-
45
-
46
- <div id="wpedon_popup_container" style="display:none;">
47
-
48
-
49
- <h2>Insert a PayPal Donation Button</h2>
50
-
51
- <table><tr><td>
52
-
53
- Choose an existing button: </td></tr><tr><td>
54
- <select id="wpedon_button_id" name="wpedon_button_id">
55
- <?php
56
- $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
57
-
58
- $posts = get_posts($args);
59
-
60
- $count = "0";
61
-
62
- if (isset($posts)) {
63
-
64
- foreach ($posts as $post) {
65
-
66
- $id = $posts[$count]->ID;
67
- $post_title = $posts[$count]->post_title;
68
- $price = get_post_meta($id,'wpedon_button_price',true);
69
- $sku = get_post_meta($id,'wpedon_button_id',true);
70
-
71
- echo "<option value='$id'>";
72
- echo "Name: ";
73
- echo $post_title;
74
- echo " - Amount: ";
75
- echo $price;
76
- echo " - ID: ";
77
- echo $sku;
78
- echo "</option>";
79
-
80
- $count++;
81
- }
82
- }
83
- else {
84
- echo "<option>No buttons found.</option>";
85
- }
86
-
87
- ?>
88
- </select>
89
- </td></tr><tr><td>
90
- Make a new button: <a target="_blank" href="admin.php?page=wpedon_buttons&action=new">here</a><br />
91
- Manage existing buttons: <a target="_blank" href="admin.php?page=wpedon_buttons">here</a>
92
-
93
- </td></tr><tr><td>
94
- <br />
95
- </td></tr><tr><td>
96
-
97
- Alignment: </td></tr><tr><td>
98
- <select id="wpedon_align" name="wpedon_align" style="width:100%;max-width:190px;">
99
- <option value="none"></option>
100
- <option value="left">Left</option>
101
- <option value="center">Center</option>
102
- <option value="right">Right</option>
103
- </select> </td></tr><tr><td>Optional
104
-
105
- </td></tr><tr><td>
106
- <br />
107
- </td></tr><tr><td>
108
-
109
- <input type="button" id="wpedon-paypal-insert" class="button-primary" onclick="wpedon_button_InsertShortcode();" value="Insert Button">
110
-
111
- </td></tr></table>
112
- </div>
113
- <?php
114
- }
115
- }
116
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ add_action('init', 'wpedon_button_media_buttons_init');
6
+
7
+ function wpedon_button_media_buttons_init() {
8
+ global $pagenow, $typenow;
9
+
10
+ // add media button for editor page
11
+ if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) && $typenow != 'download' ) {
12
+
13
+ add_action('admin_footer', 'wpedon_button_add_inline_popup_content');
14
+ add_action('media_buttons', 'wpedon_button_add_my_media_button', 20);
15
+
16
+ // button
17
+ function wpedon_button_add_my_media_button() {
18
+ echo '<a href="#TB_inline?width=600&height=500&inlineId=wpedon_popup_container" title="Insert a PayPal Donation Button" id="insert-my-media" class="button thickbox">PayPal Donation Button</a>';
19
+ }
20
+
21
+ // popup
22
+ function wpedon_button_add_inline_popup_content() {
23
+ ?>
24
+
25
+
26
+ <script type="text/javascript">
27
+ function wpedon_button_InsertShortcode() {
28
+
29
+ var id = document.getElementById("wpedon_button_id").value;
30
+ var wpedon_alignmentc = document.getElementById("wpedon_align");
31
+ var wpedon_alignmentb = wpedon_alignmentc.options[wpedon_alignmentc.selectedIndex].value;
32
+
33
+ if(id == "No buttons found.") { alert("Error: Please select an existing button from the dropdown or make a new one."); return false; }
34
+ if(id == "") { alert("Error: Please select an existing button from the dropdown or make a new one."); return false; }
35
+
36
+ if(wpedon_alignmentb == "none") { var wpedon_alignment = ""; } else { var wpedon_alignment = ' align="' + wpedon_alignmentb + '"'; };
37
+
38
+ window.send_to_editor('[wpedon id="' + id + '"' + wpedon_alignment + ']');
39
+
40
+ document.getElementById("wpedon_button_id").value = "";
41
+ wpedon_alignmentc.selectedIndex = null;
42
+ }
43
+ </script>
44
+
45
+
46
+ <div id="wpedon_popup_container" style="display:none;">
47
+
48
+
49
+ <h2>Insert a PayPal Donation Button</h2>
50
+
51
+ <table><tr><td>
52
+
53
+ Choose an existing button: </td></tr><tr><td>
54
+ <select id="wpedon_button_id" name="wpedon_button_id">
55
+ <?php
56
+ $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
57
+
58
+ $posts = get_posts($args);
59
+
60
+ $count = "0";
61
+
62
+ if (isset($posts)) {
63
+
64
+ foreach ($posts as $post) {
65
+
66
+ $id = $posts[$count]->ID;
67
+ $post_title = $posts[$count]->post_title;
68
+ $price = get_post_meta($id,'wpedon_button_price',true);
69
+ $sku = get_post_meta($id,'wpedon_button_id',true);
70
+
71
+ printf('<option value="%d">Name: %s - Amount: %s - ID: %s</option>',
72
+ $id,
73
+ esc_html($post_title),
74
+ esc_html($price),
75
+ esc_html($sku)
76
+ );
77
+
78
+ $count++;
79
+ }
80
+ }
81
+ else {
82
+ echo "<option>No buttons found.</option>";
83
+ }
84
+
85
+ ?>
86
+ </select>
87
+ </td></tr><tr><td>
88
+ Make a new button: <a target="_blank" href="admin.php?page=wpedon_buttons&action=new">here</a><br />
89
+ Manage existing buttons: <a target="_blank" href="admin.php?page=wpedon_buttons">here</a>
90
+
91
+ </td></tr><tr><td>
92
+ <br />
93
+ </td></tr><tr><td>
94
+
95
+ Alignment: </td></tr><tr><td>
96
+ <select id="wpedon_align" name="wpedon_align" style="width:100%;max-width:190px;">
97
+ <option value="none"></option>
98
+ <option value="left">Left</option>
99
+ <option value="center">Center</option>
100
+ <option value="right">Right</option>
101
+ </select> </td></tr><tr><td>Optional
102
+
103
+ </td></tr><tr><td>
104
+ <br />
105
+ </td></tr><tr><td>
106
+
107
+ <input type="button" id="wpedon-paypal-insert" class="button-primary" onclick="wpedon_button_InsertShortcode();" value="Insert Button">
108
+
109
+ </td></tr></table>
110
+ </div>
111
+ <?php
112
+ }
113
+ }
 
 
114
  }
includes/private_buttons.php CHANGED
@@ -1,361 +1,359 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- function wpedon_plugin_buttons() {
6
-
7
- if (!isset($_GET['action']) || $_GET['action'] == "delete" || !empty($_GET['action2']) == "delete") {
8
-
9
- // create a table
10
-
11
- if(!class_exists('WP_List_Table')) {
12
- require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
13
- }
14
-
15
- class wpedon_buttons_table extends WP_List_Table {
16
-
17
-
18
- function get_data() {
19
- global $wp_query;
20
-
21
- $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
22
-
23
- $posts = get_posts($args);
24
-
25
- $count = "0";
26
- foreach ($posts as $post) {
27
-
28
- $id = $posts[$count]->ID;
29
- $post_title = $posts[$count]->post_title;
30
-
31
- if ($post_title == "" || $post_title == " " || empty($post_title)) {
32
- $post_title = "(No Item Name)";
33
- }
34
-
35
- $shortcode = '<input type="text" value="[wpedon id='.$id.']">';
36
- $price = esc_attr(get_post_meta($id,'wpedon_button_price',true));
37
- $sku = esc_attr(get_post_meta($id,'wpedon_button_id',true));
38
-
39
- if (empty($price)) {
40
- $price = "Customer enters amount";
41
- }
42
-
43
-
44
- $product = $post_title;
45
-
46
- $data[] = array(
47
- 'ID' => $id,
48
- 'product' => $product,
49
- 'shortcode' => $shortcode,
50
- 'price' => $price,
51
- 'sku' => $sku
52
- );
53
-
54
- $count++;
55
- }
56
-
57
- if (empty($data)) {
58
- $data = array();
59
- }
60
-
61
- return $data;
62
- }
63
-
64
-
65
-
66
- function __construct() {
67
- global $status, $page;
68
-
69
- parent::__construct( array(
70
- 'singular' => 'product',
71
- 'plural' => 'products',
72
- 'ajax' => false
73
- ) );
74
- }
75
-
76
-
77
- function column_default($item, $column_name){
78
- switch($column_name){
79
- case 'product':
80
- case 'shortcode':
81
- case 'price':
82
- case 'sku':
83
- return $item[$column_name];
84
- default:
85
- return print_r($item,true);
86
- }
87
- }
88
-
89
- function column_product($item){
90
-
91
- // edit
92
- $edit_bare = '?page=wpedon_buttons&action=edit&product='.$item['ID'];
93
- $edit_url = wp_nonce_url($edit_bare, 'edit_'.$item['ID']);
94
-
95
- // delete
96
- $delete_bare = '?page=wpedon_buttons&action=delete&inline=true&product='.$item['ID'];
97
- $delete_url = wp_nonce_url($delete_bare, 'bulk-'.$this->_args['plural']);
98
-
99
- $actions = array(
100
- 'edit' => "<a href=$edit_url>Edit</a>",
101
- 'delete' => "<a href=$delete_url>Delete</a>"
102
- );
103
-
104
- return sprintf('%1$s %2$s',
105
- $item['product'],
106
- $this->row_actions($actions)
107
- );
108
- }
109
-
110
-
111
-
112
- function column_cb($item) {
113
- return sprintf(
114
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
115
- $this->_args['singular'],
116
- $item['ID']
117
- );
118
- }
119
-
120
-
121
- function get_columns() {
122
- $columns = array(
123
- 'cb' => '<input type="checkbox" />',
124
- 'product' => 'Name',
125
- 'shortcode' => 'Shortcode',
126
- 'price' => 'Amount',
127
- 'sku' => 'ID'
128
- );
129
- return $columns;
130
- }
131
-
132
-
133
- function no_items() {
134
- _e( 'No buttons found.' );
135
- }
136
-
137
-
138
- function get_bulk_actions() {
139
- $actions = array(
140
- 'delete' => 'Delete'
141
- );
142
- return $actions;
143
- }
144
-
145
- public function process_bulk_action() {
146
- if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) ) {
147
- $nonce = $_GET['_wpnonce'];
148
- $action = 'bulk-' . $this->_args['plural'];
149
-
150
- if ( ! wp_verify_nonce( $nonce, $action ) ) {
151
- wp_die('Security check fail');
152
- }
153
- }
154
- }
155
-
156
-
157
- function prepare_items() {
158
- global $wpdb;
159
-
160
- $per_page = 5;
161
-
162
- $columns = $this->get_columns();
163
- $hidden = array();
164
- $sortable = $this->get_sortable_columns();
165
-
166
- $this->_column_headers = array($columns, $hidden, $sortable);
167
-
168
- $this->process_bulk_action();
169
-
170
- $data = $this->get_data();
171
-
172
- function usort_reorder($a,$b) {
173
- $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'product';
174
- $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
175
- $result = strcmp($a[$orderby], $b[$orderby]);
176
- return ($order==='asc') ? $result : -$result;
177
- }
178
- usort($data, 'usort_reorder');
179
-
180
-
181
- $current_page = $this->get_pagenum();
182
-
183
-
184
-
185
- $total_items = count($data);
186
-
187
- $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
188
-
189
- $this->items = $data;
190
-
191
- $this->set_pagination_args( array(
192
- 'total_items' => $total_items,
193
- 'per_page' => $per_page,
194
- 'total_pages' => ceil($total_items/$per_page)
195
- ) );
196
-
197
- }
198
- }
199
-
200
-
201
- function wpedon_tt_render_list_page() {
202
-
203
- $testListTable = new wpedon_buttons_table();
204
- $testListTable->prepare_items();
205
-
206
- ?>
207
-
208
- <style>
209
- .check-column {
210
- width: 2% !important;
211
- }
212
- .column-product {
213
- width: 25%;
214
- }
215
- .column-shortcode {
216
- width: 35%;
217
- }
218
- .column-price {
219
- width: 25%;
220
- }
221
- .column-sku {
222
- width: 13%;
223
- }
224
- </style>
225
-
226
- <div style="width:98%">
227
-
228
- <table width="100%"><tr><td>
229
- <br />
230
- <span style="font-size:20pt;">PayPal Donation Buttons</span>
231
- </td><td valign="bottom">
232
- <a href="?page=wpedon_buttons&action=new" name='btn2' class='button-primary' style='font-size: 14px;height: 30px;float: right;'>New PayPal Donation Button</a>
233
- </td></tr></table>
234
-
235
- <?php
236
- if (isset($_GET['message']) && $_GET['message'] == "created") {
237
- echo "<div class='updated'><p>Button created.</p></div>";
238
- }
239
- if (isset($_GET['message']) && $_GET['message'] == "deleted") {
240
- echo "<div class='updated'><p>Button(s) deleted.</p></div>";
241
- }
242
- if (isset($_GET['message']) && $_GET['message'] == "nothing") {
243
- echo "<div class='updated'><p>No action selected.</p></div>";
244
- }
245
- if (isset($_GET['message']) && $_GET['message'] == "nothing_deleted") {
246
- echo "<div class='updated'><p>Nothing selected to delete.</p></div>";
247
- }
248
- if (isset($_GET['message']) && $_GET['message'] == "error") {
249
- echo "<div class='updated'><p>An error occured while processing the query. Please try again.</p></div>";
250
- }
251
- ?>
252
-
253
- <form id="products-filter" method="get">
254
- <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" />
255
- <?php $testListTable->display() ?>
256
- </form>
257
-
258
- </div>
259
-
260
- <?php
261
- }
262
-
263
- wpedon_tt_render_list_page();
264
-
265
-
266
- }
267
-
268
-
269
- // admin products page new product
270
- if (isset($_GET['action']) && $_GET['action'] == "new") {
271
- include_once ('private_buttons_new.php');
272
- }
273
- // end admin products page new product
274
-
275
- // admin products page edit product
276
- if (isset($_GET['action']) && $_GET['action'] == "edit") {
277
- $post_id = $_GET['product'];
278
- check_admin_referer('edit_'.$post_id);
279
- include_once ('private_buttons_edit.php');
280
- }
281
- // end admin products page edit product
282
-
283
- // admin products page delete product
284
- if (isset($_GET['action']) && $_GET['action'] == "delete" || isset($_GET['action2']) && $_GET['action2'] == "delete") {
285
-
286
- // check nonce for security
287
- $nonce = $_REQUEST['_wpnonce'];
288
- $action = 'bulk-products';
289
-
290
- if ( ! wp_verify_nonce( $nonce, $action ) ) {
291
- wp_die('Security check fail');
292
- }
293
-
294
- if (!empty($_GET['inline']) == "true") {
295
- $post_id = array($_GET['product']);
296
- } else {
297
- $post_id = $_GET['product'];
298
- }
299
-
300
- if (empty($post_id)) {
301
- echo'<script>window.location="?page=wpedon_buttons&message=nothing_deleted"; </script>';
302
- exit;
303
- }
304
-
305
- foreach ($post_id as $to_delete) {
306
-
307
- $to_delete = intval($to_delete);
308
-
309
- if (!$to_delete) {
310
- echo'<script>window.location="?page=wpedon_buttons&message=error"; </script>';
311
- exit;
312
- }
313
-
314
- wp_delete_post($to_delete,1);
315
- delete_post_meta($to_delete,'wpedon_button_price');
316
- delete_post_meta($to_delete,'wpedon_button_id');
317
- delete_post_meta($to_delete,'wpedon_button_enable_name');
318
- delete_post_meta($to_delete,'wpedon_button_enable_price');
319
- delete_post_meta($to_delete,'wpedon_button_enable_currency');
320
- delete_post_meta($to_delete,'wpedon_button_currency');
321
- delete_post_meta($to_delete,'wpedon_button_language');
322
- delete_post_meta($to_delete,'wpedon_button_account');
323
- delete_post_meta($to_delete,'wpedon_button_return');
324
- delete_post_meta($to_delete,'wpedon_button_buttonsize');
325
- delete_post_meta($to_delete,'wpedon_button_scpriceprice');
326
- delete_post_meta($to_delete,'wpedon_button_scpriceaname');
327
- delete_post_meta($to_delete,'wpedon_button_scpricebname');
328
- delete_post_meta($to_delete,'wpedon_button_scpricecname');
329
- delete_post_meta($to_delete,'wpedon_button_scpricedname');
330
- delete_post_meta($to_delete,'wpedon_button_scpriceename');
331
- delete_post_meta($to_delete,'wpedon_button_scpricefname');
332
- delete_post_meta($to_delete,'wpedon_button_scpricegname');
333
- delete_post_meta($to_delete,'wpedon_button_scpricehname');
334
- delete_post_meta($to_delete,'wpedon_button_scpriceiname');
335
- delete_post_meta($to_delete,'wpedon_button_scpricejname');
336
- delete_post_meta($to_delete,'wpedon_button_scpricea');
337
- delete_post_meta($to_delete,'wpedon_button_scpriceb');
338
- delete_post_meta($to_delete,'wpedon_button_scpricec');
339
- delete_post_meta($to_delete,'wpedon_button_scpriced');
340
- delete_post_meta($to_delete,'wpedon_button_scpricee');
341
- delete_post_meta($to_delete,'wpedon_button_scpricef');
342
- delete_post_meta($to_delete,'wpedon_button_scpriceg');
343
- delete_post_meta($to_delete,'wpedon_button_scpriceh');
344
- delete_post_meta($to_delete,'wpedon_button_scpricei');
345
- delete_post_meta($to_delete,'wpedon_button_scpricej');
346
-
347
- }
348
-
349
- echo'<script>window.location="?page=wpedon_buttons&message=deleted"; </script>';
350
- exit;
351
-
352
- }
353
- // end admin products page delete product
354
-
355
- // admin orders page no action taken
356
- if (isset($_GET['action']) && $_GET['action'] == "-1") {
357
- echo'<script>window.location="?page=wpedon_buttons&message=nothing"; </script>';
358
- }
359
- // end admin orders page no action taken
360
-
361
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ function wpedon_plugin_buttons() {
6
+
7
+ if (!isset($_GET['action']) || $_GET['action'] == "delete" || !empty($_GET['action2']) == "delete") {
8
+
9
+ // create a table
10
+
11
+ if(!class_exists('WP_List_Table')) {
12
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
13
+ }
14
+
15
+ class wpedon_buttons_table extends WP_List_Table {
16
+
17
+
18
+ function get_data() {
19
+ global $wp_query;
20
+
21
+ $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
22
+
23
+ $posts = get_posts($args);
24
+
25
+ $count = "0";
26
+ foreach ($posts as $post) {
27
+
28
+ $id = $posts[$count]->ID;
29
+ $post_title = $posts[$count]->post_title;
30
+
31
+ if ($post_title == "" || $post_title == " " || empty($post_title)) {
32
+ $post_title = "(No Item Name)";
33
+ }
34
+
35
+ $shortcode = '<input type="text" value="[wpedon id='.$id.']">';
36
+ $price = esc_attr(get_post_meta($id,'wpedon_button_price',true));
37
+ $sku = esc_attr(get_post_meta($id,'wpedon_button_id',true));
38
+
39
+ if (empty($price)) {
40
+ $price = "Customer enters amount";
41
+ }
42
+
43
+
44
+ $product = $post_title;
45
+
46
+ $data[] = array(
47
+ 'ID' => $id,
48
+ 'product' => $product,
49
+ 'shortcode' => $shortcode,
50
+ 'price' => $price,
51
+ 'sku' => $sku
52
+ );
53
+
54
+ $count++;
55
+ }
56
+
57
+ if (empty($data)) {
58
+ $data = array();
59
+ }
60
+
61
+ return $data;
62
+ }
63
+
64
+
65
+
66
+ function __construct() {
67
+ global $status, $page;
68
+
69
+ parent::__construct( array(
70
+ 'singular' => 'product',
71
+ 'plural' => 'products',
72
+ 'ajax' => false
73
+ ) );
74
+ }
75
+
76
+
77
+ function column_default($item, $column_name){
78
+ switch($column_name){
79
+ case 'product':
80
+ case 'shortcode':
81
+ case 'price':
82
+ case 'sku':
83
+ return $item[$column_name];
84
+ default:
85
+ return print_r($item,true);
86
+ }
87
+ }
88
+
89
+ function column_product($item){
90
+
91
+ // edit
92
+ $edit_bare = '?page=wpedon_buttons&action=edit&product='.$item['ID'];
93
+ $edit_url = wp_nonce_url($edit_bare, 'edit_'.$item['ID']);
94
+
95
+ // delete
96
+ $delete_bare = '?page=wpedon_buttons&action=delete&inline=true&product='.$item['ID'];
97
+ $delete_url = wp_nonce_url($delete_bare, 'bulk-'.$this->_args['plural']);
98
+
99
+ $actions = array(
100
+ 'edit' => '<a href="' . esc_url($edit_url) . '">Edit</a>',
101
+ 'delete' => '<a href="' . esc_url($delete_url) . '">Delete</a>'
102
+ );
103
+
104
+ return sprintf('%1$s %2$s',
105
+ esc_attr($item['product']),
106
+ $this->row_actions($actions)
107
+ );
108
+ }
109
+
110
+
111
+
112
+ function column_cb($item) {
113
+ return sprintf(
114
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
115
+ esc_attr($this->_args['singular']),
116
+ esc_attr($item['ID'])
117
+ );
118
+ }
119
+
120
+
121
+ function get_columns() {
122
+ $columns = array(
123
+ 'cb' => '<input type="checkbox" />',
124
+ 'product' => 'Name',
125
+ 'shortcode' => 'Shortcode',
126
+ 'price' => 'Amount',
127
+ 'sku' => 'ID'
128
+ );
129
+ return $columns;
130
+ }
131
+
132
+
133
+ function no_items() {
134
+ _e( 'No buttons found.' );
135
+ }
136
+
137
+
138
+ function get_bulk_actions() {
139
+ $actions = array(
140
+ 'delete' => 'Delete'
141
+ );
142
+ return $actions;
143
+ }
144
+
145
+ public function process_bulk_action() {
146
+ if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) ) {
147
+ $nonce = $_GET['_wpnonce'];
148
+ $action = 'bulk-' . $this->_args['plural'];
149
+
150
+ if ( ! wp_verify_nonce( $nonce, $action ) ) {
151
+ wp_die('Security check fail');
152
+ }
153
+ }
154
+ }
155
+
156
+
157
+ function prepare_items() {
158
+ global $wpdb;
159
+
160
+ $per_page = 5;
161
+
162
+ $columns = $this->get_columns();
163
+ $hidden = array();
164
+ $sortable = $this->get_sortable_columns();
165
+
166
+ $this->_column_headers = array($columns, $hidden, $sortable);
167
+
168
+ $this->process_bulk_action();
169
+
170
+ $data = $this->get_data();
171
+
172
+ function usort_reorder($a,$b) {
173
+ $orderby = (!empty($_REQUEST['orderby'])) ? sanitize_text_field($_REQUEST['orderby']) : 'product';
174
+ $order = (!empty($_REQUEST['order'])) ? sanitize_text_field($_REQUEST['order']) : 'asc';
175
+ $result = strcmp($a[$orderby], $b[$orderby]);
176
+ return ($order==='asc') ? $result : -$result;
177
+ }
178
+ usort($data, 'usort_reorder');
179
+
180
+
181
+ $current_page = $this->get_pagenum();
182
+
183
+
184
+
185
+ $total_items = count($data);
186
+
187
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
188
+
189
+ $this->items = $data;
190
+
191
+ $this->set_pagination_args( array(
192
+ 'total_items' => $total_items,
193
+ 'per_page' => $per_page,
194
+ 'total_pages' => ceil($total_items/$per_page)
195
+ ) );
196
+
197
+ }
198
+ }
199
+
200
+
201
+ function wpedon_tt_render_list_page() {
202
+
203
+ $testListTable = new wpedon_buttons_table();
204
+ $testListTable->prepare_items();
205
+
206
+ ?>
207
+
208
+ <style>
209
+ .check-column {
210
+ width: 2% !important;
211
+ }
212
+ .column-product {
213
+ width: 25%;
214
+ }
215
+ .column-shortcode {
216
+ width: 35%;
217
+ }
218
+ .column-price {
219
+ width: 25%;
220
+ }
221
+ .column-sku {
222
+ width: 13%;
223
+ }
224
+ </style>
225
+
226
+ <div style="width:98%">
227
+
228
+ <table width="100%"><tr><td>
229
+ <br />
230
+ <span style="font-size:20pt;">PayPal Donation Buttons</span>
231
+ </td><td valign="bottom">
232
+ <a href="?page=wpedon_buttons&action=new" name='btn2' class='button-primary' style='font-size: 14px;height: 30px;float: right;'>New PayPal Donation Button</a>
233
+ </td></tr></table>
234
+
235
+ <?php
236
+ if (isset($_GET['message'])) {
237
+ switch ($_GET['message']) {
238
+ case 'created':
239
+ echo "<div class='updated'><p>Button created.</p></div>";
240
+ break;
241
+ case 'deleted':
242
+ echo "<div class='updated'><p>Button(s) deleted.</p></div>";
243
+ break;
244
+ case 'nothing':
245
+ echo "<div class='updated'><p>No action selected.</p></div>";
246
+ break;
247
+ case 'nothing_deleted':
248
+ echo "<div class='updated'><p>Nothing selected to delete.</p></div>";
249
+ break;
250
+ case 'error':
251
+ echo "<div class='updated'><p>An error occured while processing the query. Please try again.</p></div>";
252
+ }
253
+ }
254
+ ?>
255
+
256
+ <form id="products-filter" method="get">
257
+ <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" />
258
+ <?php $testListTable->display() ?>
259
+ </form>
260
+
261
+ </div>
262
+
263
+ <?php
264
+ }
265
+
266
+ wpedon_tt_render_list_page();
267
+ }
268
+
269
+
270
+ // admin products page new product
271
+ if (isset($_GET['action']) && $_GET['action'] == "new") {
272
+ include_once ('private_buttons_new.php');
273
+ }
274
+ // end admin products page new product
275
+
276
+ // admin products page edit product
277
+ if (isset($_GET['action']) && $_GET['action'] == "edit") {
278
+ $post_id = $_GET['product'];
279
+ check_admin_referer('edit_'.$post_id);
280
+ include_once ('private_buttons_edit.php');
281
+ }
282
+ // end admin products page edit product
283
+
284
+ // admin products page delete product
285
+ if (isset($_GET['action']) && $_GET['action'] == "delete" || isset($_GET['action2']) && $_GET['action2'] == "delete") {
286
+
287
+ // check nonce for security
288
+ $nonce = $_REQUEST['_wpnonce'];
289
+ $action = 'bulk-products';
290
+
291
+ if ( ! wp_verify_nonce( $nonce, $action ) ) {
292
+ wp_die('Security check fail');
293
+ }
294
+
295
+ if (!empty($_GET['inline']) == "true") {
296
+ $post_id = array(intval($_GET['product']));
297
+ } else {
298
+ $post_id = array_map('intval', $_GET['product']);
299
+ }
300
+
301
+ if (empty($post_id)) {
302
+ echo'<script>window.location="?page=wpedon_buttons&message=nothing_deleted"; </script>';
303
+ exit;
304
+ }
305
+
306
+ foreach ($post_id as $to_delete) {
307
+ if (!$to_delete) {
308
+ echo'<script>window.location="?page=wpedon_buttons&message=error"; </script>';
309
+ exit;
310
+ }
311
+
312
+ wp_delete_post($to_delete,1);
313
+ delete_post_meta($to_delete,'wpedon_button_price');
314
+ delete_post_meta($to_delete,'wpedon_button_id');
315
+ delete_post_meta($to_delete,'wpedon_button_enable_name');
316
+ delete_post_meta($to_delete,'wpedon_button_enable_price');
317
+ delete_post_meta($to_delete,'wpedon_button_enable_currency');
318
+ delete_post_meta($to_delete,'wpedon_button_currency');
319
+ delete_post_meta($to_delete,'wpedon_button_language');
320
+ delete_post_meta($to_delete,'wpedon_button_account');
321
+ delete_post_meta($to_delete,'wpedon_button_return');
322
+ delete_post_meta($to_delete,'wpedon_button_buttonsize');
323
+ delete_post_meta($to_delete,'wpedon_button_scpriceprice');
324
+ delete_post_meta($to_delete,'wpedon_button_scpriceaname');
325
+ delete_post_meta($to_delete,'wpedon_button_scpricebname');
326
+ delete_post_meta($to_delete,'wpedon_button_scpricecname');
327
+ delete_post_meta($to_delete,'wpedon_button_scpricedname');
328
+ delete_post_meta($to_delete,'wpedon_button_scpriceename');
329
+ delete_post_meta($to_delete,'wpedon_button_scpricefname');
330
+ delete_post_meta($to_delete,'wpedon_button_scpricegname');
331
+ delete_post_meta($to_delete,'wpedon_button_scpricehname');
332
+ delete_post_meta($to_delete,'wpedon_button_scpriceiname');
333
+ delete_post_meta($to_delete,'wpedon_button_scpricejname');
334
+ delete_post_meta($to_delete,'wpedon_button_scpricea');
335
+ delete_post_meta($to_delete,'wpedon_button_scpriceb');
336
+ delete_post_meta($to_delete,'wpedon_button_scpricec');
337
+ delete_post_meta($to_delete,'wpedon_button_scpriced');
338
+ delete_post_meta($to_delete,'wpedon_button_scpricee');
339
+ delete_post_meta($to_delete,'wpedon_button_scpricef');
340
+ delete_post_meta($to_delete,'wpedon_button_scpriceg');
341
+ delete_post_meta($to_delete,'wpedon_button_scpriceh');
342
+ delete_post_meta($to_delete,'wpedon_button_scpricei');
343
+ delete_post_meta($to_delete,'wpedon_button_scpricej');
344
+
345
+ }
346
+
347
+ echo'<script>window.location="?page=wpedon_buttons&message=deleted"; </script>';
348
+ exit;
349
+
350
+ }
351
+ // end admin products page delete product
352
+
353
+ // admin orders page no action taken
354
+ if (isset($_GET['action']) && $_GET['action'] == "-1") {
355
+ echo'<script>window.location="?page=wpedon_buttons&message=nothing"; </script>';
356
+ }
357
+ // end admin orders page no action taken
358
+
 
 
359
  }
includes/private_buttons_edit.php CHANGED
@@ -1,279 +1,267 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
-
6
- if (isset($_POST['update'])) {
7
-
8
- $post_id = intval($_GET['product']);
9
-
10
- // check nonce for security
11
- $nonce = $_REQUEST['_wpnonce'];
12
- if ( ! wp_verify_nonce( $nonce, 'edit_'.$post_id ) ) {
13
- echo "Nonce verification failed.";
14
- exit;
15
- }
16
-
17
- if (!$post_id) {
18
- echo'<script>window.location="admin.php?page=wpedon_buttons"; </script>';
19
- exit;
20
- }
21
-
22
- // Update data
23
-
24
- if (!isset($error)) {
25
-
26
- $my_post = array(
27
- 'ID' => $post_id,
28
- 'post_title' => sanitize_text_field($_POST['wpedon_button_name'])
29
- );
30
- wp_update_post($my_post);
31
-
32
-
33
- $wpedon_button_price = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_price'], 'post' );
34
- update_post_meta($post_id, 'wpedon_button_price', $wpedon_button_price);
35
-
36
- update_post_meta($post_id, 'wpedon_button_id', sanitize_text_field($_POST['wpedon_button_id']));
37
-
38
- if (!empty($_POST['wpedon_button_enable_name'])) {
39
- $wpedon_button_enable_name = intval($_POST['wpedon_button_enable_name']);
40
- if (!$wpedon_button_enable_name) { $wpedon_button_enable_name = ""; }
41
- update_post_meta($post_id, 'wpedon_button_enable_name', sanitize_text_field($_POST['wpedon_button_enable_name']));
42
- } else {
43
- update_post_meta($post_id, 'wpedon_button_enable_name', 0);
44
- }
45
-
46
- if (!empty($_POST['wpedon_button_enable_price'])) {
47
- $wpedon_button_enable_price = intval($_POST['wpedon_button_enable_price']);
48
- if (!$wpedon_button_enable_price) { $wpedon_button_enable_price = ""; }
49
- update_post_meta($post_id, 'wpedon_button_enable_price', sanitize_text_field($_POST['wpedon_button_enable_price']));
50
- } else {
51
- update_post_meta($post_id, 'wpedon_button_enable_price', 0);
52
- }
53
-
54
- if (!empty($_POST['wpedon_button_enable_currency'])) {
55
- $wpedon_button_enable_currency = intval($_POST['wpedon_button_enable_currency']);
56
- if (!$wpedon_button_enable_currency) { $wpedon_button_enable_currency = ""; }
57
- update_post_meta($post_id, 'wpedon_button_enable_currency', $wpedon_button_enable_currency);
58
- } else {
59
- update_post_meta($post_id, 'wpedon_button_enable_currency', 0);
60
- }
61
-
62
- $wpedon_button_currency = intval($_POST['wpedon_button_currency']);
63
- if (!$wpedon_button_currency) { $wpedon_button_currency = ""; }
64
- update_post_meta($post_id, 'wpedon_button_currency', $wpedon_button_currency);
65
-
66
- $wpedon_button_language = intval($_POST['wpedon_button_language']);
67
- if (!$wpedon_button_language) { $wpedon_button_language = ""; }
68
- update_post_meta($post_id, 'wpedon_button_language', $wpedon_button_language);
69
-
70
- $wpedon_button_buttonsize = intval($_POST['wpedon_button_buttonsize']);
71
- if (!$wpedon_button_buttonsize && $wpedon_button_buttonsize != "0") { $wpedon_button_buttonsize = ""; }
72
- update_post_meta($post_id, 'wpedon_button_buttonsize', $wpedon_button_buttonsize);
73
-
74
- update_post_meta($post_id, 'wpedon_button_account', sanitize_text_field($_POST['wpedon_button_account']));
75
- update_post_meta($post_id, 'wpedon_button_return', sanitize_text_field($_POST['wpedon_button_return']));
76
-
77
- update_post_meta($post_id, 'wpedon_button_scpriceprice', sanitize_text_field($_POST['wpedon_button_scpriceprice']));
78
- update_post_meta($post_id, 'wpedon_button_scpriceaname', sanitize_text_field($_POST['wpedon_button_scpriceaname']));
79
- update_post_meta($post_id, 'wpedon_button_scpricebname', sanitize_text_field($_POST['wpedon_button_scpricebname']));
80
- update_post_meta($post_id, 'wpedon_button_scpricecname', sanitize_text_field($_POST['wpedon_button_scpricecname']));
81
- update_post_meta($post_id, 'wpedon_button_scpricedname', sanitize_text_field($_POST['wpedon_button_scpricedname']));
82
- update_post_meta($post_id, 'wpedon_button_scpriceename', sanitize_text_field($_POST['wpedon_button_scpriceename']));
83
- update_post_meta($post_id, 'wpedon_button_scpricefname', sanitize_text_field($_POST['wpedon_button_scpricefname']));
84
- update_post_meta($post_id, 'wpedon_button_scpricegname', sanitize_text_field($_POST['wpedon_button_scpricegname']));
85
- update_post_meta($post_id, 'wpedon_button_scpricehname', sanitize_text_field($_POST['wpedon_button_scpricehname']));
86
- update_post_meta($post_id, 'wpedon_button_scpriceiname', sanitize_text_field($_POST['wpedon_button_scpriceiname']));
87
- update_post_meta($post_id, 'wpedon_button_scpricejname', sanitize_text_field($_POST['wpedon_button_scpricejname']));
88
-
89
- $wpedon_button_scpricea = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricea'], 'post' );
90
- update_post_meta($post_id, 'wpedon_button_scpricea', $wpedon_button_scpricea);
91
- $wpedon_button_scpriceb = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceb'], 'post' );
92
- update_post_meta($post_id, 'wpedon_button_scpriceb', $wpedon_button_scpriceb);
93
- $wpedon_button_scpricec = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricec'], 'post' );
94
- update_post_meta($post_id, 'wpedon_button_scpricec', $wpedon_button_scpricec);
95
- $wpedon_button_scpriced = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriced'], 'post' );
96
- update_post_meta($post_id, 'wpedon_button_scpriced', $wpedon_button_scpriced);
97
- $wpedon_button_scpricee = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricee'], 'post' );
98
- update_post_meta($post_id, 'wpedon_button_scpricee', $wpedon_button_scpricee);
99
- $wpedon_button_scpricef = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricef'], 'post' );
100
- update_post_meta($post_id, 'wpedon_button_scpricef', $wpedon_button_scpricef);
101
- $wpedon_button_scpriceg = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceg'], 'post' );
102
- update_post_meta($post_id, 'wpedon_button_scpriceg', $wpedon_button_scpriceg);
103
- $wpedon_button_scpriceh = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceh'], 'post' );
104
- update_post_meta($post_id, 'wpedon_button_scpriceh', $wpedon_button_scpriceh);
105
- $wpedon_button_scpricei = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricei'], 'post' );
106
- update_post_meta($post_id, 'wpedon_button_scpricei', $wpedon_button_scpricei);
107
- $wpedon_button_scpricej = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricej'], 'post' );
108
- update_post_meta($post_id, 'wpedon_button_scpricej', $wpedon_button_scpricej);
109
-
110
- $message = "Saved";
111
-
112
- }
113
- }
114
-
115
-
116
- // check nonce for security
117
- $nonce = $_REQUEST['_wpnonce'];
118
- if ( ! wp_verify_nonce( $nonce, 'edit_'.$post_id ) ) {
119
- echo "Nonce verification failed.";
120
- exit;
121
- }
122
-
123
- ?>
124
-
125
- <div style="width:98%;">
126
-
127
- <form method='post'>
128
-
129
- <?php
130
- $post_id = sanitize_text_field($_GET['product']);
131
-
132
- $post_data = get_post($post_id);
133
- $title = $post_data->post_title;
134
-
135
- $siteurl = get_site_url();
136
- ?>
137
-
138
- <table width="100%"><tr><td valign="bottom" width="85%">
139
- <br />
140
- <span style="font-size:20pt;">Edit PayPal Donation Button</span>
141
- </td><td valign="bottom">
142
- <input type="submit" class="button-primary" style="font-size: 14px;height: 30px;float: right;" value="Save PayPal Donation Button">
143
- </td><td valign="bottom">
144
- <a href="admin.php?page=wpedon_buttons" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">View All Donation Buttons</a>
145
- </td></tr></table>
146
-
147
- <?php
148
- // error
149
- if (isset($error) && isset($error) && isset($message)) {
150
- echo "<div class='error'><p>"; echo $message; echo"</p></div>";
151
- }
152
- // saved
153
- if (!isset($error)&& !isset($error) && isset($message)) {
154
- echo "<div class='updated'><p>"; echo $message; echo"</p></div>";
155
- }
156
- ?>
157
-
158
- <br />
159
-
160
- <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
161
-
162
- <table><tr><td>
163
-
164
- <b>Shortcode</b> </td><td></td></td></td></tr><tr><td>
165
- Shortcode: </td><td><input type="text" readonly="true" value="<?php echo "[wpedon id=$post_id]"; ?>"></td><td>Put this in a page, post, PayPal widget, or <a target="_blank" href="https://wpplugin.org/documentation/?document=2314">in your theme</a>, to show the PayPal button on your site. <br />You can also use the button inserter found above the page or post editor.</td></tr><tr><td>
166
- </td><td><br /></td></td></td></tr><tr><td>
167
-
168
- <b>Main</b> </td><td></td></td></td></tr><tr><td>
169
- Purpose / Name: </td><td><input type="text" name="wpedon_button_name" value="<?php echo esc_attr($title); ?>"></td><td> Optional - The purpose of the donation. If blank, customer enters purpose.</td></tr><tr><td>
170
- Donation Amount: </td><td><input type="text" name="wpedon_button_price" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_price',true)); ?>"></td><td> Optional - Example: 10.50. If blank, customer enters amount on PayPal page. If using dropdown prices, leave blank.</td></tr><tr><td>
171
- Donation ID: </td><td><input type="text" name="wpedon_button_id" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_id',true)); ?>"></td><td> Optional - Example: S12T-Gec-RS.</td></tr><tr><td>
172
-
173
- </td><td><br /></td></td></td></tr><tr><td>
174
- <b>Language & Currency</b> </td><td></td></td></td></tr><tr><td>
175
-
176
- </td><td><br /></td></td></td></tr><tr><td>
177
- Language: </td><td>
178
- <select name="wpedon_button_language" style="width: 190px">
179
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "0") { echo "SELECTED"; } ?> value="0">Default Language</option>
180
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
181
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
182
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "3") { echo "SELECTED"; } ?> value="3">English</option>
183
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
184
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "4") { echo "SELECTED"; } ?> value="4">French</option>
185
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "5") { echo "SELECTED"; } ?> value="5">German</option>
186
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
187
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
188
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
189
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
190
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
191
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
192
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
193
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
194
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
195
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese -China only</option>
196
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
197
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
198
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
199
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_language',true)) == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
200
- </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
201
-
202
- </td><td><br /></td></td></td></tr><tr><td>
203
- Currency: </td><td>
204
- <select name="wpedon_button_currency" style="width: 190px">
205
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "0") { echo "SELECTED"; } ?> value="0">Default Currency</option>
206
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
207
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
208
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
209
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
210
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
211
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
212
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
213
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
214
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
215
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
216
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
217
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
218
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
219
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
220
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
221
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
222
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
223
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
224
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
225
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
226
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
227
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
228
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
229
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
230
- <option <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_currency',true)) == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
231
- </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
232
-
233
- </td><td><br /></td></td></td></tr><tr><td>
234
- <b>Other</b> </td><td></td></td></td></tr><tr><td>
235
- PayPal Account: </td><td><input type="text" name="wpedon_button_account" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_account',true)); ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
236
- Return URL: </td><td><input type="text" name="wpedon_button_return" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_return',true)); ?>"></td><td> Optional - Will override setttings page value. <br />Example: <?php echo $siteurl; ?>/thankyou</td></tr><tr><td>
237
-
238
- Button Size: </td><td>
239
- <select name="wpedon_button_buttonsize" style="width:190px;">
240
- <option value="0" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "0") { echo "SELECTED"; } ?>>Default Button</option>
241
- <option value="1" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "1") { echo "SELECTED"; } ?>>Small</option>
242
- <option value="2" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "2") { echo "SELECTED"; } ?>>Big</option>
243
- <option value="3" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "3") { echo "SELECTED"; } ?>>Big with Credit Cards</option>
244
- <option value="4" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "4") { echo "SELECTED"; } ?>>Small 2 (English only)</option>
245
- <option value="5" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "5") { echo "SELECTED"; } ?>>Big 2 (English only)</option>
246
- <option value="6" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "6") { echo "SELECTED"; } ?>>Big 2 with Credit Cards (English only)</option>
247
- <option value="7" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "7") { echo "SELECTED"; } ?>>Big 3 with logo (English only)</option>
248
- <option value="8" <?php if(esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true)) == "8") { echo "SELECTED"; } ?>>Custom</option>
249
- </select></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
250
-
251
- Show Purpose / Name: </td><td><input type="checkbox" name="wpedon_button_enable_name" value="1" <?php if (esc_attr(get_post_meta($post_id,'wpedon_button_enable_name',true)) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the purpose / name above the button.</td></tr><tr><td>
252
- Show Donation Amount: </td><td><input type="checkbox" name="wpedon_button_enable_price" value="1" <?php if (esc_attr(get_post_meta($post_id,'wpedon_button_enable_price',true)) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the donation amount above the button.</td></tr><tr><td>
253
- Show Currency: </td><td><input type="checkbox" name="wpedon_button_enable_currency" value="1" <?php if (esc_attr(get_post_meta($post_id,'wpedon_button_enable_currency',true)) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the currency (example: USD) after the amount.</td></tr><tr><td>
254
-
255
- </td><td><br /></td></td></td></tr><tr><td>
256
- <b>Dropdown Menu</b> <br /><br /></td><td></td></td></td></tr><tr><td>
257
-
258
- Amount Dropdown Menu: </td><td></td></td></td></tr><tr><td colspan="3">
259
- <table><tr><td>
260
- Amount Menu Name: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</td><td><input type="text" name="wpedon_button_scpriceprice" id="wpedon_button_scpriceprice" value="<?php echo get_post_meta($post_id,'wpedon_button_scpriceprice',true); ?>"></td><td> Optional, but required to show menu - show an amount dropdown menu. </td></tr><tr><td>
261
- Option / Amount 1: </td><td><input type="text" name="wpedon_button_scpriceaname" id="wpedon_button_scpriceaname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceaname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricea" id="wpedon_button_scpricea" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricea',true)); ?>"></td><td> Optional - Example Option: Size Medium Example Amount: 5.00 </td></tr><tr><td>
262
- Option / Amount 2: </td><td><input type="text" name="wpedon_button_scpricebname" id="wpedon_button_scpricebname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricebname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceb" id="wpedon_button_scpriceb" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceb',true)); ?>"></td><td> Optional </td></tr><tr><td>
263
- Option / Amount 3: </td><td><input type="text" name="wpedon_button_scpricecname" id="wpedon_button_scpricecname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricecname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricec" id="wpedon_button_scpricec" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricec',true)); ?>"></td><td> Optional </td></tr><tr><td>
264
- Option / Amount 4: </td><td><input type="text" name="wpedon_button_scpricedname" id="wpedon_button_scpricedname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricedname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriced" id="wpedon_button_scpriced" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriced',true)); ?>"></td><td> Optional </td></tr><tr><td>
265
- Option / Amount 5: </td><td><input type="text" name="wpedon_button_scpriceename" id="wpedon_button_scpriceename" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceename',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricee" id="wpedon_button_scpricee" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricee',true)); ?>"></td><td> Optional </td></tr><tr><td>
266
- Option / Amount 6: </td><td><input type="text" name="wpedon_button_scpricefname" id="wpedon_button_scpricefname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricefname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricef" id="wpedon_button_scpricef" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricef',true)); ?>"></td><td> Optional </td></tr><tr><td>
267
- Option / Amount 7: </td><td><input type="text" name="wpedon_button_scpricegname" id="wpedon_button_scpricegname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricegname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceg" id="wpedon_button_scpriceg" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceg',true)); ?>"></td><td> Optional </td></tr><tr><td>
268
- Option / Amount 8: </td><td><input type="text" name="wpedon_button_scpricehname" id="wpedon_button_scpricehname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricehname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceh" id="wpedon_button_scpriceh" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceh',true)); ?>"></td><td> Optional </td></tr><tr><td>
269
- Option / Amount 9: </td><td><input type="text" name="wpedon_button_scpriceiname" id="wpedon_button_scpriceiname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceiname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricei" id="wpedon_button_scpricei" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricei',true)); ?>"></td><td> Optional </td></tr><tr><td>
270
- Option / Amount 10: </td><td><input type="text" name="wpedon_button_scpricejname" id="wpedon_button_scpricejname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricejname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricej" id="wpedon_button_scpricej" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricej',true)); ?>"></td><td> Optional
271
- </td></tr></table>
272
-
273
- <?php wp_nonce_field( 'edit_'.$post_id ); ?>
274
- <input type="hidden" name="update">
275
-
276
- </td></tr></table>
277
- </div>
278
-
279
  </form>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ if (isset($_POST['update'])) {
7
+
8
+ $post_id = intval($_GET['product']);
9
+
10
+ // check nonce for security
11
+ $nonce = $_REQUEST['_wpnonce'];
12
+ if ( ! wp_verify_nonce( $nonce, 'edit_'.$post_id ) ) {
13
+ echo "Nonce verification failed.";
14
+ exit;
15
+ }
16
+
17
+ if (!$post_id) {
18
+ echo'<script>window.location="admin.php?page=wpedon_buttons"; </script>';
19
+ exit;
20
+ }
21
+
22
+ // Update data
23
+
24
+ if (!isset($error)) {
25
+
26
+ $my_post = array(
27
+ 'ID' => $post_id,
28
+ 'post_title' => sanitize_text_field($_POST['wpedon_button_name'])
29
+ );
30
+ wp_update_post($my_post);
31
+
32
+
33
+ $wpedon_button_price = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_price'], 'post' );
34
+ update_post_meta($post_id, 'wpedon_button_price', $wpedon_button_price);
35
+
36
+ update_post_meta($post_id, 'wpedon_button_id', sanitize_text_field($_POST['wpedon_button_id']));
37
+
38
+ $wpedon_button_enable_name = !empty($_POST['wpedon_button_enable_name']) ? sanitize_text_field($_POST['wpedon_button_enable_name']) : 0;
39
+ update_post_meta($post_id, 'wpedon_button_enable_name', $wpedon_button_enable_name);
40
+
41
+ $wpedon_button_enable_price = !empty($_POST['wpedon_button_enable_price']) ? sanitize_text_field($_POST['wpedon_button_enable_price']) : 0;
42
+ update_post_meta($post_id, 'wpedon_button_enable_price', $wpedon_button_enable_price);
43
+
44
+ $wpedon_button_enable_currency = !empty($_POST['wpedon_button_enable_currency']) ? intval($_POST['wpedon_button_enable_currency']) : 0;
45
+ update_post_meta($post_id, 'wpedon_button_enable_currency', $wpedon_button_enable_currency);
46
+
47
+ $wpedon_button_currency = intval($_POST['wpedon_button_currency']);
48
+ if (!$wpedon_button_currency) { $wpedon_button_currency = ""; }
49
+ update_post_meta($post_id, 'wpedon_button_currency', $wpedon_button_currency);
50
+
51
+ $wpedon_button_language = intval($_POST['wpedon_button_language']);
52
+ if (!$wpedon_button_language) { $wpedon_button_language = ""; }
53
+ update_post_meta($post_id, 'wpedon_button_language', $wpedon_button_language);
54
+
55
+ $wpedon_button_buttonsize = intval($_POST['wpedon_button_buttonsize']);
56
+ if (!$wpedon_button_buttonsize && $wpedon_button_buttonsize != "0") { $wpedon_button_buttonsize = ""; }
57
+ update_post_meta($post_id, 'wpedon_button_buttonsize', $wpedon_button_buttonsize);
58
+
59
+ update_post_meta($post_id, 'wpedon_button_account', sanitize_text_field($_POST['wpedon_button_account']));
60
+ update_post_meta($post_id, 'wpedon_button_return', sanitize_text_field($_POST['wpedon_button_return']));
61
+
62
+ update_post_meta($post_id, 'wpedon_button_scpriceprice', sanitize_text_field($_POST['wpedon_button_scpriceprice']));
63
+ update_post_meta($post_id, 'wpedon_button_scpriceaname', sanitize_text_field($_POST['wpedon_button_scpriceaname']));
64
+ update_post_meta($post_id, 'wpedon_button_scpricebname', sanitize_text_field($_POST['wpedon_button_scpricebname']));
65
+ update_post_meta($post_id, 'wpedon_button_scpricecname', sanitize_text_field($_POST['wpedon_button_scpricecname']));
66
+ update_post_meta($post_id, 'wpedon_button_scpricedname', sanitize_text_field($_POST['wpedon_button_scpricedname']));
67
+ update_post_meta($post_id, 'wpedon_button_scpriceename', sanitize_text_field($_POST['wpedon_button_scpriceename']));
68
+ update_post_meta($post_id, 'wpedon_button_scpricefname', sanitize_text_field($_POST['wpedon_button_scpricefname']));
69
+ update_post_meta($post_id, 'wpedon_button_scpricegname', sanitize_text_field($_POST['wpedon_button_scpricegname']));
70
+ update_post_meta($post_id, 'wpedon_button_scpricehname', sanitize_text_field($_POST['wpedon_button_scpricehname']));
71
+ update_post_meta($post_id, 'wpedon_button_scpriceiname', sanitize_text_field($_POST['wpedon_button_scpriceiname']));
72
+ update_post_meta($post_id, 'wpedon_button_scpricejname', sanitize_text_field($_POST['wpedon_button_scpricejname']));
73
+
74
+ $wpedon_button_scpricea = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricea'], 'post' );
75
+ update_post_meta($post_id, 'wpedon_button_scpricea', $wpedon_button_scpricea);
76
+ $wpedon_button_scpriceb = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceb'], 'post' );
77
+ update_post_meta($post_id, 'wpedon_button_scpriceb', $wpedon_button_scpriceb);
78
+ $wpedon_button_scpricec = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricec'], 'post' );
79
+ update_post_meta($post_id, 'wpedon_button_scpricec', $wpedon_button_scpricec);
80
+ $wpedon_button_scpriced = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriced'], 'post' );
81
+ update_post_meta($post_id, 'wpedon_button_scpriced', $wpedon_button_scpriced);
82
+ $wpedon_button_scpricee = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricee'], 'post' );
83
+ update_post_meta($post_id, 'wpedon_button_scpricee', $wpedon_button_scpricee);
84
+ $wpedon_button_scpricef = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricef'], 'post' );
85
+ update_post_meta($post_id, 'wpedon_button_scpricef', $wpedon_button_scpricef);
86
+ $wpedon_button_scpriceg = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceg'], 'post' );
87
+ update_post_meta($post_id, 'wpedon_button_scpriceg', $wpedon_button_scpriceg);
88
+ $wpedon_button_scpriceh = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceh'], 'post' );
89
+ update_post_meta($post_id, 'wpedon_button_scpriceh', $wpedon_button_scpriceh);
90
+ $wpedon_button_scpricei = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricei'], 'post' );
91
+ update_post_meta($post_id, 'wpedon_button_scpricei', $wpedon_button_scpricei);
92
+ $wpedon_button_scpricej = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricej'], 'post' );
93
+ update_post_meta($post_id, 'wpedon_button_scpricej', $wpedon_button_scpricej);
94
+
95
+ $message = "Saved";
96
+
97
+ }
98
+ }
99
+
100
+
101
+ // check nonce for security
102
+ $nonce = $_REQUEST['_wpnonce'];
103
+ if ( ! wp_verify_nonce( $nonce, 'edit_'.$post_id ) ) {
104
+ echo "Nonce verification failed.";
105
+ exit;
106
+ }
107
+
108
+ ?>
109
+
110
+ <div style="width:98%;">
111
+
112
+ <form method='post'>
113
+
114
+ <?php
115
+ $post_id = intval($_GET['product']);
116
+
117
+ $post_data = get_post($post_id);
118
+ $title = $post_data->post_title;
119
+
120
+ $siteurl = get_site_url();
121
+ ?>
122
+
123
+ <table width="100%"><tr><td valign="bottom" width="85%">
124
+ <br />
125
+ <span style="font-size:20pt;">Edit PayPal Donation Button</span>
126
+ </td><td valign="bottom">
127
+ <input type="submit" class="button-primary" style="font-size: 14px;height: 30px;float: right;" value="Save PayPal Donation Button">
128
+ </td><td valign="bottom">
129
+ <a href="admin.php?page=wpedon_buttons" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">View All Donation Buttons</a>
130
+ </td></tr></table>
131
+
132
+ <?php
133
+ // error
134
+ if (isset($error) && isset($message)) {
135
+ echo "<div class='error'><p>"; echo esc_html($message); echo"</p></div>";
136
+ }
137
+ // saved
138
+ if (!isset($error) && isset($message)) {
139
+ echo "<div class='updated'><p>"; echo esc_html($message); echo"</p></div>";
140
+ }
141
+ ?>
142
+
143
+ <br />
144
+
145
+ <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
146
+
147
+ <table><tr><td>
148
+
149
+ <b>Shortcode</b> </td><td></td></td></td></tr><tr><td>
150
+ Shortcode: </td><td><input type="text" readonly="true" value="<?php echo "[wpedon id=$post_id]"; ?>"></td><td>Put this in a page, post, PayPal widget, or <a target="_blank" href="https://wpplugin.org/documentation/?document=2314">in your theme</a>, to show the PayPal button on your site. <br />You can also use the button inserter found above the page or post editor.</td></tr><tr><td>
151
+ </td><td><br /></td></td></td></tr><tr><td>
152
+
153
+ <b>Main</b> </td><td></td></td></td></tr><tr><td>
154
+ Purpose / Name: </td><td><input type="text" name="wpedon_button_name" value="<?php echo esc_attr($title); ?>"></td><td> Optional - The purpose of the donation. If blank, customer enters purpose.</td></tr><tr><td>
155
+ Donation Amount: </td><td><input type="text" name="wpedon_button_price" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_price',true)); ?>"></td><td> Optional - Example: 10.50. If blank, customer enters amount on PayPal page. If using dropdown prices, leave blank.</td></tr><tr><td>
156
+ Donation ID: </td><td><input type="text" name="wpedon_button_id" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_id',true)); ?>"></td><td> Optional - Example: S12T-Gec-RS.</td></tr><tr><td>
157
+
158
+ </td><td><br /></td></td></td></tr><tr><td>
159
+ <b>Language & Currency</b> </td><td></td></td></td></tr><tr><td>
160
+
161
+ </td><td><br /></td></td></td></tr><tr><td>
162
+ Language: </td><td>
163
+ <select name="wpedon_button_language" style="width: 190px">
164
+ <?php $wpedon_button_language = get_post_meta($post_id,'wpedon_button_language',true); ?>
165
+ <option <?php if($wpedon_button_language == "0") { echo "SELECTED"; } ?> value="0">Default Language</option>
166
+ <option <?php if($wpedon_button_language == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
167
+ <option <?php if($wpedon_button_language == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
168
+ <option <?php if($wpedon_button_language == "3") { echo "SELECTED"; } ?> value="3">English</option>
169
+ <option <?php if($wpedon_button_language == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
170
+ <option <?php if($wpedon_button_language == "4") { echo "SELECTED"; } ?> value="4">French</option>
171
+ <option <?php if($wpedon_button_language == "5") { echo "SELECTED"; } ?> value="5">German</option>
172
+ <option <?php if($wpedon_button_language == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
173
+ <option <?php if($wpedon_button_language == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
174
+ <option <?php if($wpedon_button_language == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
175
+ <option <?php if($wpedon_button_language == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
176
+ <option <?php if($wpedon_button_language == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
177
+ <option <?php if($wpedon_button_language == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
178
+ <option <?php if($wpedon_button_language == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
179
+ <option <?php if($wpedon_button_language == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
180
+ <option <?php if($wpedon_button_language == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
181
+ <option <?php if($wpedon_button_language == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese -China only</option>
182
+ <option <?php if($wpedon_button_language == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
183
+ <option <?php if($wpedon_button_language == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
184
+ <option <?php if($wpedon_button_language == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
185
+ <option <?php if($wpedon_button_language == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
186
+ </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
187
+
188
+ </td><td><br /></td></td></td></tr><tr><td>
189
+ Currency: </td><td>
190
+ <select name="wpedon_button_currency" style="width: 190px">
191
+ <?php $wpedon_button_currency = get_post_meta($post_id,'wpedon_button_currency',true); ?>
192
+ <option <?php if($wpedon_button_currency == "0") { echo "SELECTED"; } ?> value="0">Default Currency</option>
193
+ <option <?php if($wpedon_button_currency == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
194
+ <option <?php if($wpedon_button_currency == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
195
+ <option <?php if($wpedon_button_currency == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
196
+ <option <?php if($wpedon_button_currency == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
197
+ <option <?php if($wpedon_button_currency == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
198
+ <option <?php if($wpedon_button_currency == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
199
+ <option <?php if($wpedon_button_currency == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
200
+ <option <?php if($wpedon_button_currency == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
201
+ <option <?php if($wpedon_button_currency == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
202
+ <option <?php if($wpedon_button_currency == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
203
+ <option <?php if($wpedon_button_currency == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
204
+ <option <?php if($wpedon_button_currency == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
205
+ <option <?php if($wpedon_button_currency == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
206
+ <option <?php if($wpedon_button_currency == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
207
+ <option <?php if($wpedon_button_currency == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
208
+ <option <?php if($wpedon_button_currency == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
209
+ <option <?php if($wpedon_button_currency == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
210
+ <option <?php if($wpedon_button_currency == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
211
+ <option <?php if($wpedon_button_currency == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
212
+ <option <?php if($wpedon_button_currency == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
213
+ <option <?php if($wpedon_button_currency == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
214
+ <option <?php if($wpedon_button_currency == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
215
+ <option <?php if($wpedon_button_currency == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
216
+ <option <?php if($wpedon_button_currency == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
217
+ <option <?php if($wpedon_button_currency == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
218
+ </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
219
+
220
+ </td><td><br /></td></td></td></tr><tr><td>
221
+ <b>Other</b> </td><td></td></td></td></tr><tr><td>
222
+ PayPal Account: </td><td><input type="text" name="wpedon_button_account" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_account',true)); ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
223
+ Return URL: </td><td><input type="text" name="wpedon_button_return" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_return',true)); ?>"></td><td> Optional - Will override setttings page value. <br />Example: <?php echo $siteurl; ?>/thankyou</td></tr><tr><td>
224
+
225
+ Button Size: </td><td>
226
+ <select name="wpedon_button_buttonsize" style="width:190px;">
227
+ <?php $wpedon_button_buttonsize = get_post_meta($post_id,'wpedon_button_buttonsize',true); ?>
228
+ <option value="0" <?php if($wpedon_button_buttonsize == "0") { echo "SELECTED"; } ?>>Default Button</option>
229
+ <option value="1" <?php if($wpedon_button_buttonsize == "1") { echo "SELECTED"; } ?>>Small</option>
230
+ <option value="2" <?php if($wpedon_button_buttonsize == "2") { echo "SELECTED"; } ?>>Big</option>
231
+ <option value="3" <?php if($wpedon_button_buttonsize == "3") { echo "SELECTED"; } ?>>Big with Credit Cards</option>
232
+ <option value="4" <?php if($wpedon_button_buttonsize == "4") { echo "SELECTED"; } ?>>Small 2 (English only)</option>
233
+ <option value="5" <?php if($wpedon_button_buttonsize == "5") { echo "SELECTED"; } ?>>Big 2 (English only)</option>
234
+ <option value="6" <?php if($wpedon_button_buttonsize == "6") { echo "SELECTED"; } ?>>Big 2 with Credit Cards (English only)</option>
235
+ <option value="7" <?php if($wpedon_button_buttonsize == "7") { echo "SELECTED"; } ?>>Big 3 with logo (English only)</option>
236
+ <option value="8" <?php if($wpedon_button_buttonsize == "8") { echo "SELECTED"; } ?>>Custom</option>
237
+ </select></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
238
+
239
+ Show Purpose / Name: </td><td><input type="checkbox" name="wpedon_button_enable_name" value="1" <?php if (get_post_meta($post_id,'wpedon_button_enable_name',true) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the purpose / name above the button.</td></tr><tr><td>
240
+ Show Donation Amount: </td><td><input type="checkbox" name="wpedon_button_enable_price" value="1" <?php if (get_post_meta($post_id,'wpedon_button_enable_price',true) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the donation amount above the button.</td></tr><tr><td>
241
+ Show Currency: </td><td><input type="checkbox" name="wpedon_button_enable_currency" value="1" <?php if (get_post_meta($post_id,'wpedon_button_enable_currency',true) == "1") { echo "CHECKED"; } ?>></td><td>Optional - Show the currency (example: USD) after the amount.</td></tr><tr><td>
242
+
243
+ </td><td><br /></td></td></td></tr><tr><td>
244
+ <b>Dropdown Menu</b> <br /><br /></td><td></td></td></td></tr><tr><td>
245
+
246
+ Amount Dropdown Menu: </td><td></td></td></td></tr><tr><td colspan="3">
247
+ <table><tr><td>
248
+ Amount Menu Name: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</td><td><input type="text" name="wpedon_button_scpriceprice" id="wpedon_button_scpriceprice" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceprice',true)); ?>"></td><td> Optional, but required to show menu - show an amount dropdown menu. </td></tr><tr><td>
249
+ Option / Amount 1: </td><td><input type="text" name="wpedon_button_scpriceaname" id="wpedon_button_scpriceaname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceaname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricea" id="wpedon_button_scpricea" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricea',true)); ?>"></td><td> Optional - Example Option: Size Medium Example Amount: 5.00 </td></tr><tr><td>
250
+ Option / Amount 2: </td><td><input type="text" name="wpedon_button_scpricebname" id="wpedon_button_scpricebname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricebname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceb" id="wpedon_button_scpriceb" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceb',true)); ?>"></td><td> Optional </td></tr><tr><td>
251
+ Option / Amount 3: </td><td><input type="text" name="wpedon_button_scpricecname" id="wpedon_button_scpricecname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricecname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricec" id="wpedon_button_scpricec" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricec',true)); ?>"></td><td> Optional </td></tr><tr><td>
252
+ Option / Amount 4: </td><td><input type="text" name="wpedon_button_scpricedname" id="wpedon_button_scpricedname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricedname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriced" id="wpedon_button_scpriced" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriced',true)); ?>"></td><td> Optional </td></tr><tr><td>
253
+ Option / Amount 5: </td><td><input type="text" name="wpedon_button_scpriceename" id="wpedon_button_scpriceename" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceename',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricee" id="wpedon_button_scpricee" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricee',true)); ?>"></td><td> Optional </td></tr><tr><td>
254
+ Option / Amount 6: </td><td><input type="text" name="wpedon_button_scpricefname" id="wpedon_button_scpricefname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricefname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricef" id="wpedon_button_scpricef" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricef',true)); ?>"></td><td> Optional </td></tr><tr><td>
255
+ Option / Amount 7: </td><td><input type="text" name="wpedon_button_scpricegname" id="wpedon_button_scpricegname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricegname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceg" id="wpedon_button_scpriceg" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceg',true)); ?>"></td><td> Optional </td></tr><tr><td>
256
+ Option / Amount 8: </td><td><input type="text" name="wpedon_button_scpricehname" id="wpedon_button_scpricehname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricehname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceh" id="wpedon_button_scpriceh" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceh',true)); ?>"></td><td> Optional </td></tr><tr><td>
257
+ Option / Amount 9: </td><td><input type="text" name="wpedon_button_scpriceiname" id="wpedon_button_scpriceiname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpriceiname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricei" id="wpedon_button_scpricei" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricei',true)); ?>"></td><td> Optional </td></tr><tr><td>
258
+ Option / Amount 10: </td><td><input type="text" name="wpedon_button_scpricejname" id="wpedon_button_scpricejname" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricejname',true)); ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricej" id="wpedon_button_scpricej" value="<?php echo esc_attr(get_post_meta($post_id,'wpedon_button_scpricej',true)); ?>"></td><td> Optional
259
+ </td></tr></table>
260
+
261
+ <?php wp_nonce_field( 'edit_'.$post_id ); ?>
262
+ <input type="hidden" name="update">
263
+
264
+ </td></tr></table>
265
+ </div>
266
+
 
 
 
 
 
 
 
 
 
 
 
 
267
  </form>
includes/private_buttons_new.php CHANGED
@@ -1,252 +1,246 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- global $current_user;
6
-
7
- if (isset($_POST['update'])) {
8
-
9
- // check nonce for security
10
- $nonce = $_REQUEST['_wpnonce'];
11
- if ( ! wp_verify_nonce( $nonce, 'new_wpedon_button' ) ) {
12
- echo "Nonce verification failed.";
13
- exit;
14
- }
15
-
16
- $my_post = array(
17
- 'post_title' => sanitize_text_field($_POST['wpedon_button_name']),
18
- 'post_status' => 'publish',
19
- 'post_author' => $current_user->ID,
20
- 'post_type' => 'wpplugin_don_button'
21
- );
22
-
23
- if (!isset($error)) {
24
-
25
- // Insert the post and meta data into the database
26
- $post_id = wp_insert_post( $my_post );
27
-
28
- $wpedon_button_price = sanitize_meta( 'currency', $_POST['wpedon_button_price'], 'post' );
29
- update_post_meta($post_id, 'wpedon_button_price', $wpedon_button_price);
30
-
31
- update_post_meta($post_id, 'wpedon_button_id', sanitize_text_field($_POST['wpedon_button_id']));
32
-
33
- if (!empty($_POST['wpedon_button_enable_name'])) {
34
- $wpedon_button_enable_name = intval($_POST['wpedon_button_enable_name']);
35
- if (!$wpedon_button_enable_name) { $wpedon_button_enable_name = ""; }
36
- update_post_meta($post_id, 'wpedon_button_enable_name', sanitize_text_field($_POST['wpedon_button_enable_name']));
37
- } else {
38
- update_post_meta($post_id, 'wpedon_button_enable_name', 0);
39
- }
40
-
41
- if (!empty($_POST['wpedon_button_enable_price'])) {
42
- $wpedon_button_enable_price = intval($_POST['wpedon_button_enable_price']);
43
- if (!$wpedon_button_enable_price) { $wpedon_button_enable_price = ""; }
44
- update_post_meta($post_id, 'wpedon_button_enable_price', sanitize_text_field($_POST['wpedon_button_enable_price']));
45
- } else {
46
- update_post_meta($post_id, 'wpedon_button_enable_price', 0);
47
- }
48
-
49
- if (!empty($_POST['wpedon_button_enable_currency'])) {
50
- $wpedon_button_enable_currency = intval($_POST['wpedon_button_enable_currency']);
51
- if (!$wpedon_button_enable_currency) { $wpedon_button_enable_currency = ""; }
52
- update_post_meta($post_id, 'wpedon_button_enable_currency', $wpedon_button_enable_currency);
53
- } else {
54
- update_post_meta($post_id, 'wpedon_button_enable_currency', 0);
55
- }
56
-
57
- $wpedon_button_currency = intval($_POST['wpedon_button_currency']);
58
- if (!$wpedon_button_currency) { $wpedon_button_currency = ""; }
59
- update_post_meta($post_id, 'wpedon_button_currency', $wpedon_button_currency);
60
-
61
- $wpedon_button_language = intval($_POST['wpedon_button_language']);
62
- if (!$wpedon_button_language) { $wpedon_button_language = ""; }
63
- update_post_meta($post_id, 'wpedon_button_language', $wpedon_button_language);
64
-
65
- $wpedon_button_buttonsize = intval($_POST['wpedon_button_buttonsize']);
66
- if (!$wpedon_button_buttonsize && $wpedon_button_buttonsize != "0") { $wpedon_button_buttonsize = ""; }
67
- update_post_meta($post_id, 'wpedon_button_buttonsize', $wpedon_button_buttonsize);
68
-
69
- update_post_meta($post_id, 'wpedon_button_account', sanitize_text_field($_POST['wpedon_button_account']));
70
- update_post_meta($post_id, 'wpedon_button_return', sanitize_text_field($_POST['wpedon_button_return']));
71
-
72
- update_post_meta($post_id, 'wpedon_button_scpriceprice', sanitize_text_field($_POST['wpedon_button_scpriceprice']));
73
- update_post_meta($post_id, 'wpedon_button_scpriceaname', sanitize_text_field($_POST['wpedon_button_scpriceaname']));
74
- update_post_meta($post_id, 'wpedon_button_scpricebname', sanitize_text_field($_POST['wpedon_button_scpricebname']));
75
- update_post_meta($post_id, 'wpedon_button_scpricecname', sanitize_text_field($_POST['wpedon_button_scpricecname']));
76
- update_post_meta($post_id, 'wpedon_button_scpricedname', sanitize_text_field($_POST['wpedon_button_scpricedname']));
77
- update_post_meta($post_id, 'wpedon_button_scpriceename', sanitize_text_field($_POST['wpedon_button_scpriceename']));
78
- update_post_meta($post_id, 'wpedon_button_scpricefname', sanitize_text_field($_POST['wpedon_button_scpricefname']));
79
- update_post_meta($post_id, 'wpedon_button_scpricegname', sanitize_text_field($_POST['wpedon_button_scpricegname']));
80
- update_post_meta($post_id, 'wpedon_button_scpricehname', sanitize_text_field($_POST['wpedon_button_scpricehname']));
81
- update_post_meta($post_id, 'wpedon_button_scpriceiname', sanitize_text_field($_POST['wpedon_button_scpriceiname']));
82
- update_post_meta($post_id, 'wpedon_button_scpricejname', sanitize_text_field($_POST['wpedon_button_scpricejname']));
83
-
84
- $wpedon_button_scpricea = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricea'], 'post' );
85
- update_post_meta($post_id, 'wpedon_button_scpricea', $wpedon_button_scpricea);
86
- $wpedon_button_scpriceb = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceb'], 'post' );
87
- update_post_meta($post_id, 'wpedon_button_scpriceb', $wpedon_button_scpriceb);
88
- $wpedon_button_scpricec = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricec'], 'post' );
89
- update_post_meta($post_id, 'wpedon_button_scpricec', $wpedon_button_scpricec);
90
- $wpedon_button_scpriced = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriced'], 'post' );
91
- update_post_meta($post_id, 'wpedon_button_scpriced', $wpedon_button_scpriced);
92
- $wpedon_button_scpricee = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricee'], 'post' );
93
- update_post_meta($post_id, 'wpedon_button_scpricee', $wpedon_button_scpricee);
94
- $wpedon_button_scpricef = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricef'], 'post' );
95
- update_post_meta($post_id, 'wpedon_button_scpricef', $wpedon_button_scpricef);
96
- $wpedon_button_scpriceg = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceg'], 'post' );
97
- update_post_meta($post_id, 'wpedon_button_scpriceg', $wpedon_button_scpriceg);
98
- $wpedon_button_scpriceh = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceh'], 'post' );
99
- update_post_meta($post_id, 'wpedon_button_scpriceh', $wpedon_button_scpriceh);
100
- $wpedon_button_scpricei = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricei'], 'post' );
101
- update_post_meta($post_id, 'wpedon_button_scpricei', $wpedon_button_scpricei);
102
- $wpedon_button_scpricej = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricej'], 'post' );
103
- update_post_meta($post_id, 'wpedon_button_scpricej', $wpedon_button_scpricej);
104
-
105
- echo'<script>window.location="?page=wpedon_buttons&message=created";</script>';
106
- exit;
107
-
108
- }
109
- }
110
-
111
- ?>
112
-
113
- <div style="width:98%;">
114
-
115
- <form method='post'>
116
-
117
- <table width="100%"><tr><td valign="bottom" width="85%">
118
- <br />
119
- <span style="font-size:20pt;">New PayPal Donation Button</span>
120
- </td><td valign="bottom">
121
- <input type="submit" class="button-primary" style="font-size: 14px;height: 30px;float: right;" value="Save PayPal Donation Button">
122
- </td><td valign="bottom">
123
- <a href="admin.php?page=wpedon_buttons" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">Cancel</a>
124
- </td></tr></table>
125
-
126
-
127
- <?php
128
- // error
129
- if (isset($error) && isset($error) && isset($message)) {
130
- echo "<div class='error'><p>"; echo $message; echo"</p></div>";
131
- }
132
- ?>
133
-
134
-
135
- <br />
136
-
137
- <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
138
-
139
- <table><tr><td>
140
-
141
- <b>Main</b> </td><td></td></td></td></tr><tr><td>
142
- Purpose / Name: </td><td><input type="text" name="wpedon_button_name" value="<?php if(isset($_POST['wpedon_button_name'])) { echo esc_attr($_POST['wpedon_button_name']); } ?>"></td><td> Optional - The purpose of the donation. If blank, customer enters purpose.</td></tr><tr><td>
143
- Donation Amount: </td><td><input type="text" name="wpedon_button_price" value="<?php if(isset($_POST['wpedon_button_price'])) { echo esc_attr($_POST['wpedon_button_created']); } ?>"></td><td> Optional - Example: 10.50. If blank, customer enters amount on PayPal page. If using dropdown prices, leave blank.</td></tr><tr><td>
144
- Donation ID: </td><td><input type="text" name="wpedon_button_id" value="<?php if(isset($_POST['wpedon_button_id'])) { echo esc_attr($_POST['wpedon_button_id']); } ?>"></td><td> Optional - Example: S12T-Gec-RS.</td></tr><tr><td>
145
-
146
- </td><td><br /></td></td></td></tr><tr><td>
147
- <b>Language & Currency</b> </td><td></td></td></td></tr><tr><td>
148
-
149
- </td><td><br /></td></td></td></tr><tr><td>
150
- <b>Language:</b> </td><td>
151
- <select name="wpedon_button_language" style="width: 190px">
152
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "0") { echo "SELECTED"; } ?> value="0">Default Language</option>
153
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
154
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
155
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "3") { echo "SELECTED"; } ?> value="3">English</option>
156
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
157
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "4") { echo "SELECTED"; } ?> value="4">French</option>
158
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "5") { echo "SELECTED"; } ?> value="5">German</option>
159
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
160
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
161
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
162
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
163
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
164
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
165
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
166
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
167
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
168
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese -China only</option>
169
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
170
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
171
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
172
- <option <?php if(isset($_POST['wpedon_button_language']) && $_POST['wpedon_button_language'] == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
173
- </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
174
-
175
- </td><td><br /></td></td></td></tr><tr><td>
176
- <b>Currency:</b> </td><td>
177
- <select name="wpedon_button_currency" style="width: 190px">
178
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "0") { echo "SELECTED"; } ?> value="0">Default Currency</option>
179
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
180
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
181
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
182
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
183
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
184
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
185
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
186
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
187
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
188
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
189
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
190
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
191
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
192
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
193
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
194
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
195
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
196
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
197
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
198
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
199
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
200
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
201
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
202
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
203
- <option <?php if(isset($_POST['wpedon_button_currency']) && $_POST['wpedon_button_currency'] == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
204
- </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
205
-
206
- </td><td><br /></td></td></td></tr><tr><td>
207
- <b>Other</b> </td><td></td></td></td></tr><tr><td>
208
- PayPal Account: </td><td><input type="text" name="wpedon_button_account" value="<?php if(isset($_POST['wpedon_button_account'])) { echo esc_attr($_POST['wpedon_button_account']); } ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
209
- Return URL: </td><td><input type="text" name="wpedon_button_return" value="<?php if(isset($_POST['wpedon_button_return'])) { echo esc_attr($_POST['wpedon_button_return']); } ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
210
-
211
- Button Size: </td><td>
212
- <select name="wpedon_button_buttonsize" style="width:190px;">
213
- <option value="0" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "0") { echo "SELECTED"; } ?>>Default Button</option>
214
- <option value="1" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "1") { echo "SELECTED"; } ?>>Small</option>
215
- <option value="2" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "2") { echo "SELECTED"; } ?>>Big</option>
216
- <option value="3" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "3") { echo "SELECTED"; } ?>>Big with Credit Cards</option>
217
- <option value="4" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "4") { echo "SELECTED"; } ?>>Small 2 (English only)</option>
218
- <option value="5" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "5") { echo "SELECTED"; } ?>>Big 2 (English only)</option>
219
- <option value="6" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "6") { echo "SELECTED"; } ?>>Big 2 with Credit Cards (English only)</option>
220
- <option value="7" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "7") { echo "SELECTED"; } ?>>Big 3 with logo (English only)</option>
221
- <option value="8" <?php if(isset($_POST['wpedon_button_buttonsize']) && $_POST['wpedon_button_buttonsize'] == "8") { echo "SELECTED"; } ?>>Custom</option>
222
- </select></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
223
-
224
- Show Purpose / Name: </td><td><input type="checkbox" name="wpedon_button_enable_name" value="1" <?php if (isset($_POST['wpedon_button_enable_name'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the purpose / name above the button.</td></tr><tr><td>
225
- Show Donation Amount: : </td><td><input type="checkbox" name="wpedon_button_enable_price" value="1" <?php if (isset($_POST['wpedon_button_enable_price'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the donation amount above the button.</td></tr><tr><td>
226
- Show Currency: </td><td><input type="checkbox" name="wpedon_button_enable_currency" value="1" <?php if (isset($_POST['wpedon_button_enable_currency'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the currency (example: USD) after the amount.</td></tr><tr><td>
227
-
228
- </td><td><br /></td></td></td></tr><tr><td>
229
- <b>Dropdown Menus</b> <br /><br /></td><td></td></td></td></tr><tr><td>
230
-
231
- Amount Dropdown Menu: </td><td></td></td></td></tr><tr><td colspan="3">
232
- <table><tr><td>
233
- Amount Menu Name: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</td><td><input type="text" name="wpedon_button_scpriceprice" id="wpedon_button_scpriceprice" value="<?php if(isset($_POST['wpedon_button_scpriceprice'])) { echo esc_attr($_POST['wpedon_button_scpriceprice']); } ?>"></td><td> Optional, but required to show menu - show an amount dropdown menu. </td></tr><tr><td>
234
- Option / Amount 1: </td><td><input type="text" name="wpedon_button_scpriceaname" id="wpedon_button_scpriceaname" value="<?php if(isset($_POST['wpedon_button_scpriceaname'])) { echo esc_attr($_POST['wpedon_button_scpriceaname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricea" id="wpedon_button_scpricea" value="<?php if(isset($_POST['wpedon_button_scpricea'])) { echo esc_attr($_POST['wpedon_button_scpricea']); } ?>"></td><td> Optional </td></tr><tr><td>
235
- Option / Amount 2: </td><td><input type="text" name="wpedon_button_scpricebname" id="wpedon_button_scpricebname" value="<?php if(isset($_POST['wpedon_button_scpricebname'])) { echo esc_attr($_POST['wpedon_button_scpricebname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceb" id="wpedon_button_scpriceb" value="<?php if(isset($_POST['wpedon_button_scpriceb'])) { echo esc_attr($_POST['wpedon_button_scpriceb']); } ?>"></td><td> Optional </td></tr><tr><td>
236
- Option / Amount 3: </td><td><input type="text" name="wpedon_button_scpricecname" id="wpedon_button_scpricecname" value="<?php if(isset($_POST['wpedon_button_scpricecname'])) { echo esc_attr($_POST['wpedon_button_scpricecname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricec" id="wpedon_button_scpricec" value="<?php if(isset($_POST['wpedon_button_scpricec'])) { echo esc_attr($_POST['wpedon_button_scpricec']); } ?>"></td><td> Optional </td></tr><tr><td>
237
- Option / Amount 4: </td><td><input type="text" name="wpedon_button_scpricedname" id="wpedon_button_scpricedname" value="<?php if(isset($_POST['wpedon_button_scpricedname'])) { echo esc_attr($_POST['wpedon_button_scpricedname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriced" id="wpedon_button_scpriced" value="<?php if(isset($_POST['wpedon_button_scpriced'])) { echo esc_attr($_POST['wpedon_button_scpriced']); } ?>"></td><td> Optional </td></tr><tr><td>
238
- Option / Amount 5: </td><td><input type="text" name="wpedon_button_scpriceename" id="wpedon_button_scpriceename" value="<?php if(isset($_POST['wpedon_button_scpriceename'])) { echo esc_attr($_POST['wpedon_button_scpriceename']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricee" id="wpedon_button_scpricee" value="<?php if(isset($_POST['wpedon_button_scpricee'])) { echo esc_attr($_POST['wpedon_button_scpricee']); } ?>"></td><td> Optional </td></tr><tr><td>
239
- Option / Amount 6: </td><td><input type="text" name="wpedon_button_scpricefname" id="wpedon_button_scpricefname" value="<?php if(isset($_POST['wpedon_button_scpricefname'])) { echo esc_attr($_POST['wpedon_button_scpricefname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricef" id="wpedon_button_scpricef" value="<?php if(isset($_POST['wpedon_button_scpricef'])) { echo esc_attr($_POST['wpedon_button_scpricef']); } ?>"></td><td> Optional </td></tr><tr><td>
240
- Option / Amount 7: </td><td><input type="text" name="wpedon_button_scpricegname" id="wpedon_button_scpricegname" value="<?php if(isset($_POST['wpedon_button_scpricegname'])) { echo esc_attr($_POST['wpedon_button_scpricegname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceg" id="wpedon_button_scpriceg" value="<?php if(isset($_POST['wpedon_button_scpriceg'])) { echo esc_attr($_POST['wpedon_button_scpriceg']); } ?>"></td><td> Optional </td></tr><tr><td>
241
- Option / Amount 8: </td><td><input type="text" name="wpedon_button_scpricehname" id="wpedon_button_scpricehname" value="<?php if(isset($_POST['wpedon_button_scpricehname'])) { echo esc_attr($_POST['wpedon_button_scpricehname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceh" id="wpedon_button_scpriceh" value="<?php if(isset($_POST['wpedon_button_scpriceh'])) { echo esc_attr($_POST['wpedon_button_scpriceh']); } ?>"></td><td> Optional </td></tr><tr><td>
242
- Option / Amount 9: </td><td><input type="text" name="wpedon_button_scpriceiname" id="wpedon_button_scpriceiname" value="<?php if(isset($_POST['wpedon_button_scpriceiname'])) { echo esc_attr($_POST['wpedon_button_scpriceiname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricei" id="wpedon_button_scpricei" value="<?php if(isset($_POST['wpedon_button_scpricei'])) { echo esc_attr($_POST['wpedon_button_scpricei']); } ?>"></td><td> Optional </td></tr><tr><td>
243
- Option / Amount 10: </td><td><input type="text" name="wpedon_button_scpricejname" id="wpedon_button_scpricejname" value="<?php if(isset($_POST['wpedon_button_scpricejname'])) { echo esc_attr($_POST['wpedon_button_scpricejname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricej" id="wpedon_button_scpricej" value="<?php if(isset($_POST['wpedon_button_scpricej'])) { echo esc_attr($_POST['wpedon_button_scpricej']); } ?>"></td><td> Optional
244
- </td></tr></table>
245
-
246
- <?php wp_nonce_field( 'new_wpedon_button' ); ?>
247
- <input type="hidden" name="update">
248
-
249
- </td></tr></table>
250
- </div>
251
-
252
  </form>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ global $current_user;
6
+
7
+ if (isset($_POST['update'])) {
8
+
9
+ // check nonce for security
10
+ $nonce = $_REQUEST['_wpnonce'];
11
+ if ( ! wp_verify_nonce( $nonce, 'new_wpedon_button' ) ) {
12
+ echo "Nonce verification failed.";
13
+ exit;
14
+ }
15
+
16
+ $my_post = array(
17
+ 'post_title' => sanitize_text_field($_POST['wpedon_button_name']),
18
+ 'post_status' => 'publish',
19
+ 'post_author' => $current_user->ID,
20
+ 'post_type' => 'wpplugin_don_button'
21
+ );
22
+
23
+ if (!isset($error)) {
24
+
25
+ // Insert the post and meta data into the database
26
+ $post_id = wp_insert_post( $my_post );
27
+
28
+ $wpedon_button_price = sanitize_meta( 'currency', $_POST['wpedon_button_price'], 'post' );
29
+ update_post_meta($post_id, 'wpedon_button_price', $wpedon_button_price);
30
+
31
+ update_post_meta($post_id, 'wpedon_button_id', sanitize_text_field($_POST['wpedon_button_id']));
32
+
33
+ $wpedon_button_enable_name = !empty($_POST['wpedon_button_enable_name']) ? sanitize_text_field($_POST['wpedon_button_enable_name']) : 0;
34
+ update_post_meta($post_id, 'wpedon_button_enable_name', $wpedon_button_enable_name);
35
+
36
+ $wpedon_button_enable_price = !empty($_POST['wpedon_button_enable_price']) ? sanitize_text_field($_POST['wpedon_button_enable_price']) : 0;
37
+ update_post_meta($post_id, 'wpedon_button_enable_price', $wpedon_button_enable_price);
38
+
39
+ if (!empty($_POST['wpedon_button_enable_currency'])) {
40
+ $wpedon_button_enable_currency = intval($_POST['wpedon_button_enable_currency']);
41
+ if (!$wpedon_button_enable_currency) { $wpedon_button_enable_currency = ""; }
42
+ } else {
43
+ $wpedon_button_enable_currency = 0;
44
+ }
45
+ update_post_meta($post_id, 'wpedon_button_enable_currency', $wpedon_button_enable_currency);
46
+
47
+
48
+ $wpedon_button_currency = intval($_POST['wpedon_button_currency']);
49
+ if (!$wpedon_button_currency) { $wpedon_button_currency = ""; }
50
+ update_post_meta($post_id, 'wpedon_button_currency', $wpedon_button_currency);
51
+
52
+ $wpedon_button_language = intval($_POST['wpedon_button_language']);
53
+ if (!$wpedon_button_language) { $wpedon_button_language = ""; }
54
+ update_post_meta($post_id, 'wpedon_button_language', $wpedon_button_language);
55
+
56
+ $wpedon_button_buttonsize = intval($_POST['wpedon_button_buttonsize']);
57
+ if (!$wpedon_button_buttonsize && $wpedon_button_buttonsize != "0") { $wpedon_button_buttonsize = ""; }
58
+ update_post_meta($post_id, 'wpedon_button_buttonsize', $wpedon_button_buttonsize);
59
+
60
+ update_post_meta($post_id, 'wpedon_button_account', sanitize_text_field($_POST['wpedon_button_account']));
61
+ update_post_meta($post_id, 'wpedon_button_return', sanitize_text_field($_POST['wpedon_button_return']));
62
+
63
+ update_post_meta($post_id, 'wpedon_button_scpriceprice', sanitize_text_field($_POST['wpedon_button_scpriceprice']));
64
+ update_post_meta($post_id, 'wpedon_button_scpriceaname', sanitize_text_field($_POST['wpedon_button_scpriceaname']));
65
+ update_post_meta($post_id, 'wpedon_button_scpricebname', sanitize_text_field($_POST['wpedon_button_scpricebname']));
66
+ update_post_meta($post_id, 'wpedon_button_scpricecname', sanitize_text_field($_POST['wpedon_button_scpricecname']));
67
+ update_post_meta($post_id, 'wpedon_button_scpricedname', sanitize_text_field($_POST['wpedon_button_scpricedname']));
68
+ update_post_meta($post_id, 'wpedon_button_scpriceename', sanitize_text_field($_POST['wpedon_button_scpriceename']));
69
+ update_post_meta($post_id, 'wpedon_button_scpricefname', sanitize_text_field($_POST['wpedon_button_scpricefname']));
70
+ update_post_meta($post_id, 'wpedon_button_scpricegname', sanitize_text_field($_POST['wpedon_button_scpricegname']));
71
+ update_post_meta($post_id, 'wpedon_button_scpricehname', sanitize_text_field($_POST['wpedon_button_scpricehname']));
72
+ update_post_meta($post_id, 'wpedon_button_scpriceiname', sanitize_text_field($_POST['wpedon_button_scpriceiname']));
73
+ update_post_meta($post_id, 'wpedon_button_scpricejname', sanitize_text_field($_POST['wpedon_button_scpricejname']));
74
+
75
+ $wpedon_button_scpricea = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricea'], 'post' );
76
+ update_post_meta($post_id, 'wpedon_button_scpricea', $wpedon_button_scpricea);
77
+ $wpedon_button_scpriceb = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceb'], 'post' );
78
+ update_post_meta($post_id, 'wpedon_button_scpriceb', $wpedon_button_scpriceb);
79
+ $wpedon_button_scpricec = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricec'], 'post' );
80
+ update_post_meta($post_id, 'wpedon_button_scpricec', $wpedon_button_scpricec);
81
+ $wpedon_button_scpriced = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriced'], 'post' );
82
+ update_post_meta($post_id, 'wpedon_button_scpriced', $wpedon_button_scpriced);
83
+ $wpedon_button_scpricee = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricee'], 'post' );
84
+ update_post_meta($post_id, 'wpedon_button_scpricee', $wpedon_button_scpricee);
85
+ $wpedon_button_scpricef = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricef'], 'post' );
86
+ update_post_meta($post_id, 'wpedon_button_scpricef', $wpedon_button_scpricef);
87
+ $wpedon_button_scpriceg = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceg'], 'post' );
88
+ update_post_meta($post_id, 'wpedon_button_scpriceg', $wpedon_button_scpriceg);
89
+ $wpedon_button_scpriceh = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpriceh'], 'post' );
90
+ update_post_meta($post_id, 'wpedon_button_scpriceh', $wpedon_button_scpriceh);
91
+ $wpedon_button_scpricei = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricei'], 'post' );
92
+ update_post_meta($post_id, 'wpedon_button_scpricei', $wpedon_button_scpricei);
93
+ $wpedon_button_scpricej = sanitize_meta( 'currency_wpedon', $_POST['wpedon_button_scpricej'], 'post' );
94
+ update_post_meta($post_id, 'wpedon_button_scpricej', $wpedon_button_scpricej);
95
+
96
+ echo'<script>window.location="?page=wpedon_buttons&message=created";</script>';
97
+ exit;
98
+
99
+ }
100
+ }
101
+
102
+ ?>
103
+
104
+ <div style="width:98%;">
105
+
106
+ <form method='post'>
107
+
108
+ <table width="100%"><tr><td valign="bottom" width="85%">
109
+ <br />
110
+ <span style="font-size:20pt;">New PayPal Donation Button</span>
111
+ </td><td valign="bottom">
112
+ <input type="submit" class="button-primary" style="font-size: 14px;height: 30px;float: right;" value="Save PayPal Donation Button">
113
+ </td><td valign="bottom">
114
+ <a href="admin.php?page=wpedon_buttons" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">Cancel</a>
115
+ </td></tr></table>
116
+
117
+
118
+ <?php
119
+ // error
120
+ if (isset($error) && isset($message)) {
121
+ echo "<div class='error'><p>"; echo $message; echo"</p></div>";
122
+ }
123
+ ?>
124
+
125
+
126
+ <br />
127
+
128
+ <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
129
+
130
+ <table><tr><td>
131
+
132
+ <b>Main</b> </td><td></td></td></td></tr><tr><td>
133
+ Purpose / Name: </td><td><input type="text" name="wpedon_button_name" value="<?php if(isset($_POST['wpedon_button_name'])) { echo esc_attr($_POST['wpedon_button_name']); } ?>"></td><td> Optional - The purpose of the donation. If blank, customer enters purpose.</td></tr><tr><td>
134
+ Donation Amount: </td><td><input type="text" name="wpedon_button_price" value="<?php if(isset($_POST['wpedon_button_price'])) { echo esc_attr($_POST['wpedon_button_created']); } ?>"></td><td> Optional - Example: 10.50. If blank, customer enters amount on PayPal page. If using dropdown prices, leave blank.</td></tr><tr><td>
135
+ Donation ID: </td><td><input type="text" name="wpedon_button_id" value="<?php if(isset($_POST['wpedon_button_id'])) { echo esc_attr($_POST['wpedon_button_id']); } ?>"></td><td> Optional - Example: S12T-Gec-RS.</td></tr><tr><td>
136
+
137
+ </td><td><br /></td></td></td></tr><tr><td>
138
+ <b>Language & Currency</b> </td><td></td></td></td></tr><tr><td>
139
+
140
+ </td><td><br /></td></td></td></tr><tr><td>
141
+ <b>Language:</b> </td><td>
142
+ <select name="wpedon_button_language" style="width: 190px">
143
+ <?php $wpedon_button_language = isset($_POST['wpedon_button_language']) ? sanitize_text_field($_POST['wpedon_button_language']) : -1; ?>
144
+ <option <?php if($wpedon_button_language == "0") { echo "SELECTED"; } ?> value="0">Default Language</option>
145
+ <option <?php if($wpedon_button_language == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
146
+ <option <?php if($wpedon_button_language == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
147
+ <option <?php if($wpedon_button_language == "3") { echo "SELECTED"; } ?> value="3">English</option>
148
+ <option <?php if($wpedon_button_language == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
149
+ <option <?php if($wpedon_button_language == "4") { echo "SELECTED"; } ?> value="4">French</option>
150
+ <option <?php if($wpedon_button_language == "5") { echo "SELECTED"; } ?> value="5">German</option>
151
+ <option <?php if($wpedon_button_language == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
152
+ <option <?php if($wpedon_button_language == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
153
+ <option <?php if($wpedon_button_language == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
154
+ <option <?php if($wpedon_button_language == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
155
+ <option <?php if($wpedon_button_language == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
156
+ <option <?php if($wpedon_button_language == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
157
+ <option <?php if($wpedon_button_language == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
158
+ <option <?php if($wpedon_button_language == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
159
+ <option <?php if($wpedon_button_language == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
160
+ <option <?php if($wpedon_button_language == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese -China only</option>
161
+ <option <?php if($wpedon_button_language == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
162
+ <option <?php if($wpedon_button_language == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
163
+ <option <?php if($wpedon_button_language == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
164
+ <option <?php if($wpedon_button_language == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
165
+ </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
166
+
167
+ </td><td><br /></td></td></td></tr><tr><td>
168
+ <b>Currency:</b> </td><td>
169
+ <select name="wpedon_button_currency" style="width: 190px">
170
+ <?php $wpedon_button_currency = isset($_POST['wpedon_button_currency']) ? sanitize_text_field($_POST['wpedon_button_currency']) : -1; ?>
171
+ <option <?php if($wpedon_button_currency == "0") { echo "SELECTED"; } ?> value="0">Default Currency</option>
172
+ <option <?php if($wpedon_button_currency == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
173
+ <option <?php if($wpedon_button_currency == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
174
+ <option <?php if($wpedon_button_currency == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
175
+ <option <?php if($wpedon_button_currency == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
176
+ <option <?php if($wpedon_button_currency == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
177
+ <option <?php if($wpedon_button_currency == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
178
+ <option <?php if($wpedon_button_currency == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
179
+ <option <?php if($wpedon_button_currency == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
180
+ <option <?php if($wpedon_button_currency == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
181
+ <option <?php if($wpedon_button_currency == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
182
+ <option <?php if($wpedon_button_currency == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
183
+ <option <?php if($wpedon_button_currency == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
184
+ <option <?php if($wpedon_button_currency == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
185
+ <option <?php if($wpedon_button_currency == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
186
+ <option <?php if($wpedon_button_currency == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
187
+ <option <?php if($wpedon_button_currency == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
188
+ <option <?php if($wpedon_button_currency == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
189
+ <option <?php if($wpedon_button_currency == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
190
+ <option <?php if($wpedon_button_currency == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
191
+ <option <?php if($wpedon_button_currency == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
192
+ <option <?php if($wpedon_button_currency == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
193
+ <option <?php if($wpedon_button_currency == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
194
+ <option <?php if($wpedon_button_currency == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
195
+ <option <?php if($wpedon_button_currency == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
196
+ <option <?php if($wpedon_button_currency == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
197
+ </select></td><td>Optional - Will override setttings page value.</td></td></td></tr><tr><td>
198
+
199
+ </td><td><br /></td></td></td></tr><tr><td>
200
+ <b>Other</b> </td><td></td></td></td></tr><tr><td>
201
+ PayPal Account: </td><td><input type="text" name="wpedon_button_account" value="<?php if(isset($_POST['wpedon_button_account'])) { echo esc_attr($_POST['wpedon_button_account']); } ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
202
+ Return URL: </td><td><input type="text" name="wpedon_button_return" value="<?php if(isset($_POST['wpedon_button_return'])) { echo esc_attr($_POST['wpedon_button_return']); } ?>"></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
203
+
204
+ Button Size: </td><td>
205
+ <select name="wpedon_button_buttonsize" style="width:190px;">
206
+ <?php $wpedon_button_buttonsize = isset($_POST['wpedon_button_buttonsize']) ? sanitize_text_field($_POST['wpedon_button_buttonsize']) : -1; ?>
207
+ <option value="0" <?php if($wpedon_button_buttonsize == "0") { echo "SELECTED"; } ?>>Default Button</option>
208
+ <option value="1" <?php if($wpedon_button_buttonsize == "1") { echo "SELECTED"; } ?>>Small</option>
209
+ <option value="2" <?php if($wpedon_button_buttonsize == "2") { echo "SELECTED"; } ?>>Big</option>
210
+ <option value="3" <?php if($wpedon_button_buttonsize == "3") { echo "SELECTED"; } ?>>Big with Credit Cards</option>
211
+ <option value="4" <?php if($wpedon_button_buttonsize == "4") { echo "SELECTED"; } ?>>Small 2 (English only)</option>
212
+ <option value="5" <?php if($wpedon_button_buttonsize == "5") { echo "SELECTED"; } ?>>Big 2 (English only)</option>
213
+ <option value="6" <?php if($wpedon_button_buttonsize == "6") { echo "SELECTED"; } ?>>Big 2 with Credit Cards (English only)</option>
214
+ <option value="7" <?php if($wpedon_button_buttonsize == "7") { echo "SELECTED"; } ?>>Big 3 with logo (English only)</option>
215
+ <option value="8" <?php if($wpedon_button_buttonsize == "8") { echo "SELECTED"; } ?>>Custom</option>
216
+ </select></td><td> Optional - Will override setttings page value.</td></tr><tr><td>
217
+
218
+ Show Purpose / Name: </td><td><input type="checkbox" name="wpedon_button_enable_name" value="1" <?php if (isset($_POST['wpedon_button_enable_name'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the purpose / name above the button.</td></tr><tr><td>
219
+ Show Donation Amount: : </td><td><input type="checkbox" name="wpedon_button_enable_price" value="1" <?php if (isset($_POST['wpedon_button_enable_price'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the donation amount above the button.</td></tr><tr><td>
220
+ Show Currency: </td><td><input type="checkbox" name="wpedon_button_enable_currency" value="1" <?php if (isset($_POST['wpedon_button_enable_currency'])) { echo "CHECKED"; } ?>></td><td>Optional - Show the currency (example: USD) after the amount.</td></tr><tr><td>
221
+
222
+ </td><td><br /></td></td></td></tr><tr><td>
223
+ <b>Dropdown Menus</b> <br /><br /></td><td></td></td></td></tr><tr><td>
224
+
225
+ Amount Dropdown Menu: </td><td></td></td></td></tr><tr><td colspan="3">
226
+ <table><tr><td>
227
+ Amount Menu Name: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</td><td><input type="text" name="wpedon_button_scpriceprice" id="wpedon_button_scpriceprice" value="<?php if(isset($_POST['wpedon_button_scpriceprice'])) { echo esc_attr($_POST['wpedon_button_scpriceprice']); } ?>"></td><td> Optional, but required to show menu - show an amount dropdown menu. </td></tr><tr><td>
228
+ Option / Amount 1: </td><td><input type="text" name="wpedon_button_scpriceaname" id="wpedon_button_scpriceaname" value="<?php if(isset($_POST['wpedon_button_scpriceaname'])) { echo esc_attr($_POST['wpedon_button_scpriceaname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricea" id="wpedon_button_scpricea" value="<?php if(isset($_POST['wpedon_button_scpricea'])) { echo esc_attr($_POST['wpedon_button_scpricea']); } ?>"></td><td> Optional </td></tr><tr><td>
229
+ Option / Amount 2: </td><td><input type="text" name="wpedon_button_scpricebname" id="wpedon_button_scpricebname" value="<?php if(isset($_POST['wpedon_button_scpricebname'])) { echo esc_attr($_POST['wpedon_button_scpricebname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceb" id="wpedon_button_scpriceb" value="<?php if(isset($_POST['wpedon_button_scpriceb'])) { echo esc_attr($_POST['wpedon_button_scpriceb']); } ?>"></td><td> Optional </td></tr><tr><td>
230
+ Option / Amount 3: </td><td><input type="text" name="wpedon_button_scpricecname" id="wpedon_button_scpricecname" value="<?php if(isset($_POST['wpedon_button_scpricecname'])) { echo esc_attr($_POST['wpedon_button_scpricecname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricec" id="wpedon_button_scpricec" value="<?php if(isset($_POST['wpedon_button_scpricec'])) { echo esc_attr($_POST['wpedon_button_scpricec']); } ?>"></td><td> Optional </td></tr><tr><td>
231
+ Option / Amount 4: </td><td><input type="text" name="wpedon_button_scpricedname" id="wpedon_button_scpricedname" value="<?php if(isset($_POST['wpedon_button_scpricedname'])) { echo esc_attr($_POST['wpedon_button_scpricedname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriced" id="wpedon_button_scpriced" value="<?php if(isset($_POST['wpedon_button_scpriced'])) { echo esc_attr($_POST['wpedon_button_scpriced']); } ?>"></td><td> Optional </td></tr><tr><td>
232
+ Option / Amount 5: </td><td><input type="text" name="wpedon_button_scpriceename" id="wpedon_button_scpriceename" value="<?php if(isset($_POST['wpedon_button_scpriceename'])) { echo esc_attr($_POST['wpedon_button_scpriceename']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricee" id="wpedon_button_scpricee" value="<?php if(isset($_POST['wpedon_button_scpricee'])) { echo esc_attr($_POST['wpedon_button_scpricee']); } ?>"></td><td> Optional </td></tr><tr><td>
233
+ Option / Amount 6: </td><td><input type="text" name="wpedon_button_scpricefname" id="wpedon_button_scpricefname" value="<?php if(isset($_POST['wpedon_button_scpricefname'])) { echo esc_attr($_POST['wpedon_button_scpricefname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricef" id="wpedon_button_scpricef" value="<?php if(isset($_POST['wpedon_button_scpricef'])) { echo esc_attr($_POST['wpedon_button_scpricef']); } ?>"></td><td> Optional </td></tr><tr><td>
234
+ Option / Amount 7: </td><td><input type="text" name="wpedon_button_scpricegname" id="wpedon_button_scpricegname" value="<?php if(isset($_POST['wpedon_button_scpricegname'])) { echo esc_attr($_POST['wpedon_button_scpricegname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceg" id="wpedon_button_scpriceg" value="<?php if(isset($_POST['wpedon_button_scpriceg'])) { echo esc_attr($_POST['wpedon_button_scpriceg']); } ?>"></td><td> Optional </td></tr><tr><td>
235
+ Option / Amount 8: </td><td><input type="text" name="wpedon_button_scpricehname" id="wpedon_button_scpricehname" value="<?php if(isset($_POST['wpedon_button_scpricehname'])) { echo esc_attr($_POST['wpedon_button_scpricehname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpriceh" id="wpedon_button_scpriceh" value="<?php if(isset($_POST['wpedon_button_scpriceh'])) { echo esc_attr($_POST['wpedon_button_scpriceh']); } ?>"></td><td> Optional </td></tr><tr><td>
236
+ Option / Amount 9: </td><td><input type="text" name="wpedon_button_scpriceiname" id="wpedon_button_scpriceiname" value="<?php if(isset($_POST['wpedon_button_scpriceiname'])) { echo esc_attr($_POST['wpedon_button_scpriceiname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricei" id="wpedon_button_scpricei" value="<?php if(isset($_POST['wpedon_button_scpricei'])) { echo esc_attr($_POST['wpedon_button_scpricei']); } ?>"></td><td> Optional </td></tr><tr><td>
237
+ Option / Amount 10: </td><td><input type="text" name="wpedon_button_scpricejname" id="wpedon_button_scpricejname" value="<?php if(isset($_POST['wpedon_button_scpricejname'])) { echo esc_attr($_POST['wpedon_button_scpricejname']); } ?>" style="width:94px;"><input style="width:93px;" type="text" name="wpedon_button_scpricej" id="wpedon_button_scpricej" value="<?php if(isset($_POST['wpedon_button_scpricej'])) { echo esc_attr($_POST['wpedon_button_scpricej']); } ?>"></td><td> Optional
238
+ </td></tr></table>
239
+
240
+ <?php wp_nonce_field( 'new_wpedon_button' ); ?>
241
+ <input type="hidden" name="update">
242
+
243
+ </td></tr></table>
244
+ </div>
245
+
 
 
 
 
 
 
246
  </form>
includes/private_filters.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- // media button inserter - change button text
6
-
7
- function wpedon_change_button_text( $translation, $text, $domain )
8
- {
9
- if ( 'default' == $domain and 'Insert into Post' == $text )
10
- {
11
- remove_filter( 'gettext', 'wpedon_change_button_text' );
12
- return 'Use this image';
13
- }
14
- return $translation;
15
- }
16
- add_filter( 'gettext', 'wpedon_change_button_text', 10, 3 );
17
-
18
-
19
- // currency validation
20
-
21
- function wpedon_sanitize_currency_meta( $value ) {
22
-
23
- if (!empty($value)) {
24
- $value = (float) preg_replace('/[^0-9.]*/','',$value);
25
- return number_format((float)$value, 2, '.', '');
26
- }
27
- }
28
  add_filter( 'sanitize_post_meta_currency_wpedon', 'wpedon_sanitize_currency_meta' );
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ // media button inserter - change button text
6
+
7
+ function wpedon_change_button_text( $translation, $text, $domain )
8
+ {
9
+ if ( 'default' == $domain and 'Insert into Post' == $text )
10
+ {
11
+ remove_filter( 'gettext', 'wpedon_change_button_text' );
12
+ return 'Use this image';
13
+ }
14
+ return $translation;
15
+ }
16
+ add_filter( 'gettext', 'wpedon_change_button_text', 10, 3 );
17
+
18
+
19
+ // currency validation
20
+
21
+ function wpedon_sanitize_currency_meta( $value ) {
22
+
23
+ if (!empty($value)) {
24
+ $value = (float) preg_replace('/[^0-9.]*/','',$value);
25
+ return number_format((float)$value, 2, '.', '');
26
+ }
27
+ }
28
  add_filter( 'sanitize_post_meta_currency_wpedon', 'wpedon_sanitize_currency_meta' );
includes/private_functions.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
-
3
-
4
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
-
6
-
7
- // display activation notice
8
- add_action('admin_notices', 'wpedon_admin_notices');
9
- function wpedon_admin_notices() {
10
- if (!get_option('wpedon_notice_shown')) {
11
- echo "<div class='updated'><p><a href='admin.php?page=wpedon_settings'>Click here to view the plugin settings</a>.</p></div>";
12
- update_option("wpedon_notice_shown", "true");
13
- }
14
- }
15
-
16
-
17
-
18
- // add paypal menu
19
- add_action("admin_menu", "wpedon_plugin_menu");
20
- function wpedon_plugin_menu() {
21
- global $plugin_dir_url;
22
-
23
- add_menu_page("PayPal Donations", "PayPal Donations", "manage_options", "wpedon_menu", "wpedon_plugin_orders",'dashicons-cart','28.5');
24
-
25
- add_submenu_page("wpedon_menu", "Donations", "Donations", "manage_options", "wpedon_menu", "wpedon_plugin_orders");
26
-
27
- add_submenu_page("wpedon_menu", "Buttons", "Buttons", "manage_options", "wpedon_buttons", "wpedon_plugin_buttons");
28
-
29
- add_submenu_page("wpedon_menu", "Settings", "Settings", "manage_options", "wpedon_settings", "wpedon_plugin_options");
30
- }
31
-
32
-
33
-
34
- function wpedon_action_links($links) {
35
-
36
- global $support_link, $edit_link, $settings_link;
37
- $links[] = '<a href="https://wordpress.org/support/plugin/easy-paypal-donation" target="_blank">Support</a>';
38
- $links[] = '<a href="admin.php?page=wpedon_settings">Settings</a>';
39
- return $links;
40
- }
41
-
42
- add_filter( 'plugin_action_links_' . $plugin_basename, 'wpedon_action_links' );
43
-
1
+ <?php
2
+
3
+
4
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
+
6
+
7
+ // display activation notice
8
+ add_action('admin_notices', 'wpedon_admin_notices');
9
+ function wpedon_admin_notices() {
10
+ if (!get_option('wpedon_notice_shown')) {
11
+ echo "<div class='updated'><p><a href='admin.php?page=wpedon_settings'>Click here to view the plugin settings</a>.</p></div>";
12
+ update_option("wpedon_notice_shown", "true");
13
+ }
14
+ }
15
+
16
+
17
+
18
+ // add paypal menu
19
+ add_action("admin_menu", "wpedon_plugin_menu");
20
+ function wpedon_plugin_menu() {
21
+ global $plugin_dir_url;
22
+
23
+ add_menu_page("PayPal Donations", "PayPal Donations", "manage_options", "wpedon_menu", "wpedon_plugin_orders",'dashicons-cart','28.5');
24
+
25
+ add_submenu_page("wpedon_menu", "Donations", "Donations", "manage_options", "wpedon_menu", "wpedon_plugin_orders");
26
+
27
+ add_submenu_page("wpedon_menu", "Buttons", "Buttons", "manage_options", "wpedon_buttons", "wpedon_plugin_buttons");
28
+
29
+ add_submenu_page("wpedon_menu", "Settings", "Settings", "manage_options", "wpedon_settings", "wpedon_plugin_options");
30
+ }
31
+
32
+
33
+
34
+ function wpedon_action_links($links) {
35
+
36
+ global $support_link, $edit_link, $settings_link;
37
+ $links[] = '<a href="https://wordpress.org/support/plugin/easy-paypal-donation" target="_blank">Support</a>';
38
+ $links[] = '<a href="admin.php?page=wpedon_settings">Settings</a>';
39
+ return $links;
40
+ }
41
+
42
+ add_filter( 'plugin_action_links_' . $plugin_basename, 'wpedon_action_links' );
43
+
includes/private_orders.php CHANGED
@@ -1,411 +1,414 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- function wpedon_plugin_orders() {
6
-
7
- if (!isset($_GET['action']) || $_GET['action'] == "delete" || $_GET['action2'] == "delete") {
8
-
9
- class wpedon_button_orders_table extends WP_List_Table {
10
-
11
-
12
- function get_data() {
13
- global $wp_query;
14
-
15
- $args = array(
16
- 'post_type' => 'wpplugin_don_order',
17
- 'posts_per_page' => -1,
18
- 'order' => 'DESC',
19
- 'orderby' => 'ID'
20
- );
21
-
22
- $posts = get_posts($args);
23
-
24
- $count = "0";
25
- foreach ($posts as $post) {
26
-
27
- $id = esc_attr($posts[$count]->ID);
28
- $post_title = esc_attr($posts[$count]->post_title);
29
- $post_date = esc_attr($posts[$count]->post_date);
30
- $item_number = esc_attr(get_post_meta($id,'wpedon_button_item_number',true));
31
- $payment_status = esc_attr(get_post_meta($id,'wpedon_button_payment_status',true));
32
- $payment_amount = esc_attr(get_post_meta($id,'wpedon_button_payment_amount',true));
33
- $payer_email = esc_attr(get_post_meta($id,'wpedon_button_payer_email',true));
34
- $payment_cycle = esc_attr(get_post_meta($id,'wpedon_button_payment_cycle',true));
35
-
36
-
37
- $order = $id;
38
- $item = $post_title."<br />".$item_number;
39
-
40
- $payment_amount = $payment_amount."<br />".$payment_cycle;
41
- $status = $payment_status."<br />".$payer_email;
42
-
43
- $data[] = array(
44
- 'ID' => $id,
45
- 'order' => $order,
46
- 'item' => $item,
47
- 'amount' => $payment_amount,
48
- 'status' => $status,
49
- 'date' => $post_date
50
- );
51
-
52
- $count++;
53
- }
54
-
55
- if (empty($data)) {
56
- $data = array();
57
- }
58
-
59
- return $data;
60
- }
61
-
62
-
63
-
64
- function __construct() {
65
- global $status, $page;
66
-
67
- parent::__construct( array(
68
- 'singular' => 'order',
69
- 'plural' => 'orders',
70
- 'ajax' => false
71
- ) );
72
- }
73
-
74
-
75
- function column_default($item, $column_name) {
76
- switch($column_name){
77
- case 'order':
78
- case 'amount':
79
- case 'status':
80
- case 'date':
81
- return $item[$column_name];
82
- default:
83
- return print_r($item,true);
84
- }
85
- }
86
-
87
- function column_order($item){
88
-
89
- // view
90
- $view_bare = '?page=wpedon_menu&action=view&order='.$item['ID'];
91
- $view_url = wp_nonce_url($view_bare, 'view_'.$item['ID']);
92
-
93
- // delete
94
- $delete_bare = '?page=wpedon_menu&action=delete&inline=true&order='.$item['ID'];
95
- $delete_url = wp_nonce_url($delete_bare, 'bulk-'.$this->_args['plural']);
96
-
97
- $actions = array(
98
- 'edit' => "<a href=$view_url>View</a>",
99
- 'delete' => "<a href=$delete_url>Delete</a>"
100
- );
101
-
102
- return sprintf('%1$s %2$s',
103
- $item['order'],
104
- $this->row_actions($actions)
105
- );
106
- }
107
-
108
-
109
- function column_cb($item) {
110
- return sprintf(
111
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
112
- $this->_args['singular'],
113
- $item['ID']
114
- );
115
- }
116
-
117
-
118
- function get_columns() {
119
- $columns = array(
120
- 'cb' => '<input type="checkbox" />',
121
- 'order' => 'Donation #',
122
- 'amount' => 'Amount',
123
- 'status' => 'Status / Email',
124
- 'date' => 'Date (YYYY-MM-DD HH-MM-SS)'
125
- );
126
- return $columns;
127
- }
128
-
129
-
130
- function get_sortable_columns() {
131
- $sortable_columns = array(
132
- 'id' => array('id',false),
133
- 'order' => array('order',false)
134
- );
135
- return $sortable_columns;
136
- }
137
-
138
-
139
- function no_items() {
140
- _e( 'No donations found.' );
141
- }
142
-
143
- function get_bulk_actions() {
144
- $actions = array(
145
- 'delete' => 'Delete'
146
- );
147
- return $actions;
148
- }
149
-
150
- public function process_bulk_action() {
151
- if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) ) {
152
- $nonce = $_GET['_wpnonce'];
153
- $action = 'bulk-' . $this->_args['plural'];
154
-
155
- if ( ! wp_verify_nonce( $nonce, $action ) ) {
156
- wp_die('Security check fail');
157
- }
158
- }
159
- }
160
-
161
- function prepare_items() {
162
- global $wpdb;
163
-
164
- $per_page = 8;
165
-
166
- $columns = $this->get_columns();
167
- $hidden = array();
168
- $sortable = $this->get_sortable_columns();
169
-
170
- $this->_column_headers = array($columns, $hidden, $sortable);
171
-
172
- $this->process_bulk_action();
173
-
174
- $data = $this->get_data();
175
-
176
- if (isset($_REQUEST['orderby'])) {
177
- function usort_reorder($a,$b) {
178
- $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'order';
179
- $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
180
- $result = strcmp($a[$orderby], $b[$orderby]);
181
- return ($order==='asc') ? $result : -$result;
182
- }
183
- usort($data, 'usort_reorder');
184
- }
185
-
186
- $current_page = $this->get_pagenum();
187
-
188
-
189
-
190
- $total_items = count($data);
191
-
192
- $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
193
-
194
-
195
-
196
-
197
- $this->items = $data;
198
-
199
- $this->set_pagination_args( array(
200
- 'total_items' => $total_items,
201
- 'per_page' => $per_page,
202
- 'total_pages' => ceil($total_items/$per_page)
203
- ) );
204
- }
205
- }
206
-
207
-
208
- function wpedon_tt_render_list_pagea() {
209
-
210
- $testListTable = new wpedon_button_orders_table();
211
- $testListTable->prepare_items();
212
-
213
- ?>
214
-
215
- <style>
216
- .check-column {
217
- width: 2% !important;
218
- }
219
- .column-order {
220
- width: 10%;
221
- }
222
- .column-item {
223
- width: 10%;
224
- }
225
- .column-amount {
226
- width: 10%;
227
- }
228
- .column-status {
229
- width: 12%;
230
- }
231
- </style>
232
-
233
- <div style="width:98%">
234
-
235
- <table width="100%"><tr><td>
236
- <br />
237
- <span style="font-size:20pt;">Donations</span>
238
- </td><td valign="bottom">
239
- </td></tr></table>
240
-
241
- <?php
242
- if (isset($_GET['message']) && $_GET['message'] == "deleted") {
243
- echo "<div class='updated'><p>Donation entry(s) deleted.</p></div>";
244
- }
245
- if (isset($_GET['message']) && $_GET['message'] == "nothing") {
246
- echo "<div class='updated'><p>No action selected.</p></div>";
247
- }
248
- if (isset($_GET['message']) && $_GET['message'] == "nothing_deleted") {
249
- echo "<div class='updated'><p>Nothing selected to delete.</p></div>";
250
- }
251
- if (isset($_GET['message']) && $_GET['message'] == "error") {
252
- echo "<div class='updated'><p>An error occured while processing the query. Please try again.</p></div>";
253
- }
254
- ?>
255
-
256
- <form id="products-filter" method="get">
257
- <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" />
258
- <?php $testListTable->display() ?>
259
- </form>
260
-
261
- </div>
262
-
263
- <?php
264
- }
265
-
266
- wpedon_tt_render_list_pagea();
267
- }
268
-
269
-
270
- // end admin orders page view orders
271
-
272
-
273
-
274
-
275
- // admin orders page view order
276
- if (isset($_GET['action']) && $_GET['action'] == "view") {
277
-
278
- ?>
279
-
280
- <div style="width:98%;">
281
-
282
- <form method='post' action='<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>'>
283
-
284
- <?php
285
- $post_id = intval($_GET['order']);
286
-
287
- if (!$post_id) {
288
- echo'<script>window.location="admin.php?page=wpedon_menu"; </script>';
289
- exit;
290
- }
291
-
292
- check_admin_referer('view_'.$post_id);
293
-
294
- $post_data = get_post($post_id);
295
- $title = $post_data->post_title;
296
- $date = $post_data->post_date;
297
- $txn_id = get_post_meta($post_id,'wpedon_button_txn_id',true);
298
- ?>
299
-
300
- <table width="100%"><tr><td valign="bottom" width="85%">
301
- <br />
302
- <span style="font-size:20pt;">View Donation</span>
303
- </td><td valign="bottom">
304
- <a href="?page=wpedon_menu" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">View All Donations</a>
305
- </td></tr></table>
306
-
307
- <?php
308
- // error
309
- if (isset($error) && isset($error) && isset($message)) {
310
- echo "<div class='error'><p>"; echo $message; echo"</p></div>";
311
- }
312
- // saved
313
- if (!isset($error)&& !isset($error) && isset($message)) {
314
- echo "<div class='updated'><p>"; echo $message; echo"</p></div>";
315
- }
316
- ?>
317
-
318
- <br />
319
-
320
- <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
321
-
322
- <span style="font-size:16pt;">Donation #<?php echo $post_id; ?> Details</span>
323
- <br /><br />
324
-
325
- <table width="350px"><tr><td>
326
-
327
- <b>Transaction</b></td></tr><tr><td>
328
- PayPal Transaction ID: </td><td><a target="_blank" href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_view-a-trans&id=<?php echo esc_attr($txn_id); ?>"><?php echo esc_attr($txn_id); ?></a></td></tr><tr><td>
329
- Donation Date: </td><td><?php echo esc_attr($date); ?></td></tr><tr><td>
330
- <br /></td><td></td></tr><tr><td>
331
- <b>Item</b></td></tr><tr><td>
332
- Purpose / Name: </td><td><?php echo esc_attr($title); ?></td></tr><tr><td>
333
- Amount: </td><td><?php echo esc_attr(get_post_meta($post_id,'wpedon_button_payment_amount',true)); ?></td></tr><tr><td>
334
- Recurring: </td><td><?php
335
- if (get_post_meta($post_id,'wpedon_button_payment_cycle',true) != "") {
336
- echo esc_attr(get_post_meta($post_id,'wpedon_button_payment_cycle',true));
337
- } else {
338
- echo "No";
339
- }
340
- ?></td></tr><tr><td>
341
- Donation ID: </td><td><?php echo esc_attr(get_post_meta($post_id,'wpedon_button_item_number',true)); ?></td></tr><tr><td>
342
- <br /></td><td></td></tr><tr><td>
343
- <b>Payer</b></td></tr><tr><td>
344
- Payer Email: </td><td><?php echo esc_attr(get_post_meta($post_id,'wpedon_button_payer_email',true)); ?></td></tr><tr><td>
345
- Payer Currency: </td><td><?php echo esc_attr(get_post_meta($post_id,'wpedon_button_payment_currency',true)); ?></td></tr><tr><td>
346
-
347
- </td></tr></table>
348
-
349
- <input type="hidden" name="update">
350
-
351
- </div>
352
-
353
- <div style="text-align:right">
354
- Note: If donation was set by donor as recurring on PayPal then <br />the Purpose / Name and Donation ID fields will be unavailable.
355
- </div>
356
- </form>
357
-
358
- </div>
359
-
360
- <?php
361
-
362
- }
363
- // end admin orders page view order
364
-
365
-
366
- // admin orders page delete order
367
- if (isset($_GET['action']) && $_GET['action'] == "delete" || isset($_GET['action2']) && $_GET['action2'] == "delete") {
368
-
369
- if ($_GET['inline'] == "true") {
370
- $post_id = array($_GET['order']);
371
- } else {
372
- $post_id = $_GET['order'];
373
- }
374
-
375
- if (empty($post_id)) {
376
- echo'<script>window.location="?page=wpedon_menu&message=nothing_deleted"; </script>';
377
- }
378
-
379
- foreach ($post_id as $to_delete) {
380
-
381
- $to_delete = intval($to_delete);
382
-
383
- if (!$to_delete) {
384
- echo'<script>window.location="?page=wpedon_buttons&message=error"; </script>';
385
- exit;
386
- }
387
-
388
- wp_delete_post($to_delete,1);
389
- delete_post_meta($to_delete,'wpedon_button_item_number');
390
- delete_post_meta($to_delete,'wpedon_button_payment_status');
391
- delete_post_meta($to_delete,'wpedon_button_payment_amount');
392
- delete_post_meta($to_delete,'wpedon_button_payment_cycle');
393
- delete_post_meta($to_delete,'wpedon_button_txn_id');
394
- delete_post_meta($to_delete,'wpedon_button_payer_email');
395
-
396
- }
397
-
398
- echo'<script>window.location="?page=wpedon_menu&message=deleted"; </script>';
399
-
400
- }
401
- // end admin orders page delete order
402
-
403
- // admin orders page no action taken
404
- if (isset($_GET['action']) && $_GET['action'] == "-1") {
405
-
406
- echo'<script>window.location="?page=wpedon_menu&message=nothing"; </script>';
407
-
408
- }
409
- // end admin orders page no action taken
410
-
 
 
 
411
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ function wpedon_plugin_orders() {
6
+
7
+ if (!isset($_GET['action']) || $_GET['action'] == "delete" || $_GET['action2'] == "delete") {
8
+
9
+ class wpedon_button_orders_table extends WP_List_Table {
10
+
11
+
12
+ function get_data() {
13
+ global $wp_query;
14
+
15
+ $args = array(
16
+ 'post_type' => 'wpplugin_don_order',
17
+ 'posts_per_page' => -1,
18
+ 'order' => 'DESC',
19
+ 'orderby' => 'ID'
20
+ );
21
+
22
+ $posts = get_posts($args);
23
+
24
+ $count = "0";
25
+ foreach ($posts as $post) {
26
+
27
+ $id = esc_attr($posts[$count]->ID);
28
+ $post_title = esc_attr($posts[$count]->post_title);
29
+ $post_date = esc_attr($posts[$count]->post_date);
30
+ $item_number = esc_attr(get_post_meta($id,'wpedon_button_item_number',true));
31
+ $payment_status = esc_attr(get_post_meta($id,'wpedon_button_payment_status',true));
32
+ $payment_amount = esc_attr(get_post_meta($id,'wpedon_button_payment_amount',true));
33
+ $payer_email = esc_attr(get_post_meta($id,'wpedon_button_payer_email',true));
34
+ $payment_cycle = esc_attr(get_post_meta($id,'wpedon_button_payment_cycle',true));
35
+
36
+
37
+ $order = $id;
38
+ $item = $post_title."<br />".$item_number;
39
+
40
+ $payment_amount = $payment_amount."<br />".$payment_cycle;
41
+ $status = $payment_status."<br />".$payer_email;
42
+
43
+ $data[] = array(
44
+ 'ID' => $id,
45
+ 'order' => $order,
46
+ 'item' => $item,
47
+ 'amount' => $payment_amount,
48
+ 'status' => $status,
49
+ 'date' => $post_date
50
+ );
51
+
52
+ $count++;
53
+ }
54
+
55
+ if (empty($data)) {
56
+ $data = array();
57
+ }
58
+
59
+ return $data;
60
+ }
61
+
62
+
63
+
64
+ function __construct() {
65
+ global $status, $page;
66
+
67
+ parent::__construct( array(
68
+ 'singular' => 'order',
69
+ 'plural' => 'orders',
70
+ 'ajax' => false
71
+ ) );
72
+ }
73
+
74
+
75
+ function column_default($item, $column_name) {
76
+ switch($column_name){
77
+ case 'order':
78
+ case 'amount':
79
+ case 'status':
80
+ case 'date':
81
+ return $item[$column_name];
82
+ default:
83
+ return print_r($item,true);
84
+ }
85
+ }
86
+
87
+ function column_order($item){
88
+
89
+ // view
90
+ $view_bare = '?page=wpedon_menu&action=view&order='.$item['ID'];
91
+ $view_url = wp_nonce_url($view_bare, 'view_'.$item['ID']);
92
+
93
+ // delete
94
+ $delete_bare = '?page=wpedon_menu&action=delete&inline=true&order='.$item['ID'];
95
+ $delete_url = wp_nonce_url($delete_bare, 'bulk-'.$this->_args['plural']);
96
+
97
+ $actions = array(
98
+ 'edit' => '<a href="' . esc_url($view_url) . '">View</a>',
99
+ 'delete' => '<a href="' . esc_url($delete_url) . '">Delete</a>'
100
+ );
101
+
102
+ return sprintf('%1$s %2$s',
103
+ $item['order'],
104
+ $this->row_actions($actions)
105
+ );
106
+ }
107
+
108
+
109
+ function column_cb($item) {
110
+ return sprintf(
111
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
112
+ esc_attr($this->_args['singular']),
113
+ esc_attr($item['ID'])
114
+ );
115
+ }
116
+
117
+
118
+ function get_columns() {
119
+ $columns = array(
120
+ 'cb' => '<input type="checkbox" />',
121
+ 'order' => 'Donation #',
122
+ 'amount' => 'Amount',
123
+ 'status' => 'Status / Email',
124
+ 'date' => 'Date (YYYY-MM-DD HH-MM-SS)'
125
+ );
126
+ return $columns;
127
+ }
128
+
129
+
130
+ function get_sortable_columns() {
131
+ $sortable_columns = array(
132
+ 'id' => array('id',false),
133
+ 'order' => array('order',false)
134
+ );
135
+ return $sortable_columns;
136
+ }
137
+
138
+
139
+ function no_items() {
140
+ _e( 'No donations found.' );
141
+ }
142
+
143
+ function get_bulk_actions() {
144
+ $actions = array(
145
+ 'delete' => 'Delete'
146
+ );
147
+ return $actions;
148
+ }
149
+
150
+ public function process_bulk_action() {
151
+ if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) ) {
152
+ $nonce = $_GET['_wpnonce'];
153
+ $action = 'bulk-' . $this->_args['plural'];
154
+
155
+ if ( ! wp_verify_nonce( $nonce, $action ) ) {
156
+ wp_die('Security check fail');
157
+ }
158
+ }
159
+ }
160
+
161
+ function prepare_items() {
162
+ global $wpdb;
163
+
164
+ $per_page = 8;
165
+
166
+ $columns = $this->get_columns();
167
+ $hidden = array();
168
+ $sortable = $this->get_sortable_columns();
169
+
170
+ $this->_column_headers = array($columns, $hidden, $sortable);
171
+
172
+ $this->process_bulk_action();
173
+
174
+ $data = $this->get_data();
175
+
176
+ if (isset($_REQUEST['orderby'])) {
177
+ function usort_reorder($a,$b) {
178
+ $orderby = (!empty($_REQUEST['orderby'])) ? sanitize_text_field($_REQUEST['orderby']) : 'order';
179
+ $order = (!empty($_REQUEST['order'])) ? sanitize_text_field($_REQUEST['order']) : 'asc';
180
+ $result = strcmp($a[$orderby], $b[$orderby]);
181
+ return ($order==='asc') ? $result : -$result;
182
+ }
183
+ usort($data, 'usort_reorder');
184
+ }
185
+
186
+ $current_page = $this->get_pagenum();
187
+
188
+
189
+
190
+ $total_items = count($data);
191
+
192
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
193
+
194
+
195
+
196
+
197
+ $this->items = $data;
198
+
199
+ $this->set_pagination_args( array(
200
+ 'total_items' => $total_items,
201
+ 'per_page' => $per_page,
202
+ 'total_pages' => ceil($total_items/$per_page)
203
+ ) );
204
+ }
205
+ }
206
+
207
+
208
+ function wpedon_tt_render_list_pagea() {
209
+
210
+ $testListTable = new wpedon_button_orders_table();
211
+ $testListTable->prepare_items();
212
+
213
+ ?>
214
+
215
+ <style>
216
+ .check-column {
217
+ width: 2% !important;
218
+ }
219
+ .column-order {
220
+ width: 10%;
221
+ }
222
+ .column-item {
223
+ width: 10%;
224
+ }
225
+ .column-amount {
226
+ width: 10%;
227
+ }
228
+ .column-status {
229
+ width: 12%;
230
+ }
231
+ </style>
232
+
233
+ <div style="width:98%">
234
+
235
+ <table width="100%"><tr><td>
236
+ <br />
237
+ <span style="font-size:20pt;">Donations</span>
238
+ </td><td valign="bottom">
239
+ </td></tr></table>
240
+
241
+ <?php
242
+ if (isset($_GET['message'])) {
243
+ switch ($_GET['message']) {
244
+ case 'deleted':
245
+ echo "<div class='updated'><p>Donation entry(s) deleted.</p></div>";
246
+ break;
247
+ case 'nothing':
248
+ echo "<div class='updated'><p>No action selected.</p></div>";
249
+ break;
250
+ case 'nothing_deleted':
251
+ echo "<div class='updated'><p>Nothing selected to delete.</p></div>";
252
+ break;
253
+ case 'error':
254
+ echo "<div class='updated'><p>An error occured while processing the query. Please try again.</p></div>";
255
+ }
256
+ }
257
+ ?>
258
+
259
+ <form id="products-filter" method="get">
260
+ <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" />
261
+ <?php $testListTable->display() ?>
262
+ </form>
263
+
264
+ </div>
265
+
266
+ <?php
267
+ }
268
+
269
+ wpedon_tt_render_list_pagea();
270
+ }
271
+
272
+
273
+ // end admin orders page view orders
274
+
275
+
276
+
277
+
278
+ // admin orders page view order
279
+ if (isset($_GET['action']) && $_GET['action'] == "view") {
280
+
281
+ ?>
282
+
283
+ <div style="width:98%;">
284
+
285
+ <form method='post' action='<?php echo esc_url($_SERVER["REQUEST_URI"]); ?>'>
286
+
287
+ <?php
288
+ $post_id = intval($_GET['order']);
289
+
290
+ if (!$post_id) {
291
+ echo'<script>window.location="admin.php?page=wpedon_menu"; </script>';
292
+ exit;
293
+ }
294
+
295
+ check_admin_referer('view_'.$post_id);
296
+
297
+ $post_data = get_post($post_id);
298
+ $title = $post_data->post_title;
299
+ $date = $post_data->post_date;
300
+ $txn_id = get_post_meta($post_id,'wpedon_button_txn_id',true);
301
+ ?>
302
+
303
+ <table width="100%"><tr><td valign="bottom" width="85%">
304
+ <br />
305
+ <span style="font-size:20pt;">View Donation</span>
306
+ </td><td valign="bottom">
307
+ <a href="?page=wpedon_menu" class="button-secondary" style="font-size: 14px;height: 30px;float: right;">View All Donations</a>
308
+ </td></tr></table>
309
+
310
+ <?php
311
+ // error
312
+ if (isset($error) && isset($message)) {
313
+ echo "<div class='error'><p>"; echo esc_html($message); echo"</p></div>";
314
+ }
315
+ // saved
316
+ if (!isset($error) && isset($message)) {
317
+ echo "<div class='updated'><p>"; echo esc_html($message); echo"</p></div>";
318
+ }
319
+ ?>
320
+
321
+ <br />
322
+
323
+ <div style="background-color:#fff;padding:8px;border: 1px solid #CCCCCC;"><br />
324
+
325
+ <span style="font-size:16pt;">Donation #<?php echo $post_id; ?> Details</span>
326
+ <br /><br />
327
+
328
+ <table width="350px"><tr><td>
329
+
330
+ <b>Transaction</b></td></tr><tr><td>
331
+ PayPal Transaction ID: </td><td><a target="_blank" href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_view-a-trans&id=<?php echo esc_attr($txn_id); ?>"><?php echo esc_html($txn_id); ?></a></td></tr><tr><td>
332
+ Donation Date: </td><td><?php echo esc_html($date); ?></td></tr><tr><td>
333
+ <br /></td><td></td></tr><tr><td>
334
+ <b>Item</b></td></tr><tr><td>
335
+ Purpose / Name: </td><td><?php echo esc_html($title); ?></td></tr><tr><td>
336
+ Amount: </td><td><?php echo esc_html(get_post_meta($post_id,'wpedon_button_payment_amount',true)); ?></td></tr><tr><td>
337
+ Recurring: </td><td><?php
338
+ if (get_post_meta($post_id,'wpedon_button_payment_cycle',true) != "") {
339
+ echo esc_html(get_post_meta($post_id,'wpedon_button_payment_cycle',true));
340
+ } else {
341
+ echo "No";
342
+ }
343
+ ?></td></tr><tr><td>
344
+ Donation ID: </td><td><?php echo esc_html(get_post_meta($post_id,'wpedon_button_item_number',true)); ?></td></tr><tr><td>
345
+ <br /></td><td></td></tr><tr><td>
346
+ <b>Payer</b></td></tr><tr><td>
347
+ Payer Email: </td><td><?php echo esc_html(get_post_meta($post_id,'wpedon_button_payer_email',true)); ?></td></tr><tr><td>
348
+ Payer Currency: </td><td><?php echo esc_html(get_post_meta($post_id,'wpedon_button_payment_currency',true)); ?></td></tr><tr><td>
349
+
350
+ </td></tr></table>
351
+
352
+ <input type="hidden" name="update">
353
+
354
+ </div>
355
+
356
+ <div style="text-align:right">
357
+ Note: If donation was set by donor as recurring on PayPal then <br />the Purpose / Name and Donation ID fields will be unavailable.
358
+ </div>
359
+ </form>
360
+
361
+ </div>
362
+
363
+ <?php
364
+
365
+ }
366
+ // end admin orders page view order
367
+
368
+
369
+ // admin orders page delete order
370
+ if (isset($_GET['action']) && $_GET['action'] == "delete" || isset($_GET['action2']) && $_GET['action2'] == "delete") {
371
+
372
+ if ($_GET['inline'] == "true") {
373
+ $post_id = array(intval($_GET['order']));
374
+ } else {
375
+ $post_id = array_map('intval', $_GET['order']);
376
+ }
377
+
378
+ if (empty($post_id)) {
379
+ echo'<script>window.location="?page=wpedon_menu&message=nothing_deleted"; </script>';
380
+ }
381
+
382
+ foreach ($post_id as $to_delete) {
383
+
384
+ $to_delete = intval($to_delete);
385
+
386
+ if (!$to_delete) {
387
+ echo'<script>window.location="?page=wpedon_buttons&message=error"; </script>';
388
+ exit;
389
+ }
390
+
391
+ wp_delete_post($to_delete,1);
392
+ delete_post_meta($to_delete,'wpedon_button_item_number');
393
+ delete_post_meta($to_delete,'wpedon_button_payment_status');
394
+ delete_post_meta($to_delete,'wpedon_button_payment_amount');
395
+ delete_post_meta($to_delete,'wpedon_button_payment_cycle');
396
+ delete_post_meta($to_delete,'wpedon_button_txn_id');
397
+ delete_post_meta($to_delete,'wpedon_button_payer_email');
398
+
399
+ }
400
+
401
+ echo'<script>window.location="?page=wpedon_menu&message=deleted"; </script>';
402
+
403
+ }
404
+ // end admin orders page delete order
405
+
406
+ // admin orders page no action taken
407
+ if (isset($_GET['action']) && $_GET['action'] == "-1") {
408
+
409
+ echo'<script>window.location="?page=wpedon_menu&message=nothing"; </script>';
410
+
411
+ }
412
+ // end admin orders page no action taken
413
+
414
  }
includes/private_settings.php CHANGED
@@ -1,345 +1,345 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
-
6
- function wpedon_plugin_options() {
7
- if ( !current_user_can( "manage_options" ) ) {
8
- wp_die( __( "You do not have sufficient permissions to access this page." ) );
9
- }
10
-
11
-
12
-
13
-
14
- // media uploader
15
- function load_admin_things() {
16
- wp_enqueue_script('media-upload');
17
- wp_enqueue_script('thickbox');
18
- wp_enqueue_style('thickbox');
19
- }
20
- load_admin_things();
21
-
22
- ?>
23
-
24
- <script>
25
- jQuery(document).ready(function() {
26
- var formfield;
27
- jQuery('.upload_image_button').click(function() {
28
- jQuery('html').addClass('Image');
29
- formfield = jQuery(this).prev().attr('name');
30
- tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
31
- return false;
32
- });
33
- window.original_send_to_editor = window.send_to_editor;
34
- window.send_to_editor = function(html){
35
- if (formfield) {
36
- fileurl = jQuery('img',html).attr('src');
37
- jQuery('#'+formfield).val(fileurl);
38
- tb_remove();
39
- jQuery('html').removeClass('Image');
40
- } else {
41
- window.original_send_to_editor(html);
42
- }
43
- };
44
- });
45
- </script>
46
-
47
- <?php
48
-
49
-
50
- // settings page
51
- echo "<table width='100%'><tr><td width='70%'><br />";
52
- echo "<label style='color: #000;font-size:18pt;'><center>Accept Donations with PayPal Settings</center></label>";
53
- echo "<form method='post' action='".esc_attr($_SERVER["REQUEST_URI"])."'>";
54
-
55
-
56
- // save and update options
57
- if (isset($_POST['update'])) {
58
-
59
- if (!isset($_POST['action_save']) || ! wp_verify_nonce($_POST['action_save'],'nonce_save') ) {
60
- print 'Sorry, your nonce did not verify.';
61
- exit;
62
- }
63
-
64
- $options['currency'] = intval($_POST['currency']);
65
- if (!$options['currency']) { $options['currency'] = "25"; }
66
-
67
- $options['language'] = intval($_POST['language']);
68
- if (!$options['language']) { $options['language'] = "3"; }
69
-
70
- $options['mode'] = intval($_POST['mode']);
71
- if (!$options['mode']) { $options['mode'] = "1"; }
72
-
73
- $options['size'] = intval($_POST['size']);
74
- if (!$options['size']) { $options['size'] = "1"; }
75
-
76
- $options['opens'] = intval($_POST['opens']);
77
- if (!$options['opens']) { $options['opens'] = "1"; }
78
-
79
- $options['no_shipping'] = intval($_POST['no_shipping']);
80
- if (!$options['no_shipping']) { $options['no_shipping'] = "0"; }
81
-
82
- $options['no_note'] = intval($_POST['no_note']);
83
- if (!$options['no_note']) { $options['no_note'] = "0"; }
84
-
85
- $options['liveaccount'] = sanitize_text_field($_POST['liveaccount']);
86
- $options['sandboxaccount'] = sanitize_text_field($_POST['sandboxaccount']);
87
- $options['image_1'] = sanitize_text_field($_POST['image_1']);
88
- $options['cancel'] = sanitize_text_field($_POST['cancel']);
89
- $options['return'] = sanitize_text_field($_POST['return']);
90
-
91
-
92
- update_option("wpedon_settingsoptions", $options);
93
-
94
- echo "<br /><div class='updated'><p><strong>"; _e("Settings Updated."); echo "</strong></p></div>";
95
- }
96
-
97
-
98
- // get options
99
- $options = get_option('wpedon_settingsoptions');
100
- foreach ($options as $k => $v ) { $value[$k] = esc_attr($v); }
101
-
102
- echo "</td><td></td></tr><tr><td>";
103
-
104
- // form
105
- echo "<br />";
106
- ?>
107
-
108
- <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
109
- &nbsp; Usage - How to use this plugin
110
- </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
111
-
112
- <b>1. Enter PayPal account</b><br />
113
- Enter your PayPal account on this page in the field titled "Live Account". <br /><br />
114
-
115
- <b>2. Make a button</b><br />
116
- On the <a href='admin.php?page=wpedon_buttons' target='_blank'>buttons page</a>, make a new button. <br /><br />
117
-
118
- <b>3. Place button on page</b><br />
119
- You can place the button on your site in 3 ways. In you Page / Post editor you can use the button titled "PayPal Donation Button". You can use the "PayPal Donation Button" Widget. Or you can manually place the shortcode on a Page / Post.<br /><br />
120
-
121
- <b>4. View donations</b><br />
122
- On the <a href='admin.php?page=wpedon_menu' target='_blank'>donations page</a> you can view the donations that have been made on your site.<br /><br />
123
-
124
- </div><br /><br />
125
-
126
- <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
127
- &nbsp; Language & Currency
128
- </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
129
-
130
- <b>Language:</b>
131
- <select name="language">
132
- <option <?php if ($value['language'] == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
133
- <option <?php if ($value['language'] == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
134
- <option <?php if ($value['language'] == "3") { echo "SELECTED"; } ?> value="3">English</option>
135
- <option <?php if ($value['language'] == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
136
- <option <?php if ($value['language'] == "4") { echo "SELECTED"; } ?> value="4">French</option>
137
- <option <?php if ($value['language'] == "5") { echo "SELECTED"; } ?> value="5">German</option>
138
- <option <?php if ($value['language'] == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
139
- <option <?php if ($value['language'] == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
140
- <option <?php if ($value['language'] == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
141
- <option <?php if ($value['language'] == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
142
- <option <?php if ($value['language'] == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
143
- <option <?php if ($value['language'] == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
144
- <option <?php if ($value['language'] == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
145
- <option <?php if ($value['language'] == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
146
- <option <?php if ($value['language'] == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
147
- <option <?php if ($value['language'] == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese - China only</option>
148
- <option <?php if ($value['language'] == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
149
- <option <?php if ($value['language'] == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
150
- <option <?php if ($value['language'] == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
151
- <option <?php if ($value['language'] == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
152
- </select>
153
-
154
- PayPal currently supports 20 languages.
155
- <br /><br />
156
-
157
- <b>Currency:</b>
158
- <select name="currency">
159
- <option <?php if ($value['currency'] == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
160
- <option <?php if ($value['currency'] == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
161
- <option <?php if ($value['currency'] == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
162
- <option <?php if ($value['currency'] == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
163
- <option <?php if ($value['currency'] == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
164
- <option <?php if ($value['currency'] == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
165
- <option <?php if ($value['currency'] == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
166
- <option <?php if ($value['currency'] == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
167
- <option <?php if ($value['currency'] == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
168
- <option <?php if ($value['currency'] == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
169
- <option <?php if ($value['currency'] == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
170
- <option <?php if ($value['currency'] == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
171
- <option <?php if ($value['currency'] == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
172
- <option <?php if ($value['currency'] == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
173
- <option <?php if ($value['currency'] == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
174
- <option <?php if ($value['currency'] == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
175
- <option <?php if ($value['currency'] == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
176
- <option <?php if ($value['currency'] == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
177
- <option <?php if ($value['currency'] == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
178
- <option <?php if ($value['currency'] == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
179
- <option <?php if ($value['currency'] == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
180
- <option <?php if ($value['currency'] == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
181
- <option <?php if ($value['currency'] == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
182
- <option <?php if ($value['currency'] == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
183
- <option <?php if ($value['currency'] == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
184
- </select>
185
- PayPal currently supports 25 currencies.
186
- <br /><br /></div>
187
-
188
- <?php
189
-
190
-
191
- ?>
192
- <br /><br /><div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
193
- &nbsp; PayPal Account </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
194
-
195
- <?php
196
-
197
- echo "<b>Live Account: </b><input type='text' name='liveaccount' value='".$value['liveaccount']."'> Required";
198
- echo "<br />Enter a valid Merchant account ID (strongly recommend) or PayPal account email address. All payments will go to this account.";
199
- echo "<br /><br />You can find your Merchant account ID in your PayPal account under Profile -> My business info -> Merchant account ID";
200
-
201
- 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 />";
202
-
203
-
204
- echo "<b>Sandbox Account: </b><input type='text' name='sandboxaccount' value='".$value['sandboxaccount']."'> Optional";
205
- 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.";
206
- 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 />";
207
-
208
- echo "<b>Sandbox Mode:</b>";
209
- echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "1") { echo "checked='checked'"; } echo " type='radio' name='mode' value='1'>On (Sandbox mode)";
210
- echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "2") { echo "checked='checked'"; } echo " type='radio' name='mode' value='2'>Off (Live mode)";
211
-
212
- echo "<br /><br /></div>";
213
-
214
-
215
-
216
- ?>
217
-
218
- <br /><br />
219
- <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
220
- &nbsp; Other Settings
221
- </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
222
-
223
- <?php
224
- echo "<table><tr><td valign='top'>";
225
-
226
- echo "<b>Default&nbsp;Button&nbsp;Style:</b></td><td valign='top' style='text-align: left;'>";
227
-
228
- echo "<input "; if ($value['size'] == "1") { echo "checked='checked'"; } echo " type='radio' name='size' value='1'>Small <br /><img src='https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif'></td><td valign='top' style='text-align: left;'>";
229
- echo "<input "; if ($value['size'] == "2") { echo "checked='checked'"; } echo " type='radio' name='size' value='2'>Big <br /><img src='https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif'></td><td valign='top' style='text-align: left;'>";
230
- 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.paypal.com/en_US/i/btn/btn_donateCC_LG.gif'>";
231
-
232
- echo "</td></tr><tr><td></td><td valign='top'>";
233
-
234
- echo "<input "; if ($value['size'] == "4") { echo "checked='checked'"; } echo " type='radio' name='size' value='4'>Small 2 <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png'></td><td valign='top' style='text-align: left;'>";
235
- echo "<input "; if ($value['size'] == "5") { echo "checked='checked'"; } echo " type='radio' name='size' value='5'>Big 2 <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png'></td><td valign='top' style='text-align: left;'>";
236
- echo "<input "; if ($value['size'] == "6") { echo "checked='checked'"; } echo " type='radio' name='size' value='6'>Big 2 with Credit Cards <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png'></td><td valign='top' style='text-align: left;'>";
237
- echo "<input "; if ($value['size'] == "7") { echo "checked='checked'"; } echo " type='radio' name='size' value='7'>Big 3 with logo <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png'>";
238
-
239
- echo "</td></tr><tr><td></td><td valign='top' colspan='3'>";
240
-
241
-
242
- echo "<input "; if ($value['size'] == "8") { echo "checked='checked'"; } echo " type='radio' name='size' value='8'>Custom <br /> Use your own image <br />
243
- <input type='text' id='image_1' name='image_1' size='15' value='"; echo $value["image_1"]; echo"'><input id='_btn' class='upload_image_button' type='button' value='Select Image'>";
244
-
245
- echo "</td></tr><tr><td><b><br />Buttons open PayPal in:</b></td>";
246
- echo "<td><input "; if ($value['opens'] == "1") { echo "checked='checked'"; } echo " type='radio' name='opens' value='1'>Same page</td>";
247
- echo "<td><input "; if ($value['opens'] == "2") { echo "checked='checked'"; } echo " type='radio' name='opens' value='2'>New page</td></tr>";
248
-
249
- echo "</td></tr><tr><td><b><br />Prompt buyers to include a note<br /> with their payments:</b></td>";
250
- echo "<td><input "; if ($value['no_note'] == "0") { echo "checked='checked'"; } echo " type='radio' name='no_note' value='0'>Yes</td>";
251
- echo "<td><input "; if ($value['no_note'] == "1") { echo "checked='checked'"; } echo " type='radio' name='no_note' value='1'>No</td></tr>";
252
-
253
- echo "</td></tr><tr><td><b><br />Prompt buyers for a shipping<br /> address:</b></td>";
254
- echo "<td><input "; if ($value['no_shipping'] == "0") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='0'>Yes</td>";
255
- echo "<td><input "; if ($value['no_shipping'] == "1") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='1'>No</td>";
256
- echo "<td><input "; if ($value['no_shipping'] == "2") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='2'>Yes, and require</td></tr>";
257
-
258
-
259
- echo "</table><br /><br />";
260
-
261
-
262
-
263
- $siteurl = get_site_url();
264
-
265
- echo "<b>Cancel URL: </b>";
266
- echo "<input type='text' name='cancel' value='".$value['cancel']."'> Optional <br />";
267
- echo "If the customer goes to PayPal and clicks the cancel button, where do they go. Example: $siteurl/cancel. Max length: 1,024 characters. <br /><br />";
268
-
269
- echo "<b>Return URL: </b>";
270
- echo "<input type='text' name='return' value='".$value['return']."'> Optional <br />";
271
- echo "If the customer goes to PayPal and successfully pays, where are they redirected to after. Example: $siteurl/thankyou. Max length: 1,024 characters. <br /><br />";
272
-
273
-
274
- ?>
275
- <br /><br /></div>
276
-
277
- <input type='hidden' name='update'><br />
278
- <?php echo wp_nonce_field('nonce_save','action_save'); ?>
279
- <input type='submit' name='btn2' class='button-primary' style='font-size: 17px;line-height: 28px;height: 32px;' value='Save Settings'>
280
-
281
-
282
-
283
-
284
-
285
- <br /><br /><br />
286
-
287
-
288
- WPPlugin is an offical PayPal Partner. Various trademarks held by their respective owners.
289
-
290
-
291
- </form>
292
-
293
-
294
-
295
-
296
- </td><td width='5%'>
297
- </td><td width='24%' valign='top'>
298
-
299
- <br />
300
-
301
- <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
302
- &nbsp; Get the Pro Version
303
- </div>
304
-
305
- <div style="background-color:#fff;border: 1px solid #E5E5E5;padding:8px;">
306
-
307
- <center><label style="font-size:14pt;">With the Pro version you'll <br /> be able to: </label></center>
308
-
309
- <br />
310
- <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer recurring donations.<br />
311
- <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer daily, weekly, monthly, and yearly billing.<br />
312
- <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Set how long should billing should continue.<br />
313
- <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offers customers a recurring donations dropdown menu.<br />
314
- <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer up to 20 amount dropdown menu options instead of 10.<br />
315
-
316
  <br />
317
- <center><a target='_blank' href="https://wpplugin.org/downloads/paypal-donation-pro/" class='button-primary' style='font-size: 17px;line-height: 28px;height: 32px;'>Learn More</a></center>
318
- <br />
319
-
320
- </div>
321
-
322
- <br /><br />
323
-
324
- <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
325
- &nbsp; Quick Links
326
- </div>
327
-
328
- <div style="background-color:#fff;border: 1px solid #E5E5E5;padding:8px;"><br />
329
-
330
- <div class="dashicons dashicons-arrow-right" style="margin-bottom: 6px;"></div> <a target="_blank" href="https://wordpress.org/support/plugin/easy-paypal-donation">Support Forum</a> <br />
331
-
332
- <div class="dashicons dashicons-arrow-right" style="margin-bottom: 6px;"></div> <a target="_blank" href="https://wpplugin.org/documentation">FAQ</a> <br />
333
-
334
- </div>
335
-
336
-
337
-
338
- </td><td width='1%'>
339
-
340
- </td></tr></table>
341
-
342
-
343
- <?php
344
- // end settings page and required permissions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ function wpedon_plugin_options() {
7
+ if ( !current_user_can( "manage_options" ) ) {
8
+ wp_die( __( "You do not have sufficient permissions to access this page." ) );
9
+ }
10
+
11
+
12
+
13
+
14
+ // media uploader
15
+ function load_admin_things() {
16
+ wp_enqueue_script('media-upload');
17
+ wp_enqueue_script('thickbox');
18
+ wp_enqueue_style('thickbox');
19
+ }
20
+ load_admin_things();
21
+
22
+ ?>
23
+
24
+ <script>
25
+ jQuery(document).ready(function() {
26
+ var formfield;
27
+ jQuery('.upload_image_button').click(function() {
28
+ jQuery('html').addClass('Image');
29
+ formfield = jQuery(this).prev().attr('name');
30
+ tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
31
+ return false;
32
+ });
33
+ window.original_send_to_editor = window.send_to_editor;
34
+ window.send_to_editor = function(html){
35
+ if (formfield) {
36
+ fileurl = jQuery('img',html).attr('src');
37
+ jQuery('#'+formfield).val(fileurl);
38
+ tb_remove();
39
+ jQuery('html').removeClass('Image');
40
+ } else {
41
+ window.original_send_to_editor(html);
42
+ }
43
+ };
44
+ });
45
+ </script>
46
+
47
+ <?php
48
+
49
+
50
+ // settings page
51
+ echo "<table width='100%'><tr><td width='70%'><br />";
52
+ echo "<label style='color: #000;font-size:18pt;'><center>Accept Donations with PayPal Settings</center></label>";
53
+ echo "<form method='post' action='".esc_url($_SERVER["REQUEST_URI"])."'>";
54
+
55
+
56
+ // save and update options
57
+ if (isset($_POST['update'])) {
58
+
59
+ if (!isset($_POST['action_save']) || ! wp_verify_nonce($_POST['action_save'],'nonce_save') ) {
60
+ print 'Sorry, your nonce did not verify.';
61
+ exit;
62
+ }
63
+
64
+ $options['currency'] = intval($_POST['currency']);
65
+ if (!$options['currency']) { $options['currency'] = "25"; }
66
+
67
+ $options['language'] = intval($_POST['language']);
68
+ if (!$options['language']) { $options['language'] = "3"; }
69
+
70
+ $options['mode'] = intval($_POST['mode']);
71
+ if (!$options['mode']) { $options['mode'] = "1"; }
72
+
73
+ $options['size'] = intval($_POST['size']);
74
+ if (!$options['size']) { $options['size'] = "1"; }
75
+
76
+ $options['opens'] = intval($_POST['opens']);
77
+ if (!$options['opens']) { $options['opens'] = "1"; }
78
+
79
+ $options['no_shipping'] = intval($_POST['no_shipping']);
80
+ if (!$options['no_shipping']) { $options['no_shipping'] = "0"; }
81
+
82
+ $options['no_note'] = intval($_POST['no_note']);
83
+ if (!$options['no_note']) { $options['no_note'] = "0"; }
84
+
85
+ $options['liveaccount'] = sanitize_text_field($_POST['liveaccount']);
86
+ $options['sandboxaccount'] = sanitize_text_field($_POST['sandboxaccount']);
87
+ $options['image_1'] = sanitize_text_field($_POST['image_1']);
88
+ $options['cancel'] = sanitize_text_field($_POST['cancel']);
89
+ $options['return'] = sanitize_text_field($_POST['return']);
90
+
91
+
92
+ update_option("wpedon_settingsoptions", $options);
93
+
94
+ echo "<br /><div class='updated'><p><strong>"; _e("Settings Updated."); echo "</strong></p></div>";
95
+ }
96
+
97
+
98
+ // get options
99
+ $options = get_option('wpedon_settingsoptions');
100
+ foreach ($options as $k => $v ) { $value[$k] = $v; }
101
+
102
+ echo "</td><td></td></tr><tr><td>";
103
+
104
+ // form
105
+ echo "<br />";
106
+ ?>
107
+
108
+ <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
109
+ &nbsp; Usage - How to use this plugin
110
+ </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
111
+
112
+ <b>1. Enter PayPal account</b><br />
113
+ Enter your PayPal account on this page in the field titled "Live Account". <br /><br />
114
+
115
+ <b>2. Make a button</b><br />
116
+ On the <a href='admin.php?page=wpedon_buttons' target='_blank'>buttons page</a>, make a new button. <br /><br />
117
+
118
+ <b>3. Place button on page</b><br />
119
+ You can place the button on your site in 3 ways. In you Page / Post editor you can use the button titled "PayPal Donation Button". You can use the "PayPal Donation Button" Widget. Or you can manually place the shortcode on a Page / Post.<br /><br />
120
+
121
+ <b>4. View donations</b><br />
122
+ On the <a href='admin.php?page=wpedon_menu' target='_blank'>donations page</a> you can view the donations that have been made on your site.<br /><br />
123
+
124
+ </div><br /><br />
125
+
126
+ <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
127
+ &nbsp; Language & Currency
128
+ </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
129
+
130
+ <b>Language:</b>
131
+ <select name="language">
132
+ <option <?php if ($value['language'] == "1") { echo "SELECTED"; } ?> value="1">Danish</option>
133
+ <option <?php if ($value['language'] == "2") { echo "SELECTED"; } ?> value="2">Dutch</option>
134
+ <option <?php if ($value['language'] == "3") { echo "SELECTED"; } ?> value="3">English</option>
135
+ <option <?php if ($value['language'] == "20") { echo "SELECTED"; } ?> value="20">English - UK</option>
136
+ <option <?php if ($value['language'] == "4") { echo "SELECTED"; } ?> value="4">French</option>
137
+ <option <?php if ($value['language'] == "5") { echo "SELECTED"; } ?> value="5">German</option>
138
+ <option <?php if ($value['language'] == "6") { echo "SELECTED"; } ?> value="6">Hebrew</option>
139
+ <option <?php if ($value['language'] == "7") { echo "SELECTED"; } ?> value="7">Italian</option>
140
+ <option <?php if ($value['language'] == "8") { echo "SELECTED"; } ?> value="8">Japanese</option>
141
+ <option <?php if ($value['language'] == "9") { echo "SELECTED"; } ?> value="9">Norwgian</option>
142
+ <option <?php if ($value['language'] == "10") { echo "SELECTED"; } ?> value="10">Polish</option>
143
+ <option <?php if ($value['language'] == "11") { echo "SELECTED"; } ?> value="11">Portuguese</option>
144
+ <option <?php if ($value['language'] == "12") { echo "SELECTED"; } ?> value="12">Russian</option>
145
+ <option <?php if ($value['language'] == "13") { echo "SELECTED"; } ?> value="13">Spanish</option>
146
+ <option <?php if ($value['language'] == "14") { echo "SELECTED"; } ?> value="14">Swedish</option>
147
+ <option <?php if ($value['language'] == "15") { echo "SELECTED"; } ?> value="15">Simplified Chinese - China only</option>
148
+ <option <?php if ($value['language'] == "16") { echo "SELECTED"; } ?> value="16">Traditional Chinese - Hong Kong only</option>
149
+ <option <?php if ($value['language'] == "17") { echo "SELECTED"; } ?> value="17">Traditional Chinese - Taiwan only</option>
150
+ <option <?php if ($value['language'] == "18") { echo "SELECTED"; } ?> value="18">Turkish</option>
151
+ <option <?php if ($value['language'] == "19") { echo "SELECTED"; } ?> value="19">Thai</option>
152
+ </select>
153
+
154
+ PayPal currently supports 20 languages.
155
+ <br /><br />
156
+
157
+ <b>Currency:</b>
158
+ <select name="currency">
159
+ <option <?php if ($value['currency'] == "1") { echo "SELECTED"; } ?> value="1">Australian Dollar - AUD</option>
160
+ <option <?php if ($value['currency'] == "2") { echo "SELECTED"; } ?> value="2">Brazilian Real - BRL</option>
161
+ <option <?php if ($value['currency'] == "3") { echo "SELECTED"; } ?> value="3">Canadian Dollar - CAD</option>
162
+ <option <?php if ($value['currency'] == "4") { echo "SELECTED"; } ?> value="4">Czech Koruna - CZK</option>
163
+ <option <?php if ($value['currency'] == "5") { echo "SELECTED"; } ?> value="5">Danish Krone - DKK</option>
164
+ <option <?php if ($value['currency'] == "6") { echo "SELECTED"; } ?> value="6">Euro - EUR</option>
165
+ <option <?php if ($value['currency'] == "7") { echo "SELECTED"; } ?> value="7">Hong Kong Dollar - HKD</option>
166
+ <option <?php if ($value['currency'] == "8") { echo "SELECTED"; } ?> value="8">Hungarian Forint - HUF</option>
167
+ <option <?php if ($value['currency'] == "9") { echo "SELECTED"; } ?> value="9">Israeli New Sheqel - ILS</option>
168
+ <option <?php if ($value['currency'] == "10") { echo "SELECTED"; } ?> value="10">Japanese Yen - JPY</option>
169
+ <option <?php if ($value['currency'] == "11") { echo "SELECTED"; } ?> value="11">Malaysian Ringgit - MYR</option>
170
+ <option <?php if ($value['currency'] == "12") { echo "SELECTED"; } ?> value="12">Mexican Peso - MXN</option>
171
+ <option <?php if ($value['currency'] == "13") { echo "SELECTED"; } ?> value="13">Norwegian Krone - NOK</option>
172
+ <option <?php if ($value['currency'] == "14") { echo "SELECTED"; } ?> value="14">New Zealand Dollar - NZD</option>
173
+ <option <?php if ($value['currency'] == "15") { echo "SELECTED"; } ?> value="15">Philippine Peso - PHP</option>
174
+ <option <?php if ($value['currency'] == "16") { echo "SELECTED"; } ?> value="16">Polish Zloty - PLN</option>
175
+ <option <?php if ($value['currency'] == "17") { echo "SELECTED"; } ?> value="17">Pound Sterling - GBP</option>
176
+ <option <?php if ($value['currency'] == "18") { echo "SELECTED"; } ?> value="18">Russian Ruble - RUB</option>
177
+ <option <?php if ($value['currency'] == "19") { echo "SELECTED"; } ?> value="19">Singapore Dollar - SGD</option>
178
+ <option <?php if ($value['currency'] == "20") { echo "SELECTED"; } ?> value="20">Swedish Krona - SEK</option>
179
+ <option <?php if ($value['currency'] == "21") { echo "SELECTED"; } ?> value="21">Swiss Franc - CHF</option>
180
+ <option <?php if ($value['currency'] == "22") { echo "SELECTED"; } ?> value="22">Taiwan New Dollar - TWD</option>
181
+ <option <?php if ($value['currency'] == "23") { echo "SELECTED"; } ?> value="23">Thai Baht - THB</option>
182
+ <option <?php if ($value['currency'] == "24") { echo "SELECTED"; } ?> value="24">Turkish Lira - TRY</option>
183
+ <option <?php if ($value['currency'] == "25") { echo "SELECTED"; } ?> value="25">U.S. Dollar - USD</option>
184
+ </select>
185
+ PayPal currently supports 25 currencies.
186
+ <br /><br /></div>
187
+
188
+ <?php
189
+
190
+
191
+ ?>
192
+ <br /><br /><div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
193
+ &nbsp; PayPal Account </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
194
+
195
+ <?php
196
+
197
+ echo "<b>Live Account: </b><input type='text' name='liveaccount' value='".esc_attr($value['liveaccount'])."'> Required";
198
+ echo "<br />Enter a valid Merchant account ID (strongly recommend) or PayPal account email address. All payments will go to this account.";
199
+ echo "<br /><br />You can find your Merchant account ID in your PayPal account under Profile -> My business info -> Merchant account ID";
200
+
201
+ 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 />";
202
+
203
+
204
+ echo "<b>Sandbox Account: </b><input type='text' name='sandboxaccount' value='".esc_attr($value['sandboxaccount'])."'> Optional";
205
+ 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.";
206
+ 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 />";
207
+
208
+ echo "<b>Sandbox Mode:</b>";
209
+ echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "1") { echo "checked='checked'"; } echo " type='radio' name='mode' value='1'>On (Sandbox mode)";
210
+ echo "&nbsp; &nbsp; <input "; if ($value['mode'] == "2") { echo "checked='checked'"; } echo " type='radio' name='mode' value='2'>Off (Live mode)";
211
+
212
+ echo "<br /><br /></div>";
213
+
214
+
215
+
216
+ ?>
217
+
218
+ <br /><br />
219
+ <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
220
+ &nbsp; Other Settings
221
+ </div><div style="background-color:#fff;border: 1px solid #E5E5E5;padding:5px;"><br />
222
+
223
+ <?php
224
+ echo "<table><tr><td valign='top'>";
225
+
226
+ echo "<b>Default&nbsp;Button&nbsp;Style:</b></td><td valign='top' style='text-align: left;'>";
227
+
228
+ echo "<input "; if ($value['size'] == "1") { echo "checked='checked'"; } echo " type='radio' name='size' value='1'>Small <br /><img src='https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif'></td><td valign='top' style='text-align: left;'>";
229
+ echo "<input "; if ($value['size'] == "2") { echo "checked='checked'"; } echo " type='radio' name='size' value='2'>Big <br /><img src='https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif'></td><td valign='top' style='text-align: left;'>";
230
+ 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.paypal.com/en_US/i/btn/btn_donateCC_LG.gif'>";
231
+
232
+ echo "</td></tr><tr><td></td><td valign='top'>";
233
+
234
+ echo "<input "; if ($value['size'] == "4") { echo "checked='checked'"; } echo " type='radio' name='size' value='4'>Small 2 <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png'></td><td valign='top' style='text-align: left;'>";
235
+ echo "<input "; if ($value['size'] == "5") { echo "checked='checked'"; } echo " type='radio' name='size' value='5'>Big 2 <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png'></td><td valign='top' style='text-align: left;'>";
236
+ echo "<input "; if ($value['size'] == "6") { echo "checked='checked'"; } echo " type='radio' name='size' value='6'>Big 2 with Credit Cards <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png'></td><td valign='top' style='text-align: left;'>";
237
+ echo "<input "; if ($value['size'] == "7") { echo "checked='checked'"; } echo " type='radio' name='size' value='7'>Big 3 with logo <br />(English only)<br /><img src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png'>";
238
+
239
+ echo "</td></tr><tr><td></td><td valign='top' colspan='3'>";
240
+
241
+
242
+ echo "<input "; if ($value['size'] == "8") { echo "checked='checked'"; } echo " type='radio' name='size' value='8'>Custom <br /> Use your own image <br />
243
+ <input type='text' id='image_1' name='image_1' size='15' value='"; echo isset($value["image_1"]) ? esc_attr($value["image_1"]) : ''; echo "'><input id='_btn' class='upload_image_button' type='button' value='Select Image'>";
244
+
245
+ echo "</td></tr><tr><td><b><br />Buttons open PayPal in:</b></td>";
246
+ echo "<td><input "; if ($value['opens'] == "1") { echo "checked='checked'"; } echo " type='radio' name='opens' value='1'>Same page</td>";
247
+ echo "<td><input "; if ($value['opens'] == "2") { echo "checked='checked'"; } echo " type='radio' name='opens' value='2'>New page</td></tr>";
248
+
249
+ echo "</td></tr><tr><td><b><br />Prompt buyers to include a note<br /> with their payments:</b></td>";
250
+ echo "<td><input "; if ($value['no_note'] == "0") { echo "checked='checked'"; } echo " type='radio' name='no_note' value='0'>Yes</td>";
251
+ echo "<td><input "; if ($value['no_note'] == "1") { echo "checked='checked'"; } echo " type='radio' name='no_note' value='1'>No</td></tr>";
252
+
253
+ echo "</td></tr><tr><td><b><br />Prompt buyers for a shipping<br /> address:</b></td>";
254
+ echo "<td><input "; if ($value['no_shipping'] == "0") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='0'>Yes</td>";
255
+ echo "<td><input "; if ($value['no_shipping'] == "1") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='1'>No</td>";
256
+ echo "<td><input "; if ($value['no_shipping'] == "2") { echo "checked='checked'"; } echo " type='radio' name='no_shipping' value='2'>Yes, and require</td></tr>";
257
+
258
+
259
+ echo "</table><br /><br />";
260
+
261
+
262
+
263
+ $siteurl = get_site_url();
264
+
265
+ echo "<b>Cancel URL: </b>";
266
+ echo "<input type='text' name='cancel' value='".esc_attr($value['cancel'])."'> Optional <br />";
267
+ echo "If the customer goes to PayPal and clicks the cancel button, where do they go. Example: $siteurl/cancel. Max length: 1,024 characters. <br /><br />";
268
+
269
+ echo "<b>Return URL: </b>";
270
+ echo "<input type='text' name='return' value='".esc_attr($value['return'])."'> Optional <br />";
271
+ echo "If the customer goes to PayPal and successfully pays, where are they redirected to after. Example: $siteurl/thankyou. Max length: 1,024 characters. <br /><br />";
272
+
273
+
274
+ ?>
275
+ <br /><br /></div>
276
+
277
+ <input type='hidden' name='update'><br />
278
+ <?php echo wp_nonce_field('nonce_save','action_save'); ?>
279
+ <input type='submit' name='btn2' class='button-primary' style='font-size: 17px;line-height: 28px;height: 32px;' value='Save Settings'>
280
+
281
+
282
+
283
+
284
+
285
+ <br /><br /><br />
286
+
287
+
288
+ WPPlugin is an offical PayPal Partner. Various trademarks held by their respective owners.
289
+
290
+
291
+ </form>
292
+
293
+
294
+
295
+
296
+ </td><td width='5%'>
297
+ </td><td width='24%' valign='top'>
298
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  <br />
300
+
301
+ <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
302
+ &nbsp; Get the Pro Version
303
+ </div>
304
+
305
+ <div style="background-color:#fff;border: 1px solid #E5E5E5;padding:8px;">
306
+
307
+ <center><label style="font-size:14pt;">With the Pro version you'll <br /> be able to: </label></center>
308
+
309
+ <br />
310
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer recurring donations.<br />
311
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer daily, weekly, monthly, and yearly billing.<br />
312
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Set how long should billing should continue.<br />
313
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offers customers a recurring donations dropdown menu.<br />
314
+ <div class="dashicons dashicons-yes" style="margin-bottom: 6px;"></div>Offer up to 20 amount dropdown menu options instead of 10.<br />
315
+
316
+ <br />
317
+ <center><a target='_blank' href="https://wpplugin.org/downloads/paypal-donation-pro/" class='button-primary' style='font-size: 17px;line-height: 28px;height: 32px;'>Learn More</a></center>
318
+ <br />
319
+
320
+ </div>
321
+
322
+ <br /><br />
323
+
324
+ <div style="background-color:#333333;padding:8px;color:#eee;font-size:12pt;font-weight:bold;">
325
+ &nbsp; Quick Links
326
+ </div>
327
+
328
+ <div style="background-color:#fff;border: 1px solid #E5E5E5;padding:8px;"><br />
329
+
330
+ <div class="dashicons dashicons-arrow-right" style="margin-bottom: 6px;"></div> <a target="_blank" href="https://wordpress.org/support/plugin/easy-paypal-donation">Support Forum</a> <br />
331
+
332
+ <div class="dashicons dashicons-arrow-right" style="margin-bottom: 6px;"></div> <a target="_blank" href="https://wpplugin.org/documentation">FAQ</a> <br />
333
+
334
+ </div>
335
+
336
+
337
+
338
+ </td><td width='1%'>
339
+
340
+ </td></tr></table>
341
+
342
+
343
+ <?php
344
+ // end settings page and required permissions
345
  }
includes/private_widget.php CHANGED
@@ -1,109 +1,109 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- class wpedon_button_widget extends WP_Widget {
6
-
7
- // constructor
8
- public function __construct() {
9
- $widget_ops = array(
10
- 'classname' => 'wpedon_widget',
11
- 'description' => 'PayPal Donation Button',
12
- );
13
- parent::__construct( 'wpedon_widget', 'PayPal Donation Button', $widget_ops );
14
- }
15
-
16
- // public output
17
- function widget( $args, $instance ) {
18
- extract($args);
19
-
20
- if (!empty($instance['idvalue'])) {
21
- $idvalue = $instance['idvalue'];
22
-
23
- $code = "[wpedon id='$idvalue' widget='true']";
24
-
25
- echo do_shortcode($code);
26
- }
27
-
28
- echo $after_widget;
29
- }
30
-
31
- // private save
32
- function update( $new_instance, $old_instance ) {
33
- $instance = $old_instance;
34
- $instance['title'] = strip_tags($new_instance['title']);
35
- $instance['idvalue'] = strip_tags($new_instance['idvalue']);
36
- return $instance;
37
- }
38
-
39
- // private output
40
- function form( $instance ) {
41
-
42
- if (empty($instance['title'])) {
43
- $instance['title'] = "";
44
- }
45
- if (empty($instance['idvalue'])) {
46
- $instance['idvalue'] = "";
47
- }
48
-
49
- $title = esc_attr($instance['title']);
50
- $idvalue = esc_attr($instance['idvalue']);
51
-
52
- ?>
53
- <p><label>Widget Name:</label>
54
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
55
-
56
- Choose an existing button:
57
- <br />
58
- <select id="wpedon_button_id" name="<?php echo $this->get_field_name('idvalue'); ?>">
59
- <?php
60
- $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
61
-
62
- $posts = get_posts($args);
63
-
64
- $count = "0";
65
-
66
- if (isset($posts)) {
67
-
68
- foreach ($posts as $post) {
69
-
70
- $id = $posts[$count]->ID;
71
- $post_title = $posts[$count]->post_title;
72
- $price = esc_attr(get_post_meta($id,'wpedon_button_price',true));
73
- $sku = esc_attr(get_post_meta($id,'wpedon_button_id',true));
74
-
75
- echo "<option value='$id' "; if($idvalue == $id) { echo "SELECTED"; } echo ">";
76
- echo "Name: ";
77
- echo $post_title;
78
- echo " - Amount: ";
79
- echo $price;
80
- echo " - ID: ";
81
- echo $sku;
82
- echo "</option>";
83
-
84
- $count++;
85
- }
86
- }
87
- else {
88
- echo "<option>No buttons found.</option>";
89
- }
90
-
91
- ?>
92
- </select>
93
- <br />
94
- Make a new button: <a target="_blank" href="admin.php?page=wpedon_buttons&action=new">here</a><br />
95
- Manage existing buttons: <a target="_blank" href="admin.php?page=wpedon_buttons">here</a>
96
-
97
-
98
- <br /><br />
99
- <?php
100
- }
101
- }
102
-
103
-
104
-
105
- // Register and load the widget
106
- function wpedon_button_widget_load() {
107
- register_widget( 'wpedon_button_widget' );
108
- }
109
  add_action( 'widgets_init', 'wpedon_button_widget_load' );
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class wpedon_button_widget extends WP_Widget {
6
+
7
+ // constructor
8
+ public function __construct() {
9
+ $widget_ops = array(
10
+ 'classname' => 'wpedon_widget',
11
+ 'description' => 'PayPal Donation Button',
12
+ );
13
+ parent::__construct( 'wpedon_widget', 'PayPal Donation Button', $widget_ops );
14
+ }
15
+
16
+ // public output
17
+ function widget( $args, $instance ) {
18
+ extract($args);
19
+
20
+ if (!empty($instance['idvalue'])) {
21
+ $idvalue = $instance['idvalue'];
22
+
23
+ $code = "[wpedon id='$idvalue' widget='true']";
24
+
25
+ echo do_shortcode($code);
26
+ }
27
+
28
+ echo $after_widget;
29
+ }
30
+
31
+ // private save
32
+ function update( $new_instance, $old_instance ) {
33
+ $instance = $old_instance;
34
+ $instance['title'] = strip_tags($new_instance['title']);
35
+ $instance['idvalue'] = strip_tags($new_instance['idvalue']);
36
+ return $instance;
37
+ }
38
+
39
+ // private output
40
+ function form( $instance ) {
41
+
42
+ if (empty($instance['title'])) {
43
+ $instance['title'] = "";
44
+ }
45
+ if (empty($instance['idvalue'])) {
46
+ $instance['idvalue'] = "";
47
+ }
48
+
49
+ $title = esc_attr($instance['title']);
50
+ $idvalue = esc_attr($instance['idvalue']);
51
+
52
+ ?>
53
+ <p><label>Widget Name:</label>
54
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
55
+
56
+ Choose an existing button:
57
+ <br />
58
+ <select id="wpedon_button_id" name="<?php echo esc_attr($this->get_field_name('idvalue')); ?>">
59
+ <?php
60
+ $args = array('post_type' => 'wpplugin_don_button','posts_per_page' => -1);
61
+
62
+ $posts = get_posts($args);
63
+
64
+ $count = "0";
65
+
66
+ if (isset($posts)) {
67
+
68
+ foreach ($posts as $post) {
69
+
70
+ $id = $posts[$count]->ID;
71
+ $post_title = $posts[$count]->post_title;
72
+ $price = get_post_meta($id,'wpedon_button_price',true);
73
+ $sku = get_post_meta($id,'wpedon_button_id',true);
74
+
75
+ echo "<option value='$id' "; if($idvalue == $id) { echo "SELECTED"; } echo ">";
76
+ echo "Name: ";
77
+ echo esc_html($post_title);
78
+ echo " - Amount: ";
79
+ echo esc_html($price);
80
+ echo " - ID: ";
81
+ echo esc_html($sku);
82
+ echo "</option>";
83
+
84
+ $count++;
85
+ }
86
+ }
87
+ else {
88
+ echo "<option>No buttons found.</option>";
89
+ }
90
+
91
+ ?>
92
+ </select>
93
+ <br />
94
+ Make a new button: <a target="_blank" href="admin.php?page=wpedon_buttons&action=new">here</a><br />
95
+ Manage existing buttons: <a target="_blank" href="admin.php?page=wpedon_buttons">here</a>
96
+
97
+
98
+ <br /><br />
99
+ <?php
100
+ }
101
+ }
102
+
103
+
104
+
105
+ // Register and load the widget
106
+ function wpedon_button_widget_load() {
107
+ register_widget( 'wpedon_button_widget' );
108
+ }
109
  add_action( 'widgets_init', 'wpedon_button_widget_load' );
includes/public_ipn.php CHANGED
@@ -1,148 +1,148 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- // paypal post
6
- add_action('admin_post_add_wpedon_button_ipn', 'wpplugin_wpedon_button_ipn');
7
- add_action('admin_post_nopriv_add_wpedon_button_ipn', 'wpplugin_wpedon_button_ipn');
8
-
9
- function wpplugin_wpedon_button_ipn() {
10
-
11
- $options = get_option('wpedon_settingsoptions');
12
- foreach ($options as $k => $v ) { $value[$k] = esc_attr($v); }
13
-
14
- if ($value['mode'] == "1") {
15
- define("USE_SANDBOX", 1);
16
- } else {
17
- define("USE_SANDBOX", 0);
18
- }
19
-
20
- $raw_post_data = file_get_contents('php://input');
21
- $raw_post_array = explode('&', $raw_post_data);
22
- $myPost = array();
23
- foreach ($raw_post_array as $keyval) {
24
- $keyval = explode ('=', $keyval);
25
- if (count($keyval) == 2)
26
- $myPost[$keyval[0]] = urldecode($keyval[1]);
27
- }
28
-
29
- $req = 'cmd=_notify-validate';
30
- if(function_exists('get_magic_quotes_gpc')) {
31
- $get_magic_quotes_exists = true;
32
- }
33
- foreach ($myPost as $key => $value) {
34
- if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
35
- $value = urlencode(stripslashes($value));
36
- } else {
37
- $value = urlencode($value);
38
- }
39
- $req .= "&$key=$value";
40
- }
41
-
42
- if(USE_SANDBOX == true) {
43
- $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
44
- } else {
45
- $paypal_url = "https://www.paypal.com/cgi-bin/webscr";
46
- }
47
-
48
- $ch = curl_init($paypal_url);
49
- if ($ch == FALSE) {
50
- return FALSE;
51
- }
52
-
53
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
54
- curl_setopt($ch, CURLOPT_POST, 1);
55
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
56
- curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
57
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
58
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
59
- curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
60
-
61
- if(WP_DEBUG === true) {
62
- curl_setopt($ch, CURLOPT_HEADER, 1);
63
- curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
64
- }
65
-
66
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
67
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
68
-
69
- $res = curl_exec($ch);
70
- if (curl_errno($ch) != 0)
71
- {
72
- if(WP_DEBUG === true) {
73
- error_log(date('[Y-m-d H:i e] '). "Can't connect to PayPal to validate IPN message: " . curl_error($ch) . PHP_EOL, 3, WP_DEBUG_LOG);
74
- }
75
- curl_close($ch);
76
- exit;
77
-
78
- } else {
79
- if(WP_DEBUG === true) {
80
- error_log(date('[Y-m-d H:i e] '). "HTTP request of validation request:". curl_getinfo($ch, CURLINFO_HEADER_OUT) ." for IPN payload: $req" . PHP_EOL, 3, WP_DEBUG_LOG);
81
- error_log(date('[Y-m-d H:i e] '). "HTTP response of validation request: $res" . PHP_EOL, 3, WP_DEBUG_LOG);
82
- }
83
- curl_close($ch);
84
- }
85
-
86
- $tokens = explode("\r\n\r\n", trim($res));
87
- $res = trim(end($tokens));
88
-
89
- if (strcmp ($res, "VERIFIED") == 0) {
90
-
91
- // assign posted variables to local variables
92
- $txn_id = sanitize_text_field($_POST['txn_id']);
93
- $custom = sanitize_text_field($_POST['custom']);
94
-
95
- // lookup post author to save ipn as based on author of button
96
- $post_id_data = get_post($custom);
97
- $post_id_author = $post_id_data->post_author;
98
-
99
- // save responce to db
100
-
101
- // make sure txt id isset, if payment is recurring paypal will post successful ipn separately and that should not be logged
102
- if (!empty($txn_id)) {
103
-
104
- // assign posted variables to local variables
105
- $item_name = sanitize_text_field($_POST['item_name']);
106
- $item_number = intval($_POST['item_number']);
107
- if (!$item_number) { $item_number = ""; }
108
- $payment_status = sanitize_text_field($_POST['payment_status']);
109
- $payment_amount = sanitize_text_field($_POST['mc_gross']);
110
- $payment_currency = sanitize_text_field($_POST['mc_currency']);
111
- $payer_email = sanitize_email($_POST['payer_email']);
112
- $purchased_quantity = sanitize_text_field($_POST['quantity']);
113
- $fee = sanitize_text_field($_POST['mc_fee']);
114
- $payment_cycle = sanitize_text_field($_POST['payment_cycle']);
115
-
116
- $ipn_post = array(
117
- 'post_title' => $item_name,
118
- 'post_status' => 'publish',
119
- 'post_author' => $post_id_author,
120
- 'post_type' => 'wpplugin_don_order'
121
- );
122
-
123
- // left here as a debugging tool
124
- //$payment_cycle = file_get_contents("php://input");
125
-
126
- $post_id = wp_insert_post($ipn_post);
127
- update_post_meta($post_id, 'wpedon_button_item_number', $item_number);
128
- update_post_meta($post_id, 'wpedon_button_payment_status', $payment_status);
129
- update_post_meta($post_id, 'wpedon_button_payment_amount', $payment_amount);
130
- update_post_meta($post_id, 'wpedon_button_payment_currency', $payment_currency);
131
- update_post_meta($post_id, 'wpedon_button_txn_id', $txn_id);
132
- update_post_meta($post_id, 'wpedon_button_payer_email', $payer_email);
133
- update_post_meta($post_id, 'wpedon_button_payment_cycle', $payment_cycle);
134
-
135
- }
136
-
137
- if(WP_DEBUG === true) {
138
- error_log(date('[Y-m-d H:i e] '). "Verified IPN: $req ". PHP_EOL, 3, WP_DEBUG_LOG);
139
- }
140
- } else if (strcmp ($res, "INVALID") == 0) {
141
- // log for manual investigation
142
- if(WP_DEBUG === true) {
143
- error_log(date('[Y-m-d H:i e] '). "Invalid IPN: $req" . PHP_EOL, 3, WP_DEBUG_LOG);
144
- }
145
-
146
- }
147
-
148
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ // paypal post
6
+ add_action('admin_post_add_wpedon_button_ipn', 'wpplugin_wpedon_button_ipn');
7
+ add_action('admin_post_nopriv_add_wpedon_button_ipn', 'wpplugin_wpedon_button_ipn');
8
+
9
+ function wpplugin_wpedon_button_ipn() {
10
+
11
+ $options = get_option('wpedon_settingsoptions');
12
+ foreach ($options as $k => $v ) { $value[$k] = $v; }
13
+
14
+ if ($value['mode'] == "1") {
15
+ define("USE_SANDBOX", 1);
16
+ } else {
17
+ define("USE_SANDBOX", 0);
18
+ }
19
+
20
+ $raw_post_data = file_get_contents('php://input');
21
+ $raw_post_array = explode('&', $raw_post_data);
22
+ $myPost = array();
23
+ foreach ($raw_post_array as $keyval) {
24
+ $keyval = explode ('=', $keyval);
25
+ if (count($keyval) == 2)
26
+ $myPost[$keyval[0]] = urldecode($keyval[1]);
27
+ }
28
+
29
+ $req = 'cmd=_notify-validate';
30
+ if(function_exists('get_magic_quotes_gpc')) {
31
+ $get_magic_quotes_exists = true;
32
+ }
33
+ foreach ($myPost as $key => $value) {
34
+ if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
35
+ $value = urlencode(stripslashes($value));
36
+ } else {
37
+ $value = urlencode($value);
38
+ }
39
+ $req .= "&$key=$value";
40
+ }
41
+
42
+ if(USE_SANDBOX == true) {
43
+ $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
44
+ } else {
45
+ $paypal_url = "https://www.paypal.com/cgi-bin/webscr";
46
+ }
47
+
48
+ $ch = curl_init($paypal_url);
49
+ if ($ch == FALSE) {
50
+ return FALSE;
51
+ }
52
+
53
+ curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
54
+ curl_setopt($ch, CURLOPT_POST, 1);
55
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
56
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
57
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
58
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
59
+ curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
60
+
61
+ if(WP_DEBUG === true) {
62
+ curl_setopt($ch, CURLOPT_HEADER, 1);
63
+ curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
64
+ }
65
+
66
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
67
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
68
+
69
+ $res = curl_exec($ch);
70
+ if (curl_errno($ch) != 0)
71
+ {
72
+ if(WP_DEBUG === true) {
73
+ error_log(date('[Y-m-d H:i e] '). "Can't connect to PayPal to validate IPN message: " . curl_error($ch) . PHP_EOL, 3, WP_DEBUG_LOG);
74
+ }
75
+ curl_close($ch);
76
+ exit;
77
+
78
+ } else {
79
+ if(WP_DEBUG === true) {
80
+ error_log(date('[Y-m-d H:i e] '). "HTTP request of validation request:". curl_getinfo($ch, CURLINFO_HEADER_OUT) ." for IPN payload: $req" . PHP_EOL, 3, WP_DEBUG_LOG);
81
+ error_log(date('[Y-m-d H:i e] '). "HTTP response of validation request: $res" . PHP_EOL, 3, WP_DEBUG_LOG);
82
+ }
83
+ curl_close($ch);
84
+ }
85
+
86
+ $tokens = explode("\r\n\r\n", trim($res));
87
+ $res = trim(end($tokens));
88
+
89
+ if (strcmp ($res, "VERIFIED") == 0) {
90
+
91
+ // assign posted variables to local variables
92
+ $txn_id = sanitize_text_field($_POST['txn_id']);
93
+ $custom = sanitize_text_field($_POST['custom']);
94
+
95
+ // lookup post author to save ipn as based on author of button
96
+ $post_id_data = get_post($custom);
97
+ $post_id_author = $post_id_data->post_author;
98
+
99
+ // save responce to db
100
+
101
+ // make sure txt id isset, if payment is recurring paypal will post successful ipn separately and that should not be logged
102
+ if (!empty($txn_id)) {
103
+
104
+ // assign posted variables to local variables
105
+ $item_name = sanitize_text_field($_POST['item_name']);
106
+ $item_number = intval($_POST['item_number']);
107
+ if (!$item_number) { $item_number = ""; }
108
+ $payment_status = sanitize_text_field($_POST['payment_status']);
109
+ $payment_amount = sanitize_text_field($_POST['mc_gross']);
110
+ $payment_currency = sanitize_text_field($_POST['mc_currency']);
111
+ $payer_email = sanitize_email($_POST['payer_email']);
112
+ $purchased_quantity = sanitize_text_field($_POST['quantity']);
113
+ $fee = sanitize_text_field($_POST['mc_fee']);
114
+ $payment_cycle = sanitize_text_field($_POST['payment_cycle']);
115
+
116
+ $ipn_post = array(
117
+ 'post_title' => $item_name,
118
+ 'post_status' => 'publish',
119
+ 'post_author' => $post_id_author,
120
+ 'post_type' => 'wpplugin_don_order'
121
+ );
122
+
123
+ // left here as a debugging tool
124
+ //$payment_cycle = file_get_contents("php://input");
125
+
126
+ $post_id = wp_insert_post($ipn_post);
127
+ update_post_meta($post_id, 'wpedon_button_item_number', $item_number);
128
+ update_post_meta($post_id, 'wpedon_button_payment_status', $payment_status);
129
+ update_post_meta($post_id, 'wpedon_button_payment_amount', $payment_amount);
130
+ update_post_meta($post_id, 'wpedon_button_payment_currency', $payment_currency);
131
+ update_post_meta($post_id, 'wpedon_button_txn_id', $txn_id);
132
+ update_post_meta($post_id, 'wpedon_button_payer_email', $payer_email);
133
+ update_post_meta($post_id, 'wpedon_button_payment_cycle', $payment_cycle);
134
+
135
+ }
136
+
137
+ if(WP_DEBUG === true) {
138
+ error_log(date('[Y-m-d H:i e] '). "Verified IPN: $req ". PHP_EOL, 3, WP_DEBUG_LOG);
139
+ }
140
+ } else if (strcmp ($res, "INVALID") == 0) {
141
+ // log for manual investigation
142
+ if(WP_DEBUG === true) {
143
+ error_log(date('[Y-m-d H:i e] '). "Invalid IPN: $req" . PHP_EOL, 3, WP_DEBUG_LOG);
144
+ }
145
+
146
+ }
147
+
148
  }
includes/public_shortcode.php CHANGED
@@ -1,466 +1,466 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
-
6
- // shortcode
7
- add_shortcode('wpedon', 'wpedon_options');
8
-
9
- function wpedon_options($atts) {
10
-
11
- // get shortcode id
12
- $atts = shortcode_atts(array(
13
- 'id' => '',
14
- 'align' => '',
15
- 'widget' => '',
16
- 'name' => ''
17
- ), $atts);
18
-
19
- $post_id = $atts['id'];
20
-
21
- // get settings page values
22
- $options = get_option('wpedon_settingsoptions');
23
- foreach ($options as $k => $v ) { $value[$k] = esc_attr($v); }
24
-
25
-
26
- // get values for button
27
- $amount = esc_attr(get_post_meta($post_id,'wpedon_button_price',true));
28
- $sku = esc_attr(get_post_meta($post_id,'wpedon_button_id',true));
29
-
30
- // price dropdown
31
- $wpedon_button_scpriceprice = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceprice',true));
32
- $wpedon_button_scpriceaname = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceaname',true));
33
- $wpedon_button_scpricebname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricebname',true));
34
- $wpedon_button_scpricecname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricecname',true));
35
- $wpedon_button_scpricedname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricedname',true));
36
- $wpedon_button_scpriceename = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceename',true));
37
- $wpedon_button_scpricefname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricefname',true));
38
- $wpedon_button_scpricegname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricegname',true));
39
- $wpedon_button_scpricehname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricehname',true));
40
- $wpedon_button_scpriceiname = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceiname',true));
41
- $wpedon_button_scpricejname = esc_attr(get_post_meta($post_id,'wpedon_button_scpricejname',true));
42
-
43
- $wpedon_button_scpricea = esc_attr(get_post_meta($post_id,'wpedon_button_scpricea',true));
44
- $wpedon_button_scpriceb = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceb',true));
45
- $wpedon_button_scpricec = esc_attr(get_post_meta($post_id,'wpedon_button_scpricec',true));
46
- $wpedon_button_scpriced = esc_attr(get_post_meta($post_id,'wpedon_button_scpriced',true));
47
- $wpedon_button_scpricee = esc_attr(get_post_meta($post_id,'wpedon_button_scpricee',true));
48
- $wpedon_button_scpricef = esc_attr(get_post_meta($post_id,'wpedon_button_scpricef',true));
49
- $wpedon_button_scpriceg = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceg',true));
50
- $wpedon_button_scpriceh = esc_attr(get_post_meta($post_id,'wpedon_button_scpriceh',true));
51
- $wpedon_button_scpricei = esc_attr(get_post_meta($post_id,'wpedon_button_scpricei',true));
52
- $wpedon_button_scpricej = esc_attr(get_post_meta($post_id,'wpedon_button_scpricej',true));
53
-
54
- $post_data = get_post($post_id);
55
- $name = $post_data->post_title;
56
-
57
- $rand_string = md5(uniqid(rand(), true));
58
-
59
- // show name
60
- $wpedon_button_enable_name = esc_attr(get_post_meta($post_id,'wpedon_button_enable_name',true));
61
-
62
- // show price
63
- $wpedon_button_enable_price = esc_attr(get_post_meta($post_id,'wpedon_button_enable_price',true));
64
-
65
- // show currency
66
- $wpedon_button_enable_currency = esc_attr(get_post_meta($post_id,'wpedon_button_enable_currency',true));
67
-
68
-
69
- // live of test mode
70
- if ($value['mode'] == "1") {
71
- $account = $value['sandboxaccount'];
72
- $path = "sandbox.paypal";
73
- } elseif ($value['mode'] == "2") {
74
- $account = $value['liveaccount'];
75
- $path = "paypal";
76
- }
77
-
78
- $account_a = esc_attr(get_post_meta($post_id,'wpedon_button_account',true));
79
- if (!empty($account_a)) { $account = $account_a; }
80
-
81
- // currency
82
- $currency_a = esc_attr(get_post_meta($post_id,'wpedon_button_currency',true));
83
- if (!empty($currency_a)) { $value['currency'] = $currency_a; }
84
-
85
- if ($value['currency'] == "1") { $currency = "AUD"; }
86
- if ($value['currency'] == "2") { $currency = "BRL"; }
87
- if ($value['currency'] == "3") { $currency = "CAD"; }
88
- if ($value['currency'] == "4") { $currency = "CZK"; }
89
- if ($value['currency'] == "5") { $currency = "DKK"; }
90
- if ($value['currency'] == "6") { $currency = "EUR"; }
91
- if ($value['currency'] == "7") { $currency = "HKD"; }
92
- if ($value['currency'] == "8") { $currency = "HUF"; }
93
- if ($value['currency'] == "9") { $currency = "ILS"; }
94
- if ($value['currency'] == "10") { $currency = "JPY"; }
95
- if ($value['currency'] == "11") { $currency = "MYR"; }
96
- if ($value['currency'] == "12") { $currency = "MXN"; }
97
- if ($value['currency'] == "13") { $currency = "NOK"; }
98
- if ($value['currency'] == "14") { $currency = "NZD"; }
99
- if ($value['currency'] == "15") { $currency = "PHP"; }
100
- if ($value['currency'] == "16") { $currency = "PLN"; }
101
- if ($value['currency'] == "17") { $currency = "GBP"; }
102
- if ($value['currency'] == "18") { $currency = "RUB"; }
103
- if ($value['currency'] == "19") { $currency = "SGD"; }
104
- if ($value['currency'] == "20") { $currency = "SEK"; }
105
- if ($value['currency'] == "21") { $currency = "CHF"; }
106
- if ($value['currency'] == "22") { $currency = "TWD"; }
107
- if ($value['currency'] == "23") { $currency = "THB"; }
108
- if ($value['currency'] == "24") { $currency = "TRY"; }
109
- if ($value['currency'] == "25") { $currency = "USD"; }
110
-
111
- // language
112
- $language_a = esc_attr(get_post_meta($post_id,'wpedon_button_language',true));
113
- if (!empty($language_a)) { $value['language'] = $language_a; }
114
-
115
- if ($value['language'] == "1") {
116
- $language = "da_DK";
117
- $imagea = "https://www.paypal.com/da_DK/i/btn/btn_donate_SM.gif";
118
- $imageb = "https://www.paypal.com/da_DK/i/btn/btn_donate_LG.gif";
119
- $imagec = "https://www.paypal.com/da_DK/DK/i/btn/btn_donateCC_LG.gif";
120
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
121
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
122
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
123
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
124
- } //Danish
125
-
126
- if ($value['language'] == "2") {
127
- $language = "nl_BE";
128
- $imagea = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donate_SM.gif";
129
- $imageb = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donate_LG.gif";
130
- $imagec = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donateCC_LG.gif";
131
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
132
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
133
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
134
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
135
- } //Dutch
136
-
137
- if ($value['language'] == "3") {
138
- $language = "EN_US";
139
- $imagea = "https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif";
140
- $imageb = "https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif";
141
- $imagec = "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif";
142
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
143
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
144
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
145
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
146
- } //English
147
-
148
- if ($value['language'] == "20") {
149
- $language = "en_GB";
150
- $imagea = "https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif";
151
- $imageb = "https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif";
152
- $imagec = "https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif";
153
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
154
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
155
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
156
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
157
- } //English - UK
158
-
159
- if ($value['language'] == "4") {
160
- $language = "fr_CA";
161
- $imagea = "https://www.paypal.com/fr_CA/i/btn/btn_donate_SM.gif";
162
- $imageb = "https://www.paypal.com/fr_CA/i/btn/btn_donate_LG.gif";
163
- $imagec = "https://www.paypal.com/fr_CA/i/btn/btn_donateCC_LG.gif";
164
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
165
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
166
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
167
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
168
- } //French
169
-
170
- if ($value['language'] == "5") {
171
- $language = "de_DE";
172
- $imagea = "https://www.paypal.com/de_DE/DE/i/btn/btn_donate_SM.gif";
173
- $imageb = "https://www.paypal.com/de_DE/DE/i/btn/btn_donate_LG.gif";
174
- $imagec = "https://www.paypal.com/de_DE/DE/i/btn/btn_donateCC_LG.gif";
175
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
176
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
177
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
178
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
179
- } //German
180
-
181
- if ($value['language'] == "6") {
182
- $language = "he_IL";
183
- $imagea = "https://www.paypal.com/he_IL/i/btn/btn_donate_SM.gif";
184
- $imageb = "https://www.paypal.com/he_IL/i/btn/btn_donate_LG.gif";
185
- $imagec = "https://www.paypal.com/he_IL/i/btn/btn_donateCC_LG.gif";
186
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
187
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
188
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
189
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
190
- } //Hebrew
191
-
192
- if ($value['language'] == "7") {
193
- $language = "it_IT";
194
- $imagea = "https://www.paypal.com/it_IT/i/btn/btn_donate_SM.gif";
195
- $imageb = "https://www.paypal.com/it_IT/i/btn/btn_donate_LG.gif";
196
- $imagec = "https://www.paypal.com/it_IT/i/btn/btn_donateCC_LG.gif";
197
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
198
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
199
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
200
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
201
- } //Italian
202
-
203
- if ($value['language'] == "8") {
204
- $language = "ja_JP";
205
- $imagea = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donate_SM.gif";
206
- $imageb = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donate_LG.gif";
207
- $imagec = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donateCC_LG.gif";
208
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
209
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
210
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
211
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
212
- } //Japanese
213
-
214
- if ($value['language'] == "9") {
215
- $language = "no_NO";
216
- $imagea = "https://www.paypal.com/no_NO/i/btn/btn_donate_SM.gif";
217
- $imageb = "https://www.paypal.com/no_NO/i/btn/btn_donate_LG.gif";
218
- $imagec = "https://www.paypal.com/no_NO/i/btn/btn_donateCC_LG.gif";
219
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
220
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
221
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
222
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
223
- } //Norwgian
224
-
225
- if ($value['language'] == "10") {
226
- $language = "pl_PL";
227
- $imagea = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donate_SM.gif";
228
- $imageb = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donate_LG.gif";
229
- $imagec = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donateCC_LG.gif";
230
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
231
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
232
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
233
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
234
- } //Polish
235
-
236
- if ($value['language'] == "11") {
237
- $language = "pt_BR";
238
- $imagea = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donate_SM.gif";
239
- $imageb = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donate_LG.gif";
240
- $imagec = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donateCC_LG.gif";
241
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
242
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
243
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
244
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
245
- } //Portuguese
246
-
247
- if ($value['language'] == "12") {
248
- $language = "ru_RU";
249
- $imagea = "https://www.paypal.com/ru_RU/i/btn/btn_donate_SM.gif";
250
- $imageb = "https://www.paypal.com/ru_RU/i/btn/btn_donate_LG.gif";
251
- $imagec = "https://www.paypal.com/ru_RU/i/btn/btn_donateCC_LG.gif";
252
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
253
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
254
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
255
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
256
- } //Russian
257
-
258
- if ($value['language'] == "13") {
259
- $language = "es_ES";
260
- $imagea = "https://www.paypal.com/es_ES/ES/i/btn/btn_donate_SM.gif";
261
- $imageb = "https://www.paypal.com/es_ES/ES/i/btn/btn_donate_LG.gif";
262
- $imagec = "https://www.paypal.com/es_ES/ES/i/btn/btn_donateCC_LG.gif";
263
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
264
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
265
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
266
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
267
- } //Spanish
268
-
269
- if ($value['language'] == "14") {
270
- $language = "sv_SE";
271
- $imagea = "https://www.paypal.com/sv_SE/i/btn/btn_donate_SM.gif";
272
- $imageb = "https://www.paypal.com/sv_SE/i/btn/btn_donate_LG.gif";
273
- $imagec = "https://www.paypal.com/sv_SE/i/btn/btn_donateCC_LG.gif";
274
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
275
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
276
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
277
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
278
- } //Swedish
279
-
280
- if ($value['language'] == "15") {
281
- $language = "zh_CN";
282
- $imagea = "https://www.paypal.com/zh_XC/i/btn/btn_donate_SM.gif";
283
- $imageb = "https://www.paypal.com/zh_XC/i/btn/btn_donate_LG.gif";
284
- $imagec = "https://www.paypal.com/zh_XC/i/btn/btn_donateCC_LG.gif";
285
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
286
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
287
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
288
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
289
- } //Simplified Chinese - China
290
-
291
- if ($value['language'] == "16") {
292
- $language = "zh_HK";
293
- $imagea = "https://www.paypal.com/zh_HK/i/btn/btn_donate_SM.gif";
294
- $imageb = "https://www.paypal.com/zh_HK/i/btn/btn_donate_LG.gif";
295
- $imagec = "https://www.paypal.com/zh_HK/i/btn/btn_donateCC_LG.gif";
296
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
297
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
298
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
299
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
300
- } //Traditional Chinese - Hong Kong
301
-
302
- if ($value['language'] == "17") {
303
- $language = "zh_TW";
304
- $imagea = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donate_SM.gif";
305
- $imageb = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donate_LG.gif";
306
- $imagec = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donateCC_LG.gif";
307
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
308
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
309
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
310
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
311
- } //Traditional Chinese - Taiwan
312
-
313
- if ($value['language'] == "18") {
314
- $language = "tr_TR";
315
- $imagea = "https://www.paypal.com/tr_TR/i/btn/btn_donate_SM.gif";
316
- $imageb = "https://www.paypal.com/tr_TR/i/btn/btn_donate_LG.gif";
317
- $imagec = "https://www.paypal.com/tr_TR/i/btn/btn_donateCC_LG.gif";
318
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
319
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
320
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
321
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
322
- } //Turkish
323
-
324
- if ($value['language'] == "19") {
325
- $language = "th_TH";
326
- $imagea = "https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif";
327
- $imageb = "https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif";
328
- $imagec = "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif";
329
- $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
330
- $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
331
- $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
332
- $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
333
- } //Thai - Thai buttons not available for donation - using US is correct
334
-
335
- // custom button size
336
- $wpedon_button_buttonsize = esc_attr(get_post_meta($post_id,'wpedon_button_buttonsize',true));
337
-
338
- if ($wpedon_button_buttonsize != "0") {
339
- $value['size'] = $wpedon_button_buttonsize;
340
- }
341
-
342
- // button size
343
- if ($value['size'] == "1") { $img = $imagea; }
344
- if ($value['size'] == "2") { $img = $imageb; }
345
- if ($value['size'] == "3") { $img = $imagec; }
346
- if ($value['size'] == "4") { $img = $imaged; }
347
- if ($value['size'] == "5") { $img = $imagee; }
348
- if ($value['size'] == "6") { $img = $imagef; }
349
- if ($value['size'] == "7") { $img = $imageg; }
350
- if ($value['size'] == "8") { $img = $value['image_1']; }
351
-
352
- // widget
353
- if ($atts['widget'] == "true") {
354
- $width = "180px";
355
- } else {
356
- $width = "220px";
357
- }
358
-
359
- // return url
360
- $return = "";
361
- $return = $value['return'];
362
- $return_a = esc_attr(get_post_meta($post_id,'wpedon_button_return',true));
363
- if (!empty($return_a)) { $return = $return_a; }
364
-
365
- // window action
366
- if ($value['opens'] == "1") { $target = ""; }
367
- if ($value['opens'] == "2") { $target = "_blank"; }
368
-
369
- // alignment
370
- if ($atts['align'] == "left") { $alignment = "style='float: left;'"; }
371
- if ($atts['align'] == "right") { $alignment = "style='float: right;'"; }
372
- if ($atts['align'] == "center") { $alignment = "style='margin-left: auto;margin-right: auto;width:$width'"; }
373
- if (empty($atts['align'])) { $alignment = ""; }
374
-
375
- // notify url
376
- $notify_url = get_admin_url() . "admin-post.php?action=add_wpedon_button_ipn";
377
-
378
- $output = "";
379
- $output .= "<div $alignment>";
380
-
381
- // text description title
382
- if ($wpedon_button_enable_name == "1" || $wpedon_button_enable_price == "1") {
383
- $output .= "<label>";
384
- }
385
-
386
- if ($wpedon_button_enable_name == "1") {
387
- $output .= $name;
388
- }
389
-
390
- if ($wpedon_button_enable_name == "1" && $wpedon_button_enable_price == "1") {
391
- $output .= "<br /><span class='price'>";
392
- }
393
-
394
- if ($wpedon_button_enable_price == "1") {
395
- $output .= $amount ."</span>";
396
- }
397
-
398
- if ($wpedon_button_enable_price == "1") {
399
- if ($wpedon_button_enable_currency == "1") {
400
- $output .= $currency;
401
- }
402
- }
403
-
404
- if ($wpedon_button_enable_name == "1" || $wpedon_button_enable_price == "1") {
405
- $output .= "</label><br />";
406
- }
407
-
408
- // price dropdown menu
409
- if (!empty($wpedon_button_scpriceprice)) {
410
-
411
- // dd is active so set first value just in case no option is selected by user
412
- $amount =$wpedon_button_scpricea;
413
-
414
- $output .= "
415
- <script>
416
- jQuery(document).ready(function(){
417
- jQuery('#dd_$rand_string').on('change', function() {
418
- jQuery('#amount_$rand_string').val(this.value);
419
- });
420
- });
421
- </script>
422
- ";
423
-
424
-
425
- if (!empty($wpedon_button_scpriceprice)) { $output .= "<label style='font-size:11pt !important;'>$wpedon_button_scpriceprice</label><br /><select name='dd_$rand_string' id='dd_$rand_string' style='width:100% !important;min-width:$width !important;max-width:$width !important;border: 1px solid #ddd !important;'>"; }
426
- if (!empty($wpedon_button_scpriceaname)) { $output .= "<option value='$wpedon_button_scpricea'>". $wpedon_button_scpriceaname ."</option>"; }
427
- if (!empty($wpedon_button_scpricebname)) { $output .= "<option value='$wpedon_button_scpriceb'>". $wpedon_button_scpricebname ."</option>"; }
428
- if (!empty($wpedon_button_scpricecname)) { $output .= "<option value='$wpedon_button_scpricec'>". $wpedon_button_scpricecname ."</option>"; }
429
- if (!empty($wpedon_button_scpricedname)) { $output .= "<option value='$wpedon_button_scpriced'>". $wpedon_button_scpricedname ."</option>"; }
430
- if (!empty($wpedon_button_scpriceename)) { $output .= "<option value='$wpedon_button_scpricee'>". $wpedon_button_scpriceename ."</option>"; }
431
- if (!empty($wpedon_button_scpricefname)) { $output .= "<option value='$wpedon_button_scpricef'>". $wpedon_button_scpricefname ."</option>"; }
432
- if (!empty($wpedon_button_scpricegname)) { $output .= "<option value='$wpedon_button_scpriceg'>". $wpedon_button_scpricegname ."</option>"; }
433
- if (!empty($wpedon_button_scpricehname)) { $output .= "<option value='$wpedon_button_scpriceh'>". $wpedon_button_scpricehname ."</option>"; }
434
- if (!empty($wpedon_button_scpriceiname)) { $output .= "<option value='$wpedon_button_scpricei'>". $wpedon_button_scpriceiname ."</option>"; }
435
- if (!empty($wpedon_button_scpricejname)) { $output .= "<option value='$wpedon_button_scpricej'>". $wpedon_button_scpricejname ."</option>"; }
436
- if (!empty($wpedon_button_scpriceprice)) { $output .= "</select><br /><br />"; }
437
- }
438
-
439
-
440
- // override name field if passed as shortcode attribute
441
- if (!empty($atts['name'])) {
442
- $name = $atts['name'];
443
- }
444
-
445
- $output .= "<form target='$target' action='https://www.$path.com/cgi-bin/webscr' method='post'>";
446
- $output .= "<input type='hidden' name='cmd' value='_donations' />";
447
- $output .= "<input type='hidden' name='business' value='$account' />";
448
- $output .= "<input type='hidden' name='item_name' value='$name' />";
449
- $output .= "<input type='hidden' name='item_number' value='$sku' />";
450
- $output .= "<input type='hidden' name='currency_code' value='$currency' />";
451
- // optional - required for fixed amounts
452
- $output .= "<input type='hidden' name='amount' id='amount_$rand_string' value='$amount' />";
453
- $output .= "<input type='hidden' name='no_note' value='". $value['no_note'] ."'>";
454
- $output .= "<input type='hidden' name='no_shipping' value='". $value['no_shipping'] ."'>";
455
- $output .= "<input type='hidden' name='notify_url' value='$notify_url'>";
456
- $output .= "<input type='hidden' name='lc' value='$language'>";
457
- $output .= "<input type='hidden' name='bn' value='WPPlugin_SP'>";
458
- $output .= "<input type='hidden' name='return' value='$return' />";
459
- $output .= "<input type='hidden' name='cancel_return' value='". $value['cancel'] ."' />";
460
- $output .= "<input class='wpedon_paypalbuttonimage' type='image' src='$img' border='0' name='submit' alt='Make your payments with PayPal. It is free, secure, effective.' style='border: none;'>";
461
- $output .= "<img alt='' border='0' style='border:none;display:none;' src='https://www.paypal.com/$language/i/scr/pixel.gif' width='1' height='1'>";
462
- $output .= "</form></div>";
463
-
464
- return $output;
465
-
466
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ // shortcode
7
+ add_shortcode('wpedon', 'wpedon_options');
8
+
9
+ function wpedon_options($atts) {
10
+
11
+ // get shortcode id
12
+ $atts = shortcode_atts(array(
13
+ 'id' => '',
14
+ 'align' => '',
15
+ 'widget' => '',
16
+ 'name' => ''
17
+ ), $atts);
18
+
19
+ $post_id = $atts['id'];
20
+
21
+ // get settings page values
22
+ $options = get_option('wpedon_settingsoptions');
23
+ foreach ($options as $k => $v ) { $value[$k] = $v; }
24
+
25
+
26
+ // get values for button
27
+ $amount = get_post_meta($post_id,'wpedon_button_price',true);
28
+ $sku = get_post_meta($post_id,'wpedon_button_id',true);
29
+
30
+ // price dropdown
31
+ $wpedon_button_scpriceprice = get_post_meta($post_id,'wpedon_button_scpriceprice',true);
32
+ $wpedon_button_scpriceaname = get_post_meta($post_id,'wpedon_button_scpriceaname',true);
33
+ $wpedon_button_scpricebname = get_post_meta($post_id,'wpedon_button_scpricebname',true);
34
+ $wpedon_button_scpricecname = get_post_meta($post_id,'wpedon_button_scpricecname',true);
35
+ $wpedon_button_scpricedname = get_post_meta($post_id,'wpedon_button_scpricedname',true);
36
+ $wpedon_button_scpriceename = get_post_meta($post_id,'wpedon_button_scpriceename',true);
37
+ $wpedon_button_scpricefname = get_post_meta($post_id,'wpedon_button_scpricefname',true);
38
+ $wpedon_button_scpricegname = get_post_meta($post_id,'wpedon_button_scpricegname',true);
39
+ $wpedon_button_scpricehname = get_post_meta($post_id,'wpedon_button_scpricehname',true);
40
+ $wpedon_button_scpriceiname = get_post_meta($post_id,'wpedon_button_scpriceiname',true);
41
+ $wpedon_button_scpricejname = get_post_meta($post_id,'wpedon_button_scpricejname',true);
42
+
43
+ $wpedon_button_scpricea = get_post_meta($post_id,'wpedon_button_scpricea',true);
44
+ $wpedon_button_scpriceb = get_post_meta($post_id,'wpedon_button_scpriceb',true);
45
+ $wpedon_button_scpricec = get_post_meta($post_id,'wpedon_button_scpricec',true);
46
+ $wpedon_button_scpriced = get_post_meta($post_id,'wpedon_button_scpriced',true);
47
+ $wpedon_button_scpricee = get_post_meta($post_id,'wpedon_button_scpricee',true);
48
+ $wpedon_button_scpricef = get_post_meta($post_id,'wpedon_button_scpricef',true);
49
+ $wpedon_button_scpriceg = get_post_meta($post_id,'wpedon_button_scpriceg',true);
50
+ $wpedon_button_scpriceh = get_post_meta($post_id,'wpedon_button_scpriceh',true);
51
+ $wpedon_button_scpricei = get_post_meta($post_id,'wpedon_button_scpricei',true);
52
+ $wpedon_button_scpricej = get_post_meta($post_id,'wpedon_button_scpricej',true);
53
+
54
+ $post_data = get_post($post_id);
55
+ $name = $post_data->post_title;
56
+
57
+ $rand_string = esc_attr(md5(uniqid(rand(), true)));
58
+
59
+ // show name
60
+ $wpedon_button_enable_name = get_post_meta($post_id,'wpedon_button_enable_name',true);
61
+
62
+ // show price
63
+ $wpedon_button_enable_price = get_post_meta($post_id,'wpedon_button_enable_price',true);
64
+
65
+ // show currency
66
+ $wpedon_button_enable_currency = get_post_meta($post_id,'wpedon_button_enable_currency',true);
67
+
68
+
69
+ // live of test mode
70
+ if ($value['mode'] == "1") {
71
+ $account = $value['sandboxaccount'];
72
+ $path = "sandbox.paypal";
73
+ } elseif ($value['mode'] == "2") {
74
+ $account = $value['liveaccount'];
75
+ $path = "paypal";
76
+ }
77
+
78
+ $account_a = get_post_meta($post_id,'wpedon_button_account',true);
79
+ if (!empty($account_a)) { $account = $account_a; }
80
+
81
+ // currency
82
+ $currency_a = get_post_meta($post_id,'wpedon_button_currency',true);
83
+ if (!empty($currency_a)) { $value['currency'] = $currency_a; }
84
+
85
+ if ($value['currency'] == "1") { $currency = "AUD"; }
86
+ if ($value['currency'] == "2") { $currency = "BRL"; }
87
+ if ($value['currency'] == "3") { $currency = "CAD"; }
88
+ if ($value['currency'] == "4") { $currency = "CZK"; }
89
+ if ($value['currency'] == "5") { $currency = "DKK"; }
90
+ if ($value['currency'] == "6") { $currency = "EUR"; }
91
+ if ($value['currency'] == "7") { $currency = "HKD"; }
92
+ if ($value['currency'] == "8") { $currency = "HUF"; }
93
+ if ($value['currency'] == "9") { $currency = "ILS"; }
94
+ if ($value['currency'] == "10") { $currency = "JPY"; }
95
+ if ($value['currency'] == "11") { $currency = "MYR"; }
96
+ if ($value['currency'] == "12") { $currency = "MXN"; }
97
+ if ($value['currency'] == "13") { $currency = "NOK"; }
98
+ if ($value['currency'] == "14") { $currency = "NZD"; }
99
+ if ($value['currency'] == "15") { $currency = "PHP"; }
100
+ if ($value['currency'] == "16") { $currency = "PLN"; }
101
+ if ($value['currency'] == "17") { $currency = "GBP"; }
102
+ if ($value['currency'] == "18") { $currency = "RUB"; }
103
+ if ($value['currency'] == "19") { $currency = "SGD"; }
104
+ if ($value['currency'] == "20") { $currency = "SEK"; }
105
+ if ($value['currency'] == "21") { $currency = "CHF"; }
106
+ if ($value['currency'] == "22") { $currency = "TWD"; }
107
+ if ($value['currency'] == "23") { $currency = "THB"; }
108
+ if ($value['currency'] == "24") { $currency = "TRY"; }
109
+ if ($value['currency'] == "25") { $currency = "USD"; }
110
+
111
+ // language
112
+ $language_a = get_post_meta($post_id,'wpedon_button_language',true);
113
+ if (!empty($language_a)) { $value['language'] = $language_a; }
114
+
115
+ if ($value['language'] == "1") {
116
+ $language = "da_DK";
117
+ $imagea = "https://www.paypal.com/da_DK/i/btn/btn_donate_SM.gif";
118
+ $imageb = "https://www.paypal.com/da_DK/i/btn/btn_donate_LG.gif";
119
+ $imagec = "https://www.paypal.com/da_DK/DK/i/btn/btn_donateCC_LG.gif";
120
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
121
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
122
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
123
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
124
+ } //Danish
125
+
126
+ if ($value['language'] == "2") {
127
+ $language = "nl_BE";
128
+ $imagea = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donate_SM.gif";
129
+ $imageb = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donate_LG.gif";
130
+ $imagec = "https://www.paypal.com/nl_NL/NL/i/btn/btn_donateCC_LG.gif";
131
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
132
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
133
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
134
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
135
+ } //Dutch
136
+
137
+ if ($value['language'] == "3") {
138
+ $language = "EN_US";
139
+ $imagea = "https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif";
140
+ $imageb = "https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif";
141
+ $imagec = "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif";
142
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
143
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
144
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
145
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
146
+ } //English
147
+
148
+ if ($value['language'] == "20") {
149
+ $language = "en_GB";
150
+ $imagea = "https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif";
151
+ $imageb = "https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif";
152
+ $imagec = "https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif";
153
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
154
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
155
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
156
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
157
+ } //English - UK
158
+
159
+ if ($value['language'] == "4") {
160
+ $language = "fr_CA";
161
+ $imagea = "https://www.paypal.com/fr_CA/i/btn/btn_donate_SM.gif";
162
+ $imageb = "https://www.paypal.com/fr_CA/i/btn/btn_donate_LG.gif";
163
+ $imagec = "https://www.paypal.com/fr_CA/i/btn/btn_donateCC_LG.gif";
164
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
165
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
166
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
167
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
168
+ } //French
169
+
170
+ if ($value['language'] == "5") {
171
+ $language = "de_DE";
172
+ $imagea = "https://www.paypal.com/de_DE/DE/i/btn/btn_donate_SM.gif";
173
+ $imageb = "https://www.paypal.com/de_DE/DE/i/btn/btn_donate_LG.gif";
174
+ $imagec = "https://www.paypal.com/de_DE/DE/i/btn/btn_donateCC_LG.gif";
175
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
176
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
177
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
178
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
179
+ } //German
180
+
181
+ if ($value['language'] == "6") {
182
+ $language = "he_IL";
183
+ $imagea = "https://www.paypal.com/he_IL/i/btn/btn_donate_SM.gif";
184
+ $imageb = "https://www.paypal.com/he_IL/i/btn/btn_donate_LG.gif";
185
+ $imagec = "https://www.paypal.com/he_IL/i/btn/btn_donateCC_LG.gif";
186
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
187
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
188
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
189
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
190
+ } //Hebrew
191
+
192
+ if ($value['language'] == "7") {
193
+ $language = "it_IT";
194
+ $imagea = "https://www.paypal.com/it_IT/i/btn/btn_donate_SM.gif";
195
+ $imageb = "https://www.paypal.com/it_IT/i/btn/btn_donate_LG.gif";
196
+ $imagec = "https://www.paypal.com/it_IT/i/btn/btn_donateCC_LG.gif";
197
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
198
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
199
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
200
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
201
+ } //Italian
202
+
203
+ if ($value['language'] == "8") {
204
+ $language = "ja_JP";
205
+ $imagea = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donate_SM.gif";
206
+ $imageb = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donate_LG.gif";
207
+ $imagec = "https://www.paypal.com/ja_JP/JP/i/btn/btn_donateCC_LG.gif";
208
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
209
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
210
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
211
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
212
+ } //Japanese
213
+
214
+ if ($value['language'] == "9") {
215
+ $language = "no_NO";
216
+ $imagea = "https://www.paypal.com/no_NO/i/btn/btn_donate_SM.gif";
217
+ $imageb = "https://www.paypal.com/no_NO/i/btn/btn_donate_LG.gif";
218
+ $imagec = "https://www.paypal.com/no_NO/i/btn/btn_donateCC_LG.gif";
219
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
220
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
221
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
222
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
223
+ } //Norwgian
224
+
225
+ if ($value['language'] == "10") {
226
+ $language = "pl_PL";
227
+ $imagea = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donate_SM.gif";
228
+ $imageb = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donate_LG.gif";
229
+ $imagec = "https://www.paypal.com/pl_PL/PL/i/btn/btn_donateCC_LG.gif";
230
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
231
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
232
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
233
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
234
+ } //Polish
235
+
236
+ if ($value['language'] == "11") {
237
+ $language = "pt_BR";
238
+ $imagea = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donate_SM.gif";
239
+ $imageb = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donate_LG.gif";
240
+ $imagec = "https://www.paypal.com/pt_PT/PT/i/btn/btn_donateCC_LG.gif";
241
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
242
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
243
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
244
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
245
+ } //Portuguese
246
+
247
+ if ($value['language'] == "12") {
248
+ $language = "ru_RU";
249
+ $imagea = "https://www.paypal.com/ru_RU/i/btn/btn_donate_SM.gif";
250
+ $imageb = "https://www.paypal.com/ru_RU/i/btn/btn_donate_LG.gif";
251
+ $imagec = "https://www.paypal.com/ru_RU/i/btn/btn_donateCC_LG.gif";
252
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
253
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
254
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
255
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
256
+ } //Russian
257
+
258
+ if ($value['language'] == "13") {
259
+ $language = "es_ES";
260
+ $imagea = "https://www.paypal.com/es_ES/ES/i/btn/btn_donate_SM.gif";
261
+ $imageb = "https://www.paypal.com/es_ES/ES/i/btn/btn_donate_LG.gif";
262
+ $imagec = "https://www.paypal.com/es_ES/ES/i/btn/btn_donateCC_LG.gif";
263
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
264
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
265
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
266
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
267
+ } //Spanish
268
+
269
+ if ($value['language'] == "14") {
270
+ $language = "sv_SE";
271
+ $imagea = "https://www.paypal.com/sv_SE/i/btn/btn_donate_SM.gif";
272
+ $imageb = "https://www.paypal.com/sv_SE/i/btn/btn_donate_LG.gif";
273
+ $imagec = "https://www.paypal.com/sv_SE/i/btn/btn_donateCC_LG.gif";
274
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
275
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
276
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
277
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
278
+ } //Swedish
279
+
280
+ if ($value['language'] == "15") {
281
+ $language = "zh_CN";
282
+ $imagea = "https://www.paypal.com/zh_XC/i/btn/btn_donate_SM.gif";
283
+ $imageb = "https://www.paypal.com/zh_XC/i/btn/btn_donate_LG.gif";
284
+ $imagec = "https://www.paypal.com/zh_XC/i/btn/btn_donateCC_LG.gif";
285
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
286
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
287
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
288
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
289
+ } //Simplified Chinese - China
290
+
291
+ if ($value['language'] == "16") {
292
+ $language = "zh_HK";
293
+ $imagea = "https://www.paypal.com/zh_HK/i/btn/btn_donate_SM.gif";
294
+ $imageb = "https://www.paypal.com/zh_HK/i/btn/btn_donate_LG.gif";
295
+ $imagec = "https://www.paypal.com/zh_HK/i/btn/btn_donateCC_LG.gif";
296
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
297
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
298
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
299
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
300
+ } //Traditional Chinese - Hong Kong
301
+
302
+ if ($value['language'] == "17") {
303
+ $language = "zh_TW";
304
+ $imagea = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donate_SM.gif";
305
+ $imageb = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donate_LG.gif";
306
+ $imagec = "https://www.paypalobjects.com/en_US/TW/i/btn/btn_donateCC_LG.gif";
307
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
308
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
309
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
310
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
311
+ } //Traditional Chinese - Taiwan
312
+
313
+ if ($value['language'] == "18") {
314
+ $language = "tr_TR";
315
+ $imagea = "https://www.paypal.com/tr_TR/i/btn/btn_donate_SM.gif";
316
+ $imageb = "https://www.paypal.com/tr_TR/i/btn/btn_donate_LG.gif";
317
+ $imagec = "https://www.paypal.com/tr_TR/i/btn/btn_donateCC_LG.gif";
318
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
319
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
320
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
321
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
322
+ } //Turkish
323
+
324
+ if ($value['language'] == "19") {
325
+ $language = "th_TH";
326
+ $imagea = "https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif";
327
+ $imageb = "https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif";
328
+ $imagec = "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif";
329
+ $imaged = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png";
330
+ $imagee = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png";
331
+ $imagef = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png";
332
+ $imageg = "https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png";
333
+ } //Thai - Thai buttons not available for donation - using US is correct
334
+
335
+ // custom button size
336
+ $wpedon_button_buttonsize = get_post_meta($post_id,'wpedon_button_buttonsize',true);
337
+
338
+ if ($wpedon_button_buttonsize != "0") {
339
+ $value['size'] = $wpedon_button_buttonsize;
340
+ }
341
+
342
+ // button size
343
+ if ($value['size'] == "1") { $img = $imagea; }
344
+ if ($value['size'] == "2") { $img = $imageb; }
345
+ if ($value['size'] == "3") { $img = $imagec; }
346
+ if ($value['size'] == "4") { $img = $imaged; }
347
+ if ($value['size'] == "5") { $img = $imagee; }
348
+ if ($value['size'] == "6") { $img = $imagef; }
349
+ if ($value['size'] == "7") { $img = $imageg; }
350
+ if ($value['size'] == "8") { $img = $value['image_1']; }
351
+
352
+ // widget
353
+ if ($atts['widget'] == "true") {
354
+ $width = "180px";
355
+ } else {
356
+ $width = "220px";
357
+ }
358
+
359
+ // return url
360
+ $return = "";
361
+ $return = $value['return'];
362
+ $return_a = get_post_meta($post_id,'wpedon_button_return',true);
363
+ if (!empty($return_a)) { $return = $return_a; }
364
+
365
+ // window action
366
+ if ($value['opens'] == "1") { $target = ""; }
367
+ if ($value['opens'] == "2") { $target = "_blank"; }
368
+
369
+ // alignment
370
+ if ($atts['align'] == "left") { $alignment = "style='float: left;'"; }
371
+ if ($atts['align'] == "right") { $alignment = "style='float: right;'"; }
372
+ if ($atts['align'] == "center") { $alignment = "style='margin-left: auto;margin-right: auto;width:$width'"; }
373
+ if (empty($atts['align'])) { $alignment = ""; }
374
+
375
+ // notify url
376
+ $notify_url = get_admin_url() . "admin-post.php?action=add_wpedon_button_ipn";
377
+
378
+ $output = "";
379
+ $output .= "<div $alignment>";
380
+
381
+ // text description title
382
+ if ($wpedon_button_enable_name == "1" || $wpedon_button_enable_price == "1") {
383
+ $output .= "<label>";
384
+ }
385
+
386
+ if ($wpedon_button_enable_name == "1") {
387
+ $output .= esc_html($name);
388
+ }
389
+
390
+ if ($wpedon_button_enable_name == "1" && $wpedon_button_enable_price == "1") {
391
+ $output .= "<br /><span class='price'>";
392
+ }
393
+
394
+ if ($wpedon_button_enable_price == "1") {
395
+ $output .= esc_html($amount) ."</span>";
396
+ }
397
+
398
+ if ($wpedon_button_enable_price == "1") {
399
+ if ($wpedon_button_enable_currency == "1") {
400
+ $output .= esc_html($currency);
401
+ }
402
+ }
403
+
404
+ if ($wpedon_button_enable_name == "1" || $wpedon_button_enable_price == "1") {
405
+ $output .= "</label><br />";
406
+ }
407
+
408
+ // price dropdown menu
409
+ if (!empty($wpedon_button_scpriceprice)) {
410
+
411
+ // dd is active so set first value just in case no option is selected by user
412
+ $amount =$wpedon_button_scpricea;
413
+
414
+ $output .= "
415
+ <script>
416
+ jQuery(document).ready(function(){
417
+ jQuery('#dd_$rand_string').on('change', function() {
418
+ jQuery('#amount_$rand_string').val(this.value);
419
+ });
420
+ });
421
+ </script>
422
+ ";
423
+
424
+
425
+ if (!empty($wpedon_button_scpriceprice)) { $output .= "<label style='font-size:11pt !important;'>" . esc_html($wpedon_button_scpriceprice) . "</label><br /><select name='dd_$rand_string' id='dd_$rand_string' style='width:100% !important;min-width:$width !important;max-width:$width !important;border: 1px solid #ddd !important;'>"; }
426
+ if (!empty($wpedon_button_scpriceaname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricea) . "'>" . esc_html($wpedon_button_scpriceaname) . "</option>"; }
427
+ if (!empty($wpedon_button_scpricebname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpriceb) . "'>" . esc_html($wpedon_button_scpricebname) . "</option>"; }
428
+ if (!empty($wpedon_button_scpricecname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricec) . "'>" . esc_html($wpedon_button_scpricecname) . "</option>"; }
429
+ if (!empty($wpedon_button_scpricedname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpriced) . "'>" . esc_html($wpedon_button_scpricedname) . "</option>"; }
430
+ if (!empty($wpedon_button_scpriceename)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricee) . "'>" . esc_html($wpedon_button_scpriceename) . "</option>"; }
431
+ if (!empty($wpedon_button_scpricefname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricef) . "'>" . esc_html($wpedon_button_scpricefname) . "</option>"; }
432
+ if (!empty($wpedon_button_scpricegname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpriceg) . "'>" . esc_html($wpedon_button_scpricegname) . "</option>"; }
433
+ if (!empty($wpedon_button_scpricehname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpriceh) . "'>" . esc_html($wpedon_button_scpricehname) . "</option>"; }
434
+ if (!empty($wpedon_button_scpriceiname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricei) . "'>" . esc_html($wpedon_button_scpriceiname) . "</option>"; }
435
+ if (!empty($wpedon_button_scpricejname)) { $output .= "<option value='" . esc_attr($wpedon_button_scpricej) . "'>" . esc_html($wpedon_button_scpricejname) . "</option>"; }
436
+ if (!empty($wpedon_button_scpriceprice)) { $output .= "</select><br /><br />"; }
437
+ }
438
+
439
+
440
+ // override name field if passed as shortcode attribute
441
+ if (!empty($atts['name'])) {
442
+ $name = $atts['name'];
443
+ }
444
+
445
+ $output .= "<form target='$target' action='https://www.$path.com/cgi-bin/webscr' method='post'>";
446
+ $output .= "<input type='hidden' name='cmd' value='_donations' />";
447
+ $output .= "<input type='hidden' name='business' value='" . esc_attr($account) . "' />";
448
+ $output .= "<input type='hidden' name='item_name' value='" . esc_attr($name) . "' />";
449
+ $output .= "<input type='hidden' name='item_number' value='" . esc_attr($sku) . "' />";
450
+ $output .= "<input type='hidden' name='currency_code' value='" . esc_attr($currency) . "' />";
451
+ // optional - required for fixed amounts
452
+ $output .= "<input type='hidden' name='amount' id='amount_$rand_string' value='" . esc_attr($amount) . "' />";
453
+ $output .= "<input type='hidden' name='no_note' value='". esc_attr($value['no_note']) ."'>";
454
+ $output .= "<input type='hidden' name='no_shipping' value='". esc_attr($value['no_shipping']) ."'>";
455
+ $output .= "<input type='hidden' name='notify_url' value='" . esc_attr($notify_url) . "'>";
456
+ $output .= "<input type='hidden' name='lc' value='" . $language . "'>";
457
+ $output .= "<input type='hidden' name='bn' value='WPPlugin_SP'>";
458
+ $output .= "<input type='hidden' name='return' value='" . esc_attr($return) . "' />";
459
+ $output .= "<input type='hidden' name='cancel_return' value='". esc_attr($value['cancel']) ."' />";
460
+ $output .= "<input class='wpedon_paypalbuttonimage' type='image' src='" . esc_attr($img) . "' border='0' name='submit' alt='Make your payments with PayPal. It is free, secure, effective.' style='border: none;'>";
461
+ $output .= "<img alt='' border='0' style='border:none;display:none;' src='https://www.paypal.com/$language/i/scr/pixel.gif' width='1' height='1'>";
462
+ $output .= "</form></div>";
463
+
464
+ return $output;
465
+
466
  }
readme.txt CHANGED
@@ -1,181 +1,185 @@
1
- === Accept Donations with PayPal ===
2
- Contributors: scottpaterson,wp-plugin
3
- Donate link: https://wpplugin.org/donate/
4
- Tags: donation, donate, donations, charity, paypal, gateway, paypal donation, paypal donate
5
- Author URI: https://wpplugin.org
6
- Requires at least: 3.0
7
- Tested up to: 5.8
8
- Requires PHP: 5.4
9
- Stable tag: 1.3.1
10
- License: GPLv2 or later
11
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
-
13
- Add a PayPal Donation Button to your website and start collecting donations with PayPal today. No Coding Required. Official PayPal Partner.
14
-
15
- == Description ==
16
- = Overview =
17
-
18
- This plugin will allow you to collect PayPal donations on your website.
19
-
20
- Watch this 1 minute video of how the plugin works:
21
-
22
- [youtube https://www.youtube.com/watch?v=YYUsrfnjNN0]
23
-
24
- You can place a PayPal Donation button anywhere on your site where you want to collect money. Your customers can use their PayPal account or Credit Card to donate money to you.
25
-
26
- What makes this PayPal donation plugin powerful is its simplicity. Just install the plugin and in just a few minutes customers from around the world can start donating to you via PayPal.
27
-
28
- On the settings page of the plugin you will find clear instructions on how to sign up for a PayPal account if you don't have one already. The plugin also provides instructions for how to setup a PayPal Sandbox account - which will allow you to setup a fake PayPal buyer and seller account (with fake money) so you can test everything before you start selling to the public.
29
-
30
- If you have any problems, questions, or issues about this PayPal plugin then please create a support request and we will get back to you quickly.
31
-
32
- This PayPal plugin works with any WordPress theme.
33
-
34
- WP Plugin is an offical PayPal Partner based in Boulder, Colorado. You can visit WP Plugins website at [wpplugin.org](https://wpplugin.org). Various trademarks held by their respective owners.
35
-
36
-
37
- = PayPal Donation Features =
38
-
39
- * View donations made in your WordPress admin
40
- * Button Manager
41
- * Page / Post Button shortcode Inserter
42
- * Donation Widget
43
- * Built in support for 18 languages (PayPal currently supports 18 languages)
44
- * Built in support 25 currencies (PayPal currently supports 25 currencies)
45
- * Each button can have its own language and currency
46
- * Each button can have its own button image
47
- * Each button can have itw own PayPal account
48
- * PayPal testing with Sandbox mode
49
- * Customer can choose to make a recurring monthly PayPal donation
50
- * Choose from 7 different PayPal donation buttons
51
- * Upload and use your own donation button
52
- * Choose how the PayPal window opens
53
- * Setup a dropdown menu to force certain amounts
54
-
55
- > #### Accept Donations with PayPal Pro
56
- > We offer a Pro version of this PayPal plugin for business owners who need more features.<br />
57
- >
58
- > * Offer recurring donations.
59
- > * Recurring donations can be set up per day, week, month and year.
60
- > * Setup donations that recur forever.
61
- > * Recurring donations dropdown menu.
62
- > * Offer up to 20 amount dropdown menu options instead of 10.
63
- >
64
- >
65
- > [You can learn more about Accept Donations with PayPal Pro here](https://wpplugin.org/downloads/paypal-donation-pro/)
66
-
67
- WP Plugin is an offical PayPal Partner. Various trademarks held by their respective owners.
68
-
69
-
70
- == Installation ==
71
-
72
- = Automatic Installation =
73
- > 1. Sign in to your WordPress site as an administrator.
74
- > 2. In the main menu go to Plugins -> Add New.
75
- > 3. Search for PayPal Donation Button and click install.
76
- > 4. Configure values on the settings page.
77
- > 5. Make a donation button on the button page. Place the shortcode it creates anywhere on your site to show the button.
78
- > 6. You are now ready to start collecting donations via PayPal on your site.
79
- == Frequently Asked Questions ==
80
-
81
- = How do I use this PayPal plugin =
82
- Configure values on the settings page. Make a donation button on the button page. Place the shortcode it creates anywhere on your site to show the button.
83
-
84
- = Can I put more then one shortcode on the same post / page? =
85
- Yes, there is no limit to the amount of PayPal donations buttons that you can put on one post / page, or your entire site.
86
-
87
- == Screenshots ==
88
- 1. Donation Button
89
- 2. Settings Page
90
- 3. buttons Page
91
- 4. Orders Page
92
- 5. Widget Page
93
- 6. Button Inserter
94
-
95
- == Changelog ==
96
-
97
- = 1.3.1 =
98
- * 10/1/21
99
- * Fix - Security Issues
100
-
101
- = 1.3 =
102
- * 11/9/20
103
- * Fix - Changed the variables for logging and deubgging to use WordPress globals. The plugin now uses: WP_DEBUG and WP_DEBUG_LOG
104
- * Updated - Pro version feature list.
105
-
106
- = 1.2.9 =
107
- * 6/12/18
108
- * Fix - Cannot modify header PHP warning in Divi page builder.
109
- * Fix - CSS drodown menu height and background color attributes removed.
110
-
111
- = 1.2.8 =
112
- * 5/16/18
113
- * Fix - Removed button title !important attribute
114
-
115
- = 1.2.7 =
116
- * 5/16/18
117
- * Fix - Spelling mistake
118
- * Fix - Link was not working
119
-
120
- = 1.2.6 =
121
- * 3/9/18
122
- * Fix - Error message was being thrown in relation to widget function.
123
-
124
- = 1.2.5 =
125
- * 1/31/18
126
- * New - Ability to pass name as shortcode attribute.
127
-
128
- = 1.2.4 =
129
- * 1/24/18
130
- * Fix - PHP Error message caused by widget class name
131
-
132
- = 1.2.3 =
133
- * 6/15/17
134
- * Updated - Tested plugin up to WordPress version 4.8
135
- * Fix - Fixed code formatting issue
136
-
137
- = 1.2.2 =
138
- * 8/26/16
139
- * Updated - Updated the settings page right sidebar to offer information about the pro version.
140
-
141
- = 1.2.1 =
142
- * 8/20/16
143
- * Updated - Changed plugin name, dropped the word easy at the beginning.
144
- * Updated - Updated WordPress version tested up to tag.
145
-
146
- = 1.2 =
147
- * 2/8/15
148
- * Bug fix - Dropdown menu option 8 was not saving
149
- * Updated - Updated WordPress version tested up to tag
150
-
151
- = 1.1 =
152
- * 12/20/15
153
- * Bug fixes
154
-
155
- = 1.0 =
156
- * 12/11/15
157
- * Initial release
158
-
159
- == Upgrade Notice ==
160
-
161
- = 1.2.2 =
162
- * 8/26/16
163
- * Updated - Updated the settings page right sidebar to offer information about the pro version.
164
-
165
- = 1.2.1 =
166
- * 8/20/16
167
- * Updated - Changed plugin name, dropped the word easy at the beginning.
168
- * Updated - Updated WordPress version tested up to tag.
169
-
170
- = 1.2 =
171
- * 2/8/15
172
- * Bug fix - Dropdown menu option 8 was not saving
173
- * Updated - Updated WordPress version tested up to tag
174
-
175
- = 1.1 =
176
- * 12/20/15
177
- * Bug fixes
178
-
179
- = 1.0 =
180
- * 12/11/15
 
 
 
 
181
  Initial release
1
+ === Accept Donations with PayPal ===
2
+ Contributors: scottpaterson,wp-plugin
3
+ Donate link: https://wpplugin.org/donate/
4
+ Tags: donation, donate, donations, charity, paypal, gateway, paypal donation, paypal donate
5
+ Author URI: https://wpplugin.org
6
+ Requires at least: 3.0
7
+ Tested up to: 5.8
8
+ Requires PHP: 5.4
9
+ Stable tag: 1.3.2
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+
13
+ Add a PayPal Donation Button to your website and start collecting donations with PayPal today. No Coding Required. Official PayPal Partner.
14
+
15
+ == Description ==
16
+ = Overview =
17
+
18
+ This plugin will allow you to collect PayPal donations on your website.
19
+
20
+ Watch this 1 minute video of how the plugin works:
21
+
22
+ [youtube https://www.youtube.com/watch?v=YYUsrfnjNN0]
23
+
24
+ You can place a PayPal Donation button anywhere on your site where you want to collect money. Your customers can use their PayPal account or Credit Card to donate money to you.
25
+
26
+ What makes this PayPal donation plugin powerful is its simplicity. Just install the plugin and in just a few minutes customers from around the world can start donating to you via PayPal.
27
+
28
+ On the settings page of the plugin you will find clear instructions on how to sign up for a PayPal account if you don't have one already. The plugin also provides instructions for how to setup a PayPal Sandbox account - which will allow you to setup a fake PayPal buyer and seller account (with fake money) so you can test everything before you start selling to the public.
29
+
30
+ If you have any problems, questions, or issues about this PayPal plugin then please create a support request and we will get back to you quickly.
31
+
32
+ This PayPal plugin works with any WordPress theme.
33
+
34
+ WP Plugin is an offical PayPal Partner based in Boulder, Colorado. You can visit WP Plugins website at [wpplugin.org](https://wpplugin.org). Various trademarks held by their respective owners.
35
+
36
+
37
+ = PayPal Donation Features =
38
+
39
+ * View donations made in your WordPress admin
40
+ * Button Manager
41
+ * Page / Post Button shortcode Inserter
42
+ * Donation Widget
43
+ * Built in support for 18 languages (PayPal currently supports 18 languages)
44
+ * Built in support 25 currencies (PayPal currently supports 25 currencies)
45
+ * Each button can have its own language and currency
46
+ * Each button can have its own button image
47
+ * Each button can have itw own PayPal account
48
+ * PayPal testing with Sandbox mode
49
+ * Customer can choose to make a recurring monthly PayPal donation
50
+ * Choose from 7 different PayPal donation buttons
51
+ * Upload and use your own donation button
52
+ * Choose how the PayPal window opens
53
+ * Setup a dropdown menu to force certain amounts
54
+
55
+ > #### Accept Donations with PayPal Pro
56
+ > We offer a Pro version of this PayPal plugin for business owners who need more features.<br />
57
+ >
58
+ > * Offer recurring donations.
59
+ > * Recurring donations can be set up per day, week, month and year.
60
+ > * Setup donations that recur forever.
61
+ > * Recurring donations dropdown menu.
62
+ > * Offer up to 20 amount dropdown menu options instead of 10.
63
+ >
64
+ >
65
+ > [You can learn more about Accept Donations with PayPal Pro here](https://wpplugin.org/downloads/paypal-donation-pro/)
66
+
67
+ WP Plugin is an offical PayPal Partner. Various trademarks held by their respective owners.
68
+
69
+
70
+ == Installation ==
71
+
72
+ = Automatic Installation =
73
+ > 1. Sign in to your WordPress site as an administrator.
74
+ > 2. In the main menu go to Plugins -> Add New.
75
+ > 3. Search for PayPal Donation Button and click install.
76
+ > 4. Configure values on the settings page.
77
+ > 5. Make a donation button on the button page. Place the shortcode it creates anywhere on your site to show the button.
78
+ > 6. You are now ready to start collecting donations via PayPal on your site.
79
+ == Frequently Asked Questions ==
80
+
81
+ = How do I use this PayPal plugin =
82
+ Configure values on the settings page. Make a donation button on the button page. Place the shortcode it creates anywhere on your site to show the button.
83
+
84
+ = Can I put more then one shortcode on the same post / page? =
85
+ Yes, there is no limit to the amount of PayPal donations buttons that you can put on one post / page, or your entire site.
86
+
87
+ == Screenshots ==
88
+ 1. Donation Button
89
+ 2. Settings Page
90
+ 3. buttons Page
91
+ 4. Orders Page
92
+ 5. Widget Page
93
+ 6. Button Inserter
94
+
95
+ == Changelog ==
96
+
97
+ = 1.3.2 =
98
+ * 10/14/21
99
+ * Fix - Security Issues
100
+
101
+ = 1.3.1 =
102
+ * 10/1/21
103
+ * Fix - Security Issues
104
+
105
+ = 1.3 =
106
+ * 11/9/20
107
+ * Fix - Changed the variables for logging and deubgging to use WordPress globals. The plugin now uses: WP_DEBUG and WP_DEBUG_LOG
108
+ * Updated - Pro version feature list.
109
+
110
+ = 1.2.9 =
111
+ * 6/12/18
112
+ * Fix - Cannot modify header PHP warning in Divi page builder.
113
+ * Fix - CSS drodown menu height and background color attributes removed.
114
+
115
+ = 1.2.8 =
116
+ * 5/16/18
117
+ * Fix - Removed button title !important attribute
118
+
119
+ = 1.2.7 =
120
+ * 5/16/18
121
+ * Fix - Spelling mistake
122
+ * Fix - Link was not working
123
+
124
+ = 1.2.6 =
125
+ * 3/9/18
126
+ * Fix - Error message was being thrown in relation to widget function.
127
+
128
+ = 1.2.5 =
129
+ * 1/31/18
130
+ * New - Ability to pass name as shortcode attribute.
131
+
132
+ = 1.2.4 =
133
+ * 1/24/18
134
+ * Fix - PHP Error message caused by widget class name
135
+
136
+ = 1.2.3 =
137
+ * 6/15/17
138
+ * Updated - Tested plugin up to WordPress version 4.8
139
+ * Fix - Fixed code formatting issue
140
+
141
+ = 1.2.2 =
142
+ * 8/26/16
143
+ * Updated - Updated the settings page right sidebar to offer information about the pro version.
144
+
145
+ = 1.2.1 =
146
+ * 8/20/16
147
+ * Updated - Changed plugin name, dropped the word easy at the beginning.
148
+ * Updated - Updated WordPress version tested up to tag.
149
+
150
+ = 1.2 =
151
+ * 2/8/15
152
+ * Bug fix - Dropdown menu option 8 was not saving
153
+ * Updated - Updated WordPress version tested up to tag
154
+
155
+ = 1.1 =
156
+ * 12/20/15
157
+ * Bug fixes
158
+
159
+ = 1.0 =
160
+ * 12/11/15
161
+ * Initial release
162
+
163
+ == Upgrade Notice ==
164
+
165
+ = 1.2.2 =
166
+ * 8/26/16
167
+ * Updated - Updated the settings page right sidebar to offer information about the pro version.
168
+
169
+ = 1.2.1 =
170
+ * 8/20/16
171
+ * Updated - Changed plugin name, dropped the word easy at the beginning.
172
+ * Updated - Updated WordPress version tested up to tag.
173
+
174
+ = 1.2 =
175
+ * 2/8/15
176
+ * Bug fix - Dropdown menu option 8 was not saving
177
+ * Updated - Updated WordPress version tested up to tag
178
+
179
+ = 1.1 =
180
+ * 12/20/15
181
+ * Bug fixes
182
+
183
+ = 1.0 =
184
+ * 12/11/15
185
  Initial release