Payment Form for PayPal Pro - Version 1.1.65

Version Description

  • Bug fixes

=

Download this release

Release Info

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

Code changes from version 1.1.64 to 1.1.65

Files changed (3) hide show
  1. README.txt +5 -2
  2. cp_ppp.php +1 -1
  3. cp_ppp_data_source.inc.php +0 -342
README.txt CHANGED
@@ -323,7 +323,10 @@ A: In all plugin versions you can turn off IP tracking to avoid saving that user
323
  = 1.1.64 =
324
  * WordPress editor block update
325
 
 
 
 
326
  == Upgrade Notice ==
327
 
328
- = 1.1.64 =
329
- * WordPress editor block update
323
  = 1.1.64 =
324
  * WordPress editor block update
325
 
326
+ = 1.1.65 =
327
+ * Bug fixes
328
+
329
  == Upgrade Notice ==
330
 
331
+ = 1.1.65 =
332
+ * Bug fixes
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.64
7
  Author: CodePeople
8
  Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
  License: GPL
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.65
7
  Author: CodePeople
8
  Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
  License: GPL
cp_ppp_data_source.inc.php CHANGED
@@ -1,342 +0,0 @@
1
- <?php
2
-
3
- add_action( 'init', 'cp_ppp_init_ds', 0 );
4
-
5
- function cp_ppp_init_ds()
6
- {
7
- if( isset( $_REQUEST[ 'cffaction' ] ) )
8
- {
9
- switch( $_REQUEST[ 'cffaction' ] )
10
- {
11
- case 'test_db_connection':
12
- global $cpcff_db_connect;
13
-
14
- $_REQUEST[ 'data_source' ] = 'database';
15
- $_REQUEST[ 'query' ] = 'SHOW tables';
16
- $result = cp_ppp_ds( $_REQUEST );
17
- $err = mysqli_error( $cpcff_db_connect );
18
- if( !is_null( mysqli_connect_error() ) ) $err .= mysqli_connect_error();
19
- print( ( ( empty( $err ) ) ? 'Connection OK' : $err ) );
20
- exit;
21
- break;
22
- case 'test_db_query':
23
- if( $_REQUEST[ 'active' ] == 'structure' )
24
- {
25
- _cp_ppp_check_for_variable( $_REQUEST[ 'table' ] );
26
- _cp_ppp_check_for_variable( $_REQUEST[ 'where' ] );
27
- }
28
- else
29
- {
30
- _cp_ppp_check_for_variable( $_REQUEST[ 'query' ] );
31
- }
32
- case 'get_data_from_database':
33
- global $cpcff_db_connect;
34
-
35
- $_REQUEST[ 'data_source' ] = 'database';
36
- if( $_REQUEST[ 'active' ] == 'structure' )
37
- {
38
- $_REQUEST[ 'query' ] = '';
39
- }
40
-
41
- $query_result = cp_ppp_ds( $_REQUEST );
42
- $err = mysqli_error( $cpcff_db_connect );
43
- if( !is_null( mysqli_connect_error() ) ) $err .= mysqli_connect_error();
44
- if( $_REQUEST[ 'cffaction' ] == test_db_query )
45
- {
46
- print_r( ( ( empty( $err ) ) ? $query_result : $err ) );
47
- }
48
- else
49
- {
50
- $result_obj = new stdClass;
51
- if( !empty( $err ) )
52
- {
53
- $result_obj->error = $err;
54
- }
55
- else
56
- {
57
- $result_obj->data = $query_result;
58
- }
59
- print( json_encode( $result_obj ) );
60
- }
61
- exit;
62
- break;
63
- case 'get_post_types':
64
- print json_encode( get_post_types( array('public' => true) ) );
65
- exit;
66
- break;
67
- case 'get_posts':
68
- $_REQUEST[ 'data_source' ] = 'post_type';
69
- $result_obj = new stdClass;
70
- $result_obj->data = cp_ppp_ds( $_REQUEST );
71
- print( json_encode( $result_obj ) );
72
- exit;
73
- break;
74
- case 'get_available_taxonomies':
75
- print json_encode( get_taxonomies( array('public' => true), 'objects' ) );
76
- exit;
77
- break;
78
- case 'get_taxonomies':
79
- $_REQUEST[ 'data_source' ] = 'taxonomy';
80
- $result_obj = new stdClass;
81
- $result_obj->data = cp_ppp_ds( $_REQUEST );
82
- print( json_encode( $result_obj ) );
83
- exit;
84
- break;
85
- case 'get_users':
86
- $_REQUEST[ 'data_source' ] = 'user';
87
- $result_obj = new stdClass;
88
- $result_obj->data = cp_ppp_ds( $_REQUEST );
89
- print( json_encode( $result_obj ) );
90
- exit;
91
- break;
92
- }
93
- }
94
-
95
- } // End cp_ppp_init_ds
96
-
97
- function cp_ppp_ds( $data )
98
- {
99
- switch( $data[ 'data_source' ] )
100
- {
101
- case 'database':
102
- return cp_ppp_ds_db( $data );
103
- break;
104
- case 'csv':
105
- return cp_ppp_ds_csv( $data );
106
- break;
107
- case 'post_type':
108
- return cp_ppp_ds_post_type( $data );
109
- break;
110
- case 'taxonomy':
111
- return cp_ppp_ds_taxonomy( $data );
112
- break;
113
- case 'user':
114
- return cp_ppp_ds_user( $data );
115
- break;
116
- }
117
- }
118
-
119
- /**
120
- Displays a text about the existence of variables in the query, and stops the script execution.
121
- **/
122
- function _cp_ppp_check_for_variable( $str )
123
- {
124
- if( preg_match( '/<%fieldname\d+%>/', $str ) )
125
- {
126
- print 'Your query includes variables, so it cannot be tested from the form\'s edition';
127
- exit;
128
- }
129
- }
130
- function _cp_ppp_set_attr( &$obj, $attr, $arr, $elem )
131
- {
132
- $arr = (array)$arr;
133
- if( !empty( $elem ) && !empty( $arr[ $elem ] ) )
134
- {
135
- $tmp = (array)$obj;
136
- $tmp[ $attr ] = $arr[ $elem ];
137
- $obj = (object)$tmp;
138
- }
139
- }
140
-
141
- function cp_ppp_ds_db( $data )
142
- {
143
- global $wpdb, $cpcff_db_connect;
144
-
145
- if( !empty( $data[ 'query' ] ) )
146
- {
147
- $query = $data[ 'query' ];
148
- }
149
- else
150
- {
151
- $separator = '';
152
- $select = '';
153
- if( !empty( $data[ 'value' ] ) )
154
- {
155
- $separator = ',';
156
- $select .= $data[ 'value' ] . ' AS value';
157
- }
158
-
159
- if( !empty( $data[ 'text' ] ) )
160
- {
161
- $select .= $separator . $data[ 'text' ] . ' AS text';
162
- }
163
-
164
- $query = 'SELECT DISTINCT ' . $select . ' FROM ' . $data[ 'table' ] . ( ( !empty( $data[ 'where' ] ) ) ? ' WHERE ' . $data[ 'where' ] : '' ) . ( ( !empty( $data[ 'orderby' ] ) ) ? ' ORDER BY ' . $data[ 'orderby' ] : '' ).( ( !empty( $data[ 'limit' ] ) ) ? ' LIMIT ' . $data[ 'limit' ] : '' );
165
-
166
- }
167
- $query = stripcslashes( $query );
168
-
169
- if( !empty( $data[ 'connection' ] ) && !empty( $data[ 'form' ] ) )
170
- {
171
- $connection_data = unserialize( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, cp_ppp_get_option( 'form_structure', CP_PPP_DEFAULT_form_structure, $data[ 'form' ] ), base64_decode( $data[ 'connection' ] ), MCRYPT_MODE_ECB ) );
172
- foreach( $connection_data as $key => $val )
173
- {
174
- $data[ $key ] = $val;
175
- }
176
- }
177
-
178
- if( !empty( $data[ 'host' ] ) ) // External database
179
- {
180
- $results = array();
181
- $cpcff_db_connect = mysqli_connect( $data[ 'host' ], $data[ 'user' ], $data[ 'pass' ], $data[ 'database' ] );
182
-
183
- if( $cpcff_db_connect !== false )
184
- {
185
- $query_result = mysqli_query( $cpcff_db_connect, $query );
186
- while( $query_result && $row = mysqli_fetch_object( $query_result ) )
187
- {
188
- $results[] = $row;
189
- }
190
- }
191
- return $results;
192
- }
193
- else // Local database
194
- {
195
- return $wpdb->get_results( $query, ARRAY_A );
196
- }
197
- } // End cp_ppp_ds_db
198
-
199
- function cp_ppp_ds_csv( $data )
200
- {
201
- }
202
-
203
- function cp_ppp_ds_post_type( $data )
204
- {
205
-
206
- $posts = array();
207
- if( !empty( $data[ 'id' ] ) )
208
- {
209
- $result = get_post( $data[ 'id' ], ARRAY_A );
210
- if( !is_null( $result ) )
211
- {
212
- $tmp = new stdClass;
213
- _cp_ppp_set_attr( $tmp, 'value', $result, $data[ 'value' ] );
214
- _cp_ppp_set_attr( $tmp, 'text', $result, $data[ 'text' ] );
215
- array_push( $posts, $tmp );
216
- }
217
- }
218
- else
219
- {
220
- $args = array(
221
- 'post_status' => 'publish',
222
- 'orderby' => 'post_date',
223
- 'order' => 'DESC'
224
- );
225
-
226
- if( !empty( $data[ 'posttype' ] ) )
227
- {
228
- $args[ 'post_type' ] = $data[ 'posttype' ];
229
- }
230
-
231
- if( !empty( $data[ 'last' ] ) )
232
- {
233
- $args[ 'posts_per_page' ] = $data[ 'last' ];
234
- }
235
-
236
- $results = get_posts( $args );
237
-
238
- foreach ( $results as $result )
239
- {
240
- $tmp = new stdClass;
241
- _cp_ppp_set_attr( $tmp, 'value', $result, $data[ 'value' ] );
242
- _cp_ppp_set_attr( $tmp, 'text', $result, $data[ 'text' ] );
243
- array_push( $posts, $tmp );
244
- }
245
- }
246
- return $posts;
247
- }
248
-
249
- function cp_ppp_ds_taxonomy( $data )
250
- {
251
- $taxonomies = array();
252
- if( !empty( $data[ 'id' ] ) || !empty( $data[ 'slug' ] ) )
253
- {
254
- if( !empty( $data[ 'taxonomy' ] ) )
255
- {
256
- if( !empty( $data[ 'id' ] ) )
257
- {
258
- $result = get_term( $data[ 'id' ], $data[ 'taxonomy' ], ARRAY_A );
259
- }
260
- else
261
- {
262
- $result = get_term_by( 'slug', $data[ 'slug' ], $data[ 'taxonomy' ], ARRAY_A );
263
- }
264
-
265
- if( !is_null( $result ) )
266
- {
267
- $tmp = new stdClass;
268
- _cp_ppp_set_attr( $tmp, 'value', $result, $data[ 'value' ] );
269
- _cp_ppp_set_attr( $tmp, 'text', $result, $data[ 'text' ] );
270
- array_push( $taxonomies, $tmp );
271
- }
272
- }
273
- }
274
- else
275
- {
276
- if( !empty( $data[ 'taxonomy' ] ) )
277
- {
278
- $results = get_terms( $data[ 'taxonomy' ], array( 'hide_empty' => 0 ) );
279
-
280
- foreach ( $results as $result )
281
- {
282
- $tmp = new stdClass;
283
- _cp_ppp_set_attr( $tmp, 'value', $result, $data[ 'value' ] );
284
- _cp_ppp_set_attr( $tmp, 'text', $result, $data[ 'text' ] );
285
- array_push( $taxonomies, $tmp );
286
- }
287
- }
288
- }
289
- return $taxonomies;
290
- }
291
-
292
-
293
- function cp_ppp_ds_user( $data )
294
- {
295
- $users = array();
296
- if( !empty( $data[ 'logged' ] ) && $data[ 'logged' ] !== 'false' )
297
- {
298
- $result = wp_get_current_user();
299
- if( !empty( $result ) )
300
- {
301
- $tmp = new stdClass;
302
- _cp_ppp_set_attr( $tmp, 'value', $result->data, $data[ 'value' ] );
303
- $users[] = $tmp;
304
- }
305
- }
306
- elseif( !empty( $data[ 'id' ] ) || !empty( $data[ 'login' ] ) )
307
- {
308
- if( !empty( $data[ 'id' ] ) )
309
- {
310
- $tmp = new stdClass;
311
- $result = get_user_by( 'id', $data[ 'id' ] );
312
- }
313
- else
314
- {
315
- $tmp = new stdClass;
316
- $result = get_user_by( 'login', $data[ 'login' ] );
317
- }
318
-
319
- if( !empty( $result ) )
320
- {
321
- $tmp = new stdClass;
322
- _cp_ppp_set_attr( $tmp, 'value', $result->data, $data[ 'value' ] );
323
- $users[] = $tmp;
324
- }
325
- }
326
- else
327
- {
328
-
329
- $results = get_users();
330
- foreach( $results as $result )
331
- {
332
- $tmp = new stdClass;
333
- _cp_ppp_set_attr( $tmp, 'value', $result->data, $data[ 'value' ] );
334
- _cp_ppp_set_attr( $tmp, 'text', $result->data, $data[ 'text' ] );
335
- $users[] = $tmp;
336
- }
337
- }
338
-
339
- return $users;
340
- }
341
-
342
- ?>