This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
easyReservations_admin_settings.php
1560 lines (1505 loc) · 98.6 KB
/
easyReservations_admin_settings.php
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
function reservation_settings_page(){
do_action('easy-header');
global $wpdb;
if(isset($_GET["deleteform"])) $namtetodelete = $_GET['deleteform'];
if(isset($_POST["action"])) $action = $_POST['action'];
if(isset($_GET["site"])) $setting_current_page = $_GET['site'];
else { $setting_current_page="general"; $ifgeneralcurrent='class="current"'; }
if($setting_current_page=="about") $ifaboutcurrent='class="current"';
if(isset($action) && $action == "reservation_clean_database"){
$wpdb->query( "DELETE FROM ".$wpdb->prefix ."reservations WHERE departure < NOW() AND approve != 'yes' " );
$prompt = '<div class="update"><p>'.__( 'Database cleaned' , 'easyReservations' ).'</p></div>';
}
if(isset($_POST['easy-set-main'])){ //Set Reservation settings
if(!wp_verify_nonce($_POST['easy-set-main'], 'easy-set-main' )) die('Security check <a href="'.$_SERVER['referer_url'].'">('.__( 'Back' , 'easyReservations' ).')</a>' );
if(isset($_POST["reservations_uninstall"])) $reservations_uninstall = 1; else $reservations_uninstall = 0;
if(isset($_POST["reservations_time"])) $reservations_time = 1; else $reservations_time = 0;
if(isset($_POST["reservations_tutorial"])) $tutorial = 1; else $tutorial = 0;
if(isset($_POST['reservations_resourcemerge_box'])) $mergeres = $_POST['reservations_resourcemerge'];
else $mergeres = 0;
update_option("reservations_uninstall", $reservations_uninstall);
if(isset($_POST['reservations_currency_whitespace'])) $white = 1;
else $white = 0;
$settings_array = array( 'style' => $_POST["reservations_style"], 'currency' => array('sign' => $_POST["reservations_currency"], 'whitespace' => $white, 'decimal' => $_POST["reservations_currency_decimal"], 'divider1' => $_POST["reservations_currency_divider1"], 'divider2' => $_POST["reservations_currency_divider2"], 'place' => $_POST['reservations_currency_place']), 'date_format' => $_POST["reservations_date_format"], 'time_format' => $_POST["reservations_time_format"], 'time' => $reservations_time, 'tutorial' => $tutorial, 'mergeres' => array('merge' => $mergeres,'blockbefore'=>$_POST['blockbefore'], 'blockafter' => $_POST['blockafter']));
update_option("reservations_settings", $settings_array);
update_option("reservations_regular_guests", $_POST["regular_guests"]);
update_option("easyreservations_successful_script", $_POST["javascript"]);
update_option("reservations_support_mail", $_POST["reservations_support_mail"]);
do_action( 'er_set_main_save' );
$prompt = '<div class="updated"><p>'.__( 'General settings saved', 'easyReservations' ).'</p></div>';
}
if(isset($action) && $action == "reservations_email_settings"){//Set Reservation Mails
do_action( 'er_set_email_save' );
if(isset($_POST["reservations_email_sendmail_msg"])){
if(isset($_POST["reservations_email_sendmail_check"])) $reservations_email_sendmail_check = 1; else $reservations_email_sendmail_check = 0;
if(is_array($_POST["reservations_email_sendmail_msg"])) $_POST["reservations_email_sendmail_msg"] = implode($_POST["reservations_email_sendmail_msg"]);
$reservations_email_sendmail = array(
'msg' => stripslashes($_POST["reservations_email_sendmail_msg"]),
'subj' => stripslashes($_POST["reservations_email_sendmail_subj"]),
'active' => $reservations_email_sendmail_check
);
update_option("reservations_email_sendmail",$reservations_email_sendmail);
}
if(isset($_POST["reservations_email_to_admin_msg"])){
if(isset($_POST["reservations_email_to_admin_check"])) $reservations_email_to_admin_check = 1; else $reservations_email_to_admin_check = 0;
if(is_array($_POST["reservations_email_to_admin_msg"])) $_POST["reservations_email_to_admin_msg"] = implode($_POST["reservations_email_to_admin_msg"]);
$reservations_email_to_admin = array(
'msg' => stripslashes($_POST["reservations_email_to_admin_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_admin_subj"]),
'active' => $reservations_email_to_admin_check
);
update_option("reservations_email_to_admin",$reservations_email_to_admin);
}
if(isset($_POST["reservations_email_to_userapp_msg"])){
if(isset($_POST["reservations_email_to_userapp_check"])) $reservations_email_to_userapp_check = 1; else $reservations_email_to_userapp_check = 0;
if(is_array($_POST["reservations_email_to_userapp_msg"])) $_POST["reservations_email_to_userapp_msg"] = implode($_POST["reservations_email_to_userapp_msg"]);
$reservations_email_to_userapp = array(
'msg' => stripslashes($_POST["reservations_email_to_userapp_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_userapp_subj"]),
'active' => $reservations_email_to_userapp_check
);
update_option("reservations_email_to_userapp",$reservations_email_to_userapp);
}
if(isset($_POST["reservations_email_to_userdel_msg"])){
if(isset($_POST["reservations_email_to_userdel_check"])) $reservations_email_to_userdel_check = 1; else $reservations_email_to_userdel_check = 0;
if(is_array($_POST["reservations_email_to_userdel_msg"])) $_POST["reservations_email_to_userdel_msg"] = implode($_POST["reservations_email_to_userdel_msg"]);
$reservations_email_to_userdel = array(
'msg' => stripslashes($_POST["reservations_email_to_userdel_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_userdel_subj"]),
'active' => $reservations_email_to_userdel_check
);
update_option("reservations_email_to_userdel",$reservations_email_to_userdel);
}
if(isset($_POST["reservations_email_to_user_msg"])){
if(isset($_POST["reservations_email_to_user_check"])) $reservations_email_to_user_check = 1; else $reservations_email_to_user_check = 0;
if(is_array($_POST["reservations_email_to_user_msg"])) $_POST["reservations_email_to_user_msg"] = implode($_POST["reservations_email_to_user_msg"]);
$reservations_email_to_user = array(
'msg' => stripslashes($_POST["reservations_email_to_user_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_user_subj"]),
'active' => $reservations_email_to_user_check
);
update_option("reservations_email_to_user",$reservations_email_to_user);
}
if(isset($_POST["reservations_email_to_user_edited_msg"])){
if(isset($_POST["reservations_email_to_user_edited_check"])) $reservations_email_to_user_edited_check = 1; else $reservations_email_to_user_edited_check = 0;
if(is_array($_POST["reservations_email_to_user_edited_msg"])) $_POST["reservations_email_to_user_edited_msg"] = implode($_POST["reservations_email_to_user_edited_msg"]);
$reservations_email_to_user_edited = array(
'msg' => stripslashes($_POST["reservations_email_to_user_edited_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_user_edited_subj"]),
'active' => $reservations_email_to_user_edited_check
);
update_option("reservations_email_to_user_edited",$reservations_email_to_user_edited);
}
if(isset($_POST["reservations_email_to_admin_edited_msg"])){
if(isset($_POST["reservations_email_to_admin_edited_check"])) $reservations_email_to_admin_edited_check = 1; else $reservations_email_to_admin_edited_check = 0;
if(is_array($_POST["reservations_email_to_admin_edited_msg"])) $_POST["reservations_email_to_admin_edited_msg"] = implode($_POST["reservations_email_to_admin_edited_msg"]);
$reservations_email_to_admin_edited = array(
'msg' => stripslashes($_POST["reservations_email_to_admin_edited_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_admin_edited_subj"]),
'active' => $reservations_email_to_admin_edited_check
);
update_option("reservations_email_to_admin_edited",$reservations_email_to_admin_edited);
}
if(isset($_POST["reservations_email_to_admin_canceled_msg"])){
if(isset($_POST["reservations_email_to_admin_canceled_check"])) $reservations_email_to_admin_canceled_check = 1; else $reservations_email_to_admin_canceled_check = 0;
if(is_array($_POST["reservations_email_to_admin_canceled_msg"])) $_POST["reservations_email_to_admin_canceled_msg"] = implode($_POST["reservations_email_to_admin_canceled_msg"]);
$reservations_email_to_admin_canceled = array(
'msg' => stripslashes($_POST["reservations_email_to_admin_canceled_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_admin_canceled_subj"]),
'active' => $reservations_email_to_admin_canceled_check
);
update_option("reservations_email_to_admin_canceled",$reservations_email_to_admin_canceled);
}
if(isset($_POST["reservations_email_to_user_admin_edited_msg"])){
if(isset($_POST["reservations_email_to_user_admin_edited_check"])) $reservations_email_to_user_admin_edited_check = 1; else $reservations_email_to_user_admin_edited_check = 0;
if(is_array($_POST["reservations_email_to_user_admin_edited_msg"])) $_POST["reservations_email_to_user_admin_edited_msg"] = implode($_POST["reservations_email_to_user_admin_edited_msg"]);
$reservations_email_to_user_admin_edited = array(
'msg' => stripslashes($_POST["reservations_email_to_user_admin_edited_msg"]),
'subj' => stripslashes($_POST["reservations_email_to_user_admin_edited_subj"]),
'active' => $reservations_email_to_user_admin_edited_check
);
update_option("reservations_email_to_user_admin_edited",$reservations_email_to_user_admin_edited);
}
$prompt = '<div class="updated"><p>'.__( 'Email settings saved' , 'easyReservations' ).'</p></div>';
}
if(isset($action) && $action == "reservations_form_settings"){ // Change a form
$test = '';
foreach(explode("<br>\r\n", $_POST['reservations_formvalue']) as $v){
$test[] = str_replace('<br>', "<br>\r\n", $v);
}
$reservations_form_value = implode("<br>\r\n", $test);
$reservations_form_value = str_replace(array('<br>', '</formtag>'), array("\n", ''), $reservations_form_value);
$reservations_form_value = preg_replace('/<formtag.*?>/', '', $reservations_form_value);
$reservations_form_value = html_entity_decode($reservations_form_value);
$name = '';
if(isset($_GET["form"])) $name = $_GET["form"];
if($name == "") update_option("reservations_form", $reservations_form_value);
else update_option('reservations_form_'.$name, $reservations_form_value);
$prompt = '<div class="updated"><p>'.sprintf(__( 'Form%ssaved' , 'easyReservations' ), '<b> '.$name.' </b>' ).'</p></div>';
}
if(isset($action) && $action == "reservation_change_permissions"){ // Change a form
if(current_user_can('manage_options')){
$permissions = array('dashboard' => $_POST["easy-permission-dashboard"], 'resources' => $_POST["easy-permission-resources"], 'statistics' => $_POST["easy-permission-statistics"], 'settings' => $_POST["easy-permission-settings"]);
update_option('reservations_main_permission', $permissions);
$prompt = '<div class="updated"><p>'.__( 'Permissions changed' , 'easyReservations' ).'</p></div>';
} else $prompt = '<div class="error"><p>'.__( 'Only admins can change the permissions for' , 'easyReservations' ).' easyReservations</p></div>';
}
if(isset($namtetodelete)){
delete_option('reservations_form_'.$namtetodelete);
$prompt = '<div class="updated"><p>'.sprintf(__( 'Form %s has been deleted' , 'easyReservations' ), '<b>'.$namtetodelete.'</b>' ).'</p></div>';
}
if(isset($action) && $action == "reservations_form_add"){
if($_POST["formname"]!=""){
$formname0='reservations_form_'.strtolower(str_replace(' ', '', $_POST["formname"]));
$formname1=$formname0.'_1';
$formname2=$formname0.'_2';
if(get_option($formname0)=="") add_option(''.$formname0.'', ' ', '', 'no' );
elseif(get_option($formname1)=="") add_option(''.$formname1.'', ' ', '', 'no');
else add_option(''.$formname2.'', ' ', '', 'no');
$prompt = '<div class="updated"><p>'.sprintf(__( 'Form %s has been added' , 'easyReservations' ), '<b>'.$_POST["formname"].'</b>' ).'</p></div>';
} else $prompt = '<div class="error"><p>'.__( 'Please enter a name for the form' , 'easyReservations' ).'</p></div>';
}
if($setting_current_page == "form"){//Get current form Options
$forms = '';
$ifformcurrent='class="current"';
$formresult = $wpdb->get_results($wpdb->prepare("SELECT option_name, option_value FROM ".$wpdb->prefix ."options WHERE option_name like '%1\$s' ", like_escape("reservations_form_") . '%'));
foreach( $formresult as $result ){
$formcutedname=str_replace('reservations_form_', '', $result->option_name);
if($formcutedname!=""){
if(isset($_GET['form']) && $formcutedname == $_GET['form']) $class=' class="curr"'; else $class = '';
$link = 'admin.php?page=reservation-settings&site=form';
$forms.=' <li'.$class.'><a href="'.$link.'&form='.$formcutedname.'">'.$formcutedname.'</a> <a href="'.$link.'&deleteform='.$formcutedname.'"><img style="vertical-align:text-bottom;" src="'.RESERVATIONS_URL.'images/delete.png"></a></li>';
}
}
}
do_action( 'er_set_save' );
if($setting_current_page == "email") $ifemailcurrent='class="current"';
echo '<h2>'.__( 'Reservations Settings' , 'easyReservations' ).'</h2>';
if(isset($prompt)) echo $prompt; ?>
<div id="wrap">
<div class="tabs-box" style="width:99%">
<ul class="tabs">
<li><a <?php if(isset($ifgeneralcurrent)) echo $ifgeneralcurrent; ?> href="admin.php?page=reservation-settings"><img style="vertical-align:text-bottom ;" src="<?php echo RESERVATIONS_URL; ?>images/pref.png"> <?php printf ( __( 'General' , 'easyReservations' ));?></a></li>
<li><a <?php if(isset($ifformcurrent)) echo $ifformcurrent; ?> href="admin.php?page=reservation-settings&site=form"><img style="vertical-align:text-bottom ;" src="<?php echo RESERVATIONS_URL; ?>images/form.png"> <?php printf ( __( 'Form' , 'easyReservations' ));?></a></li>
<li><a <?php if($setting_current_page == 'custom') echo 'class="current"'; ?> href="admin.php?page=reservation-settings&site=custom">
<img style="vertical-align:text-bottom ;" src="<?php echo RESERVATIONS_URL; ?>images/list.png"> <?php printf ( __( 'Custom' , 'easyReservations' ));?>
</a></li>
<li><a <?php if(isset($ifemailcurrent)) echo $ifemailcurrent; ?> href="admin.php?page=reservation-settings&site=email"><img style="vertical-align:text-bottom ;" src="<?php echo RESERVATIONS_URL; ?>images/email.png"> <?php printf ( __( 'Emails' , 'easyReservations' ));?></a></li>
<?php do_action( 'er_set_tab_add' ); ?>
<li><a <?php if(isset($ifaboutcurrent)) echo $ifaboutcurrent; ?> href="admin.php?page=reservation-settings&site=about"><img style="vertical-align:text-bottom ;" src="<?php echo RESERVATIONS_URL; ?>images/logo.png"> <?php printf ( __( 'About' , 'easyReservations' ));?></a></li>
</ul>
</div>
<?php do_action( 'er_add_settings_top' );
if($setting_current_page == "general"){
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + GENERAL SETTINGS + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + */
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Get current Options
$reservations_settings = get_option("reservations_settings");
$reservations_currency = $reservations_settings['currency'];
if(!is_array($reservations_currency)) $reservations_currency = array('sign' => $reservations_currency, 'place' => 0, 'whitespace' => 1, 'divider1' => '.', 'divider2' => ',', 'decimal' => 1);
$reservations_date_format = $reservations_settings['date_format'];
if(isset($reservations_settings['time_format'])) $reservations_time_format = $reservations_settings['time_format'];
else $reservations_time_format = 'H:i';
$easyReservationSyle=$reservations_settings['style'];
$reservation_support_mail = get_option("reservations_support_mail");
$reservations_regular_guests = get_option('reservations_regular_guests');
$reservations_javascript = get_option('easyreservations_successful_script');
$permission_options=get_option("reservations_main_permission");
$reservations_uninstall=get_option("reservations_uninstall");
if(isset($reservations_settings['mergeres']) && is_array($reservations_settings['mergeres'])){
$blockbefore = $reservations_settings['mergeres']['blockbefore'];
$blockafter = $reservations_settings['mergeres']['blockafter'];
$reservations_settings['mergeres'] = $reservations_settings['mergeres']['merge'];
} else {
$blockbefore = 0;
$blockafter = 0;
}
if(!isset($reservations_settings['tutorial'])) $reservations_settings['tutorial'] = 1;?>
<div id="ieerror" class="error" style="display:none;">
<p>
The administration part of easyReservations is not tested in Internet Explorer. Please use a mordern browser like Firefox, Chrome, Safari or Opera.
</p>
</div>
<table cellspacing="0" style="width:99%">
<tr cellspacing="0">
<td style="width:70%;" valign="top" >
<?php
$currencys = array('#8364' => 'Euro','#36' => 'Dollar','#165' => 'Yen','#162' => 'Cent','#402' => 'Florin','#163' => 'Pound','#8356' => 'Lire','#20803' => 'Hongkong Dollar','#x20b8' => 'Tenge','#8365' => 'Laos Kip','#8353' => 'Colon','#8370' => 'Guarani','#70;t' => 'Hungary Forint','#8369' => 'Uruguay Peso','#8360' => 'Indian Rupee','#8377' => 'Indian Rupee 2nd','#2547' => 'Bengali Rupee','#2801' => 'Gujarati Rupee','#3065' => 'Tamil Rupee','#3647' => 'Thai Baht','#6107' => 'Khmer Riel','#66;Z$' => 'Belize Dollar','#36;b' => 'Bolivia Boliviano','#75;M' => 'Bosnia and Herzegovina Marka', '#77;X$' => 'Mexican Pesos', '#80' => 'Botswana Pula','#1083;в' => 'Bulgaria Lev','#6107' => 'Cambodia Riel','#20803' => 'China Yuan','#8371' => 'Austral','#8372' => 'Hryvnia','#81' => 'Guatemala Quetzal','#8373' => 'Cedi','#8366' => 'Tugril','#84;L' => 'Turkish Lira','#8367' => 'Drachma','#76' => 'Honduras Lempira','#8363' => 'Vietnam Dong','#8358' => 'Naira','#1084;ан' => 'Azerbaijan New Manat','#83;GD' => 'Singapore Dollar', '#1076;ен' => 'Macedonia Denar','#8366' => 'Mongolia Tughrik','#1547' => 'Afghanistan Afghani','#8354' => 'Cruzeiro','#65020' => 'Omani Rial','#65510' => 'Won','#82p.' => 'Indonesian rupiah sign','#73DR' => 'Indonesian rupiah ISO','#608' => 'Philippine Peso','#80;h' => 'Philippine Peso 2nd','#986' => 'Brazilian Real','#76;s' => 'Brazilian Real 2nd','#77;T' => 'Nicaragua Cordoba','#82;M' => 'Malaysia Ringgit','#82;$' => 'Latvia Lat','#1083;в' => 'Kazakhstan Tenge','#74;$' => 'Jamaica Dollar','#75;č' => 'Czech Koruna','#107;r' => 'Danish Krone','#83;EK' => 'Swedish Krone','#107;n' => 'Croatia Kuna','#122;ł' => 'Polish Zloty','#8362' => 'Israeli Sheqel','#66;/.' => 'Panamanian Balboa','#82;D$' => 'Dominican Republic Peso','#78;OK' => 'Norwegian Krone','#67;HF' => 'Switzerland Franc','#108;ei' => 'Romanian Leu', '#78;ZD' => 'New Zealand dollar', '#1088;у' => 'Russian Rouble','#82' => 'South African ZAR','#67;OP' => 'Colombian peso','#66;s.' => 'Venezuelan Bolivares', '#76;TL' => 'Lithuanian litas', '#67;$' => 'Canadian Dollar');
asort($currencys);
$divider = array('.' => '.', ',' => ',', ' ' => 'whitespace', '' => '');
$styles = array('widefat' =>__( 'Wordpress' , 'easyReservations' ),'greyfat' =>__( 'Grey' , 'easyReservations' ));
if(file_exists(WP_PLUGIN_DIR . '/easyreservations/lib/modules/styles/admin/style_premium.css')) $styles['premium'] = __( 'Premium' , 'easyReservations' );
$date_formats = array('Y/m/d' => date('Y/m/d'),'Y-m-d' => date('Y-m-d'),'m/d/Y' => date('m/d/Y'),'d-m-Y' => date('d-m-Y'),'d.m.Y' => date('d.m.Y'));
$time_formats = array('H:i' => date('H:i',time()),'h:i a' => date('h:i a'));
if(isset($reservations_settings['mergeres']) && $reservations_settings['mergeres'] > 0) $thenum = $reservations_settings['mergeres'];
else $thenum = 0;
$timearray = array(0 => '0 '.__('minutes', 'easyReservations'),5 => '5 '.__('minutes', 'easyReservations'),10 =>'10 '. __('minutes', 'easyReservations'),15 => '15 '.__('minutes', 'easyReservations'),30 => '30'. __('minutes', 'easyReservations'),45 =>'45 '. __('minutes', 'easyReservations'),60=>'1 '.__('hour', 'easyReservations'),90=>'1.5 '.__('hours', 'easyReservations'),120=>'2 '.__('hours', 'easyReservations'),150=>'2.5 '.__('hours', 'easyReservations'),180=>'3 '.__('hours', 'easyReservations'),240=>'4 '.__('hours', 'easyReservations'),300=>'5 '.__('hours', 'easyReservations'),360=>'6 '.__('hours', 'easyReservations'),600=>'10 '.__('hours', 'easyReservations'),720=>'12 '.__('hours', 'easyReservations'),1080=>'18 '.__('hours', 'easyReservations'),1440=>'1 '.__('day', 'easyReservations'),2160=>'1.5 '.__('days', 'easyReservations'),2880=>'2 '.__('days', 'easyReservations'),4320=>'3 '.__('days', 'easyReservations'),5760=>'4 '.__('days', 'easyReservations'),7200=>'5 '.__('days', 'easyReservations'),8640=>'6 '.__('days', 'easyReservations'),10080=>'7 '.__('days', 'easyReservations'),20160=>'14 '.__('days', 'easyReservations'),40320=>'1 '.__('month', 'easyReservations'));
$rows = array(
'<img src="'.RESERVATIONS_URL.'images/email.png"> <b>'.__( 'Support email', 'easyReservations' ).'</b>' => '<input type="text" name="reservations_support_mail" value="'.$reservation_support_mail.'" style="width:50%">',
'<img src="'.RESERVATIONS_URL.'images/dollar.png"> <b>'.__( 'Money format', 'easyReservations' ).'</b>' => array('currency_settings',easyreservations_generate_input_select('reservations_currency', $currencys, $reservations_currency['sign'], '', true).' '.easyreservations_generate_input_select('reservations_currency_place', array(__( 'after' , 'easyReservations' ),__( 'before' , 'easyReservations' )), $reservations_currency['place']).' '.__( 'Price' , 'easyReservations' ).' <input type="checkbox" name="reservations_currency_whitespace" '.checked($reservations_currency['whitespace'],1,false).'> '.__( 'Whitespace between price and currency sign' , 'easyReservations' ).'<br>'.__( 'Th. seperator' , 'easyReservations' ).': '.easyreservations_generate_input_select('reservations_currency_divider1', $divider, $reservations_currency['divider1']).' '.__( 'Dec. seperator' , 'easyReservations' ).': '.easyreservations_generate_input_select('reservations_currency_divider2', $divider, $reservations_currency['divider2']).' '.easyreservations_generate_input_select('reservations_currency_decimal',array('1' =>__('show decimals','easyReservations'), '0' => __( 'round' , 'easyReservations' )), $reservations_currency['decimal']).' '.__( 'Example' , 'easyReservations' ).':</strong> <span id="reservations_currency_example"></span>'),
'<img src="'.RESERVATIONS_URL.'images/day.png"> <b>'.__( 'Date format', 'easyReservations' ).'</b>' => easyreservations_generate_input_select('reservations_date_format',$date_formats,$reservations_date_format).' '.easyreservations_generate_input_select('reservations_time_format',$time_formats,$reservations_time_format),
'<img src="'.RESERVATIONS_URL.'images/clock.png"> <b>'.__( 'Time', 'easyReservations' ).'</b>' => '<input type="checkbox" name="reservations_time" '.checked($reservations_settings['time'],1,false).'> '.__( 'Enable display of time and that the time gets used to calculate the billing units instead of only the date', 'easyReservations' ),
'<img src="'.RESERVATIONS_URL.'images/background.png"> <b>'.__( 'Admin Style', 'easyReservations' ).'</b>' => easyreservations_generate_input_select('reservations_style',$styles,$easyReservationSyle),
'<img src="'.RESERVATIONS_URL.'images/house.png"> <b>'.__( 'Merge resources', 'easyReservations' ).'</b>' => '<input type="checkbox" id="checkmerge" name="reservations_resourcemerge_box" value="1" '.((isset($reservations_settings['mergeres']) && $reservations_settings['mergeres'] > 0) ? 'checked="checked"' : '').'> '.sprintf(__( 'Only allow %s reservations at the same time in all resources regardless of the resource counts' , 'easyReservations' ), '<select name="reservations_resourcemerge" onclick="document.getElementById(\'checkmerge\').checked = true;">'.easyreservations_num_options(0,99,$thenum).'</select>'),
'<img src="'.RESERVATIONS_URL.'images/lock.png"> <b>'.__( 'Block time', 'easyReservations' ).'</b>' => __( 'Block' , 'easyReservations' ).' '.easyreservations_generate_input_select('blockbefore', $timearray, $blockbefore).' '.__( 'before and' , 'easyReservations' ).' '.easyreservations_generate_input_select('blockafter', $timearray, $blockafter).' '.__( 'after reservations' , 'easyReservations' ),
'<img src="'.RESERVATIONS_URL.'images/help.png"> <b>'.__( 'Tutorial', 'easyReservations' ).'</b>' => '<input type="checkbox" name="reservations_tutorial" value="1" '.checked($reservations_settings['tutorial'],1,false).'> '.__( 'Enable tutorial mode' , 'easyReservations' ).' <a class="button" href="admin.php?page=reservation-settings&tutorial_histoy=0"> '.__( 'Reset' , 'easyReservations' ).'</a>',
'<img src="'.RESERVATIONS_URL.'images/database.png"> <b>'.__( 'Uninstall', 'easyReservations' ).'</b>' => '<input type="checkbox" name="reservations_uninstall" value="1" '.checked($reservations_uninstall, 1,false).'> '.__( 'Delete settings, reservations and resources' , 'easyReservations' ),
);
$rows = apply_filters('er_add_set_main_table_row', $rows);
$rows['<img src="'.RESERVATIONS_URL.'css/images/star_full.png"> <b>'.__( 'Important guests', 'easyReservations' ).'</b>'] = '<i>'.__( 'Enter emails of important guests; saperated by comma. Reservations with this email will be highlighted.' , 'easyReservations' ).'</i><textarea name="regular_guests" style="width:100%;height:80px;margin-top:5px;">'.$reservations_regular_guests.'</textarea>';
$rows['<img src="'.RESERVATIONS_URL.'images/lightning.png"> <b>'.__( 'Execute scripts', 'easyReservations' ).'</b>'] = '<i>'.__( 'After successful reservation.' , 'easyReservations' ).'</i><textarea name="javascript" style="width:100%;height:100px;margin-top:5px;">'.stripslashes($reservations_javascript).'</textarea>';
$table = easyreservations_generate_table('reservation_main_settings_table', __( 'General Settings', 'easyReservations' ).'<input type="submit" value="'. __( 'Save Changes' , 'easyReservations' ).'" onclick="document.getElementById(\'er_main_set\').submit(); return false;" class="easybutton button-primary" style="float:right" >', $rows);
echo easyreservations_generate_form('er_main_set', 'admin.php?page=reservation-settings', 'post', false, array('easy-set-main' => wp_create_nonce('easy-set-main')), $table);
do_action( 'er_set_main_out' ); ?>
</td><td style="width:1%;" valign="top">
</td><td style="width:29%;" valign="top">
<table class="<?php echo RESERVATIONS_STYLE; ?>" style="width:100%;margin-bottom:7px;" cellspacing="0" cellpadding="0" style="background:#fff;">
<thead>
<tr>
<th colspan="2"> <?php printf ( __( 'Status' , 'easyReservations' ));?></th>
</tr>
</thead>
<tbody>
<tr>
<td style="font-weight:bold;padding:10px;text-align:center"><span style="width:20%;display: inline-block">Version: <?php echo RESERVATIONS_VERSION; ?></span><span style="width:30%;display: inline-block">Last update: 08.05.2015</span><span style="width:30%;display: inline-block">written by Feryaz Beer</span></td>
</tr>
<tr class="alternate">
<td style="font-size:14px;text-align:center;font-weight:bold;padding:10px"><a href="http://easyreservations.org/knowledgebase/" target="_blank" id="iddocumentation"><?php echo __( 'Documentation' , 'easyReservations' );?></a></td>
</tr>
<tr>
<td style="font-size:14px;text-align:center;font-weight:bold;padding:10px"><a href="http://easyreservations.org/forums/forum/bug-reports/" target="_blank" id="idbugreport"><?php echo __( 'Report bug' , 'easyReservations' );?></a></td>
</tr>
<tr class="alternate">
<td style="font-size:14px;text-align:center;font-weight:bold;padding:10px"><a href="http://easyreservations.org/premium/" target="_blank" id="idpremium"><?php echo __( 'Premium' , 'easyReservations' );?></a></td>
</tr>
<tr>
<td style="font-size:14px;text-align:center;font-weight:bold;padding:10px"><a href="http://wordpress.org/extend/plugins/easyreservations/" target="_blank" id="idrate"><?php echo __( 'Rate the Plugin' , 'easyReservations' );?>, please!</a></td>
</tr>
</tbody>
</table>
<?php do_action( 'er_set_main_side_top' ); ?>
<form method="post" action="admin.php?page=reservation-settings" id="reservation_clean_database">
<input type="hidden" name="action" value="reservation_clean_database" id="reservation_clean_database">
<table class="<?php echo RESERVATIONS_STYLE; ?>" style="width:100%;" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th> <?php printf ( __( 'Clean Database' , 'easyReservations' ));?><input type="button" onclick="document.getElementById('reservation_clean_database').submit(); return false;" style="float:right;" title="" class="button" value="<?php printf ( __( 'Clean' , 'easyReservations' ));?>"></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img style="vertical-align:text-bottom;" src="<?php echo RESERVATIONS_URL; ?>images/database.png"> <?php printf ( __( 'Delete all unapproved old reservations' , 'easyReservations' ));?>
</td>
</tr>
</tbody>
</table>
</form>
<form method="post" action="admin.php?page=reservation-settings" id="reservation_change_permissions">
<input type="hidden" name="action" value="reservation_change_permissions" id="reservation_change_permissions">
<table class="<?php echo RESERVATIONS_STYLE; ?>" style="width:100%;margin-top:7px;" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th colspan="2" id="idpermission"> <?php printf ( __( 'Change Permissions' , 'easyReservations' ));?><input type="submit" onclick="document.getElementById('reservation_change_permissions').submit(); return false;" class="easybutton button-primary" style="float:right;" value="<?php printf ( __( 'Set' , 'easyReservations' ));?>"></th>
</tr>
</thead>
<tbody>
<tr class="alternate">
<td><?php echo __( 'Dashboard' , 'easyReservations' );?></td>
<td><select name="easy-permission-dashboard" style="float:right"><?php echo easyreservations_get_roles_options($permission_options['dashboard']); ?></select></td>
</tr>
<tr>
<td><?php printf ( __( 'Resources' , 'easyReservations' ));?></td>
<td><select name="easy-permission-resources" style="float:right"><?php echo easyreservations_get_roles_options($permission_options['resources']); ?></select></td>
</tr>
<tr class="alternate">
<td><?php printf ( __( 'Statistics' , 'easyReservations' ));?></td>
<td><select name="easy-permission-statistics" style="float:right"><?php echo easyreservations_get_roles_options($permission_options['statistics']); ?></select></td>
</tr>
<tr valign="top">
<td><?php printf ( __( 'Settings' , 'easyReservations' ));?></td>
<td><select name="easy-permission-settings" style="float:right"><?php echo easyreservations_get_roles_options($permission_options['settings']); ?></select></td>
</tr>
</tbody>
</table>
</form>
<?php do_action( 'er_set_main_side_out' ); ?>
</td>
</tr>
</table>
<script type="text/javascript">
function easyreservations_currency_example(){
var divider1 = jQuery('select[name=reservations_currency_divider1]').val();
var divider2 = jQuery('select[name=reservations_currency_divider2]').val();
var decimal = jQuery('select[name=reservations_currency_decimal]').val();
var place = jQuery('select[name=reservations_currency_place]').val();
var sign = jQuery('select[name=reservations_currency]').val();
var price = 54+divider1;
if(decimal == 1) price+= 847+divider2+99;
else price += 848;
if(place == 0){
if(jQuery('input[name=reservations_currency_whitespace]').is(":checked")) price+= ' ';
price += '&'+sign+';';
} else {
var white = '';
if(jQuery('input[name=reservations_currency_whitespace]').is(":checked")) white = ' ';
price = '&'+sign+';'+white+price;
}
jQuery('#reservations_currency_example').html(price);
}
jQuery('#currency_settings input,#currency_settings select').bind('change',function(){
easyreservations_currency_example();
});
easyreservations_currency_example();
</script><?php
} elseif($setting_current_page == "form"){
if(isset($_GET["form"])){
$formnameget = $_GET['form'];
$reservations_form = get_option("reservations_form_".$formnameget);
} else {
$formnameget='';
$reservations_form = get_option("reservations_form");
}
$custom_fields = get_option('reservations_custom_fields');
$custom_fields_array = '';
if($custom_fields){
foreach($custom_fields['fields'] as $id => $custom){
$custom_fields_array[$id] = $custom['title'];
}
} ?>
<div class="formnavigation" style="width:99%;height: 29px">
<ul class="navtabs">
<?php if($formnameget == ""){ ?>
<li class="curr"><a href="admin.php?page=reservation-settings&site=form"><?php printf ( __( 'Standard' , 'easyReservations' ));?></a></li>
<?php } else { ?>
<li><a href="admin.php?page=reservation-settings&site=form"><?php printf ( _e( 'Standard' , 'easyReservations' ));?></a></li>
<?php } echo $forms; ?>
</ul>
<div style="float:right">
<form method="post" action="admin.php?page=reservation-settings&site=form" id="reservations_form_add">
<input type="hidden" name="action" value="reservations_form_add">
<input name="formname" type="text" style="width:200px;height:25px;">
<input type="button" onclick="document.getElementById('reservations_form_add').submit(); return false;" class="easybutton button-primary" value="<?php echo __( 'Add' , 'easyReservations' );?>">
</form>
</div>
</div>
<script type="text/javascript">
function submitForm(){
jQuery('*[name="reservations_formvalue"]').val(jQuery('#formcontainer').html());
jQuery('#easyform').submit();
}
function generateHiddenOptions(tag){
var value = '<h4><?php echo addslashes(__( 'Type' , 'easyReservations' ));?></h4><p><select id="hiddentype" name="1" onchange="changeHiddenOption()">';
jQuery.each({
xxx: "<?php echo addslashes(__( 'Type' , 'easyReservations' ));?>",
resource: "<?php echo addslashes(__( 'Resource' , 'easyReservations' ));?>",
from: "<?php echo addslashes(__( 'Arrival date' , 'easyReservations' ));?>",
"date-from-hour": "<?php echo addslashes(__( 'Arrival hour' , 'easyReservations' ));?>",
"date-from-min": "<?php echo addslashes(__( 'Arrival minute' , 'easyReservations' ));?>",
to: "<?php echo addslashes(__( 'Departure Date' , 'easyReservations' ));?>",
"date-to-hour": "<?php echo addslashes(__( 'Departure hour' , 'easyReservations' ));?>",
"date-to-min": "<?php echo addslashes(__( 'Departure minute' , 'easyReservations' ));?>",
units: "<?php echo addslashes(__( 'Billing units' , 'easyReservations' ));?>",
adults: "<?php echo addslashes(__( 'Adults' , 'easyReservations' ));?>",
childs: "<?php echo addslashes(__( 'Children' , 'easyReservations' ));?>"
}, function(ok,ov){
var selected = '';
if(tag && tag[1] == ok) selected = 'selected="selected"';
value += '<option value="'+ok+'" '+selected+'>'+ov+'</option>';
});
value += '</select></p><span id="the_hidden_value">';
if(tag) value += changeHiddenOption(tag, tag[1]);
value += '</span>';
return value;
}
function changeHiddenOption(tag,typ){
if(typ) var type = typ;
else var type = jQuery('#hiddentype').val();
var field = false;
if(type == 'resource'){
if(!tag || !tag[2]) tag = {2:''}
field = generateResourceSelect(tag[2],'2');
} else if(type == "from" || type == "to"){
if(!tag || !tag[2]) tag = {2:'<?php echo RESERVATIONS_DATE_FORMAT; ?>'}
field = '<input type="text" name="2" value="'+tag[2]+'">'
} else if(type == "date-from-hour" || type == "date-to-hour"){
if(!tag || !tag[2]) tag = {2:12}
field = '<select name="2">'+generateOptions('0-23',tag[2])+'</select>'
} else if(type == "date-from-min" || type == "date-to-min"){
if(!tag || !tag[2]) tag = {2:30}
field = '<select name="2">'+generateOptions('0-59',tag[2])+'</select>'
} else if(type == "adults" || type == "units"){
if(!tag || !tag[2]) tag = {2:2}
field = '<select name="2">'+generateOptions('1-100',tag[2])+'</select>'
} else if(type == "childs"){
if(!tag || !tag[2]) tag = {2:1}
field = '<select name="2">'+generateOptions('0-100',tag[2])+'</select>'
}
if(field){
field = '<h4><?php echo addslashes(__( 'Value' , 'easyReservations' ));?></h4><p>'+field+'</p>'
if(typ) return field;
else jQuery('#the_hidden_value').html(field);
}
}
function resourceSelect(tag){
if(!tag) tag = {value:''};
else if(!tag['value']) tag['value'] = '';
return generateResourceSelect(tag['value'],'value');
}
function generateResourceSelect(sel,name){
var resources = <?php easyreservations_load_resources(); global $the_rooms_array; echo str_replace('\\"', '"', addslashes(json_encode($the_rooms_array))); ?>;
var value = '<select name="'+name+'">';
jQuery.each(resources, function(k,v){
var selected = '';
if(sel && sel == k) selected = 'selected="selected"';
value += '<option value="'+k+'" '+selected+'>'+v['post_title']+'</option>';
});
return value+'</select>';
}
function generateInfoboxImage(tag){
var checked = '', img_y = '100', img_x = '100';
if(tag && tag['img'] && tag['img'] == 'yes') checked = ' checked="checked"';
if(tag && tag['img_y']) img_y = tag['img_y'];
if(tag && tag['img_x']) img_x = tag['img_x'];
var value = '<input type="checkbox" name="img" value="yes"'+checked+'> <?php echo addslashes(__( 'Display featured image' , 'easyReservations' ));?><br>';
value += '<?php echo addslashes(__( 'Width' , 'easyReservations' ));?>: <input type="text" name="img_y" class="not" value="'+img_y+'" style="width:100px"> px<br>';
return value + '<?php echo addslashes(__( 'Height' , 'easyReservations' ));?>: <input type="text" name="img_x" class="not" value="'+img_x+'" style="width:100px"> px';
}
function generateInfoboxContent(tag){
var checked = '';
if(tag && tag['content']) checked = ' checked="checked"';
else if(tag) tag['content'] = 400;
else tag = {content: 400};
return '<input type="checkbox" name="content" class="not" value="yes"'+checked+'> <?php echo addslashes(__( 'Display content with' , 'easyReservations' )); ?> <input type="text" name="content_value" class="not" value="'+tag['content']+'" style="width:80px"> <?php echo addslashes(__( 'characters' , 'easyReservations' )); ?>';
}
function generateInfoboxExcerpt(tag){
var checked = '';
if(tag && tag['excerpt']) checked = ' checked="checked"';
else if(tag) tag['excerpt'] = 400;
else tag = {excerpt: 400};
return '<input type="checkbox" name="excerpt" class="not" value="yes"'+checked+'> <?php echo addslashes(__( 'Display excerpt with' , 'easyReservations' )); ?> <input type="text" name="excerpt_value" class="not" value="'+tag['excerpt']+'" style="width:80px"> <?php echo addslashes(__( 'characters' , 'easyReservations' )); ?>';
}
function generateInfobox(){
var tag = '';
if(jQuery('*[name="img"]').attr('checked')) tag += 'img_y="'+jQuery('*[name="img_y"]').val()+'" img_x="'+jQuery('*[name="img_x"]').val()+'" ';
if(jQuery('*[name="content"]').attr('checked')) tag += 'content="'+jQuery('*[name="content_value"]').val()+'" ';
if(jQuery('*[name="excerpt"]').attr('checked')) tag += 'excerpt="'+jQuery('*[name="excerpt_value"]').val()+'" ';
return tag;
}
function customRequired(tag){
var sel = '', checked = '';
if(tag && tag[Object.keys(tag)[Object.keys(tag).length - 1]]) sel = tag[Object.keys(tag)[Object.keys(tag).length - 1]];
if(sel == '*') checked = ' checked="checked"';
var value = '<input type="checkbox" name="*" value="*"'+checked+'> <?php echo addslashes(__( 'Required' , 'easyReservations' )); ?><br>';
return value;
}
function priceCheckBoxes(tag){
var sel = '';
if(tag && tag[Object.keys(tag)[Object.keys(tag).length - 1]]) sel = tag[Object.keys(tag)[Object.keys(tag).length - 1]];
var checked = '';
if(sel == 'pn' || sel == 'pb') checked = ' checked="checked"';
var value = '<input type="checkbox" name="pn" class="not" value="yes"'+checked+'> <?php echo addslashes(__( 'Price per billing unit' , 'easyReservations' )); ?><br>';
checked = '';
if(sel == 'pp' || sel == 'pb') checked = ' checked="checked"';
value += '<input type="checkbox" name="pp" class="not" value="yes"'+checked+'> <?php echo addslashes(__( 'Price per person' , 'easyReservations' )); ?>';
return value;
}
function generatePrice(){
var tag = '';
if(jQuery('*[name="pn"]').attr('checked')) tag = 'pn ';
if(jQuery('*[name="pp"]').attr('checked')){
if(tag != '') tag = 'pb ';
else tag = 'pp ';
}
return tag;
}
var style = {
title: '<?php echo addslashes(__( 'Style' , 'easyReservations' ));?>',
input: 'text'
},
title = {
title: '<?php echo addslashes(__( 'Title' , 'easyReservations' ));?>',
input: 'text'
},
maxlength = {
title: '<?php echo addslashes(__( 'Max-length' , 'easyReservations' ));?>',
input: 'select',
options: '0-100',
default: 50
},
disabled = {
title: '<?php echo addslashes(__( 'Disabled' , 'easyReservations' ));?>',
input: 'check',
default: 'disabled'
},
fields = {
error: {
name: '<?php echo addslashes(__( 'Errors' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Shows the warning messages in form. Is required for the multiple reservations form function.' , 'easyReservations' ));?>',
options: {
error_title: {
title: '<?php echo addslashes(__( 'Title' , 'easyReservations' ));?>',
input: 'text',
default: 'Errors found in the form'
},
error_message: {
title: '<?php echo addslashes(__( 'Message' , 'easyReservations' ));?>',
input: 'textarea',
default: 'There is a problem with the form, please check and correct the following:'
},
style: style,
title: title
}
},
"date-from": {
name: '<?php echo addslashes(__( 'Arrival date' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Field with datepicker for the arrival date. Is required in any form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Value' , 'easyReservations' ));?>',
input: 'text',
default: '+14'
},
maxlength: maxlength,
style: style,
title: title,
disabled:disabled
}
},
"date-to": {
name: '<?php echo addslashes(__( 'Departure date' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Field with datepicker for the departure date. Can be replaced by billing units selection or deleted so that every reservation lasts one billing unit.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Value' , 'easyReservations' ));?>',
input: 'text',
default: '+21'
},
maxlength: maxlength,
style: style,
title: title,
disabled:disabled
}
},
"date-from-hour": {
name: '<?php echo addslashes(__( 'Arrival hour' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select for arrival hour. Can be replaced by a hidden field and defaults to 12:00 if not in form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '0-23',
default: '12'
},
style: style,
title: title,
disabled:disabled
}
},
"date-to-hour": {
name: '<?php echo addslashes(__( 'Departure hour' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select for departure hour. Can be replaced by a hidden field and defaults to 12:00 if not in form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '0-23',
default: '12'
},
style: style,
title: title,
disabled:disabled
}
},
"date-from-min": {
name: '<?php echo addslashes(__( 'Arrival minute' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select for arrival minute.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '0-59',
default: '0'
},
style: style,
title: title,
disabled:disabled
}
},
"date-to-min": {
name: '<?php echo addslashes(__( 'Departure minute' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select for departure minute.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '0-59',
default: '0'
},
style: style,
title: title,
disabled:disabled
}
},
units: {
name: '<?php echo addslashes(__( 'Billing units' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select of billing units to define the length of stay. Can be replaced by depature date field or defaults to one billing unit if not in form.' , 'easyReservations' ));?>',
options: {
1: {
title: '<?php echo addslashes(__( 'Min' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '1'
},
2: {
title: '<?php echo addslashes(__( 'Max' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '10'
},
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '7'
},
style: style,
title: title,
disabled:disabled
}
},
resources: {
name: '<?php echo addslashes(__( 'Resources' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select of resources. Is required and can only be replaced by hidden field. You can exclude resources with comma saperated IDs.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: resourceSelect
},
exclude: {
title: '<?php echo addslashes(__( 'Exclude' , 'easyReservations' ));?>',
input: 'text',
default: ''
},
style: style,
title: title,
disabled:disabled
}
},
adults: {
name: '<?php echo addslashes(__( 'Adults' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select of adults. Is required and can only be replaced by hidden field.' , 'easyReservations' ));?>',
options: {
1: {
title: '<?php echo addslashes(__( 'Min' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '1'
},
2: {
title: '<?php echo addslashes(__( 'Max' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '10'
},
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '3'
},
style: style,
title: title,
disabled:disabled
}
},
childs: {
name: '<?php echo addslashes(__( 'Children\'s' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Select of children\'s. Can be replaced by hidden field or deleted.' , 'easyReservations' ));?>',
options: {
1: {
title: '<?php echo addslashes(__( 'Min' , 'easyReservations' ));?>',
input: 'select',
options: '0-100',
default: '0'
},
2: {
title: '<?php echo addslashes(__( 'Max' , 'easyReservations' ));?>',
input: 'select',
options: '1-100',
default: '10'
},
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: '0-100',
default: '0'
},
style: style,
title: title,
disabled:disabled
}
},
thename: {
name: '<?php echo addslashes(__( 'Name' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Text field for name. Is required in any form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Value' , 'easyReservations' ));?>',
input: 'text',
default: ''
},
maxlength: maxlength,
style: style,
title: title,
disabled:disabled
}
},
email: {
name: '<?php echo addslashes(__( 'Email' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Text field for email. Is required in any form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Value' , 'easyReservations' ));?>',
input: 'text',
default: ''
},
maxlength: maxlength,
style: style,
title: title,
disabled:disabled
}
},
country: {
name: '<?php echo addslashes(__( 'Country' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Text field for email. Is required in any form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Selected' , 'easyReservations' ));?>',
input: 'select',
options: <?php echo str_replace('\\"', '"', addslashes(json_encode(easyReservations_country_array()))); ?>,
default: 'US'
},
maxlength: maxlength,
style: style,
title: title,
disabled:disabled
}
},
hidden: {
name: '<?php echo addslashes(__( 'Hidden' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Date and information fields can be replaced by hidden fields to force the selection without the guest choosing or seeing it. They are helpful for special offers or forms for just one resource.' , 'easyReservations' ));?>',
options: generateHiddenOptions
},
infobox: {
name: '<?php echo addslashes(__( 'Resources infobox' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Shows the information title, image, content and excerpt of the currently selected resource.' , 'easyReservations' ));?>',
generate: generateInfobox,
options: {
theme: {
title: '<?php echo addslashes(__( 'Size' , 'easyReservations' ));?>',
input: 'select',
options: {big:"<?php echo addslashes(__( 'Big' , 'easyReservations' ));?>", medium:"<?php echo addslashes(__( 'Medium' , 'easyReservations' ));?>"},
default: 'big'
},
img: {
title: '<?php echo addslashes(__( 'Featured image' , 'easyReservations' ));?>',
input: generateInfoboxImage
},
title: {
title: '<?php echo addslashes(__( 'Show title' , 'easyReservations' ));?>',
input: 'check',
default: 'yes'
},
content: {
title: '<?php echo addslashes(__( 'Content' , 'easyReservations' ));?>',
input: generateInfoboxContent
},
excerpt: {
title: '<?php echo addslashes(__( 'Excerpt' , 'easyReservations' ));?>',
input: generateInfoboxExcerpt
}
}
},
captcha: {
name: '<?php echo addslashes(__( 'Captcha' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Text field for email. Is required in any form.' , 'easyReservations' ));?>',
options: {
color: {
title: '<?php echo addslashes(__( 'Color of code' , 'easyReservations' ));?>',
input: 'select',
options: {black: "<?php echo addslashes(__( 'Black' , 'easyReservations' ));?>", white: "<?php echo addslashes(__( 'White' , 'easyReservations' ));?>"},
default: 'black'
},
style: style,
title: title
}
},
"show_price": {
name: '<?php echo addslashes(__( 'display price' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Shows the price as of selections.' , 'easyReservations' ));?>',
options: {
before: {
title: '<?php echo addslashes(__( 'Text before price' , 'easyReservations' ));?>',
input: 'text',
default: 'Price:'
},
style: style,
title: title
}
},
submit: {
name: '<?php echo addslashes(__( 'Submit' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(__( 'Button to submit the form.' , 'easyReservations' ));?>',
options: {
value: {
title: '<?php echo addslashes(__( 'Value' , 'easyReservations' ));?>',
input: 'text',
default: 'Submit'
},
style: style,
title: title
}
},
custom: {
name: '<?php echo addslashes(__( 'Custom' , 'easyReservations' ));?>',
desc: '<?php echo addslashes(sprintf( __( 'Can be any form element, can have an impact on the price and are used to get more information. Define them %s first' , 'easyReservations' ), '<a href="admin.php?page=reservation-settings&site=custom">here</a>'));?>',
options: {
id: {
title: '<?php echo addslashes(__( 'Select field' , 'easyReservations' ));?>',
input: 'select',
options: <?php if(!isset($custom_fields_array)) $custom_fields_array = array(); echo json_encode($custom_fields_array);?>
},
style: style,
title: title
}
}
};
<?php do_action('easy-form-js-before'); ?>
</script><?php
$new_form = '';
foreach(explode("\r\n", ($reservations_form)) as $v){
$new_form .= nl2br(htmlspecialchars($v, ENT_COMPAT));
}
$tags = easyreservations_shortcode_parser($new_form, true);
foreach($tags as &$v){
$explode = explode(' ', $v);
$new_form = str_replace('['.$v.']', '<formtag attr="'.$explode[0].'">['.$v.']</formtag>', $new_form);
}
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script('form-editor', RESERVATIONS_URL.'js/functions/form.editor.js');
$textfield = '<div id="formcontainer" style="min-height:500px;width:63%;float:left;background:#fff;border:1px solid #CCC;padding:4px;font-size:13px;font-family: Consolas, Monaco, monospace" contenteditable="true">';
$textfield .= stripslashes($new_form);
$textfield .= '</div>';
$accordion = '<div id="accordion_container">';
$accordion .= '<div id="accordion">';
$accordion .= '<h3>'.__('Date fields','easyReservations').'</h3>';
$accordion .= '<div class="table">';
$accordion .= '<table class="formtable">';
$accordion .= '<thead>';
$accordion .= '<tr>';
$accordion .= '<th></th>';
$accordion .= '<th>'.__('Type','easyReservations').'</th>';
$accordion .= '<th>'.__('Default','easyReservations').'</th>';
$accordion .= '</tr>';
$accordion .= '</thead>';
$accordion .= '<tbody>';
$accordion .= '<tr attr="date-from">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/day.png);"></td>';
$accordion .= '<td><strong>'.__('Arrival date','easyReservations').'</strong><br><i>'.__('Text field with datepicker','easyReservations').'</i></td>';
$accordion .= '<td>✘</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="date-from-hour">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/clock.png);"></td>';
$accordion .= '<td><strong>'.__('Arrival hour','easyReservations').'</strong><br><i>'.__('Select field as of the time pattern selection','easyReservations').'</i></td>';
$accordion .= '<td>12</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="date-from-min">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/hour.png);"></td>';
$accordion .= '<td><strong>'.__('Arrival minute','easyReservations').'</strong><br><i>'.__('Select field','easyReservations').' 00-59</i></td>';
$accordion .= '<td>12</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="date-to">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/day.png);"></td>';
$accordion .= '<td><strong>'.__('Departure date','easyReservations').'</strong><br><i>'.__('Text field with datepicker','easyReservations').'</i></td>';
$accordion .= '<td>✘</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="units">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/units.png);"></td>';
$accordion .= '<td><strong>'.__('Billing units','easyReservations').'</strong><br><i>'.__('Select field to choose length of stay','easyReservations').'</i></td>';
$accordion .= '<td>✘</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="date-to-hour">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/clock.png);"></td>';
$accordion .= '<td><strong>'.__('Departure hour','easyReservations').'</strong><br><i>'.__('Select field as of the time pattern selection','easyReservations').'</i></td>';
$accordion .= '<td>12</td>';
$accordion .= '</tr>';
$accordion .= '<tr attr="date-to-min">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/hour.png);"></td>';
$accordion .= '<td><strong>'.__('Departure minute','easyReservations').'</strong><br><i>'.__('Select field','easyReservations').' 00-59</i></td>';
$accordion .= '<td>12</td>';
$accordion .= '</tr>';
$accordion .= '</tbody>';
$accordion .= '</table>';
$accordion .= '</div>';
$accordion .= '<h3>'.__('Information fields','easyReservations').'</h3>';
$accordion .= '<div class="table">';
$accordion .= '<table class="formtable">';
$accordion .= '<thead>';
$accordion .= '<tr>';
$accordion .= '<th></th>';
$accordion .= '<th>'.__('Type','easyReservations').'</th>';
$accordion .= '<th>'.__('Default','easyReservations').'</th>';
$accordion .= '</tr>';
$accordion .= '</thead>';
$accordion .= '<tbody>';
$accordion .= '<tr attr="resources">';
$accordion .= '<td style="background-image:url('.RESERVATIONS_URL.'images/house.png);"></td>';
$accordion .= '<td><strong>'.__('Resources','easyReservations').'</strong><br><i>'.__('Select of resource','easyReservations').'</i></td>';