Payment Form for PayPal Pro - Version 1.1.31

Version Description

  • Added CSS and JavaScript customization panel

=

Download this release

Release Info

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

Code changes from version 1.1.30 to 1.1.31

README.txt CHANGED
@@ -217,7 +217,10 @@ If that doesn't work please check if your hosting service requires some specific
217
= 1.1.30 =
218
* Fixed bug in review panel
219
220
== Upgrade Notice ==
221
222
- = 1.1.30 =
223
- * Fixed bug in review panel
217
= 1.1.30 =
218
* Fixed bug in review panel
219
220
+ = 1.1.31 =
221
+ * Added CSS and JavaScript customization panel
222
+
223
== Upgrade Notice ==
224
225
+ = 1.1.31 =
226
+ * Added CSS and JavaScript customization panel
cp_admin_int_edition.inc.php ADDED
@@ -0,0 +1,59 @@
1
+ <?php
2
+
3
+ if ( !is_admin() )
4
+ {
5
+ echo 'Direct access not allowed.';
6
+ exit;
7
+ }
8
+
9
+ global $wpdb;
10
+
11
+ $cpid = 'CP_PPPRO';
12
+ $plugslug = 'cp_ppp';
13
+
14
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST[$cpid.'_post_edition'] ) )
15
+ echo "<div id='setting-error-settings_updated' class='updated settings-error'> <p><strong>Settings saved.</strong></p></div>";
16
+
17
+ if ($_GET["item"] == 'js')
18
+ $saved_contents = base64_decode(get_option($cpid.'_JS', ''));
19
+ else if ($_GET["item"] == 'css')
20
+ $saved_contents = base64_decode(get_option($cpid.'_CSS', ''));
21
+
22
+ ?>
23
+ <div class="wrap">
24
+ <h1>Customization / Edit Page</h1>
25
+
26
+
27
+
28
+ <input type="button" name="backbtn" value="Back to items list..." onclick="document.location='admin.php?page=<?php echo $plugslug; ?>';">
29
+ <br /><br />
30
+
31
+ <form method="post" action="" name="cpformconf">
32
+ <input name="<?php echo $cpid; ?>_post_edition" type="hidden" value="1" />
33
+ <input name="cfwpp_edit" type="hidden" value="<?php echo $_GET["item"]; ?>" />
34
+
35
+ <div id="normal-sortables" class="meta-box-sortables">
36
+
37
+ <textarea name="editionarea" id="editionarea" style="width:100%" rows="20"><?php echo $saved_contents; ?></textarea>
38
+
39
+ </div>
40
+
41
+
42
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes" /></p>
43
+
44
+
45
+ </form>
46
+ </div>
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
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.30
7
Author: CodePeople
8
Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
License: GPL
@@ -176,7 +176,7 @@ function _cp_ppp_install() {
176
paid INT DEFAULT 0 NOT NULL,
177
UNIQUE KEY id (id)
178
);";
179
- $wpdb->query( $wpdb->prepare ($sql, array()) );
180
181
$sql = "CREATE TABLE ".$wpdb->prefix.CP_PPP_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." (
182
id mediumint(9) NOT NULL AUTO_INCREMENT,
@@ -189,7 +189,7 @@ function _cp_ppp_install() {
189
used int(10) unsigned NOT NULL DEFAULT 0,
190
UNIQUE KEY id (id)
191
);";
192
- $wpdb->query( $wpdb->prepare ($sql, array()) );
193
194
195
$sql = "CREATE TABLE $table_name (
@@ -267,7 +267,7 @@ function _cp_ppp_install() {
267
268
UNIQUE KEY id (id)
269
);";
270
- $wpdb->query( $wpdb->prepare ($sql, array()) );
271
272
$count = $wpdb->get_var( "SELECT COUNT(id) FROM ".$table_name );
273
if (!$count)
@@ -553,7 +553,9 @@ function set_cp_ppp_insert_button() {
553
function cp_ppp_html_post_page() {
554
if (isset($_GET["cal"]) && $_GET["cal"] != '')
555
{
556
- if (isset($_GET["list"]) && $_GET["list"] == '1')
557
@include_once dirname( __FILE__ ) . '/cp_ppp_admin_int_message_list.inc.php';
558
else if (current_user_can('manage_options'))
559
@include_once dirname( __FILE__ ) . '/cp_ppp_admin_int.php';
@@ -743,7 +745,13 @@ function cp_ppp_check_posted_data() {
743
cp_ppp_save_options();
744
return;
745
}
746
-
747
if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST['cp_ppp_pform_process'] ) )
748
if ( 'GET' != $_SERVER['REQUEST_METHOD'] || !isset( $_GET['hdcaptcha_cp_ppp_post'] ) )
749
return;
@@ -1292,6 +1300,18 @@ function cp_ppp_update_script_method()
1292
exit;
1293
}
1294
1295
function cp_ppp_save_options()
1296
{
1297
global $wpdb;
@@ -1395,11 +1415,16 @@ function cp_ppp_get_option ($field, $default_value, $id = '')
1395
else
1396
{
1397
$myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE." WHERE id=%d", $id) );
1398
- $value = @$myrows[0]->$field;
1399
- $cp_ppp_option_buffered_item = $myrows[0];
1400
- $cp_ppp_option_buffered_id = $id;
1401
}
1402
- if ($value == '' && $cp_ppp_option_buffered_item->form_structure == '')
1403
$value = $default_value;
1404
return $value;
1405
}
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.31
7
Author: CodePeople
8
Author URI: https://wordpress.dwbooster.com/forms/payment-form-for-paypal-pro
9
License: GPL
176
paid INT DEFAULT 0 NOT NULL,
177
UNIQUE KEY id (id)
178
);";
179
+ $wpdb->query( $sql );
180
181
$sql = "CREATE TABLE ".$wpdb->prefix.CP_PPP_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." (
182
id mediumint(9) NOT NULL AUTO_INCREMENT,
189
used int(10) unsigned NOT NULL DEFAULT 0,
190
UNIQUE KEY id (id)
191
);";
192
+ $wpdb->query( $sql );
193
194
195
$sql = "CREATE TABLE $table_name (
267
268
UNIQUE KEY id (id)
269
);";
270
+ $wpdb->query( $sql );
271
272
$count = $wpdb->get_var( "SELECT COUNT(id) FROM ".$table_name );
273
if (!$count)
553
function cp_ppp_html_post_page() {
554
if (isset($_GET["cal"]) && $_GET["cal"] != '')
555
{
556
+ if (isset($_GET["edit"]) && $_GET["edit"] == '1')
557
+ @include_once dirname( __FILE__ ) . '/cp_admin_int_edition.inc.php';
558
+ else if (isset($_GET["list"]) && $_GET["list"] == '1')
559
@include_once dirname( __FILE__ ) . '/cp_ppp_admin_int_message_list.inc.php';
560
else if (current_user_can('manage_options'))
561
@include_once dirname( __FILE__ ) . '/cp_ppp_admin_int.php';
745
cp_ppp_save_options();
746
return;
747
}
748
+
749
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['CP_PPPRO_post_edition'] ) && is_admin() )
750
+ {
751
+ cp_ppp_save_edition();
752
+ return;
753
+ }
754
+
755
if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST['cp_ppp_pform_process'] ) )
756
if ( 'GET' != $_SERVER['REQUEST_METHOD'] || !isset( $_GET['hdcaptcha_cp_ppp_post'] ) )
757
return;
1300
exit;
1301
}
1302
1303
+
1304
+ function cp_ppp_save_edition()
1305
+ {
1306
+ if (substr_count($_POST['editionarea'],"\\\""))
1307
+ $_POST["editionarea"] = stripcslashes($_POST["editionarea"]);
1308
+ if ($_POST["cfwpp_edit"] == 'js')
1309
+ update_option('CP_PPPRO_JS', base64_encode($_POST["editionarea"]));
1310
+ else if ($_POST["cfwpp_edit"] == 'css')
1311
+ update_option('CP_PPPRO_CSS', base64_encode($_POST["editionarea"]));
1312
+ }
1313
+
1314
+
1315
function cp_ppp_save_options()
1316
{
1317
global $wpdb;
1415
else
1416
{
1417
$myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE." WHERE id=%d", $id) );
1418
+ if (count($myrows))
1419
+ {
1420
+ $value = @$myrows[0]->$field;
1421
+ $cp_ppp_option_buffered_item = $myrows[0];
1422
+ $cp_ppp_option_buffered_id = $id;
1423
+ }
1424
+ else
1425
+ $value = $default_value;
1426
}
1427
+ if ($value == '' && is_object($cp_ppp_option_buffered_item) && $cp_ppp_option_buffered_item->form_structure == '')
1428
$value = $default_value;
1429
return $value;
1430
}
cp_ppp_admin_int_list.inc.php CHANGED
@@ -276,6 +276,24 @@ if ($message) echo "<div id='setting-error-settings_updated' class='updated sett
276
</div>
277
</div>
278
279
<?php } ?>
280
281
</div>
276
</div>
277
</div>
278
279
+
280
+ <script type="text/javascript">
281
+ function cp_editArea(id)
282
+ {
283
+ document.location = 'admin.php?page=cp_ppp&edit=1&cal=1&item='+id+'&r='+Math.random();
284
+ }
285
+ </script>
286
+ <div id="metabox_basic_settings" class="postbox" >
287
+ <h3 class='hndle' style="padding:5px;"><span>Customization Area</span></h3>
288
+ <div class="inside">
289
+ <p>Use this area to add custom CSS styles or custom scripts. These styles and scripts will be keep safe even after updating the plugin.</p>
290
+ <input type="button" onclick="cp_editArea('css');" name="gobtn3" value="Add Custom Styles" />
291
+ &nbsp; &nbsp; &nbsp;
292
+ <input type="button" onclick="cp_editArea('js');" name="gobtn2" value="Add Custom JavaScript" />
293
+ </div>
294
+ </div>
295
+
296
+
297
<?php } ?>
298
299
</div>
cp_ppp_public_int.inc.php CHANGED
@@ -109,6 +109,14 @@ $raw_form_str = str_replace('"','&quot;',esc_attr($raw_form_str));
109
}
110
}
111
</script>
112
<form class="cpp_form" name="cp_ppp_pform<?php echo $CP_CPP_global_form_count; ?>" id="cp_ppp_pform<?php echo $CP_CPP_global_form_count; ?>" action="<?php get_site_url(); ?>" method="post" enctype="multipart/form-data" onsubmit="return doValidate<?php echo $CP_CPP_global_form_count; ?>(this);"><input type="hidden" name="cp_pform_psequence" value="<?php echo $CP_CPP_global_form_count; ?>" /><input type="hidden" name="cp_ppp_pform_process" value="1" /><input type="hidden" name="cp_ppp_id" value="<?php echo $id; ?>" /><input type="hidden" name="cp_ref_page" value="<?php esc_attr(cp_ppp_get_FULL_site_url); ?>" /><input type="hidden" name="form_structure<?php echo $CP_CPP_global_form_count; ?>" id="form_structure<?php echo $CP_CPP_global_form_count; ?>" size="180" value="<?php echo $raw_form_str; ?>" /><input type="hidden" id="cp_ppp_paymentspro<?php echo $CP_CPP_global_form_count; ?>" name="cp_ppp_paymentspro<?php echo $CP_CPP_global_form_count; ?>" value="1" />
113
<div id="fbuilder">
114
<div id="fbuilder<?php echo $CP_CPP_global_form_count; ?>">
109
}
110
}
111
</script>
112
+ <?php
113
+ $custom_styles = base64_decode(get_option('CP_PPPRO_CSS', ''));
114
+ if ($custom_styles != '')
115
+ echo '<style type="text/css">'.$custom_styles.'</style>';
116
+ $custom_scripts = base64_decode(get_option('CP_PPPRO_JS', ''));
117
+ if ($custom_scripts != '')
118
+ echo '<script type="text/javascript">'.$custom_scripts.'</script>';
119
+ ?>
120
<form class="cpp_form" name="cp_ppp_pform<?php echo $CP_CPP_global_form_count; ?>" id="cp_ppp_pform<?php echo $CP_CPP_global_form_count; ?>" action="<?php get_site_url(); ?>" method="post" enctype="multipart/form-data" onsubmit="return doValidate<?php echo $CP_CPP_global_form_count; ?>(this);"><input type="hidden" name="cp_pform_psequence" value="<?php echo $CP_CPP_global_form_count; ?>" /><input type="hidden" name="cp_ppp_pform_process" value="1" /><input type="hidden" name="cp_ppp_id" value="<?php echo $id; ?>" /><input type="hidden" name="cp_ref_page" value="<?php esc_attr(cp_ppp_get_FULL_site_url); ?>" /><input type="hidden" name="form_structure<?php echo $CP_CPP_global_form_count; ?>" id="form_structure<?php echo $CP_CPP_global_form_count; ?>" size="180" value="<?php echo $raw_form_str; ?>" /><input type="hidden" id="cp_ppp_paymentspro<?php echo $CP_CPP_global_form_count; ?>" name="cp_ppp_paymentspro<?php echo $CP_CPP_global_form_count; ?>" value="1" />
121
<div id="fbuilder">
122
<div id="fbuilder<?php echo $CP_CPP_global_form_count; ?>">