Payment Form for PayPal Pro - Version 1.1.37

Version Description

  • Optional deactivation feedback

=

Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Payment Form for PayPal Pro
Version 1.1.37
Comparing to
See all releases

Code changes from version 1.1.36 to 1.1.37

Files changed (3) hide show
  1. README.txt +5 -2
  2. cp-feedback.php +183 -0
  3. cp_ppp.php +3 -2
README.txt CHANGED
@@ -239,7 +239,10 @@ A: In all plugin versions you can turn off IP tracking to avoid saving that user
239
= 1.1.36 =
240
* Easier activation process
241
242
== Upgrade Notice ==
243
244
- = 1.1.36 =
245
- * Easier activation process
239
= 1.1.36 =
240
* Easier activation process
241
242
+ = 1.1.37 =
243
+ * Optional deactivation feedback
244
+
245
== Upgrade Notice ==
246
247
+ = 1.1.37 =
248
+ * Optional deactivation feedback
cp-feedback.php ADDED
@@ -0,0 +1,183 @@
1
+ <?php
2
+ add_action( 'admin_enqueue_scripts', 'cppffppp_feedback_insert_adminScripts', 1);
3
+ add_action( 'wp_ajax_cppffppp_feedback', 'cppffppp_feedback' );
4
+ $cppffppp_plugfile = 'cp_ppp.php';
5
+ $cppffppp_plugslug = 'payment-form-for-paypal-pro';
6
+ $cppffppp_supportlink = 'https://wordpress.dwbooster.com/support';
7
+ $cppffppp_supportlink_full = $cppffppp_supportlink . '?priority-support=yes';
8
+
9
+ function cppffppp_feedback_insert_adminScripts($hook) {
10
+ if( 'plugins.php' == $hook )
11
+ {
12
+ wp_enqueue_style('wp-jquery-ui-dialog');
13
+ wp_enqueue_script('jquery');
14
+ wp_enqueue_script('jquery-ui-dialog');
15
+ add_action( 'admin_footer', 'cppffppp_feedback_javascript' );
16
+ }
17
+ }
18
+
19
+
20
+
21
+ // This function is used only if explicitly accepted (opt-in) by the user
22
+ function cppffppp_feedback() {
23
+ global $cppffppp_plugfile;
24
+ $cppffppp_plugin_data = get_plugin_data( dirname(__FILE__).'/'.$cppffppp_plugfile );
25
+ $cppffppp_plugin_version = $cppffppp_plugin_data['Version'];
26
+ $data = array(
27
+ 'answer' => urlencode(@$_POST["answer"]),
28
+ 'otherplugin' => urlencode(@$_POST["opinfo"]),
29
+ 'otherinfo' => urlencode(@$_POST["oinfo"]),
30
+ 'plugin' => urlencode($cppffppp_plugin_data['Name']),
31
+ 'pluginv' => urlencode($cppffppp_plugin_version),
32
+ 'wordpress' => urlencode(get_bloginfo( 'version' )),
33
+ 'phpversion' => urlencode(phpversion ())
34
+ );
35
+ if (@$_POST["onymous"] == 'false') // send this data only if explicitly accepted
36
+ {
37
+ $current_user = wp_get_current_user();
38
+ $data['email'] = urlencode($current_user->user_email);
39
+ $data['website'] = urlencode($_SERVER['HTTP_HOST']);
40
+ $data['url'] = urlencode(get_site_url());
41
+ }
42
+
43
+ //extract data from the post
44
+ //set POST variables
45
+ $url = 'https://wordpress.dwbooster.com/licensesystem/debug-data.php';
46
+ $fields = $data;
47
+
48
+ //url-ify the data for the POST
49
+ foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
50
+ rtrim($fields_string, '&');
51
+
52
+ //open connection
53
+ $ch = curl_init();
54
+
55
+ //set the url, number of POST vars, POST data
56
+ curl_setopt($ch,CURLOPT_URL, $url);
57
+ curl_setopt($ch,CURLOPT_POST, count($fields));
58
+ curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
59
+
60
+ //execute post
61
+ $result = curl_exec($ch);
62
+
63
+ //close connection
64
+ curl_close($ch);
65
+
66
+ wp_die(); // this is required to terminate immediately and return a proper response
67
+ }
68
+
69
+
70
+ function cppffppp_feedback_javascript() {
71
+ global $cppffppp_plugslug, $cppffppp_supportlink, $cppffppp_supportlink_full;
72
+ ?>
73
+ <script type="text/javascript">
74
+
75
+ $ = jQuery.noConflict()
76
+ $( window ).load(function() {
77
+ document.querySelector('[data-slug="<?php echo $cppffppp_plugslug; ?>"] .deactivate a').addEventListener('click', function(event){
78
+ event.preventDefault()
79
+ var urlRedirect = document.querySelector('[data-slug="<?php echo $cppffppp_plugslug; ?>"] .deactivate a').getAttribute('href');
80
+
81
+ $('<div title="QUICK FEEDBACK"><div style="padding:10px;">'+
82
+ '<style type="text/css">.abcreasonblock { margin-top:8px; }</style>'+
83
+ '<h3><strong>If you have a moment, please let us know why you are deactivating:</strong></h3>'+
84
+ '<form id="cpfeedbackform">'+
85
+
86
+ '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cppffppp_update_reason(this);" value="no-work"> The plugin didn\'t work<br />'+
87
+ '<div id="abcm_nowork" style="margin-left:25px;display:none;padding:10px;border:1px dotted gray;color:#660000"><strong>We can help!</strong> We offer <strong>free support</strong> for this plugin. Feel free to open a support ticket at <a href="<?php echo $cppffppp_supportlink_full; ?>"><strong><?php echo $cppffppp_supportlink; ?></strong></a> and we will be happy to help.</div></div>'+
88
+
89
+ '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cppffppp_update_reason(this);" value="-"> I don\'t like to share my information with you<br /></div>'+
90
+
91
+ '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cppffppp_update_reason(this);" value="temporary-deactivation"> It\'s a temporary deactivation. I\'m just debugging an issue.<br /></div>'+
92
+
93
+ '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cppffppp_update_reason(this);" value="better-plugin"> I found a better plugin<br />'+
94
+ '<div id="abcm_otherplugin" style="margin-left:25px;display:none;"><input type="text" name="abcm_otherpinfo" placeholder="What\'s the plugin name?" style="width:100%"></div></div>'+
95
+
96
+ '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cppffppp_update_reason(this);" value="other"> Other<br />'+
97
+ '<div id="abcm_other" style="margin-left:25px;display:none;font-weight:bold;">Kindly tell us the reason so we can improve.<br /><input type="text" name="abcm_otherinfo" style="width:100%"></div></div>'+
98
+
99
+ '<div id="abcnofeedback" style="display:none;margin-top:30px;text-align:right"><input type="checkbox" name="cpabcanonymous" value="yes"> Anonymous feedback</div>'+
100
+
101
+ '</form>'+
102
+ '</div></div>'
103
+ ).dialog({
104
+ width:'600',
105
+ dialogClass: 'wp-dialog',
106
+ modal: true,
107
+ close: function(event, ui)
108
+ {
109
+ $(this).dialog("close");
110
+ $(this).remove();
111
+ },
112
+ closeOnEscape: true,
113
+ buttons: [
114
+ {
115
+ id: 'abcdeactivatebtn',
116
+ text: "Skip & Deactivate",
117
+ click: function() {
118
+ var answer = $("input[name='abcm_reason']:checked").val();
119
+ if (answer == undefined || answer == '' || answer == '-')
120
+ window.location.href = urlRedirect;
121
+ else
122
+ {
123
+ var opinfo = $("input[name='abcm_otherpinfo']").val();
124
+ var oinfo = $("input[name='abcm_otherinfo']").val();
125
+ var isAnonymous = $("input[name='cpabcanonymous']:checked").length > 0;
126
+ var data = {
127
+ 'action': 'cppffppp_feedback',
128
+ 'answer': $("input[name='abcm_reason']:checked").val(),
129
+ 'opinfo': $("input[name='abcm_otherpinfo']").val(),
130
+ 'oinfo': $("input[name='abcm_otherinfo']").val(),
131
+ 'onymous': $("input[name='cpabcanonymous']:checked").length > 0
132
+ };
133
+ $.post(ajaxurl, data, function(response) {
134
+ window.location.href = urlRedirect;
135
+ });
136
+ }
137
+ }
138
+ },
139
+ {
140
+ text: "We can help: Support Service",
141
+ click: function() {
142
+ window.open('<?php echo $cppffppp_supportlink_full; ?>');
143
+ $(this).dialog("close");
144
+ }
145
+ },
146
+ {
147
+ text: "Cancel",
148
+ "class": 'button button-primary button-close',
149
+ click: function() {
150
+ $(this).dialog("close");
151
+ }
152
+ }
153
+ ]
154
+ });
155
+ })
156
+ });
157
+
158
+ function cppffppp_update_reason(field)
159
+ {
160
+ document.getElementById("abcdeactivatebtn").value = 'Submit & Deactivate';
161
+ document.getElementById("abcdeactivatebtn").innerHTML = '<span class="ui-button-text">Submit &amp; Deactivate</span>';
162
+ document.getElementById("abcnofeedback").style.display = '';
163
+ document.getElementById("abcm_other").style.display = 'none';
164
+ document.getElementById("abcm_otherplugin").style.display = 'none';
165
+ document.getElementById("abcm_nowork").style.display = 'none';
166
+ if (field.value == '-')
167
+ {
168
+ document.getElementById("abcdeactivatebtn").value = 'Skip & Deactivate';
169
+ document.getElementById("abcdeactivatebtn").innerHTML = '<span class="ui-button-text">Skip &amp; Deactivate</span>';
170
+ document.getElementById("abcnofeedback").style.display = 'none';
171
+ }
172
+ else if (field.value == 'other')
173
+ document.getElementById("abcm_other").style.display = '';
174
+ else if (field.value == 'better-plugin')
175
+ document.getElementById("abcm_otherplugin").style.display = '';
176
+ else if (field.value == 'no-work')
177
+ document.getElementById("abcm_nowork").style.display = '';
178
+ }
179
+
180
+ </script><?php
181
+ }
182
+
183
+ ?>
cp_ppp.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Payment Form for PayPal Pro
4
Plugin URI: https://wordpress.dwbooster.com/forms/paypal-payment-pro-form
5
Description: Payment Form for PayPal Pro to accept credit cards directly into your website. Official PayPal Partner.
6
- Version: 1.1.36
7
Author: CodePeople
8
Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
License: GPL
@@ -1494,6 +1494,7 @@ class CP_PPP_Widget extends WP_Widget
1494
1495
}
1496
1497
-
1498
1499
?>
3
Plugin Name: Payment Form for PayPal Pro
4
Plugin URI: https://wordpress.dwbooster.com/forms/paypal-payment-pro-form
5
Description: Payment Form for PayPal Pro to accept credit cards directly into your website. Official PayPal Partner.
6
+ Version: 1.1.37
7
Author: CodePeople
8
Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
License: GPL
1494
1495
}
1496
1497
+ // optional opt-in deactivation feedback
1498
+ require_once 'cp-feedback.php';
1499
1500
?>