forked from tlovett1/custom-contact-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-contact-forms-admin.php
More file actions
2579 lines (2493 loc) · 150 KB
/
Copy pathcustom-contact-forms-admin.php
File metadata and controls
2579 lines (2493 loc) · 150 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
/*
Custom Contact Forms Plugin
By Taylor Lovett - http://www.taylorlovett.com
Plugin URL: http://www.taylorlovett.com/wordpress-plugins
*/
if (!class_exists('CustomContactFormsAdmin')) {
class CustomContactFormsAdmin extends CustomContactForms {
var $action_complete = '';
function adminInit() {
$this->downloadExportFile();
$this->downloadCSVExportFile();
$this->runImport();
}
function insertUsagePopover() {
ccf_utils::load_module('usage_popover/custom-contact-forms-usage-popover.php');
}
function insertQuickStartPopover() {
ccf_utils::load_module('usage_popover/custom-contact-forms-quick-start-popover.php');
}
function isPluginAdminPage() {
$pages = array('custom-contact-forms', 'ccf-settings', 'ccf-saved-form-submissions');
return (in_array($GLOBALS['ccf_current_page'], $pages));
}
function appendToActionLinks($action_links, $plugin_file) {
static $link_added = false;
if (!$link_added && basename($plugin_file) == 'custom-contact-forms.php') {
$new_link = '<a style="font-weight:bold;" href="admin.php?page=custom-contact-forms" title="' . __('Manage Custom Contact Forms', 'custom-contact-forms') . '">' . __('Settings', 'custom-contact-forms') . '</a>';
array_unshift($action_links, $new_link);
$link_added = true;
}
return $action_links;
}
function downloadExportFile() {
if (isset($_POST['ccf_export'])) {
//chmod('modules/export/', 0777);
ccf_utils::load_module('export/custom-contact-forms-export.php');
$transit = new CustomContactFormsExport(parent::getAdminOptionsName());
$transit->exportAll();
$file = $transit->exportToFile();
ccf_utils::redirect(plugins_url() . '/custom-contact-forms/download.php?location=export/' . $file);
}
}
function downloadCSVExportFile() {
if (isset($_POST['ccf_export_all_csv'])) {
ccf_utils::load_module('export/custom-contact-forms-export.php');
$transit = new CustomContactFormsExport(parent::getAdminOptionsName());
$transit->exportSavedFormSubmissionsToCSV();
$file = $transit->exportCSVToFile();
ccf_utils::redirect(plugins_url() . '/custom-contact-forms/download.php?location=export/' . $file);
} elseif (isset($_POST['ccf_export_form_csv']) && isset($_POST['csv_form_id']) && !empty($_POST['csv_form_id'])) {
ccf_utils::load_module('export/custom-contact-forms-export.php');
$transit = new CustomContactFormsExport(parent::getAdminOptionsName());
$transit->exportSavedFormSubmissionsToCSV($_POST['csv_form_id']);
$file = $transit->exportCSVToFile();
ccf_utils::redirect(plugins_url() . '/custom-contact-forms/download.php?location=export/' . $file);
}
}
function runImport() {
if (isset($_POST['ccf_clear_import']) || isset($_POST['ccf_merge_import'])) {
//chmod('modules/export/', 0777);
ccf_utils::load_module('export/custom-contact-forms-export.php');
$transit = new CustomContactFormsExport(parent::getAdminOptionsName());
$settings['import_general_settings'] = ($_POST['ccf_import_overwrite_settings'] == 1) ? true : false;
$settings['import_forms'] = ($_POST['ccf_import_forms'] == 1) ? true : false;
$settings['import_fields'] = ($_POST['ccf_import_fields'] == 1) ? true : false;
$settings['import_field_options'] = ($_POST['ccf_import_field_options'] == 1) ? true : false;
$settings['import_styles'] = ($_POST['ccf_import_styles'] == 1) ? true : false;
$settings['import_saved_submissions'] = ($_POST['ccf_import_saved_submissions'] == 1) ? true : false;
$settings['mode'] = ($_POST['ccf_clear_import']) ? 'clear_import' : 'merge_import';
$transit->importFromFile($_FILES['import_file'], $settings);
ccf_utils::redirect('options-general.php?page=custom-contact-forms');
}
}
function contactAuthor($name, $email, $website, $message, $type, $host, $ccf_version, $wp_version) {
if (empty($message)) return false;
if (!class_exists('PHPMailer'))
require_once(ABSPATH . "wp-includes/class-phpmailer.php");
$mail = new PHPMailer();
$body = "Name: $name<br />\n";
$body .= "Email: $email<br />\n";
$body .= "Website: $website<br />\n";
$body .= "CCF Version: $ccf_version<br />\n";
$body .= "WP Version: $wp_version<br />\n";
$body .= "Host: $host<br />\n";
$body .= "Message: $message<br />\n";
$body .= "Message Type: $type<br />\n";
$body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "<br />\n";
$admin_options = parent::getAdminOptions();
if ($admin_options['mail_function'] == 'smtp') {
$mail->IsSMTP();
$mail->Host = $admin_options['smtp_host'];
if ($admin_options['smtp_authentication'] == 1) {
$mail->SMTPAuth = true;
$mail->Username = $admin_options['smtp_username'];
$mail->Password = $admin_options['smtp_password'];
$mail->Port = $admin_options['smtp_port'];
} else
$mail->SMTPAuth = false;
}
$mail->From = $email;
$mail->FromName = 'Custom Contact Forms';
$mail->AddAddress('admin@taylorlovett.com');
$mail->Subject = "CCF Message: $type";
$mail->CharSet = "utf-8";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->Send();
return true;
}
function displayPluginNewsFeed() {
include_once(ABSPATH . WPINC . '/feed.php');
$rss = @fetch_feed('http://www.taylorlovett.com/category/custom-contact-forms/feed');
if (!is_wp_error($rss) ) {
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
}
?>
<ul>
<?php if ($maxitems == 0) echo '<li>' . __('Nothing to show.', 'custom-contact-forms') . '</li>';
else
foreach ( $rss_items as $item ) : ?>
<li>
<div class="news-header">
<a href="<?php echo esc_attr($item->get_permalink()); ?>"><?php echo esc_html($item->get_title()); ?></a> <span class="date"><?php echo esc_html($item->get_date('j F, Y')); ?></span>
</div>
<div class="news-content">
<?php echo $item->get_content(); ?>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php
}
function getFieldsForm($show_field_type = false) {
$fields = parent::selectAllFields();
$out = '';
foreach ($fields as $field) {
$type = ($show_field_type) ? ' ('.$field->field_type.')' : '';
$out .= '<option value="'.$field->id.'">'.$field->field_slug . $type . '</option>' . "\n";
}
return $out;
}
function handleAJAX() {
if (!wp_verify_nonce($_POST['nonce'], 'ccf_nonce')) exit(__('Invalid request.', 'custom-contact-forms'));
$output = $this->handleAdminPostRequests();
$response = json_encode( $output );
header("Content-Type: application/json");
exit($response);
return true;
}
function getFieldOptionsForm() {
$options = parent::selectAllFieldOptions();
$out = '';
foreach ($options as $option) {
$out .= '<option value="'.$option->id.'">'.$option->option_slug.'</option>' . "\n";
}
return $out;
}
function insertBackEndStyles() {
wp_register_style('ccf-standards', plugins_url() . '/custom-contact-forms/css/custom-contact-forms-standards.css');
wp_register_style('ccf-jquery-ui', plugins_url() . '/custom-contact-forms/css/jquery-ui.css');
wp_register_style('ccf-admin', plugins_url() . '/custom-contact-forms/css/custom-contact-forms-admin.css');
wp_register_style('ccf-colorpicker', plugins_url() . '/custom-contact-forms/css/colorpicker.css');
wp_enqueue_style('ccf-jquery-ui');
wp_enqueue_style('ccf-standards');
wp_enqueue_style('ccf-admin');
wp_enqueue_style('ccf-colorpicker');
}
function insertAdminScripts() {
$js_version = '2.0.5';
$admin_options = parent::getAdminOptions();
$js_lang = array(
'attaching' => __('Attaching', 'custom-contact-forms'),
'detaching' => __('Detaching', 'custom-contact-forms'),
'update_button' => __('Save', 'custom-contact-forms'),
'attach_button' => __('Attach', 'custom-contact-forms'),
'saving' => __('Saving', 'custom-contact-forms'),
'more_options' => __('More Options', 'custom-contact-forms'),
'expand' => __('Expand', 'custom-contact-forms'),
'click_to_confirm' => __('Click to Confirm', 'custom-contact-forms'),
'selected_tab' => (isset($_POST['selected_tab'])) ? $_POST['selected_tab'] : 0,
'delete_confirm' => __('Are you sure you want to delete this?', 'custom-contact-forms'),
'error' => __('An error has occured. Please try again later.', 'custom-contact-forms'),
'nothing_to_show' => __('Nothing to show.', 'custom-contact-forms'),
'nothing_attached' => __('Nothing Attached!', 'custom-contact-forms'),
'no_fields' => __('No Fields', 'custom-contact-forms'),
'nonce' => wp_create_nonce('ccf_nonce')
);
$js_ajax = array('plugin_dir' => plugins_url() . '/custom-contact-forms',
'url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('ccf-ajax-nonce'));
wp_enqueue_script('jquery');
wp_deregister_script('jquery-form');
wp_register_script('jquery-form', plugins_url() . '/custom-contact-forms/js/jquery.form.js', $js_version);
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-dialog');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-tools', plugins_url() . '/custom-contact-forms/js/jquery.tools.min.js');
wp_enqueue_script('jquery-ui-widget', plugins_url() . '/custom-contact-forms/js/jquery.ui.widget.js');
//wp_enqueue_script('jquery-ui-dialog', plugins_url() . '/custom-contact-forms/js/jquery.ui.dialog.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'));
//wp_enqueue_script('ccf-pagination', plugins_url() . '/custom-contact-forms/js/jquery.pagination.js');
wp_enqueue_script('ccf-admin-inc', plugins_url() . '/custom-contact-forms/js/custom-contact-forms-admin-inc.js', $js_version);
wp_enqueue_script('ccf-admin', plugins_url() . '/custom-contact-forms/js/custom-contact-forms-admin.js', $js_version);
if ($admin_options['admin_ajax'] == 1) {
wp_enqueue_script('ccf-admin-ajax', plugins_url() . '/custom-contact-forms/js/custom-contact-forms-admin-ajax.js', array('jquery-form'), $js_version);
wp_localize_script('ccf-admin-ajax', 'ccfLang', $js_lang);
wp_localize_script('ccf-admin-ajax', 'ccfAjax', $js_ajax);
}
/*wp_enqueue_script('ccf-colorpicker', plugins_url() . '/custom-contact-forms/js/colorpicker.js');
wp_enqueue_script('ccf-eye', plugins_url() . '/custom-contact-forms/js/eye.js');
wp_enqueue_script('ccf-utils', plugins_url() . '/custom-contact-forms/js/utils.js');
wp_enqueue_script('ccf-layout', plugins_url() . '/custom-contact-forms/js/layout.js?ver=1.0.2');*/
wp_localize_script('ccf-admin-inc', 'ccfLang', $js_lang);
wp_localize_script('ccf-admin-inc', 'ccfAjax', $js_ajax);
wp_localize_script('ccf-admin', 'ccfLang', $js_lang);
}
function handleAdminPostRequests() {
//print_r($_POST);
//print_r(unserialize(stripslashes($_POST[attached_array])));
$out = array('success' => true);
if (isset($_POST['object_create'])) {
if ($_POST['object_type'] == 'form') {
if (parent::insertForm($_POST['object']) != false)
$this->action_complete = __('A new form was successfully created!', 'custom-contact-forms');
} elseif ($_POST['object_type'] == 'field') {
if (parent::insertField($_POST['object']) != false)
$this->action_complete = __('A new field was successful created!', 'custom-contact-forms');
} elseif ($_POST['object_type'] == 'field_option') {
if (parent::insertFieldOption($_POST['object']) != false)
$this->action_complete = __('A new field option was successful created!', 'custom-contact-forms');
} elseif ($_POST['object_type'] == 'style') {
if (parent::insertStyle($_POST['object']) != false)
$this->action_complete = __('A new style was successful created!', 'custom-contact-forms');
}
return $out;
}
if (isset($_POST['attached_save'])) {
if ($_POST['object_type'] == 'form') {
parent::updateForm(array('form_fields' => unserialize(stripslashes($_POST[attached_array]))), $_POST['object_id']);
} elseif ($_POST['object_type'] == 'field') {
parent::updateField(array('field_options' => unserialize(stripslashes($_POST[attached_array]))), $_POST['object_id']);
}
return $out;
}
if (isset($_POST['object_bulk_apply'])) {
$out['object_bulk_action'] = $_POST['object_bulk_action'];
if ($_POST['object_bulk_action'] == 'edit') {
foreach ($_POST['objects'] as $obj) {
if (isset($obj['object_do']) && $obj['object_do'] == 1) {
if ($obj['object_type'] == 'form') {
parent::updateForm($obj['values'], $obj['object_id']);
} elseif ($obj['object_type'] == 'field') {
parent::updateField($obj['values'], $obj['object_id']);
} elseif ($obj['object_type'] == 'field_option') parent::updateFieldOption($obj['values'], $obj['object_id']);
elseif ($obj['object_type'] == 'style') parent::updateStyle($obj['values'], $obj['object_id']);
$out['objects'][] = $obj;
}
}
}
elseif ($_POST['object_bulk_action'] == 'delete') {
foreach ($_POST['objects'] as $obj) {
if (isset($obj['object_do']) && $obj['object_do'] == 1) {
if ($obj['object_type'] == 'form') parent::deleteForm($obj['object_id']);
elseif ($obj['object_type'] == 'field') parent::deleteField($obj['object_id']);
elseif ($obj['object_type'] == 'field_option') parent::deleteFieldOption($obj['object_id']);
elseif ($obj['object_type'] == 'style') parent::deleteStyle($obj['object_id']);
elseif ($obj['object_type'] == 'form_submission') {
parent::deleteUserData($obj['object_id']);
}
$out['objects'][] = $obj;
}
}
}
}
return $out;
}
function rateMeForm() {
?>
<form class="rate-me" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="TXYVDCH955V28">
<a href="http://wordpress.org/extend/plugins/custom-contact-forms" title="<?php _e("Rate This Plugin", 'custom-contact-forms'); ?>">
<?php _e("We need your help to continue development! Please <span>rate this plugin</span> to show your support.", 'custom-contact-forms'); ?></a>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="Donate to Custom Contact Forms plugin" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<?php
}
function printAdminPage() {
$admin_options = parent::getAdminOptions();
if ($admin_options['show_install_popover'] == 1) {
$admin_options['show_install_popover'] = 0;
?>
<script type="text/javascript" language="javascript">
$j(document).ready(function() {
$j("#ccf-usage-popover").dialog('open');
});
</script>
<?php
update_option(parent::getAdminOptionsName(), $admin_options);
}
$this->handleAdminPostRequests();
if (isset($_POST['insert_default_content'])) {
ccf_utils::load_module('db/custom-contact-forms-default-db.php');
$this->action_complete = __('Default content has been inserted!', 'custom-contact-forms');
new CustomContactFormsDefaultDB();
} elseif (isset($_POST['contact_author'])) {
$this->action_complete = __('Your message has been sent!', 'custom-contact-forms');
$this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME'];
$this->contactAuthor($_POST['name'], $_POST['email'], $this_url, $_POST['message'], $_POST['type'], $_POST['host'], $_POST['ccf-version'], $_POST['wp-version']);
} elseif (isset($_GET['clear_tables']) && $_GET['clear_tables'] == 1) {
parent::emptyAllTables();
}
$styles = parent::selectAllStyles();
$style_options = '<option value="0">Default</option>';
foreach ($styles as $style)
$style_options .= '<option value="'.$style->id.'">'.$style->style_slug.'</option>';
?>
<div id="customcontactforms-admin">
<div class="plugin-header">
<h2>
<?php _e("Custom Contact Forms", 'custom-contact-forms'); ?>
</h2>
<div class="links">
<a href="javascript:void(0)" class="quick-start-button">Quick Start Guide</a> - <a href="javascript:void(0)" class="usage-popover-button">Plugin Usage Manual</a>
</div>
</div>
<div id="ccf-tabs">
<ul id="plugin-nav">
<li><a href="#forms"><?php _e("Forms", 'custom-contact-forms'); ?></a></li>
<li><a href="#fields"><?php _e("Fields", 'custom-contact-forms'); ?></a></li>
<li><a href="#field-options"><?php _e("Field Options", 'custom-contact-forms'); ?></a></li>
<li><a href="#styles"><?php _e("Styles", 'custom-contact-forms'); ?></a></li>
<li><a href="#support"><?php _e("Support", 'custom-contact-forms'); ?></a></li>
<li><a href="#advanced"><?php _e("Advanced", 'custom-contact-forms'); ?></a></li>
<li><a href="#news"><?php _e("News", 'custom-contact-forms'); ?></a></li>
</ul>
<a class="gravity" href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=125082">Are you looking for a more customizable, reliable, and secure contact form solution for WordPress? Try <span>Gravity Forms</span>.</a>
<a class="genesis" href="http://www.shareasale.com/r.cfm?b=241369&u=481196&m=28169&urllink=&afftrack="><?php _e('Custom Contact Forms works best with any of the 20+ ', 'custom-contact-forms'); ?><span><?php _e('Genesis', 'custom-contact-forms'); ?></span> <?php _e('Wordpress child themes. The', 'custom-contact-forms'); ?> <span><?php _e('Genesis Framework', 'custom-contact-forms'); ?></span> <?php _e('empowers you to quickly and easily build incredible websites with WordPress.', 'custom-contact-forms'); ?></a>
<form class="blog-horizontal-form" method="post" action="http://www.aweber.com/scripts/addlead.pl">
<input type="hidden" name="meta_web_form_id" value="1578604781" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="ccf-plugin" />
<input type="hidden" name="redirect" value="http://www.taylorlovett.com/wordpress-plugins/tutorials-offers-tips/" id="redirect_5832e41084448adb07da67a35dc83c27" />
<input type="hidden" name="meta_adtracking" value="CCF_-_Wordpress_Plugins_Horizontal" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />
<span><?php _e('WP Blogging Tips, Downloads, SEO Tricks & Exclusive Tutorials', 'custom-contact-forms'); ?></span>
<input type="text" name="name" value="Your Name" onclick="value=''" />
<input type="text" name="email" value="Your Email" onclick="value=''" />
<input type="submit" value="Sign Up for Free" />
</form>
<?php if (!empty($this->action_complete)) { ?>
<div id="message" class="updated below-h2">
<p><?php echo esc_html($this->action_complete); ?></p>
</div>
<?php } ?>
<div id="forms">
<div id="create-forms" class="postbox">
<h3 class="hndle"><span>
<?php _e("Create A Form", 'custom-contact-forms'); ?>
</span></h3>
<div class="inside">
<form id="ccf-create-form" method="post" action="<?php menu_page_url("custom-contact-forms", 1); ?>">
<input value="forms" name="selected_tab" type="hidden" />
<ul class="left">
<li>
<label for="object[form_slug]">*
<?php _e("Form Slug:", 'custom-contact-forms'); ?>
</label>
<input type="text" class="ccf-width250" maxlength="100" name="object[form_slug]" />
<br />
<?php _e("This is just a unique way for CCF to refer to your form. Must be unique from other slugs and contain only underscores and alphanumeric characters.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_title]">
<?php _e("Form Title:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" maxlength="200" name="object[form_title]" />
<?php _e("This text is displayed above the form as the heading.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_action]">
<?php _e("Form Style:", 'custom-contact-forms'); ?>
</label>
<select name="object[form_style]" class="form_style_input">
<?php echo $style_options; ?>
</select></li>
<li>
<label for="object[submit_button_text]">
<?php _e("Submit Button Text:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" maxlength="200" name="object[submit_button_text]" />
</li>
<li>
<label for="object[form_email]">
<?php _e("Form Destination Email:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_email]" />
<br />
<?php _e("Will receive all submissions from this form; if left blank it will use the default specified in general settings. You can have form submissions sent to multiple emails by separating them with semicolons.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_email_subject]">
<?php _e("Form Email Subject:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_email_subject]" />
<br />
<?php _e("When submitted and configured accordingly, the form will send an email with this subject.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_email_name]">
<?php _e("Form Email Name:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_email_name]" />
<br />
<?php _e("When submitted and configured accordingly, the form will send an email with this as the email 'from name'.", 'custom-contact-forms'); ?>
</li>
</ul>
<ul class="right">
<li>
<label for="object[form_success_message]">
<?php _e("Form Success Message:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_success_message]" />
<br />
<?php _e("Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_success_title]">
<?php _e("Form Success Message Title:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_success_title]" />
<br />
<?php _e("Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="object[form_thank_you_page]">
<?php _e("Custom Success URL:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" type="text" name="object[form_thank_you_page]" />
<br />
<?php _e("If this is filled out, users will be sent to this page when they successfully fill out this form. If it is left blank, a popover showing the form's 'success message' will be displayed on form success.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="form_access"><?php _e('Who Can View This Form:', ''); ?></label>
<?php
$roles = parent::getRolesArray();
$i = 0;
foreach ($roles as $role) {
if ($i == 3) echo '<br />';
?>
<div class="role">
<input type="checkbox" checked="checked" name="object[form_access][]" value="<?php echo esc_attr($role); ?>" />
<?php echo esc_html($role); ?>
</div>
<?php
$i++;
}
?><br />
<?php _e('Choose which types of users should be able to view this form.', 'custom-contact-forms'); ?>
</li>
<li>
<input type="hidden" name="object_type" value="form" />
<input type="submit" class="create-button" value="<?php _e("Create Form", 'custom-contact-forms'); ?>" name="object_create" />
</li>
<li class="attach"><span class="ccf-red">*</span> <?php _e('You should go to the form manager to attach fields to this form after you create it.', 'custom-contact-forms'); ?></li>
</ul>
</form>
<div class="ccf-clear"></div>
</div>
</div>
<h3 class="manage-h3">
<?php _e("Manage Forms", 'custom-contact-forms'); ?>
</h3>
<form class="ccf-edit-ajax" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
<input type="hidden" name="selected_tab" value="forms" />
<table class="widefat post" id="manage-forms" cellspacing="0">
<thead>
<tr>
<th scope="col" class="manage-column check-col"><input type="checkbox" class="checkall" /></th>
<th scope="col" class="manage-column form-code"><?php _e("Form Display Code", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-slug"><?php _e("Theme Display Code", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-slug"><?php _e("Slug", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-title"><?php _e("Title", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-style"><?php _e("Style", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-expand"></th>
</tr>
</thead>
<tbody>
<?php
$forms = parent::selectAllForms();
for ($i = 0; $i < count($forms); $i++) {
$form_methods = '<option>Post</option><option>Get</option>';
$form_methods = str_replace('<option>'.$forms[$i]->form_method.'</option>', '<option selected="selected">'.$forms[$i]->form_method.'</option>', $form_methods);
$add_fields = $this->getFieldsForm(true);
$this_style = parent::selectStyle($forms[$i]->form_style, '');
if ($this_style != NULL)
$sty_opt = str_replace('<option value="'.$forms[$i]->form_style.'">'.$this_style->style_slug.'</option>', '<option value="'.$forms[$i]->form_style.'" selected="selected">'.$this_style->style_slug.'</option>', $style_options);
else
$sty_opt = $style_options;
?>
<tr class="row-form-<?php echo esc_attr($forms[$i]->id); ?> <?php if ($i % 2 == 0) echo 'ccf-evenrow'; ?>">
<td><input type="checkbox" class="object-check" value="1" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][object_do]" /></td>
<td><input type="text" class="ccf-width175" value="[customcontact form=<?php echo esc_attr($forms[$i]->id); ?>]" name="post_code_<?php echo esc_attr($forms[$i]->id); ?>" /></td>
<td><input type="text" class="ccf-width125" value="<?php if (function_exists('serveCustomContactForm')) { serveCustomContactForm(<?php echo esc_attr($forms[$i]->id); ?>); } ?>" name="theme_code_<?php echo esc_attr($forms[$i]->id); ?>" /></td>
<td><input type="text" class="ccf-width175" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_slug]" value="<?php echo esc_attr($forms[$i]->form_slug); ?>" /></td>
<td><input type="text" class="ccf-width175" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_title]" value="<?php echo esc_attr($forms[$i]->form_title); ?>" /></td>
<td><select name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_style]" class="form_style_input">
<?php echo $sty_opt; ?>
</select></td>
<td><input class="object-id" type="hidden" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][object_id]" value="<?php echo esc_attr($forms[$i]->id); ?>" />
<input type="hidden" class="object-type" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][object_type]" value="form" />
<input type="button" class="single-save" value="<?php _e('Save', 'custom-contact-forms'); ?>" />
<input type="button" class="single-delete" value="<?php _e('Delete', 'custom-contact-forms'); ?>" />
<input type="button" class="form-options-expand-link" value="<?php _e('Options', 'custom-contact-forms'); ?>" />
<div class="loading-img-container"><img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="ccf-hide loading-img-inner-form-<?php echo esc_attr($forms[$i]->id); ?>" /></div>
</td>
</tr>
<tr class="row-form-<?php echo esc_attr($forms[$i]->id); ?> <?php if ($i % 2 == 0) echo 'ccf-evenrow'; ?>">
<td class="form-extra-options ccf-center ccf-hide" colspan="8">
<div class="left">
<span>Email</span>
<ul>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("Form submissions will be emailed to this address.", 'custom-contact-forms'); ?>">(?)</a> Destination Email:</label> <input type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_email]" class="ccf-width250" value="<?php echo esc_attr($forms[$i]->form_email); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This is the form email subject sent to the destination email address. If left blank, the default from General Settings will be used.", 'custom-contact-forms'); ?>">(?)</a> Email Subject:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_email_subject]" maxlength="250" value="<?php echo esc_attr($forms[$i]->form_email_subject); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This is the from name of the email sent on successful form submission. If left blank, the default from General Settings will be used.", 'custom-contact-forms'); ?>">(?)</a> Email From Name:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_email_name]" maxlength="100" value="<?php echo esc_attr($forms[$i]->form_email_name); ?>" /></li>
</ul>
<span>Advanced</span>
<ul>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("The Form Method is the method by which information is transfer through your form. If you aren't an expert with HTML and PHP, leave this as Post.", 'custom-contact-forms'); ?>">(?)</a> Method:</label> <select name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_method]">
<?php echo $form_methods; ?>
</select></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This lets you process your forms through alternate scripts. If you use a service like InfusionSoft or Aweber, set this to be the same form action as the code provided to you by that service, otherwise leave this blank.", 'custom-contact-forms'); ?>">(?)</a> Form Action:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_action]" value="<?php echo esc_attr($forms[$i]->form_action); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("Insert the page id's that your form will be used on. This will make it so the plugin will only load JS and CSS files on these select pages. This will improve your site's load time.", 'custom-contact-forms'); ?>">(?)</a> Form Pages:</label> <input class="ccf-width250" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_pages]" type="text" value="<?php echo esc_attr($forms[$i]->form_pages); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("If you want to show this form to only certain types of users, you can uncheck boxes accordingly. To show this form to anyone, check all the boxes. This will only take effect if 'Form Access Capabilities' is enabled in general settings.", 'custom-contact-forms'); ?>">(?)</a> Form Access:</label>
<ul><?php
$roles = parent::getRolesArray();
$access_array = parent::getFormAccessArray($forms[$i]->form_access);
foreach ($roles as $role) {
?>
<li><input type="checkbox" <?php if (parent::formHasRole($access_array, $role)) { echo 'checked="checked"'; } ?> name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_access][]" value="<?php echo esc_attr($role); ?>" />
<?php echo esc_html($role); ?>
</li>
<?php
}
?></ul><input name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_access_update]" type="hidden" value="1" />
</li>
<li></li>
</ul>
</div>
<div class="right">
<span>Successful Submission</span>
<ul>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("If this is filled out, users will be sent to this thank you page when they successfully fill out this form. If it is left blank, a popover showing the form's 'success message' will be displayed on form success.", 'custom-contact-forms'); ?>">(?)</a> Custom Success URL:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_thank_you_page]" value="<?php echo esc_attr($forms[$i]->form_thank_you_page); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This will be displayed as the header in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.", 'custom-contact-forms'); ?>">(?)</a> Success Message Title:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_success_title]" value="<?php echo esc_attr($forms[$i]->form_success_title); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.", 'custom-contact-forms'); ?>">(?)</a> Success Message:</label> <textarea name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][form_success_message]"><?php echo esc_attr($forms[$i]->form_success_message); ?></textarea></li>
</ul>
<span>Customization</span>
<ul>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This text will display on the form submit button.", 'custom-contact-forms'); ?>">(?)</a> Button Text:</label> <input class="ccf-width250" type="text" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][submit_button_text]" value="<?php echo esc_attr($forms[$i]->submit_button_text); ?>" /></li>
<li><label><a href="javascript:void(0)" class="toollink" title="<?php _e("This field allows you to insert HTML directly after the starting <form> tag.", 'custom-contact-forms'); ?>">(?)</a> Custom Code:</label> <textarea name="objects[<?php echo esc_attr($forms[$i]->id); ?>][values][custom_code]"><?php echo esc_attr($forms[$i]->custom_code); ?></textarea></li>
</ul>
</div>
<div class="ccf-clear"></div>
<div class="fattach">
<div class="attach">
<p><label><span>
<?php _e("Add A Field:", 'custom-contact-forms'); ?>
</span></label></p>
<select class="onObject<?php echo esc_attr($forms[$i]->id); ?> attach-object field-dropdown objectTypeForm" name="objects[<?php echo esc_attr($forms[$i]->id); ?>][attach]">
<?php echo $add_fields; ?>
</select> <input class="attach-button" type="button" value="<?php _e('Attach', 'custom-contact-forms'); ?>" />
<p>
<span class="ccf-red ccf-bold">*</span>
<?php _e("Attach fixed fields or ones you", 'custom-contact-forms'); ?>
<a href="#create-fields">
<?php _e("create", 'custom-contact-forms'); ?>
</a>. </p></div>
<div class="attached">
<p><span>
<?php _e("Attached Fields:", 'custom-contact-forms'); ?>
</span></p>
<?php
$attached_fields = parent::getAttachedFieldsArray($forms[$i]->id);
echo '<ul class="onObject' . esc_attr($forms[$i]->id) . ' sortable field-list ccfsort" id="' . esc_attr($form->form_slug) . '">';
foreach($attached_fields as $attached_field) {
$this_field = parent::selectField($attached_field, '');
?>
<li class="field<?php echo esc_attr($this_field->id); ?> ui-state-default"><span>×</span> <?php
echo esc_html($this_field->field_slug);?> (<?php echo esc_html($this_field->field_type);?>)</li>
<?php
}
echo '</ul>';
?>
<input class="attached-update-button" type="button" value="<?php _e('Save Field Configuration', 'custom-contact-forms'); ?>" />
<img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="ccf-hide loading-img-field-config-form-<?php echo esc_attr($forms[$i]->id); ?>" />
</div>
<div class="ccf-clear"></div>
</div>
</td>
</tr>
<?php
}
$remember_check = ($admin_options['remember_field_values'] == 0) ? 'selected="selected"' : '';
$remember_fields = '<option value="1">'.__('Yes', 'custom-contact-forms').'</option><option '.$remember_check.' value="0">'.__('No', 'custom-contact-forms').'</option>';
$border_style_options = '<option>solid</option><option>dashed</option>
<option>grooved</option><option>double</option><option>dotted</option><option>ridged</option><option>none</option>
<option>inset</option><option>outset</option>';
?>
</tbody>
<tfoot>
<tr>
<th scope="col" class="manage-column check-col"><input type="checkbox" class="checkall" /></th>
<th scope="col" class="manage-column form-code"><?php _e("Form Display Code", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-slug"><?php _e("Theme Display Code", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-slug"><?php _e("Slug", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-title"><?php _e("Title", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-style"><?php _e("Style", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column form-expand"></th>
</tr>
</tfoot>
</table>
<select class="bulk-dropdown" name="object_bulk_action">
<option value="0"><?php _e('Bulk Actions', 'custom-contact-forms'); ?></option>
<option value="edit"><?php _e('Save', 'custom-contact-forms'); ?></option>
<option value="delete"><?php _e('Delete', 'custom-contact-forms'); ?></option></select>
<input type="submit" name="object_bulk_apply" class="bulk-apply" value="<?php _e('Apply', 'custom-contact-forms'); ?>" /> <img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="loading-img" />
</form>
</div>
<div id="fields">
<div id="create-fields" class="postbox">
<h3 class="hndle"><span>
<?php _e("Create A Form Field", 'custom-contact-forms'); ?>
</span></h3>
<div class="inside">
<form id="ccf-create-field" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
<input type="hidden" name="selected_tab" value="fields" />
<ul class="left">
<li>
<label for="field_slug">*
<?php _e("Field Slug:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_slug]" type="text" maxlength="40" />
<br />
<?php _e("This is just a unique way for CCF to refer to your field. Must be unique from other slugs and contain only underscores and alphanumeric characters.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_label">
<?php _e("Field Label:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_label]" type="text" maxlength="100" />
<br />
<?php _e("The field label is displayed next to the field and is visible to the user.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_type">*
<?php _e("Field Type:", 'custom-contact-forms'); ?>
</label>
<select name="object[field_type]" class="field-type-selector">
<option>Text</option>
<option>Date</option>
<option>File</option>
<option>Textarea</option>
<option>Hidden</option>
<option>Checkbox</option>
<option>Radio</option>
<option>Dropdown</option>
</select>
</li>
<li>
<label for="field_value">
<?php _e("Initial Value:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_value]" type="text" maxlength="50" />
<br />
<?php _e("This is the initial value of the field. If you set the type as checkbox, it is recommend you set this to what the checkbox is implying. For example if I were creating the checkbox
'Are you human?', I would set the initial value to 'Yes'.", 'custom-contact-forms'); ?>
<?php _e("If you set the field type as 'Dropdown' or 'Radio', you should enter the slug of the", 'custom-contact-forms'); ?>
<a href="#manage-field-options" title="<?php _e("Create a Field Option", 'custom-contact-forms'); ?>"><?php _e("field option", 'custom-contact-forms'); ?></a>
<?php _e("you would like initially selected.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_maxlength">
<?php _e("Max Length:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" size="10" name="object[field_maxlength]" type="text" maxlength="4" />
<br />
<?php _e("0 for no limit; only applies to Text fields", 'custom-contact-forms'); ?>
</li>
</ul>
<ul class="right">
<li>
<label for="field_required">*
<?php _e("Required Field:", 'custom-contact-forms'); ?>
</label>
<select name="object[field_required]">
<option value="0">
<?php _e("No", 'custom-contact-forms'); ?>
</option>
<option value="1">
<?php _e("Yes", 'custom-contact-forms'); ?>
</option>
</select>
<br />
<?php _e("If a field is required and a user leaves it blank, the plugin will display an error message (which you can customize using 'Field Error') explaining the problem.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_instructions">
<?php _e("Field Instructions:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_instructions]" type="text" />
<br />
<?php _e("If this is filled out, a tooltip popover displaying this text will show when the field is selected.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_class">
<?php _e("Field Class:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_class]" type="text" />
<br />
<?php _e("If you manage your own .css stylesheet, you can use this to attach a class to this field. Leaving this blank will do nothing.", 'custom-contact-forms'); ?>
</li>
<li>
<label for="field_error">
<?php _e("Field Error:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_error]" type="text" />
<br />
<?php _e("If a user leaves this field blank and the field is required, this error message will be shown. A generic default will show if left blank.", 'custom-contact-forms'); ?>
</li>
<li class="file-fields">
<label for="field_max_upload_size">
<?php _e("Max File Size Allowed:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_max_upload_size]" value="5000" type="text" /> <?php _e('KB', 'custom-contact-forms'); ?>
<br />
<?php _e("If a user tries to upload a file larger than the max upload size, an error message will be displayed.", 'custom-contact-forms'); ?>
</li>
<li class="file-fields">
<label for="field_allowed_file_extensions">
<?php _e("Allowed File Extensions for Upload:", 'custom-contact-forms'); ?>
</label>
<input class="ccf-width250" name="object[field_allowed_file_extensions]" type="text" />
<br />
<?php _e("If a user tries to upload a file with an extension not in this list, an error will be shown. Separate file extensions with a comma. Ex: doc, jpg, jpeg, txt. If left blank, all extensions will be allowed.", 'custom-contact-forms'); ?>
</li>
<li>
<input type="hidden" name="object[user_field]" value="1" />
<input type="hidden" name="object_type" value="field" />
<input type="submit" value="<?php _e("Create Field", 'custom-contact-forms'); ?>" name="object_create" class="create-button" />
</li>
<li class="attach"><span class="ccf-red">*</span> <?php _e('If this is a dropdown or radio field, you should go to the field manager below to attach field options after you create it.', 'custom-contact-forms'); ?></li>
</ul>
</form>
<div class="ccf-clear"></div>
</div>
</div>
<h3 class="manage-h3">
<?php _e("Manage User Fields", 'custom-contact-forms'); ?>
</h3>
<form class="ccf-edit-ajax" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
<input type="hidden" name="selected_tab" value="fields" />
<table class="widefat post" id="manage-fields" cellspacing="0">
<thead>
<tr>
<th scope="col" class="manage-column check-col"><input type="checkbox" class="checkall" /></th>
<th scope="col" class="manage-column field-slug"><?php _e("Slug", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-label"><?php _e("Label", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-type"><?php _e("Type", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-value"><?php _e("Initial Value", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-required"><?php _e("Required", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-expand"></th>
</tr>
</thead>
<tbody>
<?php
$fields = parent::selectAllFields();
for ($i = 0, $z = 0; $i < count($fields); $i++, $z++) {
if ($fields[$i]->user_field == 0) { $z--; continue; }
$attached_options = parent::getAttachedFieldOptionsArray($fields[$i]->id);
$field_types = '<option>Text</option><option>Date</option><option>File</option><option>Textarea</option><option>Hidden</option><option>Checkbox</option><option>Radio</option><option>Dropdown</option>';
$field_types = str_replace('<option>'.$fields[$i]->field_type.'</option>', '<option selected="selected">'.$fields[$i]->field_type.'</option>', $field_types);
?>
<tr class="row-field-<?php echo esc_attr($fields[$i]->id); ?> <?php if ($z % 2 == 1) echo ' ccf-evenrow'; ?>">
<td><input class="object-check" type="checkbox" value="1" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][object_do]" /></td>
<td><input type="text" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_slug]" class="ccf-width125" maxlength="50" value="<?php echo esc_attr($fields[$i]->field_slug); ?>" /></td>
<td><input type="text" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_label]" class="ccf-width200" maxlength="100" value="<?php echo esc_attr($fields[$i]->field_label); ?>" /></td>
<td><select name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_type]">
<?php echo $field_types; ?>
</select></td>
<td><input type="text" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_value]" maxlength="50" class="ccf-width100" value="<?php echo esc_attr($fields[$i]->field_value); ?>" /></td>
<td><select name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_required]">
<option value="1">
<?php _e("Yes", 'custom-contact-forms'); ?>
</option>
<option value="0" <?php if ($fields[$i]->field_required != 1) echo 'selected="selected"'; ?>>
<?php _e("No", 'custom-contact-forms'); ?>
</option>
</select></td>
<td><input type="hidden" class="object-type" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][object_type]" value="field" />
<input type="hidden" class="object-id" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][object_id]" value="<?php echo esc_attr($fields[$i]->id); ?>" />
<input type="button" class="single-save" value="<?php _e('Save', 'custom-contact-forms'); ?>" />
<input type="button" class="single-delete" value="<?php _e('Delete', 'custom-contact-forms'); ?>" />
<input type="button" class="fields-options-expand-link" value="<?php _e('Options', 'custom-contact-forms'); ?>">
<div class="loading-img-container"><img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="ccf-hide loading-img-inner-field-<?php echo esc_attr($fields[$i]->id); ?>" /></div>
</td>
</tr>
<?php $show_field_options = ($fields[$i]->field_type == 'Radio' || $fields[$i]->field_type == 'Dropdown' || $fields[$i]->field_type == 'Checkbox') ? true : false; ?>
<tr class="row-field-<?php echo esc_attr($fields[$i]->id); ?> <?php if ($z % 2 == 1) echo 'ccf-evenrow'; ?>">
<td class="fields-extra-options ccf-hide" colspan="8">
<div class="one">
<label for="field_instructions">
<a href="javascript:void(0)" class="toollink" title="<?php _e('If this is filled out, a tooltip popover displaying this text will show when the field is selected.', 'custom-contact-forms'); ?>">(?)</a>
<?php _e("Field Instructions:", 'custom-contact-forms'); ?>
</label>
<textarea class="ccf-width250" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_instructions]"><?php echo esc_attr($fields[$i]->field_instructions); ?></textarea>
</div>
<div class="two">
<label for="field_error">
<a href="javascript:void(0)" class="toollink" title="<?php _e('This lets you customize the error message displayed when this field is required and left blank.', 'custom-contact-forms'); ?>">(?)</a>
<?php _e("Field Error:", 'custom-contact-forms'); ?>
</label>
<textarea class="ccf-width250" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_error]"><?php echo esc_attr($fields[$i]->field_error); ?></textarea>
</div>
<div class="three">
<label for="field_class">
<a href="javascript:void(0)" class="toollink" title="<?php _e('If you manage a .CSS file for your theme, you could create a class in that file and add it to this field. If the form attaching this field is using a "Form Style" other than the default, styles inherited from the "Field Class" might be overwritten.', 'custom-contact-forms'); ?>">(?)</a>
<?php _e("Field Class:", 'custom-contact-forms'); ?>
</label>
<input type="text" class="ccf-width75" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_class]" value="<?php echo esc_attr($fields[$i]->field_class); ?>" />
<br />
<?php if ($fields[$i]->field_type != 'Dropdown' && $fields[$i]->field_type != 'Radio' && $fields[$i]->field_type != 'Checkbox') { ?>
<label for="field_maxlength"><a href="javascript:void(0)" class="toollink" title="<?php _e('Max length allows you to set a cap on the amount of characters a user can submit.', 'custom-contact-forms'); ?>">(?)</a>
<?php _e('Max Length:', 'custom-contact-forms'); ?>
</label>
<input type="text" class="ccf-width75" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_maxlength]" value="<?php echo esc_attr($fields[$i]->field_maxlength); ?>" />
<br />
<?php } ?>
<?php if ($fields[$i]->field_type == 'File') { ?>
<label for="field_max_upload_size"><a href="javascript:void(0)" class="toollink" title="<?php _e('If a user tries to upload a file greater than the value in this field, an error will be shown. Upload size is in KB. If this is left blank or set to 0, then there will be no maximum file size for this field.', 'custom-contact-forms'); ?>">(?)</a>
<?php _e("Max Upload Size:", 'custom-contact-forms'); ?></label>
<input type="text" class="ccf-width75" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_max_upload_size]" value="<?php echo esc_attr($fields[$i]->field_max_upload_size); ?>" /><?php _e('KB', 'custom-contact-forms'); ?>
<br />
<label for="field_allowed_file_extensions"><a href="javascript:void(0)" class="toollink" title="<?php _e('If a user tries to upload a file with an extension not in this list, an error will be shown. If this is left blank, then all file extensions will be accepted. Separate file extensions with a comma. Ex: doc, jpg, jpeg, bmp, gif, txt', 'custom-contact-forms'); ?>">(?)</a>
<?php _e("Allowed File Extensions:", 'custom-contact-forms'); ?></label>
<input type="text" class="ccf-width75" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_allowed_file_extensions]" value="<?php $exts = unserialize($fields[$i]->field_allowed_file_extensions); echo (!empty($exts)) ? esc_attr(@implode(', ', $exts)) : ''; ?>" />
<?php } ?>
</div>
<?php
if ($show_field_options) { ?>
<div class="ccf-clear"></div>
<div class="fattach">
<div class="attach">
<p><label><span>
<?php _e("Add A Field Option:", 'custom-contact-forms'); ?>
</span></label></p>
<select class="onObject<?php echo esc_attr($fields[$i]->id); ?> attach-object field-option-dropdown objectTypeField" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][attach]">
<?php
$options = parent::selectAllFieldOptions();
foreach ($options as $option) {
?>
<option value="<?php echo esc_attr($option->id); ?>"><?php echo esc_attr($option->option_slug); ?></option>
<?php
}
?>
</select> <input class="attach-button" type="button" value="<?php _e('Attach', 'custom-contact-forms'); ?>" />
<p>
<span class="ccf-red ccf-bold">*</span>
<?php _e("Attach field options you ", 'custom-contact-forms'); ?>
<a href="#field-options">
<?php _e("create", 'custom-contact-forms'); ?>
</a>. </p></div>
<div class="attached">
<p><span>
<?php _e("Attached Field Options:", 'custom-contact-forms'); ?>
</span></p>
<?php
$attached_options = parent::getAttachedFieldOptionsArray($fields[$i]->id);
echo '<ul class="onObject'.esc_attr($fields[$i]->id).' sortable field-option-list ccfsort" id="'.esc_attr($field->field_slug) . '">';
foreach($attached_options as $attached_option) {
$this_option = parent::selectFieldOption($attached_option, '');
?>
<li class="field<?php echo esc_attr($this_option->id); ?> ui-state-default"><span>×</span> <?php
echo esc_html($this_option->option_slug);?></li>
<?php
}
echo '</ul>';
?>
<input class="attached-update-button" type="button" value="<?php _e('Save Option Configuration', 'custom-contact-forms'); ?>" />
<img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="ccf-hide loading-img-field-config-field-<?php echo esc_attr($fields[$i]->id); ?>" />
</div></div>
<div class="ccf-clear"></div>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th scope="col" class="manage-column check-col"><input type="checkbox" class="checkall" /></th>
<th scope="col" class="manage-column field-slug"><?php _e("Slug", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-label"><?php _e("Label", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-type"><?php _e("Type", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-value"><?php _e("Initial Value", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-required"><?php _e("Required", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-expand"></th>
</tr>
</tfoot>
</table>
<select class="bulk-dropdown" name="object_bulk_action">
<option value="0"><?php _e('Bulk Actions', 'custom-contact-forms'); ?></option>
<option value="edit"><?php _e('Save', 'custom-contact-forms'); ?></option>
<option value="delete"><?php _e('Delete', 'custom-contact-forms'); ?></option>
</select> <input type="submit" name="object_bulk_apply" class="bulk-apply" value="<?php _e('Apply', 'custom-contact-forms'); ?>" /> <img src="<?php echo plugins_url(); ?>/custom-contact-forms/images/wpspin_light.gif" width="16" height="16" class="loading-img" />
</form>
<h3 class="manage-h3">
<?php _e("Manage Fixed Fields", 'custom-contact-forms'); ?>
</h3>
<form class="ccf-edit-ajax" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
<input type="hidden" name="selected_tab" value="fields" />
<table class="widefat post" id="manage-fixed-fields" cellspacing="0">
<thead>
<tr>
<th scope="col" class="manage-column check-col"><input type="checkbox" class="checkall" /></th>
<th scope="col" class="manage-column field-slug"><?php _e("Slug", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-label"><?php _e("Label", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-type"><?php _e("Type", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-value"><?php _e("Initial Value", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-value"><?php _e("Required", 'custom-contact-forms'); ?></th>
<th scope="col" class="manage-column field-expand"></th>
</tr>
</thead>
<tbody>
<?php
$fields = parent::selectAllFields();
for ($i = 0, $z = 0; $i < count($fields); $i++, $z++) {
if ($fields[$i]->user_field == 1) { $z--; continue;}
$field_types = '<option>Text</option><option>Textarea</option><option>Hidden</option><option>Checkbox</option>';
$field_types = str_replace('<option>'.$fields[$i]->field_type.'</option>', '<option selected="selected">'.$fields[$i]->field_type.'</option>', $field_types);
?>
<tr class="row-field-<?php echo esc_attr($fields[$i]->id); ?> <?php if ($z % 2 == 0) echo 'ccf-evenrow'; ?>">
<td><input class="object-check" type="checkbox" value="1" name="objects[<?php echo esc_attr($fields[$i]->id ); ?>][object_do]" /></td>
<td><?php echo esc_attr($fields[$i]->field_slug); ?></td>
<td><?php if ($fields[$i]->field_slug == 'resetButton') { _e('None', 'custom-contact-forms'); } else { ?>
<input type="text" name="objects[<?php echo esc_attr($fields[$i]->id); ?>][values][field_label]" maxlength="100" value="<?php echo esc_attr($fields[$i]->field_label); ?>" />
<?php } ?></td>