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