-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
1834 lines (1759 loc) · 100 KB
/
Copy pathsettings.php
File metadata and controls
1834 lines (1759 loc) · 100 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( class_exists( 'MultiPay_Settings', false ) ) {
return;
}
class MultiPay_Settings {
function output() {
$qp_setup = qp_get_stored_setup();
$form = $qp_setup['current'];
?>
<div id="multipay" class="wrap">
<h1>MultiPay</h1>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<?php
if ( isset ($_GET['tab'])) {
self::admin_tabs($_GET['tab']); $tab = $_GET['tab'];
} else {
self::admin_tabs('setup'); $tab = 'setup';
}
switch ($tab) {
case 'setup' : self::setup($form); break;
case 'settings' : self::form_options($form); break;
case 'styles' : self::styles($form); break;
case 'send' : self::send_page($form); break;
case 'address' : self::address ($form); break;
case 'shortcodes' : self::shortcodes (); break;
case 'reset' : self::reset_page($form); break;
case 'coupon' : self::coupon_codes($form); break;
case 'paypal' : self::paypal_api(); break;
case 'stripe' : self::stripe_api(); break;
case 'worldpay' : self::worldpay_api(); break;
case 'amazon' : self::amazon_api(); break;
case 'autoresponce' : self::autoresponce_page($form); break;
case 'upgrade' : self::upgrade(); break;
}
?>
</div>
<div id="postbox-container-1" class="postbox-container">
<div class="box rating">
<h2 class="title"><?php _e( 'What\'s Your Rating?','multipay' ); ?></h2>
<div class="rate">
<div class="rating-stars">
<a data-rating="1" target="_blank" href="//wordpress.org/support/plugin/multipay/reviews/?rate=1#new-post" title="Poor"><span class="dashicons dashicons-star-empty" style="color:#ffb900 !important;"></span></a><a data-rating="2" target="_blank" href="//wordpress.org/support/plugin/multipay/reviews/?rate=2#new-post" title="Works"><span class="dashicons dashicons-star-empty" style="color:#ffb900 !important;"></span></a><a data-rating="3" target="_blank" href="//wordpress.org/support/plugin/multipay/reviews/?rate=3#new-post" title="Good"><span class="dashicons dashicons-star-empty" style="color:#ffb900 !important;"></span></a><a data-rating="4" target="_blank" href="//wordpress.org/support/plugin/multipay/reviews/?rate=4#new-post" title="Great"><span class="dashicons dashicons-star-empty" style="color:#ffb900 !important;"></span></a><a data-rating="5" target="_blank" href="//wordpress.org/support/plugin/multipay/reviews/?rate=5#new-post" title="Fantastic!"><span class="dashicons dashicons-star-empty" style="color:#ffb900 !important;"></span></a>
</div>
</div>
<p><?php echo sprintf( __( 'If you could spare <a href="%s" target="_blank" rel="nofollow">30 seconds to rate this plugin</a>, that would be fantastic!','multipay' ), 'https://wordpress.org/support/plugin/multipay/reviews?rate=5#new-post' ); ?></p>
</div>
<div class="box">
<h2 class="title"><?php _e( 'Need Help?','multipay' ); ?></h2>
<p><?php echo sprintf( __( '<a href="%s" target="_blank" rel="nofollow">Read the FAQ on WordPress.org</a> to see if your question is answered.','multipay' ), 'https://wordpress.org/plugins/multipay/#faq' ); ?></p>
</div>
<div class="box">
<h2 class="title"><?php _e( 'Need Support?','multipay' ); ?></h2>
<p><?php echo sprintf( __( '<a href="%s" target="_blank" rel="nofollow">Visit the WordPress.org Support Forum</a> to read the existing topics or create a new topic to get support.','multipay' ), 'https://wordpress.org/support/plugin/multipay/' ); ?></p>
</div>
<div class="box">
<h2 class="title"><?php _e( 'Need a Feature?','multipay' ); ?></h2>
<p><?php echo sprintf( __( '<a href="%s" target="_blank" rel="nofollow">Request a new feature on the WordPress.org Support Forum</a>','multipay' ), 'https://wordpress.org/support/plugin/multipay/' ); ?></p>
</div>
<div class="box github">
<h2 class="title"><?php _e( 'Want to Contribute?','multipay' ); ?></h2>
<p><a href="https://github.com/etalented/multipay" target="_blank"><img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Logo.png" alt=""></a></p>
<p><?php echo sprintf( __( '<a href="%s" target="_blank" rel="nofollow">The entire codebase is on GitHub</a>, so please feel free to make a pull request.','multipay' ), 'https://github.com/etalented/multipay' ); ?></p>
</div>
<p class="byline"><script src="//etalented.co.uk/bl/bl.js"></script></p>
</div>
</div>
</div>
</div>
<script>
jQuery( document ).ready( function( $ ) {
$( '.rating-stars' ).find( 'a' ).on( 'hover', function() {
$( this ).nextAll( 'a' ).children( 'span' ).removeClass( 'dashicons-star-filled' ).addClass( 'dashicons-star-empty' );
$( this ).prevAll( 'a' ).children( 'span' ).removeClass( 'dashicons-star-empty' ).addClass( 'dashicons-star-filled' );
$( this ).children( 'span' ).removeClass( 'dashicons-star-empty' ).addClass( 'dashicons-star-filled' );
});
});
</script>
<?php
}
// Build the Tabs
function admin_tabs($current = 'settings') {
$tabs = array(
'setup' => 'Setup',
'paypal' => 'PayPal',
'stripe' => 'Stripe',
'worldpay' => 'WorldPay',
'amazon' => 'Amazon',
'settings' => 'Form Settings',
'styles' => 'Styling',
'send' => 'Processing',
'autoresponce' => 'Auto Responder',
'paypal' => 'PayPal',
'stripe' => 'Stripe',
'worldpay' => 'WorldPay',
'amazon' => 'Amazon',
'upgrade' => '<span style="color:#8951A5;">Upgrade</span>',
);
?>
<nav class="nav-tab-wrapper">
<?php foreach( $tabs as $id => $name ): ?>
<?php $class = ( $id === $current ) ? 'nav-tab nav-tab-active' : 'nav-tab'; ?>
<?php $url = 'admin.php?page=multipay-settings&tab=' . urlencode( $id ); ?>
<a class="<?php echo $class; ?>" href="<?php echo $url; ?>"><?php echo $name; ?></a>
<?php endforeach ?>
</nav>
<?php
}
function head_css() {
$data = '<style type="text/css" media="screen">'."\r\n".qp_generate_css()."\r\n".'</style>';
echo $data;
}
// Plugin Setup
function setup ($form) {
$qp_setup = qp_get_stored_setup();
$qp_curr = qp_get_stored_curr();
$new_curr = $qp_curr['default'];
if( isset( $_POST['Submit']) && check_admin_referer("save_qp")) {
$qp_setup['alternative'] = filter_var($_POST['alternative'],FILTER_SANITIZE_STRING);
if (!empty($_POST['new_form'])) {
$qp_setup['current'] = stripslashes($_POST['new_form']);
$qp_setup['current'] = filter_var($qp_setup['current'],FILTER_SANITIZE_STRING);
$qp_setup['current'] = preg_replace("/[^A-Za-z]/",'',$qp_setup['current']);
$qp_setup['alternative'] = $qp_setup['current'].','.$qp_setup['alternative'];
}
else {
$qp_setup['current'] = filter_var($_POST['current'],FILTER_SANITIZE_STRING);
}
$arr = explode(",",$qp_setup['alternative']);
foreach ($arr as $item) {
$qp_curr[$item] = stripslashes($_POST['qp_curr'.$item]);
$qp_curr[$item] = filter_var($qp_curr[$item],FILTER_SANITIZE_STRING);
}
if (!empty($_POST['new_form'])) {
$formname = $qp_setup['current'];
$qp_curr[$formname] = stripslashes($_POST['new_curr']);
$qp_curr[$formname] = filter_var($qp_curr[$formname],FILTER_SANITIZE_STRING);
}
update_option( 'qp_curr', $qp_curr);
update_option( 'qp_setup', $qp_setup);
qp_admin_notice(__('The forms have been updated','multipay'));
if ($_POST['qp_clone'] && !empty($_POST['new_form'])) self::form_clone($qp_setup['current'],$_POST['qp_clone']);
}
if( isset( $_POST['Default']) && check_admin_referer("save_qp")) {
$qp_curr['default'] = stripslashes($_POST['default_currency']);
update_option( 'qp_curr', $qp_curr);
qp_admin_notice(__('Default current has been updated','multipay'));
}
if( isset( $_POST['Reset']) && check_admin_referer("save_qp")) {
self::delete_everything();
qp_admin_notice(__('Everything has been reset','multipay'));
$qp_setup = qp_get_stored_setup();
}
$arr = explode(",",$qp_setup['alternative']);
foreach ($arr as $item) if (isset($_POST['deleteform'.$item]) && $_POST['deleteform'.$item] == $item && isset($_POST['delete'.$item]) && $item != '') {
$forms = $qp_setup['alternative'];
self::delete_things($_POST['deleteform'.$item]);
$qp_setup['alternative'] = str_replace($_POST['deleteform'.$item].',','',$forms);
$qp_setup['current'] = 'default';
update_option('qp_setup', $qp_setup);
qp_admin_notice(__('The form named','multipay').' ' .$item.' '.__('has been deleted','multipay'));
$form = 'default';
break;
}
$new = '<h2>'.__('Setting up the form','multipay').'</h2>
<p>'.__('Click on the tabs for the payment providers you wish to use and add your credentials.','multipay').'</p>
<p>'.__('Update the settings.','multipay').'</p>
<h2>'.__('Adding the payment form to your site','multipay').'</h2>
<p>'.__('Add the payment form to your posts or pages use the shortcode: <code>[multipay]</code>.','multipay').'</p>
<p>'.__('There is also a widget called "MultiPay" you can drag and drop into a sidebar.','multipay').'</p>
<p>'.__('That\'s it. The payment form is ready to use.','multipay').'</p>
<p>'.__('You can now use the other tabs to change a whole range of settings.','multipay').'</p>
<form method="post" action="">
<h2>Currency</h2>
<p>Enter your currency code: <input type="text" style="width:3em;padding:1px;" name="default_currency" value="' . $qp_curr['default'].'" /></p>
<p><input type="submit" name="Default" class="button-primary" style="color: #FFF;" value="'.__('Update Currency','multipay').'" /></p>';
$new .= wp_nonce_field("save_qp");
$new .= '</form>
<div class="qpupgrade"><a href="admin.php?page=multipay-settings&tab=upgrade">
<h3>'.__('Upgrade to Pro','multipay').'</h3>
<p>'.__('Upgrading gets you multiple forms, more fields, autoresponder and the payment manager. All for just $10.','multipay').'</p>
<p>'.__('Click to find out more','multipay').'</p>
</a></div>';
$qppkey = get_option('qpp_key');
if (!$new_curr) $new_curr = $qp_curr['default'];
$content ='<div class="qp-settings"><div class="qp-options">
<h2 style="color:#B52C00">'.__('Setup','multipay').'</h2>';
if (!$qppkey['authorised']) {
$content .= $new;
} else {
$content .= '<form method="post" action="">
<h2>'.__('Existing Forms','multipay').'</h2>
<table>
<tr>
<td><b>'.__('Form name','multipay').' </b></td>
<td><b>'.__('Currency','multipay').'</b></td>
<td><b>'.__('Shortcode','multipay').'</b></td>
</tr>';
$arr = explode(",",$qp_setup['alternative']);
sort($arr);
foreach ($arr as $item) {
$checked = ($qp_setup['current'] == $item ? 'checked' : 'default');
$content .='<tr>
<td><input type="radio" name="current" value="' .$item . '" ' .$checked . ' /> '.$item.'</td>
<td><input type="text" style="width:3em;padding:1px;" name="qp_curr'.$item.'" value="' . $qp_curr[$item].'" /></td>';
$shortcode = ($item != 'default' ?' form="'.$item.'"' : '');
$content .= '<td><code>[multipay'.$shortcode.']</code></td><td>';
if ($item != 'default') $content .= '<input type="hidden" name="deleteform'.$item.'" value="'.$item.'"><input type="submit" name="delete'.$item.'" class="button-secondary" value="delete" onclick="return window.confirm( \'Are you sure you want to delete '.$item.'?\' );" />';
$content .= '</td></tr>';
}
$content .= '</table>
<h2>'.__('Create New Form','multipay').'</h2>
<p>'.__('Enter form name (letters only - no numbers, spaces or punctuation marks)','multipay').'</p>
<p>'.__('<input type="text" label="new_Form" name="new_form" value="" />','multipay').'</p>
<p>'.__('Enter currency code','multipay').': <input type="text" style="width:3em" label="new_curr" name="new_curr" value="'.$new_curr.'" /> ('.__('For example: GBP, USD, EUR','multipay').')</p>
<p><span style="color:red; font-weight: bold; margin-right: 3px">'.__('Important','multipay').'!</span> '.__('If your currency is not correct the plugin will work but the merchant will not accept the payment.','multipay').'</p>
<input type="hidden" name="alternative" value="' . $qp_setup['alternative'] . '" />
<p>'.__('Copy settings from an exisiting form.','multipay').'</p>
<select name="qp_clone"><option>'.__('Do not copy settings','multipay').'</option>';
foreach ($arr as $item) {
$content .= '<option value="'.$item.'">'.$item.'</option>';
}
$content .= '</select>
<p><input type="submit" name="Submit" class="button-primary" style="color: #FFF;" value="'.__('Update Settings','multipay').'" /> <input type="submit" name="Reset" class="button-secondary" value="'.__('Reset Everything','multipay').'" onclick="return window.confirm( \'This will delete all your forms and settings.\nAre you sure you want to reset everything?\' );"/></p>';
$content .= wp_nonce_field("save_qp");
$content .= '</form>';
}
$content .= '</div></div>';
echo $content;
}
// Clone the Form
function form_clone ($form,$clone) {
$update = qp_get_stored_options ($clone);update_option( 'qp_options'.$form, $update );
$update = qp_get_stored_send ($clone);update_option( 'qp_send'.$form, $update );
$update = qp_get_stored_coupon ($clone);update_option( 'qp_coupon'.$form, $update );
$update = qp_get_stored_address ($clone);update_option( 'qp_address'.$form, $update );
$update = qp_get_stored_autoresponder ($clone);update_option( 'qp_autoresponder'.$form, $update );
}
// Form Settings
function form_options($form) {
self::change_form_update($form);
$qppkey = get_option('qpp_key');
if( isset( $_POST['qp_submit']) && check_admin_referer("save_qp")) {
$options = array(
'title',
'blurb',
'sort',
'inputreference',
'fixedreference',
'refselector',
'inputamount',
'allow_amount',
'fixedamount',
'amtselector',
'combobox',
'comboboxword',
'comboboxlabel',
'use_currency',
'currencylabel',
'use_quantity',
'quantitylabel',
'quantitymax',
'quantitymaxblurb',
'use_stock',
'ruse_stock',
'fixedstock',
'stocklabel',
'use_options',
'ruse_options',
'optionlabel',
'optionvalues',
'optionselector',
'inline_options',
'use_process',
'processblurb',
'processref',
'processtype',
'processpercent',
'processfixed',
'use_postage',
'postageblurb',
'postageref',
'postagetype',
'postagepercent',
'postagefixed',
'use_blurb',
'extrablurb',
'use_address',
'addressblurb',
'use_email',
'ruse_email',
'emailblurb',
'use_message',
'ruse_message',
'messagelabel',
'use_terms',
'termsblurb',
'termsurl',
'termspage',
'captcha',
'mathscaption',
'use_reset',
'resetcaption',
);
foreach ($options as $item) {
$qp[$item] = stripslashes( $_POST[$item]);
$qp[$item] = filter_var($qp[$item],FILTER_SANITIZE_STRING);
}
if ($qppkey['authorised']) {
$options = array(
'use_coupon',
'couponblurb',
'couponref',
'couponbutton',
'use_totals',
'totalsblurb',
'use_datepicker',
'ruse_datepicker',
'datepickerblurb',
'use_slider',
'sliderlabel',
'min',
'max',
'initial',
'step'
);
foreach ($options as $item) {
$qp[$item] = stripslashes( $_POST[$item]);
$qp[$item] = filter_var($qp[$item],FILTER_SANITIZE_STRING);
}
}
update_option('qp_options'.$form, $qp);
qp_admin_notice(__('The form and submission settings have been updated','multipay'));
}
if( isset( $_POST['Reset']) && check_admin_referer("save_qp")) {
delete_option('qp_options'.$form);
qp_admin_notice(__('The form and submission settings have been reset','multipay'));
}
$qp_setup = qp_get_stored_setup();
$form=$qp_setup['current'];
$currency = qp_get_stored_curr();
$refradio=$refdropdown=$radio=$dropdown=$optionsradio=$optionsdropdown=$processpercent=$postagepercent=$comma=$D=$W=$Y='';
$qp = qp_get_stored_options($form);
$$qp['processtype'] = 'checked';
$$qp['postagetype'] = 'checked';
$$qp['coupontype'] = 'checked';
$$qp['refselector'] = 'checked';
$$qp['amtselector'] = 'checked';
$$qp['optionselector'] = 'checked';
$content = self::head_css();
$content .= '<script>
jQuery(function() {var qp_sort = jQuery( "#qp_sort" ).sortable({axis: "y",update:function(e,ui) {var order = qp_sort.sortable("toArray").join();jQuery("#qp_settings_sort").val(order);}});});
</script>';
$content .='<div class="qp-settings"><div class="qp-options">
<h2>'.__('Form Settings','multipay').'</h2>';
$content .= self::change_form($qp_setup);
$content .= '<form action="" method="POST">
<p>'.__('Form heading (optional)','multipay').'</p>
<p><input type="text" style="width:100%" name="title" value="' . $qp['title'] . '" /></p>
<p>'.__('This is the blurb that will appear below the heading and above the form:','multipay').'</p>
<p><input type="text" style="width:100%" name="blurb" value="' . $qp['blurb'] . '" /></p>
<h2>'.__('Form Fields','multipay').'</h2>
<p>'.__('Drag and drop to change order of the fields','multipay').'</p>
<table id="sorting">
<thead>
<tr>
<th width="5%">U</th>
<th width="5%">R</th>
<th width="20%">'.__('Form Field', 'multipay').'</th>
<th width="70%">'.__('Labels and Options', 'multipay').'</th>
</tr>
</thead>
<tbody id="qp_sort">';
foreach (explode( ',',$qp['sort']) as $name) {
switch ( $name ) {
case 'reference':
$check = ' ';
$type = 'Reference';
$input = 'inputreference';
$checked = 'checked';
$required = '';
$refselector = $qp['refselector'];
$options = '<p><input type="checkbox" name="fixedreference" ' . $qp['fixedreference'] . ' value="checked" /> Display as a pre-set reference</p>
<p class="description">Use commas to seperate options: Red,Green, Blue</p>
<p class="description">Use semi-colons to combine with amount: Red;$5,Green;$10,Blue;£20</span></p>
<p>Options Selector: <input type="radio" name="refselector" value="refradio" ' . (($refselector == 'refradio') ? 'checked' : '') . ' /> Radio <input type="radio" name="refselector" value="refdropdown" ' . (($refselector == 'refdropdown') ? 'checked' : '') . ' /> Dropdown</p>';
break;
case 'amount':
$check = ' ';
$type = 'Amount';
$input = 'inputamount';
$checked = 'checked';
$required = '';
$amtselector = $qp['amtselector'];
$options = '<p><input type="checkbox" name="allow_amount" ' . $qp['allow_amount'] . ' value="checked" /> Do not validate (use default amount value)</p>
<p><input type="checkbox" name="fixedamount" ' . $qp['fixedamount'] . ' value="checked" /> Display as a pre-set amount</p>
<p class="description">Use commas to create an options list: £10,£20,£30</p>
<p>Options Selector: <input type="radio" name="amtselector" value="amtradio" ' . (($amtselector == 'amtradio') ? 'checked' : '') . ' /> Radio <input type="radio" name="amtselector" value="amtdropdown" ' . (($amtselector == 'amtdropdown') ? 'checked' : '') . ' /> Dropdown</p>
<p><input type="checkbox" name="combobox" ' . $qp['combobox'] . ' value="checked" /> Add input field to dropdown<br>
Caption: <input type="text" style="width:7em;" name="comboboxword" value="' . $qp['comboboxword'] . '" /><br>
Instruction: <input type="text" style="width:10em;" name="comboboxlabel" value="' . $qp['comboboxlabel'] . '" /></p>';
break;
case 'quantity':
$check = '<input type="checkbox" name="use_quantity" ' . $qp['use_quantity'] . ' value="checked" />';
$type = 'Quantity';
$input = 'quantitylabel';
$checked = $qp['use_quantity'];
$required = '';
$options = '<p><input type="checkbox" name="quantitymax" ' . $qp['quantitymax'] . ' value="checked" /> Display and validate a maximum quantity</p>
<p class="description">Message that will display on the form:</p>
<p><input type="text" name="quantitymaxblurb" value="' . $qp['quantitymaxblurb'] . '" /></p>
<p class="description">E.g. "maxiumum of 10", where 10 is the maximum quantity</p>';
break;
case 'stock':
$check = '<input type="checkbox" name="use_stock" ' . $qp['use_stock'] . ' value="checked" />';
$type = 'Item Number';
$input = 'stocklabel';
$checked = $qp['use_stock'];
$required = '<input type="checkbox" name="ruse_stock" ' . $qp['ruse_stock'] . ' value="checked" />';
$options = '<p><input type="checkbox" name="fixedstock" ' . $qp['fixedstock'] . ' value="checked" /> Display as a pre-set item number</p>';
break;
case 'options':
$check = '<input type="checkbox" name="use_options" ' . $qp['use_options'] . ' value="checked" />';
$type = 'Options';
$input = 'optionlabel';
$checked = $qp['use_options'];
$required = '<input type="checkbox" name="ruse_options" ' . $qp['ruse_options'] . ' value="checked" />';
$optionselector = $qp['optionselector'];
$options = '<p class="description">Options (separate with a comma):</p>
<p><textarea name="optionvalues" label="Radio" rows="2">' . $qp['optionvalues'] . '</textarea></p>
<p>Options Selector: <input type="radio" name="optionselector" value="optionsradio" ' . (($optionselector == 'optionsradio') ? 'checked' : '') . ' /> Radio <input type="radio" name="optionselector" value="optionscheckbox" ' . (($optionselector == 'optionscheckbox') ? 'checked' : '') . ' /> Checkbox <input type="radio" name="optionselector" value="optionsdropdown" ' . (($optionselector == 'optionsdropdown') ? 'checked' : '') . ' /> Dropdown</p>
<p><input type="checkbox" name="inline_options" ' . $qp['inline_options'] . ' value="checked" /> Display inline radio and checkbox fields</p>';
break;
case 'postage':
$check = '<input type="checkbox" name="use_postage" ' . $qp['use_postage'] . ' value="checked" />';
$type = 'Postal charge';
$input = 'postageblurb';
$checked = $qp['use_postage'];
$required = '';
$postagetype = $qp['postagetype'];
$options = '<p class="description">Post and Packing charge type:</p>
<p><input type="radio" name="postagetype" value="postagepercent" ' . (($postagetype == 'postagepercent') ? 'checked' : '') . ' /> Percentage of the total: <input type="text" style="width:4em;padding:2px" label="postagepercent" name="postagepercent" value="' . $qp['postagepercent'] . '" /> %</p>
<p><input type="radio" name="postagetype" value="postagefixed" ' . (($postagetype == 'postagefixed') ? 'checked' : '') . ' /> Fixed amount: <input type="text" style="width:4em;padding:2px" label="postagefixed" name="postagefixed" value="' . $qp['postagefixed'] . '" /> '.$currency[$form].'</p>';
break;
case 'processing':
$check = '<input type="checkbox" name="use_process" ' . $qp['use_process'] . ' value="checked" />';
$type = 'Processing Charge';
$input = 'processblurb';
$checked = $qp['use_process'];
$required = '';
$processtype = $qp['processtype'];
$options = '<p class="description">Payment charge type:</p>
<p><input type="radio" name="processtype" value="processpercent" ' . (($processtype == 'processpercent') ? 'checked' : '') . ' /> Percentage of the total: <input type="text" style="width:4em;padding:2px" label="processpercent" name="processpercent" value="' . $qp['processpercent'] . '" /> %</p>
<p><input type="radio" name="processtype" value="processfixed" ' . (($processtype == 'processfixed') ? 'checked' : '') . ' /> Fixed amount: <input type="text" style="width:4em;padding:2px" label="processfixed" name="processfixed" value="' . $qp['processfixed'] . '" /> '.$currency[$form].'</p>';
break;
case 'coupon':
if ($qppkey['authorised']) {
$check = '<input type="checkbox" name="use_coupon" ' . $qp['use_coupon'] . ' value="checked" />';
$type = 'Coupon Code';
$input = 'couponblurb';
$checked = $qp['use_coupon'];
$required = '';
$options = '<p class="description">Button label:</p>
<p><input type="text" name="couponbutton" value="' . $qp['couponbutton'] . '" /></p>
<p class="description">Coupon applied message:</p>
<p><input type="text" name="couponref" value="' . $qp['couponref'] . '" /></p>
<p><a href="admin.php?page=multipay-settings&tab=coupon">Set coupon codes</a></p>';
} else {
$type = 'Coupons';
$input = '';
$options = '<p>Coupons are only available in the Pro Version</p>';
$check = '';
$required = '';
$checked = false;
}
break;
case 'additionalinfo':
$check = '<input type="checkbox" name="use_blurb" ' . $qp['use_blurb'] . ' value="checked" />';
$type = 'Additional Information';
$input = 'extrablurb';
$checked = $qp['use_blurb'];
$required = '';
$options = '<p class="description">Add additional information to your form</p>';
break;
case 'address':
$check = '<input type="checkbox" name="use_address" ' . $qp['use_address'] . ' value="checked" />';
$type = 'Personal Details';
$input = 'addressblurb';
$checked = $qp['use_address'];
$options = '<p><a href="admin.php?page=multipay-settings&tab=address">'.__('Personal details Settings','multipay').'</a></p>';
break;
case 'slider';
if ($qppkey['authorised']) {
$check = '<input type="checkbox" name="use_slider" ' . $qp['use_slider'] . ' value="checked" />';
$type = 'Range slider';
$input = 'sliderlabel';
$checked = $qp['use_slider'];
$options = '<p>The range slider replaces the amount field.</p>
<p><input type="text" style="border:1px solid #415063; width:3em;" name="min" . value ="' . $qp['min'] . '" /> Minimum value<br>
<input type="text" style="border:1px solid #415063; width:3em;" name="max" . value ="' . $qp['max'] . '" /> Maximum value<br>
<input type="text" style="border:1px solid #415063; width:3em;" name="initial" . value ="' . $qp['initial'] . '" /> Initial value<br>
<input type="text" style="border:1px solid #415063; width:3em;" name="step" . value ="' . $qp['step'] . '" /> Step</p>';
} else {
$type = 'Range Slider';
$input = '';
$options = '<p>The rangeslider option is only available in the Pro Version</p>';
$check = '';
$required = '';
$checked = false;
}
break;
case 'email':
$check = '<input type="checkbox" name="use_email" ' . $qp['use_email'] . ' value="checked" />';
$type = 'Email Address';
$input = 'emailblurb';
$checked = $qp['use_email'];
$required = '<input type="checkbox" name="ruse_email" ' . $qp['ruse_email'] . ' value="checked" />';
$options = '<p class="description">Use this to collect the Payees email address.</p>';
break;
case 'message':
$check = '<input type="checkbox" name="use_message" ' . $qp['use_message'] . ' value="checked" />';
$type = 'Add textbox for comments';
$input = 'messagelabel';
$checked = $qp['use_message'];
$required = '<input type="checkbox" name="ruse_message" ' . $qp['ruse_message'] . ' value="checked" />';
$options = '';
break;
case 'datepicker':
if ($qppkey['authorised']) {
$check = '<input type="checkbox" name="use_datepicker" ' . $qp['use_datepicker'] . ' value="checked" />';
$type = 'Add datepicker';
$input = 'datepickerlabel';
$checked = $qp['use_datepicker'];
$required = '<input type="checkbox" name="ruse_datepicker" ' . $qp['ruse_datepicker'] . ' value="checked" />';
$options = '';
} else {
$type = 'Add datepicker';
$input = '';
$options = '<p>The datepicker option is only available in the Pro Version</p>';
$check = '';
$required = '';
$checked = false;
}
break;
case 'terms':
$check = '<input type="checkbox" name="use_terms" ' . $qp['use_terms'] . ' value="checked" />';
$type = 'Terms and Conditions';
$input = 'termsblurb';
$checked = $qp['use_terms'];
$required = '';
$options = '<p class="description">URL of Terms and Conditions:</p>
<p><input type="text" name="termsurl" value="' . $qp['termsurl'] . '" /></p>
<p><input type="checkbox" name="termspage" ' . $qp['termspage'] . ' value="checked" /> Open link in a new page</p>';
break;
case 'captcha':
$check = '<input type="checkbox" name="captcha" ' . $qp['captcha'] . ' value="checked" />';
$type = 'Maths Captcha';
$input = 'mathscaption';
$checked = $qp['captcha'];
$options = '<p class="description">Add a maths checker to the form to (hopefully) block most of the spambots.</p>';
break;
case 'totals':
if ($qppkey['authorised']) {
$check = '<input type="checkbox" name="use_totals" ' . $qp['use_totals'] . ' value="checked" />';
$type = 'Show totals';
$input = 'totalsblurb';
$checked = $qp['use_totals'];
$required = '';
$options = '<p class="description">Show live totals on your form.</p>';
} else {
$type = 'Live totals';
$input = '';
$options = '<p>Live totals are only available in the Pro Version</p>';
$check = '';
$required = '';
$checked = false;
}
break;
}
$li_class = ($checked) ? 'button_active' : 'button_inactive';
$content .='<tr class="'.$li_class.'" id="'.$name.'">
<td>'.$check.'</td>
<td>'.$required.'</td>
<td>'.$type.'</td>
<td>';
if ($input) $content .='<input type="text" id="'.$name.'" name="'.$input.'" value="' . $qp[$input] . '" />';
if ($options) $content .= $options;
$content .='</td>
</tr>';
}
$content .='</tbody></table>
<h2>'.__('Reset button','multipay').'</h2>
<p>'.__('<input type="checkbox" name="use_reset" ' . $qp['use_reset'] . ' value="checked" /> Show Reset Button','multipay').'</p>
<input type="text" name="resetcaption" value="' . $qp['resetcaption'] . '" />
<p>'.__('<input type="submit" name="qp_submit" class="button-primary" style="color: #FFF;" value="Save Changes" /> <input type="submit" name="Reset" class="button-primary" style="color: #FFF;" value="Reset" onclick="return window.confirm( \'Are you sure you want to reset the form settings?\' );"/>','multipay').'</p>
<input type="hidden" id="qp_settings_sort" name="sort" value="'.$qp['sort'].'" />';
$content .= wp_nonce_field("save_qp");
$content .= '</form>
</div></div>';
echo $content;
}
function checked($value, $eq = null) {
return (($value && $eq === null) || $value == $eq) ? 'checked' : '';
}
// Styles
function styles($form) {
if( isset( $_POST['Submit']) && check_admin_referer("save_qp")) {
$options = array(
'font',
'font-family',
'font-size',
'font-colour',
'text-font-family',
'text-font-size',
'text-font-colour',
'form-border',
'input-border',
'required-border',
'error-colour',
'border',
'width',
'widthtype',
'background',
'backgroundhex',
'backgroundimage',
'corners',
'custom',
'use_custom',
'use_theme',
'styles',
'submit-colour',
'submit-background',
'submit-hover-background',
'submit-border',
'submitwidth',
'submitwidthset',
'submitposition',
'coupon-colour',
'coupon-background',
'header-type',
'header-size',
'header-colour',
'slider-background',
'slider-revealed',
'handle-background',
'handle-border',
'output-size',
'output-colour',
'slider-thickness',
'handle-corners',
'line_margin'
);
foreach ( $options as $item) {
$style[$item] = stripslashes($_POST[$item]);
$style[$item] = filter_var($style[$item],FILTER_SANITIZE_STRING);
}
update_option( 'qp_style', $style);
qp_admin_notice(__('The form styles have been updated'.'multipay'));
}
if( isset( $_POST['Reset']) && check_admin_referer("save_qp")) {
delete_option('qp_style');
qp_admin_notice(__('The form styles have been reset','multipay'));
}
$percent=$pixel=$none=$plain=$shadow=$roundshadow=$round=$white=$square=$theme=$submitrandom=$submitpixel=$submitright='';
$style = qp_get_stored_style();
$$style['font'] = 'checked';
$$style['widthtype'] = 'checked';
$$style['submitwidth'] = 'checked';
$$style['submitposition'] = 'checked';
$$style['border'] = 'checked';
$$style['background'] = 'checked';
$$style['corners'] = 'checked';
$$style['styles'] = 'checked';
$$style['header-type'] = 'checked';
$content = self::head_css();
$content .= '<div class="qp-settings"><div class="qp-options">
<h2 style="color:#B52C00">'.__('Styling','multipay').'</h2>';
$qp = qp_get_stored_options($form);
$content .= '<form method="post" action="">
<table>
<tr>
<td colspan="2"><h2>'.__('Form Width','multipay').'</h2></td>
</tr>
<tr>
<td colspan="2"><input type="radio" name="widthtype" value="percent" ' . $percent . ' '.self::checked($style['widthtype'], 'percent').' /> 100% (fill the available space)<br />
<input type="radio" name="widthtype" value="pixel" ' . $pixel . ' '.self::checked($style['widthtype'], 'pixel').' /> Pixel (fixed): <input type="text" style="width:4em" label="width" name="width" value="' . $style['width'] . '" /> use px, em or %. Default is px.</td>
</tr>
<tr>
<td colspan="2"><h2>'.__('Form Border','multipay').'</h2></td
</tr>
<tr>
<td width="20%">Type:</td>
<td><input type="radio" name="border" value="none" ' . $none . ' '.self::checked($style['border'], 'none').' /> No border<br />
<input type="radio" name="border" value="plain" ' . $plain . ' '.self::checked($style['border'], 'plain').' /> Plain Border<br />
<input type="radio" name="border" value="rounded" ' . $rounded . ' '.self::checked($style['border'], 'rounded').' /> Round Corners (Not IE8)<br />
<input type="radio" name="border" value="shadow" ' . $shadow . ' '.self::checked($style['border'], 'shadow').' /> Shadowed Border(Not IE8)<br />
<input type="radio" name="border" value="roundshadow" ' . $roundshadow . ' '.self::checked($style['border'], 'roundshadow').' /> Rounded Shadowed Border (Not IE8)</td>
</tr>
<tr>
<td>Style:</td>
<td><input type="text" label="form-border" name="form-border" value="' . $style['form-border'] . '" /></td>
</tr>
<tr>
<td colspan="2"><h2>'.__('Background','multipay').'</h2></td>
</tr>
<tr>
<td>Colour:</td>
<td><input type="radio" name="background" value="theme" ' . $theme . ' '.self::checked($style['background'], 'theme').' /> Same at theme<br />
<input style="margin-bottom:5px;" type="radio" name="background" value="color" '.self::checked($style['background'], 'color').' ' . $color . ' />
<input type="text" class="qp-color" label="background" name="backgroundhex" value="' . $style['backgroundhex'] . '" /></td>
</tr>
<tr><td>Background<br>Image:</td>
<td>
<input id="qp_background_image" type="text" name="backgroundimage" value="' . $style['backgroundimage'] . '" />
<input id="qp_upload_background_image" class="button" type="button" value="Upload Image" /></td>
</tr>
<tr>
<td colspan="2"><h2>'.__('Form Header','multipay').'</h2></td>
</tr>
<tr>
<td>Header Size:</td>
<td><input type="text" style="width:6em" label="header-size" name="header-size" value="' . $style['header-size'] . '" /></td>
</tr>
<tr><td>Header Colour:</td>
<td><input type="text" class="qp-color" label="header-colour" name="header-colour" value="' . $style['header-colour'] . '" /></td>
</tr>
<tr>
<td colspan="2"><h2>'.__('Input fields','multipay').'</h2></td>
</tr>
<tr>
<td>Font Family: </td>
<td><input type="text" label="font-family" name="font-family" value="' . $style['font-family'] . '" /></td>
</tr>
<tr>
<td>Font Size: </td>
<td><input type="text" label="font-size" style="width:6em" name="font-size" value="' . $style['font-size'] . '" /></td>
</tr>
<tr>
<td>Font Colour: </td>
<td><input type="text" class="qp-color" label="font-colour" name="font-colour" value="' . $style['font-colour'] . '" /></td
</tr>
<tr>
<td>Normal Border: </td>
<td><input type="text" label="input-border" name="input-border" value="' . $style['input-border'] . '" /></td>
</tr>
<tr>
<td>Required Border: </td>
<td><input type="text" name="required-border" value="' . $style['required-border'] . '" /></td>
</tr>
<tr>
<td>Error Colour: </td>
<td><input type="text" class="qp-color" name="error-colour" value="' . $style['error-colour'] . '" /></td>
</tr>
<tr>
<td>Corners: </td>
<td><input type="radio" name="corners" value="square" ' . $square . ' '.self::checked($style['corners'], 'square').' /> Square corners<br />
<input type="radio" name="corners" value="round" ' . $round . ' '.self::checked($style['corners'], 'round').' /> Rounded corners</td></tr>
<tr>
<td style="vertical-align:top;">'.__('Margins and Padding', 'multipay').'</td>
<td><span class="description">'.__('Set the margins and padding of each bit using CSS shortcodes', 'multipay').':</span><br><input type="text" label="line margin" name="line_margin" value="' . $style['line_margin'] . '" /></td>
</tr>
<tr>';
if ($qp['use_coupon']) $content .= '<td colspan="2"><h2>'.__('Apply Coupon Button','multipay').'</h2></td>
</tr>
<tr>
<td>Font Colour: </td>
<td><input type="text" class="qp-color" label="coupon-colour" name="coupon-colour" value="' . $style['coupon-colour'] . '" /></td>
</tr>
<tr>
<td>Background: </td>
<td><input type="text" class="qp-color" label="coupon-background" name="coupon-background" value="' . $style['coupon-background'] . '" /><br>Other settings are the same as the Submit Button</td>
</tr>';
$content .= '<tr>
<td colspan="2"><h2>'.__('Other text content','multipay').'</h2></td>
</tr>
<tr>
<td>Font Family: </td>
<td><input type="text" label="text-font-family" name="text-font-family" value="' . $style['text-font-family'] . '" /></td>
</tr>
<tr>
<td>Font Size: </td>
<td><input type="text" style="width:6em" label="text-font-size" name="text-font-size" value="' . $style['text-font-size'] . '" /></td>
</tr>
<tr>
<td>Font Colour: </td>
<td><input type="text" class="qp-color" label="text-font-colour" name="text-font-colour" value="' . $style['text-font-colour'] . '" /></td>
</tr>
<tr>
<td colspan="2"><h2>'.__('Submit Button','multipay').'</h2></td>
</tr>
<tr>
<td>Font Colour:</td>
<td><input type="text" class="qp-color" label="submit-colour" name="submit-colour" value="' . $style['submit-colour'] . '" /></td></tr>
<tr>
<td>Background:</td>
<td><input type="text" class="qp-color" label="submit-background" name="submit-background" value="' . $style['submit-background'] . '" /></td>
</tr>
<tr>
<td>Hover: </td>
<td><input type="text" class="qp-color" label="submit-hover-background" name="submit-hover-background" value="' . $style['submit-hover-background'] . '" /></td>
</tr>
<tr>
<td>Border:</td>
<td><input type="text" label="submit-border" name="submit-border" value="' . $style['submit-border'] . '" /></td></tr>
<tr>
<td>Size:</td>
<td><input type="radio" name="submitwidth" value="submitpercent" ' . $submitpercent . ' '.self::checked($style['submitwidth'], 'submitpercent').' /> Same width as the form<br />
<input type="radio" name="submitwidth" value="submitrandom" ' . $submitrandom . ' '.self::checked($style['submitwidth'], 'submitrandom').' /> Same width as the button text</td></tr>
<tr>
<td>Position:</td>
<td><input type="radio" name="submitposition" value="submitleft" ' . $submitleft . ' '.self::checked($style['submitposition'], 'submitleft').' /> Left <input type="radio" name="submitposition" value="submitmiddle" ' . $submitmiddle . ' '.self::checked($style['submitposition'], 'submitmiddle').' /> Centre <input type="radio" name="submitposition" value="submitright" ' . $submitright . ' '.self::checked($style['submitposition'], 'submitright').' /> Right</td>
</tr>';
if ($qp['use_slider']) $content .= '<tr>
<td colspan="2"><h2>'.__('Slider','multipay').'</h2></td>
</tr>
<tr>
<td>Thickness</td>
<td><input type="text" style="width:3em" label="input-border" name="slider-thickness" value="' . $style['slider-thickness'] . '" />em</td>
</tr>
<tr>
<td>Normal Background</td>
<td><input type="text" class="qp-color" label="input-border" name="slider-background" value="' . $style['slider-background'] . '" /></td>
</tr>
<tr>
<td>Revealed Background</td>
<td><input type="text" class="qp-color" label="input-border" name="slider-revealed" value="' . $style['slider-revealed'] . '" /></td>
</tr>
<tr>
<td>Handle Background</td>
<td><input type="text" class="qp-color" label="input-border" name="handle-background" value="' . $style['handle-background'] . '" /></td>
</tr>
<tr>
<td>Handle Border</td>
<td><input type="text" class="qp-color" label="input-border" name="handle-border" value="' . $style['handle-border'] . '" /></td>
</tr>
<tr>
<td>Corners</td>
<td><input type="text" style="width:2em" name="handle-corners" value="' . $style['handle-corners'] . '" /> %</td>
</tr>
<tr>
<td>Output Size</td>
<td><input type="text" style="width:5em" label="input-border" name="output-size" value="' . $style['output-size'] . '" /></td>
</tr>
<tr>
<td>Output Colour</td>
<td><input type="text" class="qp-color" label="input-border" name="output-colour" value="' . $style['output-colour'] . '" /></td>
</tr>';
$content .= '</table>
<p>'.__('<input type="submit" name="Submit" class="button-primary" style="color: #FFF;" value="Save Changes" /> <input type="submit" name="Reset" class="button-primary" style="color: #FFF;" value="Reset" onclick="return window.confirm( \'Are you sure you want to reset the form styles?\' );"/>','multipay').'</p>';
$content .= wp_nonce_field("save_qp");
$content .= '</form>
</div></div>';
echo $content;
}
// Processing Settings and Messages
function send_page($form) {
self::change_form_update($form);
$default_options = qp_get_send_defaults();
$existing_options = get_option('qp_send'.$form);
$processing_options = array(
'customurl',
'cancelurl',
'thanksurl',
'combine',
'mailchimpregion',
'mailchimpuser',
'mailchimpid',
);
$messages_options = array(
'errortitle',
'errorblurb',
'validating',
'waiting',
'failuretitle',
'failureblurb',
'failureanchor',
'pendingtitle',
'pendingblurb',
'pendinganchor',
'confirmationtitle',
'confirmationblurb',
'confirmationanchor',
);
// Processing update
if( isset( $_POST['processing_submit']) && check_admin_referer("processing_save")) {
foreach ($processing_options as $item) {
$send[$item] = stripslashes( $_POST[$item]);
$send[$item] = filter_var($send[$item],FILTER_SANITIZE_STRING);
}
update_option('qp_send'.$form, wp_parse_args( $send, $existing_options ));
qp_admin_notice(__('The processing settings have been updated','multipay'));
}
// Messages update
if( isset( $_POST['messages_submit']) && check_admin_referer("messages_save")) {
foreach ($messages_options as $item) {
$send[$item] = stripslashes( $_POST[$item]);
$send[$item] = filter_var($send[$item],FILTER_SANITIZE_STRING);
}
update_option('qp_send'.$form, wp_parse_args( $send, $existing_options ));
qp_admin_notice(__('The messages settings have been updated','multipay'));
}
// Reset processing options
if( isset( $_POST['processing_reset']) && check_admin_referer("processing_save")) {
$reset_options = array();
foreach ($processing_options as $item) {
$reset_options[$item] = $default_options[$item];
}
update_option('qp_send'.$form, wp_parse_args( $reset_options, $existing_options ));
qp_admin_notice(__('The processing settings have been reset','multipay'));
}
// Reset messages options
if( isset( $_POST['messages_reset']) && check_admin_referer("messages_save")) {
$reset_options = array();
foreach ($messages_options as $item) {
$reset_options[$item] = $default_options[$item];
}
update_option('qp_send'.$form, wp_parse_args( $reset_options, $existing_options ));
qp_admin_notice(__('The processing settings have been reset','multipay'));
}
$qp_setup = qp_get_stored_setup();
$form = $qp_setup['current'];
$newpage = $customurl = '';
$send = qp_get_stored_send($form);
$$send['target'] = 'checked';
$$send['lc'] = 'selected';
if (empty($send['confirmemail'])) {
$send['confirmemail'] = get_bloginfo('admin_email');
}
$content = self::head_css();
$content .= self::change_form($qp_setup);
$content .= '<div class="qp-settings"><div class="qp-options"><form action="" method="POST">
<h2 style="color:#B52C00">'.__('Processing','multipay').'</h2>';
$content .= '<h2>'.__('Cancel and Thank you pages','multipay').'</h2>
<p>'.__('If you leave these blank the merchant will return the user to the current page.','multipay').'</p>
<p>'.__('URL of cancellation page','multipay').'</p>
<input type="text" style="width:100%" name="cancelurl" value="' . $send['cancelurl'] . '" />
<p>'.__('URL of thank you page','multipay').'</p>
<input type="text" style="width:100%" name="thanksurl" value="' . $send['thanksurl'] . '" />
<h2>'.__('Add to Mailchimp','multipay').'</h2>
<p>'.__('This will only work if you are collecting names and email addresses','multipay').'</p>
<p>'.__('Your Mailchimp Region:
<input type="text" style="width:100%" name="mailchimpregion" value="' . $send['mailchimpregion'] . '" />','multipay').'</p>
<p>'.__('Your Mailchimp User ID:
<input type="text" style="width:100%" name="mailchimpuser" value="' . $send['mailchimpuser'] . '" />','multipay').'</p>
<p>'.__('The Mailchimp List ID:
<input type="text" style="width:100%" name="mailchimpid" value="' . $send['mailchimpid'] . '" />','multipay').'</p>
<p><a href="https://wordpress.org/plugins/multipay/#faq" target="_blank">'.__("Visit the FAQ to find out what to put here",'multipay').'</a></p>
<p>'.__('<input type="submit" name="processing_submit" class="button-primary" style="color: #FFF;" value="Save Changes" /> <input type="submit" name="processing_reset" class="button-primary" style="color: #FFF;" value="Reset" onclick="return window.confirm( \'Are you sure you want to reset the processing fields?\' );"/>','multipay').'</p>';
$content .= wp_nonce_field("processing_save");
$content .= '</form></div>';
$content .= '<div class="qp-options"><form action="" method="POST">
<h2 style="color:#B52C00">'.__('Error and Validation Messages','multipay').'</h2>
<table>
<tr>
<td colspan="2"><h2>'.__('Form Error Messages', 'multipay').'</h2></td>
</tr>
<tr>
<td width="40%">Error header</td>
<td><input type="text" style="width:100%" name="errortitle" value="' . $send['errortitle'] . '" /></td>
</tr>
<tr>
<td>Error message</td>
<td><input type="text" style="width:100%" name="errorblurb" value="' . $send['errorblurb'] . '" /></td>