Everest Forms – Easy Contact Form and Form Builder - Version 1.0

Version Description

Download this release

Release Info

Developer wpeverest
Plugin Icon 128x128 Everest Forms – Easy Contact Form and Form Builder
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (141) hide show
  1. CHANGELOG.txt +0 -0
  2. assets/css/activation-rtl.css +1 -0
  3. assets/css/activation.css +1 -0
  4. assets/css/activation.scss +36 -0
  5. assets/css/admin-settings-rtl.css +1 -0
  6. assets/css/admin-settings.css +1 -0
  7. assets/css/admin-settings.scss +138 -0
  8. assets/css/everest-builder-rtl.css +1 -0
  9. assets/css/everest-builder.css +1 -0
  10. assets/css/everest-builder.scss +121 -0
  11. assets/css/everest-forms-rtl.css +1 -0
  12. assets/css/everest-forms.css +1 -0
  13. assets/css/everest-forms.scss +318 -0
  14. assets/css/evf-add-form-rtl.css +1 -0
  15. assets/css/evf-add-form.css +1 -0
  16. assets/css/evf-form-modal-rtl.css +1 -0
  17. assets/css/evf-form-modal.css +1 -0
  18. assets/css/evf-form-modal.scss +205 -0
  19. assets/css/jquery-ui-datepicker/jquery-ui-datepicker-rtl.css +1 -0
  20. assets/css/jquery-ui-datepicker/jquery-ui-datepicker.css +165 -0
  21. assets/css/jquery-ui-datepicker/jquery-ui-datepicker.scss +165 -0
  22. assets/css/scss/_admin.scss +1174 -0
  23. assets/css/scss/_backbone.scss +136 -0
  24. assets/css/scss/_clearings.scss +31 -0
  25. assets/css/scss/_colors.scss +51 -0
  26. assets/css/scss/_evf-icon.scss +74 -0
  27. assets/fonts/evf-icon.eot +0 -0
  28. assets/fonts/evf-icon.svg +37 -0
  29. assets/fonts/evf-icon.ttf +0 -0
  30. assets/fonts/evf-icon.woff +0 -0
  31. assets/images/blank-form.jpg +0 -0
  32. assets/images/contact-form.jpg +0 -0
  33. assets/js/admin/admin-helper.js +91 -0
  34. assets/js/admin/admin-helper.min.js +1 -0
  35. assets/js/admin/builder-config.js +29 -0
  36. assets/js/admin/builder-config.min.js +1 -0
  37. assets/js/admin/everest-builder.js +94 -0
  38. assets/js/admin/everest-builder.min.js +1 -0
  39. assets/js/admin/everest-forms-admin.js +0 -0
  40. assets/js/admin/everest-forms-admin.min.js +0 -0
  41. assets/js/admin/everest-panel-builder.js +816 -0
  42. assets/js/admin/everest-panel-builder.min.js +1 -0
  43. assets/js/admin/evf-add-form.js +115 -0
  44. assets/js/admin/evf-add-form.min.js +1 -0
  45. assets/js/admin/evf-form-modal.js +195 -0
  46. assets/js/admin/evf-form-modal.min.js +1 -0
  47. assets/js/admin/settings.js +13 -0
  48. assets/js/admin/settings.min.js +1 -0
  49. assets/js/frontend/everest-forms.js +87 -0
  50. assets/js/frontend/everest-forms.min.js +1 -0
  51. assets/js/jquery-blockui/jquery.blockUI.js +619 -0
  52. assets/js/jquery-blockui/jquery.blockUI.min.js +14 -0
  53. assets/js/jquery-confirm/jquery-confirm.min.css +9 -0
  54. assets/js/jquery-confirm/jquery-confirm.min.js +10 -0
  55. assets/js/jquery-tiptip/jquery.tipTip.js +191 -0
  56. assets/js/jquery-tiptip/jquery.tipTip.min.js +1 -0
  57. everest-forms.php +42 -0
  58. gulpfile.js +58 -0
  59. includes/abstracts/abstract-evf-admin-form-panel.php +182 -0
  60. includes/abstracts/abstract-evf-form-fields.php +821 -0
  61. includes/abstracts/abstract-evf-log-handler.php +49 -0
  62. includes/abstracts/abstract-evf-session.php +124 -0
  63. includes/admin/class-evf-add-form.php +108 -0
  64. includes/admin/class-evf-admin-assets.php +213 -0
  65. includes/admin/class-evf-admin-form-builder.php +210 -0
  66. includes/admin/class-evf-admin-form-list.php +71 -0
  67. includes/admin/class-evf-admin-form-table-list.php +404 -0
  68. includes/admin/class-evf-admin-menus.php +477 -0
  69. includes/admin/class-evf-admin-notices.php +189 -0
  70. includes/admin/class-evf-admin-post-types.php +35 -0
  71. includes/admin/class-evf-admin-settings.php +755 -0
  72. includes/admin/class-evf-admin-status.php +179 -0
  73. includes/admin/class-evf-admin.php +162 -0
  74. includes/admin/evf-admin-functions.php +419 -0
  75. includes/admin/form-panels/class-evf-fields-panel.php +291 -0
  76. includes/admin/form-panels/class-evf-settings-panel.php +253 -0
  77. includes/admin/settings/class-evf-settings-email.php +119 -0
  78. includes/admin/settings/class-evf-settings-general.php +90 -0
  79. includes/admin/settings/class-evf-settings-page.php +158 -0
  80. includes/admin/settings/class-evf-settings-recaptcha.php +98 -0
  81. includes/admin/settings/class-evf-settings-validation.php +118 -0
  82. includes/admin/views/html-admin-form-modal.php +36 -0
  83. includes/admin/views/html-admin-page-forms.php +24 -0
  84. includes/admin/views/html-admin-page-status-logs.php +38 -0
  85. includes/admin/views/html-admin-page-status.php +42 -0
  86. includes/admin/views/html-admin-settings.php +57 -0
  87. includes/admin/views/html-notice-custom.php +17 -0
  88. includes/admin/views/html-notice-update.php +21 -0
  89. includes/admin/views/html-notice-updated.php +17 -0
  90. includes/admin/views/html-notice-updating.php +15 -0
  91. includes/class-everest-forms.php +377 -0
  92. includes/class-evf-ajax.php +221 -0
  93. includes/class-evf-autoloader.php +96 -0
  94. includes/class-evf-background-updater.php +135 -0
  95. includes/class-evf-cache-helper.php +87 -0
  96. includes/class-evf-emails.php +588 -0
  97. includes/class-evf-field-item.php +84 -0
  98. includes/class-evf-form-handler.php +349 -0
  99. includes/class-evf-form-task.php +455 -0
  100. includes/class-evf-forms-feature.php +140 -0
  101. includes/class-evf-frontend-scripts.php +278 -0
  102. includes/class-evf-install.php +703 -0
  103. includes/class-evf-log-levels.php +120 -0
  104. includes/class-evf-logger.php +277 -0
  105. includes/class-evf-post-types.php +103 -0
  106. includes/class-evf-session-handler.php +307 -0
  107. includes/class-evf-shortcodes.php +81 -0
  108. includes/class-evf-template-loader.php +93 -0
  109. includes/class-evf-validation.php +51 -0
  110. includes/evf-core-functions.php +1035 -0
  111. includes/evf-deprecated-functions.php +136 -0
  112. includes/evf-formatting-functions.php +515 -0
  113. includes/evf-notice-functions.php +197 -0
  114. includes/evf-template-functions.php +101 -0
  115. includes/evf-user-functions.php +15 -0
  116. includes/form-fields/class-evf-field-checkbox.php +321 -0
  117. includes/form-fields/class-evf-field-date-time.php +133 -0
  118. includes/form-fields/class-evf-field-email.php +205 -0
  119. includes/form-fields/class-evf-field-first-name.php +134 -0
  120. includes/form-fields/class-evf-field-last-name.php +134 -0
  121. includes/form-fields/class-evf-field-number.php +135 -0
  122. includes/form-fields/class-evf-field-radio.php +321 -0
  123. includes/form-fields/class-evf-field-select.php +255 -0
  124. includes/form-fields/class-evf-field-text.php +134 -0
  125. includes/form-fields/class-evf-field-textarea.php +146 -0
  126. includes/form-fields/class-evf-field-url.php +135 -0
  127. includes/interfaces/class-evf-log-handler-interface.php +28 -0
  128. includes/interfaces/class-evf-logger-interface.php +134 -0
  129. includes/libraries/class-emogrifier.php +1555 -0
  130. includes/libraries/wp-async-request.php +158 -0
  131. includes/libraries/wp-background-process.php +500 -0
  132. includes/log-handlers/class-evf-log-handler-file.php +372 -0
  133. includes/shortcodes/class-evf-shortcode-form.php +575 -0
  134. includes/templates/contact.php +80 -0
  135. languages/everest-forms.pot +569 -0
  136. license.txt +702 -0
  137. readme.txt +71 -0
  138. templates/notices/error.php +33 -0
  139. templates/notices/notice.php +25 -0
  140. templates/notices/success.php +25 -0
  141. uninstall.php +42 -0
CHANGELOG.txt ADDED
File without changes
assets/css/activation-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ div.everest-forms-message{overflow:hidden;position:relative;border-right-color:#2ea2cc!important}div.everest-forms-message a.button-primary,div.everest-forms-message a.button-secondary{text-decoration:none!important}div.everest-forms-message a.everest-forms-message-close{position:absolute;top:0;left:0;padding:10px 21px 10px 15px;font-size:13px;line-height:1.23076923;text-decoration:none}div.everest-forms-message a.everest-forms-message-close:before{position:absolute;top:8px;right:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}
assets/css/activation.css ADDED
@@ -0,0 +1 @@
 
1
+ div.everest-forms-message{overflow:hidden;position:relative;border-left-color:#2ea2cc!important}div.everest-forms-message a.button-primary,div.everest-forms-message a.button-secondary{text-decoration:none!important}div.everest-forms-message a.everest-forms-message-close{position:absolute;top:0;right:0;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}div.everest-forms-message a.everest-forms-message-close:before{position:absolute;top:8px;left:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}
assets/css/activation.scss ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * activation.scss
3
+ * Styles applied to elements displayed on activation
4
+ */
5
+
6
+ /**
7
+ * Styling begins
8
+ */
9
+ div.everest-forms-message {
10
+ overflow: hidden;
11
+ position: relative;
12
+ border-left-color: #2ea2cc !important;
13
+
14
+ a.button-primary,
15
+ a.button-secondary {
16
+ text-decoration: none !important;
17
+ }
18
+
19
+ a.everest-forms-message-close {
20
+ position: absolute;
21
+ top: 0;
22
+ right: 0;
23
+ padding: 10px 15px 10px 21px;
24
+ font-size: 13px;
25
+ line-height: 1.23076923;
26
+ text-decoration: none;
27
+
28
+ &:before {
29
+ position: absolute;
30
+ top: 8px;
31
+ left: 0;
32
+ -webkit-transition: all .1s ease-in-out;
33
+ transition: all .1s ease-in-out;
34
+ }
35
+ }
36
+ }
assets/css/admin-settings-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}.everest-forms_page_evf-settings #wpcontent{padding-right:0}*{box-sizing:border-box}.everest-forms{margin:0;background-color:#f9fafc}.everest-forms .evf-nav-tab-wrapper{padding:0;margin:0;list-style:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-bottom:none transparent;background-color:#7f5aec}.everest-forms .evf-nav-tab-wrapper a.nav-tab{border:none transparent;background-color:transparent;margin-right:0;font-size:12px;line-height:24px;color:#fff;padding:10px 30px;display:block;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out}.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons,.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons-before:before{display:block;font-size:32px;width:auto;height:auto}.everest-forms .evf-nav-tab-wrapper a.nav-tab.nav-tab-active{background-color:#f9fafc;color:#575757}.everest-forms .evf-nav-tab-wrapper a.nav-tab:focus{box-shadow:0 0 0 0 transparent}.everest-forms .nav-tab.nav-tab-active:focus{box-shadow:none}.everest-forms p.submit{padding-right:30px;padding-left:30px}.everest-forms p.submit .everest-forms-save-button{padding:10px 20px;height:auto;border-radius:0;border:0 transparent;text-shadow:0 0 0 transparent;box-shadow:0 0 0 0 transparent;background:#8ce99a;-webkit-transition:.5s background ease-in-out;transition:.5s background ease-in-out}.everest-forms p.submit .everest-forms-save-button:hover{background:#7f5aec}.everest-forms .evf-setting-tab-content{display:none;padding:30px}.everest-forms .evf-setting-tab-content h2{margin-top:0;color:#292929}.everest-forms .evf-setting-tab-content .form-table{margin-top:0;border-top:1px solid #efefef}.everest-forms .evf-setting-tab-content.active{display:block}.everest-forms .evf-setting-tab-content label{font-size:12px;color:#575757}.everest-forms .evf-setting-tab-content textarea{height:100px}.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) input,.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) select,.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) textarea{border-color:#d5d9e2;padding:10px;box-shadow:0 0 0 0 transparent;color:#555;height:45px;border-radius:3px;width:100%;min-width:100%!important}@media screen and (max-width:782px){.everest-forms .evf-setting-tab-content .form-table th{padding-top:15px;padding-bottom:15px}}@media screen and (max-width:480px){.everest-forms .evf-nav-tab-wrapper a.nav-tab{padding:10px}.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons,.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons-before:before{display:none}}
assets/css/admin-settings.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}.everest-forms_page_evf-settings #wpcontent{padding-left:0}*{box-sizing:border-box}.everest-forms{margin:0;background-color:#f9fafc}.everest-forms .evf-nav-tab-wrapper{padding:0;margin:0;list-style:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-bottom:none transparent;background-color:#7f5aec}.everest-forms .evf-nav-tab-wrapper a.nav-tab{border:none transparent;background-color:transparent;margin-left:0;font-size:12px;line-height:24px;color:#fff;padding:10px 30px;display:block;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out}.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons,.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons-before:before{display:block;font-size:32px;width:auto;height:auto}.everest-forms .evf-nav-tab-wrapper a.nav-tab.nav-tab-active{background-color:#f9fafc;color:#575757}.everest-forms .evf-nav-tab-wrapper a.nav-tab:focus{box-shadow:0 0 0 0 transparent}.everest-forms .nav-tab.nav-tab-active:focus{box-shadow:none}.everest-forms p.submit{padding-left:30px;padding-right:30px}.everest-forms p.submit .everest-forms-save-button{padding:10px 20px;height:auto;border-radius:0;border:0 transparent;text-shadow:0 0 0 transparent;box-shadow:0 0 0 0 transparent;background:#8ce99a;-webkit-transition:.5s background ease-in-out;transition:.5s background ease-in-out}.everest-forms p.submit .everest-forms-save-button:hover{background:#7f5aec}.everest-forms .evf-setting-tab-content{display:none;padding:30px}.everest-forms .evf-setting-tab-content h2{margin-top:0;color:#292929}.everest-forms .evf-setting-tab-content .form-table{margin-top:0;border-top:1px solid #efefef}.everest-forms .evf-setting-tab-content.active{display:block}.everest-forms .evf-setting-tab-content label{font-size:12px;color:#575757}.everest-forms .evf-setting-tab-content textarea{height:100px}.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) input,.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) select,.everest-forms .evf-setting-tab-content .forminp:not(.forminp-tinymce) textarea{border-color:#d5d9e2;padding:10px;box-shadow:0 0 0 0 transparent;color:#555;height:45px;border-radius:3px;width:100%;min-width:100%!important}@media screen and (max-width:782px){.everest-forms .evf-setting-tab-content .form-table th{padding-top:15px;padding-bottom:15px}}@media screen and (max-width:480px){.everest-forms .evf-nav-tab-wrapper a.nav-tab{padding:10px}.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons,.everest-forms .evf-nav-tab-wrapper a.nav-tab .dashicons-before:before{display:none}}
assets/css/admin-settings.scss ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "scss/colors";
2
+ @import "scss/clearings";
3
+
4
+ .everest-forms_page_evf-settings {
5
+ #wpcontent {
6
+ padding-left: 0;
7
+ }
8
+ }
9
+
10
+ *{
11
+ box-sizing: border-box;
12
+ }
13
+ .everest-forms {
14
+ margin: 0;
15
+ background-color: $color-whitesmoke;
16
+
17
+ .evf-nav-tab-wrapper {
18
+ padding: 0;
19
+ margin: 0;
20
+ list-style: none;
21
+ display: flex;
22
+ border-bottom: none transparent;
23
+ background-color: $color-brand-secondary;
24
+
25
+ a.nav-tab {
26
+ border: none transparent;
27
+ background-color: transparent;
28
+ margin-left: 0;
29
+ font-size: 12px;
30
+ line-height: 24px;
31
+ color: $color-white;
32
+ padding: 10px 30px;
33
+ display: block;
34
+ cursor: pointer;
35
+ transition: 0.5s background-color ease-in-out;
36
+
37
+ .dashicons,
38
+ .dashicons-before:before {
39
+ display: block;
40
+ font-size: 32px;
41
+ width: auto;
42
+ height: auto;
43
+ }
44
+ &.nav-tab-active {
45
+ background-color: $color-whitesmoke;
46
+ color: $color-gray-darker;
47
+ }
48
+ &:focus {
49
+ box-shadow:0 0 0 0 transparent;
50
+ }
51
+ }
52
+ }
53
+
54
+ .nav-tab.nav-tab-active:focus {
55
+ box-shadow: none;
56
+ }
57
+
58
+
59
+ p.submit {
60
+ padding-left: 30px;
61
+ padding-right: 30px;
62
+
63
+ .everest-forms-save-button {
64
+ padding: 10px 20px;
65
+ height: auto;
66
+ border-radius: 0;
67
+ border: 0 transparent;
68
+ text-shadow: 0 0 0 transparent;
69
+ box-shadow: 0 0 0 0 transparent;
70
+ background: $submit-color;
71
+ transition: 0.5s background ease-in-out;
72
+
73
+ &:hover {
74
+ background: $color-brand-secondary;
75
+ }
76
+ }
77
+ }
78
+ .evf-setting-tab-content {
79
+ display: none;
80
+ padding: 30px;
81
+
82
+ h2 {
83
+ margin-top: 0;
84
+ color: $color-gray-more-darken;
85
+ }
86
+
87
+ .form-table {
88
+ margin-top: 0;
89
+ border-top: 1px solid $color-white-darken;
90
+ }
91
+
92
+ &.active {
93
+ display: block;
94
+ }
95
+
96
+ label {
97
+ font-size: 12px;
98
+ color:$color-gray-darker;
99
+ }
100
+
101
+ textarea {
102
+ height: 100px;
103
+ }
104
+
105
+ .forminp:not(.forminp-tinymce) {
106
+ input,
107
+ select,
108
+ textarea {
109
+ border-color: $border-color;
110
+ padding:10px;
111
+ box-shadow: 0 0 0 0 transparent;
112
+ color: #555;
113
+ height:45px;
114
+ border-radius:3px;
115
+ width: 100%;
116
+ min-width: 100% !important;
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ @media screen and (max-width: 782px) {
123
+ .everest-forms .evf-setting-tab-content .form-table th {
124
+ padding-top: 15px;
125
+ padding-bottom: 15px;
126
+ }
127
+ }
128
+
129
+ @media screen and (max-width: 480px) {
130
+ .everest-forms .evf-nav-tab-wrapper a.nav-tab {
131
+ padding: 10px;
132
+
133
+ .dashicons,
134
+ .dashicons-before:before {
135
+ display: none;
136
+ }
137
+ }
138
+ }
assets/css/everest-builder-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}body{margin:0}*{box-sizing:border-box}.everest-forms_page_edit-evf-form #wpcontent{padding-right:0}.everest-forms-add-fields-group .handlediv,.everest-forms-field-option-group .handlediv{float:left}.everest-forms-add-fields-group .handlediv::before,.everest-forms-field-option-group .handlediv::before{content:'\f142'!important;cursor:pointer;display:inline-block;font:400 20px/1 Dashicons;line-height:.5!important;padding:4px;position:relative;left:0;top:0}.everest-forms-add-fields-group.closed .handlediv::before,.everest-forms-field-option-group.closed .handlediv::before{content:'\f140'!important}#everest-forms-builder{margin:0}#everest-forms-builder .evf-builder-tabs{background-color:#7f5aec}#everest-forms-builder a{text-decoration:none}#everest-forms-builder a:focus{outline:0;box-shadow:0 0 0 transparent}#everest-forms-builder .evf-tab-lists{padding:0;margin:0;float:right;list-style:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-lists li{margin-bottom:0}#everest-forms-builder .evf-tab-lists li a{font-size:12px;line-height:24px;color:#fff;padding:10px 30px;display:block;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out}#everest-forms-builder .evf-tab-lists li a.active,#everest-forms-builder .evf-tab-lists li a:hover{color:#575757;background-color:#f9fafc;outline:0}#everest-forms-builder .evf-tab-lists li a:focus{outline:0}#everest-forms-builder .evf-tab-lists li .dashicons{display:block;font-size:32px;width:auto;height:auto}#everest-forms-builder .evf_save_form_action_button{float:left;padding:7px 22px;background-color:#fff;color:#000;font-size:12px;text-transform:uppercase;border:0 none;border-radius:100px;margin:20px 20px 0 45px;cursor:pointer}#everest-forms-builder .evf_save_form_action_button:focus{outline:0}#everest-forms-builder .evf-tab-content .everest-forms-panel{width:100%;display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel.active{display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar-content{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar{background-color:#f9fafc;width:30%;border-left:1px solid #ebedf0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields{padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields-heading{display:block;font-size:14px;font-weight:500;margin-bottom:15px;padding-bottom:10px;color:#575757;border-bottom:1px solid #efefef}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields-heading i{float:left;font-size:14px;margin-right:5px;line-height:1.5}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons{margin-left:-1.5%;margin-right:-1.5%;list-style:none;padding:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{margin-right:1.5%;margin-left:1.5%;padding:20px 8px;border:1px solid #ebedf0;width:30.3%;z-index:999;margin-bottom:10px;color:#969696;cursor:pointer;border-radius:2px;font-size:12px;-webkit-transition:.5s color ease-in-out,.5s border-color ease-in-out;transition:.5s color ease-in-out,.5s border-color ease-in-out;text-align:center;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item .dashicons{display:block;margin:0 auto}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover{color:#7ca8eb;border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover .evf-icon{color:inherit}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg{width:40px;height:40px;display:block;margin:0 auto 10px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-3{fill:#414042;-webkit-transition:.5s fill ease-in-out;transition:.5s fill ease-in-out;font-size:7px;font-weight:300}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover{color:#7ca8eb;border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-3{fill:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging{margin:0;border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-3{fill:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox label,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox label{width:auto;padding:0;display:inline-block;vertical-align:top;height:auto}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox input{margin:3px 0 0 5px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options{display:none;background-color:#f0f1f2;height:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group{border-bottom:1px solid #f0f1f2}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row{margin-bottom:15px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row:last-child{margin-bottom:0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row .inline{margin-bottom:0;display:inline-block;vertical-align:top;margin-right:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option{display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group-toggle{background-color:#f9fafc;padding:15px 20px;font-size:14px;font-weight:600;display:block;color:#404040}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group-inner{background-color:#f0f1f2;padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel{background-color:#f0f1f2;padding:15px 20px;font-size:14px;font-weight:600;display:block;color:#404040;border-bottom:3px solid #f0f1f2}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel .everest-forms-toggle-arrow{float:left;font-size:14px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel.active{background-color:#fff;position:relative;color:#7f5aec;border-color:#7f5aec}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel.active::after{position:absolute;content:"";top:0;left:-1px;bottom:0;width:1px;height:100%;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap{background-color:#fff;width:70%;padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-title-desc .everest-forms-form-name{margin-top:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-field-wrapper{padding:0 15px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-field-wrapper.evf-hover{background-color:#d4e3f9}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row{text-align:center}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span{width:40px;height:40px;line-height:30px;padding:5px;color:#fff;background-color:#969696;border-radius:5px;cursor:pointer;-webkit-transition:.5s ease-in-out background-color;transition:.5s ease-in-out background-color;margin-bottom:20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:active,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:focus,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:hover{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row{background-color:transparent;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:0 -15px 30px;position:relative;border:1px solid transparent;-webkit-transition:.5s border,.5s background-color;transition:.5s border,.5s background-color}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:last-child{margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row{background-color:#8ce99a;color:#fff;position:absolute;left:0;top:0;z-index:9999;visibility:hidden;opacity:0;-webkit-transition:.7s all;transition:.7s all;padding:5px 10px;cursor:pointer}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-show-grid{display:inline-block;font-size:12px;letter-spacing:1px;font-weight:600;text-transform:uppercase}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-delete-row{display:inline-block;padding-left:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-delete-row span{font-size:14px;height:auto;line-height:1.2;color:#d9534f}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content{display:none;position:absolute;width:200px;padding:30px;text-align:center;left:-20px;border-radius:11px;background-color:#fff;font-weight:600;font-size:12px;top:40px;box-shadow:0 0 39px rgba(0,0,0,.1);-webkit-transition:.9s background-color;transition:.9s background-color}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content::before{top:-5px;content:"";left:45px;border-left:6px solid transparent;border-bottom:6px solid #fff;border-right:6px solid transparent;position:absolute}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content>span{color:#575757;display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content small{color:#c6ccd7;margin-bottom:10px;display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector{height:30px;width:40px;border:1px solid #d6d8da;display:inline-block;margin:3px;border-radius:3px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span{height:100%;display:inline-block;background:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span:nth-child(n+1){border-right:1px solid #d6d8da}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span:nth-child(1){border-right:0 none}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector.active{border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector.active span{border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover{background-color:#f7fafc;border:1px dashed #5d96ee}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover .evf-admin-grid{border:1px dashed #bdbdbd}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover .evf-toggle-row{opacity:1;visibility:visible}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid{background:#fff;min-height:200px;margin:15px;padding:5px;border:1px solid transparent;-webkit-transition:.5s border,.5s background-color;transition:.5s border,.5s background-color;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover{border:1px dashed #bdbdbd}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover.evf-item-hover{position:relative;box-shadow:0 0 5px rgba(0,100,251,.5)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover.evf-item-hover::after{position:absolute;content:"";top:-1px;right:-1px;left:-1px;width:auto;height:15px;background-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-1{width:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-2{width:50%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-3{width:30%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid .evf-registered-item{padding:20px;font-size:18px;text-align:right}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid .evf-registered-item .dashicons{font-size:22px;margin-top:3px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-empty-grid{border:1px dashed #bdbdbd;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-empty-grid:before{position:absolute;margin:auto;content:"\f132";font-size:40px;display:block;font-family:dashicons;-webkit-transform:translate(50%,-50%);-ms-transform:translate(50%,-50%);transform:translate(50%,-50%);right:50%;top:50%;color:#d6d8da}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field{margin-bottom:30px;padding:15px;position:relative;box-shadow:0 0 15px transparent;-webkit-transition:.5s box-shadow;transition:.5s box-shadow}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:last-child{margin-bottom:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--first,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--last{width:48.5%;margin-left:3%;float:right}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--last{margin-left:0;float:left}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action{position:absolute;top:10px;left:5px;visibility:hidden;opacity:0;-webkit-transition:.5s all;transition:.5s all}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action a{color:#7ca8eb;margin-right:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action a.everest-forms-field-delete:hover{color:#d9534f}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:hover{box-shadow:0 0 15px rgba(0,0,0,.1)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:hover .evf-field-action{visibility:visible;opacity:1}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper{box-shadow:-1px 5px 35px rgba(0,0,0,.2);padding:20px 30px;height:auto!important;right:-20px;left:-20px;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper::before{position:absolute;right:0;top:0;width:5px;height:100%;background-color:#7f5aec;content:""}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper:hover .evf-field-action{display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader{width:100%;border:2px dashed #d5d9e2;background-color:#fbfdfe;border-radius:3px;cursor:pointer;text-align:center;padding-top:30px;padding-bottom:30px;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader svg{width:30px;height:30px;fill:#bbbcbd;margin-bottom:20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader input.file-input{-ms-touch-action:manipulation;touch-action:manipulation;max-width:100%;min-width:14px;margin:0;opacity:0;height:18px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .drop{display:block;font-size:14px;font-weight:600;color:#969696;margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .or{font-size:12px;color:#bdbdbd;font-weight:500;display:block;margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .file-control{position:absolute;bottom:30px;color:#5d96ee;padding-bottom:2px;display:block;right:0;left:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .file-control::before{content:"";width:45px;background-color:#5d96ee;height:1px;display:block;right:50%;bottom:-2px;position:absolute;-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .publishing-action{width:100%;text-align:left}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .submit-button{display:inline-block;font-size:12px;font-weight:600;color:#fff;padding:15px 20px;border:0 none;background-color:#8ce99a;border-radius:3px}#everest-forms-builder .evf-tab-content label{font-size:12px;margin-bottom:15px;color:#575757;display:block;font-weight:600}#everest-forms-builder .evf-tab-content label i{color:#bdbdbd;font-size:16px;line-height:1.2}#everest-forms-builder .evf-tab-content label .required{margin-right:5px}#everest-forms-builder .evf-tab-content input:not(.ed_button),#everest-forms-builder .evf-tab-content select,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area){border:1px solid #d5d9e2;border-radius:3px;height:45px;width:100%;padding:10px 15px;color:#575757;font-size:14px}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox],#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio],#everest-forms-builder .evf-tab-content select[type=checkbox],#everest-forms-builder .evf-tab-content select[type=radio],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]{width:16px;height:16px;background-color:#fff}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio],#everest-forms-builder .evf-tab-content select[type=radio],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]{border-radius:10px}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox]:checked,#everest-forms-builder .evf-tab-content select[type=checkbox]:checked,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox]:checked{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox]:checked::before,#everest-forms-builder .evf-tab-content select[type=checkbox]:checked::before,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox]:checked::before{color:#fff;background-color:transparent}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio]:checked::before,#everest-forms-builder .evf-tab-content select[type=radio]:checked::before,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]:checked::before{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-webkit-input-placeholder,#everest-forms-builder .evf-tab-content select::-webkit-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-webkit-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-moz-placeholder,#everest-forms-builder .evf-tab-content select::-moz-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-moz-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button):-ms-input-placeholder,#everest-forms-builder .evf-tab-content select:-ms-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area):-ms-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-ms-input-placeholder,#everest-forms-builder .evf-tab-content select::-ms-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-ms-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::placeholder,#everest-forms-builder .evf-tab-content select::placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button):focus,#everest-forms-builder .evf-tab-content select:focus,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area):focus{outline:0}#everest-forms-builder .evf-tab-content textarea,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area){height:120px}#everest-forms-builder .evf-tab-content .evf-grid-lists{margin-right:-1.5%;margin-left:1.5%;background-color:#f9fafc;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-content .evf-grid-lists .evf-grid-lists-item{padding-right:1.5%;padding-left:1.5%;background-color:#fff}#everest-forms-builder .evf-tab-content .evf-content-section-title{font-size:24px;font-weight:500;margin-bottom:20px;padding-bottom:20px;line-height:34px;border-bottom:1px solid #efefef}#everest-forms-builder .evf-tab-content .everest-forms-panel-field{margin-bottom:20px}#everest-forms-builder .evf-registered-item{z-index:999;cursor:pointer;border-radius:2px;font-size:12px;text-align:center;margin:0;background-color:#fff;border:1px solid #ebedf0;color:#969696}#everest-forms-builder .evf-registered-item .evf-icon{color:inherit;display:block!important;font-size:32px!important}#everest-forms-builder .evf-registered-item.ui-draggable-dragging{border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;text-align:center!important;font-size:12px!important;box-shadow:0 0 32px rgba(0,0,0,.15)}#everest-forms-builder .evf-choices-list li{clear:both;padding:5px 5px;cursor:pointer}#everest-forms-builder .evf-choices-list li input.value{display:none}#everest-forms-builder .evf-choices-list li input[type=checkbox],#everest-forms-builder .evf-choices-list li input[type=radio]{float:right;margin-top:6px}#everest-forms-builder .evf-choices-list li input[type=text]{height:30px;font-size:12px;width:70%;line-height:12px}#everest-forms-builder .evf-choices-list li a.add,#everest-forms-builder .evf-choices-list li a.remove{margin-top:5px;margin-right:2px;display:inline-block;float:left}#everest-forms-builder .evf-choices-list li:hover{background:#f9f9f9}#everest-forms-builder .everest-forms-field.ui-draggable-dragging{margin:0;border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;background-color:#fff;text-align:center;font-size:12px!important}#everest-forms-builder .everest-forms-field.ui-draggable-dragging .evf-icon{color:inherit;display:block!important;font-size:302x!important}#everest-forms-panel-settings .evf-content-section{display:none}#everest-forms-panel-settings .evf-content-section.active{display:block}.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.evf-cancel-btn,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.evf-confirm-btn,.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.evf-cancel-btn,.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.evf-confirm-btn{padding:7px 15px;background-color:#292929;color:#fff;font-size:12px;text-transform:uppercase;border:0 none;border-radius:5px;cursor:pointer;font-weight:600}@media screen and (max-width:1200px){#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:47%}}@media screen and (max-width:782px){.everest-forms_page_edit-evf-form.auto-fold #wpcontent{padding-right:0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-content-wrap,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar{width:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:30.3%}}@media screen and (max-width:600px){#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap{padding:20px 20px 0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin:0 0 20px;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-1,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-2,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-3{width:auto}}@media screen and (max-width:480px){#everest-forms-builder .evf-tab-lists li a{padding:15px}#everest-forms-builder .evf-tab-lists li .dashicons{font-size:24px}#everest-forms-builder .evf_save_form_action_button{margin:12px 5px 0 15px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:47%}.jconfirm.jconfirm-light .jconfirm-box,.jconfirm.jconfirm-white .jconfirm-box{width:90%!important}}.evf-overlay{height:100%;width:100%;background:0 0;position:absolute;top:0;left:0;right:0;bottom:0;z-index:1000;padding:20px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-right:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-right:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-right:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-right:-5px;border-left-color:#333}#tiptip_holder.tip_left{padding-left:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-right:-7px;border-right-color:#333}#tiptip_content,.chart-tooltip,.evf_error_tip{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code,.chart-tooltip code,.evf_error_tip code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}#tiptip_arrow{right:50%;margin-right:-6px}.evf_error_tip{max-width:20em;line-height:1.8em;position:absolute;white-space:normal;background:#d82223;margin:1.5em -1em 0 1px;z-index:9999999}.evf_error_tip::after{content:'';display:block;border:8px solid #d82223;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;position:absolute;top:-3px;right:50%;margin:-1em -3px 0 0}@font-face{font-family:evf-icon;src:url(../fonts/evf-icon.eot?5fwmb3);src:url(../fonts/evf-icon.eot?5fwmb3#iefix) format("embedded-opentype"),url(../fonts/evf-icon.ttf?5fwmb3) format("truetype"),url(../fonts/evf-icon.woff?5fwmb3) format("woff"),url(../fonts/evf-icon.svg?5fwmb3#evf-icon) format("svg");font-weight:400;font-style:normal}[class*=" evf-icon-"],[class^=evf-icon-]{font-family:evf-icon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.evf-icon-last-name:before{content:"\e900"}.evf-icon-first-name:before{content:"\e901"}.evf-icon-checkbox:before{content:"\e902"}.evf-icon-radio:before{content:"\e903"}.evf-icon-file-upload:before{content:"\e904"}.evf-icon-hidden-field:before{content:"\e90a"}.evf-icon-address:before{content:"\e911"}.evf-icon-phone:before{content:"\e912"}.evf-icon-website:before{content:"\e913"}.evf-icon-number:before{content:"\e914"}.evf-icon-dropdown:before{content:"\e915"}.evf-icon-paragraph:before{content:"\e916"}.evf-icon-multiple-choices:before{content:"\e917"}.evf-icon-date-time:before{content:"\e918"}.evf-icon-email:before{content:"\e919"}.evf-icon-text:before{content:"\e91a"}
assets/css/everest-builder.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}body{margin:0}*{box-sizing:border-box}.everest-forms_page_edit-evf-form #wpcontent{padding-left:0}.everest-forms-add-fields-group .handlediv,.everest-forms-field-option-group .handlediv{float:right}.everest-forms-add-fields-group .handlediv::before,.everest-forms-field-option-group .handlediv::before{content:'\f142'!important;cursor:pointer;display:inline-block;font:400 20px/1 Dashicons;line-height:.5!important;padding:4px;position:relative;right:0;top:0}.everest-forms-add-fields-group.closed .handlediv::before,.everest-forms-field-option-group.closed .handlediv::before{content:'\f140'!important}#everest-forms-builder{margin:0}#everest-forms-builder .evf-builder-tabs{background-color:#7f5aec}#everest-forms-builder a{text-decoration:none}#everest-forms-builder a:focus{outline:0;box-shadow:0 0 0 transparent}#everest-forms-builder .evf-tab-lists{padding:0;margin:0;float:left;list-style:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-lists li{margin-bottom:0}#everest-forms-builder .evf-tab-lists li a{font-size:12px;line-height:24px;color:#fff;padding:10px 30px;display:block;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out}#everest-forms-builder .evf-tab-lists li a.active,#everest-forms-builder .evf-tab-lists li a:hover{color:#575757;background-color:#f9fafc;outline:0}#everest-forms-builder .evf-tab-lists li a:focus{outline:0}#everest-forms-builder .evf-tab-lists li .dashicons{display:block;font-size:32px;width:auto;height:auto}#everest-forms-builder .evf_save_form_action_button{float:right;padding:7px 22px;background-color:#fff;color:#000;font-size:12px;text-transform:uppercase;border:0 none;border-radius:100px;margin:20px 45px 0 20px;cursor:pointer}#everest-forms-builder .evf_save_form_action_button:focus{outline:0}#everest-forms-builder .evf-tab-content .everest-forms-panel{width:100%;display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel.active{display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar-content{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar{background-color:#f9fafc;width:30%;border-right:1px solid #ebedf0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields{padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields-heading{display:block;font-size:14px;font-weight:500;margin-bottom:15px;padding-bottom:10px;color:#575757;border-bottom:1px solid #efefef}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-add-fields-heading i{float:right;font-size:14px;margin-left:5px;line-height:1.5}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons{margin-right:-1.5%;margin-left:-1.5%;list-style:none;padding:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{margin-left:1.5%;margin-right:1.5%;padding:20px 8px;border:1px solid #ebedf0;width:30.3%;z-index:999;margin-bottom:10px;color:#969696;cursor:pointer;border-radius:2px;font-size:12px;-webkit-transition:.5s color ease-in-out,.5s border-color ease-in-out;transition:.5s color ease-in-out,.5s border-color ease-in-out;text-align:center;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item .dashicons{display:block;margin:0 auto}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover{color:#7ca8eb;border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover .evf-icon{color:inherit}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg{width:40px;height:40px;display:block;margin:0 auto 10px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item svg .cls-3{fill:#414042;-webkit-transition:.5s fill ease-in-out;transition:.5s fill ease-in-out;font-size:7px;font-weight:300}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover{color:#7ca8eb;border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item:hover svg .cls-3{fill:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging{margin:0;border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-1,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-2,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item.ui-draggable-dragging svg .cls-3{fill:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox label,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox label{width:auto;padding:0;display:inline-block;vertical-align:top;height:auto}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-field-option--checkbox input,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting--checkbox input{margin:3px 5px 0 0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options{display:none;background-color:#f0f1f2;height:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group{border-bottom:1px solid #f0f1f2}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row{margin-bottom:15px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row:last-child{margin-bottom:0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-row .inline{margin-bottom:0;display:inline-block;vertical-align:top;margin-left:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option{display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group-toggle{background-color:#f9fafc;padding:15px 20px;font-size:14px;font-weight:600;display:block;color:#404040}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .everest-forms-field-options .everest-forms-field-option-group-inner{background-color:#f0f1f2;padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel{background-color:#f0f1f2;padding:15px 20px;font-size:14px;font-weight:600;display:block;color:#404040;border-bottom:3px solid #f0f1f2}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel .everest-forms-toggle-arrow{float:right;font-size:14px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel.active{background-color:#fff;position:relative;color:#7f5aec;border-color:#7f5aec}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-setting-panel.active::after{position:absolute;content:"";top:0;right:-1px;bottom:0;width:1px;height:100%;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap{background-color:#fff;width:70%;padding:15px 20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-title-desc .everest-forms-form-name{margin-top:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-field-wrapper{padding:0 15px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-field-wrapper.evf-hover{background-color:#d4e3f9}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row{text-align:center}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span{width:40px;height:40px;line-height:30px;padding:5px;color:#fff;background-color:#969696;border-radius:5px;cursor:pointer;-webkit-transition:.5s ease-in-out background-color;transition:.5s ease-in-out background-color;margin-bottom:20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:active,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:focus,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-add-row span:hover{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row{background-color:transparent;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:0 -15px 30px;position:relative;border:1px solid transparent;-webkit-transition:.5s border,.5s background-color;transition:.5s border,.5s background-color}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:last-child{margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row{background-color:#8ce99a;color:#fff;position:absolute;right:0;top:0;z-index:9999;visibility:hidden;opacity:0;-webkit-transition:.7s all;transition:.7s all;padding:5px 10px;cursor:pointer}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-show-grid{display:inline-block;font-size:12px;letter-spacing:1px;font-weight:600;text-transform:uppercase}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-delete-row{display:inline-block;padding-right:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-delete-row span{font-size:14px;height:auto;line-height:1.2;color:#d9534f}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content{display:none;position:absolute;width:200px;padding:30px;text-align:center;right:-20px;border-radius:11px;background-color:#fff;font-weight:600;font-size:12px;top:40px;box-shadow:0 0 39px rgba(0,0,0,.1);-webkit-transition:.9s background-color;transition:.9s background-color}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content::before{top:-5px;content:"";right:45px;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;position:absolute}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content>span{color:#575757;display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content small{color:#c6ccd7;margin-bottom:10px;display:block}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector{height:30px;width:40px;border:1px solid #d6d8da;display:inline-block;margin:3px;border-radius:3px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span{height:100%;display:inline-block;background:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span:nth-child(n+1){border-left:1px solid #d6d8da}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector span:nth-child(1){border-left:0 none}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector.active{border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-toggle-row .evf-toggle-row-content .evf-grid-selector.active span{border-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover{background-color:#f7fafc;border:1px dashed #5d96ee}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover .evf-admin-grid{border:1px dashed #bdbdbd}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row:hover .evf-toggle-row{opacity:1;visibility:visible}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid{background:#fff;min-height:200px;margin:15px;padding:5px;border:1px solid transparent;-webkit-transition:.5s border,.5s background-color;transition:.5s border,.5s background-color;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover{border:1px dashed #bdbdbd}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover.evf-item-hover{position:relative;box-shadow:0 0 5px rgba(0,100,251,.5)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-hover.evf-item-hover::after{position:absolute;content:"";top:-1px;left:-1px;right:-1px;width:auto;height:15px;background-color:#7ca8eb}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-1{width:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-2{width:50%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-3{width:30%}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid .evf-registered-item{padding:20px;font-size:18px;text-align:left}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid .evf-registered-item .dashicons{font-size:22px;margin-top:3px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-empty-grid{border:1px dashed #bdbdbd;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-empty-grid:before{position:absolute;margin:auto;content:"\f132";font-size:40px;display:block;font-family:dashicons;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);left:50%;top:50%;color:#d6d8da}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field{margin-bottom:30px;padding:15px;position:relative;box-shadow:0 0 15px transparent;-webkit-transition:.5s box-shadow;transition:.5s box-shadow}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:last-child{margin-bottom:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--first,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--last{width:48.5%;margin-right:3%;float:left}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.everest-forms-field--last{margin-right:0;float:right}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action{position:absolute;top:10px;right:5px;visibility:hidden;opacity:0;-webkit-transition:.5s all;transition:.5s all}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action a{color:#7ca8eb;margin-left:5px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field .evf-field-action a.everest-forms-field-delete:hover{color:#d9534f}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:hover{box-shadow:0 0 15px rgba(0,0,0,.1)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field:hover .evf-field-action{visibility:visible;opacity:1}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper{box-shadow:1px 5px 35px rgba(0,0,0,.2);padding:20px 30px;height:auto!important;left:-20px;right:-20px;background-color:#fff}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper::before{position:absolute;left:0;top:0;width:5px;height:100%;background-color:#7f5aec;content:""}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .everest-forms-field.ui-sortable-helper:hover .evf-field-action{display:none}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader{width:100%;border:2px dashed #d5d9e2;background-color:#fbfdfe;border-radius:3px;cursor:pointer;text-align:center;padding-top:30px;padding-bottom:30px;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader svg{width:30px;height:30px;fill:#bbbcbd;margin-bottom:20px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader input.file-input{-ms-touch-action:manipulation;touch-action:manipulation;max-width:100%;min-width:14px;margin:0;opacity:0;height:18px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .drop{display:block;font-size:14px;font-weight:600;color:#969696;margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .or{font-size:12px;color:#bdbdbd;font-weight:500;display:block;margin-bottom:10px}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .file-control{position:absolute;bottom:30px;color:#5d96ee;padding-bottom:2px;display:block;left:0;right:0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .file-uploader .file-control::before{content:"";width:45px;background-color:#5d96ee;height:1px;display:block;left:50%;bottom:-2px;position:absolute;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .publishing-action{width:100%;text-align:right}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .submit-button{display:inline-block;font-size:12px;font-weight:600;color:#fff;padding:15px 20px;border:0 none;background-color:#8ce99a;border-radius:3px}#everest-forms-builder .evf-tab-content label{font-size:12px;margin-bottom:15px;color:#575757;display:block;font-weight:600}#everest-forms-builder .evf-tab-content label i{color:#bdbdbd;font-size:16px;line-height:1.2}#everest-forms-builder .evf-tab-content label .required{margin-left:5px}#everest-forms-builder .evf-tab-content input:not(.ed_button),#everest-forms-builder .evf-tab-content select,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area){border:1px solid #d5d9e2;border-radius:3px;height:45px;width:100%;padding:10px 15px;color:#575757;font-size:14px}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox],#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio],#everest-forms-builder .evf-tab-content select[type=checkbox],#everest-forms-builder .evf-tab-content select[type=radio],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]{width:16px;height:16px;background-color:#fff}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio],#everest-forms-builder .evf-tab-content select[type=radio],#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]{border-radius:10px}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox]:checked,#everest-forms-builder .evf-tab-content select[type=checkbox]:checked,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox]:checked{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=checkbox]:checked::before,#everest-forms-builder .evf-tab-content select[type=checkbox]:checked::before,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=checkbox]:checked::before{color:#fff;background-color:transparent}#everest-forms-builder .evf-tab-content input:not(.ed_button)[type=radio]:checked::before,#everest-forms-builder .evf-tab-content select[type=radio]:checked::before,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)[type=radio]:checked::before{background-color:#7ca8eb}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-webkit-input-placeholder,#everest-forms-builder .evf-tab-content select::-webkit-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-webkit-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-moz-placeholder,#everest-forms-builder .evf-tab-content select::-moz-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-moz-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button):-ms-input-placeholder,#everest-forms-builder .evf-tab-content select:-ms-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area):-ms-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::-ms-input-placeholder,#everest-forms-builder .evf-tab-content select::-ms-input-placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::-ms-input-placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button)::placeholder,#everest-forms-builder .evf-tab-content select::placeholder,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area)::placeholder{color:#c6ccd7}#everest-forms-builder .evf-tab-content input:not(.ed_button):focus,#everest-forms-builder .evf-tab-content select:focus,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area):focus{outline:0}#everest-forms-builder .evf-tab-content textarea,#everest-forms-builder .evf-tab-content textarea:not(.wp-editor-area){height:120px}#everest-forms-builder .evf-tab-content .evf-grid-lists{margin-left:-1.5%;margin-right:1.5%;background-color:#f9fafc;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#everest-forms-builder .evf-tab-content .evf-grid-lists .evf-grid-lists-item{padding-left:1.5%;padding-right:1.5%;background-color:#fff}#everest-forms-builder .evf-tab-content .evf-content-section-title{font-size:24px;font-weight:500;margin-bottom:20px;padding-bottom:20px;line-height:34px;border-bottom:1px solid #efefef}#everest-forms-builder .evf-tab-content .everest-forms-panel-field{margin-bottom:20px}#everest-forms-builder .evf-registered-item{z-index:999;cursor:pointer;border-radius:2px;font-size:12px;text-align:center;margin:0;background-color:#fff;border:1px solid #ebedf0;color:#969696}#everest-forms-builder .evf-registered-item .evf-icon{color:inherit;display:block!important;font-size:32px!important}#everest-forms-builder .evf-registered-item.ui-draggable-dragging{border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;text-align:center!important;font-size:12px!important;box-shadow:0 0 32px rgba(0,0,0,.15)}#everest-forms-builder .evf-choices-list li{clear:both;padding:5px 5px;cursor:pointer}#everest-forms-builder .evf-choices-list li input.value{display:none}#everest-forms-builder .evf-choices-list li input[type=checkbox],#everest-forms-builder .evf-choices-list li input[type=radio]{float:left;margin-top:6px}#everest-forms-builder .evf-choices-list li input[type=text]{height:30px;font-size:12px;width:70%;line-height:12px}#everest-forms-builder .evf-choices-list li a.add,#everest-forms-builder .evf-choices-list li a.remove{margin-top:5px;margin-left:2px;display:inline-block;float:right}#everest-forms-builder .evf-choices-list li:hover{background:#f9f9f9}#everest-forms-builder .everest-forms-field.ui-draggable-dragging{margin:0;border:1px solid #7ca8eb;width:105px!important;color:#7ca8eb;background-color:#fff;text-align:center;font-size:12px!important}#everest-forms-builder .everest-forms-field.ui-draggable-dragging .evf-icon{color:inherit;display:block!important;font-size:302x!important}#everest-forms-panel-settings .evf-content-section{display:none}#everest-forms-panel-settings .evf-content-section.active{display:block}.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.evf-cancel-btn,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.evf-confirm-btn,.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.evf-cancel-btn,.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.evf-confirm-btn{padding:7px 15px;background-color:#292929;color:#fff;font-size:12px;text-transform:uppercase;border:0 none;border-radius:5px;cursor:pointer;font-weight:600}@media screen and (max-width:1200px){#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:47%}}@media screen and (max-width:782px){.everest-forms_page_edit-evf-form.auto-fold #wpcontent{padding-left:0}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-content-wrap,#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar{width:100%}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:30.3%}}@media screen and (max-width:600px){#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap{padding:20px 20px 0}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin:0 0 20px;position:relative}#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-1,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-2,#everest-forms-builder .evf-tab-content .everest-forms-panel-content-wrap .evf-admin-row .evf-admin-grid.evf-grid-3{width:auto}}@media screen and (max-width:480px){#everest-forms-builder .evf-tab-lists li a{padding:15px}#everest-forms-builder .evf-tab-lists li .dashicons{font-size:24px}#everest-forms-builder .evf_save_form_action_button{margin:12px 15px 0 5px}#everest-forms-builder .evf-tab-content .everest-forms-panel .everest-forms-panel-sidebar .evf-registered-buttons .evf-registered-item{width:47%}.jconfirm.jconfirm-light .jconfirm-box,.jconfirm.jconfirm-white .jconfirm-box{width:90%!important}}.evf-overlay{height:100%;width:100%;background:0 0;position:absolute;top:0;right:0;left:0;bottom:0;z-index:1000;padding:20px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#333}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#333}#tiptip_content,.chart-tooltip,.evf_error_tip{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code,.chart-tooltip code,.evf_error_tip code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}.evf_error_tip{max-width:20em;line-height:1.8em;position:absolute;white-space:normal;background:#d82223;margin:1.5em 1px 0 -1em;z-index:9999999}.evf_error_tip::after{content:'';display:block;border:8px solid #d82223;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent;position:absolute;top:-3px;left:50%;margin:-1em 0 0 -3px}@font-face{font-family:evf-icon;src:url(../fonts/evf-icon.eot?5fwmb3);src:url(../fonts/evf-icon.eot?5fwmb3#iefix) format("embedded-opentype"),url(../fonts/evf-icon.ttf?5fwmb3) format("truetype"),url(../fonts/evf-icon.woff?5fwmb3) format("woff"),url(../fonts/evf-icon.svg?5fwmb3#evf-icon) format("svg");font-weight:400;font-style:normal}[class*=" evf-icon-"],[class^=evf-icon-]{font-family:evf-icon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.evf-icon-last-name:before{content:"\e900"}.evf-icon-first-name:before{content:"\e901"}.evf-icon-checkbox:before{content:"\e902"}.evf-icon-radio:before{content:"\e903"}.evf-icon-file-upload:before{content:"\e904"}.evf-icon-hidden-field:before{content:"\e90a"}.evf-icon-address:before{content:"\e911"}.evf-icon-phone:before{content:"\e912"}.evf-icon-website:before{content:"\e913"}.evf-icon-number:before{content:"\e914"}.evf-icon-dropdown:before{content:"\e915"}.evf-icon-paragraph:before{content:"\e916"}.evf-icon-multiple-choices:before{content:"\e917"}.evf-icon-date-time:before{content:"\e918"}.evf-icon-email:before{content:"\e919"}.evf-icon-text:before{content:"\e91a"}
assets/css/everest-builder.scss ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "scss/colors";
2
+ @import "scss/clearings";
3
+ @import "scss/admin";
4
+ @import "scss/_evf-icon";
5
+
6
+ /*
7
+ #everest-forms-builder {
8
+
9
+ padding: 20px;
10
+ border: 1px solid #e1e1e1;
11
+ .everest-forms-panels-tabs {
12
+
13
+ button {
14
+
15
+ padding: 10px 20px;
16
+ background: #bec8fb;
17
+ -webkit-box-shadow: none;
18
+ -moz-box-shadow: none;
19
+ box-shadow: none;
20
+ border: 0;
21
+ cursor: pointer;
22
+ &.active, &:hover {
23
+
24
+ background: #ddd;
25
+ }
26
+ }
27
+
28
+ }
29
+ .everest-forms-panels {
30
+
31
+ padding: 10px 20px;
32
+ border: 1px solid #e1e1e1;
33
+
34
+ .everest-forms-panel-sidebar {
35
+ width: 400px;
36
+ background: #f9f9f9;
37
+ padding: 10px;
38
+ border: 1px solid #e1e1e1;
39
+ float: left;
40
+ }
41
+
42
+ .everest-forms-panel-content-wrap {
43
+
44
+ padding: 10px;
45
+
46
+ float: right;
47
+ width: 500px;
48
+ background: #f9f9f9;
49
+ }
50
+ .everest-forms-panel {
51
+ display: none;
52
+ &.active {
53
+ display: block;
54
+ }
55
+ }
56
+
57
+ .everest-forms-field-options {
58
+ display: none;
59
+ }
60
+ }
61
+
62
+ }
63
+
64
+ .everest-forms-panel-content-wrap {
65
+
66
+ .everest-forms-preview {
67
+
68
+ background: #f1f1f1;
69
+
70
+ }
71
+ }
72
+
73
+ .evf-admin-row {
74
+
75
+ position: relative;
76
+ padding: 20px;
77
+
78
+ .evf-admin-grid {
79
+
80
+ position: relative;
81
+ width: 45%;
82
+ float: left;
83
+ border: 1px solid #e1e1e1;
84
+ background: green;
85
+ min-height: 100px;
86
+
87
+ &:nth-of-type(2) {
88
+ background: blue;
89
+ float: right;
90
+
91
+ }
92
+ }
93
+ .evf-toggle-row {
94
+ width: 100px;
95
+ float: right;
96
+ padding: 10px;
97
+ background: #999;
98
+ color: #fff;
99
+ .evf-toggle-row-content {
100
+ display: none;
101
+ .evf-grid-selector {
102
+ height: 20px;
103
+ width: 20px;
104
+ background: #6aabff;
105
+
106
+ padding: 2px;
107
+ float: left;
108
+ margin: 3px;
109
+ span {
110
+ height: 100%;
111
+ display: block;
112
+ float: left;
113
+ background: #fff;
114
+ border-radius: 2px;
115
+ }
116
+ }
117
+ }
118
+
119
+ }
120
+ }
121
+ */
assets/css/everest-forms-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}*{box-sizing:border-box}.everest-forms .evf-frontend-row{margin-right:-20px;margin-left:-20px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.everest-forms .evf-frontend-row .evf-frontend-grid{padding-right:20px;padding-left:20px;margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-1{width:100%}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-2{width:50%}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-3{width:30%}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field{margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field:last-child{margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul{margin:0;padding:0;list-style:none}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li{display:inline-block;margin-left:20px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li label{display:inline-block;vertical-align:middle;margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input[type=checkbox],.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input[type=radio]{margin-left:8px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li label{font-weight:500}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid label{color:#d9534f}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid .select2-container,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid input.input-text,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid select,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid textarea{border-color:#d9534f}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated .select2-container,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated input.input-text,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated select,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated textarea{border-color:#5cb85c}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ::-webkit-input-placeholder{line-height:normal}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field :-moz-placeholder{line-height:normal}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field :-ms-input-placeholder{line-height:normal}.everest-forms .evf-frontend-row label{font-size:14px;margin-bottom:20px;color:#575757;display:block;font-weight:600}.everest-forms .evf-frontend-row label .required{color:red;font-weight:700;border:0}.everest-forms .evf-frontend-row label.evf-error{border:1px solid #d9534f;background-color:#f9e2e2;padding:7px 10px;color:#c9302c;display:inline-block;margin-top:15px;margin-bottom:0;border-radius:3px;font-weight:300}.everest-forms .evf-frontend-row input,.everest-forms .evf-frontend-row select,.everest-forms .evf-frontend-row textarea{border:1px solid #969696;height:45px;width:100%;padding:10px 15px;color:#575757;font-size:14px;margin-bottom:0;background-color:transparent;box-shadow:0 0 0 0 transparent;border-radius:0}.everest-forms .evf-frontend-row input[type=checkbox],.everest-forms .evf-frontend-row input[type=radio],.everest-forms .evf-frontend-row select[type=checkbox],.everest-forms .evf-frontend-row select[type=radio],.everest-forms .evf-frontend-row textarea[type=checkbox],.everest-forms .evf-frontend-row textarea[type=radio]{width:14px;height:14px;background-color:#fff}.everest-forms .evf-frontend-row input[type=radio],.everest-forms .evf-frontend-row select[type=radio],.everest-forms .evf-frontend-row textarea[type=radio]{border-radius:10px}.everest-forms .evf-frontend-row input[type=checkbox]:checked,.everest-forms .evf-frontend-row select[type=checkbox]:checked,.everest-forms .evf-frontend-row textarea[type=checkbox]:checked{background-color:#7ca8eb}.everest-forms .evf-frontend-row input[type=checkbox]:checked::before,.everest-forms .evf-frontend-row select[type=checkbox]:checked::before,.everest-forms .evf-frontend-row textarea[type=checkbox]:checked::before{color:#fff;background-color:transparent}.everest-forms .evf-frontend-row input[type=radio]:checked::before,.everest-forms .evf-frontend-row select[type=radio]:checked::before,.everest-forms .evf-frontend-row textarea[type=radio]:checked::before{background-color:#7ca8eb}.everest-forms .evf-frontend-row input::-webkit-input-placeholder,.everest-forms .evf-frontend-row select::-webkit-input-placeholder,.everest-forms .evf-frontend-row textarea::-webkit-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::-moz-placeholder,.everest-forms .evf-frontend-row select::-moz-placeholder,.everest-forms .evf-frontend-row textarea::-moz-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input:-ms-input-placeholder,.everest-forms .evf-frontend-row select:-ms-input-placeholder,.everest-forms .evf-frontend-row textarea:-ms-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::-ms-input-placeholder,.everest-forms .evf-frontend-row select::-ms-input-placeholder,.everest-forms .evf-frontend-row textarea::-ms-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::placeholder,.everest-forms .evf-frontend-row select::placeholder,.everest-forms .evf-frontend-row textarea::placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input:focus,.everest-forms .evf-frontend-row select:focus,.everest-forms .evf-frontend-row textarea:focus{outline:0;border:1px solid #7ca8eb}.everest-forms .evf-frontend-row textarea{height:100px}.everest-forms .evf-submit-container{margin-top:30px;text-align:left}.everest-forms .evf-submit{padding:15px 30px;font-size:12px;border:0 none;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out;border-radius:0}.everest-forms .layout-two label{margin-bottom:0}.everest-forms .layout-two .evf-field-checkbox label,.everest-forms .layout-two .evf-field-radio label{margin-bottom:20px}.everest-forms .layout-two input,.everest-forms .layout-two select,.everest-forms .layout-two textarea{border-top:none transparent;border-left:none transparent;border-right:none transparent;border-bottom:1px solid #969696;height:40px;padding:10px 0;background-color:transparent}.everest-forms .layout-two input:focus,.everest-forms .layout-two select:focus,.everest-forms .layout-two textarea:focus{border-top:none transparent;border-left:none transparent;border-right:none transparent}.everest-forms .layout-two textarea{height:80px}.everest-forms .everest-forms-notice{padding:1em 3em;margin:0 0 2em;position:relative;background-color:#7ca8eb;color:#fff;border-radius:5px}.everest-forms .everest-forms-notice::after,.everest-forms .everest-forms-notice::before{content:' ';display:table}.everest-forms .everest-forms-notice::after{clear:both}.everest-forms .everest-forms-notice::before{font-family:dashicons;content:"\f348";position:absolute;top:1em;right:1.5em;color:inherit}.everest-forms .everest-forms-notice .button{float:left}.everest-forms .everest-forms-notice li{list-style:none outside!important;padding-right:0!important;margin-right:0!important}.everest-forms .everest-forms-notice--success{background-color:#5cb85c}.everest-forms .everest-forms-notice--success::before{content:"\f147"}.everest-forms .everest-forms-notice--error{background-color:#d9534f}.everest-forms .everest-forms-notice--error::before{content:"\f534";color:inherit}.everest-forms .everest-forms-notice--error .everest-forms-notice-list{margin:0;list-style:none outside}.everest-forms .everest-forms-notice--error .everest-forms-notice-list .everest-forms-notice-list__item{margin-bottom:.5em}.everest-forms .everest-forms-notice--error .everest-forms-notice-list .everest-forms-notice-list__item:last-child{margin-bottom:0}@media screen and (max-width:768px){.everest-forms .evf-frontend-row{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.everest-forms .evf-frontend-row .evf-frontend-grid{margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid:last-child{margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-2,.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-3{width:100%}}
assets/css/everest-forms.css ADDED
@@ -0,0 +1 @@
 
1
+ .clearfix::after,.clearfix::before,.container-fluid::after,.container-fluid::before,.container::after,.container::before,.tg-row::after,.tg-row::before{display:table;content:""}.clearfix::after,.container-fluid::after,.container::after,.tg-row::after{clear:both}*{box-sizing:border-box}.everest-forms .evf-frontend-row{margin-left:-20px;margin-right:-20px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.everest-forms .evf-frontend-row .evf-frontend-grid{padding-left:20px;padding-right:20px;margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-1{width:100%}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-2{width:50%}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-3{width:30%}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field{margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field:last-child{margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul{margin:0;padding:0;list-style:none}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li{display:inline-block;margin-right:20px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li label{display:inline-block;vertical-align:middle;margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input[type=checkbox],.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li input[type=radio]{margin-right:8px}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ul li label{font-weight:500}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid label{color:#d9534f}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid .select2-container,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid input.input-text,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid select,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-invalid textarea{border-color:#d9534f}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated .select2-container,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated input.input-text,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated select,.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field.everest-forms-validated textarea{border-color:#5cb85c}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field ::-webkit-input-placeholder{line-height:normal}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field :-moz-placeholder{line-height:normal}.everest-forms .evf-frontend-row .evf-frontend-grid .evf-field :-ms-input-placeholder{line-height:normal}.everest-forms .evf-frontend-row label{font-size:14px;margin-bottom:20px;color:#575757;display:block;font-weight:600}.everest-forms .evf-frontend-row label .required{color:red;font-weight:700;border:0}.everest-forms .evf-frontend-row label.evf-error{border:1px solid #d9534f;background-color:#f9e2e2;padding:7px 10px;color:#c9302c;display:inline-block;margin-top:15px;margin-bottom:0;border-radius:3px;font-weight:300}.everest-forms .evf-frontend-row input,.everest-forms .evf-frontend-row select,.everest-forms .evf-frontend-row textarea{border:1px solid #969696;height:45px;width:100%;padding:10px 15px;color:#575757;font-size:14px;margin-bottom:0;background-color:transparent;box-shadow:0 0 0 0 transparent;border-radius:0}.everest-forms .evf-frontend-row input[type=checkbox],.everest-forms .evf-frontend-row input[type=radio],.everest-forms .evf-frontend-row select[type=checkbox],.everest-forms .evf-frontend-row select[type=radio],.everest-forms .evf-frontend-row textarea[type=checkbox],.everest-forms .evf-frontend-row textarea[type=radio]{width:14px;height:14px;background-color:#fff}.everest-forms .evf-frontend-row input[type=radio],.everest-forms .evf-frontend-row select[type=radio],.everest-forms .evf-frontend-row textarea[type=radio]{border-radius:10px}.everest-forms .evf-frontend-row input[type=checkbox]:checked,.everest-forms .evf-frontend-row select[type=checkbox]:checked,.everest-forms .evf-frontend-row textarea[type=checkbox]:checked{background-color:#7ca8eb}.everest-forms .evf-frontend-row input[type=checkbox]:checked::before,.everest-forms .evf-frontend-row select[type=checkbox]:checked::before,.everest-forms .evf-frontend-row textarea[type=checkbox]:checked::before{color:#fff;background-color:transparent}.everest-forms .evf-frontend-row input[type=radio]:checked::before,.everest-forms .evf-frontend-row select[type=radio]:checked::before,.everest-forms .evf-frontend-row textarea[type=radio]:checked::before{background-color:#7ca8eb}.everest-forms .evf-frontend-row input::-webkit-input-placeholder,.everest-forms .evf-frontend-row select::-webkit-input-placeholder,.everest-forms .evf-frontend-row textarea::-webkit-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::-moz-placeholder,.everest-forms .evf-frontend-row select::-moz-placeholder,.everest-forms .evf-frontend-row textarea::-moz-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input:-ms-input-placeholder,.everest-forms .evf-frontend-row select:-ms-input-placeholder,.everest-forms .evf-frontend-row textarea:-ms-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::-ms-input-placeholder,.everest-forms .evf-frontend-row select::-ms-input-placeholder,.everest-forms .evf-frontend-row textarea::-ms-input-placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input::placeholder,.everest-forms .evf-frontend-row select::placeholder,.everest-forms .evf-frontend-row textarea::placeholder{color:#c6ccd7}.everest-forms .evf-frontend-row input:focus,.everest-forms .evf-frontend-row select:focus,.everest-forms .evf-frontend-row textarea:focus{outline:0;border:1px solid #7ca8eb}.everest-forms .evf-frontend-row textarea{height:100px}.everest-forms .evf-submit-container{margin-top:30px;text-align:right}.everest-forms .evf-submit{padding:15px 30px;font-size:12px;border:0 none;cursor:pointer;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out;border-radius:0}.everest-forms .layout-two label{margin-bottom:0}.everest-forms .layout-two .evf-field-checkbox label,.everest-forms .layout-two .evf-field-radio label{margin-bottom:20px}.everest-forms .layout-two input,.everest-forms .layout-two select,.everest-forms .layout-two textarea{border-top:none transparent;border-right:none transparent;border-left:none transparent;border-bottom:1px solid #969696;height:40px;padding:10px 0;background-color:transparent}.everest-forms .layout-two input:focus,.everest-forms .layout-two select:focus,.everest-forms .layout-two textarea:focus{border-top:none transparent;border-right:none transparent;border-left:none transparent}.everest-forms .layout-two textarea{height:80px}.everest-forms .everest-forms-notice{padding:1em 3em;margin:0 0 2em;position:relative;background-color:#7ca8eb;color:#fff;border-radius:5px}.everest-forms .everest-forms-notice::after,.everest-forms .everest-forms-notice::before{content:' ';display:table}.everest-forms .everest-forms-notice::after{clear:both}.everest-forms .everest-forms-notice::before{font-family:dashicons;content:"\f348";position:absolute;top:1em;left:1.5em;color:inherit}.everest-forms .everest-forms-notice .button{float:right}.everest-forms .everest-forms-notice li{list-style:none outside!important;padding-left:0!important;margin-left:0!important}.everest-forms .everest-forms-notice--success{background-color:#5cb85c}.everest-forms .everest-forms-notice--success::before{content:"\f147"}.everest-forms .everest-forms-notice--error{background-color:#d9534f}.everest-forms .everest-forms-notice--error::before{content:"\f534";color:inherit}.everest-forms .everest-forms-notice--error .everest-forms-notice-list{margin:0;list-style:none outside}.everest-forms .everest-forms-notice--error .everest-forms-notice-list .everest-forms-notice-list__item{margin-bottom:.5em}.everest-forms .everest-forms-notice--error .everest-forms-notice-list .everest-forms-notice-list__item:last-child{margin-bottom:0}@media screen and (max-width:768px){.everest-forms .evf-frontend-row{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.everest-forms .evf-frontend-row .evf-frontend-grid{margin-bottom:30px}.everest-forms .evf-frontend-row .evf-frontend-grid:last-child{margin-bottom:0}.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-2,.everest-forms .evf-frontend-row .evf-frontend-grid.evf-grid-3{width:100%}}
assets/css/everest-forms.scss ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "scss/colors";
2
+ @import "scss/clearings";
3
+
4
+ *{
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ .everest-forms {
9
+ .evf-frontend-row {
10
+ margin-left: -20px;
11
+ margin-right: -20px;
12
+ display: flex;
13
+ flex-wrap: wrap;
14
+
15
+ .evf-frontend-grid {
16
+ padding-left: 20px;
17
+ padding-right: 20px;
18
+ margin-bottom: 30px;
19
+
20
+ &.evf-grid-1 {
21
+ width: 100%;
22
+ }
23
+
24
+ &.evf-grid-2 {
25
+ width: 50%;
26
+ }
27
+
28
+ &.evf-grid-3 {
29
+ width: 30%;
30
+
31
+ }
32
+
33
+ .evf-field {
34
+ margin-bottom: 30px;
35
+
36
+ &:last-child {
37
+ margin-bottom: 0;
38
+ }
39
+
40
+ ul {
41
+ margin: 0;
42
+ padding: 0;
43
+ list-style: none;
44
+
45
+ li {
46
+ display: inline-block;
47
+ margin-right: 20px;
48
+
49
+ label,
50
+ input {
51
+ display: inline-block;
52
+ vertical-align: middle;
53
+ margin-bottom: 0;
54
+
55
+ }
56
+
57
+ input[type="checkbox"],
58
+ input[type="radio"] {
59
+ margin-right: 8px;
60
+ }
61
+
62
+ label {
63
+
64
+ font-weight: 500;
65
+ }
66
+ }
67
+ }
68
+
69
+ &.everest-forms-invalid {
70
+ label {
71
+ color: $color-alert-danger;
72
+ }
73
+
74
+ .select2-container,
75
+ input.input-text,
76
+ select,
77
+ textarea {
78
+ border-color: $color-alert-danger;
79
+ }
80
+ }
81
+
82
+ &.everest-forms-validated {
83
+ .select2-container,
84
+ input.input-text,
85
+ select,
86
+ textarea {
87
+ border-color: $color-alert-success;
88
+ }
89
+ }
90
+
91
+ ::-webkit-input-placeholder {
92
+ line-height: normal;
93
+ }
94
+
95
+ :-moz-placeholder {
96
+ line-height: normal;
97
+ }
98
+
99
+ :-ms-input-placeholder {
100
+ line-height: normal;
101
+ }
102
+ }
103
+ }
104
+
105
+ label {
106
+ font-size: 14px;
107
+ margin-bottom: 20px;
108
+ color: $color-gray-darker;
109
+ display: block;
110
+ font-weight: 600;
111
+
112
+ .required {
113
+ color: red;
114
+ font-weight: 700;
115
+ border: 0;
116
+ }
117
+
118
+ &.evf-error {
119
+ border: 1px solid $color-alert-danger;
120
+ background-color: lighten($color-alert-danger, 35%);
121
+ padding: 7px 10px;
122
+ color:darken($color-alert-danger, 10%);
123
+ display: inline-block;
124
+ margin-top: 15px;
125
+ margin-bottom: 0;
126
+ border-radius: 3px;
127
+ font-weight: 300;
128
+ }
129
+ }
130
+
131
+ input,
132
+ select,
133
+ textarea {
134
+ border: 1px solid $color-gray;
135
+ height: 45px;
136
+ width: 100%;
137
+ padding: 10px 15px;
138
+ color: $color-gray-darker;;
139
+ font-size: 14px;
140
+ margin-bottom: 0;
141
+ background-color: transparent;
142
+ box-shadow: 0 0 0 0 transparent;
143
+ border-radius: 0;
144
+
145
+ &[type="checkbox"],
146
+ &[type="radio"] {
147
+ width: 14px;
148
+ height: 14px;
149
+ background-color: $color-white;
150
+
151
+ }
152
+
153
+ &[type="radio"] {
154
+ border-radius: 10px;
155
+ }
156
+
157
+ &[type="checkbox"]:checked {
158
+ background-color: $color-brand-primary;
159
+
160
+ &::before {
161
+ color: $color-white;
162
+ background-color: transparent;
163
+ }
164
+ }
165
+
166
+ &[type="radio"]:checked {
167
+ &::before {
168
+ background-color: $color-brand-primary;
169
+ }
170
+ }
171
+
172
+ &::placeholder {
173
+ color: $input-color;
174
+ }
175
+
176
+ &:focus {
177
+ outline: none;
178
+ border: 1px solid $color-brand-primary;
179
+ }
180
+ }
181
+
182
+ textarea {
183
+ height: 100px;
184
+ }
185
+ }
186
+
187
+ .evf-submit-container {
188
+ margin-top: 30px;
189
+ text-align: right;
190
+ }
191
+
192
+ .evf-submit {
193
+ padding: 15px 30px;
194
+ font-size: 12px;
195
+ border: 0 none;
196
+ cursor: pointer;
197
+ transition: .5s background-color ease-in-out;
198
+ border-radius: 0;
199
+ }
200
+
201
+ .layout-two {
202
+ label {
203
+ margin-bottom: 0;
204
+ }
205
+
206
+ .evf-field-checkbox,
207
+ .evf-field-radio {
208
+ label {
209
+ margin-bottom: 20px;
210
+ }
211
+ }
212
+
213
+ input,
214
+ select,
215
+ textarea {
216
+ border-top:none transparent;
217
+ border-right:none transparent;
218
+ border-left:none transparent;
219
+ border-bottom: 1px solid $color-gray;
220
+ height: 40px;
221
+ padding: 10px 0;
222
+ background-color: transparent;
223
+
224
+ &:focus {
225
+ border-top:none transparent;
226
+ border-right:none transparent;
227
+ border-left:none transparent;
228
+ }
229
+ }
230
+
231
+ textarea {
232
+ height: 80px;
233
+ }
234
+ }
235
+ /**
236
+ * Notices.
237
+ */
238
+
239
+ .everest-forms-notice {
240
+ padding: 1em 3em;
241
+ margin: 0 0 2em;
242
+ position: relative;
243
+ background-color: $color-brand-primary;
244
+ color: $color-white;
245
+ border-radius: 5px;
246
+ @include clearfix();
247
+
248
+ &::before {
249
+ font-family: 'dashicons';
250
+ content: "\f348";
251
+ position: absolute;
252
+ top: 1em;
253
+ left: 1.5em;
254
+ color:inherit;
255
+ }
256
+
257
+ .button {
258
+ float: right;
259
+ }
260
+
261
+ li {
262
+ list-style: none outside !important; // Required for default theme compatibility
263
+ padding-left: 0 !important; // Required for default theme compatibility
264
+ margin-left: 0 !important; // Required for default theme compatibility
265
+ }
266
+ }
267
+
268
+ .everest-forms-notice--success {
269
+ background-color: $color-alert-success;
270
+
271
+ &::before {
272
+ content: "\f147";
273
+ }
274
+ }
275
+
276
+ .everest-forms-notice--error {
277
+ background-color: $color-alert-danger;
278
+
279
+ &::before {
280
+ content: "\f534";
281
+ color: inherit;
282
+ }
283
+
284
+ .everest-forms-notice-list {
285
+ margin: 0;
286
+ list-style: none outside;
287
+
288
+ .everest-forms-notice-list__item {
289
+ margin-bottom: .5em;
290
+ }
291
+ .everest-forms-notice-list__item:last-child {
292
+ margin-bottom: 0;
293
+ }
294
+ }
295
+ }
296
+ }
297
+
298
+
299
+ @media screen and (max-width: 768px) {
300
+ .everest-forms {
301
+ .evf-frontend-row {
302
+ flex-direction: column;
303
+
304
+ .evf-frontend-grid {
305
+ margin-bottom: 30px;
306
+
307
+ &:last-child {
308
+ margin-bottom: 0;
309
+ }
310
+
311
+ &.evf-grid-2,
312
+ &.evf-grid-3 {
313
+ width: 100%;
314
+ }
315
+ }
316
+ }
317
+ }
318
+ }
assets/css/evf-add-form-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ #evf-modal-wrap{display:none;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);width:500px;height:220px;overflow:hidden;margin-right:-250px;margin-top:-125px;position:fixed;top:50%;right:50%;z-index:100105;-webkit-transition:height .2s,margin-top .2s;transition:height .2s,margin-top .2s}#evf-modal-backdrop{display:none;position:fixed;top:0;right:0;left:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100100}#evf-modal{position:relative;height:100%}#evf-modal-title{background:#fcfcfc;border-bottom:1px solid #dfdfdf;height:36px;font-size:18px;font-weight:600;line-height:36px;padding:0 16px 0 36px;top:0;left:0;right:0}#evf-modal-close{color:#666;padding:0;position:absolute;top:0;left:0;width:36px;height:36px;text-align:center;background:100% 0;border:none;cevfsor:pointer}#evf-modal-close:before{font:normal 20px/36px dashicons;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:36px;height:36px;content:'\f158'}#evf-modal-close:focus,#evf-modal-close:hover{color:#2ea2cc}#evf-modal-close:focus{outline:0;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}#evf-modal-inner{padding:0 16px 50px}#evf-modal-search-toggle:after{display:inline-block;font:normal 20px/1 dashicons;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:'\f140'}#evf-modal #evf-modal-options{padding:8px 0 12px}#evf-modal #evf-modal-options .evf-modal-inline{display:inline-block;margin:0;padding:0 0 0 20px}#evf-modal-select-form{margin-bottom:1em;max-width:100%}#evf-modal .submitbox{padding:8px 16px;background:#fcfcfc;border-top:1px solid #dfdfdf;position:absolute;bottom:0;right:0;left:0}#evf-modal-cancel{line-height:25px;float:right}#evf-modal-update{line-height:23px;float:left}#evf-modal-submit{float:left;margin-bottom:0}@media screen and (max-width:782px){#evf-modal-wrap{height:280px;margin-top:-140px}#evf-modal-inner{padding:0 16px 60px}#evf-modal-cancel{line-height:32px}}@media screen and (max-width:520px){#evf-modal-wrap{width:auto;margin-right:0;right:10px;left:10px;max-width:500px}}@media screen and (max-height:520px){#evf-modal-wrap{-webkit-transition:none;transition:none}}@media screen and (max-height:290px){#evf-modal-wrap{height:auto;margin-top:0;top:10px;bottom:10px}#evf-modal-inner{overflow:auto;height:calc(100% - 92px);padding-bottom:2px}}
assets/css/evf-add-form.css ADDED
@@ -0,0 +1 @@
 
1
+ #evf-modal-wrap{display:none;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);width:500px;height:220px;overflow:hidden;margin-left:-250px;margin-top:-125px;position:fixed;top:50%;left:50%;z-index:100105;-webkit-transition:height .2s,margin-top .2s;transition:height .2s,margin-top .2s}#evf-modal-backdrop{display:none;position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100100}#evf-modal{position:relative;height:100%}#evf-modal-title{background:#fcfcfc;border-bottom:1px solid #dfdfdf;height:36px;font-size:18px;font-weight:600;line-height:36px;padding:0 36px 0 16px;top:0;right:0;left:0}#evf-modal-close{color:#666;padding:0;position:absolute;top:0;right:0;width:36px;height:36px;text-align:center;background:0 0;border:none;cevfsor:pointer}#evf-modal-close:before{font:normal 20px/36px dashicons;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:36px;height:36px;content:'\f158'}#evf-modal-close:focus,#evf-modal-close:hover{color:#2ea2cc}#evf-modal-close:focus{outline:0;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}#evf-modal-inner{padding:0 16px 50px}#evf-modal-search-toggle:after{display:inline-block;font:normal 20px/1 dashicons;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:'\f140'}#evf-modal #evf-modal-options{padding:8px 0 12px}#evf-modal #evf-modal-options .evf-modal-inline{display:inline-block;margin:0;padding:0 20px 0 0}#evf-modal-select-form{margin-bottom:1em;max-width:100%}#evf-modal .submitbox{padding:8px 16px;background:#fcfcfc;border-top:1px solid #dfdfdf;position:absolute;bottom:0;left:0;right:0}#evf-modal-cancel{line-height:25px;float:left}#evf-modal-update{line-height:23px;float:right}#evf-modal-submit{float:right;margin-bottom:0}@media screen and (max-width:782px){#evf-modal-wrap{height:280px;margin-top:-140px}#evf-modal-inner{padding:0 16px 60px}#evf-modal-cancel{line-height:32px}}@media screen and (max-width:520px){#evf-modal-wrap{width:auto;margin-left:0;left:10px;right:10px;max-width:500px}}@media screen and (max-height:520px){#evf-modal-wrap{-webkit-transition:none;transition:none}}@media screen and (max-height:290px){#evf-modal-wrap{height:auto;margin-top:0;top:10px;bottom:10px}#evf-modal-inner{overflow:auto;height:calc(100% - 92px);padding-bottom:2px}}
assets/css/evf-form-modal-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .evf-backbone-modal *{box-sizing:border-box}.evf-backbone-modal .evf-backbone-modal-content{position:fixed;background:#fff;z-index:100000;right:50%;top:50%;-webkit-transform:translate(50%,-50%);-ms-transform:translate(50%,-50%);transform:translate(50%,-50%);width:500px}.evf-backbone-modal .evf-backbone-modal-content article{overflow:auto}.evf-backbone-modal .select2-container{width:100%!important}.evf-backbone-modal-backdrop{position:fixed;top:0;right:0;left:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:99900}.evf-backbone-modal-main{padding-bottom:55px}.evf-backbone-modal-main article,.evf-backbone-modal-main header{display:block;position:relative}.evf-backbone-modal-main .evf-backbone-modal-header{height:auto;background:#fcfcfc;padding:1em 1.5em;border-bottom:1px solid #ddd}.evf-backbone-modal-main .evf-backbone-modal-header h1{margin:0;font-size:18px;font-weight:700;line-height:1.5em}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link{cursor:pointer;color:#777;height:54px;width:54px;padding:0;position:absolute;top:0;left:0;text-align:center;border:0;border-right:1px solid #ddd;background-color:transparent;-webkit-transition:color .1s ease-in-out,background .1s ease-in-out;transition:color .1s ease-in-out,background .1s ease-in-out}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link::before{font:normal 22px/50px dashicons!important;color:#666;display:block;content:'\f335';font-weight:300}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:focus,.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:hover{background:#ddd;border-color:#ccc;color:#000}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:focus{outline:0}.evf-backbone-modal-main article{padding:1.5em}.evf-backbone-modal-main article p{margin:1.5em 0}.evf-backbone-modal-main article p:first-child{margin-top:0}.evf-backbone-modal-main article p:last-child{margin-bottom:0}.evf-backbone-modal-main article .pagination{padding:10px 0 0;text-align:center}.evf-backbone-modal-main footer{position:absolute;right:0;left:0;bottom:0;z-index:100;padding:1em 1.5em;background:#fcfcfc;border-top:1px solid #dfdfdf;box-shadow:0 -4px 4px -4px rgba(0,0,0,.1)}.evf-backbone-modal-main footer .inner{float:left;line-height:23px}.evf-backbone-modal-main footer .inner .button{margin-bottom:0}*{box-sizing:border-box}.everest-forms_page_edit-evf-form #wpcontent{padding-right:0}.everest-forms_page_edit-evf-form .everest-forms{width:600px;margin:100px auto 50px;background-color:#fff;border:1px solid #d6d8da}.everest-forms_page_edit-evf-form .everest-forms span{font-size:12px;margin-bottom:15px;color:#575757;display:inline-block;font-weight:600}.everest-forms_page_edit-evf-form .everest-forms .everest-forms-setup-form-name{padding:15px 20px;border-bottom:1px solid #d6d8da}.everest-forms_page_edit-evf-form .everest-forms .everest-forms-setup-form-name .everest-forms-setup-name{margin-right:40px;padding:10px;height:45px;width:400px}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-title{width:auto;font-size:24px;line-height:34px;font-weight:600;color:#575757;padding:15px 20px 10px}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-title p.desc{font-weight:400}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates{height:290px;display:block;padding:0 20px;text-align:right}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template{width:48%;float:right;display:inline-block;vertical-align:top;position:relative}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template img{width:100%;display:block}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template:nth-child(even){float:left}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay{position:absolute;background-color:rgba(0,0,0,.5);top:0;right:0;left:0;bottom:0;opacity:0;visibility:hidden;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out;color:#fff;text-align:center;padding:40% 0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay .evf-template-select{text-decoration:none}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{background:#fff;-webkit-animation:load1 1s infinite ease-in-out;animation:load1 1s infinite ease-in-out;width:1em;height:4em;padding:0;border-radius:0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button{color:#fff;text-indent:-9999em;margin:0 auto;position:relative;font-size:11px;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation-delay:-.16s;animation-delay:-.16s}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{position:absolute;top:0;content:''}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{right:-1.5em;-webkit-animation-delay:-.32s;animation-delay:-.32s}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after{right:1.5em}@-webkit-keyframes load1{0%,100%,80%{box-shadow:0 0;height:4em}40%{box-shadow:0 -2em;height:5em}}@keyframes load1{0%,100%,80%{box-shadow:0 0;height:4em}40%{box-shadow:0 -2em;height:5em}}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template:hover .evf-template-overlay{opacity:1;visibility:visible}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-button{display:inline-block;padding:15px 22px;background-color:#fff;color:#000;font-size:12px;text-transform:uppercase;border:none;border-radius:100px}@media screen and (max-width:782px){.everest-forms_page_edit-evf-form .everest-forms #everest-forms-setup-name{width:auto}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-desc a{width:200px}}@media screen and (max-width:600px){.everest-forms_page_edit-evf-form .everest-forms{width:100%;margin:20px 0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-desc a{display:block;margin-bottom:30px;text-align:center;width:100%;margin-right:0}}
assets/css/evf-form-modal.css ADDED
@@ -0,0 +1 @@
 
1
+ .evf-backbone-modal *{box-sizing:border-box}.evf-backbone-modal .evf-backbone-modal-content{position:fixed;background:#fff;z-index:100000;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:500px}.evf-backbone-modal .evf-backbone-modal-content article{overflow:auto}.evf-backbone-modal .select2-container{width:100%!important}.evf-backbone-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:99900}.evf-backbone-modal-main{padding-bottom:55px}.evf-backbone-modal-main article,.evf-backbone-modal-main header{display:block;position:relative}.evf-backbone-modal-main .evf-backbone-modal-header{height:auto;background:#fcfcfc;padding:1em 1.5em;border-bottom:1px solid #ddd}.evf-backbone-modal-main .evf-backbone-modal-header h1{margin:0;font-size:18px;font-weight:700;line-height:1.5em}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link{cursor:pointer;color:#777;height:54px;width:54px;padding:0;position:absolute;top:0;right:0;text-align:center;border:0;border-left:1px solid #ddd;background-color:transparent;-webkit-transition:color .1s ease-in-out,background .1s ease-in-out;transition:color .1s ease-in-out,background .1s ease-in-out}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link::before{font:normal 22px/50px dashicons!important;color:#666;display:block;content:'\f335';font-weight:300}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:focus,.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:hover{background:#ddd;border-color:#ccc;color:#000}.evf-backbone-modal-main .evf-backbone-modal-header .modal-close-link:focus{outline:0}.evf-backbone-modal-main article{padding:1.5em}.evf-backbone-modal-main article p{margin:1.5em 0}.evf-backbone-modal-main article p:first-child{margin-top:0}.evf-backbone-modal-main article p:last-child{margin-bottom:0}.evf-backbone-modal-main article .pagination{padding:10px 0 0;text-align:center}.evf-backbone-modal-main footer{position:absolute;left:0;right:0;bottom:0;z-index:100;padding:1em 1.5em;background:#fcfcfc;border-top:1px solid #dfdfdf;box-shadow:0 -4px 4px -4px rgba(0,0,0,.1)}.evf-backbone-modal-main footer .inner{float:right;line-height:23px}.evf-backbone-modal-main footer .inner .button{margin-bottom:0}*{box-sizing:border-box}.everest-forms_page_edit-evf-form #wpcontent{padding-left:0}.everest-forms_page_edit-evf-form .everest-forms{width:600px;margin:100px auto 50px;background-color:#fff;border:1px solid #d6d8da}.everest-forms_page_edit-evf-form .everest-forms span{font-size:12px;margin-bottom:15px;color:#575757;display:inline-block;font-weight:600}.everest-forms_page_edit-evf-form .everest-forms .everest-forms-setup-form-name{padding:15px 20px;border-bottom:1px solid #d6d8da}.everest-forms_page_edit-evf-form .everest-forms .everest-forms-setup-form-name .everest-forms-setup-name{margin-left:40px;padding:10px;height:45px;width:400px}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-title{width:auto;font-size:24px;line-height:34px;font-weight:600;color:#575757;padding:15px 20px 10px}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-title p.desc{font-weight:400}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates{height:290px;display:block;padding:0 20px;text-align:left}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template{width:48%;float:left;display:inline-block;vertical-align:top;position:relative}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template img{width:100%;display:block}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template:nth-child(even){float:right}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay{position:absolute;background-color:rgba(0,0,0,.5);top:0;left:0;right:0;bottom:0;opacity:0;visibility:hidden;-webkit-transition:.5s background-color ease-in-out;transition:.5s background-color ease-in-out;color:#fff;text-align:center;padding:40% 0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay .evf-template-select{text-decoration:none}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{background:#fff;-webkit-animation:load1 1s infinite ease-in-out;animation:load1 1s infinite ease-in-out;width:1em;height:4em;padding:0;border-radius:0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button{color:#fff;text-indent:-9999em;margin:0 auto;position:relative;font-size:11px;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation-delay:-.16s;animation-delay:-.16s}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{position:absolute;top:0;content:''}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:before{left:-1.5em;-webkit-animation-delay:-.32s;animation-delay:-.32s}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading .evf-button:after{left:1.5em}@-webkit-keyframes load1{0%,100%,80%{box-shadow:0 0;height:4em}40%{box-shadow:0 -2em;height:5em}}@keyframes load1{0%,100%,80%{box-shadow:0 0;height:4em}40%{box-shadow:0 -2em;height:5em}}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-template-overlay.loading,.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template:hover .evf-template-overlay{opacity:1;visibility:visible}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-templates .evf-template .evf-button{display:inline-block;padding:15px 22px;background-color:#fff;color:#000;font-size:12px;text-transform:uppercase;border:none;border-radius:100px}@media screen and (max-width:782px){.everest-forms_page_edit-evf-form .everest-forms #everest-forms-setup-name{width:auto}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-desc a{width:200px}}@media screen and (max-width:600px){.everest-forms_page_edit-evf-form .everest-forms{width:100%;margin:20px 0}.everest-forms_page_edit-evf-form .everest-forms .evf-setup-desc a{display:block;margin-bottom:30px;text-align:center;width:100%;margin-left:0}}
assets/css/evf-form-modal.scss ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "scss/backbone";
2
+ @import "scss/colors";
3
+ /**
4
+ add form tempalte page CSS
5
+ **/
6
+ *{
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .everest-forms_page_edit-evf-form {
11
+ #wpcontent {
12
+ padding-left: 0;
13
+ }
14
+ .everest-forms {
15
+ width: 600px;
16
+ margin: 100px auto 50px;
17
+ background-color: $color-white;
18
+ border: 1px solid $color-gray-lighter;
19
+
20
+ span {
21
+ font-size: 12px;
22
+ margin-bottom: 15px;
23
+ color: $color-gray-darker;
24
+ display: inline-block;
25
+ font-weight: 600;
26
+ }
27
+
28
+ .everest-forms-setup-form-name {
29
+ padding: 15px 20px;
30
+ border-bottom: 1px solid $color-gray-lighter;
31
+
32
+ .everest-forms-setup-name {
33
+ margin-left: 40px;
34
+ padding: 10px;
35
+ height: 45px;
36
+ width: 400px;
37
+ }
38
+ }
39
+
40
+ .evf-setup-title {
41
+ width: auto;
42
+ font-size: 24px;
43
+ line-height: 34px;
44
+ font-weight: 600;
45
+ color: $color-gray-darker;
46
+ padding: 15px 20px 10px;
47
+
48
+ p.desc {
49
+ font-weight: normal;
50
+ }
51
+ }
52
+
53
+ .evf-setup-templates {
54
+ height: 290px;
55
+ display: block;
56
+ padding: 0 20px;
57
+ text-align: left;
58
+
59
+ .evf-template {
60
+ width: 48%;
61
+ float: left;
62
+ display: inline-block;
63
+ vertical-align: top;
64
+ position: relative;
65
+
66
+ img {
67
+ width:100%;
68
+ display: block;
69
+ }
70
+
71
+ &:nth-child( even ) {
72
+ float: right;
73
+ }
74
+
75
+ .evf-template-overlay {
76
+ position: absolute;
77
+ background-color: rgba(0,0,0,0.5);
78
+ top: 0;
79
+ left: 0;
80
+ right: 0;
81
+ bottom: 0;
82
+ opacity: 0;
83
+ visibility: hidden;
84
+ transition: 0.5s background-color ease-in-out;
85
+ color: $color-white;
86
+ text-align: center;
87
+ padding: 40% 0;
88
+
89
+ .evf-template-select {
90
+ text-decoration: none;
91
+ }
92
+
93
+ &.loading {
94
+ .evf-button,
95
+ .evf-button:before,
96
+ .evf-button:after {
97
+ background: #ffffff;
98
+ -webkit-animation: load1 1s infinite ease-in-out;
99
+ animation: load1 1s infinite ease-in-out;
100
+ width: 1em;
101
+ height: 4em;
102
+ padding: 0;
103
+ border-radius: 0;
104
+ }
105
+ .evf-button {
106
+ color: #ffffff;
107
+ text-indent: -9999em;
108
+ margin: 0 auto;
109
+ position: relative;
110
+ font-size: 11px;
111
+ -webkit-transform: translateZ(0);
112
+ -ms-transform: translateZ(0);
113
+ transform: translateZ(0);
114
+ -webkit-animation-delay: -0.16s;
115
+ animation-delay: -0.16s;
116
+ }
117
+ .evf-button:before,
118
+ .evf-button:after {
119
+ position: absolute;
120
+ top: 0;
121
+ content: '';
122
+ }
123
+ .evf-button:before {
124
+ left: -1.5em;
125
+ -webkit-animation-delay: -0.32s;
126
+ animation-delay: -0.32s;
127
+ }
128
+ .evf-button:after {
129
+ left: 1.5em;
130
+ }
131
+ @-webkit-keyframes load1 {
132
+ 0%,
133
+ 80%,
134
+ 100% {
135
+ box-shadow: 0 0;
136
+ height: 4em;
137
+ }
138
+ 40% {
139
+ box-shadow: 0 -2em;
140
+ height: 5em;
141
+ }
142
+ }
143
+ @keyframes load1 {
144
+ 0%,
145
+ 80%,
146
+ 100% {
147
+ box-shadow: 0 0;
148
+ height: 4em;
149
+ }
150
+ 40% {
151
+ box-shadow: 0 -2em;
152
+ height: 5em;
153
+ }
154
+ }
155
+
156
+ }
157
+ }
158
+
159
+ &:hover .evf-template-overlay,
160
+ .evf-template-overlay.loading {
161
+ opacity: 1;
162
+ visibility: visible;
163
+ }
164
+
165
+ .evf-button {
166
+ display: inline-block;
167
+ padding: 15px 22px;
168
+ background-color: #fff;
169
+ color: #000;
170
+ font-size: 12px;
171
+ text-transform: uppercase;
172
+ border: none;
173
+ border-radius: 100px;
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ @media screen and (max-width: 782px) {
181
+ .everest-forms_page_edit-evf-form .everest-forms {
182
+ #everest-forms-setup-name {
183
+ width: auto;
184
+ }
185
+
186
+ .evf-setup-desc a {
187
+ width: 200px;
188
+ }
189
+ }
190
+ }
191
+
192
+ @media screen and (max-width: 600px) {
193
+ .everest-forms_page_edit-evf-form .everest-forms {
194
+ width: 100%;
195
+ margin: 20px 0;
196
+
197
+ .evf-setup-desc a {
198
+ display: block;
199
+ margin-bottom: 30px;
200
+ text-align: center;
201
+ width: 100%;
202
+ margin-left: 0;
203
+ }
204
+ }
205
+ }
assets/css/jquery-ui-datepicker/jquery-ui-datepicker-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .ui-datepicker{padding:0;margin:0;border-radius:0;background-color:#fff;border:1px solid #dfdfdf;border-top:none;-webkit-box-shadow:0 3px 6px rgba(0,0,0,.075);box-shadow:0 3px 6px rgba(0,0,0,.075);width:auto}.ui-datepicker *{padding:0;border-radius:0}.ui-datepicker table{width:auto;margin:0;border:none;border-collapse:collapse}.ui-datepicker .ui-datepicker-header,.ui-datepicker .ui-widget-header{background-image:none;border:none;font-weight:400}.ui-datepicker .ui-datepicker-header .ui-state-hover{background:0 0;border-color:transparent;cursor:pointer}.ui-datepicker .ui-datepicker-title{margin:0;padding:10px 0;font-size:14px;line-height:14px;text-align:center}.ui-datepicker .ui-datepicker-next,.ui-datepicker .ui-datepicker-prev{position:relative;top:0;height:34px;width:34px}.ui-datepicker .ui-state-hover.ui-datepicker-next,.ui-datepicker .ui-state-hover.ui-datepicker-prev{border:none}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-prev-hover{right:0}.ui-datepicker .ui-datepicker-next,.ui-datepicker .ui-datepicker-next-hover{left:0}.ui-datepicker .ui-datepicker-next span,.ui-datepicker .ui-datepicker-prev span{display:none}.ui-datepicker .ui-datepicker-prev{float:right}.ui-datepicker .ui-datepicker-next{float:left}.ui-datepicker .ui-datepicker-next:before,.ui-datepicker .ui-datepicker-prev:before{font:normal 20px/34px dashicons;padding-right:7px;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:34px;height:34px}.ui-datepicker .ui-datepicker-prev:before{content:'\f341'}.ui-datepicker .ui-datepicker-next:before{content:'\f345'}.ui-datepicker .ui-datepicker-next-hover:before,.ui-datepicker .ui-datepicker-prev-hover:before{opacity:.7}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:33%}.ui-datepicker thead{font-weight:600}.ui-datepicker th{padding:10px;border-width:1px}.ui-datepicker td{padding:0;border:1px solid #f4f4f4}.ui-datepicker td.ui-datepicker-other-month{border:transparent}.ui-datepicker td.ui-datepicker-today{background-color:#f0f0c0}.ui-datepicker td.ui-datepicker-current-day{background:#bd8}.ui-datepicker td .ui-state-default{background:0 0;border:none;text-align:center;text-decoration:none;width:auto;display:block;padding:5px 10px;font-weight:400;color:#444}.ui-datepicker td.ui-state-disabled .ui-state-default{opacity:.5}.ui-datepicker-next.ui-corner-all.ui-state-disabled,.ui-datepicker-prev.ui-corner-all.ui-state-disabled{opacity:.5}.ui-datepicker td.ui-datepicker-closed{background-color:#f4f4f4;border:1px solid #f4f4f4}
assets/css/jquery-ui-datepicker/jquery-ui-datepicker.css ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ui-datepicker {
2
+ padding: 0;
3
+ margin: 0;
4
+ -webkit-border-radius: 0;
5
+ -moz-border-radius: 0;
6
+ border-radius: 0;
7
+ background-color: #fff;
8
+ border: 1px solid #dfdfdf;
9
+ border-top: none;
10
+ -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
11
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
12
+ width: auto;
13
+ }
14
+
15
+ .ui-datepicker * {
16
+ padding: 0;
17
+ -webkit-border-radius: 0;
18
+ -moz-border-radius: 0;
19
+ border-radius: 0;
20
+ }
21
+
22
+ .ui-datepicker table {
23
+ width: auto;
24
+ margin: 0;
25
+ border: none;
26
+ border-collapse: collapse;
27
+ }
28
+
29
+ .ui-datepicker .ui-widget-header,
30
+ .ui-datepicker .ui-datepicker-header {
31
+ background-image: none;
32
+ border: none;
33
+ font-weight: normal;
34
+ }
35
+
36
+ .ui-datepicker .ui-datepicker-header .ui-state-hover {
37
+ background: transparent;
38
+ border-color: transparent;
39
+ cursor: pointer;
40
+ }
41
+
42
+ .ui-datepicker .ui-datepicker-title {
43
+ margin: 0;
44
+ padding: 10px 0;
45
+ font-size: 14px;
46
+ line-height: 14px;
47
+ text-align: center;
48
+ }
49
+
50
+ .ui-datepicker .ui-datepicker-prev,
51
+ .ui-datepicker .ui-datepicker-next {
52
+ position: relative;
53
+ top: 0;
54
+ height: 34px;
55
+ width: 34px;
56
+ }
57
+
58
+ .ui-datepicker .ui-state-hover.ui-datepicker-prev,
59
+ .ui-datepicker .ui-state-hover.ui-datepicker-next {
60
+ border: none;
61
+ }
62
+
63
+ .ui-datepicker .ui-datepicker-prev,
64
+ .ui-datepicker .ui-datepicker-prev-hover {
65
+ left: 0;
66
+ }
67
+
68
+ .ui-datepicker .ui-datepicker-next,
69
+ .ui-datepicker .ui-datepicker-next-hover {
70
+ right: 0;
71
+ }
72
+
73
+ .ui-datepicker .ui-datepicker-next span,
74
+ .ui-datepicker .ui-datepicker-prev span {
75
+ display: none;
76
+ }
77
+
78
+ .ui-datepicker .ui-datepicker-prev {
79
+ float: left;
80
+ }
81
+
82
+ .ui-datepicker .ui-datepicker-next {
83
+ float: right;
84
+ }
85
+
86
+ .ui-datepicker .ui-datepicker-prev:before,
87
+ .ui-datepicker .ui-datepicker-next:before {
88
+ font: normal 20px/34px 'dashicons';
89
+ padding-left: 7px;
90
+ speak: none;
91
+ -webkit-font-smoothing: antialiased;
92
+ -moz-osx-font-smoothing: grayscale;
93
+ width: 34px;
94
+ height: 34px;
95
+ }
96
+
97
+ .ui-datepicker .ui-datepicker-prev:before {
98
+ content: '\f341';
99
+ }
100
+
101
+ .ui-datepicker .ui-datepicker-next:before {
102
+ content: '\f345';
103
+ }
104
+
105
+ .ui-datepicker .ui-datepicker-prev-hover:before,
106
+ .ui-datepicker .ui-datepicker-next-hover:before {
107
+ opacity: 0.7;
108
+ }
109
+
110
+ .ui-datepicker select.ui-datepicker-month,
111
+ .ui-datepicker select.ui-datepicker-year {
112
+ width: 33%;
113
+ }
114
+
115
+ .ui-datepicker thead {
116
+ font-weight: 600;
117
+ }
118
+
119
+ .ui-datepicker th {
120
+ padding: 10px;
121
+ border-width: 1px;
122
+ }
123
+
124
+ .ui-datepicker td {
125
+ padding: 0;
126
+ border: 1px solid #f4f4f4;
127
+ }
128
+
129
+ .ui-datepicker td.ui-datepicker-other-month {
130
+ border: transparent;
131
+ }
132
+
133
+ .ui-datepicker td.ui-datepicker-today {
134
+ background-color: #f0f0c0;
135
+ }
136
+
137
+ .ui-datepicker td.ui-datepicker-current-day {
138
+ background: #bbdd88;
139
+ }
140
+
141
+ .ui-datepicker td .ui-state-default {
142
+ background: transparent;
143
+ border: none;
144
+ text-align: center;
145
+ text-decoration: none;
146
+ width: auto;
147
+ display: block;
148
+ padding: 5px 10px;
149
+ font-weight: normal;
150
+ color: #444;
151
+ }
152
+
153
+ .ui-datepicker td.ui-state-disabled .ui-state-default {
154
+ opacity: 0.5;
155
+ }
156
+
157
+ .ui-datepicker-prev.ui-corner-all.ui-state-disabled,
158
+ .ui-datepicker-next.ui-corner-all.ui-state-disabled {
159
+ opacity: 0.5;
160
+ }
161
+
162
+ .ui-datepicker td.ui-datepicker-closed {
163
+ background-color: #f4f4f4;
164
+ border: 1px solid #f4f4f4;
165
+ }
assets/css/jquery-ui-datepicker/jquery-ui-datepicker.scss ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ui-datepicker {
2
+ padding: 0;
3
+ margin: 0;
4
+ -webkit-border-radius: 0;
5
+ -moz-border-radius: 0;
6
+ border-radius: 0;
7
+ background-color: #fff;
8
+ border: 1px solid #dfdfdf;
9
+ border-top: none;
10
+ -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
11
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
12
+ width: auto;
13
+ }
14
+
15
+ .ui-datepicker * {
16
+ padding: 0;
17
+ -webkit-border-radius: 0;
18
+ -moz-border-radius: 0;
19
+ border-radius: 0;
20
+ }
21
+
22
+ .ui-datepicker table {
23
+ width: auto;
24
+ margin: 0;
25
+ border: none;
26
+ border-collapse: collapse;
27
+ }
28
+
29
+ .ui-datepicker .ui-widget-header,
30
+ .ui-datepicker .ui-datepicker-header {
31
+ background-image: none;
32
+ border: none;
33
+ font-weight: normal;
34
+ }
35
+
36
+ .ui-datepicker .ui-datepicker-header .ui-state-hover {
37
+ background: transparent;
38
+ border-color: transparent;
39
+ cursor: pointer;
40
+ }
41
+
42
+ .ui-datepicker .ui-datepicker-title {
43
+ margin: 0;
44
+ padding: 10px 0;
45
+ font-size: 14px;
46
+ line-height: 14px;
47
+ text-align: center;
48
+ }
49
+
50
+ .ui-datepicker .ui-datepicker-prev,
51
+ .ui-datepicker .ui-datepicker-next {
52
+ position: relative;
53
+ top: 0;
54
+ height: 34px;
55
+ width: 34px;
56
+ }
57
+
58
+ .ui-datepicker .ui-state-hover.ui-datepicker-prev,
59
+ .ui-datepicker .ui-state-hover.ui-datepicker-next {
60
+ border: none;
61
+ }
62
+
63
+ .ui-datepicker .ui-datepicker-prev,
64
+ .ui-datepicker .ui-datepicker-prev-hover {
65
+ left: 0;
66
+ }
67
+
68
+ .ui-datepicker .ui-datepicker-next,
69
+ .ui-datepicker .ui-datepicker-next-hover {
70
+ right: 0;
71
+ }
72
+
73
+ .ui-datepicker .ui-datepicker-next span,
74
+ .ui-datepicker .ui-datepicker-prev span {
75
+ display: none;
76
+ }
77
+
78
+ .ui-datepicker .ui-datepicker-prev {
79
+ float: left;
80
+ }
81
+
82
+ .ui-datepicker .ui-datepicker-next {
83
+ float: right;
84
+ }
85
+
86
+ .ui-datepicker .ui-datepicker-prev:before,
87
+ .ui-datepicker .ui-datepicker-next:before {
88
+ font: normal 20px/34px 'dashicons';
89
+ padding-left: 7px;
90
+ speak: none;
91
+ -webkit-font-smoothing: antialiased;
92
+ -moz-osx-font-smoothing: grayscale;
93
+ width: 34px;
94
+ height: 34px;
95
+ }
96
+
97
+ .ui-datepicker .ui-datepicker-prev:before {
98
+ content: '\f341';
99
+ }
100
+
101
+ .ui-datepicker .ui-datepicker-next:before {
102
+ content: '\f345';
103
+ }
104
+
105
+ .ui-datepicker .ui-datepicker-prev-hover:before,
106
+ .ui-datepicker .ui-datepicker-next-hover:before {
107
+ opacity: 0.7;
108
+ }
109
+
110
+ .ui-datepicker select.ui-datepicker-month,
111
+ .ui-datepicker select.ui-datepicker-year {
112
+ width: 33%;
113
+ }
114
+
115
+ .ui-datepicker thead {
116
+ font-weight: 600;
117
+ }
118
+
119
+ .ui-datepicker th {
120
+ padding: 10px;
121
+ border-width: 1px;
122
+ }
123
+
124
+ .ui-datepicker td {
125
+ padding: 0;
126
+ border: 1px solid #f4f4f4;
127
+ }
128
+
129
+ .ui-datepicker td.ui-datepicker-other-month {
130
+ border: transparent;
131
+ }
132
+
133
+ .ui-datepicker td.ui-datepicker-today {
134
+ background-color: #f0f0c0;
135
+ }
136
+
137
+ .ui-datepicker td.ui-datepicker-current-day {
138
+ background: #bbdd88;
139
+ }
140
+
141
+ .ui-datepicker td .ui-state-default {
142
+ background: transparent;
143
+ border: none;
144
+ text-align: center;
145
+ text-decoration: none;
146
+ width: auto;
147
+ display: block;
148
+ padding: 5px 10px;
149
+ font-weight: normal;
150
+ color: #444;
151
+ }
152
+
153
+ .ui-datepicker td.ui-state-disabled .ui-state-default {
154
+ opacity: 0.5;
155
+ }
156
+
157
+ .ui-datepicker-prev.ui-corner-all.ui-state-disabled,
158
+ .ui-datepicker-next.ui-corner-all.ui-state-disabled {
159
+ opacity: 0.5;
160
+ }
161
+
162
+ .ui-datepicker td.ui-datepicker-closed {
163
+ background-color: #f4f4f4;
164
+ border: 1px solid #f4f4f4;
165
+ }
assets/css/scss/_admin.scss ADDED
@@ -0,0 +1,1174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *Everest Forms Style
3
+ */
4
+ body {
5
+ margin: 0;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .everest-forms_page_edit-evf-form {
13
+ #wpcontent {
14
+ padding-left: 0;
15
+ }
16
+ }
17
+
18
+ .everest-forms-add-fields-group,
19
+ .everest-forms-field-option-group {
20
+ .handlediv {
21
+ float: right;
22
+
23
+ &::before {
24
+ content: '\f142' !important;
25
+ cursor: pointer;
26
+ display: inline-block;
27
+ font: 400 20px/1 'Dashicons';
28
+ line-height: 0.5 !important;
29
+ padding: 4px;
30
+ position: relative;
31
+ right: 0;
32
+ top: 0;
33
+ }
34
+ }
35
+
36
+ &.closed {
37
+ .handlediv::before {
38
+ content: '\f140' !important;
39
+ }
40
+ }
41
+ }
42
+
43
+ #everest-forms-builder {
44
+ margin: 0;
45
+
46
+ .evf-builder-tabs {
47
+ background-color: $color-brand-secondary;
48
+ }
49
+
50
+ a {
51
+ text-decoration: none;
52
+
53
+ &:focus {
54
+ outline: none;
55
+ box-shadow: 0 0 0 rgba(0, 0, 0, 0);
56
+ }
57
+ }
58
+
59
+ .evf-tab-lists {
60
+ padding: 0;
61
+ margin: 0;
62
+ float: left;
63
+ list-style: none;
64
+ display: flex;
65
+
66
+ li {
67
+ margin-bottom: 0;
68
+
69
+ a {
70
+ font-size: 12px;
71
+ line-height: 24px;
72
+ color: $color-white;
73
+ padding: 10px 30px;
74
+ display: block;
75
+ cursor: pointer;
76
+ transition: 0.5s background-color ease-in-out;
77
+
78
+ &:hover,
79
+ &.active {
80
+ color: $color-gray-darker;
81
+ background-color: $color-whitesmoke;
82
+ outline: none;
83
+ }
84
+
85
+ &:focus {
86
+ outline: none;
87
+ }
88
+ }
89
+
90
+ .dashicons {
91
+ display: block;
92
+ font-size: 32px;
93
+ width: auto;
94
+ height: auto;
95
+ }
96
+ }
97
+ }
98
+
99
+ .evf_save_form_action_button {
100
+ float: right;
101
+ padding: 7px 22px;
102
+ background-color: $color-white;
103
+ color: $color-gray-base;
104
+ font-size: 12px;
105
+ text-transform: uppercase;
106
+ border: 0 none;
107
+ border-radius: 100px;
108
+ margin: 20px 45px 0 20px;
109
+ cursor: pointer;
110
+
111
+ &:focus {
112
+ outline: none;
113
+ }
114
+ }
115
+
116
+ .evf-tab-content {
117
+ .everest-forms-panel {
118
+ width: 100%;
119
+ display: none;
120
+
121
+ &.active {
122
+ display: block;
123
+
124
+ }
125
+
126
+ .everest-forms-panel-sidebar-content {
127
+ display: flex;
128
+ }
129
+
130
+ .everest-forms-panel-sidebar {
131
+ background-color: $color-whitesmoke;
132
+ width: 30%;
133
+ border-right: 1px solid $color-border-right;
134
+
135
+ .everest-forms-add-fields {
136
+ padding: 15px 20px;
137
+ }
138
+
139
+ .everest-forms-add-fields-heading {
140
+ display: block;
141
+ font-size: 14px;
142
+ font-weight: 500;
143
+ margin-bottom: 15px;
144
+ padding-bottom: 10px;
145
+ color: $color-gray-darker;
146
+ border-bottom: 1px solid $color-white-darken;
147
+
148
+ i {
149
+ float: right;
150
+ font-size: 14px;
151
+ margin-left: 5px;
152
+ line-height: 1.5;
153
+ }
154
+ }
155
+
156
+ .evf-registered-buttons {
157
+ margin-right: -1.5%;
158
+ margin-left: -1.5%;
159
+ list-style: none;
160
+ padding: 0;
161
+ display: flex;
162
+ flex-wrap: wrap;
163
+
164
+ .evf-registered-item {
165
+ margin-left: 1.5%;
166
+ margin-right: 1.5%;
167
+ padding: 20px 8px;
168
+ border: 1px solid $color-border-right;
169
+ width: 30.3%;
170
+ z-index: 999;
171
+ margin-bottom: 10px;
172
+ color: $color-gray;
173
+ cursor: pointer;
174
+ border-radius: 2px;
175
+ font-size: 12px;
176
+ transition: 0.5s color ease-in-out, 0.5s border-color ease-in-out;
177
+ text-align: center;
178
+ background-color: $color-white;
179
+
180
+ .dashicons {
181
+ display: block;
182
+ margin: 0 auto;
183
+ }
184
+
185
+ &:hover {
186
+ color: $color-brand-primary;
187
+ border-color: $color-brand-primary;
188
+
189
+ .evf-icon {
190
+ color: inherit;
191
+ }
192
+ }
193
+
194
+ svg {
195
+ width: 40px;
196
+ height: 40px;
197
+ display: block;
198
+ margin: 0 auto 10px;
199
+
200
+ .cls-1,
201
+ .cls-2,
202
+ .cls-3 {
203
+ fill: #414042;
204
+ transition: 0.5s fill ease-in-out;
205
+ font-size: 7px;
206
+ font-weight: 300;
207
+ }
208
+ }
209
+
210
+ &:hover {
211
+ color: $color-brand-primary;
212
+ border-color: $color-brand-primary;
213
+
214
+ svg {
215
+ .cls-1,
216
+ .cls-2,
217
+ .cls-3 {
218
+ fill: $color-brand-primary;
219
+ }
220
+ }
221
+ }
222
+ &.ui-draggable-dragging {
223
+ margin: 0;
224
+ border: 1px solid $color-brand-primary;
225
+ width: 105px !important;
226
+ color: $color-brand-primary;
227
+ background-color: $color-white;
228
+
229
+ svg {
230
+
231
+ .cls-1,
232
+ .cls-2,
233
+ .cls-3 {
234
+ fill: $color-brand-primary;
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
+ .evf-setting--checkbox,
242
+ .evf-field-option--checkbox {
243
+ input,
244
+ label {
245
+ width: auto;
246
+ padding: 0;
247
+ display: inline-block;
248
+ vertical-align: top;
249
+ height: auto;
250
+ }
251
+
252
+ input {
253
+ margin: 3px 5px 0 0;
254
+ }
255
+ }
256
+
257
+ .everest-forms-field-options {
258
+ display: none;
259
+ background-color: $accordion-content-bg;
260
+ height: 100%;
261
+
262
+ .everest-forms-field-option-group {
263
+ border-bottom: 1px solid $accordion-content-bg;
264
+ }
265
+
266
+ .everest-forms-field-option-row {
267
+ margin-bottom: 15px;
268
+
269
+ &:last-child {
270
+ margin-bottom: 0;
271
+ }
272
+
273
+ .inline {
274
+ margin-bottom: 0;
275
+ display: inline-block;
276
+ vertical-align: top;
277
+ margin-left: 5px;
278
+ }
279
+ }
280
+
281
+ .everest-forms-field-option {
282
+ display: none;
283
+ }
284
+
285
+ .everest-forms-field-option-group-toggle {
286
+ background-color: $accordion-bg;
287
+ padding: 15px 20px;
288
+ font-size: 14px;
289
+ font-weight: 600;
290
+ display: block;
291
+ color: $color-gray-darken;
292
+ }
293
+
294
+ .everest-forms-field-option-group-inner {
295
+ background-color: $accordion-content-bg;
296
+ padding: 15px 20px;
297
+ }
298
+ }
299
+
300
+ .evf-setting-panel {
301
+ background-color: $accordion-content-bg;
302
+ padding: 15px 20px;
303
+ font-size: 14px;
304
+ font-weight: 600;
305
+ display: block;
306
+ color: $color-gray-darken;
307
+ border-bottom: 3px solid $accordion-content-bg;
308
+
309
+ .everest-forms-toggle-arrow {
310
+ float: right;
311
+ font-size: 14px;
312
+ }
313
+
314
+ &.active {
315
+ background-color: $color-white;
316
+ position: relative;
317
+ color: $color-brand-secondary;
318
+ border-color: $color-brand-secondary;
319
+
320
+ &::after {
321
+ position: absolute;
322
+ content: "";
323
+ top: 0;
324
+ right: -1px;
325
+ bottom: 0;
326
+ width: 1px;
327
+ height: 100%;
328
+ background-color: $color-white;
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
334
+
335
+ .everest-forms-panel-content-wrap {
336
+ background-color: $color-white;
337
+ width: 70%;
338
+ padding: 15px 20px;
339
+
340
+ .everest-forms-title-desc {
341
+ .everest-forms-form-name {
342
+ margin-top: 0;
343
+ }
344
+ }
345
+
346
+ .evf-admin-field-wrapper {
347
+ padding: 0 15px;
348
+
349
+ &.evf-hover {
350
+ background-color: $color-brand-primary-light;
351
+ }
352
+ }
353
+
354
+ .evf-add-row {
355
+ text-align: center;
356
+
357
+ span {
358
+ width: 40px;
359
+ height: 40px;
360
+ line-height: 30px;
361
+ padding: 5px;
362
+ color: $color-white;
363
+ background-color: $color-gray;
364
+ border-radius: 5px;
365
+ cursor: pointer;
366
+ transition: 0.5s ease-in-out background-color;
367
+ margin-bottom: 20px;
368
+
369
+ &:hover,
370
+ &:focus,
371
+ &:active {
372
+ background-color: $color-brand-primary;
373
+ }
374
+ }
375
+ }
376
+
377
+ .evf-admin-row {
378
+ background-color: transparent;
379
+ display: flex;
380
+ margin: 0 -15px 30px;
381
+ position: relative;
382
+ border: 1px solid transparent;
383
+ transition: 0.5s border, 0.5s background-color;
384
+ &:last-child {
385
+ margin-bottom: 10px;
386
+ }
387
+
388
+ .evf-toggle-row {
389
+ background-color: $submit-color;
390
+ color: #fff;
391
+ position: absolute;
392
+ right: 0;
393
+ top: 0;
394
+ z-index: 9999;
395
+ visibility: hidden;
396
+ opacity: 0;
397
+ transition: 0.7s all;
398
+ padding: 5px 10px;
399
+ cursor: pointer;
400
+
401
+ .evf-show-grid {
402
+ display: inline-block;
403
+ font-size: 12px;
404
+ letter-spacing: 1px;
405
+ font-weight: 600;
406
+ text-transform: uppercase;
407
+ }
408
+
409
+ .evf-delete-row {
410
+ display: inline-block;
411
+ padding-right: 5px;
412
+ span {
413
+ font-size: 14px;
414
+ height: auto;
415
+ line-height: 1.2;
416
+ color: $color-alert-danger;
417
+ }
418
+ }
419
+
420
+ .evf-toggle-row-content {
421
+ display: none;
422
+ position: absolute;
423
+ width: 200px;
424
+ padding: 30px;
425
+ text-align: center;
426
+ right: -20px;
427
+ border-radius: 11px;
428
+ background-color: $color-white;
429
+ font-weight: 600;
430
+ font-size: 12px;
431
+ top: 40px;
432
+ box-shadow: 0 0 39px rgba(0, 0, 0, 0.1);
433
+ transition: 0.9s background-color;
434
+
435
+ &::before {
436
+ top: -5px;
437
+ content: "";
438
+ right: 45px;
439
+ border-right: 6px solid transparent;
440
+ border-bottom: 6px solid $color-white;
441
+ border-left: 6px solid transparent;
442
+ position: absolute;
443
+ }
444
+
445
+ > span {
446
+ color: $color-gray-darker;
447
+ display: block;
448
+ }
449
+
450
+ small {
451
+ color: $input-color;
452
+ margin-bottom: 10px;
453
+ display: block;
454
+ }
455
+
456
+ .evf-grid-selector {
457
+ height: 30px;
458
+ width: 40px;
459
+ border: 1px solid $color-gray-lighter;
460
+ display: inline-block;
461
+ margin: 3px;
462
+ border-radius: 3px;
463
+
464
+ span {
465
+ height: 100%;
466
+ display: inline-block;
467
+ background: #fff;
468
+
469
+ &:nth-child(n+1) {
470
+ border-left: 1px solid $color-gray-lighter;
471
+ }
472
+ &:nth-child(1) {
473
+ border-left: 0 none;
474
+ }
475
+ }
476
+
477
+ &.active {
478
+ border-color: $color-brand-primary;
479
+ span {
480
+ border-color: $color-brand-primary;
481
+
482
+ }
483
+ }
484
+
485
+ }
486
+ }
487
+
488
+ }
489
+
490
+ &:hover {
491
+ background-color: $color-evf-hover;
492
+ border: 1px dashed $button-color;
493
+
494
+ .evf-admin-grid {
495
+ border: 1px dashed $color-gray-light;
496
+ }
497
+
498
+ .evf-toggle-row {
499
+ opacity: 1;
500
+ visibility: visible;
501
+ }
502
+ }
503
+
504
+ .evf-admin-grid {
505
+ background: $color-white;
506
+ min-height: 200px;
507
+ margin: 15px;
508
+ padding: 5px;
509
+ border: 1px solid transparent;
510
+ transition: 0.5s border, 0.5s background-color;
511
+ position: relative;
512
+
513
+ &.evf-hover {
514
+ border: 1px dashed $color-gray-light;
515
+
516
+ &.evf-item-hover {
517
+ position: relative;
518
+ box-shadow: 0 0 5px rgba(0, 100, 251, 0.5);
519
+
520
+ &::after {
521
+ position: absolute;
522
+ content: "";
523
+ top: -1px;
524
+ left: -1px;
525
+ right: -1px;
526
+ width: auto;
527
+ height: 15px;
528
+ background-color: $color-brand-primary;
529
+ }
530
+ }
531
+ }
532
+
533
+ &.evf-grid-1 {
534
+ width: 100%;
535
+ }
536
+
537
+ &.evf-grid-2 {
538
+ width: 50%;
539
+ }
540
+
541
+ &.evf-grid-3 {
542
+ width: 30%;
543
+
544
+ }
545
+
546
+ .evf-registered-item {
547
+ padding: 20px;
548
+ font-size: 18px;
549
+ text-align: left;
550
+
551
+ .dashicons {
552
+ font-size: 22px;
553
+ margin-top: 3px;
554
+ }
555
+ }
556
+
557
+ &.evf-empty-grid {
558
+ border: 1px dashed $color-gray-light;
559
+ position: relative;
560
+
561
+ &:before {
562
+ position: absolute;
563
+ margin: auto;
564
+ content: "\f132";
565
+ font-size: 40px;
566
+ display: block;
567
+ font-family: dashicons;
568
+ transform: translate(-50%, -50%);
569
+ left: 50%;
570
+ top: 50%;
571
+ color: $color-gray-lighter;
572
+
573
+ }
574
+ }
575
+ }
576
+ }
577
+
578
+ .everest-forms-field {
579
+ margin-bottom: 30px;
580
+ padding: 15px;
581
+ position: relative;
582
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0);
583
+ transition: 0.5s box-shadow;
584
+
585
+ &:last-child {
586
+ margin-bottom: 0;
587
+ }
588
+
589
+ &.everest-forms-field--first,
590
+ &.everest-forms-field--last {
591
+ width: 48.5%;
592
+ margin-right: 3%;
593
+ float: left;
594
+ }
595
+
596
+ &.everest-forms-field--last {
597
+ margin-right: 0;
598
+ float: right;
599
+ }
600
+
601
+ .evf-field-action {
602
+ position: absolute;
603
+ top: 10px;
604
+ right: 5px;
605
+ visibility: hidden;
606
+ opacity: 0;
607
+ transition: 0.5s all;
608
+
609
+ a {
610
+ color: $color-brand-primary;
611
+ margin-left: 5px;
612
+
613
+ &.everest-forms-field-delete:hover {
614
+ color: $color-alert-danger;
615
+ }
616
+ }
617
+ }
618
+
619
+ &:hover {
620
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
621
+ .evf-field-action {
622
+ visibility: visible;
623
+ opacity: 1;
624
+ }
625
+ }
626
+
627
+ &.ui-sortable-helper {
628
+ box-shadow: 1px 5px 35px rgba(0, 0, 0, 0.2);
629
+ padding: 20px 30px;
630
+ height: auto !important;
631
+ left: -20px;
632
+ right: -20px;
633
+ background-color: $color-white;
634
+
635
+ &::before {
636
+ position: absolute;
637
+ left: 0;
638
+ top: 0;
639
+ width: 5px;
640
+ height: 100%;
641
+ background-color: $color-brand-secondary;
642
+ content: "";
643
+ }
644
+
645
+ &:hover {
646
+ .evf-field-action {
647
+ display: none;
648
+ }
649
+ }
650
+ }
651
+ }
652
+
653
+ .file-uploader {
654
+ width: 100%;
655
+ border: 2px dashed $border-color;
656
+ background-color: $uploader-background;
657
+ border-radius: 3px;
658
+ cursor: pointer;
659
+ text-align: center;
660
+ padding-top: 30px;
661
+ padding-bottom: 30px;
662
+ position: relative;
663
+
664
+ svg {
665
+ width: 30px;
666
+ height: 30px;
667
+ fill: #BBBCBD;
668
+ margin-bottom: 20px;
669
+ }
670
+
671
+ input {
672
+ &.file-input {
673
+ touch-action: manipulation;
674
+ max-width: 100%;
675
+ min-width: 14px;
676
+ margin: 0;
677
+ opacity: 0;
678
+ height: 18px;
679
+ }
680
+ }
681
+
682
+ .drop {
683
+ display: block;
684
+ font-size: 14px;
685
+ font-weight: 600;
686
+ color: $color-gray;
687
+ margin-bottom: 10px;
688
+ }
689
+
690
+ .or {
691
+ font-size: 12px;
692
+ color: $color-gray-light;
693
+ font-weight: 500;
694
+ display: block;
695
+ margin-bottom: 10px;
696
+
697
+ }
698
+
699
+ .file-control {
700
+ position: absolute;
701
+ bottom: 30px;
702
+ color: $button-color;
703
+ padding-bottom: 2px;
704
+ display: block;
705
+ left: 0;
706
+ right: 0;
707
+
708
+ &::before {
709
+ content: "";
710
+ width: 45px;
711
+ background-color: $button-color;
712
+ height: 1px;
713
+ display: block;
714
+ left: 50%;
715
+ bottom: -2px;
716
+ position: absolute;
717
+ transform: translateX(-50%);
718
+ }
719
+ }
720
+
721
+ }
722
+
723
+ .publishing-action {
724
+ width: 100%;
725
+ text-align: right;
726
+ }
727
+
728
+ .submit-button {
729
+ display: inline-block;
730
+ font-size: 12px;
731
+ font-weight: 600;
732
+ color: $color-white;
733
+ padding: 15px 20px;
734
+ border: 0 none;
735
+ background-color: $submit-color;
736
+ border-radius: 3px;
737
+ }
738
+ }
739
+
740
+ label {
741
+ font-size: 12px;
742
+ margin-bottom: 15px;
743
+ color: $color-gray-darker;
744
+ display: block;
745
+ font-weight: 600;
746
+
747
+ i {
748
+ color: $color-gray-light;
749
+ font-size: 16px;
750
+ line-height: 1.2;
751
+ }
752
+
753
+ .required {
754
+ margin-left: 5px;
755
+ }
756
+ }
757
+
758
+ input:not(.ed_button),
759
+ textarea:not(.wp-editor-area),
760
+ select {
761
+ border: 1px solid $border-color;
762
+ border-radius: 3px;
763
+ height: 45px;
764
+ width: 100%;
765
+ padding: 10px 15px;
766
+ color: $color-gray-darker;
767
+ font-size: 14px;
768
+
769
+ &[type="checkbox"],
770
+ &[type="radio"] {
771
+ width: 16px;
772
+ height: 16px;
773
+ background-color: $color-white;
774
+
775
+ }
776
+ &[type="radio"] {
777
+ border-radius: 10px;
778
+ }
779
+
780
+ &[type="checkbox"]:checked {
781
+ background-color: $color-brand-primary;
782
+
783
+ &::before {
784
+ color: $color-white;
785
+ background-color: transparent;
786
+ }
787
+ }
788
+
789
+ &[type="radio"]:checked {
790
+ &::before {
791
+ background-color: $color-brand-primary;
792
+ }
793
+ }
794
+
795
+ &::placeholder {
796
+ color: $input-color;
797
+ }
798
+
799
+ &:focus {
800
+ outline: none;
801
+ }
802
+ }
803
+
804
+ textarea,
805
+ textarea:not(.wp-editor-area) {
806
+ height: 120px;
807
+ }
808
+
809
+ .evf-grid-lists {
810
+ margin-left: -1.5%;
811
+ margin-right: 1.5%;
812
+ background-color: $accordion-bg;
813
+ display: flex;
814
+
815
+ .evf-grid-lists-item {
816
+ padding-left: 1.5%;
817
+ padding-right: 1.5%;
818
+ background-color: $color-white;
819
+ }
820
+ }
821
+ .evf-content-section-title {
822
+ font-size: 24px;
823
+ font-weight: 500;
824
+ margin-bottom: 20px;
825
+ padding-bottom: 20px;
826
+ line-height: 34px;
827
+ border-bottom: 1px solid $color-white-darken;
828
+ }
829
+ .everest-forms-panel-field {
830
+ margin-bottom: 20px;
831
+ }
832
+ }
833
+
834
+ .evf-registered-item {
835
+ z-index: 999;
836
+ cursor: pointer;
837
+ border-radius: 2px;
838
+ font-size: 12px;
839
+ text-align: center;
840
+ margin: 0;
841
+ background-color: $color-white;
842
+ border: 1px solid $color-border-right;
843
+ color: $color-gray;
844
+
845
+ .evf-icon {
846
+ color: inherit;
847
+ display: block !important;
848
+ font-size: 32px !important;
849
+ }
850
+
851
+ &.ui-draggable-dragging {
852
+ border: 1px solid $color-brand-primary;
853
+ width: 105px !important;
854
+ color: $color-brand-primary;
855
+ text-align: center !important;
856
+ font-size: 12px !important;
857
+ box-shadow: 0 0 32px rgba(0, 0, 0, 0.15);
858
+ }
859
+ }
860
+
861
+ .evf-choices-list {
862
+ li {
863
+ input.value {
864
+ display: none;
865
+ }
866
+ input[type="checkbox"], input[type="radio"] {
867
+ float: left;
868
+ margin-top: 6px;
869
+ }
870
+ input[type="text"] {
871
+ height: 30px;
872
+ font-size: 12px;
873
+ width: 70%;
874
+ line-height: 12px;
875
+ }
876
+ a.add, a.remove {
877
+ margin-top: 5px;
878
+ margin-left: 2px;
879
+ display: inline-block;
880
+ float: right;
881
+ }
882
+ clear: both;
883
+ padding: 5px 5px;
884
+ cursor:pointer;
885
+ &:hover {
886
+ background: #f9f9f9;
887
+ }
888
+ }
889
+ }
890
+
891
+ .everest-forms-field.ui-draggable-dragging {
892
+ margin: 0;
893
+ border: 1px solid $color-brand-primary;
894
+ width: 105px !important;
895
+ color: $color-brand-primary;
896
+ background-color: $color-white;
897
+ text-align: center;
898
+ font-size: 12px!important;
899
+
900
+ .evf-icon {
901
+ color: inherit;
902
+ display: block !important;
903
+ font-size: 302x !important;
904
+ }
905
+ }
906
+ }
907
+
908
+ #everest-forms-panel-settings {
909
+ .evf-content-section {
910
+ display: none;
911
+
912
+ }
913
+
914
+ .evf-content-section.active {
915
+ display: block;
916
+ }
917
+ }
918
+
919
+ .jconfirm.jconfirm-white,
920
+ .jconfirm.jconfirm-light {
921
+ .jconfirm-box .jconfirm-buttons button {
922
+ &.evf-confirm-btn,
923
+ &.evf-cancel-btn {
924
+ padding: 7px 15px;
925
+ background-color: $color-gray-more-darken;
926
+ color: $color-white;
927
+ font-size: 12px;
928
+ text-transform: uppercase;
929
+ border: 0 none;
930
+ border-radius: 5px;
931
+ cursor: pointer;
932
+ font-weight: 600;
933
+ }
934
+ }
935
+ }
936
+
937
+ @media screen and (max-width: 1200px) {
938
+ #everest-forms-builder {
939
+ .evf-tab-content {
940
+ .everest-forms-panel {
941
+ .everest-forms-panel-sidebar {
942
+ .evf-registered-buttons {
943
+ .evf-registered-item {
944
+ width: 47%;
945
+ }
946
+ }
947
+ }
948
+ }
949
+ }
950
+ }
951
+ }
952
+
953
+ @media screen and (max-width: 782px) {
954
+ .everest-forms_page_edit-evf-form.auto-fold {
955
+ #wpcontent {
956
+ padding-left: 0;
957
+ }
958
+ }
959
+ #everest-forms-builder {
960
+ .evf-tab-content {
961
+ .everest-forms-panel {
962
+ .everest-forms-panel-sidebar-content {
963
+ flex-direction: column;
964
+ }
965
+
966
+ .everest-forms-panel-sidebar,
967
+ .everest-forms-panel-content-wrap {
968
+ width: 100%;
969
+ }
970
+
971
+ .everest-forms-panel-sidebar {
972
+ .evf-registered-buttons {
973
+ .evf-registered-item {
974
+ width: 30.3%;
975
+ }
976
+ }
977
+ }
978
+ }
979
+ }
980
+ }
981
+ }
982
+
983
+ @media screen and (max-width: 600px) {
984
+ #everest-forms-builder {
985
+ .evf-tab-content {
986
+ .everest-forms-panel-content-wrap {
987
+ padding: 20px 20px 0;
988
+
989
+ .evf-admin-row {
990
+ flex-direction: column;
991
+ margin: 0 0 20px;
992
+ position: relative;
993
+
994
+ .evf-admin-grid {
995
+ &.evf-grid-1,
996
+ &.evf-grid-2,
997
+ &.evf-grid-3 {
998
+ width: auto;
999
+ }
1000
+ }
1001
+ }
1002
+ }
1003
+ }
1004
+ }
1005
+ }
1006
+
1007
+ @media screen and (max-width: 480px) {
1008
+ #everest-forms-builder {
1009
+ .evf-tab-lists li {
1010
+ a {
1011
+ padding: 15px;
1012
+ }
1013
+
1014
+ .dashicons {
1015
+ font-size: 24px;
1016
+ }
1017
+ }
1018
+
1019
+ .evf_save_form_action_button {
1020
+ margin: 12px 15px 0 5px;
1021
+ }
1022
+
1023
+ .evf-tab-content {
1024
+ .everest-forms-panel {
1025
+ .everest-forms-panel-sidebar {
1026
+ .evf-registered-buttons {
1027
+ .evf-registered-item {
1028
+ width: 47%;
1029
+ }
1030
+ }
1031
+ }
1032
+ }
1033
+ }
1034
+ }
1035
+
1036
+ .jconfirm.jconfirm-white .jconfirm-box,
1037
+ .jconfirm.jconfirm-light .jconfirm-box {
1038
+ width: 90% !important;
1039
+ }
1040
+ }
1041
+
1042
+ .evf-overlay {
1043
+ height: 100%;
1044
+ width: 100%;
1045
+ background: transparent;
1046
+ position: absolute;
1047
+ top: 0;
1048
+ right: 0;
1049
+ left: 0;
1050
+ bottom: 0;
1051
+ z-index: 1000;
1052
+ padding: 20px;
1053
+
1054
+ }
1055
+
1056
+ /**
1057
+ * Tooltips
1058
+ */
1059
+ .tips {
1060
+ cursor: help;
1061
+ text-decoration: none;
1062
+ }
1063
+
1064
+ img.tips {
1065
+ padding: 5px 0 0;
1066
+ }
1067
+
1068
+ #tiptip_holder {
1069
+ display: none;
1070
+ z-index: 8675309;
1071
+ position: absolute;
1072
+ top: 0;
1073
+ /*rtl:ignore*/
1074
+ left: 0;
1075
+
1076
+
1077
+ &.tip_top {
1078
+ padding-bottom: 5px;
1079
+
1080
+ #tiptip_arrow_inner {
1081
+ margin-top: -7px;
1082
+ margin-left: -6px;
1083
+ border-top-color: #333;
1084
+ }
1085
+ }
1086
+
1087
+ &.tip_bottom {
1088
+ padding-top: 5px;
1089
+
1090
+ #tiptip_arrow_inner {
1091
+ margin-top: -5px;
1092
+ margin-left: -6px;
1093
+ border-bottom-color: #333;
1094
+ }
1095
+ }
1096
+
1097
+ &.tip_right {
1098
+ padding-left: 5px;
1099
+
1100
+ #tiptip_arrow_inner {
1101
+ margin-top: -6px;
1102
+ margin-left: -5px;
1103
+ border-right-color: #333;
1104
+ }
1105
+ }
1106
+
1107
+ &.tip_left {
1108
+ padding-right: 5px;
1109
+
1110
+ #tiptip_arrow_inner {
1111
+ margin-top: -6px;
1112
+ margin-left: -7px;
1113
+ border-left-color: #333;
1114
+ }
1115
+ }
1116
+ }
1117
+
1118
+ #tiptip_content,
1119
+ .chart-tooltip,
1120
+ .evf_error_tip {
1121
+ color: #fff;
1122
+ font-size: 0.8em;
1123
+ max-width: 150px;
1124
+ background: #333;
1125
+ text-align: center;
1126
+ border-radius: 3px;
1127
+ padding: 0.618em 1em;
1128
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
1129
+
1130
+ code {
1131
+ padding: 1px;
1132
+ background: #888;
1133
+ }
1134
+ }
1135
+
1136
+ #tiptip_arrow,
1137
+ #tiptip_arrow_inner {
1138
+ position: absolute;
1139
+ border-color: transparent;
1140
+ border-style: solid;
1141
+ border-width: 6px;
1142
+ height: 0;
1143
+ width: 0;
1144
+ }
1145
+
1146
+ /*rtl:raw:
1147
+ #tiptip_arrow {
1148
+ right: 50%;
1149
+ margin-right: -6px;
1150
+ }
1151
+ */
1152
+
1153
+ .evf_error_tip {
1154
+ max-width: 20em;
1155
+ line-height: 1.8em;
1156
+ position: absolute;
1157
+ white-space: normal;
1158
+ background: #d82223;
1159
+ margin: 1.5em 1px 0 -1em;
1160
+ z-index: 9999999;
1161
+
1162
+ &::after {
1163
+ content: '';
1164
+ display: block;
1165
+ border: 8px solid #d82223;
1166
+ border-right-color: transparent;
1167
+ border-left-color: transparent;
1168
+ border-top-color: transparent;
1169
+ position: absolute;
1170
+ top: -3px;
1171
+ left: 50%;
1172
+ margin: -1em 0 0 -3px;
1173
+ }
1174
+ }
assets/css/scss/_backbone.scss ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Backbone modal dialog
3
+ */
4
+ .evf-backbone-modal {
5
+ * {
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .evf-backbone-modal-content {
10
+ position: fixed;
11
+ background: #fff;
12
+ z-index: 100000;
13
+ left: 50%;
14
+ top: 50%;
15
+ transform: translate(-50%, -50%);
16
+ width: 500px;
17
+ article {
18
+ overflow: auto;
19
+ }
20
+ }
21
+
22
+ .select2-container {
23
+ width: 100% !important;
24
+ }
25
+ }
26
+
27
+ .evf-backbone-modal-backdrop {
28
+ position: fixed;
29
+ top: 0;
30
+ left: 0;
31
+ right: 0;
32
+ bottom: 0;
33
+ min-height: 360px;
34
+ background: #000;
35
+ opacity: 0.7;
36
+ z-index: 99900;
37
+ }
38
+
39
+ .evf-backbone-modal-main {
40
+ padding-bottom: 55px;
41
+
42
+ header,
43
+ article {
44
+ display: block;
45
+ position: relative;
46
+ }
47
+
48
+ .evf-backbone-modal-header {
49
+ height: auto;
50
+ background: #fcfcfc;
51
+ padding: 1em 1.5em;
52
+ border-bottom: 1px solid #ddd;
53
+
54
+ h1 {
55
+ margin: 0;
56
+ font-size: 18px;
57
+ font-weight: 700;
58
+ line-height: 1.5em;
59
+ }
60
+
61
+ .modal-close-link {
62
+ cursor: pointer;
63
+ color: #777;
64
+ height: 54px;
65
+ width: 54px;
66
+ padding: 0;
67
+ position: absolute;
68
+ top: 0;
69
+ right: 0;
70
+ text-align: center;
71
+ border: 0;
72
+ border-left: 1px solid #ddd;
73
+ background-color: transparent;
74
+ transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
75
+
76
+ &::before {
77
+ font: normal 22px/50px 'dashicons' !important;
78
+ color: #666;
79
+ display: block;
80
+ content: '\f335';
81
+ font-weight: 300;
82
+ }
83
+
84
+ &:hover,
85
+ &:focus {
86
+ background: #ddd;
87
+ border-color: #ccc;
88
+ color: #000;
89
+ }
90
+
91
+ &:focus {
92
+ outline: none;
93
+ }
94
+ }
95
+ }
96
+
97
+ article {
98
+ padding: 1.5em;
99
+
100
+ p {
101
+ margin: 1.5em 0;
102
+ }
103
+ p:first-child {
104
+ margin-top: 0;
105
+ }
106
+
107
+ p:last-child {
108
+ margin-bottom: 0;
109
+ }
110
+ .pagination {
111
+ padding: 10px 0 0;
112
+ text-align: center;
113
+ }
114
+ }
115
+
116
+ footer {
117
+ position: absolute;
118
+ left: 0;
119
+ right: 0;
120
+ bottom: 0;
121
+ z-index: 100;
122
+ padding: 1em 1.5em;
123
+ background: #fcfcfc;
124
+ border-top: 1px solid #dfdfdf;
125
+ box-shadow: 0 -4px 4px -4px rgba(0, 0, 0, 0.1);
126
+
127
+ .inner {
128
+ float: right;
129
+ line-height: 23px;
130
+
131
+ .button {
132
+ margin-bottom: 0;
133
+ }
134
+ }
135
+ }
136
+ }
assets/css/scss/_clearings.scss ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .clearfix::before,
2
+ .clearfix::after,
3
+ .container::before,
4
+ .container::after,
5
+ .container-fluid::before,
6
+ .container-fluid::after,
7
+ .tg-row::before,
8
+ .tg-row::after {
9
+ display: table;
10
+ content: "";
11
+ }
12
+ .clearfix::after,
13
+ .container::after,
14
+ .container-fluid::after,
15
+ .tg-row::after {
16
+ clear: both;
17
+ }
18
+
19
+ @mixin clearfix() {
20
+ *zoom: 1;
21
+
22
+ &::before,
23
+ &::after {
24
+ content: ' ';
25
+ display: table;
26
+ }
27
+
28
+ &::after {
29
+ clear: both;
30
+ }
31
+ }
assets/css/scss/_colors.scss ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $primary: #ff0033; // Primary color for buttons (alt)
2
+ $primarytext: desaturate( lighten( $primary, 52% ), 18% ); // Text on primary color bg
3
+
4
+ $secondary: desaturate( lighten( $primary, 44% ), 91% ); // Secondary buttons
5
+ $secondarytext: desaturate( darken( $secondary, 64% ), 91% ); // Text on secondary color bg
6
+
7
+ $border-color: #D5D9E2;
8
+ $text-color: #C6CCD7;
9
+ $uploader-background: #FBFDFE;
10
+ $button-color: #5D96EE;
11
+ $submit-color: #8CE99A;
12
+ $input-color: #C6CCD7;
13
+ $accordion-bg: #F9FAFC;
14
+ $accordion-content-bg: #F0F1F2;
15
+ $color-evf-hover: #F7FAFC;
16
+
17
+
18
+ $color-gray-base: #000000;
19
+ $color-gray-more-darken: #292929; //Gray 16%
20
+ $color-gray-darken: #404040; //Gray 25%
21
+ $color-gray-darker: #575757; // Gray 34%
22
+ $color-gray-dark: #747474; // Gray 45.5%
23
+ $color-gray: #969696; // Gray 59%
24
+ $color-gray-light: #BDBDBD; // Gray 74%
25
+ $color-gray-lighter: #D6D8DA; // Gray 84%
26
+
27
+
28
+ /*===== Light colors ======*/
29
+ $color-white: #FFFFFF;
30
+ $color-white-dark: #FAFAFA; // white 2%
31
+ $color-white-darker: #F5F5F5; // white 4%
32
+ $color-white-darken: #EFEFEF; // white 6.2%
33
+ $color-white-more-darken: #E6E6E6; // white 10%
34
+ $color-whitesmoke: #F9FAFC;
35
+ $color-border-right: #EBEDF0;
36
+
37
+
38
+ /*========== Brand-colors ==========*/
39
+ $color-brand-primary: #7CA8EB; // #337ab7
40
+ $color-brand-primary-light: lighten($color-brand-primary, 20%); // #337ab7
41
+ $color-brand-secondary: #7F5AEC;
42
+
43
+ /*========== Alert Colors ==========*/
44
+ $color-alert-success: #5CB85C;
45
+ $color-alert-info: #5BC0DE;
46
+ $color-alert-warning: #F0AD4E;
47
+ $color-alert-danger: #D9534F;
48
+
49
+ /*========== Typography Colors ==========*/
50
+ $color-heading: $color-gray-dark;
51
+ $color-body: $color-gray;
assets/css/scss/_evf-icon.scss ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'evf-icon';
3
+ src: url('../fonts/evf-icon.eot?5fwmb3');
4
+ src: url('../fonts/evf-icon.eot?5fwmb3#iefix') format('embedded-opentype'),
5
+ url('../fonts/evf-icon.ttf?5fwmb3') format('truetype'),
6
+ url('../fonts/evf-icon.woff?5fwmb3') format('woff'),
7
+ url('../fonts/evf-icon.svg?5fwmb3#evf-icon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ [class^="evf-icon-"], [class*=" evf-icon-"] {
13
+ /* use !important to prevent issues with browser extensions that change ../fonts */
14
+ font-family: 'evf-icon' !important;
15
+ speak: none;
16
+ font-style: normal;
17
+ font-weight: normal;
18
+ font-variant: normal;
19
+ text-transform: none;
20
+ line-height: 1;
21
+
22
+ /* Better Font Rendering =========== */
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale;
25
+ }
26
+
27
+ .evf-icon-last-name:before {
28
+ content: "\e900";
29
+ }
30
+ .evf-icon-first-name:before {
31
+ content: "\e901";
32
+ }
33
+ .evf-icon-checkbox:before {
34
+ content: "\e902";
35
+ }
36
+ .evf-icon-radio:before {
37
+ content: "\e903";
38
+ }
39
+ .evf-icon-file-upload:before {
40
+ content: "\e904";
41
+ }
42
+ .evf-icon-hidden-field:before {
43
+ content: "\e90a";
44
+ }
45
+ .evf-icon-address:before {
46
+ content: "\e911";
47
+ }
48
+ .evf-icon-phone:before {
49
+ content: "\e912";
50
+ }
51
+ .evf-icon-website:before {
52
+ content: "\e913";
53
+ }
54
+ .evf-icon-number:before {
55
+ content: "\e914";
56
+ }
57
+ .evf-icon-dropdown:before {
58
+ content: "\e915";
59
+ }
60
+ .evf-icon-paragraph:before {
61
+ content: "\e916";
62
+ }
63
+ .evf-icon-multiple-choices:before {
64
+ content: "\e917";
65
+ }
66
+ .evf-icon-date-time:before {
67
+ content: "\e918";
68
+ }
69
+ .evf-icon-email:before {
70
+ content: "\e919";
71
+ }
72
+ .evf-icon-text:before {
73
+ content: "\e91a";
74
+ }
assets/fonts/evf-icon.eot ADDED
Binary file
assets/fonts/evf-icon.svg ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="icomoon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="Asset-7" d="M354.28 496.375c-0.035 0-0.076 0-0.118 0-95.557 0-173.021 77.464-173.021 173.021s77.464 173.021 173.021 173.021c95.557 0 173.021-77.464 173.021-173.021v0c-0.134-95.462-77.451-172.82-172.884-173.021h-0.019zM354.28 818.759c-0.035 0-0.076 0-0.118 0-82.556 0-149.48-66.925-149.48-149.48s66.925-149.48 149.48-149.48c82.556 0 149.48 66.925 149.48 149.48 0 0.041 0 0.083 0 0.124v-0.006c-0.067 82.464-66.899 149.296-149.356 149.363h-0.006zM16.596 57.468l-3.649 13.536c-8.22 28.447-12.947 61.122-12.947 94.901 0 195.664 158.617 354.28 354.28 354.28s354.28-158.617 354.28-354.28c0-0.053 0-0.107 0-0.16v0.008c0-0.020 0-0.043 0-0.066 0-29.857-3.734-58.842-10.762-86.514l0.522 2.423-3.178-13.536-12.476 5.414c-89.748 37.287-193.991 58.942-303.292 58.942-4.271 0-8.534-0.033-12.79-0.099l0.643 0.008c-124.528 0-244.348-24.6-337.567-69.208zM354.28 496.375c-182.54-0.201-330.472-148.091-330.74-330.596v-0.026c0.037-26.606 3.166-52.462 9.048-77.253l-0.456 2.277c94.161 42.372 212.451 65.56 334.742 65.56 3.040 0.039 6.63 0.062 10.225 0.062 108.376 0 211.986-20.409 307.195-57.593l-5.747 1.976c4.072 19.583 6.426 42.106 6.474 65.17v0.037c-0.402 182.43-148.282 330.187-330.721 330.387h-0.019zM685.609 831.706h23.54v-683.020h-23.54v683.020zM689.258 91.836h329.799v-23.54h-329.799v23.54z" />
11
+ <glyph unicode="&#xe901;" glyph-name="Asset-8" d="M350.255 495.825c-0.034 0-0.075 0-0.116 0-94.471 0-171.055 76.584-171.055 171.055s76.584 171.055 171.055 171.055c94.471 0 171.055-76.584 171.055-171.055v0c-0.132-94.377-76.571-170.856-170.919-171.055h-0.019zM350.255 814.545c-0.035 0-0.075 0-0.116 0-81.618 0-147.782-66.164-147.782-147.782s66.164-147.782 147.782-147.782c81.618 0 147.782 66.164 147.782 147.782 0 0.041 0 0.082 0 0.123v-0.006c-0.066 81.527-66.139 147.599-147.659 147.665h-0.006zM16.407 61.905l-3.607 13.382c-8.126 28.123-12.8 60.427-12.8 93.822 0 193.44 156.814 350.255 350.255 350.255s350.255-156.814 350.255-350.255c0-0.053 0-0.105 0-0.158v0.008c0-0.019 0-0.042 0-0.065 0-29.518-3.692-58.174-10.639-85.531l0.516 2.395-3.142-13.382-12.335 5.353c-88.728 36.863-191.787 58.272-299.845 58.272-4.223 0-8.437-0.033-12.644-0.098l0.635 0.008c-123.113 0-241.571-24.32-333.731-68.422zM350.255 495.825c-180.493-0.132-326.783-146.382-326.982-326.846v-0.019c0.036-26.303 3.13-51.866 8.945-76.375l-0.451 2.252c93.091 41.891 210.036 64.815 330.938 64.815 3.005 0.039 6.555 0.061 10.109 0.061 107.145 0 209.577-20.177 303.704-56.939l-5.682 1.954c4.026 19.361 6.353 41.627 6.4 64.429v0.036c-0.397 180.357-146.597 326.435-326.963 326.633h-0.019zM677.818 827.345h23.273v-675.258h-23.273v675.258zM693.062 827.113h326.051v-23.273h-326.051v23.273zM693.062 565.178h203.869v-23.273h-203.869v23.273z" />
12
+ <glyph unicode="&#xe902;" glyph-name="Asset-9" d="M383.353 321.589l-136.298 154.895 17.773 15.537 122.645-139.358 626.994 417.957 13.065-19.538-644.178-429.491zM834.030 50.406h-834.030v797.778h834.030v-127.235h-23.54v103.695h-786.95v-750.698h786.95v429.138h23.54v-452.679z" />
13
+ <glyph unicode="&#xe903;" glyph-name="Asset-10" d="M512-64c-282.77 0-512 229.23-512 512s229.23 512 512 512c282.77 0 512-229.23 512-512v0c-0.313-282.644-229.356-511.687-511.97-512h-0.030zM512 932.517c-267.592 0-484.517-216.926-484.517-484.517s216.926-484.517 484.517-484.517c267.592 0 484.517 216.926 484.517 484.517v0c-0.313 267.466-217.052 484.205-484.487 484.517h-0.030zM702.729 448c0-105.337-85.392-190.729-190.729-190.729s-190.729 85.392-190.729 190.729c0 105.337 85.392 190.729 190.729 190.729s190.729-85.392 190.729-190.729z" />
14
+ <glyph unicode="&#xe904;" glyph-name="Asset-11" d="M899.459-69.674h-774.919v774.919h294.054v-27.676h-266.378v-719.568h719.568v719.568h-266.378v27.676h294.054v-774.919zM498.162 940.489h27.676v-373.622h-27.676v373.622zM626.716 806.123l-114.716 114.716-114.716-114.716-19.65 19.511 134.365 134.365 134.365-134.365-19.65-19.511zM387.459 400.813h249.081v-27.676h-249.081v27.676zM387.459 276.272h124.541v-27.676h-124.541v27.676zM387.459 151.732h249.081v-27.676h-249.081v27.676z" />
15
+ <glyph unicode="&#xe905;" d="M1024-64h-1024v1024h1024zM27.676-36.324h968.649v968.649h-968.649z" />
16
+ <glyph unicode="&#xe906;" d="M312.597 367.187h-32.657v83.857h-88.147v-83.857h-32.796v196.636h32.796v-86.486h88.147v86.486h32.657z" />
17
+ <glyph unicode="&#xe907;" d="M490.136 537.531h-59.364v-170.344h-32.934v170.344h-59.364v26.292h152.216z" />
18
+ <glyph unicode="&#xe908;" d="M558.357 563.823l56.735-151.248 56.874 151.248h42.482v-196.636h-32.104v66.975l3.183 85.241-58.396-152.216h-22.141l-57.981 152.216h-0.83l2.491-85.241v-66.975h-32.796v196.636z" />
19
+ <glyph unicode="&#xe909;" d="M791.109 393.479h90.361v-26.292h-123.157v196.636h32.796z" />
20
+ <glyph unicode="&#xe90a;" glyph-name="Asset-13" d="M509.815 185.719c-274.295 0-492.476 240.162-501.623 250.402l-8.192 9.011 8.192 9.694c9.148 10.24 227.328 250.266 501.623 250.266s492.612-240.572 501.76-250.266l8.192-9.148-8.192-9.011c-9.148-10.786-227.328-250.948-501.76-250.948zM37.137 445.133c43.008-43.964 240.162-232.107 472.678-232.107s429.807 188.143 473.225 232.107c-42.871 44.1-240.026 232.107-472.678 232.107s-430.217-188.006-473.225-232.107zM509.815 308.599c-75.405 0-136.533 61.128-136.533 136.533s61.128 136.533 136.533 136.533c75.405 0 136.533-61.128 136.533-136.533v0c0-75.405-61.128-136.533-136.533-136.533v0zM509.815 554.359c-60.324 0-109.227-48.902-109.227-109.227s48.902-109.227 109.227-109.227c60.324 0 109.227 48.902 109.227 109.227v0c0 60.324-48.902 109.227-109.227 109.227v0zM8.675-36.778l983.007 983.007 19.309-19.309-983.007-983.007-19.309 19.309z" />
21
+ <glyph unicode="&#xe90b;" d="M887.836-60.541h-751.671c-36.989 0-66.975 29.986-66.975 66.975v0 516.428c0 36.989 29.986 66.975 66.975 66.975v0h751.671c36.989 0 66.975-29.986 66.975-66.975v0-516.428c0-36.989-29.986-66.975-66.975-66.975v0zM136.164 562.162c-21.673-0.078-39.221-17.627-39.299-39.292v-516.436c0.078-21.673 17.627-39.221 39.292-39.299h751.679c21.673 0.078 39.221 17.627 39.299 39.292v516.436c-0.078 21.673-17.627 39.221-39.292 39.299h-0.008z" />
22
+ <glyph unicode="&#xe90c;" d="M768.83 572.541h-27.676v124.541c0 129.921-105.322 235.243-235.243 235.243s-235.243-105.322-235.243-235.243v0-124.541h-27.676v124.541c0 145.206 117.713 262.919 262.919 262.919s262.919-117.713 262.919-262.919v0z" />
23
+ <glyph unicode="&#xe90d;" d="M373.622 264.649c0-19.106-15.489-34.595-34.595-34.595s-34.595 15.489-34.595 34.595c0 19.106 15.489 34.595 34.595 34.595s34.595-15.489 34.595-34.595z" />
24
+ <glyph unicode="&#xe90e;" d="M488.891 264.649c0-19.106-15.489-34.595-34.595-34.595s-34.595 15.489-34.595 34.595c0 19.106 15.489 34.595 34.595 34.595s34.595-15.489 34.595-34.595z" />
25
+ <glyph unicode="&#xe90f;" d="M604.298 264.649c0-19.106-15.489-34.595-34.595-34.595s-34.595 15.489-34.595 34.595c0 19.106 15.489 34.595 34.595 34.595s34.595-15.489 34.595-34.595z" />
26
+ <glyph unicode="&#xe910;" d="M719.568 264.649c0-19.106-15.489-34.595-34.595-34.595s-34.595 15.489-34.595 34.595c0 19.106 15.489 34.595 34.595 34.595s34.595-15.489 34.595-34.595z" />
27
+ <glyph unicode="&#xe911;" glyph-name="Asset-15" d="M514.076-59.849l-11.070 14.668c-13.976 18.681-343.87 459.416-343.87 650.24 0 196.028 158.912 354.941 354.941 354.941s354.941-158.912 354.941-354.941v0c0-190.824-329.894-631.559-343.87-650.378zM514.076 932.324c-180.648-0.236-327.029-146.616-327.265-327.242v-0.023c0-162.733 268.869-538.984 327.265-618.69 58.396 79.706 327.265 455.957 327.265 618.69-0.236 180.648-146.616 327.029-327.242 327.265h-0.023zM509.232 434.162c-76.424 0-138.378 61.954-138.378 138.378s61.954 138.378 138.378 138.378c76.424 0 138.378-61.954 138.378-138.378v0c0-76.424-61.954-138.378-138.378-138.378v0zM509.232 683.243c-61.139 0-110.703-49.563-110.703-110.703s49.563-110.703 110.703-110.703c61.139 0 110.703 49.563 110.703 110.703v0c0 61.139-49.563 110.703-110.703 110.703v0z" />
28
+ <glyph unicode="&#xe912;" glyph-name="Asset-16" d="M853.656-64h-683.312c-25.265 0.078-45.725 20.538-45.803 45.796v932.402c0.078 25.265 20.538 45.725 45.796 45.803h683.32c25.265-0.078 45.725-20.538 45.803-45.796v-932.402c-0.078-25.265-20.538-45.725-45.796-45.803h-0.008zM170.344 932.324c-10.012 0-18.128-8.116-18.128-18.128v0-932.394c0-10.012 8.116-18.128 18.128-18.128h683.312c10.012 0 18.128 8.116 18.128 18.128v0 932.394c0 10.012-8.116 18.128-18.128 18.128v0zM296.683 835.459h52.999v-27.676h-52.999v27.676zM421.224 835.459h283.676v-27.676h-283.676v27.676zM451.39 84.757h121.081v-27.676h-121.081v27.676z" />
29
+ <glyph unicode="&#xe913;" glyph-name="Asset-17" d="M512-64c-282.716 0.071-511.875 229.274-511.875 512 0 282.77 229.23 512 512 512 185.237 0 347.499-98.37 437.396-245.72l1.278-2.254c7.057-11.762 13.838-24.078 19.926-36.394 33.594-65.837 53.278-143.597 53.278-225.954 0-0.59-0.001-1.18-0.003-1.77v0.091c0-282.77-229.23-512-512-512v0zM512 932.324c-267.485 0-484.324-216.839-484.324-484.324s216.839-484.324 484.324-484.324c267.485 0 484.324 216.839 484.324 484.324v0c0.002 0.449 0.002 0.981 0.002 1.513 0 77.924-18.61 151.501-51.628 216.529l1.256-2.726c-5.812 11.624-12.177 23.248-18.819 34.456-85.563 141.453-238.562 234.555-413.306 234.555-0.643 0-1.285-0.001-1.928-0.004h0.099zM525.838 555.658q-213.795 0-439.351 129.384l13.838 24.078c288.519-166.054 564.307-167.161 819.338-3.875l14.945-23.248c-132.013-84.134-268.039-126.339-408.77-126.339zM97.972 177.332l-16.052 22.417c300.281 213.656 587.555 215.040 853.795 3.875l-17.159-21.587c-259.044 205.354-527.498 203.831-820.584-4.705zM498.162 946.162h27.676v-985.946h-27.676v985.946zM509.648-64c-148.757 0-269.838 229.708-269.838 512s121.081 512 269.838 512 269.838-229.708 269.838-512-120.943-512-269.838-512zM509.648 932.324c-133.535 0-242.162-217.254-242.162-484.324s108.627-484.324 242.162-484.324 242.162 217.254 242.162 484.324-108.627 484.324-242.162 484.324z" />
30
+ <glyph unicode="&#xe914;" glyph-name="Asset-18" d="M1024-64h-1024v1024h1024zM27.676-36.324h968.649v968.649h-968.649zM387.504 200.382l55.347 498.141 27.506-3.056-55.347-498.141-27.506 3.056zM553.501 200.577l57.145 501.559 27.498-3.133-57.145-501.559-27.498 3.133zM262.919 524.108h498.162v-27.676h-498.162v27.676zM262.919 399.568h498.162v-27.676h-498.162v27.676z" />
31
+ <glyph unicode="&#xe915;" glyph-name="Asset-19" d="M512 303.948l-258.906 258.768 19.65 19.65 239.256-239.395 239.256 239.395 19.65-19.65-258.906-258.768zM1024-64h-1024v1024h1024zM27.676-36.324h968.649v968.649h-968.649z" />
32
+ <glyph unicode="&#xe916;" glyph-name="Asset-20" d="M512 440.986c-0.099 0-0.215 0-0.332 0-143.322 0-259.507 116.185-259.507 259.507s116.185 259.507 259.507 259.507c46.49 0 90.125-12.225 127.865-33.636l-1.286 0.672-14.027-24.408c-32.341 18.271-71.016 29.037-112.205 29.037-127.75 0-231.312-103.562-231.312-231.312 0-127.745 103.554-231.303 231.296-231.312h0.001c41.227 0.023 79.909 10.894 113.355 29.912l-1.136-0.595 14.027-24.408c-36.322-20.738-79.822-32.964-126.177-32.964-0.024 0-0.049 0-0.073 0h0.003zM617.205 945.973h28.055v-1009.973h-28.055v1009.973zM743.452 945.973h28.055v-1009.973h-28.055v1009.973z" />
33
+ <glyph unicode="&#xe917;" glyph-name="Asset-21" d="M283.676 683.243h-276.757v276.757h276.757zM34.595 710.919h221.405v221.405h-221.405zM283.676 309.622h-276.757v276.757h276.757zM34.595 337.297h221.405v221.405h-221.405zM283.676-64h-276.757v276.757h276.757zM34.595-36.324h221.405v221.405h-221.405zM394.378 835.459h622.703v-27.676h-622.703v27.676zM394.378 461.838h622.703v-27.676h-622.703v27.676zM394.378 88.216h622.703v-27.676h-622.703v27.676z" />
34
+ <glyph unicode="&#xe918;" glyph-name="Asset-22" d="M1024-57.081h-1024v681.514h1024zM27.676-29.405h968.649v626.162h-968.649zM1024 596.757h-1024v245.622h1024zM27.676 624.432h968.649v190.27h-968.649zM249.081 953.081h27.676v-249.081h-27.676v249.081zM498.162 953.081h27.676v-249.081h-27.676v249.081zM747.243 953.081h27.676v-249.081h-27.676v249.081z" />
35
+ <glyph unicode="&#xe919;" glyph-name="Asset-23" d="M768.203 63.763l-768.203 512.135 1024.406 384.102zM59.009 569.131l693.359-461.788 231.165 808.4zM259.451-64l2.572 491.969 272.985-175.133zM288.821 378.028l-2.030-369.755 207.209 238.744zM276.388 407.54l706.152 516.447 15.979-21.849-706.152-516.447-15.979 21.849z" />
36
+ <glyph unicode="&#xe91a;" glyph-name="Asset-24" d="M1024 697.081h-27.676v235.243h-968.649v-235.243h-27.676v262.919h1024v-262.919zM761.081-64h-498.162v27.676h235.243v982.486h27.676v-982.486h235.243v-27.676z" />
37
+ </font></defs></svg>
assets/fonts/evf-icon.ttf ADDED
Binary file
assets/fonts/evf-icon.woff ADDED
Binary file
assets/images/blank-form.jpg ADDED
Binary file
assets/images/contact-form.jpg ADDED
Binary file
assets/js/admin/admin-helper.js ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;
2
+ var evfHelper = {
3
+
4
+ init: function () {
5
+
6
+
7
+ },
8
+ /**
9
+ * Update query string in URL.
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ updateQueryString: function ( key, value, url ) {
14
+
15
+ if ( !url ) url = window.location.href;
16
+ var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"),
17
+ hash;
18
+
19
+ if ( re.test(url) ) {
20
+ if ( typeof value !== 'undefined' && value !== null )
21
+ return url.replace(re, '$1' + key + "=" + value + '$2$3');
22
+ else {
23
+ hash = url.split('#');
24
+ url = hash[ 0 ].replace(re, '$1$3').replace(/(&|\?)$/, '');
25
+ if ( typeof hash[ 1 ] !== 'undefined' && hash[ 1 ] !== null )
26
+ url += '#' + hash[ 1 ];
27
+ return url;
28
+ }
29
+ } else {
30
+ if ( typeof value !== 'undefined' && value !== null ) {
31
+ var separator = url.indexOf('?') !== -1 ? '&' : '?';
32
+ hash = url.split('#');
33
+ url = hash[ 0 ] + separator + key + '=' + value;
34
+ if ( typeof hash[ 1 ] !== 'undefined' && hash[ 1 ] !== null )
35
+ url += '#' + hash[ 1 ];
36
+ return url;
37
+ }
38
+ else
39
+ return url;
40
+ }
41
+ },
42
+ parseInt: function ( value, number ) {
43
+
44
+ if ( typeof number !== 'undefined' ) {
45
+
46
+ return parseInt(value, number);
47
+
48
+ }
49
+ return parseInt(value, 0);
50
+
51
+ },
52
+ /**
53
+ * Get query string in a URL.
54
+ *
55
+ * @since 1.0.0
56
+ */
57
+ getQueryString: function ( name ) {
58
+
59
+ var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
60
+ return match && decodeURIComponent(match[ 1 ].replace(/\+/g, ' '));
61
+ },
62
+
63
+ /**
64
+ * Is number?
65
+ *
66
+ * @since 1.0.0
67
+ */
68
+ isNumber: function ( n ) {
69
+ return !isNaN(parseFloat(n)) && isFinite(n);
70
+ },
71
+ startEvfOverLay: function ( $node, $this ) {
72
+
73
+
74
+ var overlay = $("<div class='evf-overlay'/>");
75
+ overlay.append('<div class="loading"/>');
76
+ $this.find('.spinner').remove();
77
+ $node.find('.evf-overlay').remove();
78
+ $node.css({ 'position': 'relative' });
79
+ $node.append(overlay);
80
+ $this.append('<span style="margin-top: -1px;margin-right: 0;" class="spinner is-active"/>');
81
+ },
82
+ endEvfOverLay: function ( $node, $this ) {
83
+
84
+ $node.find('.evf-overlay').fadeOut();
85
+ $node.find('.evf-overlay').remove();
86
+ $node.removeAttr('style');
87
+ $this.find('.spinner').remove();
88
+ }
89
+
90
+ };
91
+ evfHelper.init();
assets/js/admin/admin-helper.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var evfHelper={init:function(){},updateQueryString:function(e,n,r){r||(r=window.location.href);var i,t=new RegExp("([?&])"+e+"=.*?(&|#|$)(.*)","gi");if(t.test(r))return void 0!==n&&null!==n?r.replace(t,"$1"+e+"="+n+"$2$3"):(i=r.split("#"),r=i[0].replace(t,"$1$3").replace(/(&|\?)$/,""),"undefined"!=typeof i[1]&&null!==i[1]&&(r+="#"+i[1]),r);if(void 0!==n&&null!==n){var a=-1!==r.indexOf("?")?"&":"?";return i=r.split("#"),r=i[0]+a+e+"="+n,"undefined"!=typeof i[1]&&null!==i[1]&&(r+="#"+i[1]),r}return r},parseInt:function(e,n){return void 0!==n?parseInt(e,n):parseInt(e,0)},getQueryString:function(e){var n=new RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return n&&decodeURIComponent(n[1].replace(/\+/g," "))},isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},startEvfOverLay:function(e,n){var r=$("<div class='evf-overlay'/>");r.append('<div class="loading"/>'),n.find(".spinner").remove(),e.find(".evf-overlay").remove(),e.css({position:"relative"}),e.append(r),n.append('<span style="margin-top: -1px;margin-right: 0;" class="spinner is-active"/>')},endEvfOverLay:function(e,n){e.find(".evf-overlay").fadeOut(),e.find(".evf-overlay").remove(),e.removeAttr("style"),n.find(".spinner").remove()}};evfHelper.init();
assets/js/admin/builder-config.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ( $ ) {
2
+
3
+ var builder_node = $('#everest-builder');
4
+
5
+ $(document).trigger("everest_builder_builder_node_filter", [ builder_node ]);
6
+
7
+ var builder_config = {
8
+ fields: [
9
+ {
10
+ type: 'text',
11
+ field_settings: {
12
+ required: true,
13
+ default: 'Hello World',
14
+ meta_key: 'this_is_field_meta_key',
15
+ }
16
+ },
17
+
18
+ ],
19
+ form_settings: {
20
+ form_shortcode: ''
21
+ },
22
+ appearance_settings: {},
23
+ dragged_fields: {}
24
+
25
+
26
+ };
27
+ builder_node.EverestBuilder(builder_config);
28
+
29
+ })(jQuery);
assets/js/admin/builder-config.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t=e("#everest-builder");e(document).trigger("everest_builder_builder_node_filter",[t]);t.EverestBuilder({fields:[{type:"text",field_settings:{required:!0,"default":"Hello World",meta_key:"this_is_field_meta_key"}}],form_settings:{form_shortcode:""},appearance_settings:{},dragged_fields:{}})}(jQuery);
assets/js/admin/everest-builder.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //Plugin made by Umesh Ghimire
2
+ (function ( $ ) {
3
+ $.fn.EverestBuilder = function ( options ) {
4
+
5
+ return this.each(function () {
6
+ // Bob's default settings:
7
+ var defaults = {
8
+ fields: [],
9
+ form_settings: {},
10
+ appearance_settings: {},
11
+ dragged_fields: {}
12
+ };
13
+ var settings = $.extend({}, defaults, options);
14
+
15
+
16
+ var self = {
17
+ draggableNode: function () {
18
+ var draggable_node = $('<div class="eb-draggable"/>');
19
+ $.each(settings.fields, function ( field_index, field_value ) {
20
+ if ( 'undefined' !== typeof field_value.type ) {
21
+ var field_node = $.fn.EverestBuilder.nodeGenerator(field_value.type, field_value, settings);
22
+ draggable_node.append(field_node);
23
+ } else {
24
+ eb_notices('Undefined property type of field');
25
+ }
26
+ })
27
+
28
+ },
29
+ // It will render the builder node
30
+ renderNode: function () {
31
+ var draggable_node = this.draggableNode();
32
+ },
33
+ init: function () {
34
+
35
+ this.renderNode();
36
+
37
+ },
38
+
39
+ };
40
+
41
+ self.init();
42
+
43
+ });
44
+
45
+ };
46
+
47
+
48
+ function eb_notices ( notice, type ) {
49
+
50
+ var color = '#a94442';
51
+
52
+ if ( 'undefined' !== typeof type && 'info' === type ) {
53
+ color = '#31708f';
54
+ }
55
+ console.log('%c ' + 'EverestBuilder - Notice : ' + notice, 'color: ' + color);
56
+ }
57
+
58
+ function eb_error ( error ) {
59
+ throw 'EverestBuilder - Error : ' + error;
60
+ }
61
+ })(jQuery);
62
+
63
+ (function ( $ ) {
64
+ // Node methods
65
+
66
+ $.fn.EverestBuilder.nodeGenerator = function ( type, field, $this ) {
67
+
68
+ if ( 'undefined' === typeof $.fn.EverestBuilder.nodeGenerator[ type ] ) {
69
+
70
+ eb_error('Could not find method - ' + type);
71
+ }
72
+ $.fn.EverestBuilder.nodeGenerator[ type ](field, $this);
73
+
74
+ };
75
+
76
+ $.fn.EverestBuilder.nodeGenerator.text = function ( field, instance ) {
77
+
78
+ var defaults = {
79
+ type: 'text',
80
+ field_settings: {
81
+ required: true,
82
+ default: 'LOL World',
83
+ meta_key: 'this_is_field_meta_key',
84
+ }
85
+ };
86
+ var options = $.extend({}, defaults, field);
87
+ console.log(field);
88
+ console.log(options);
89
+
90
+ };
91
+ })(jQuery);
92
+
93
+
94
+
assets/js/admin/everest-builder.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){e.fn.EverestBuilder=function(n){return this.each(function(){var t=e.extend({},{fields:[],form_settings:{},appearance_settings:{},dragged_fields:{}},n);({draggableNode:function(){var n=e('<div class="eb-draggable"/>');e.each(t.fields,function(r,o){if("undefined"!=typeof o.type){var d=e.fn.EverestBuilder.nodeGenerator(o.type,o,t);n.append(d)}else!function(e,n){var t="#a94442";void 0!==n&&"info"===n&&(t="#31708f"),console.log("%c EverestBuilder - Notice : "+e,"color: "+t)}("Undefined property type of field")})},renderNode:function(){this.draggableNode()},init:function(){this.renderNode()}}).init()})}}(jQuery),function(e){e.fn.EverestBuilder.nodeGenerator=function(n,t,r){"undefined"==typeof e.fn.EverestBuilder.nodeGenerator[n]&&eb_error("Could not find method - "+n),e.fn.EverestBuilder.nodeGenerator[n](t,r)},e.fn.EverestBuilder.nodeGenerator.text=function(n,t){var r=e.extend({},{type:"text",field_settings:{required:!0,"default":"LOL World",meta_key:"this_is_field_meta_key"}},n);console.log(n),console.log(r)}}(jQuery);
assets/js/admin/everest-forms-admin.js ADDED
File without changes
assets/js/admin/everest-forms-admin.min.js ADDED
File without changes
assets/js/admin/everest-panel-builder.js ADDED
@@ -0,0 +1,816 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ( $, evf_data ) {
2
+
3
+
4
+ var EVFPanelBuilder = {
5
+
6
+
7
+ /**
8
+ * Start the panel builder.
9
+ *
10
+ * @since 1.0.0
11
+ */
12
+ init: function () {
13
+
14
+ // Document ready
15
+ $(document).ready(EVFPanelBuilder.ready);
16
+
17
+ // Page load
18
+ $(window).on('load', EVFPanelBuilder.load);
19
+
20
+ EVFPanelBuilder.bindUI();
21
+ },
22
+
23
+ load: function () {
24
+
25
+ },
26
+ bindUI: function () {
27
+
28
+ EVFPanelBuilder.bindDefaultTabs();
29
+ EVFPanelBuilder.checkEmptyGrid();
30
+ EVFPanelBuilder.bindFields();
31
+ EVFPanelBuilder.bindFormPreview();
32
+ EVFPanelBuilder.bindGridSwitcher();
33
+ EVFPanelBuilder.bindFieldSettings();
34
+ EVFPanelBuilder.bindFieldDelete();
35
+ EVFPanelBuilder.bindCloneField();
36
+ EVFPanelBuilder.bindSaveOption();
37
+ EVFPanelBuilder.bindFieldOptionChange();
38
+ EVFPanelBuilder.bindAddNewRow();
39
+ EVFPanelBuilder.bindRemoveRow();
40
+ EVFPanelBuilder.bindFormSettings();
41
+ EVFPanelBuilder.choicesInit();
42
+ EVFPanelBuilder.choicesUpdate();
43
+
44
+ var tab = evf_data.tab;
45
+ if ( tab === 'field-options' ) {
46
+ $('.evf-panel-field-options-button').trigger('click');
47
+ }
48
+
49
+ },
50
+ choicesInit: function () {
51
+ var choice_list = $(".evf-choices-list");
52
+ choice_list.sortable({
53
+ out: function ( event, ui ) {
54
+
55
+ var field_id = $(event.target).attr('data-field-id');
56
+ EVFPanelBuilder.choiceChange(field_id);
57
+
58
+ }
59
+ }
60
+ );
61
+ var option_container = choice_list.closest('.everest-forms-field-option');
62
+ var field_id = option_container.attr('data-field-id');
63
+ var field_container = $('#everest-forms-field-' + field_id);
64
+
65
+
66
+ },
67
+ choicesUpdate: function () {
68
+ var choice_list = $(".evf-choices-list");
69
+ $('body').on('click', '.evf-choices-list a.add', function () {
70
+ var clone = $(this).closest('li').clone();
71
+ clone.find('input[type="text"]').val('');
72
+ var ul = $(this).closest('.evf-choices-list');
73
+ var field_id = ul.attr('data-field-id');
74
+ var total_list = ul.find('li').length;
75
+ total_list++;
76
+ clone.find('input[type="checkbox"],input[type="radio"]').prop('checked', false);
77
+ clone.attr('data-key', total_list);
78
+ clone.find('.default').attr('name', 'form_fields[' + field_id + '][choices][' + total_list + '][default]');
79
+ clone.find('.label').attr('name', 'form_fields[' + field_id + '][choices][' + total_list + '][label]');
80
+ clone.find('.value').attr('name', 'form_fields[' + field_id + '][choices][' + total_list + '][value]');
81
+ $(this).closest('li').after(clone);
82
+ EVFPanelBuilder.choiceChange(field_id);
83
+ });
84
+ $('body').on('click', '.evf-choices-list a.remove', function () {
85
+ var ul = $(this).closest('.evf-choices-list');
86
+ var field_id = ul.attr('data-field-id');
87
+ if ( ul.find('li').length < 2 ) {
88
+
89
+ var type = '';
90
+ var title = evf_data.delete_confirm_title;
91
+ var content = evf_data.are_you_sure_want_to_delete_row;
92
+
93
+ var buttons = {
94
+ ok: {
95
+ text: evf_data.ok,
96
+ btnClass: 'evf-ok-btn',
97
+ action: function () {
98
+
99
+ }
100
+ }
101
+ };
102
+
103
+ type = 'red';
104
+ title = evf_data.could_not_delete_single_choice;
105
+ content = evf_data.could_not_delete_single_choice_content;
106
+
107
+ $.confirm({
108
+ columnClass: 'evf-responsive-class',
109
+ type: type,
110
+ typeAnimated: true,
111
+ boxWidth: '400px',
112
+ useBootstrap: false,
113
+ title: title,
114
+ content: content,
115
+ buttons: buttons
116
+ });
117
+ return;
118
+ }
119
+ $(this).closest('li').remove();
120
+ EVFPanelBuilder.choiceChange(field_id);
121
+ });
122
+ var selector = '.evf-choices-list input';
123
+
124
+
125
+ $('body').on('keyup paste click', selector, function () {
126
+ var ul = $(this).closest('.evf-choices-list');
127
+ var field_id = ul.attr('data-field-id');
128
+ var type = $(this).attr('type');
129
+ if ( type.toLowerCase() === 'radio' ) {
130
+ if ( $(this).is(":checked") ) {
131
+ $(this).closest('.evf-choices-list').find('input[type="radio"]').prop('checked', false);
132
+ $(this).prop('checked', true);
133
+ }
134
+ }
135
+
136
+ EVFPanelBuilder.choiceChange(field_id);
137
+
138
+ });
139
+
140
+ },
141
+ choiceChange: function ( field_id ) {
142
+ var choices_wrapper = $('#everest-forms-field-option-row-' + field_id + '-choices');
143
+ var choices_field = $('#everest-forms-field-' + field_id);
144
+ var primary_field = choices_field.find('ul.primary-input');
145
+
146
+ var choice_type = choices_wrapper.find('ul.evf-choices-list').attr('data-field-type');
147
+ if ( choice_type === 'select' ) {
148
+ primary_field = choices_field.find('select.primary-input');
149
+ }
150
+ primary_field.html('');
151
+
152
+ $.each(choices_wrapper.find('ul.evf-choices-list').find('li'), function () {
153
+ var type = $(this).find('.default').attr('type');
154
+ var list = $('<li/>').append('<input type="' + type + '" disabled="">');
155
+ if ( choice_type === 'select' ) {
156
+ list = $('<option/>');
157
+ if ( $(this).find('.default').is(":checked") ) {
158
+ list.attr('selected', 'selected');
159
+ }
160
+ }
161
+ list.append($(this).find('.label').val());
162
+ if ( $(this).find('.default').is(":checked") ) {
163
+ list.find('input').prop('checked', true);
164
+ }
165
+ primary_field.append(list);
166
+ });
167
+
168
+ },
169
+ bindFormSettings: function () {
170
+
171
+ $('body').on('click', '.evf-setting-panel', function ( e ) {
172
+
173
+ var data_setting_section = $(this).attr('data-section');
174
+ $('.evf-setting-panel').removeClass('active');
175
+ $('.evf-content-section').removeClass('active');
176
+ $(this).addClass('active');
177
+ $('.evf-content-' + data_setting_section + '-settings').addClass('active');
178
+ e.preventDefault();
179
+ });
180
+
181
+ $('.evf-setting-panel').eq(0).trigger('click');
182
+ },
183
+ removeRow: function ( row ) {
184
+ $.each(row.find('.everest-forms-field'), function () {
185
+ var field = $(this);
186
+ var field_id = field.attr('data-field-id');
187
+ var option_field = $('#everest-forms-field-option-' + field_id);
188
+ field.remove();
189
+ option_field.remove();
190
+ });
191
+ row.remove();
192
+ },
193
+ bindRemoveRow: function () {
194
+ $('body').on('click', '.evf-delete-row', function () {
195
+ var row = $(this).closest('.evf-admin-row');
196
+ var buttons = {
197
+ confirm: {
198
+ text: evf_data.confirm,
199
+ btnClass: 'evf-confirm-btn',
200
+ action: function () {
201
+ EVFPanelBuilder.removeRow(row);
202
+ }
203
+ }, cancel: {
204
+ text: evf_data.cancel,
205
+ btnClass: 'evf-cancel-btn',
206
+ action: function () {
207
+
208
+ }
209
+ }
210
+ };
211
+ var type = '';
212
+ var title = evf_data.delete_confirm_title;
213
+ var content = evf_data.are_you_sure_want_to_delete_row;
214
+ if ( $('.evf-admin-row').length < 2 ) {
215
+ buttons = {
216
+ ok: {
217
+ text: evf_data.ok,
218
+ btnClass: 'evf-ok-btn',
219
+ action: function () {
220
+
221
+ }
222
+ }
223
+ };
224
+
225
+ type = 'red';
226
+ title = evf_data.could_not_delete_single_row_title;
227
+ content = evf_data.could_not_delete_single_row_content;
228
+ }
229
+ $.confirm({
230
+ columnClass: 'evf-responsive-class',
231
+ type: type,
232
+ typeAnimated: true,
233
+ boxWidth: '400px',
234
+ useBootstrap: false,
235
+ title: title,
236
+ content: content,
237
+ buttons: buttons
238
+ });
239
+ })
240
+ },
241
+ bindAddNewRow: function () {
242
+
243
+ $('body').on('click', '.evf-add-row span', function () {
244
+
245
+ var row_clone = $('.evf-admin-row').eq(0).clone();
246
+ var number_of_rows = $('.evf-admin-row').length;
247
+ row_clone.find('.evf-admin-grid').html('');
248
+ row_clone.attr('data-row-id', (number_of_rows + 1));
249
+ $('.evf-admin-field-wrapper').append(row_clone);
250
+ EVFPanelBuilder.bindFields();
251
+
252
+ EVFPanelBuilder.checkEmptyGrid();
253
+ })
254
+ },
255
+ bindFieldOptionChange: function () {
256
+
257
+ var selector = '.everest-forms-field-option-row input[type="text"][name$="[label]"], ' +
258
+ '.everest-forms-field-option-row textarea[name$="[description]"], ' +
259
+ '.everest-forms-field-option-row input[type="checkbox"][name$="[required]"], ' +
260
+ '.everest-forms-field-option-row input[type="checkbox"][name$="[label_hide]"], ' +
261
+ '.everest-forms-field-option-row input[type="text"][name$="[placeholder]"]';
262
+
263
+ $('body').on('keyup paste click', selector, function () {
264
+ EVFPanelBuilder.bindFormFieldChange($(this));
265
+ });
266
+
267
+ },
268
+ bindFormFieldChange: function ( option_field ) {
269
+ var field_id = option_field.closest('.everest-forms-field-option-row').attr('data-field-id');
270
+ var field = $('.evf-admin-grid #everest-forms-field-' + field_id + '.active');
271
+ var option_field_type = option_field.attr('id');
272
+ if ( option_field_type === 'undefined' || option_field_type === undefined ) {
273
+ return;
274
+ }
275
+ option_field_type = option_field_type.replace('everest-forms-field-option-' + field_id + '-', '');
276
+ switch ( option_field_type ) {
277
+ case 'label':
278
+ field.find('.label-title .text').text(option_field.val());
279
+ break;
280
+ case 'description':
281
+ field.find('.description').text(option_field.val());
282
+ break;
283
+ case 'required':
284
+ if ( option_field.is(":checked") ) {
285
+ field.find('.label-title .required').remove();
286
+ field.find('.label-title').append('<span class="required">*</span>');
287
+
288
+ } else {
289
+ field.find('.label-title .required').remove();
290
+ }
291
+ break;
292
+ case 'label_hide':
293
+ if ( option_field.is(":checked") ) {
294
+ field.find('.label-title').hide();
295
+
296
+ } else {
297
+ field.find('.label-title').show();
298
+ }
299
+ break;
300
+ case 'placeholder':
301
+ field.find('input').attr('placeholder', option_field.val());
302
+ break;
303
+
304
+ }
305
+
306
+ },
307
+ bindCloneField: function () {
308
+ $('body').on('click', '.everest-forms-preview .everest-forms-field .everest-forms-field-duplicate', function () {
309
+ var field = $(this).closest('.everest-forms-field');
310
+ var label_title = field.find('.label-title span.text').text();
311
+ $.confirm({
312
+ columnClass: 'evf-responsive-class',
313
+ boxWidth: '400px',
314
+ useBootstrap: false,
315
+ title: evf_data.duplicate_confirm_title,
316
+ content: evf_data.are_you_sure_want_to_duplicate_this + ' <b>' + label_title + '</b> ' + evf_data.field + ' ?',
317
+ buttons: {
318
+ confirm: {
319
+ text: evf_data.confirm,
320
+ btnClass: 'evf-confirm-btn',
321
+ action: function () {
322
+ EVFPanelBuilder.cloneFieldAction(field);
323
+ }
324
+ }, cancel: {
325
+ text: evf_data.cancel,
326
+ btnClass: 'evf-cancel-btn',
327
+ action: function () {
328
+
329
+ }
330
+ }
331
+ }
332
+ });
333
+ });
334
+
335
+ },
336
+ cloneFieldAction: function ( field ) {
337
+ var element_field_id = field.attr('data-field-id');
338
+ var form_id = evf_data.form_id;
339
+ var data = {
340
+ action: 'everest_forms_get_next_id',
341
+ security: evf_data.evf_get_next_id,
342
+ form_id: form_id
343
+ };
344
+ $.ajax({
345
+ url: evf_data.ajax_url,
346
+ data: data,
347
+ type: 'POST',
348
+ beforeSend: function () {
349
+ },
350
+ success: function ( response ) {
351
+ if ( typeof response.success === 'boolean' && response.success === true ) {
352
+
353
+ var field_id = response.data.field_id;
354
+ var field_key = response.data.field_key;
355
+ $('#everest-forms-field-id').val(field_id);
356
+
357
+ EVFPanelBuilder.render_node(field, element_field_id, field_key);
358
+
359
+ }
360
+ }
361
+ });
362
+ },
363
+ render_node: function ( field, old_key, new_key ) {
364
+
365
+ var option = $('.everest-forms-field-options #everest-forms-field-option-' + old_key);
366
+ var field_type = field.attr('data-field-type'),
367
+ newOptionHtml = option.html(),
368
+ new_field_label = evf_data.copy_of + $('#everest-forms-field-option-' + old_key + '-label').val(),
369
+ newFieldCloned = field.clone();
370
+ var regex = new RegExp(old_key, "g");
371
+ newOptionHtml = newOptionHtml.replace(regex, new_key);
372
+ var newOption = $('<div class="everest-forms-field-option everest-forms-field-option-' + field_type + '" id="everest-forms-field-option-' + new_key + '" data-field-id="' + new_key + '" />');
373
+ newOption.append(newOptionHtml);
374
+ $.each(option.find(':input'), function () {
375
+ var type = $(this).attr('type');
376
+ var name = $(this).attr('name');
377
+ var new_name = name.replace(regex, new_key);
378
+ var value = '';
379
+ if ( type === 'text' || type === 'hidden' ) {
380
+ value = $(this).val();
381
+ newOption.find('input[name="' + new_name + '"]').val(value);
382
+ newOption.find('input[value="' + old_key + '"]').val(new_key);
383
+ } else if ( type === 'checkbox' || type === 'radio' ) {
384
+ if ( $(this).is(':checked') ) {
385
+ newOption.find('input[name="' + new_name + '"]').prop('checked', true).attr('checked', 'checked');
386
+ } else {
387
+ newOption.find('[name="' + new_name + '"]').prop('checked', false).attr('checked', false);
388
+ }
389
+ } else if ( $(this).is('select') ) {
390
+ if ( $(this).find('option:selected').length ) {
391
+ var option_value = $(this).find('option:selected').val();
392
+ newOption.find('[name="' + new_name + '"]').find('[value="' + option_value + '"]').prop('selected', true);
393
+ }
394
+ } else {
395
+ if ( $(this).val() !== '' ) {
396
+ newOption.find('[name="' + new_name + '"]').val($(this).val());
397
+ }
398
+ }
399
+ });
400
+
401
+ $('.everest-forms-field-options').append(newOption);
402
+
403
+ $('#everest-forms-field-option-' + new_key + '-label').val(new_field_label);
404
+
405
+ // Field Clone
406
+ newFieldCloned.attr('class', field.attr('class'));
407
+ newFieldCloned.attr('id', 'everest-forms-field-' + new_key);
408
+ newFieldCloned.attr('data-field-id', new_key);
409
+ newFieldCloned.attr('data-field-type', field_type);
410
+ newFieldCloned.find('.label-title .text').text(new_field_label);
411
+ field.closest('.evf-admin-grid').append(newFieldCloned);
412
+ $(document).trigger('everest-form-cloned', [ new_key, type ]);
413
+
414
+
415
+ },
416
+ bindFieldDelete: function () {
417
+ $('body').on('click', '.everest-forms-preview .everest-forms-field .everest-forms-field-delete', function () {
418
+ var field = $(this).closest('.everest-forms-field');
419
+ var field_id = field.attr('data-field-id');
420
+ var option_field = $('#everest-forms-field-option-' + field_id);
421
+ var label_title = field.find('.label-title span.text').text();
422
+ $.confirm({
423
+ columnClass: 'evf-responsive-class',
424
+ boxWidth: '400px',
425
+ useBootstrap: false,
426
+ title: evf_data.delete_confirm_title,
427
+ content: evf_data.are_you_sure_want_to_delete_this + ' <b>' + label_title + '</b> ' + evf_data.field + ' ?',
428
+ buttons: {
429
+ confirm: {
430
+ text: evf_data.confirm,
431
+ btnClass: 'evf-confirm-btn',
432
+ action: function () {
433
+ $('.evf-panel-fields-button').trigger('click');
434
+ field.fadeOut("slow", function () {
435
+ field.remove();
436
+ option_field.remove();
437
+ });
438
+ }
439
+ }, cancel: {
440
+ text: evf_data.cancel,
441
+ btnClass: 'evf-cancel-btn',
442
+ action: function () {
443
+
444
+ }
445
+ }
446
+ }
447
+ });
448
+ });
449
+ },
450
+ bindSaveOption: function () {
451
+
452
+ $('body').on('click', '.evf_save_form_action_button', function () {
453
+ var $this = $(this);
454
+ var form = $('form#everest-forms-builder-form');
455
+ var structure = EVFPanelBuilder.getStructure();
456
+
457
+ var form_data = form.serializeArray();
458
+
459
+ var new_form_data = form_data.concat(structure);
460
+
461
+ var data = {
462
+ action: 'everest_forms_save_form',
463
+ security: evf_data.evf_save_form,
464
+ form_data: JSON.stringify(new_form_data),
465
+ };
466
+ var $wrapper = $('#everest-forms-builder');
467
+ $.ajax({
468
+ url: evf_data.ajax_url,
469
+ data: data,
470
+ type: 'POST',
471
+ beforeSend: function () {
472
+ evfHelper.startEvfOverLay($wrapper, $this);
473
+ },
474
+ success: function ( response ) {
475
+ evfHelper.endEvfOverLay($wrapper, $this);
476
+
477
+ if ( typeof response.success === 'boolean' && response.success === true ) {
478
+ // console.log(response.data);
479
+ // window.location = response.data.redirect_url;
480
+ window.location.reload();
481
+ }
482
+ }
483
+ });
484
+ })
485
+
486
+ },
487
+ getStructure: function () {
488
+
489
+ var wrapper = $('.evf-admin-field-wrapper');
490
+ var structure = [];
491
+ $.each(wrapper.find('.evf-admin-row'), function () {
492
+ var row = $(this);
493
+ var row_id = row.attr('data-row-id');
494
+ $.each(row.find('.evf-admin-grid'), function () {
495
+ var grid = $(this);
496
+ var grid_id = grid.attr('data-grid-id');
497
+
498
+ var array_index = 0;
499
+ $.each(grid.find('.everest-forms-field'), function () {
500
+ var structure_object = { name: '', value: '' };
501
+ var field_id = $(this).attr('data-field-id');
502
+ structure_object.name = 'structure[row_' + row_id + '][grid_' + grid_id + '][' + array_index + ']';
503
+ array_index++;
504
+ structure_object.value = field_id;
505
+ structure.push(structure_object);
506
+ });
507
+ if ( grid.find('.everest-forms-field').length < 1 ) {
508
+
509
+ structure.push({ name: 'structure[row_' + row_id + '][grid_' + grid_id + ']', value: '' });
510
+
511
+ }
512
+
513
+ })
514
+
515
+ });
516
+ return structure;
517
+ },
518
+ getFieldArray: function ( grid ) {
519
+
520
+ var fields = [];
521
+ $.each(grid.find('.everest-forms-field'), function () {
522
+
523
+ var field_id = $(this).attr('data-field-id');
524
+ fields.push(field_id);
525
+ });
526
+ return fields;
527
+ },
528
+
529
+ checkEmptyGrid: function () {
530
+
531
+ $.each($('.evf-admin-grid'), function () {
532
+ if ( $(this).find('.everest-forms-field').length < 1 ) {
533
+ $(this).addClass('evf-empty-grid');
534
+ } else {
535
+ $(this).removeClass('evf-empty-grid');
536
+ }
537
+ });
538
+ EVFPanelBuilder.choicesInit();
539
+
540
+ },
541
+ bindDefaultTabs: function () {
542
+
543
+ $(document).on('click', '#evf-builder-tabs li', function ( e ) {
544
+ e.preventDefault();
545
+ EVFPanelBuilder.switchTab($(this).data('panel'));
546
+ });
547
+ },
548
+ switchTab: function ( panel ) {
549
+ var $panel = $('#everest-forms-panel-' + panel),
550
+ $panelBtn = $('.evf-panel-' + panel + '-button');
551
+
552
+ $('#evf-builder-tabs').find('li a').removeClass('active');
553
+ $panelBtn.find('a').addClass('active');
554
+ $panel.closest('.evf-tab-content').find('.everest-forms-panel').removeClass('active');
555
+ $panel.addClass('active');
556
+ if ( panel === 'fields' ) {
557
+ $('.everest-forms-field-options').hide();
558
+ $('.everest-forms-add-fields').show();
559
+
560
+
561
+ }
562
+ history.replaceState({}, null, evfHelper.updateQueryString('tab', panel));
563
+ EVFPanelBuilder.switchPanel(panel);
564
+
565
+ },
566
+ switchPanel: function ( panel ) {
567
+ if ( panel === 'field-options' ) {
568
+
569
+ EVFPanelBuilder.switchToFieldOptionPanel();
570
+ }
571
+
572
+ },
573
+ switchToFieldOptionPanel: function ( field_id ) {
574
+ $('li.evf-panel-field-options-button.evf-disabled-tab').show();
575
+ $('.everest-forms-field-options').find('.no-fields').hide();
576
+ $('.evf-admin-field-wrapper .everest-forms-field').removeClass('active');
577
+ $('.everest-forms-panel').removeClass('active');
578
+ $('#everest-forms-panel-fields').addClass('active');
579
+ $('.everest-forms-add-fields').hide();
580
+ $('.everest-forms-field-options').show();
581
+ $('.everest-forms-field-options').find('.everest-forms-field-option').hide();
582
+ $('.evf-tab-lists').find('li a').removeClass('active');
583
+ $('.evf-tab-lists').find('li.evf-panel-field-options-button a').addClass('active');
584
+ if ( typeof field_id !== 'undefined' ) {
585
+
586
+ $('#everest-forms-field-option-' + field_id).show();
587
+ $('#everest-forms-field-' + field_id).addClass('active');
588
+
589
+ } else {
590
+
591
+ if ( $('.evf-admin-field-wrapper .everest-forms-field').length > 0 ) {
592
+ $('.evf-admin-field-wrapper .everest-forms-field').eq(0).addClass('active');
593
+ $('#everest-forms-field-option-' + $('.evf-admin-field-wrapper .everest-forms-field').eq(0).attr('data-field-id')).show();
594
+
595
+ } else {
596
+ $('.everest-forms-field-options').find('.no-fields').show();
597
+ }
598
+ }
599
+ },
600
+ bindFields: function () {
601
+
602
+ $('.evf-admin-grid').sortable({
603
+ containment: '.evf-admin-field-wrapper',
604
+ cancel: false,
605
+ over: function ( event, ui ) {
606
+ $(event.target).addClass('evf-item-hover');
607
+ $('.evf-admin-grid').addClass('evf-hover');
608
+ EVFPanelBuilder.checkEmptyGrid();
609
+ },
610
+ out: function ( event, ui ) {
611
+ $('.evf-admin-grid').removeClass('evf-hover');
612
+ $(event.target).removeClass('evf-item-hover');
613
+ EVFPanelBuilder.checkEmptyGrid();
614
+
615
+ },
616
+ revert: true,
617
+ connectWith: '.evf-admin-grid'
618
+ }).disableSelection();
619
+
620
+ $('.evf-admin-field-wrapper').sortable({
621
+ containment: '.evf-admin-field-wrapper',
622
+ tolerance: 'pointer',
623
+ revert: 'invalid',
624
+ placeholder: 'evf-admin-row',
625
+ forceHelperSize: true,
626
+ over: function () {
627
+ $('.evf-admin-field-wrapper').addClass('evf-hover');
628
+ },
629
+ out: function () {
630
+ $('.evf-admin-field-wrapper').removeClass('evf-hover');
631
+ }
632
+ });
633
+ $('.evf-registered-buttons button.evf-registered-item').draggable({
634
+ connectToSortable: '.evf-admin-grid',
635
+ containment: '#everest-forms-builder',
636
+ helper: 'clone',
637
+ revert: 'invalid',
638
+ cancel: false,
639
+ start: function ( event, ui ) {
640
+ $('.evf-admin-grid').addClass('evf-hover');
641
+ },
642
+ stop: function ( event, ui ) {
643
+ $('.evf-admin-grid').removeClass('evf-hover');
644
+ var grid = ui.helper.closest('.evf-admin-grid');
645
+ var helper = ui.helper;
646
+ EVFPanelBuilder.fieldDrop(helper);
647
+
648
+
649
+ }
650
+ }).disableSelection();
651
+ },
652
+ bindFormPreview: function () {
653
+
654
+ },
655
+ bindGridSwitcher: function () {
656
+ $('body').on('click', '.evf-show-grid', function () {
657
+ $(this).closest('.evf-toggle-row').find(".evf-toggle-row-content").slideToggle(200);
658
+ });
659
+ var max_number_of_grid = 2;
660
+ $('body').on('click', '.evf-grid-selector', function () {
661
+ var $this_single_row = $(this).closest('.evf-admin-row');
662
+ if ( $(this).hasClass('active') ) {
663
+ return;
664
+ }
665
+ var grid_id = evfHelper.parseInt($(this).attr('data-evf-grid'));
666
+ if ( grid_id > max_number_of_grid ) {
667
+ return;
668
+ }
669
+ var grid_node = $('<div class="evf-admin-grid evf-grid-' + grid_id + ' ui-sortable" />');
670
+ var grids = $('<div/>');
671
+
672
+
673
+ $.each($this_single_row.find('.evf-admin-grid'), function () {
674
+ $(this).children('*').each(function () {
675
+ grids.append($(this).clone()); // "this" is the current element in the loop
676
+ });
677
+ });
678
+ $this_single_row.find('.evf-admin-grid').remove();
679
+ $this_single_row.find('.evf-clear ').remove();
680
+ $this_single_row.append('<div class="clear evf-clear"></div>');
681
+
682
+ for ( var $grid_number = 1; $grid_number <= grid_id; $grid_number++ ) {
683
+
684
+ grid_node.attr('data-grid-id', $grid_number);
685
+ $this_single_row.append(grid_node.clone());
686
+
687
+ }
688
+ $this_single_row.append('<div class="clear evf-clear"></div>');
689
+ $this_single_row.find('.evf-admin-grid').eq(0).append(grids.html());
690
+ $this_single_row.find('.evf-grid-selector').removeClass('active');
691
+ $(this).addClass('active');
692
+ EVFPanelBuilder.bindFields();
693
+ });
694
+ },
695
+ fieldDrop: function ( field ) {
696
+ var field_type = field.attr('data-field-type');
697
+ field.css({
698
+ 'width': '100%',
699
+ 'left': '0',
700
+ });
701
+
702
+ field.append('<i class="spinner is-active" style="margin: 0;padding: 0;"></i>');
703
+
704
+ var data = {
705
+ action: 'everest_forms_new_field_' + field_type,
706
+ security: evf_data.evf_field_drop_nonce,
707
+ field_type: field_type,
708
+ form_id: evf_data.form_id
709
+ };
710
+ $.ajax({
711
+ url: evf_data.ajax_url,
712
+ data: data,
713
+ type: 'POST',
714
+ beforeSend: function () {
715
+
716
+ },
717
+ success: function ( response ) {
718
+ var field_preview = response.data.preview;
719
+ var field_options = response.data.options;
720
+ var form_field_id = response.data.form_field_id;
721
+ $('#everest-forms-field-id').val(form_field_id);
722
+ $('.everest-forms-field-options').find('.no-fields').hide();
723
+ $('.everest-forms-field-options').append(field_options);
724
+ field.after(field_preview);
725
+ field.remove();
726
+ EVFPanelBuilder.checkEmptyGrid();
727
+
728
+
729
+ }
730
+ });
731
+ },
732
+ bindFieldSettings: function () {
733
+
734
+ $('body').on('click', '.everest-forms-preview .everest-forms-field, .everest-forms-preview .everest-forms-field .everest-forms-field-setting', function () {
735
+ var field_id = $(this).closest('.everest-forms-field').attr('data-field-id');
736
+
737
+ EVFPanelBuilder.switchToFieldOptionPanel(field_id);
738
+ });
739
+
740
+ }
741
+ };
742
+
743
+ $(function () {
744
+ EVFPanelBuilder.init();
745
+ });
746
+
747
+ })(jQuery, window.evf_data);
748
+
749
+ jQuery(function () {
750
+
751
+ var mySelect = jQuery('#everest-forms-panel-field-settings-redirect_to option:selected').val();
752
+
753
+ if ( mySelect == '0' ) {
754
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').hide();
755
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').hide();
756
+ }
757
+ else if(mySelect == '1') {
758
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').show();
759
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').hide();
760
+ }
761
+ else if(mySelect == '2'){
762
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').show();
763
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').hide();
764
+ }
765
+
766
+ jQuery( '#everest-forms-panel-field-settings-redirect_to' ).on( 'change', function () {
767
+ if ( this.value == '0' ) {
768
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').hide();
769
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').hide();
770
+ }
771
+ else if ( this.value == '1') {
772
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').show();
773
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').hide();
774
+ }
775
+ else if ( this.value == '2') {
776
+ jQuery('#everest-forms-panel-field-settings-custom_page-wrap').hide();
777
+ jQuery('#everest-forms-panel-field-settings-external_url-wrap').show();
778
+ }
779
+ });
780
+ jQuery( 'li.evf-panel-field-options-button.evf-disabled-tab' ).hide();
781
+
782
+ });
783
+
784
+ jQuery( function ( $ ) {
785
+
786
+ // Init tooltip.
787
+ $( document.body ).on( 'init_tooltips', function() {
788
+ $( '.tips, .help_tip, .everest-forms-help-tooltip' ).tipTip( {
789
+ 'attribute': 'data-tip',
790
+ 'fadeIn': 50,
791
+ 'fadeOut': 50,
792
+ 'delay': 200
793
+ } );
794
+ } ).trigger( 'init_tooltips' );
795
+
796
+ $( '.everest-forms-tab-content' ).on( 'click', '.everest-forms-add-fields-group > a', function( event ) {
797
+ event.preventDefault();
798
+ });
799
+
800
+ // Fields Options - Open/close.
801
+ $( '.everest-forms-field-option' ).on( 'click', '.everest-forms-field-option-group > a', function( event ) {
802
+ event.preventDefault();
803
+ $( this ).parent( '.everest-forms-field-option-group' ).toggleClass( 'closed' ).toggleClass( 'open' );
804
+ });
805
+ $( '.everest-forms-field-option' ).on( 'click', '.everest-forms-field-option-group a', function( event ) {
806
+ // If the user clicks on some form input inside, the box should not be toggled.
807
+ if ( $( event.target ).filter( ':input, option, .sort' ).length ) {
808
+ return;
809
+ }
810
+
811
+ $( this ).next( '.everest-forms-field-option-group-inner' ).stop().slideToggle();
812
+ });
813
+ $( '.everest-forms-field-option-group.closed' ).each( function() {
814
+ $( this ).find( '.everest-forms-field-option-group-inner' ).hide();
815
+ });
816
+ });
assets/js/admin/everest-panel-builder.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e,t){var i={init:function(){e(document).ready(i.ready),e(window).on("load",i.load),i.bindUI()},load:function(){},bindUI:function(){i.bindDefaultTabs(),i.checkEmptyGrid(),i.bindFields(),i.bindFormPreview(),i.bindGridSwitcher(),i.bindFieldSettings(),i.bindFieldDelete(),i.bindCloneField(),i.bindSaveOption(),i.bindFieldOptionChange(),i.bindAddNewRow(),i.bindRemoveRow(),i.bindFormSettings(),i.choicesInit(),i.choicesUpdate();"field-options"===t.tab&&e(".evf-panel-field-options-button").trigger("click")},choicesInit:function(){var t=e(".evf-choices-list");t.sortable({out:function(t,n){var o=e(t.target).attr("data-field-id");i.choiceChange(o)}});var n=t.closest(".everest-forms-field-option").attr("data-field-id");e("#everest-forms-field-"+n)},choicesUpdate:function(){e(".evf-choices-list");e("body").on("click",".evf-choices-list a.add",function(){var t=e(this).closest("li").clone();t.find('input[type="text"]').val("");var n=e(this).closest(".evf-choices-list"),o=n.attr("data-field-id"),r=n.find("li").length;r++,t.find('input[type="checkbox"],input[type="radio"]').prop("checked",!1),t.attr("data-key",r),t.find(".default").attr("name","form_fields["+o+"][choices]["+r+"][default]"),t.find(".label").attr("name","form_fields["+o+"][choices]["+r+"][label]"),t.find(".value").attr("name","form_fields["+o+"][choices]["+r+"][value]"),e(this).closest("li").after(t),i.choiceChange(o)}),e("body").on("click",".evf-choices-list a.remove",function(){var n=e(this).closest(".evf-choices-list"),o=n.attr("data-field-id");if(n.find("li").length<2){var r=t.delete_confirm_title,s=t.are_you_sure_want_to_delete_row,a={ok:{text:t.ok,btnClass:"evf-ok-btn",action:function(){}}};return"red",r=t.could_not_delete_single_choice,s=t.could_not_delete_single_choice_content,void e.confirm({columnClass:"evf-responsive-class",type:"red",typeAnimated:!0,boxWidth:"400px",useBootstrap:!1,title:r,content:s,buttons:a})}e(this).closest("li").remove(),i.choiceChange(o)});e("body").on("keyup paste click",".evf-choices-list input",function(){var t=e(this).closest(".evf-choices-list").attr("data-field-id");"radio"===e(this).attr("type").toLowerCase()&&e(this).is(":checked")&&(e(this).closest(".evf-choices-list").find('input[type="radio"]').prop("checked",!1),e(this).prop("checked",!0)),i.choiceChange(t)})},choiceChange:function(t){var i=e("#everest-forms-field-option-row-"+t+"-choices"),n=e("#everest-forms-field-"+t),o=n.find("ul.primary-input"),r=i.find("ul.evf-choices-list").attr("data-field-type");"select"===r&&(o=n.find("select.primary-input")),o.html(""),e.each(i.find("ul.evf-choices-list").find("li"),function(){var t=e(this).find(".default").attr("type"),i=e("<li/>").append('<input type="'+t+'" disabled="">');"select"===r&&(i=e("<option/>"),e(this).find(".default").is(":checked")&&i.attr("selected","selected")),i.append(e(this).find(".label").val()),e(this).find(".default").is(":checked")&&i.find("input").prop("checked",!0),o.append(i)})},bindFormSettings:function(){e("body").on("click",".evf-setting-panel",function(t){var i=e(this).attr("data-section");e(".evf-setting-panel").removeClass("active"),e(".evf-content-section").removeClass("active"),e(this).addClass("active"),e(".evf-content-"+i+"-settings").addClass("active"),t.preventDefault()}),e(".evf-setting-panel").eq(0).trigger("click")},removeRow:function(t){e.each(t.find(".everest-forms-field"),function(){var t=e(this),i=t.attr("data-field-id"),n=e("#everest-forms-field-option-"+i);t.remove(),n.remove()}),t.remove()},bindRemoveRow:function(){e("body").on("click",".evf-delete-row",function(){var n=e(this).closest(".evf-admin-row"),o={confirm:{text:t.confirm,btnClass:"evf-confirm-btn",action:function(){i.removeRow(n)}},cancel:{text:t.cancel,btnClass:"evf-cancel-btn",action:function(){}}},r="",s=t.delete_confirm_title,a=t.are_you_sure_want_to_delete_row;e(".evf-admin-row").length<2&&(o={ok:{text:t.ok,btnClass:"evf-ok-btn",action:function(){}}},r="red",s=t.could_not_delete_single_row_title,a=t.could_not_delete_single_row_content),e.confirm({columnClass:"evf-responsive-class",type:r,typeAnimated:!0,boxWidth:"400px",useBootstrap:!1,title:s,content:a,buttons:o})})},bindAddNewRow:function(){e("body").on("click",".evf-add-row span",function(){var t=e(".evf-admin-row").eq(0).clone(),n=e(".evf-admin-row").length;t.find(".evf-admin-grid").html(""),t.attr("data-row-id",n+1),e(".evf-admin-field-wrapper").append(t),i.bindFields(),i.checkEmptyGrid()})},bindFieldOptionChange:function(){e("body").on("keyup paste click",'.everest-forms-field-option-row input[type="text"][name$="[label]"], .everest-forms-field-option-row textarea[name$="[description]"], .everest-forms-field-option-row input[type="checkbox"][name$="[required]"], .everest-forms-field-option-row input[type="checkbox"][name$="[label_hide]"], .everest-forms-field-option-row input[type="text"][name$="[placeholder]"]',function(){i.bindFormFieldChange(e(this))})},bindFormFieldChange:function(t){var i=t.closest(".everest-forms-field-option-row").attr("data-field-id"),n=e(".evf-admin-grid #everest-forms-field-"+i+".active"),o=t.attr("id");if("undefined"!==o&&o!==undefined)switch(o=o.replace("everest-forms-field-option-"+i+"-","")){case"label":n.find(".label-title .text").text(t.val());break;case"description":n.find(".description").text(t.val());break;case"required":t.is(":checked")?(n.find(".label-title .required").remove(),n.find(".label-title").append('<span class="required">*</span>')):n.find(".label-title .required").remove();break;case"label_hide":t.is(":checked")?n.find(".label-title").hide():n.find(".label-title").show();break;case"placeholder":n.find("input").attr("placeholder",t.val())}},bindCloneField:function(){e("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-duplicate",function(){var n=e(this).closest(".everest-forms-field"),o=n.find(".label-title span.text").text();e.confirm({columnClass:"evf-responsive-class",boxWidth:"400px",useBootstrap:!1,title:t.duplicate_confirm_title,content:t.are_you_sure_want_to_duplicate_this+" <b>"+o+"</b> "+t.field+" ?",buttons:{confirm:{text:t.confirm,btnClass:"evf-confirm-btn",action:function(){i.cloneFieldAction(n)}},cancel:{text:t.cancel,btnClass:"evf-cancel-btn",action:function(){}}}})})},cloneFieldAction:function(n){var o=n.attr("data-field-id"),r=t.form_id,s={action:"everest_forms_get_next_id",security:t.evf_get_next_id,form_id:r};e.ajax({url:t.ajax_url,data:s,type:"POST",beforeSend:function(){},success:function(t){if("boolean"==typeof t.success&&!0===t.success){var r=t.data.field_id,s=t.data.field_key;e("#everest-forms-field-id").val(r),i.render_node(n,o,s)}}})},render_node:function(i,n,o){var r=e(".everest-forms-field-options #everest-forms-field-option-"+n),s=i.attr("data-field-type"),a=r.html(),d=t.copy_of+e("#everest-forms-field-option-"+n+"-label").val(),l=i.clone(),f=new RegExp(n,"g");a=a.replace(f,o);var c=e('<div class="everest-forms-field-option everest-forms-field-option-'+s+'" id="everest-forms-field-option-'+o+'" data-field-id="'+o+'" />');c.append(a),e.each(r.find(":input"),function(){var t=e(this).attr("type"),i=e(this).attr("name").replace(f,o),r="";if("text"===t||"hidden"===t)r=e(this).val(),c.find('input[name="'+i+'"]').val(r),c.find('input[value="'+n+'"]').val(o);else if("checkbox"===t||"radio"===t)e(this).is(":checked")?c.find('input[name="'+i+'"]').prop("checked",!0).attr("checked","checked"):c.find('[name="'+i+'"]').prop("checked",!1).attr("checked",!1);else if(e(this).is("select")){if(e(this).find("option:selected").length){var s=e(this).find("option:selected").val();c.find('[name="'+i+'"]').find('[value="'+s+'"]').prop("selected",!0)}}else""!==e(this).val()&&c.find('[name="'+i+'"]').val(e(this).val())}),e(".everest-forms-field-options").append(c),e("#everest-forms-field-option-"+o+"-label").val(d),l.attr("class",i.attr("class")),l.attr("id","everest-forms-field-"+o),l.attr("data-field-id",o),l.attr("data-field-type",s),l.find(".label-title .text").text(d),i.closest(".evf-admin-grid").append(l),e(document).trigger("everest-form-cloned",[o,type])},bindFieldDelete:function(){e("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-delete",function(){var i=e(this).closest(".everest-forms-field"),n=i.attr("data-field-id"),o=e("#everest-forms-field-option-"+n),r=i.find(".label-title span.text").text();e.confirm({columnClass:"evf-responsive-class",boxWidth:"400px",useBootstrap:!1,title:t.delete_confirm_title,content:t.are_you_sure_want_to_delete_this+" <b>"+r+"</b> "+t.field+" ?",buttons:{confirm:{text:t.confirm,btnClass:"evf-confirm-btn",action:function(){e(".evf-panel-fields-button").trigger("click"),i.fadeOut("slow",function(){i.remove(),o.remove()})}},cancel:{text:t.cancel,btnClass:"evf-cancel-btn",action:function(){}}}})})},bindSaveOption:function(){e("body").on("click",".evf_save_form_action_button",function(){var n=e(this),o=e("form#everest-forms-builder-form"),r=i.getStructure(),s=o.serializeArray().concat(r),a={action:"everest_forms_save_form",security:t.evf_save_form,form_data:JSON.stringify(s)},d=e("#everest-forms-builder");e.ajax({url:t.ajax_url,data:a,type:"POST",beforeSend:function(){evfHelper.startEvfOverLay(d,n)},success:function(e){evfHelper.endEvfOverLay(d,n),"boolean"==typeof e.success&&!0===e.success&&window.location.reload()}})})},getStructure:function(){var t=e(".evf-admin-field-wrapper"),i=[];return e.each(t.find(".evf-admin-row"),function(){var t=e(this),n=t.attr("data-row-id");e.each(t.find(".evf-admin-grid"),function(){var t=e(this),o=t.attr("data-grid-id"),r=0;e.each(t.find(".everest-forms-field"),function(){var t={name:"",value:""},s=e(this).attr("data-field-id");t.name="structure[row_"+n+"][grid_"+o+"]["+r+"]",r++,t.value=s,i.push(t)}),t.find(".everest-forms-field").length<1&&i.push({name:"structure[row_"+n+"][grid_"+o+"]",value:""})})}),i},getFieldArray:function(t){var i=[];return e.each(t.find(".everest-forms-field"),function(){var t=e(this).attr("data-field-id");i.push(t)}),i},checkEmptyGrid:function(){e.each(e(".evf-admin-grid"),function(){e(this).find(".everest-forms-field").length<1?e(this).addClass("evf-empty-grid"):e(this).removeClass("evf-empty-grid")}),i.choicesInit()},bindDefaultTabs:function(){e(document).on("click","#evf-builder-tabs li",function(t){t.preventDefault(),i.switchTab(e(this).data("panel"))})},switchTab:function(t){var n=e("#everest-forms-panel-"+t),o=e(".evf-panel-"+t+"-button");e("#evf-builder-tabs").find("li a").removeClass("active"),o.find("a").addClass("active"),n.closest(".evf-tab-content").find(".everest-forms-panel").removeClass("active"),n.addClass("active"),"fields"===t&&(e(".everest-forms-field-options").hide(),e(".everest-forms-add-fields").show()),history.replaceState({},null,evfHelper.updateQueryString("tab",t)),i.switchPanel(t)},switchPanel:function(e){"field-options"===e&&i.switchToFieldOptionPanel()},switchToFieldOptionPanel:function(t){e("li.evf-panel-field-options-button.evf-disabled-tab").show(),e(".everest-forms-field-options").find(".no-fields").hide(),e(".evf-admin-field-wrapper .everest-forms-field").removeClass("active"),e(".everest-forms-panel").removeClass("active"),e("#everest-forms-panel-fields").addClass("active"),e(".everest-forms-add-fields").hide(),e(".everest-forms-field-options").show(),e(".everest-forms-field-options").find(".everest-forms-field-option").hide(),e(".evf-tab-lists").find("li a").removeClass("active"),e(".evf-tab-lists").find("li.evf-panel-field-options-button a").addClass("active"),void 0!==t?(e("#everest-forms-field-option-"+t).show(),e("#everest-forms-field-"+t).addClass("active")):e(".evf-admin-field-wrapper .everest-forms-field").length>0?(e(".evf-admin-field-wrapper .everest-forms-field").eq(0).addClass("active"),e("#everest-forms-field-option-"+e(".evf-admin-field-wrapper .everest-forms-field").eq(0).attr("data-field-id")).show()):e(".everest-forms-field-options").find(".no-fields").show()},bindFields:function(){e(".evf-admin-grid").sortable({containment:".evf-admin-field-wrapper",cancel:!1,over:function(t,n){e(t.target).addClass("evf-item-hover"),e(".evf-admin-grid").addClass("evf-hover"),i.checkEmptyGrid()},out:function(t,n){e(".evf-admin-grid").removeClass("evf-hover"),e(t.target).removeClass("evf-item-hover"),i.checkEmptyGrid()},revert:!0,connectWith:".evf-admin-grid"}).disableSelection(),e(".evf-admin-field-wrapper").sortable({containment:".evf-admin-field-wrapper",tolerance:"pointer",revert:"invalid",placeholder:"evf-admin-row",forceHelperSize:!0,over:function(){e(".evf-admin-field-wrapper").addClass("evf-hover")},out:function(){e(".evf-admin-field-wrapper").removeClass("evf-hover")}}),e(".evf-registered-buttons button.evf-registered-item").draggable({connectToSortable:".evf-admin-grid",containment:"#everest-forms-builder",helper:"clone",revert:"invalid",cancel:!1,start:function(t,i){e(".evf-admin-grid").addClass("evf-hover")},stop:function(t,n){e(".evf-admin-grid").removeClass("evf-hover");n.helper.closest(".evf-admin-grid");var o=n.helper;i.fieldDrop(o)}}).disableSelection()},bindFormPreview:function(){},bindGridSwitcher:function(){e("body").on("click",".evf-show-grid",function(){e(this).closest(".evf-toggle-row").find(".evf-toggle-row-content").slideToggle(200)});e("body").on("click",".evf-grid-selector",function(){var t=e(this).closest(".evf-admin-row");if(!e(this).hasClass("active")){var n=evfHelper.parseInt(e(this).attr("data-evf-grid"));if(!(n>2)){var o=e('<div class="evf-admin-grid evf-grid-'+n+' ui-sortable" />'),r=e("<div/>");e.each(t.find(".evf-admin-grid"),function(){e(this).children("*").each(function(){r.append(e(this).clone())})}),t.find(".evf-admin-grid").remove(),t.find(".evf-clear ").remove(),t.append('<div class="clear evf-clear"></div>');for(var s=1;s<=n;s++)o.attr("data-grid-id",s),t.append(o.clone());t.append('<div class="clear evf-clear"></div>'),t.find(".evf-admin-grid").eq(0).append(r.html()),t.find(".evf-grid-selector").removeClass("active"),e(this).addClass("active"),i.bindFields()}}})},fieldDrop:function(n){var o=n.attr("data-field-type");n.css({width:"100%",left:"0"}),n.append('<i class="spinner is-active" style="margin: 0;padding: 0;"></i>');var r={action:"everest_forms_new_field_"+o,security:t.evf_field_drop_nonce,field_type:o,form_id:t.form_id};e.ajax({url:t.ajax_url,data:r,type:"POST",beforeSend:function(){},success:function(t){var o=t.data.preview,r=t.data.options,s=t.data.form_field_id;e("#everest-forms-field-id").val(s),e(".everest-forms-field-options").find(".no-fields").hide(),e(".everest-forms-field-options").append(r),n.after(o),n.remove(),i.checkEmptyGrid()}})},bindFieldSettings:function(){e("body").on("click",".everest-forms-preview .everest-forms-field, .everest-forms-preview .everest-forms-field .everest-forms-field-setting",function(){var t=e(this).closest(".everest-forms-field").attr("data-field-id");i.switchToFieldOptionPanel(t)})}};e(function(){i.init()})}(jQuery,window.evf_data),jQuery(function(){var e=jQuery("#everest-forms-panel-field-settings-redirect_to option:selected").val();"0"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==e&&(jQuery("#everest-forms-panel-field-settings-external_url-wrap").show(),jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide()),jQuery("#everest-forms-panel-field-settings-redirect_to").on("change",function(){"0"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==this.value&&(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").show())}),jQuery("li.evf-panel-field-options-button.evf-disabled-tab").hide()}),jQuery(function(e){e(document.body).on("init_tooltips",function(){e(".tips, .help_tip, .everest-forms-help-tooltip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}).trigger("init_tooltips"),e(".everest-forms-tab-content").on("click",".everest-forms-add-fields-group > a",function(e){e.preventDefault()}),e(".everest-forms-field-option").on("click",".everest-forms-field-option-group > a",function(t){t.preventDefault(),e(this).parent(".everest-forms-field-option-group").toggleClass("closed").toggleClass("open")}),e(".everest-forms-field-option").on("click",".everest-forms-field-option-group a",function(t){e(t.target).filter(":input, option, .sort").length||e(this).next(".everest-forms-field-option-group-inner").stop().slideToggle()}),e(".everest-forms-field-option-group.closed").each(function(){e(this).find(".everest-forms-field-option-group-inner").hide()})});
assets/js/admin/evf-add-form.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global everest_add_form_params */
2
+ (function( $ ){
3
+ 'use strict';
4
+
5
+ $( function() {
6
+ // Close modal
7
+ var evfModalClose = function() {
8
+ if ( $('#evf-modal-select-form').length ) {
9
+ $('#evf-modal-select-form').get(0).selectedIndex = 0;
10
+ $('#evf-modal-checkbox-title, #evf-modal-checkbox-description').prop('checked', false);
11
+ }
12
+ $('#evf-modal-backdrop, #evf-modal-wrap').css('display','none');
13
+ $( document.body ).removeClass( 'modal-open' );
14
+ };
15
+ // Open modal when media button is clicked
16
+ $(document).on('click', '.evf-insert-form-button', function(event) {
17
+ event.preventDefault();
18
+ $('#evf-modal-backdrop, #evf-modal-wrap').css('display','block');
19
+ $( document.body ).addClass( 'modal-open' );
20
+ });
21
+ // Close modal on close or cancel links
22
+ $(document).on('click', '#evf-modal-close, #evf-modal-cancel a', function(event) {
23
+ event.preventDefault();
24
+ evfModalClose();
25
+ });
26
+ // Insert shortcode into TinyMCE
27
+ $(document).on('click', '#evf-modal-submit', function(event) {
28
+ event.preventDefault();
29
+ var shortcode;
30
+ shortcode = '[everest_form id="' + $('#evf-modal-select-form').val() + '"';
31
+ if ( $('#evf-modal-checkbox-title').is(':checked') ) {
32
+ shortcode = shortcode+' title="true"';
33
+ }
34
+ if ( $('#evf-modal-checkbox-description').is(':checked') ) {
35
+ shortcode = shortcode+' description="true"';
36
+ }
37
+ shortcode = shortcode+']';
38
+ wp.media.editor.insert(shortcode);
39
+ evfModalClose();
40
+ });
41
+
42
+ /**
43
+ * Setup actions.
44
+ */
45
+ var everest_setup_form_actions = {
46
+ $setup_form: $( 'form.everest-forms-setup' ),
47
+ init: function() {
48
+ this.title_focus();
49
+
50
+ // Select and apply a template.
51
+ this.$setup_form.on( 'click', '.evf-template-select', this.template_select );
52
+
53
+ // Prevent <ENTER> key for setup actions.
54
+ $( document.body ).on( 'keypress', '.everest-forms-setup-form-name input', this.input_keypress );
55
+ },
56
+ title_focus: function() {
57
+ setTimeout( function (){
58
+ $( '#everest-forms-setup-name' ).focus();
59
+ }, 100);
60
+ },
61
+ template_select: function( e ) {
62
+ e.preventDefault();
63
+
64
+ var $this = $( this ),
65
+ $formName = $( '#everest-forms-setup-name' ),
66
+ template = $this.data( 'template' ),
67
+ templateName = $this.data( 'template-name-raw' ),
68
+ formName = '';
69
+
70
+ // Don't do anything for selects that trigger modal
71
+ if ( $this.parent().hasClass( 'loading' ) ) {
72
+ return;
73
+ }
74
+
75
+ // Check that form title is provided.
76
+ if ( ! $formName.val() ) {
77
+ formName = templateName;
78
+ } else {
79
+ formName = $formName.val();
80
+ }
81
+
82
+ $this.parent().addClass( 'loading' );
83
+
84
+ var data = {
85
+ title: formName,
86
+ action: 'everest_forms_create_form',
87
+ template: template,
88
+ security: everest_add_form_params.create_form_nonce
89
+ };
90
+
91
+ $.post( everest_add_form_params.ajax_url, data, function( response ) {
92
+ if ( response.success ) {
93
+ $this.parent().removeClass( 'loading' );
94
+ window.location.href = response.data.redirect;
95
+ } else {
96
+ window.console.log( response );
97
+ }
98
+ }).fail( function( xhr ) {
99
+ window.console.log( xhr.responseText );
100
+ });
101
+ },
102
+ input_keypress: function ( e ) {
103
+ var button = e.keyCode || e.which;
104
+
105
+ // Enter key.
106
+ if ( 13 === button && e.target.tagName.toLowerCase() === 'input' ) {
107
+ e.preventDefault();
108
+ return false;
109
+ }
110
+ }
111
+ };
112
+
113
+ everest_setup_form_actions.init();
114
+ } );
115
+ }(jQuery));
assets/js/admin/evf-add-form.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){"use strict";e(function(){var t=function(){e("#evf-modal-select-form").length&&(e("#evf-modal-select-form").get(0).selectedIndex=0,e("#evf-modal-checkbox-title, #evf-modal-checkbox-description").prop("checked",!1)),e("#evf-modal-backdrop, #evf-modal-wrap").css("display","none"),e(document.body).removeClass("modal-open")};e(document).on("click",".evf-insert-form-button",function(t){t.preventDefault(),e("#evf-modal-backdrop, #evf-modal-wrap").css("display","block"),e(document.body).addClass("modal-open")}),e(document).on("click","#evf-modal-close, #evf-modal-cancel a",function(e){e.preventDefault(),t()}),e(document).on("click","#evf-modal-submit",function(o){o.preventDefault();var a;a='[everest_form id="'+e("#evf-modal-select-form").val()+'"',e("#evf-modal-checkbox-title").is(":checked")&&(a+=' title="true"'),e("#evf-modal-checkbox-description").is(":checked")&&(a+=' description="true"'),a+="]",wp.media.editor.insert(a),t()});({$setup_form:e("form.everest-forms-setup"),init:function(){this.title_focus(),this.$setup_form.on("click",".evf-template-select",this.template_select),e(document.body).on("keypress",".everest-forms-setup-form-name input",this.input_keypress)},title_focus:function(){setTimeout(function(){e("#everest-forms-setup-name").focus()},100)},template_select:function(t){t.preventDefault();var o=e(this),a=e("#everest-forms-setup-name"),n=o.data("template"),s=o.data("template-name-raw"),c="";if(!o.parent().hasClass("loading")){c=a.val()?a.val():s,o.parent().addClass("loading");var r={title:c,action:"everest_forms_create_form",template:n,security:everest_add_form_params.create_form_nonce};e.post(everest_add_form_params.ajax_url,r,function(e){e.success?(o.parent().removeClass("loading"),window.location.href=e.data.redirect):window.console.log(e)}).fail(function(e){window.console.log(e.responseText)})}},input_keypress:function(e){if(13===(e.keyCode||e.which)&&"input"===e.target.tagName.toLowerCase())return e.preventDefault(),!1}}).init()})}(jQuery);
assets/js/admin/evf-form-modal.js ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global jQuery, Backbone, _ */
2
+ ( function ( $, Backbone, _, evf_form_modal_data ) {
3
+ 'use strict';
4
+
5
+ /**
6
+ * RestaurantPress Backbone Modal plugin
7
+ *
8
+ * @param {object} options
9
+ */
10
+ $.fn.EVFBackboneModal = function ( options ) {
11
+ return this.each(function () {
12
+ ( new $.EVFBackboneModal($(this), options) );
13
+ });
14
+ };
15
+
16
+ /**
17
+ * Initialize the Backbone Modal
18
+ *
19
+ * @param {object} element [description]
20
+ * @param {object} options [description]
21
+ */
22
+ $.EVFBackboneModal = function ( element, options ) {
23
+ // Set settings
24
+ var settings = $.extend({}, $.EVFBackboneModal.defaultOptions, options);
25
+
26
+ if ( settings.template ) {
27
+ new $.EVFBackboneModal.View({
28
+ target: settings.template,
29
+ string: settings.variable
30
+ });
31
+ }
32
+ };
33
+
34
+ /**
35
+ * Set default options
36
+ *
37
+ * @type {object}
38
+ */
39
+ $.EVFBackboneModal.defaultOptions = {
40
+ template: '',
41
+ variable: {}
42
+ };
43
+
44
+ /**
45
+ * Create the Backbone Modal
46
+ *
47
+ * @return {null}
48
+ */
49
+ $.EVFBackboneModal.View = Backbone.View.extend({
50
+ tagName: 'div',
51
+ id: 'evf-backbone-modal-dialog',
52
+ _target: undefined,
53
+ _string: undefined,
54
+ events: {
55
+ 'click .modal-close': 'closeButton',
56
+ 'click #btn-ok': 'addButton',
57
+ 'touchstart #btn-ok': 'addButton',
58
+ 'keydown': 'keyboardActions'
59
+ },
60
+ resizeContent: function () {
61
+ var $content = $('.evf-backbone-modal-content').find('article');
62
+ var max_h = $(window).height() * 0.75;
63
+
64
+ $content.css({
65
+ 'max-height': max_h + 'px'
66
+ });
67
+ },
68
+ initialize: function ( data ) {
69
+ var view = this;
70
+ this._target = data.target;
71
+ this._string = data.string;
72
+ _.bindAll(this, 'render');
73
+ this.render();
74
+
75
+ $(window).resize(function () {
76
+ view.resizeContent();
77
+ });
78
+ },
79
+ render: function () {
80
+ var template = wp.template(this._target);
81
+
82
+ this.$el.append(
83
+ template(this._string)
84
+ );
85
+
86
+ $(document.body).css({
87
+ 'overflow': 'hidden'
88
+ }).append(this.$el);
89
+
90
+ this.resizeContent();
91
+ this.$('.evf-backbone-modal-content').attr('tabindex', '0').focus();
92
+
93
+ $(document.body).trigger('init_tooltips');
94
+
95
+ $(document.body).trigger('evf_backbone_modal_loaded', this._target);
96
+ },
97
+ closeButton: function ( e ) {
98
+ e.preventDefault();
99
+ $(document.body).trigger('evf_backbone_modal_before_remove', this._target);
100
+ this.undelegateEvents();
101
+ $(document).off('focusin');
102
+ $(document.body).css({
103
+ 'overflow': 'auto'
104
+ });
105
+ this.remove();
106
+ $(document.body).trigger('evf_backbone_modal_removed', this._target);
107
+ },
108
+ addButton: function ( e ) {
109
+ $(document.body).trigger('evf_backbone_modal_response', [ this._target, this.getFormData() ]);
110
+
111
+ var data = {
112
+ action: 'everest_forms_new_form',
113
+ security: evf_form_modal_data.evf_new_form_nonce,
114
+ form_name: $('#evf-modal-form-name').val()
115
+ };
116
+ $.ajax({
117
+ url: evf_form_modal_data.ajax_url,
118
+ data: data,
119
+ type: 'POST',
120
+ beforeSend: function () {
121
+
122
+ },
123
+ success: function ( response ) {
124
+ var message = '';
125
+ var type = 'success';
126
+ debugger;
127
+ if ( typeof response.success !== 'undefined' ) {
128
+ if ( response.data.id > 0 ) {
129
+
130
+ message = 'Form successfully created. Redirecting....';
131
+ setTimeout(function () {
132
+ window.location = response.data.redirect;
133
+ }, 1000)
134
+ //
135
+ } else {
136
+ message = 'Unknown error ! Could not create a form';
137
+ type = 'error';
138
+ }
139
+
140
+ } else {
141
+
142
+ type = 'error';
143
+ message = 'Unknown error ! Could not create a form';
144
+
145
+ }
146
+ var message_node = '<div id="message" class="notice notice-' + type + ' is-dismissible"><p>' + message + '</p></div>';
147
+ $('#evf-backbone-modal-dialog').find('#message').remove();
148
+ $('#evf-backbone-modal-dialog').find('article').append(message_node);
149
+ }
150
+ });
151
+ //this.closeButton(e);
152
+ },
153
+ getFormData: function () {
154
+ var data = {};
155
+
156
+ $(document.body).trigger('evf_backbone_modal_before_update', this._target);
157
+
158
+ $.each($('form', this.$el).serializeArray(), function ( index, item ) {
159
+ if ( item.name.indexOf('[]') !== -1 ) {
160
+ item.name = item.name.replace('[]', '');
161
+ data[ item.name ] = $.makeArray(data[ item.name ]);
162
+ data[ item.name ].push(item.value);
163
+ } else {
164
+ data[ item.name ] = item.value;
165
+ }
166
+ });
167
+
168
+ return data;
169
+ },
170
+ keyboardActions: function ( e ) {
171
+ var button = e.keyCode || e.which;
172
+
173
+ // Enter key
174
+ if ( 13 === button && !( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) ) ) {
175
+ this.addButton(e);
176
+ }
177
+
178
+ // ESC key
179
+ if ( 27 === button ) {
180
+ this.closeButton(e);
181
+ }
182
+ }
183
+ });
184
+
185
+ $('body').on('click', '.evf-add-new', function ( event ) {
186
+ $(this).EVFBackboneModal({
187
+ template: 'evf-add-new-form',
188
+ variable: {
189
+ test: 'tet'
190
+ }
191
+ });
192
+ return false;
193
+
194
+ })
195
+ }(jQuery, Backbone, _, window.evf_form_modal_data));
assets/js/admin/evf-form-modal.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e,t,o,n){"use strict";e.fn.EVFBackboneModal=function(t){return this.each(function(){new e.EVFBackboneModal(e(this),t)})},e.EVFBackboneModal=function(t,o){var n=e.extend({},e.EVFBackboneModal.defaultOptions,o);n.template&&new e.EVFBackboneModal.View({target:n.template,string:n.variable})},e.EVFBackboneModal.defaultOptions={template:"",variable:{}},e.EVFBackboneModal.View=t.View.extend({tagName:"div",id:"evf-backbone-modal-dialog",_target:undefined,_string:undefined,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","touchstart #btn-ok":"addButton",keydown:"keyboardActions"},resizeContent:function(){var t=e(".evf-backbone-modal-content").find("article"),o=.75*e(window).height();t.css({"max-height":o+"px"})},initialize:function(t){var n=this;this._target=t.target,this._string=t.string,o.bindAll(this,"render"),this.render(),e(window).resize(function(){n.resizeContent()})},render:function(){var t=wp.template(this._target);this.$el.append(t(this._string)),e(document.body).css({overflow:"hidden"}).append(this.$el),this.resizeContent(),this.$(".evf-backbone-modal-content").attr("tabindex","0").focus(),e(document.body).trigger("init_tooltips"),e(document.body).trigger("evf_backbone_modal_loaded",this._target)},closeButton:function(t){t.preventDefault(),e(document.body).trigger("evf_backbone_modal_before_remove",this._target),this.undelegateEvents(),e(document).off("focusin"),e(document.body).css({overflow:"auto"}),this.remove(),e(document.body).trigger("evf_backbone_modal_removed",this._target)},addButton:function(t){e(document.body).trigger("evf_backbone_modal_response",[this._target,this.getFormData()]);var o={action:"everest_forms_new_form",security:n.evf_new_form_nonce,form_name:e("#evf-modal-form-name").val()};e.ajax({url:n.ajax_url,data:o,type:"POST",beforeSend:function(){},success:function(t){var o="",n="success";"undefined"!=typeof t.success?t.data.id>0?(o="Form successfully created. Redirecting....",setTimeout(function(){window.location=t.data.redirect},1e3)):(o="Unknown error ! Could not create a form",n="error"):(n="error",o="Unknown error ! Could not create a form");var a='<div id="message" class="notice notice-'+n+' is-dismissible"><p>'+o+"</p></div>";e("#evf-backbone-modal-dialog").find("#message").remove(),e("#evf-backbone-modal-dialog").find("article").append(a)}})},getFormData:function(){var t={};return e(document.body).trigger("evf_backbone_modal_before_update",this._target),e.each(e("form",this.$el).serializeArray(),function(o,n){-1!==n.name.indexOf("[]")?(n.name=n.name.replace("[]",""),t[n.name]=e.makeArray(t[n.name]),t[n.name].push(n.value)):t[n.name]=n.value}),t},keyboardActions:function(e){var t=e.keyCode||e.which;13!==t||e.target.tagName&&("input"===e.target.tagName.toLowerCase()||"textarea"===e.target.tagName.toLowerCase())||this.addButton(e),27===t&&this.closeButton(e)}}),e("body").on("click",".evf-add-new",function(t){return e(this).EVFBackboneModal({template:"evf-add-new-form",variable:{test:"tet"}}),!1})}(jQuery,Backbone,_,window.evf_form_modal_data);
assets/js/admin/settings.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //Plugin made by Umesh Ghimire
2
+ (function ( $ ) {
3
+ $(document).ready(function () {
4
+ $('body').on('click', '.evf-nav-tab-wrapper a.nav-tab', function ( event ) {
5
+ event.preventDefault();
6
+ var tab = $(this).attr('data-key');
7
+ $('.everest-forms .nav-tab').removeClass('nav-tab-active');
8
+ $(this).addClass('nav-tab-active');
9
+ $('.evf-setting-tab-content').removeClass('active');
10
+ $('.evf-setting-tab-content[data-conent-key="' + tab + '"]').addClass('active');
11
+ });
12
+ });
13
+ })(jQuery);
assets/js/admin/settings.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){t(document).ready(function(){t("body").on("click",".evf-nav-tab-wrapper a.nav-tab",function(a){a.preventDefault();var e=t(this).attr("data-key");t(".everest-forms .nav-tab").removeClass("nav-tab-active"),t(this).addClass("nav-tab-active"),t(".evf-setting-tab-content").removeClass("active"),t('.evf-setting-tab-content[data-conent-key="'+e+'"]').addClass("active")})})}(jQuery);
assets/js/frontend/everest-forms.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global everest_forms_params */
2
+ jQuery( function ( $ ) {
3
+ 'use strict';
4
+
5
+ // everest_forms_params is required to continue, ensure the object exists.
6
+ if ( typeof everest_forms_params === 'undefined' ) {
7
+ return false;
8
+ }
9
+
10
+ var everest_forms = {
11
+ $everest_form: $( 'form.everest-form' ),
12
+ init: function() {
13
+ this.init_datepicker();
14
+
15
+ // Prevent HTML5 validation which can conflict.
16
+ this.$everest_form.attr( 'novalidate', 'novalidate' );
17
+
18
+ // Inline validation
19
+ this.$everest_form.on( 'input validate change', '.input-text, select, input:checkbox', this.validate_field );
20
+ },
21
+ init_datepicker: function () {
22
+ $( '.date-picker-field, .date-picker' ).datepicker({
23
+ changeMonth: true,
24
+ changeYear: true,
25
+ defaultDate: '',
26
+ dateFormat: 'yy-mm-dd',
27
+ numberOfMonths: 1,
28
+ minDate: '-15Y',
29
+ maxDate: '+15Y'
30
+ });
31
+ },
32
+ validate_field: function ( e ) {
33
+ var $this = $( this ),
34
+ $parent = $this.closest( '.form-row' ),
35
+ validated = true,
36
+ validate_required = $parent.is( '.validate-required' ),
37
+ validate_email = $parent.is( '.validate-email' ),
38
+ event_type = e.type;
39
+
40
+ if ( 'input' === event_type ) {
41
+ $parent.removeClass( 'everest-forms-invalid everest-forms-invalid-required-field everest-forms-invalid-email everest-forms-validated' );
42
+ }
43
+
44
+ if ( 'validate' === event_type || 'change' === event_type ) {
45
+
46
+ if ( validate_required ) {
47
+ if ( 'checkbox' === $this.attr( 'type' ) && ! $this.is( ':checked' ) ) {
48
+ $parent.removeClass( 'everest-forms-validated' ).addClass( 'everest-forms-invalid everest-forms-invalid-required-field' );
49
+ validated = false;
50
+ } else if ( $this.val() === '' ) {
51
+ $parent.removeClass( 'everest-forms-validated' ).addClass( 'everest-forms-invalid everest-forms-invalid-required-field' );
52
+ validated = false;
53
+ }
54
+ }
55
+
56
+ if ( validate_email ) {
57
+ if ( $this.val() ) {
58
+ /* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */
59
+ var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
60
+
61
+ if ( ! pattern.test( $this.val() ) ) {
62
+ $parent.removeClass( 'everest-forms-validated' ).addClass( 'everest-forms-invalid everest-forms-invalid-email' );
63
+ validated = false;
64
+ }
65
+ }
66
+ }
67
+
68
+ if ( validated ) {
69
+ $parent.removeClass( 'everest-forms-invalid everest-forms-invalid-required-field everest-forms-invalid-email' ).addClass( 'everest-forms-validated' );
70
+ }
71
+ }
72
+ }
73
+ };
74
+
75
+ everest_forms.init();
76
+ });
77
+
78
+ /* jshint ignore:start */
79
+ var google_recaptcha_everest_forms;
80
+ var onloadEVFCallback = function () {
81
+ google_recaptcha_everest_forms = grecaptcha.render( 'evf_node_recaptcha', {
82
+ 'sitekey': evf_google_recaptcha_code.site_key,
83
+ 'theme': 'light',
84
+ 'style': 'transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;',
85
+ });
86
+ };
87
+ /* jshint ignore:end */
assets/js/frontend/everest-forms.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(e){"use strict";if("undefined"==typeof everest_forms_params)return!1;({$everest_form:e("form.everest-form"),init:function(){this.init_datepicker(),this.$everest_form.attr("novalidate","novalidate"),this.$everest_form.on("input validate change",".input-text, select, input:checkbox",this.validate_field)},init_datepicker:function(){e(".date-picker-field, .date-picker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-15Y",maxDate:"+15Y"})},validate_field:function(F){var a=e(this),r=a.closest(".form-row"),t=!0,i=r.is(".validate-required"),u=r.is(".validate-email"),s=F.type;if("input"===s&&r.removeClass("everest-forms-invalid everest-forms-invalid-required-field everest-forms-invalid-email everest-forms-validated"),"validate"===s||"change"===s){if(i&&("checkbox"!==a.attr("type")||a.is(":checked")?""===a.val()&&(r.removeClass("everest-forms-validated").addClass("everest-forms-invalid everest-forms-invalid-required-field"),t=!1):(r.removeClass("everest-forms-validated").addClass("everest-forms-invalid everest-forms-invalid-required-field"),t=!1)),u&&a.val()){new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i).test(a.val())||(r.removeClass("everest-forms-validated").addClass("everest-forms-invalid everest-forms-invalid-email"),t=!1)}t&&r.removeClass("everest-forms-invalid everest-forms-invalid-required-field everest-forms-invalid-email").addClass("everest-forms-validated")}}}).init()});var google_recaptcha_everest_forms,onloadEVFCallback=function(){google_recaptcha_everest_forms=grecaptcha.render("evf_node_recaptcha",{sitekey:evf_google_recaptcha_code.site_key,theme:"light",style:"transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"})};
assets/js/jquery-blockui/jquery.blockUI.js ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery blockUI plugin
3
+ * Version 2.70.0-2014.11.23
4
+ * Requires jQuery v1.7 or later
5
+ *
6
+ * Examples at: http://malsup.com/jquery/block/
7
+ * Copyright (c) 2007-2013 M. Alsup
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
+ */
14
+ ;(function() {
15
+ /*jshint eqeqeq:false curly:false latedef:false */
16
+ "use strict";
17
+
18
+ function setup($) {
19
+ $.fn._fadeIn = $.fn.fadeIn;
20
+
21
+ var noOp = $.noop || function() {};
22
+
23
+ // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
24
+ // confusing userAgent strings on Vista)
25
+ var msie = /MSIE/.test(navigator.userAgent);
26
+ var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
27
+ var mode = document.documentMode || 0;
28
+ var setExpr = $.isFunction( document.createElement('div').style.setExpression );
29
+
30
+ // global $ methods for blocking/unblocking the entire page
31
+ $.blockUI = function(opts) { install(window, opts); };
32
+ $.unblockUI = function(opts) { remove(window, opts); };
33
+
34
+ // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
35
+ $.growlUI = function(title, message, timeout, onClose) {
36
+ var $m = $('<div class="growlUI"></div>');
37
+ if (title) $m.append('<h1>'+title+'</h1>');
38
+ if (message) $m.append('<h2>'+message+'</h2>');
39
+ if (timeout === undefined) timeout = 3000;
40
+
41
+ // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
42
+ var callBlock = function(opts) {
43
+ opts = opts || {};
44
+
45
+ $.blockUI({
46
+ message: $m,
47
+ fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
48
+ fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
49
+ timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
50
+ centerY: false,
51
+ showOverlay: false,
52
+ onUnblock: onClose,
53
+ css: $.blockUI.defaults.growlCSS
54
+ });
55
+ };
56
+
57
+ callBlock();
58
+ var nonmousedOpacity = $m.css('opacity');
59
+ $m.mouseover(function() {
60
+ callBlock({
61
+ fadeIn: 0,
62
+ timeout: 30000
63
+ });
64
+
65
+ var displayBlock = $('.blockMsg');
66
+ displayBlock.stop(); // cancel fadeout if it has started
67
+ displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
68
+ }).mouseout(function() {
69
+ $('.blockMsg').fadeOut(1000);
70
+ });
71
+ // End konapun additions
72
+ };
73
+
74
+ // plugin method for blocking element content
75
+ $.fn.block = function(opts) {
76
+ if ( this[0] === window ) {
77
+ $.blockUI( opts );
78
+ return this;
79
+ }
80
+ var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
81
+ this.each(function() {
82
+ var $el = $(this);
83
+ if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
84
+ return;
85
+ $el.unblock({ fadeOut: 0 });
86
+ });
87
+
88
+ return this.each(function() {
89
+ if ($.css(this,'position') == 'static') {
90
+ this.style.position = 'relative';
91
+ $(this).data('blockUI.static', true);
92
+ }
93
+ this.style.zoom = 1; // force 'hasLayout' in ie
94
+ install(this, opts);
95
+ });
96
+ };
97
+
98
+ // plugin method for unblocking element content
99
+ $.fn.unblock = function(opts) {
100
+ if ( this[0] === window ) {
101
+ $.unblockUI( opts );
102
+ return this;
103
+ }
104
+ return this.each(function() {
105
+ remove(this, opts);
106
+ });
107
+ };
108
+
109
+ $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
110
+
111
+ // override these in your code to change the default behavior and style
112
+ $.blockUI.defaults = {
113
+ // message displayed when blocking (use null for no message)
114
+ message: '<h1>Please wait...</h1>',
115
+
116
+ title: null, // title string; only used when theme == true
117
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
118
+
119
+ theme: false, // set to true to use with jQuery UI themes
120
+
121
+ // styles for the message when blocking; if you wish to disable
122
+ // these and use an external stylesheet then do this in your code:
123
+ // $.blockUI.defaults.css = {};
124
+ css: {
125
+ padding: 0,
126
+ margin: 0,
127
+ width: '30%',
128
+ top: '40%',
129
+ left: '35%',
130
+ textAlign: 'center',
131
+ color: '#000',
132
+ border: '3px solid #aaa',
133
+ backgroundColor:'#fff',
134
+ cursor: 'wait'
135
+ },
136
+
137
+ // minimal style set used when themes are used
138
+ themedCSS: {
139
+ width: '30%',
140
+ top: '40%',
141
+ left: '35%'
142
+ },
143
+
144
+ // styles for the overlay
145
+ overlayCSS: {
146
+ backgroundColor: '#000',
147
+ opacity: 0.6,
148
+ cursor: 'wait'
149
+ },
150
+
151
+ // style to replace wait cursor before unblocking to correct issue
152
+ // of lingering wait cursor
153
+ cursorReset: 'default',
154
+
155
+ // styles applied when using $.growlUI
156
+ growlCSS: {
157
+ width: '350px',
158
+ top: '10px',
159
+ left: '',
160
+ right: '10px',
161
+ border: 'none',
162
+ padding: '5px',
163
+ opacity: 0.6,
164
+ cursor: 'default',
165
+ color: '#fff',
166
+ backgroundColor: '#000',
167
+ '-webkit-border-radius':'10px',
168
+ '-moz-border-radius': '10px',
169
+ 'border-radius': '10px'
170
+ },
171
+
172
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
173
+ // (hat tip to Jorge H. N. de Vasconcelos)
174
+ /*jshint scripturl:true */
175
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
176
+
177
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
178
+ forceIframe: false,
179
+
180
+ // z-index for the blocking overlay
181
+ baseZ: 1000,
182
+
183
+ // set these to true to have the message automatically centered
184
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
185
+ centerY: true,
186
+
187
+ // allow body element to be stetched in ie6; this makes blocking look better
188
+ // on "short" pages. disable if you wish to prevent changes to the body height
189
+ allowBodyStretch: true,
190
+
191
+ // enable if you want key and mouse events to be disabled for content that is blocked
192
+ bindEvents: true,
193
+
194
+ // be default blockUI will supress tab navigation from leaving blocking content
195
+ // (if bindEvents is true)
196
+ constrainTabKey: true,
197
+
198
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
199
+ fadeIn: 200,
200
+
201
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
202
+ fadeOut: 400,
203
+
204
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
205
+ timeout: 0,
206
+
207
+ // disable if you don't want to show the overlay
208
+ showOverlay: true,
209
+
210
+ // if true, focus will be placed in the first available input field when
211
+ // page blocking
212
+ focusInput: true,
213
+
214
+ // elements that can receive focus
215
+ focusableElements: ':input:enabled:visible',
216
+
217
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
218
+ // no longer needed in 2012
219
+ // applyPlatformOpacityRules: true,
220
+
221
+ // callback method invoked when fadeIn has completed and blocking message is visible
222
+ onBlock: null,
223
+
224
+ // callback method invoked when unblocking has completed; the callback is
225
+ // passed the element that has been unblocked (which is the window object for page
226
+ // blocks) and the options that were passed to the unblock call:
227
+ // onUnblock(element, options)
228
+ onUnblock: null,
229
+
230
+ // callback method invoked when the overlay area is clicked.
231
+ // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
232
+ onOverlayClick: null,
233
+
234
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
235
+ quirksmodeOffsetHack: 4,
236
+
237
+ // class name of the message block
238
+ blockMsgClass: 'blockMsg',
239
+
240
+ // if it is already blocked, then ignore it (don't unblock and reblock)
241
+ ignoreIfBlocked: false
242
+ };
243
+
244
+ // private data and functions follow...
245
+
246
+ var pageBlock = null;
247
+ var pageBlockEls = [];
248
+
249
+ function install(el, opts) {
250
+ var css, themedCSS;
251
+ var full = (el == window);
252
+ var msg = (opts && opts.message !== undefined ? opts.message : undefined);
253
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
254
+
255
+ if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
256
+ return;
257
+
258
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
259
+ css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
260
+ if (opts.onOverlayClick)
261
+ opts.overlayCSS.cursor = 'pointer';
262
+
263
+ themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
264
+ msg = msg === undefined ? opts.message : msg;
265
+
266
+ // remove the current block (if there is one)
267
+ if (full && pageBlock)
268
+ remove(window, {fadeOut:0});
269
+
270
+ // if an existing element is being used as the blocking content then we capture
271
+ // its current place in the DOM (and current display style) so we can restore
272
+ // it when we unblock
273
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
274
+ var node = msg.jquery ? msg[0] : msg;
275
+ var data = {};
276
+ $(el).data('blockUI.history', data);
277
+ data.el = node;
278
+ data.parent = node.parentNode;
279
+ data.display = node.style.display;
280
+ data.position = node.style.position;
281
+ if (data.parent)
282
+ data.parent.removeChild(node);
283
+ }
284
+
285
+ $(el).data('blockUI.onUnblock', opts.onUnblock);
286
+ var z = opts.baseZ;
287
+
288
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
289
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
290
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
291
+ // layer3 is the message content that is displayed while blocking
292
+ var lyr1, lyr2, lyr3, s;
293
+ if (msie || opts.forceIframe)
294
+ lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
295
+ else
296
+ lyr1 = $('<div class="blockUI" style="display:none"></div>');
297
+
298
+ if (opts.theme)
299
+ lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
300
+ else
301
+ lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
302
+
303
+ if (opts.theme && full) {
304
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
305
+ if ( opts.title ) {
306
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
307
+ }
308
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
309
+ s += '</div>';
310
+ }
311
+ else if (opts.theme) {
312
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
313
+ if ( opts.title ) {
314
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
315
+ }
316
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
317
+ s += '</div>';
318
+ }
319
+ else if (full) {
320
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
321
+ }
322
+ else {
323
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
324
+ }
325
+ lyr3 = $(s);
326
+
327
+ // if we have a message, style it
328
+ if (msg) {
329
+ if (opts.theme) {
330
+ lyr3.css(themedCSS);
331
+ lyr3.addClass('ui-widget-content');
332
+ }
333
+ else
334
+ lyr3.css(css);
335
+ }
336
+
337
+ // style the overlay
338
+ if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
339
+ lyr2.css(opts.overlayCSS);
340
+ lyr2.css('position', full ? 'fixed' : 'absolute');
341
+
342
+ // make iframe layer transparent in IE
343
+ if (msie || opts.forceIframe)
344
+ lyr1.css('opacity',0.0);
345
+
346
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
347
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
348
+ $.each(layers, function() {
349
+ this.appendTo($par);
350
+ });
351
+
352
+ if (opts.theme && opts.draggable && $.fn.draggable) {
353
+ lyr3.draggable({
354
+ handle: '.ui-dialog-titlebar',
355
+ cancel: 'li'
356
+ });
357
+ }
358
+
359
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
360
+ var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
361
+ if (ie6 || expr) {
362
+ // give body 100% height
363
+ if (full && opts.allowBodyStretch && $.support.boxModel)
364
+ $('html,body').css('height','100%');
365
+
366
+ // fix ie6 issue when blocked element has a border width
367
+ if ((ie6 || !$.support.boxModel) && !full) {
368
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
369
+ var fixT = t ? '(0 - '+t+')' : 0;
370
+ var fixL = l ? '(0 - '+l+')' : 0;
371
+ }
372
+
373
+ // simulate fixed position
374
+ $.each(layers, function(i,o) {
375
+ var s = o[0].style;
376
+ s.position = 'absolute';
377
+ if (i < 2) {
378
+ if (full)
379
+ s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
380
+ else
381
+ s.setExpression('height','this.parentNode.offsetHeight + "px"');
382
+ if (full)
383
+ s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
384
+ else
385
+ s.setExpression('width','this.parentNode.offsetWidth + "px"');
386
+ if (fixL) s.setExpression('left', fixL);
387
+ if (fixT) s.setExpression('top', fixT);
388
+ }
389
+ else if (opts.centerY) {
390
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
391
+ s.marginTop = 0;
392
+ }
393
+ else if (!opts.centerY && full) {
394
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
395
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
396
+ s.setExpression('top',expression);
397
+ }
398
+ });
399
+ }
400
+
401
+ // show the message
402
+ if (msg) {
403
+ if (opts.theme)
404
+ lyr3.find('.ui-widget-content').append(msg);
405
+ else
406
+ lyr3.append(msg);
407
+ if (msg.jquery || msg.nodeType)
408
+ $(msg).show();
409
+ }
410
+
411
+ if ((msie || opts.forceIframe) && opts.showOverlay)
412
+ lyr1.show(); // opacity is zero
413
+ if (opts.fadeIn) {
414
+ var cb = opts.onBlock ? opts.onBlock : noOp;
415
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
416
+ var cb2 = msg ? cb : noOp;
417
+ if (opts.showOverlay)
418
+ lyr2._fadeIn(opts.fadeIn, cb1);
419
+ if (msg)
420
+ lyr3._fadeIn(opts.fadeIn, cb2);
421
+ }
422
+ else {
423
+ if (opts.showOverlay)
424
+ lyr2.show();
425
+ if (msg)
426
+ lyr3.show();
427
+ if (opts.onBlock)
428
+ opts.onBlock.bind(lyr3)();
429
+ }
430
+
431
+ // bind key and mouse events
432
+ bind(1, el, opts);
433
+
434
+ if (full) {
435
+ pageBlock = lyr3[0];
436
+ pageBlockEls = $(opts.focusableElements,pageBlock);
437
+ if (opts.focusInput)
438
+ setTimeout(focus, 20);
439
+ }
440
+ else
441
+ center(lyr3[0], opts.centerX, opts.centerY);
442
+
443
+ if (opts.timeout) {
444
+ // auto-unblock
445
+ var to = setTimeout(function() {
446
+ if (full)
447
+ $.unblockUI(opts);
448
+ else
449
+ $(el).unblock(opts);
450
+ }, opts.timeout);
451
+ $(el).data('blockUI.timeout', to);
452
+ }
453
+ }
454
+
455
+ // remove the block
456
+ function remove(el, opts) {
457
+ var count;
458
+ var full = (el == window);
459
+ var $el = $(el);
460
+ var data = $el.data('blockUI.history');
461
+ var to = $el.data('blockUI.timeout');
462
+ if (to) {
463
+ clearTimeout(to);
464
+ $el.removeData('blockUI.timeout');
465
+ }
466
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
467
+ bind(0, el, opts); // unbind events
468
+
469
+ if (opts.onUnblock === null) {
470
+ opts.onUnblock = $el.data('blockUI.onUnblock');
471
+ $el.removeData('blockUI.onUnblock');
472
+ }
473
+
474
+ var els;
475
+ if (full) // crazy selector to handle odd field errors in ie6/7
476
+ els = $(document.body).children().filter('.blockUI').add('body > .blockUI');
477
+ else
478
+ els = $el.find('>.blockUI');
479
+
480
+ // fix cursor issue
481
+ if ( opts.cursorReset ) {
482
+ if ( els.length > 1 )
483
+ els[1].style.cursor = opts.cursorReset;
484
+ if ( els.length > 2 )
485
+ els[2].style.cursor = opts.cursorReset;
486
+ }
487
+
488
+ if (full)
489
+ pageBlock = pageBlockEls = null;
490
+
491
+ if (opts.fadeOut) {
492
+ count = els.length;
493
+ els.stop().fadeOut(opts.fadeOut, function() {
494
+ if ( --count === 0)
495
+ reset(els,data,opts,el);
496
+ });
497
+ }
498
+ else
499
+ reset(els, data, opts, el);
500
+ }
501
+
502
+ // move blocking element back into the DOM where it started
503
+ function reset(els,data,opts,el) {
504
+ var $el = $(el);
505
+ if ( $el.data('blockUI.isBlocked') )
506
+ return;
507
+
508
+ els.each(function(i,o) {
509
+ // remove via DOM calls so we don't lose event handlers
510
+ if (this.parentNode)
511
+ this.parentNode.removeChild(this);
512
+ });
513
+
514
+ if (data && data.el) {
515
+ data.el.style.display = data.display;
516
+ data.el.style.position = data.position;
517
+ data.el.style.cursor = 'default'; // #59
518
+ if (data.parent)
519
+ data.parent.appendChild(data.el);
520
+ $el.removeData('blockUI.history');
521
+ }
522
+
523
+ if ($el.data('blockUI.static')) {
524
+ $el.css('position', 'static'); // #22
525
+ }
526
+
527
+ if (typeof opts.onUnblock == 'function')
528
+ opts.onUnblock(el,opts);
529
+
530
+ // fix issue in Safari 6 where block artifacts remain until reflow
531
+ var body = $(document.body), w = body.width(), cssW = body[0].style.width;
532
+ body.width(w-1).width(w);
533
+ body[0].style.width = cssW;
534
+ }
535
+
536
+ // bind/unbind the handler
537
+ function bind(b, el, opts) {
538
+ var full = el == window, $el = $(el);
539
+
540
+ // don't bother unbinding if there is nothing to unbind
541
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
542
+ return;
543
+
544
+ $el.data('blockUI.isBlocked', b);
545
+
546
+ // don't bind events when overlay is not in use or if bindEvents is false
547
+ if (!full || !opts.bindEvents || (b && !opts.showOverlay))
548
+ return;
549
+
550
+ // bind anchors and inputs for mouse and key events
551
+ var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
552
+ if (b)
553
+ $(document).bind(events, opts, handler);
554
+ else
555
+ $(document).unbind(events, handler);
556
+
557
+ // former impl...
558
+ // var $e = $('a,:input');
559
+ // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
560
+ }
561
+
562
+ // event handler to suppress keyboard/mouse events when blocking
563
+ function handler(e) {
564
+ // allow tab navigation (conditionally)
565
+ if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
566
+ if (pageBlock && e.data.constrainTabKey) {
567
+ var els = pageBlockEls;
568
+ var fwd = !e.shiftKey && e.target === els[els.length-1];
569
+ var back = e.shiftKey && e.target === els[0];
570
+ if (fwd || back) {
571
+ setTimeout(function(){focus(back);},10);
572
+ return false;
573
+ }
574
+ }
575
+ }
576
+ var opts = e.data;
577
+ var target = $(e.target);
578
+ if (target.hasClass('blockOverlay') && opts.onOverlayClick)
579
+ opts.onOverlayClick(e);
580
+
581
+ // allow events within the message content
582
+ if (target.parents('div.' + opts.blockMsgClass).length > 0)
583
+ return true;
584
+
585
+ // allow events for content that is not being blocked
586
+ return target.parents().children().filter('div.blockUI').length === 0;
587
+ }
588
+
589
+ function focus(back) {
590
+ if (!pageBlockEls)
591
+ return;
592
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
593
+ if (e)
594
+ e.focus();
595
+ }
596
+
597
+ function center(el, x, y) {
598
+ var p = el.parentNode, s = el.style;
599
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
600
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
601
+ if (x) s.left = l > 0 ? (l+'px') : '0';
602
+ if (y) s.top = t > 0 ? (t+'px') : '0';
603
+ }
604
+
605
+ function sz(el, p) {
606
+ return parseInt($.css(el,p),10)||0;
607
+ }
608
+
609
+ }
610
+
611
+
612
+ /*global define:true */
613
+ if (typeof define === 'function' && define.amd && define.amd.jQuery) {
614
+ define(['jquery'], setup);
615
+ } else {
616
+ setup(jQuery);
617
+ }
618
+
619
+ })();
assets/js/jquery-blockui/jquery.blockUI.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery blockUI plugin
3
+ * Version 2.70.0-2014.11.23
4
+ * Requires jQuery v1.7 or later
5
+ *
6
+ * Examples at: http://malsup.com/jquery/block/
7
+ * Copyright (c) 2007-2013 M. Alsup
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
+ */
14
+ !function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'<iframe class="blockUI" style="z-index:'+x+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+n.iframeSrc+'"></iframe>':'<div class="blockUI" style="display:none"></div>'),I=e(n.theme?'<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+x+++';display:none"></div>':'<div class="blockUI blockOverlay" style="z-index:'+x+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),n.theme&&k?(U='<div class="blockUI '+n.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(x+10)+';display:none;position:fixed">',n.title&&(U+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),U+='<div class="ui-widget-content ui-dialog-content"></div>',U+="</div>"):n.theme?(U='<div class="blockUI '+n.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(x+10)+';display:none;position:absolute">',n.title&&(U+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),U+='<div class="ui-widget-content ui-dialog-content"></div>',U+="</div>"):U=k?'<div class="blockUI '+n.blockMsgClass+' blockPage" style="z-index:'+(x+10)+';display:none;position:fixed"></div>':'<div class="blockUI '+n.blockMsgClass+' blockElement" style="z-index:'+(x+10)+';display:none;position:absolute"></div>',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>"),o&&s.append("<h2>"+o+"</h2>"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.mouseover(function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var p=null,b=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}();
assets/js/jquery-confirm/jquery-confirm.min.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jquery-confirm v3.3.0 (http://craftpip.github.io/jquery-confirm/)
3
+ * Author: boniface pereira
4
+ * Website: www.craftpip.com
5
+ * Contact: hey@craftpip.com
6
+ *
7
+ * Copyright 2013-2017 jquery-confirm
8
+ * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE)
9
+ */@-webkit-keyframes jconfirm-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes jconfirm-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}body[class*=jconfirm-no-scroll-]{overflow:hidden!important}.jconfirm{position:fixed;top:0;left:0;right:0;bottom:0;z-index:99999999;font-family:inherit;overflow:hidden}.jconfirm .jconfirm-bg{position:fixed;top:0;left:0;right:0;bottom:0;-webkit-transition:opacity .4s;transition:opacity .4s}.jconfirm .jconfirm-bg.jconfirm-bg-h{opacity:0!important}.jconfirm .jconfirm-scrollpane{-webkit-perspective:500px;perspective:500px;-webkit-perspective-origin:center;perspective-origin:center;display:table;width:100%;height:100%}.jconfirm .jconfirm-row{display:table-row;width:100%}.jconfirm .jconfirm-cell{display:table-cell;vertical-align:middle}.jconfirm .jconfirm-holder{max-height:100%;padding:50px 0}.jconfirm .jconfirm-box-container{-webkit-transition:-webkit-transform;transition:-webkit-transform;transition:transform;transition:transform,-webkit-transform}.jconfirm .jconfirm-box-container.jconfirm-no-transition{-webkit-transition:none!important;transition:none!important}.jconfirm .jconfirm-box{background:white;border-radius:4px;position:relative;outline:0;padding:15px 15px 0;overflow:hidden;margin-left:auto;margin-right:auto}@-webkit-keyframes type-blue{1%,100%{border-color:#3498db}50%{border-color:#5faee3}}@keyframes type-blue{1%,100%{border-color:#3498db}50%{border-color:#5faee3}}@-webkit-keyframes type-green{1%,100%{border-color:#2ecc71}50%{border-color:#54d98c}}@keyframes type-green{1%,100%{border-color:#2ecc71}50%{border-color:#54d98c}}@-webkit-keyframes type-red{1%,100%{border-color:#e74c3c}50%{border-color:#ed7669}}@keyframes type-red{1%,100%{border-color:#e74c3c}50%{border-color:#ed7669}}@-webkit-keyframes type-orange{1%,100%{border-color:#f1c40f}50%{border-color:#f4d03f}}@keyframes type-orange{1%,100%{border-color:#f1c40f}50%{border-color:#f4d03f}}@-webkit-keyframes type-purple{1%,100%{border-color:#9b59b6}50%{border-color:#b07cc6}}@keyframes type-purple{1%,100%{border-color:#9b59b6}50%{border-color:#b07cc6}}@-webkit-keyframes type-dark{1%,100%{border-color:#34495e}50%{border-color:#46627f}}@keyframes type-dark{1%,100%{border-color:#34495e}50%{border-color:#46627f}}.jconfirm .jconfirm-box.jconfirm-type-animated{-webkit-animation-duration:2s;animation-duration:2s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jconfirm .jconfirm-box.jconfirm-type-blue{border-top:solid 7px #3498db;-webkit-animation-name:type-blue;animation-name:type-blue}.jconfirm .jconfirm-box.jconfirm-type-green{border-top:solid 7px #2ecc71;-webkit-animation-name:type-green;animation-name:type-green}.jconfirm .jconfirm-box.jconfirm-type-red{border-top:solid 7px #e74c3c;-webkit-animation-name:type-red;animation-name:type-red}.jconfirm .jconfirm-box.jconfirm-type-orange{border-top:solid 7px #f1c40f;-webkit-animation-name:type-orange;animation-name:type-orange}.jconfirm .jconfirm-box.jconfirm-type-purple{border-top:solid 7px #9b59b6;-webkit-animation-name:type-purple;animation-name:type-purple}.jconfirm .jconfirm-box.jconfirm-type-dark{border-top:solid 7px #34495e;-webkit-animation-name:type-dark;animation-name:type-dark}.jconfirm .jconfirm-box.loading{height:120px}.jconfirm .jconfirm-box.loading:before{content:'';position:absolute;left:0;background:white;right:0;top:0;bottom:0;border-radius:10px;z-index:1}.jconfirm .jconfirm-box.loading:after{opacity:.6;content:'';height:30px;width:30px;border:solid 3px transparent;position:absolute;left:50%;margin-left:-15px;border-radius:50%;-webkit-animation:jconfirm-spin 1s infinite linear;animation:jconfirm-spin 1s infinite linear;border-bottom-color:dodgerblue;top:50%;margin-top:-15px;z-index:2}.jconfirm .jconfirm-box div.jconfirm-closeIcon{height:20px;width:20px;position:absolute;top:10px;right:10px;cursor:pointer;opacity:.6;text-align:center;font-size:27px!important;line-height:14px!important;display:none;z-index:1}.jconfirm .jconfirm-box div.jconfirm-closeIcon:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-closeIcon .fa{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon .glyphicon{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon .zmdi{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon:hover{opacity:1}.jconfirm .jconfirm-box div.jconfirm-title-c{display:block;font-size:22px;line-height:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;padding-bottom:15px}.jconfirm .jconfirm-box div.jconfirm-title-c.jconfirm-hand{cursor:move}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{font-size:inherit;display:inline-block;vertical-align:middle}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c i{vertical-align:middle}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:inherit;font-family:inherit;display:inline-block;vertical-align:middle}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-content-pane{margin-bottom:15px;height:auto;-webkit-transition:height .4s ease-in;transition:height .4s ease-in;display:inline-block;width:100%;position:relative;overflow-x:hidden;overflow-y:auto}.jconfirm .jconfirm-box div.jconfirm-content-pane.no-scroll{overflow-y:hidden}.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar{width:3px}.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar-track{background:rgba(0,0,0,0.1)}.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar-thumb{background:#666;border-radius:3px}.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content{overflow:auto}.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content img{max-width:100%;height:auto}.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content:empty{display:none}.jconfirm .jconfirm-box .jconfirm-buttons{padding-bottom:11px}.jconfirm .jconfirm-box .jconfirm-buttons>button{margin-bottom:4px;margin-left:2px;margin-right:2px}.jconfirm .jconfirm-box .jconfirm-buttons button{display:inline-block;padding:6px 12px;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:4px;min-height:1em;-webkit-transition:opacity .1s ease,background-color .1s ease,color .1s ease,background .1s ease,-webkit-box-shadow .1s ease;transition:opacity .1s ease,background-color .1s ease,color .1s ease,background .1s ease,-webkit-box-shadow .1s ease;transition:opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;transition:opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease,-webkit-box-shadow .1s ease;-webkit-tap-highlight-color:transparent;border:0;background-image:none}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue{background-color:#3498db;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue:hover{background-color:#2980b9;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green{background-color:#2ecc71;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green:hover{background-color:#27ae60;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red{background-color:#e74c3c;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red:hover{background-color:#c0392b;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange{background-color:#f1c40f;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange:hover{background-color:#f39c12;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default{background-color:#ecf0f1;color:#000;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default:hover{background-color:#bdc3c7;color:#000}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple{background-color:#9b59b6;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple:hover{background-color:#8e44ad;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark{background-color:#34495e;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark:hover{background-color:#2c3e50;color:#FFF}.jconfirm .jconfirm-box.jconfirm-type-red .jconfirm-title-c .jconfirm-icon-c{color:#e74c3c!important}.jconfirm .jconfirm-box.jconfirm-type-blue .jconfirm-title-c .jconfirm-icon-c{color:#3498db!important}.jconfirm .jconfirm-box.jconfirm-type-green .jconfirm-title-c .jconfirm-icon-c{color:#2ecc71!important}.jconfirm .jconfirm-box.jconfirm-type-purple .jconfirm-title-c .jconfirm-icon-c{color:#9b59b6!important}.jconfirm .jconfirm-box.jconfirm-type-orange .jconfirm-title-c .jconfirm-icon-c{color:#f1c40f!important}.jconfirm .jconfirm-box.jconfirm-type-dark .jconfirm-title-c .jconfirm-icon-c{color:#34495e!important}.jconfirm .jconfirm-clear{clear:both}.jconfirm.jconfirm-rtl{direction:rtl}.jconfirm.jconfirm-rtl div.jconfirm-closeIcon{left:5px;right:auto}.jconfirm.jconfirm-white .jconfirm-bg,.jconfirm.jconfirm-light .jconfirm-bg{background-color:#444;opacity:.2}.jconfirm.jconfirm-white .jconfirm-box,.jconfirm.jconfirm-light .jconfirm-box{-webkit-box-shadow:0 2px 6px rgba(0,0,0,0.2);box-shadow:0 2px 6px rgba(0,0,0,0.2);border-radius:5px}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons{float:right}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button{text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default{-webkit-box-shadow:none;box-shadow:none;color:#333}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default:hover,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default:hover{background:#ddd}.jconfirm.jconfirm-white.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-light.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-black .jconfirm-bg,.jconfirm.jconfirm-dark .jconfirm-bg{background-color:darkslategray;opacity:.4}.jconfirm.jconfirm-black .jconfirm-box,.jconfirm.jconfirm-dark .jconfirm-box{-webkit-box-shadow:0 2px 6px rgba(0,0,0,0.2);box-shadow:0 2px 6px rgba(0,0,0,0.2);background:#444;border-radius:5px;color:white}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons{float:right}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button{border:0;background-image:none;text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none;-webkit-transition:background .1s;transition:background .1s;color:white}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default{-webkit-box-shadow:none;box-shadow:none;color:#fff;background:0}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default:hover,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default:hover{background:#666}.jconfirm.jconfirm-black.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-dark.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm .jconfirm-box.hilight.jconfirm-hilight-shake{-webkit-animation:shake .82s cubic-bezier(0.36,0.07,0.19,0.97) both;animation:shake .82s cubic-bezier(0.36,0.07,0.19,0.97) both;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.jconfirm .jconfirm-box.hilight.jconfirm-hilight-glow{-webkit-animation:glow .82s cubic-bezier(0.36,0.07,0.19,0.97) both;animation:glow .82s cubic-bezier(0.36,0.07,0.19,0.97) both;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-webkit-keyframes shake{10%,90%{-webkit-transform:translate3d(-2px,0,0);transform:translate3d(-2px,0,0)}20%,80%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-8px,0,0);transform:translate3d(-8px,0,0)}40%,60%{-webkit-transform:translate3d(8px,0,0);transform:translate3d(8px,0,0)}}@keyframes shake{10%,90%{-webkit-transform:translate3d(-2px,0,0);transform:translate3d(-2px,0,0)}20%,80%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-8px,0,0);transform:translate3d(-8px,0,0)}40%,60%{-webkit-transform:translate3d(8px,0,0);transform:translate3d(8px,0,0)}}@-webkit-keyframes glow{0%,100%{-webkit-box-shadow:0 0 0 red;box-shadow:0 0 0 red}50%{-webkit-box-shadow:0 0 30px red;box-shadow:0 0 30px red}}@keyframes glow{0%,100%{-webkit-box-shadow:0 0 0 red;box-shadow:0 0 0 red}50%{-webkit-box-shadow:0 0 30px red;box-shadow:0 0 30px red}}.jconfirm{-webkit-perspective:400px;perspective:400px}.jconfirm .jconfirm-box{opacity:1;-webkit-transition-property:all;transition-property:all}.jconfirm .jconfirm-box.jconfirm-animation-top,.jconfirm .jconfirm-box.jconfirm-animation-left,.jconfirm .jconfirm-box.jconfirm-animation-right,.jconfirm .jconfirm-box.jconfirm-animation-bottom,.jconfirm .jconfirm-box.jconfirm-animation-opacity,.jconfirm .jconfirm-box.jconfirm-animation-zoom,.jconfirm .jconfirm-box.jconfirm-animation-scale,.jconfirm .jconfirm-box.jconfirm-animation-none,.jconfirm .jconfirm-box.jconfirm-animation-rotate,.jconfirm .jconfirm-box.jconfirm-animation-rotatex,.jconfirm .jconfirm-box.jconfirm-animation-rotatey,.jconfirm .jconfirm-box.jconfirm-animation-scaley,.jconfirm .jconfirm-box.jconfirm-animation-scalex{opacity:0}.jconfirm .jconfirm-box.jconfirm-animation-rotate{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.jconfirm .jconfirm-box.jconfirm-animation-rotatex{-webkit-transform:rotateX(90deg);transform:rotateX(90deg);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotatexr{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotatey{-webkit-transform:rotatey(90deg);transform:rotatey(90deg);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotateyr{-webkit-transform:rotatey(-90deg);transform:rotatey(-90deg);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-scaley{-webkit-transform:scaley(1.5);transform:scaley(1.5);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-scalex{-webkit-transform:scalex(1.5);transform:scalex(1.5);-webkit-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-top{-webkit-transform:translate(0px,-100px);transform:translate(0px,-100px)}.jconfirm .jconfirm-box.jconfirm-animation-left{-webkit-transform:translate(-100px,0px);transform:translate(-100px,0px)}.jconfirm .jconfirm-box.jconfirm-animation-right{-webkit-transform:translate(100px,0px);transform:translate(100px,0px)}.jconfirm .jconfirm-box.jconfirm-animation-bottom{-webkit-transform:translate(0px,100px);transform:translate(0px,100px)}.jconfirm .jconfirm-box.jconfirm-animation-zoom{-webkit-transform:scale(1.2);transform:scale(1.2)}.jconfirm .jconfirm-box.jconfirm-animation-scale{-webkit-transform:scale(0.5);transform:scale(0.5)}.jconfirm .jconfirm-box.jconfirm-animation-none{visibility:hidden}.jconfirm.jconfirm-supervan .jconfirm-bg{background-color:rgba(54,70,93,0.95)}.jconfirm.jconfirm-supervan .jconfirm-box{background-color:transparent}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-blue{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-green{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-red{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-orange{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-purple{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-dark{border:0}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-closeIcon{color:white}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c{text-align:center;color:white;font-size:28px;font-weight:normal}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c>*{padding-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content-pane{margin-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content{text-align:center;color:white}.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons{text-align:center}.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons button{font-size:16px;border-radius:2px;background:#303f53;text-shadow:none;border:0;color:white;padding:10px;min-width:100px}.jconfirm.jconfirm-supervan.jconfirm-rtl .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-material .jconfirm-bg{background-color:rgba(0,0,0,0.67)}.jconfirm.jconfirm-material .jconfirm-box{background-color:white;-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);padding:30px 25px 10px 25px}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-content{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons{text-align:right}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons button{text-transform:uppercase;font-weight:500}.jconfirm.jconfirm-material.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-bootstrap .jconfirm-bg{background-color:rgba(0,0,0,0.21)}.jconfirm.jconfirm-bootstrap .jconfirm-box{background-color:white;-webkit-box-shadow:0 3px 8px 0 rgba(0,0,0,0.2);box-shadow:0 3px 8px 0 rgba(0,0,0,0.2);border:solid 1px rgba(0,0,0,0.4);padding:15px 0 0}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold;padding-left:15px;padding-right:15px}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-content{color:rgba(0,0,0,0.87);padding:0 15px}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons{text-align:right;padding:10px;margin:-5px 0 0;border-top:solid 1px #ddd;overflow:hidden;border-radius:0 0 4px 4px}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons button{font-weight:500}.jconfirm.jconfirm-bootstrap.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-modern .jconfirm-bg{background-color:slategray;opacity:.6}.jconfirm.jconfirm-modern .jconfirm-box{background-color:white;-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);padding:30px 30px 15px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87);top:15px;right:15px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:24px;font-weight:bold;text-align:center;margin-bottom:10px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{-webkit-transition:-webkit-transform .5s;transition:-webkit-transform .5s;transition:transform .5s;transition:transform .5s,-webkit-transform .5s;-webkit-transform:scale(0);transform:scale(0);display:block;margin-right:0;margin-left:0;margin-bottom:10px;font-size:69px;color:#aaa}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content{text-align:center;font-size:15px;color:#777;margin-bottom:25px}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons{text-align:center}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button{font-weight:bold;text-transform:uppercase;-webkit-transition:background .1s;transition:background .1s;padding:10px 20px}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button+button{margin-left:4px}.jconfirm.jconfirm-modern.jconfirm-open .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{-webkit-transform:scale(1);transform:scale(1)}
assets/js/jquery-confirm/jquery-confirm.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jquery-confirm v3.3.0 (http://craftpip.github.io/jquery-confirm/)
3
+ * Author: Boniface Pereira
4
+ * Website: www.craftpip.com
5
+ * Contact: hey@craftpip.com
6
+ *
7
+ * Copyright 2013-2017 jquery-confirm
8
+ * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE)
9
+ */
10
+ if(typeof jQuery==="undefined"){throw new Error("jquery-confirm requires jQuery");}var jconfirm,Jconfirm;(function($,window){$.fn.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}$(this).each(function(){var $this=$(this);if($this.attr("jc-attached")){console.warn("jConfirm has already been attached to this element ",$this[0]);return;}$this.on("click",function(e){e.preventDefault();var jcOption=$.extend({},options);if($this.attr("data-title")){jcOption.title=$this.attr("data-title");}if($this.attr("data-content")){jcOption.content=$this.attr("data-content");}if(typeof jcOption.buttons=="undefined"){jcOption.buttons={};}jcOption["$target"]=$this;if($this.attr("href")&&Object.keys(jcOption.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];jcOption.buttons=buttons;jcOption.buttons[firstBtn].action=function(){location.href=$this.attr("href");};}jcOption.closeIcon=false;var instance=$.confirm(jcOption);});$this.attr("jc-attached",true);});return $(this);};$.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});options.buttons=buttons;}return jconfirm(options);};$.alert=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];options.buttons[firstBtn]=buttons[firstBtn];}return jconfirm(options);};$.dialog=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false,closeIcon:function(){}};}options.buttons={};if(typeof options.closeIcon=="undefined"){options.closeIcon=function(){};}options.confirmKeys=[13];return jconfirm(options);};jconfirm=function(options){if(typeof options==="undefined"){options={};}var pluginOptions=$.extend(true,{},jconfirm.pluginDefaults);if(jconfirm.defaults){pluginOptions=$.extend(true,pluginOptions,jconfirm.defaults);}pluginOptions=$.extend(true,{},pluginOptions,options);var instance=new Jconfirm(pluginOptions);jconfirm.instances.push(instance);return instance;};Jconfirm=function(options){$.extend(this,options);this._init();};Jconfirm.prototype={_init:function(){var that=this;if(!jconfirm.instances.length){jconfirm.lastFocused=$("body").find(":focus");}this._id=Math.round(Math.random()*99999);this.contentParsed=$(document.createElement("div"));if(!this.lazyOpen){setTimeout(function(){that.open();},0);}},_buildHTML:function(){var that=this;this._parseAnimation(this.animation,"o");this._parseAnimation(this.closeAnimation,"c");this._parseBgDismissAnimation(this.backgroundDismissAnimation);this._parseColumnClass(this.columnClass);this._parseTheme(this.theme);this._parseType(this.type);var template=$(this.template);template.find(".jconfirm-box").addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed);if(this.typeAnimated){template.find(".jconfirm-box").addClass("jconfirm-type-animated");}if(this.useBootstrap){template.find(".jc-bs3-row").addClass(this.bootstrapClasses.row);template.find(".jc-bs3-row").addClass("justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center");template.find(".jconfirm-box-container").addClass(this.columnClassParsed);if(this.containerFluid){template.find(".jc-bs3-container").addClass(this.bootstrapClasses.containerFluid);}else{template.find(".jc-bs3-container").addClass(this.bootstrapClasses.container);}}else{template.find(".jconfirm-box").css("width",this.boxWidth);}if(this.titleClass){template.find(".jconfirm-title-c").addClass(this.titleClass);}template.addClass(this.themeParsed);var ariaLabel="jconfirm-box"+this._id;template.find(".jconfirm-box").attr("aria-labelledby",ariaLabel).attr("tabindex",-1);template.find(".jconfirm-content").attr("id",ariaLabel);if(this.bgOpacity!==null){template.find(".jconfirm-bg").css("opacity",this.bgOpacity);}if(this.rtl){template.addClass("jconfirm-rtl");}this.$el=template.appendTo(this.container);this.$jconfirmBoxContainer=this.$el.find(".jconfirm-box-container");this.$jconfirmBox=this.$body=this.$el.find(".jconfirm-box");this.$jconfirmBg=this.$el.find(".jconfirm-bg");this.$title=this.$el.find(".jconfirm-title");this.$titleContainer=this.$el.find(".jconfirm-title-c");this.$content=this.$el.find("div.jconfirm-content");this.$contentPane=this.$el.find(".jconfirm-content-pane");this.$icon=this.$el.find(".jconfirm-icon-c");this.$closeIcon=this.$el.find(".jconfirm-closeIcon");this.$holder=this.$el.find(".jconfirm-holder");this.$btnc=this.$el.find(".jconfirm-buttons");this.$scrollPane=this.$el.find(".jconfirm-scrollpane");that.setStartingPoint();this._contentReady=$.Deferred();this._modalReady=$.Deferred();this.$holder.css({"padding-top":this.offsetTop,"padding-bottom":this.offsetBottom,});this.setTitle();this.setIcon();this._setButtons();this._parseContent();this.initDraggable();if(this.isAjax){this.showLoading(false);}$.when(this._contentReady,this._modalReady).then(function(){if(that.isAjaxLoading){setTimeout(function(){that.isAjaxLoading=false;that.setContent();that.setTitle();that.setIcon();setTimeout(function(){that.hideLoading(false);that._updateContentMaxHeight();},100);if(typeof that.onContentReady==="function"){that.onContentReady();}},50);}else{that._updateContentMaxHeight();that.setTitle();that.setIcon();if(typeof that.onContentReady==="function"){that.onContentReady();}}if(that.autoClose){that._startCountDown();}});this._watchContent();if(this.animation==="none"){this.animationSpeed=1;this.animationBounce=1;}this.$body.css(this._getCSS(this.animationSpeed,this.animationBounce));this.$contentPane.css(this._getCSS(this.animationSpeed,1));this.$jconfirmBg.css(this._getCSS(this.animationSpeed,1));this.$jconfirmBoxContainer.css(this._getCSS(this.animationSpeed,1));},_typePrefix:"jconfirm-type-",typeParsed:"",_parseType:function(type){this.typeParsed=this._typePrefix+type;},setType:function(type){var oldClass=this.typeParsed;this._parseType(type);this.$jconfirmBox.removeClass(oldClass).addClass(this.typeParsed);},themeParsed:"",_themePrefix:"jconfirm-",setTheme:function(theme){var previous=this.theme;this.theme=theme||this.theme;this._parseTheme(this.theme);if(previous){this.$el.removeClass(previous);}this.$el.addClass(this.themeParsed);this.theme=theme;},_parseTheme:function(theme){var that=this;theme=theme.split(",");$.each(theme,function(k,a){if(a.indexOf(that._themePrefix)===-1){theme[k]=that._themePrefix+$.trim(a);}});this.themeParsed=theme.join(" ").toLowerCase();},backgroundDismissAnimationParsed:"",_bgDismissPrefix:"jconfirm-hilight-",_parseBgDismissAnimation:function(bgDismissAnimation){var animation=bgDismissAnimation.split(",");var that=this;$.each(animation,function(k,a){if(a.indexOf(that._bgDismissPrefix)===-1){animation[k]=that._bgDismissPrefix+$.trim(a);}});this.backgroundDismissAnimationParsed=animation.join(" ").toLowerCase();},animationParsed:"",closeAnimationParsed:"",_animationPrefix:"jconfirm-animation-",setAnimation:function(animation){this.animation=animation||this.animation;this._parseAnimation(this.animation,"o");},_parseAnimation:function(animation,which){which=which||"o";var animations=animation.split(",");var that=this;$.each(animations,function(k,a){if(a.indexOf(that._animationPrefix)===-1){animations[k]=that._animationPrefix+$.trim(a);}});var a_string=animations.join(" ").toLowerCase();if(which==="o"){this.animationParsed=a_string;}else{this.closeAnimationParsed=a_string;}return a_string;},setCloseAnimation:function(closeAnimation){this.closeAnimation=closeAnimation||this.closeAnimation;this._parseAnimation(this.closeAnimation,"c");},setAnimationSpeed:function(speed){this.animationSpeed=speed||this.animationSpeed;},columnClassParsed:"",setColumnClass:function(colClass){if(!this.useBootstrap){console.warn("cannot set columnClass, useBootstrap is set to false");return;}this.columnClass=colClass||this.columnClass;this._parseColumnClass(this.columnClass);this.$jconfirmBoxContainer.addClass(this.columnClassParsed);},_updateContentMaxHeight:function(){var height=$(window).height()-(this.$jconfirmBox.outerHeight()-this.$contentPane.outerHeight())-(this.offsetTop+this.offsetBottom);this.$contentPane.css({"max-height":height+"px"});},setBoxWidth:function(width){if(this.useBootstrap){console.warn("cannot set boxWidth, useBootstrap is set to true");return;}this.boxWidth=width;this.$jconfirmBox.css("width",width);},_parseColumnClass:function(colClass){colClass=colClass.toLowerCase();var p;switch(colClass){case"xl":case"xlarge":p="col-md-12";break;case"l":case"large":p="col-md-8 col-md-offset-2";break;case"m":case"medium":p="col-md-6 col-md-offset-3";break;case"s":case"small":p="col-md-4 col-md-offset-4";break;case"xs":case"xsmall":p="col-md-2 col-md-offset-5";break;default:p=colClass;}this.columnClassParsed=p;},initDraggable:function(){var that=this;var $t=this.$titleContainer;this.resetDrag();if(this.draggable){$t.on("mousedown",function(e){$t.addClass("jconfirm-hand");that.mouseX=e.clientX;that.mouseY=e.clientY;that.isDrag=true;});$(window).on("mousemove."+this._id,function(e){if(that.isDrag){that.movingX=e.clientX-that.mouseX+that.initialX;that.movingY=e.clientY-that.mouseY+that.initialY;that.setDrag();}});$(window).on("mouseup."+this._id,function(){$t.removeClass("jconfirm-hand");if(that.isDrag){that.isDrag=false;that.initialX=that.movingX;that.initialY=that.movingY;}});}},resetDrag:function(){this.isDrag=false;this.initialX=0;this.initialY=0;this.movingX=0;this.movingY=0;this.mouseX=0;this.mouseY=0;this.$jconfirmBoxContainer.css("transform","translate("+0+"px, "+0+"px)");},setDrag:function(){if(!this.draggable){return;}this.alignMiddle=false;var boxWidth=this.$jconfirmBox.outerWidth();var boxHeight=this.$jconfirmBox.outerHeight();var windowWidth=$(window).width();var windowHeight=$(window).height();var that=this;var dragUpdate=1;if(that.movingX%dragUpdate===0||that.movingY%dragUpdate===0){if(that.dragWindowBorder){var leftDistance=(windowWidth/2)-boxWidth/2;var topDistance=(windowHeight/2)-boxHeight/2;topDistance-=that.dragWindowGap;leftDistance-=that.dragWindowGap;if(leftDistance+that.movingX<0){that.movingX=-leftDistance;}else{if(leftDistance-that.movingX<0){that.movingX=leftDistance;}}if(topDistance+that.movingY<0){that.movingY=-topDistance;}else{if(topDistance-that.movingY<0){that.movingY=topDistance;}}}that.$jconfirmBoxContainer.css("transform","translate("+that.movingX+"px, "+that.movingY+"px)");}},_scrollTop:function(){if(typeof pageYOffset!=="undefined"){return pageYOffset;}else{var B=document.body;var D=document.documentElement;D=(D.clientHeight)?D:B;return D.scrollTop;}},_watchContent:function(){var that=this;if(this._timer){clearInterval(this._timer);}var prevContentHeight=0;this._timer=setInterval(function(){if(that.smoothContent){var contentHeight=that.$content.outerHeight()||0;if(contentHeight!==prevContentHeight){that.$contentPane.css({height:contentHeight}).scrollTop(0);prevContentHeight=contentHeight;}var wh=$(window).height();var total=that.offsetTop+that.offsetBottom+that.$jconfirmBox.height()-that.$contentPane.height()+that.$content.height();if(total<wh){that.$contentPane.addClass("no-scroll");}else{that.$contentPane.removeClass("no-scroll");}}},this.watchInterval);},_overflowClass:"jconfirm-overflow",_hilightAnimating:false,highlight:function(){this.hiLightModal();},hiLightModal:function(){var that=this;if(this._hilightAnimating){return;}that.$body.addClass("hilight");var duration=parseFloat(that.$body.css("animation-duration"))||2;this._hilightAnimating=true;setTimeout(function(){that._hilightAnimating=false;that.$body.removeClass("hilight");},duration*1000);},_bindEvents:function(){var that=this;this.boxClicked=false;this.$scrollPane.click(function(e){if(!that.boxClicked){var buttonName=false;var shouldClose=false;var str;if(typeof that.backgroundDismiss=="function"){str=that.backgroundDismiss();}else{str=that.backgroundDismiss;}if(typeof str=="string"&&typeof that.buttons[str]!="undefined"){buttonName=str;shouldClose=false;}else{if(typeof str=="undefined"||!!(str)==true){shouldClose=true;}else{shouldClose=false;}}if(buttonName){var btnResponse=that.buttons[buttonName].action.apply(that);shouldClose=(typeof btnResponse=="undefined")||!!(btnResponse);}if(shouldClose){that.close();}else{that.hiLightModal();}}that.boxClicked=false;});this.$jconfirmBox.click(function(e){that.boxClicked=true;});var isKeyDown=false;$(window).on("jcKeyDown."+that._id,function(e){if(!isKeyDown){isKeyDown=true;}});$(window).on("keyup."+that._id,function(e){if(isKeyDown){that.reactOnKey(e);isKeyDown=false;}});$(window).on("resize."+this._id,function(){that._updateContentMaxHeight();setTimeout(function(){that.resetDrag();},100);});},_cubic_bezier:"0.36, 0.55, 0.19",_getCSS:function(speed,bounce){return{"-webkit-transition-duration":speed/1000+"s","transition-duration":speed/1000+"s","-webkit-transition-timing-function":"cubic-bezier("+this._cubic_bezier+", "+bounce+")","transition-timing-function":"cubic-bezier("+this._cubic_bezier+", "+bounce+")"};},_setButtons:function(){var that=this;var total_buttons=0;if(typeof this.buttons!=="object"){this.buttons={};}$.each(this.buttons,function(key,button){total_buttons+=1;if(typeof button==="function"){that.buttons[key]=button={action:button};}that.buttons[key].text=button.text||key;that.buttons[key].btnClass=button.btnClass||"btn-default";that.buttons[key].action=button.action||function(){};that.buttons[key].keys=button.keys||[];that.buttons[key].isHidden=button.isHidden||false;that.buttons[key].isDisabled=button.isDisabled||false;$.each(that.buttons[key].keys,function(i,a){that.buttons[key].keys[i]=a.toLowerCase();});var button_element=$('<button type="button" class="btn"></button>').html(that.buttons[key].text).addClass(that.buttons[key].btnClass).prop("disabled",that.buttons[key].isDisabled).css("display",that.buttons[key].isHidden?"none":"").click(function(e){e.preventDefault();var res=that.buttons[key].action.apply(that,[that.buttons[key]]);that.onAction.apply(that,[key,that.buttons[key]]);that._stopCountDown();if(typeof res==="undefined"||res){that.close();}});that.buttons[key].el=button_element;that.buttons[key].setText=function(text){button_element.html(text);};that.buttons[key].addClass=function(className){button_element.addClass(className);};that.buttons[key].removeClass=function(className){button_element.removeClass(className);};that.buttons[key].disable=function(){that.buttons[key].isDisabled=true;button_element.prop("disabled",true);};that.buttons[key].enable=function(){that.buttons[key].isDisabled=false;button_element.prop("disabled",false);};that.buttons[key].show=function(){that.buttons[key].isHidden=false;button_element.css("display","");};that.buttons[key].hide=function(){that.buttons[key].isHidden=true;button_element.css("display","none");};that["$_"+key]=that["$$"+key]=button_element;that.$btnc.append(button_element);});if(total_buttons===0){this.$btnc.hide();}if(this.closeIcon===null&&total_buttons===0){this.closeIcon=true;}if(this.closeIcon){if(this.closeIconClass){var closeHtml='<i class="'+this.closeIconClass+'"></i>';this.$closeIcon.html(closeHtml);}this.$closeIcon.click(function(e){e.preventDefault();var buttonName=false;var shouldClose=false;var str;if(typeof that.closeIcon=="function"){str=that.closeIcon();}else{str=that.closeIcon;}if(typeof str=="string"&&typeof that.buttons[str]!="undefined"){buttonName=str;shouldClose=false;}else{if(typeof str=="undefined"||!!(str)==true){shouldClose=true;}else{shouldClose=false;}}if(buttonName){var btnResponse=that.buttons[buttonName].action.apply(that);shouldClose=(typeof btnResponse=="undefined")||!!(btnResponse);}if(shouldClose){that.close();}});this.$closeIcon.show();}else{this.$closeIcon.hide();}},setTitle:function(string,force){force=force||false;if(typeof string!=="undefined"){if(typeof string=="string"){this.title=string;}else{if(typeof string=="function"){if(typeof string.promise=="function"){console.error("Promise was returned from title function, this is not supported.");}var response=string();if(typeof response=="string"){this.title=response;}else{this.title=false;}}else{this.title=false;}}}if(this.isAjaxLoading&&!force){return;}this.$title.html(this.title||"");this.updateTitleContainer();},setIcon:function(iconClass,force){force=force||false;if(typeof iconClass!=="undefined"){if(typeof iconClass=="string"){this.icon=iconClass;}else{if(typeof iconClass==="function"){var response=iconClass();if(typeof response=="string"){this.icon=response;}else{this.icon=false;}}else{this.icon=false;}}}if(this.isAjaxLoading&&!force){return;}this.$icon.html(this.icon?'<i class="'+this.icon+'"></i>':"");this.updateTitleContainer();},updateTitleContainer:function(){if(!this.title&&!this.icon){this.$titleContainer.hide();}else{this.$titleContainer.show();}},setContentPrepend:function(content,force){if(!content){return;}this.contentParsed.prepend(content);},setContentAppend:function(content){if(!content){return;}this.contentParsed.append(content);},setContent:function(content,force){force=!!force;var that=this;if(content){this.contentParsed.html("").append(content);}if(this.isAjaxLoading&&!force){return;}this.$content.html("");this.$content.append(this.contentParsed);setTimeout(function(){that.$body.find("input[autofocus]:visible:first").focus();},100);},loadingSpinner:false,showLoading:function(disableButtons){this.loadingSpinner=true;this.$jconfirmBox.addClass("loading");if(disableButtons){this.$btnc.find("button").prop("disabled",true);}},hideLoading:function(enableButtons){this.loadingSpinner=false;this.$jconfirmBox.removeClass("loading");if(enableButtons){this.$btnc.find("button").prop("disabled",false);}},ajaxResponse:false,contentParsed:"",isAjax:false,isAjaxLoading:false,_parseContent:function(){var that=this;var e="&nbsp;";if(typeof this.content=="function"){var res=this.content.apply(this);if(typeof res=="string"){this.content=res;}else{if(typeof res=="object"&&typeof res.always=="function"){this.isAjax=true;this.isAjaxLoading=true;res.always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});this.content=e;}else{this.content=e;}}}if(typeof this.content=="string"&&this.content.substr(0,4).toLowerCase()==="url:"){this.isAjax=true;this.isAjaxLoading=true;var u=this.content.substring(4,this.content.length);$.get(u).done(function(html){that.contentParsed.html(html);}).always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});}if(!this.content){this.content=e;}if(!this.isAjax){this.contentParsed.html(this.content);this.setContent();that._contentReady.resolve();}},_stopCountDown:function(){clearInterval(this.autoCloseInterval);if(this.$cd){this.$cd.remove();}},_startCountDown:function(){var that=this;var opt=this.autoClose.split("|");if(opt.length!==2){console.error("Invalid option for autoClose. example 'close|10000'");return false;}var button_key=opt[0];var time=parseInt(opt[1]);if(typeof this.buttons[button_key]==="undefined"){console.error("Invalid button key '"+button_key+"' for autoClose");return false;}var seconds=Math.ceil(time/1000);this.$cd=$('<span class="countdown"> ('+seconds+")</span>").appendTo(this["$_"+button_key]);this.autoCloseInterval=setInterval(function(){that.$cd.html(" ("+(seconds-=1)+") ");if(seconds<=0){that["$$"+button_key].trigger("click");that._stopCountDown();}},1000);},_getKey:function(key){switch(key){case 192:return"tilde";case 13:return"enter";case 16:return"shift";case 9:return"tab";case 20:return"capslock";case 17:return"ctrl";case 91:return"win";case 18:return"alt";case 27:return"esc";case 32:return"space";}var initial=String.fromCharCode(key);if(/^[A-z0-9]+$/.test(initial)){return initial.toLowerCase();}else{return false;}},reactOnKey:function(e){var that=this;var a=$(".jconfirm");if(a.eq(a.length-1)[0]!==this.$el[0]){return false;}var key=e.which;if(this.$content.find(":input").is(":focus")&&/13|32/.test(key)){return false;}var keyChar=this._getKey(key);if(keyChar==="esc"&&this.escapeKey){if(this.escapeKey===true){this.$scrollPane.trigger("click");}else{if(typeof this.escapeKey==="string"||typeof this.escapeKey==="function"){var buttonKey;if(typeof this.escapeKey==="function"){buttonKey=this.escapeKey();}else{buttonKey=this.escapeKey;}if(buttonKey){if(typeof this.buttons[buttonKey]==="undefined"){console.warn("Invalid escapeKey, no buttons found with key "+buttonKey);}else{this["$_"+buttonKey].trigger("click");}}}}}$.each(this.buttons,function(key,button){if(button.keys.indexOf(keyChar)!=-1){that["$_"+key].trigger("click");}});},setDialogCenter:function(){console.info("setDialogCenter is deprecated, dialogs are centered with CSS3 tables");},_unwatchContent:function(){clearInterval(this._timer);},close:function(){var that=this;if(typeof this.onClose==="function"){this.onClose();}this._unwatchContent();$(window).unbind("resize."+this._id);$(window).unbind("keyup."+this._id);$(window).unbind("jcKeyDown."+this._id);if(this.draggable){$(window).unbind("mousemove."+this._id);$(window).unbind("mouseup."+this._id);this.$titleContainer.unbind("mousedown");}that.$el.removeClass(that.loadedClass);$("body").removeClass("jconfirm-no-scroll-"+that._id);that.$jconfirmBoxContainer.removeClass("jconfirm-no-transition");setTimeout(function(){that.$body.addClass(that.closeAnimationParsed);that.$jconfirmBg.addClass("jconfirm-bg-h");var closeTimer=(that.closeAnimation==="none")?1:that.animationSpeed;setTimeout(function(){that.$el.remove();var l=jconfirm.instances;var i=jconfirm.instances.length-1;for(i;i>=0;i--){if(jconfirm.instances[i]._id===that._id){jconfirm.instances.splice(i,1);}}if(!jconfirm.instances.length){if(that.scrollToPreviousElement&&jconfirm.lastFocused&&jconfirm.lastFocused.length&&$.contains(document,jconfirm.lastFocused[0])){var $lf=jconfirm.lastFocused;if(that.scrollToPreviousElementAnimate){var st=$(window).scrollTop();var ot=jconfirm.lastFocused.offset().top;var wh=$(window).height();if(!(ot>st&&ot<(st+wh))){var scrollTo=(ot-Math.round((wh/3)));$("html, body").animate({scrollTop:scrollTo},that.animationSpeed,"swing",function(){$lf.focus();});}else{$lf.focus();}}else{$lf.focus();}jconfirm.lastFocused=false;}}if(typeof that.onDestroy==="function"){that.onDestroy();}},closeTimer*0.4);},50);return true;},open:function(){if(this.isOpen()){return false;}this._buildHTML();this._bindEvents();this._open();return true;},setStartingPoint:function(){var el=false;if(this.animateFromElement!==true&&this.animateFromElement){el=this.animateFromElement;jconfirm.lastClicked=false;}else{if(jconfirm.lastClicked&&this.animateFromElement===true){el=jconfirm.lastClicked;jconfirm.lastClicked=false;}else{return false;}}if(!el){return false;}var offset=el.offset();var iTop=el.outerHeight()/2;var iLeft=el.outerWidth()/2;iTop-=this.$jconfirmBox.outerHeight()/2;iLeft-=this.$jconfirmBox.outerWidth()/2;var sourceTop=offset.top+iTop;sourceTop=sourceTop-this._scrollTop();var sourceLeft=offset.left+iLeft;var wh=$(window).height()/2;var ww=$(window).width()/2;var targetH=wh-this.$jconfirmBox.outerHeight()/2;var targetW=ww-this.$jconfirmBox.outerWidth()/2;sourceTop-=targetH;sourceLeft-=targetW;if(Math.abs(sourceTop)>wh||Math.abs(sourceLeft)>ww){return false;}this.$jconfirmBoxContainer.css("transform","translate("+sourceLeft+"px, "+sourceTop+"px)");},_open:function(){var that=this;if(typeof that.onOpenBefore==="function"){that.onOpenBefore();}this.$body.removeClass(this.animationParsed);this.$jconfirmBg.removeClass("jconfirm-bg-h");this.$body.focus();that.$jconfirmBoxContainer.css("transform","translate("+0+"px, "+0+"px)");setTimeout(function(){that.$body.css(that._getCSS(that.animationSpeed,1));that.$body.css({"transition-property":that.$body.css("transition-property")+", margin"});that.$jconfirmBoxContainer.addClass("jconfirm-no-transition");that._modalReady.resolve();if(typeof that.onOpen==="function"){that.onOpen();}that.$el.addClass(that.loadedClass);},this.animationSpeed);},loadedClass:"jconfirm-open",isClosed:function(){return !this.$el||this.$el.css("display")==="";},isOpen:function(){return !this.isClosed();},toggle:function(){if(!this.isOpen()){this.open();}else{this.close();}}};jconfirm.instances=[];jconfirm.lastFocused=false;jconfirm.pluginDefaults={template:'<div class="jconfirm"><div class="jconfirm-bg jconfirm-bg-h"></div><div class="jconfirm-scrollpane"><div class="jconfirm-row"><div class="jconfirm-cell"><div class="jconfirm-holder"><div class="jc-bs3-container"><div class="jc-bs3-row"><div class="jconfirm-box-container jconfirm-animated"><div class="jconfirm-box" role="dialog" aria-labelledby="labelled" tabindex="-1"><div class="jconfirm-closeIcon">&times;</div><div class="jconfirm-title-c"><span class="jconfirm-icon-c"></span><span class="jconfirm-title"></span></div><div class="jconfirm-content-pane"><div class="jconfirm-content"></div></div><div class="jconfirm-buttons"></div><div class="jconfirm-clear"></div></div></div></div></div></div></div></div></div></div>',title:"Hello",titleClass:"",type:"default",typeAnimated:true,draggable:true,dragWindowGap:15,dragWindowBorder:true,animateFromElement:true,alignMiddle:true,smoothContent:true,content:"Are you sure to continue?",buttons:{},defaultButtons:{ok:{action:function(){}},close:{action:function(){}}},contentLoaded:function(){},icon:"",lazyOpen:false,bgOpacity:null,theme:"light",animation:"scale",closeAnimation:"scale",animationSpeed:400,animationBounce:1,escapeKey:true,rtl:false,container:"body",containerFluid:false,backgroundDismiss:false,backgroundDismissAnimation:"shake",autoClose:false,closeIcon:null,closeIconClass:false,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",boxWidth:"50%",scrollToPreviousElement:true,scrollToPreviousElementAnimate:true,useBootstrap:true,offsetTop:40,offsetBottom:40,bootstrapClasses:{container:"container",containerFluid:"container-fluid",row:"row"},onContentReady:function(){},onOpenBefore:function(){},onOpen:function(){},onClose:function(){},onDestroy:function(){},onAction:function(){}};var keyDown=false;$(window).on("keydown",function(e){if(!keyDown){var $target=$(e.target);var pass=false;if($target.closest(".jconfirm-box").length){pass=true;}if(pass){$(window).trigger("jcKeyDown");}keyDown=true;}});$(window).on("keyup",function(){keyDown=false;});jconfirm.lastClicked=false;$(document).on("mousedown","button, a",function(){jconfirm.lastClicked=$(this);});})(jQuery,window);
assets/js/jquery-tiptip/jquery.tipTip.js ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * TipTip
3
+ * Copyright 2010 Drew Wilson
4
+ * www.drewwilson.com
5
+ * code.drewwilson.com/entry/tiptip-jquery-plugin
6
+ *
7
+ * Version 1.3 - Updated: Mar. 23, 2010
8
+ *
9
+ * This Plug-In will create a custom tooltip to replace the default
10
+ * browser tooltip. It is extremely lightweight and very smart in
11
+ * that it detects the edges of the browser window and will make sure
12
+ * the tooltip stays within the current window size. As a result the
13
+ * tooltip will adjust itself to be displayed above, below, to the left
14
+ * or to the right depending on what is necessary to stay within the
15
+ * browser window. It is completely customizable as well via CSS.
16
+ *
17
+ * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
18
+ * http://www.opensource.org/licenses/mit-license.php
19
+ * http://www.gnu.org/licenses/gpl.html
20
+ */
21
+
22
+ (function($){
23
+ $.fn.tipTip = function(options) {
24
+ var defaults = {
25
+ activation: "hover",
26
+ keepAlive: false,
27
+ maxWidth: "200px",
28
+ edgeOffset: 3,
29
+ defaultPosition: "bottom",
30
+ delay: 400,
31
+ fadeIn: 200,
32
+ fadeOut: 200,
33
+ attribute: "title",
34
+ content: false, // HTML or String to fill TipTIp with
35
+ enter: function(){},
36
+ exit: function(){}
37
+ };
38
+ var opts = $.extend(defaults, options);
39
+
40
+ // Setup tip tip elements and render them to the DOM
41
+ if($("#tiptip_holder").length <= 0){
42
+ var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
43
+ var tiptip_content = $('<div id="tiptip_content"></div>');
44
+ var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
45
+ $("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
46
+ } else {
47
+ var tiptip_holder = $("#tiptip_holder");
48
+ var tiptip_content = $("#tiptip_content");
49
+ var tiptip_arrow = $("#tiptip_arrow");
50
+ }
51
+
52
+ return this.each(function(){
53
+ var org_elem = $(this);
54
+ if(opts.content){
55
+ var org_title = opts.content;
56
+ } else {
57
+ var org_title = org_elem.attr(opts.attribute);
58
+ }
59
+ if(org_title != ""){
60
+ if(!opts.content){
61
+ org_elem.removeAttr(opts.attribute); //remove original Attribute
62
+ }
63
+ var timeout = false;
64
+
65
+ if(opts.activation == "hover"){
66
+ org_elem.hover(function(){
67
+ active_tiptip();
68
+ }, function(){
69
+ if(!opts.keepAlive){
70
+ deactive_tiptip();
71
+ }
72
+ });
73
+ if(opts.keepAlive){
74
+ tiptip_holder.hover(function(){}, function(){
75
+ deactive_tiptip();
76
+ });
77
+ }
78
+ } else if(opts.activation == "focus"){
79
+ org_elem.focus(function(){
80
+ active_tiptip();
81
+ }).blur(function(){
82
+ deactive_tiptip();
83
+ });
84
+ } else if(opts.activation == "click"){
85
+ org_elem.click(function(){
86
+ active_tiptip();
87
+ return false;
88
+ }).hover(function(){},function(){
89
+ if(!opts.keepAlive){
90
+ deactive_tiptip();
91
+ }
92
+ });
93
+ if(opts.keepAlive){
94
+ tiptip_holder.hover(function(){}, function(){
95
+ deactive_tiptip();
96
+ });
97
+ }
98
+ }
99
+
100
+ function active_tiptip(){
101
+ opts.enter.call(this);
102
+ tiptip_content.html(org_title);
103
+ tiptip_holder.hide().removeAttr("class").css("margin","0");
104
+ tiptip_arrow.removeAttr("style");
105
+
106
+ var top = parseInt(org_elem.offset()['top']);
107
+ var left = parseInt(org_elem.offset()['left']);
108
+ var org_width = parseInt(org_elem.outerWidth());
109
+ var org_height = parseInt(org_elem.outerHeight());
110
+ var tip_w = tiptip_holder.outerWidth();
111
+ var tip_h = tiptip_holder.outerHeight();
112
+ var w_compare = Math.round((org_width - tip_w) / 2);
113
+ var h_compare = Math.round((org_height - tip_h) / 2);
114
+ var marg_left = Math.round(left + w_compare);
115
+ var marg_top = Math.round(top + org_height + opts.edgeOffset);
116
+ var t_class = "";
117
+ var arrow_top = "";
118
+ var arrow_left = Math.round(tip_w - 12) / 2;
119
+
120
+ if(opts.defaultPosition == "bottom"){
121
+ t_class = "_bottom";
122
+ } else if(opts.defaultPosition == "top"){
123
+ t_class = "_top";
124
+ } else if(opts.defaultPosition == "left"){
125
+ t_class = "_left";
126
+ } else if(opts.defaultPosition == "right"){
127
+ t_class = "_right";
128
+ }
129
+
130
+ var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
131
+ var left_compare = (tip_w + left) > parseInt($(window).width());
132
+
133
+ if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
134
+ t_class = "_right";
135
+ arrow_top = Math.round(tip_h - 13) / 2;
136
+ arrow_left = -12;
137
+ marg_left = Math.round(left + org_width + opts.edgeOffset);
138
+ marg_top = Math.round(top + h_compare);
139
+ } else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
140
+ t_class = "_left";
141
+ arrow_top = Math.round(tip_h - 13) / 2;
142
+ arrow_left = Math.round(tip_w);
143
+ marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
144
+ marg_top = Math.round(top + h_compare);
145
+ }
146
+
147
+ var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
148
+ var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
149
+
150
+ if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
151
+ if(t_class == "_top" || t_class == "_bottom"){
152
+ t_class = "_top";
153
+ } else {
154
+ t_class = t_class+"_top";
155
+ }
156
+ arrow_top = tip_h;
157
+ marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
158
+ } else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
159
+ if(t_class == "_top" || t_class == "_bottom"){
160
+ t_class = "_bottom";
161
+ } else {
162
+ t_class = t_class+"_bottom";
163
+ }
164
+ arrow_top = -12;
165
+ marg_top = Math.round(top + org_height + opts.edgeOffset);
166
+ }
167
+
168
+ if(t_class == "_right_top" || t_class == "_left_top"){
169
+ marg_top = marg_top + 5;
170
+ } else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
171
+ marg_top = marg_top - 5;
172
+ }
173
+ if(t_class == "_left_top" || t_class == "_left_bottom"){
174
+ marg_left = marg_left + 5;
175
+ }
176
+ tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
177
+ tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
178
+
179
+ if (timeout){ clearTimeout(timeout); }
180
+ timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
181
+ }
182
+
183
+ function deactive_tiptip(){
184
+ opts.exit.call(this);
185
+ if (timeout){ clearTimeout(timeout); }
186
+ tiptip_holder.fadeOut(opts.fadeOut);
187
+ }
188
+ }
189
+ });
190
+ }
191
+ })(jQuery);
assets/js/jquery-tiptip/jquery.tipTip.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){t.fn.tipTip=function(e){var o=t.extend({activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},e);if(t("#tiptip_holder").length<=0){var i=t('<div id="tiptip_holder" style="max-width:'+o.maxWidth+';"></div>'),n=t('<div id="tiptip_content"></div>'),r=t('<div id="tiptip_arrow"></div>');t("body").append(i.html(n).prepend(r.html('<div id="tiptip_arrow_inner"></div>')))}else i=t("#tiptip_holder"),n=t("#tiptip_content"),r=t("#tiptip_arrow");return this.each(function(){function e(){o.enter.call(this),n.html(d),i.hide().removeAttr("class").css("margin","0"),r.removeAttr("style");var e=parseInt(f.offset().top),a=parseInt(f.offset().left),p=parseInt(f.outerWidth()),l=parseInt(f.outerHeight()),h=i.outerWidth(),c=i.outerHeight(),s=Math.round((p-h)/2),_=Math.round((l-c)/2),v=Math.round(a+s),m=Math.round(e+l+o.edgeOffset),g="",b="",M=Math.round(h-12)/2;"bottom"==o.defaultPosition?g="_bottom":"top"==o.defaultPosition?g="_top":"left"==o.defaultPosition?g="_left":"right"==o.defaultPosition&&(g="_right");var w=s+a<parseInt(t(window).scrollLeft()),O=h+a>parseInt(t(window).width());w&&s<0||"_right"==g&&!O||"_left"==g&&a<h+o.edgeOffset+5?(g="_right",b=Math.round(c-13)/2,M=-12,v=Math.round(a+p+o.edgeOffset),m=Math.round(e+_)):(O&&s<0||"_left"==g&&!w)&&(g="_left",b=Math.round(c-13)/2,M=Math.round(h),v=Math.round(a-(h+o.edgeOffset+5)),m=Math.round(e+_));var x=e+l+o.edgeOffset+c+8>parseInt(t(window).height()+t(window).scrollTop()),I=e+l-(o.edgeOffset+c+8)<0;x||"_bottom"==g&&x||"_top"==g&&!I?("_top"==g||"_bottom"==g?g="_top":g+="_top",b=c,m=Math.round(e-(c+5+o.edgeOffset))):(I|("_top"==g&&I)||"_bottom"==g&&!x)&&("_top"==g||"_bottom"==g?g="_bottom":g+="_bottom",b=-12,m=Math.round(e+l+o.edgeOffset)),"_right_top"==g||"_left_top"==g?m+=5:"_right_bottom"!=g&&"_left_bottom"!=g||(m-=5),"_left_top"!=g&&"_left_bottom"!=g||(v+=5),r.css({"margin-left":M+"px","margin-top":b+"px"}),i.css({"margin-left":v+"px","margin-top":m+"px"}).attr("class","tip"+g),u&&clearTimeout(u),u=setTimeout(function(){i.stop(!0,!0).fadeIn(o.fadeIn)},o.delay)}function a(){o.exit.call(this),u&&clearTimeout(u),i.fadeOut(o.fadeOut)}var f=t(this);if(o.content)var d=o.content;else d=f.attr(o.attribute);if(""!=d){o.content||f.removeAttr(o.attribute);var u=!1;"hover"==o.activation?(f.hover(function(){e()},function(){o.keepAlive||a()}),o.keepAlive&&i.hover(function(){},function(){a()})):"focus"==o.activation?f.focus(function(){e()}).blur(function(){a()}):"click"==o.activation&&(f.click(function(){return e(),!1}).hover(function(){},function(){o.keepAlive||a()}),o.keepAlive&&i.hover(function(){},function(){a()}))}})}}(jQuery);
everest-forms.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Everest Forms
4
+ * Plugin URI: https://wpeverest.com/wordpress-plugins/everest-forms/
5
+ * Description: Drag and Drop form builder to easily create contact forms and more.
6
+ * Version: 1.0.0
7
+ * Author: WPEverest
8
+ * Author URI: https://wpeverest.com
9
+ * Text Domain: everest-forms
10
+ * Domain Path: /languages/
11
+ *
12
+ * @package EverestForms
13
+ */
14
+
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit; // Exit if accessed directly.
17
+ }
18
+
19
+ // Define EVF_PLUGIN_FILE.
20
+ if ( ! defined( 'EVF_PLUGIN_FILE' ) ) {
21
+ define( 'EVF_PLUGIN_FILE', __FILE__ );
22
+ }
23
+
24
+ // Include the main EverestForms class.
25
+ if ( ! class_exists( 'EverestForms' ) ) {
26
+ include_once dirname( __FILE__ ) . '/includes/class-everest-forms.php';
27
+ }
28
+
29
+ /**
30
+ * Main instance of EverestForms.
31
+ *
32
+ * Returns the main instance of EVF to prevent the need to use globals.
33
+ *
34
+ * @since 1.0.0
35
+ * @return EverestForms
36
+ */
37
+ function evf() {
38
+ return EverestForms::instance();
39
+ }
40
+
41
+ // Global for backwards compatibility.
42
+ $GLOBALS['everest-forms'] = evf();
gulpfile.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ var gulp = require( 'gulp' );
4
+ var browserSync = require('browser-sync').create();
5
+ var sass = require( 'gulp-sass' );
6
+
7
+ // Define paths
8
+ var paths = {
9
+ styles: {
10
+ src: './assets/css/**/*.scss',
11
+ dest: './assets/css/'
12
+ },
13
+ js: {
14
+ src: './assets/js/**/*.js',
15
+ dest: './assets/js/'
16
+ }
17
+ };
18
+
19
+ // Start browserSync
20
+ function browserSyncStart( cb ) {
21
+ browserSync.init({
22
+ proxy: 'localhost/suffice'
23
+ }, cb);
24
+ }
25
+
26
+ // Reloads the browser
27
+ function browserSyncReload( cb ) {
28
+ browserSync.reload();
29
+ cb();
30
+ }
31
+
32
+ // Compiles SASS into CSS
33
+ function sassCompile() {
34
+ return gulp.src( paths.styles.src )
35
+ .pipe( sass({
36
+ indentType: 'tab',
37
+ indentWidth: 1,
38
+ outputStyle: 'expanded'
39
+ } ).on( 'error', sass.logError) )
40
+ .pipe( gulp.dest( paths.styles.dest ) )
41
+ .pipe( browserSync.stream() );
42
+ }
43
+
44
+ // Watch for file changes
45
+ function watch() {
46
+ gulp.watch( paths.styles.src, sassCompile );
47
+ gulp.watch( paths.js.src, browserSyncReload );
48
+ }
49
+
50
+
51
+ // define series of tasks
52
+ var server = gulp.series( browserSyncStart, watch );
53
+
54
+ exports.browserSyncStart = browserSyncStart;
55
+ exports.browserSyncReload = browserSyncReload;
56
+ exports.sassCompile = sassCompile;
57
+ exports.watch = watch;
58
+ exports.server = server;
includes/abstracts/abstract-evf-admin-form-panel.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Abstract EVF_Admin_Form_Panel Class
8
+ *
9
+ * @version 1.0.0
10
+ * @author WPEverest
11
+ */
12
+ abstract class EVF_Admin_Form_Panel {
13
+
14
+ /**
15
+ * Full name of the panel.
16
+ *
17
+ * @var string
18
+ */
19
+ public $name;
20
+
21
+ /**
22
+ * Slug.
23
+ *
24
+ * @var string
25
+ */
26
+ public $slug;
27
+
28
+ /**
29
+ * Font Awesome Icon used for the editor button.
30
+ *
31
+ * @var mixed
32
+ */
33
+ public $icon = false;
34
+
35
+ /**
36
+ * Priority order the field button should show inside the "Add Fields" tab.
37
+ *
38
+ * @var integer
39
+ */
40
+ public $order = 50;
41
+
42
+ /**
43
+ * If panel contains a sidebar element or is full width.
44
+ *
45
+ * @var boolean
46
+ */
47
+ public $sidebar = false;
48
+
49
+ /**
50
+ * Contains form object if we have one.
51
+ *
52
+ * @var object
53
+ */
54
+ public $form;
55
+
56
+ /**
57
+ * Contains array of the form data (post_content).
58
+ *
59
+ * @var array
60
+ */
61
+ public $form_data;
62
+
63
+ /**
64
+ * Primary class constructor.
65
+ */
66
+ public $form_setting;
67
+
68
+ public function __construct() {
69
+ // Load form if found.
70
+ $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : false;
71
+ $this->form = EVF()->form->get( $form_id );
72
+ $this->form_data = $this->form ? evf_decode( $this->form->post_content ) : false;
73
+ $this->form_setting = isset( $this->form_data['settings'] ) ? $this->form_data['settings'] : array();
74
+ $this->init();
75
+
76
+ // Hooks.
77
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueues' ), 15 );
78
+ add_action( 'everest_forms_builder_panel_buttons', array( $this, 'button' ), $this->order, 2 );
79
+ add_action( 'everest_forms_builder_panels', array( $this, 'panel_output' ), $this->order, 2 );
80
+ }
81
+
82
+ /**
83
+ * Hook in tabs.
84
+ */
85
+ public function init() {}
86
+
87
+ /**
88
+ * Enqueue assets
89
+ */
90
+ public function enqueues() {}
91
+
92
+ /**
93
+ * Primary panel button in the left panel navigation.
94
+ *
95
+ * @param mixed $form
96
+ * @param string $view
97
+ */
98
+ public function button( $form, $view ) {
99
+ $active = $view == $this->slug ? 'active' : '';
100
+
101
+ printf( '<li class="evf-panel-%s-button" data-panel="%s">', $this->slug, $this->slug );
102
+ printf( '<a href="#" class="%s">', $active );
103
+ printf( '<span class="%s"></span>', $this->icon );
104
+ printf( '%s</a>', $this->name );
105
+ echo '</li>';
106
+ }
107
+
108
+ /**
109
+ * Outputs the contents of the panel.
110
+ *
111
+ * @param object $form
112
+ * @param string $view
113
+ */
114
+ public function panel_output( $form, $view ) {
115
+ $active = $view == $this->slug ? 'active' : '';
116
+
117
+ $wrap = $this->sidebar ? 'everest-forms-panel-sidebar-content' : 'everest-forms-panel-full-content';
118
+
119
+ printf( '<div class="everest-forms-panel %s" id="everest-forms-panel-%s">', $active, $this->slug );
120
+
121
+ printf( '<div class="%s">', $wrap );
122
+
123
+ if ( true == $this->sidebar ) {
124
+
125
+ echo '<div class="everest-forms-panel-sidebar">';
126
+
127
+ do_action( 'everest_forms_builder_before_panel_sidebar', $this->form, $this->slug );
128
+
129
+ $this->panel_sidebar();
130
+
131
+ do_action( 'everest_forms_builder_after_panel_sidebar', $this->form, $this->slug );
132
+
133
+ echo '</div>';
134
+ }
135
+
136
+ echo '<div class="everest-forms-panel-content-wrap">';
137
+ echo '<div class="everest-forms-panel-content">';
138
+
139
+ do_action( 'everest_forms_builder_before_panel_content', $this->form, $this->slug );
140
+
141
+ $this->panel_content();
142
+
143
+ do_action( 'everest_forms_builder_after_panel_content', $this->form, $this->slug );
144
+
145
+ echo '</div></div></div></div>';
146
+ }
147
+
148
+ /**
149
+ * Outputs the panel's sidebar if we have one.
150
+ */
151
+ public function panel_sidebar() {}
152
+
153
+ /**
154
+ * Outputs panel sidebar sections.
155
+ */
156
+ public function panel_sidebar_section( $name, $slug, $icon = '' ) {
157
+
158
+ $class = '';
159
+ $class .= $slug == 'default' ? ' default' : '';
160
+ $class .= ! empty( $icon ) ? ' icon' : '';
161
+
162
+ echo '<a href="#" class="evf-setting-panel everest-forms-panel-sidebar-section everest-forms-panel-sidebar-section-' . esc_attr( $slug ) . $class . '" data-section="' . esc_attr( $slug ) . '">';
163
+
164
+ if ( ! empty( $icon ) ) {
165
+ echo '<img src="' . esc_url( $icon ) . '">';
166
+ }
167
+
168
+ echo esc_html( $name );
169
+
170
+ echo '<i class="dashicons dashicons-arrow-right-alt2 everest-forms-toggle-arrow"></i>';
171
+
172
+ echo '</a>';
173
+ }
174
+
175
+ /**
176
+ * Outputs the panel's primary content.
177
+ *
178
+ * @since 1.0.0
179
+ */
180
+ public function panel_content() {
181
+ }
182
+ }
includes/abstracts/abstract-evf-form-fields.php ADDED
@@ -0,0 +1,821 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * Abstract EVF_Form_Fields Class
8
+ *
9
+ * @version 1.0.0
10
+ * @package EverestFroms/Abstracts
11
+ * @category Abstract Class
12
+ * @author WPEverest
13
+ */
14
+ abstract class EVF_Form_Fields {
15
+ /**
16
+ * Full name of the field type, eg "Paragraph Text".
17
+ *
18
+ * $since 1.0.0
19
+ * @var string
20
+ */
21
+ public $name;
22
+
23
+ /**
24
+ * Type of the field, eg "textarea".
25
+ *
26
+ * $since 1.0.0
27
+ * @var string
28
+ */
29
+ public $type;
30
+
31
+ /**
32
+ * Font Awesome Icon used for the editor button.
33
+ *
34
+ * $since 1.0.0
35
+ * @var mixed
36
+ */
37
+ public $icon = false;
38
+
39
+ /**
40
+ * Priority order the field button should show inside the "Add Fields" tab.
41
+ *
42
+ * $since 1.0.0
43
+ * @var integer
44
+ */
45
+ public $order = 20;
46
+
47
+ /**
48
+ * Field group the field belongs to.
49
+ *
50
+ * $since 1.0.0
51
+ * @var string
52
+ */
53
+ public $group = 'general';
54
+
55
+ /**
56
+ * Placeholder to hold default value(s) for some field types.
57
+ *
58
+ * $since 1.0.0
59
+ * @var mixed
60
+ */
61
+ public $defaults;
62
+
63
+ /**
64
+ * Current form ID in the admin builder.
65
+ *
66
+ * $since 1.0.0
67
+ * @var mixed, int or false
68
+ */
69
+ public $form_id;
70
+
71
+ /**
72
+ * Current form data in admin builder.
73
+ *
74
+ * $since 1.0.0
75
+ * @var mixed, int or false
76
+ */
77
+ public $form_data;
78
+
79
+ /**
80
+ * Primary class constructor.
81
+ *
82
+ * $since 1.0.0
83
+ *
84
+ * @param bool $init
85
+ */
86
+ public function __construct( $init = true ) {
87
+ if ( ! $init ) {
88
+ return;
89
+ }
90
+
91
+ // The form ID is to be accessed in the builder.
92
+ $this->form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : false;
93
+
94
+ // Bootstrap.
95
+ $this->init();
96
+
97
+ // Add fields tab.
98
+ add_filter( 'everest_forms_builder_fields_buttons', array( $this, 'field_button' ), 15 );
99
+
100
+ // Field options tab.
101
+ add_action( "everest_forms_builder_fields_options_{$this->type}", array( $this, 'field_options' ), 10 );
102
+
103
+ // Preview fields.
104
+ add_action( "everest_forms_builder_fields_previews_{$this->type}", array( $this, 'field_preview' ), 10 );
105
+
106
+ // AJAX Add new field.
107
+ add_action( "wp_ajax_everest_forms_new_field_{$this->type}", array( $this, 'field_new' ) );
108
+
109
+ // Display field input elements on front-end.
110
+ add_action( "evf_display_field_{$this->type}", array( $this, 'field_display' ), 10, 3 );
111
+
112
+ // Validation on submit.
113
+ add_action( "everest_forms_process_validate_{$this->type}", array( $this, 'validate' ), 10, 4 );
114
+
115
+ // Format.
116
+ add_action( "everest_forms_process_format_{$this->type}", array( $this, 'format' ), 10, 3 );
117
+ }
118
+
119
+ /**
120
+ * All systems go. Used by subclasses.
121
+ *
122
+ * $since 1.0.0
123
+ */
124
+ public function init() {
125
+ }
126
+
127
+ /**
128
+ * Create the button for the 'Add Fields' tab, inside the form editor.
129
+ *
130
+ * $since 1.0.0
131
+ *
132
+ * @param array $fields
133
+ *
134
+ * @return array
135
+ */
136
+ public function field_button( $fields ) {
137
+
138
+ // Add field information to fields array.
139
+ $fields[ $this->group ]['fields'][] = array(
140
+ 'order' => $this->order,
141
+ 'name' => $this->name,
142
+ 'type' => $this->type,
143
+ 'icon' => $this->icon,
144
+ );
145
+
146
+ // Wipe hands clean.
147
+ return $fields;
148
+ }
149
+
150
+ /**
151
+ * Creates the field options panel. Used by subclasses.
152
+ *
153
+ * $since 1.0.0
154
+ *
155
+ * @param array $field
156
+ */
157
+ public function field_options( $field ) {
158
+ }
159
+
160
+ /**
161
+ * Creates the field preview. Used by subclasses.
162
+ *
163
+ * $since 1.0.0
164
+ *
165
+ * @param array $field
166
+ */
167
+ public function field_preview( $field ) {
168
+ }
169
+
170
+ /**
171
+ * Helper function to create field option elements.
172
+ *
173
+ * Field option elements are pieces that help create a field option.
174
+ * They are used to quickly build field options.
175
+ *
176
+ * $since 1.0.0
177
+ *
178
+ * @param string $option
179
+ * @param array $field
180
+ * @param array $args
181
+ * @param boolean $echo
182
+ *
183
+ * @return mixed echo or return string
184
+ */
185
+ public function field_element( $option, $field, $args = array(), $echo = true ) {
186
+
187
+ $id = $field['id'];
188
+ $class = ! empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
189
+ $slug = ! empty( $args['slug'] ) ? sanitize_title( $args['slug'] ) : '';
190
+ $data = '';
191
+ $output = '';
192
+
193
+ if ( ! empty( $args['data'] ) ) {
194
+ foreach ( $args['data'] as $key => $val ) {
195
+ if ( is_array( $val ) ) {
196
+ $val = wp_json_encode( $val );
197
+ }
198
+ $data .= ' data-' . $key . '=\'' . $val . '\'';
199
+ }
200
+ }
201
+
202
+ switch ( $option ) {
203
+
204
+ // Row.
205
+ case 'row':
206
+ $output = sprintf( '<div class="everest-forms-field-option-row everest-forms-field-option-row-%s %s" id="everest-forms-field-option-row-%s-%s" data-field-id="%s">%s</div>', $slug, $class, $id, $slug, $id, $args['content'] );
207
+ break;
208
+
209
+ // Label.
210
+ case 'label':
211
+ $output = sprintf( '<label for="everest-forms-field-option-%s-%s">%s', $id, $slug, esc_html( $args['value'] ) );
212
+ if ( isset( $args['tooltip'] ) && ! empty( $args['tooltip'] ) ) {
213
+ $output .= ' ' . sprintf( '<i class="dashicons dashicons-editor-help everest-forms-help-tooltip" data-tip="%s"></i>', esc_attr( $args['tooltip'] ) );
214
+ }
215
+ if ( isset( $args['after_tooltip'] ) && ! empty( $args['after_tooltip'] ) ) {
216
+ $output .= $args['after_tooltip'];
217
+ }
218
+ $output .= '</label>';
219
+ break;
220
+
221
+ // Text input.
222
+ case 'text':
223
+ $type = ! empty( $args['type'] ) ? esc_attr( $args['type'] ) : 'text';
224
+ $placeholder = ! empty( $args['placeholder'] ) ? esc_attr( $args['placeholder'] ) : '';
225
+ $before = ! empty( $args['before'] ) ? '<span class="before-input">' . esc_html( $args['before'] ) . '</span>' : '';
226
+ if ( ! empty( $before ) ) {
227
+ $class .= ' has-before';
228
+ }
229
+ $output = sprintf( '%s<input type="%s" class="%s" id="everest-forms-field-option-%s-%s" name="form_fields[%s][%s]" value="%s" placeholder="%s" %s>', $before, $type, $class, $id, $slug, $id, $slug, esc_attr( $args['value'] ), $placeholder, $data );
230
+ break;
231
+
232
+ // Textarea.
233
+ case 'textarea':
234
+ $rows = ! empty( $args['rows'] ) ? (int) $args['rows'] : '3';
235
+ $output = sprintf( '<textarea class="%s" id="everest-forms-field-option-%s-%s" name="form_fields[%s][%s]" rows="%s" %s>%s</textarea>', $class, $id, $slug, $id, $slug, $rows, $data, $args['value'] );
236
+ break;
237
+
238
+ // Checkbox.
239
+ case 'checkbox':
240
+ $checked = checked( '1', $args['value'], false );
241
+ $output = sprintf( '<input type="checkbox" class="%s" id="everest-forms-field-option-%s-%s" name="form_fields[%s][%s]" value="1" %s %s>', $class, $id, $slug, $id, $slug, $checked, $data );
242
+ $output .= sprintf( '<label for="everest-forms-field-option-%s-%s" class="inline">%s', $id, $slug, $args['desc'] );
243
+ if ( isset( $args['tooltip'] ) && ! empty( $args['tooltip'] ) ) {
244
+ $output .= ' ' . sprintf( '<i class="dashicons dashicons-editor-help everest-forms-help-tooltip" data-tip="%s"></i>', esc_attr( $args['tooltip'] ) );
245
+ }
246
+ $output .= '</label>';
247
+ break;
248
+
249
+ // Toggle.
250
+ case 'toggle':
251
+ $checked = checked( '1', $args['value'], false );
252
+ $icon = $args['value'] ? 'fa-toggle-on' : 'fa-toggle-off';
253
+ $cls = $args['value'] ? 'everest-forms-on' : 'everest-forms-off';
254
+ $status = $args['value'] ? __( 'On', 'everest-forms' ) : __( 'Off', 'everest-forms' );
255
+ $output = sprintf( '<span class="everest-forms-toggle-icon %s"><i class="fa %s" aria-hidden="true"></i> <span class="everest-forms-toggle-icon-label">%s</span>', $cls, $icon, $status );
256
+ $output .= sprintf( '<input type="checkbox" class="%s" id="everest-forms-field-option-%s-%s" name="form_fields[%s][%s]" value="1" %s %s></span>', $class, $id, $slug, $id, $slug, $checked, $data );
257
+ break;
258
+
259
+ // Select.
260
+ case 'select':
261
+ $options = $args['options'];
262
+ $value = isset( $args['value'] ) ? $args['value'] : '';
263
+ $output = sprintf( '<select class="%s" id="everest-forms-field-option-%s-%s" name="form_fields[%s][%s]" %s>', $class, $id, $slug, $id, $slug, $data );
264
+ foreach ( $options as $key => $option ) {
265
+ $output .= sprintf( '<option value="%s" %s>%s</option>', esc_attr( $key ), selected( $key, $value, false ), $option );
266
+ }
267
+ $output .= '</select>';
268
+ break;
269
+ } // End switch().
270
+
271
+ if ( $echo ) {
272
+ echo $output; // WPCS: XSS ok.
273
+ } else {
274
+ return $output;
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Helper function to create common field options that are used frequently.
280
+ *
281
+ * $since 1.0.0
282
+ *
283
+ * @param string $option
284
+ * @param array $field
285
+ * @param array $args
286
+ * @param boolean $echo
287
+ *
288
+ * @return mixed echo or return string
289
+ */
290
+ public function field_option( $option, $field, $args = array(), $echo = true ) {
291
+
292
+ $output = '';
293
+
294
+ switch ( $option ) {
295
+
296
+ // --------------------------------------------------------------//
297
+ // Basic Fields.
298
+ // --------------------------------------------------------------//
299
+
300
+ // Basic Options markup. ------------------------------------------//
301
+
302
+ case 'basic-options':
303
+ $markup = ! empty( $args['markup'] ) ? $args['markup'] : 'open';
304
+ $class = ! empty( $args['class'] ) ? esc_html( $args['class'] ) : '';
305
+ if ( 'open' === $markup ) {
306
+ $output = sprintf( '<div class="everest-forms-field-option-group everest-forms-field-option-group-basic open" id="everest-forms-field-option-basic-%s">', $field['id'] );
307
+ $output .= sprintf( '<a href="#" class="everest-forms-field-option-group-toggle">%s<span>(ID #%s)</span> <i class="handlediv"></i></a>', $this->name, $field['id'] );
308
+ $output .= sprintf( '<div class="everest-forms-field-option-group-inner %s">', $class );
309
+ } else {
310
+ $output = '</div></div>';
311
+ }
312
+ break;
313
+
314
+ // Field Label. ---------------------------------------------------//
315
+
316
+ case 'label':
317
+ $value = ! empty( $field['label'] ) ? esc_attr( $field['label'] ) : '';
318
+ $tooltip = __( 'Enter text for the form field label.', 'everest-forms' );
319
+ $output = $this->field_element( 'label', $field, array(
320
+ 'slug' => 'label',
321
+ 'value' => __( 'Label', 'everest-forms' ),
322
+ 'tooltip' => $tooltip
323
+ ), false );
324
+ $output .= $this->field_element( 'text', $field, array(
325
+ 'slug' => 'label',
326
+ 'value' => $value
327
+ ), false );
328
+ $output = $this->field_element( 'row', $field, array(
329
+ 'slug' => 'label',
330
+ 'content' => $output
331
+ ), false );
332
+ break;
333
+
334
+ // Field Description. ---------------------------------------------//
335
+
336
+ case 'description':
337
+ $value = ! empty( $field['description'] ) ? esc_attr( $field['description'] ) : '';
338
+ $tooltip = __( 'Enter text for the form field description.', 'everest-forms' );
339
+ $output = $this->field_element( 'label', $field, array(
340
+ 'slug' => 'description',
341
+ 'value' => __( 'Description', 'everest-forms' ),
342
+ 'tooltip' => $tooltip
343
+ ), false );
344
+ $output .= $this->field_element( 'textarea', $field, array(
345
+ 'slug' => 'description',
346
+ 'value' => $value
347
+ ), false );
348
+ $output = $this->field_element( 'row', $field, array(
349
+ 'slug' => 'description',
350
+ 'content' => $output
351
+ ), false );
352
+ break;
353
+
354
+
355
+ case 'required':
356
+ $default = ! empty( $args['default'] ) ? $args['default'] : '0';
357
+ $value = isset( $field['required'] ) ? $field['required'] : $default;
358
+ $tooltip = __( 'Check this option to mark the field required.', 'everest-forms' );
359
+ $output = $this->field_element( 'checkbox', $field, array(
360
+ 'slug' => 'required',
361
+ 'value' => $value,
362
+ 'desc' => __( 'Required', 'everest-forms' ),
363
+ 'tooltip' => $tooltip
364
+ ), false );
365
+ $output = $this->field_element( 'row', $field, array(
366
+ 'slug' => 'required',
367
+ 'content' => $output
368
+ ), false );
369
+ break;
370
+
371
+ // EVF meta fields
372
+ case 'meta':
373
+ $output = sprintf( '<label>%s</label>', 'Type' );
374
+ $output .= sprintf( '<p class="meta">%s <span class="id">(ID #%s)</span></p>', $this->name, $field['id'] );
375
+ $output = $this->field_element( 'row', $field, array( 'slug' => 'meta', 'content' => $output ), false );
376
+ break;
377
+ case 'choices':
378
+ $tooltip = __( 'Add choices for the form field.', 'everest-forms' );
379
+ $toggle = '';
380
+ $dynamic = ! empty( $field['dynamic_choices'] ) ? esc_html( $field['dynamic_choices'] ) : '';
381
+ $values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
382
+ $class = ! empty( $field['show_values'] ) && $field['show_values'] == '1' ? 'show-values' : '';
383
+ $class .= ! empty( $dynamic ) ? ' evf-hidden' : '';
384
+
385
+ // Field option label and type.
386
+ $option_label = $this->field_element(
387
+ 'label',
388
+ $field,
389
+ array(
390
+ 'slug' => 'choices',
391
+ 'value' => __( 'Choices', 'everest-forms' ),
392
+ 'tooltip' => $tooltip,
393
+ 'after_tooltip' => $toggle,
394
+ ),
395
+ false
396
+ );
397
+ $option_type = 'checkbox' === $this->type ? 'checkbox' : 'radio';
398
+
399
+ // Field option choices inputs
400
+ $option_choices = sprintf( '<ul data-next-id="%s" class="evf-choices-list %s" data-field-id="%s" data-field-type="%s">', max( array_keys( $values ) ) + 1, $class, $field['id'], $this->type );
401
+ foreach ( $values as $key => $value ) {
402
+ $default = ! empty( $value['default'] ) ? $value['default'] : '';
403
+ $option_choices .= sprintf( '<li data-key="%d">', $key );
404
+ $option_choices .= sprintf( '<input type="%s" name="form_fields[%s][choices][%s][default]" class="default" value="1" %s>', $option_type, $field['id'], $key, checked( '1', $default, false ) );
405
+ $option_choices .= sprintf( '<input type="text" name="form_fields[%s][choices][%s][label]" value="%s" class="label">', $field['id'], $key, esc_attr( $value['label'] ) );
406
+ $option_choices .= sprintf( '<input type="text" name="form_fields[%s][choices][%s][value]" value="%s" class="value">', $field['id'], $key, esc_attr( $value['value'] ) );
407
+ $option_choices .= '<a class="remove" href="#"><i class="dashicons dashicons-dismiss"></i></a>';
408
+ $option_choices .= '<a class="add" href="#"><i class="dashicons dashicons-plus-alt"></i></a>';
409
+
410
+ $option_choices .= '</li>';
411
+ }
412
+ $option_choices .= '</ul>';
413
+ // Field option row (markup) including label and input.
414
+ $output = $this->field_element(
415
+ 'row',
416
+ $field,
417
+ array(
418
+ 'slug' => 'choices',
419
+ 'content' => $option_label . $option_choices,
420
+ )
421
+ );
422
+ break;
423
+
424
+ // ---------------------------------------------------------------//
425
+ // Advanced Fields.
426
+ // ---------------------------------------------------------------//
427
+
428
+ // Default value. -------------------------------------------------//
429
+
430
+ case 'default_value':
431
+ $value = ! empty( $field['default_value'] ) ? esc_attr( $field['default_value'] ) : '';
432
+ $tooltip = __( 'Enter text for the default form field value.', 'everest-forms' );
433
+ $toggle = '';
434
+ $output = $this->field_element( 'label', $field, array(
435
+ 'slug' => 'default_value',
436
+ 'value' => __( 'Default Value', 'everest-forms' ),
437
+ 'tooltip' => $tooltip,
438
+ 'after_tooltip' => $toggle
439
+ ), false );
440
+ $output .= $this->field_element( 'text', $field, array(
441
+ 'slug' => 'default_value',
442
+ 'value' => $value
443
+ ), false );
444
+ $output = $this->field_element( 'row', $field, array(
445
+ 'slug' => 'default_value',
446
+ 'content' => $output
447
+ ), false );
448
+ break;
449
+
450
+ // Advanced Options markup. ---------------------------------------//
451
+
452
+ case 'advanced-options':
453
+ $markup = ! empty( $args['markup'] ) ? $args['markup'] : 'open';
454
+ if ( 'open' === $markup ) {
455
+ $override = apply_filters( 'everest_forms_advanced_options_override', false );
456
+ $override = ! empty( $override ) ? 'style="display:' . $override . ';"' : '';
457
+ $output = sprintf( '<div class="everest-forms-field-option-group everest-forms-field-option-group-advanced everest-forms-hide closed" id="everest-forms-field-option-advanced-%s" %s>', $field['id'], $override );
458
+ $output .= sprintf( '<a href="#" class="everest-forms-field-option-group-toggle">%s<i class="handlediv"></i></a>', __( 'Advanced Options', 'everest-forms' ) );
459
+ $output .= '<div class="everest-forms-field-option-group-inner">';
460
+ } else {
461
+ $output = '</div></div>';
462
+ }
463
+ break;
464
+
465
+ // Placeholder. ---------------------------------------------------//
466
+
467
+ case 'placeholder':
468
+ $value = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
469
+ $tooltip = __( 'Enter text for the form field placeholder.', 'everest-forms' );
470
+ $output = $this->field_element( 'label', $field, array(
471
+ 'slug' => 'placeholder',
472
+ 'value' => __( 'Placeholder Text', 'everest-forms' ),
473
+ 'tooltip' => $tooltip
474
+ ), false );
475
+ $output .= $this->field_element( 'text', $field, array(
476
+ 'slug' => 'placeholder',
477
+ 'value' => $value
478
+ ), false );
479
+ $output = $this->field_element( 'row', $field, array(
480
+ 'slug' => 'placeholder',
481
+ 'content' => $output
482
+ ), false );
483
+ break;
484
+
485
+ // CSS classes. ---------------------------------------------------//
486
+
487
+ case 'css':
488
+ $toggle = '';
489
+ $tooltip = __( 'Enter CSS class for this field container. Class names should be separated with spaces.', 'everest-forms' );
490
+ $value = ! empty( $field['css'] ) ? esc_attr( $field['css'] ) : '';
491
+ // Build output
492
+ $output = $this->field_element( 'label', $field, array(
493
+ 'slug' => 'css',
494
+ 'value' => __( 'CSS Classes', 'everest-forms' ),
495
+ 'tooltip' => $tooltip,
496
+ 'after_tooltip' => $toggle
497
+ ), false );
498
+ $output .= $this->field_element( 'text', $field, array( 'slug' => 'css', 'value' => $value ), false );
499
+ $output = $this->field_element( 'row', $field, array( 'slug' => 'css', 'content' => $output ), false );
500
+ break;
501
+
502
+ // Hide Label. ----------------------------------------------------//
503
+
504
+ case 'label_hide':
505
+ $value = isset( $field['label_hide'] ) ? $field['label_hide'] : '0';
506
+ $tooltip = __( 'Check this option to hide the form field label.', 'everest-forms' );
507
+ // Build output
508
+ $output = $this->field_element( 'checkbox', $field, array(
509
+ 'slug' => 'label_hide',
510
+ 'value' => $value,
511
+ 'desc' => __( 'Hide Label', 'everest-forms' ),
512
+ 'tooltip' => $tooltip
513
+ ), false );
514
+ $output = $this->field_element( 'row', $field, array(
515
+ 'slug' => 'label_hide',
516
+ 'content' => $output
517
+ ), false );
518
+ break;
519
+
520
+ // Hide Sub-Labels. -----------------------------------------------//
521
+
522
+ case 'sublabel_hide':
523
+ $value = isset( $field['sublabel_hide'] ) ? $field['sublabel_hide'] : '0';
524
+ $tooltip = __( 'Check this option to hide the form field sub-label.', 'everest-forms' );
525
+ // Build output
526
+ $output = $this->field_element( 'checkbox', $field, array(
527
+ 'slug' => 'sublabel_hide',
528
+ 'value' => $value,
529
+ 'desc' => __( 'Hide Sub-Labels', 'everest-forms' ),
530
+ 'tooltip' => $tooltip
531
+ ), false );
532
+ $output = $this->field_element( 'row', $field, array(
533
+ 'slug' => 'sublabel_hide',
534
+ 'content' => $output
535
+ ), false );
536
+ break;
537
+
538
+ } // End switch().
539
+
540
+ if ( $echo ) {
541
+
542
+ if ( in_array( $option, array( 'basic-options', 'advanced-options' ), true ) ) {
543
+
544
+ if ( 'open' === $markup ) {
545
+ do_action( "everest_forms_field_options_before_{$option}", $field, $this );
546
+ }
547
+
548
+ echo $output; // WPCS: XSS ok.
549
+
550
+ if ( 'close' === $markup ) {
551
+ do_action( "everest_forms_field_options_after_{$option}", $field, $this );
552
+ }
553
+ } else {
554
+ echo $output; // WPCS: XSS ok.
555
+ }
556
+ } else {
557
+ return $output;
558
+ }
559
+ }
560
+
561
+ /**
562
+ * Helper function to create common field options that are used frequently
563
+ * in the field preview.
564
+ *
565
+ * $since 1.0.0
566
+ *
567
+ * @param string $option
568
+ * @param array $field
569
+ * @param array $args
570
+ * @param boolean $echo
571
+ *
572
+ * @return mixed echo or return string
573
+ */
574
+ public function field_preview_option( $option, $field, $args = array(), $echo = true ) {
575
+
576
+ $required_string = isset( $field['required'] ) && $field['required'] ? '<span class="required">*</span>' : '';
577
+ $hide_style = isset( $field['label_hide'] ) && $field['label_hide'] ? 'display:none' : '';
578
+ switch ( $option ) {
579
+
580
+ case 'label':
581
+ $label = isset( $field['label'] ) && ! empty( $field['label'] ) ? esc_html( $field['label'] ) : '';
582
+ $output = sprintf( '<label style="%s" class="label-title"><span class="text">%s</span>%s</label>', $hide_style, $label, $required_string );
583
+ break;
584
+
585
+ case 'description':
586
+ $description = isset( $field['description'] ) && ! empty( $field['description'] ) ? $field['description'] : '';
587
+ $output = sprintf( '<div class="description">%s</div>', $description );
588
+ break;
589
+ }
590
+
591
+ if ( $echo ) {
592
+ echo $output; // WPCS: XSS ok.
593
+ } else {
594
+ return $output;
595
+ }
596
+ }
597
+
598
+ /**
599
+ * Create a new field in the admin AJAX editor.
600
+ *
601
+ * $since 1.0.0
602
+ */
603
+ public function field_new() {
604
+
605
+ // Run a security check.
606
+ check_ajax_referer( 'everest_forms_field_drop', 'security' );
607
+
608
+ // Check for permissions.
609
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
610
+ die( esc_html__( 'You do no have permission.', 'everest-forms' ) );
611
+ }
612
+
613
+
614
+ // Check for form ID.
615
+ if ( ! isset( $_POST['form_id'] ) || empty( $_POST['form_id'] ) ) {
616
+ die( esc_html__( 'No form ID found', 'everest-forms' ) );
617
+ }
618
+
619
+ // Check for field type to add.
620
+ if ( ! isset( $_POST['field_type'] ) || empty( $_POST['field_type'] ) ) {
621
+ die( esc_html__( 'No field type found', 'everest-forms' ) );
622
+ }
623
+
624
+ $field_args = ! empty( $_POST['defaults'] ) ? (array) $_POST['defaults'] : array();
625
+
626
+ $field_type = esc_attr( $_POST['field_type'] );
627
+ $field_id = EVF()->form->field_unique_key( $_POST['form_id'] );
628
+ $field = array(
629
+ 'id' => $field_id,
630
+ 'type' => $field_type,
631
+ 'label' => $this->name,
632
+ 'description' => '',
633
+ );
634
+
635
+ $field = wp_parse_args( $field_args, $field );
636
+ $field = apply_filters( 'everest_forms_field_new_default', $field );
637
+ $field_required = apply_filters( 'everest_forms_field_new_required', '', $field );
638
+ $field_class = apply_filters( 'everest_forms_field_new_class', '', $field );
639
+
640
+ // Field types that default to required.
641
+ if ( ! empty( $field_required ) ) {
642
+ $field_required = 'required';
643
+ $field['required'] = '1';
644
+ }
645
+
646
+ // Build Preview.
647
+ ob_start();
648
+
649
+ $this->field_preview( $field );
650
+ $prev = ob_get_clean();
651
+ $preview = sprintf( '<div class="everest-forms-field everest-forms-field-%s %s %s" id="everest-forms-field-%s" data-field-id="%s" data-field-type="%s">', $field_type, $field_required, $field_class, $field['id'], $field['id'], $field_type );
652
+ $preview .= sprintf( '<div class="evf-field-action">' );
653
+ $preview .= sprintf( '<a href="#" class="everest-forms-field-duplicate" title="%s"><span class="dashicons dashicons-media-default"></span></a>', __( 'Duplicate Field', 'everest-forms' ) );
654
+ $preview .= sprintf( '<a href="#" class="everest-forms-field-delete" title="%s"><span class="dashicons dashicons-trash"></span></a>', __( 'Delete Field', 'everest-forms' ) );
655
+ $preview .= sprintf( '<a href="#" class="everest-forms-field-setting" title="%s"><span class="dashicons dashicons-admin-generic"></span></a>', __( 'Settings', 'everest-forms' ) );
656
+ $preview .= sprintf( '</div>' );
657
+ $preview .= $prev;
658
+ $preview .= '</div>';
659
+
660
+ // Build Options.
661
+ $options = sprintf( '<div class="everest-forms-field-option everest-forms-field-option-%s" id="everest-forms-field-option-%s" data-field-id="%s">', esc_attr( $field['type'] ), $field['id'], $field['id'] );
662
+ $options .= sprintf( '<input type="hidden" name="form_fields[%s][id]" value="%s" class="everest-forms-field-option-hidden-id">', $field['id'], $field['id'] );
663
+ $options .= sprintf( '<input type="hidden" name="form_fields[%s][type]" value="%s" class="everest-forms-field-option-hidden-type">', $field['id'], esc_attr( $field['type'] ) );
664
+ ob_start();
665
+ $this->field_options( $field );
666
+ $options .= ob_get_clean();
667
+ $options .= '</div>';
668
+
669
+ $form_field_array = explode( '-', $field_id );
670
+ $field_id_int = absint( $form_field_array[ count( $form_field_array ) - 1 ] );
671
+
672
+ // Prepare to return compiled results.
673
+ wp_send_json_success(
674
+ array(
675
+ 'form_id' => $_POST['form_id'],
676
+ 'field' => $field,
677
+ 'preview' => $preview,
678
+ 'options' => $options,
679
+ 'form_field_id' => ( $field_id_int + 1 )
680
+ )
681
+ );
682
+ }
683
+
684
+ /**
685
+ * Display the field input elements on the frontend.
686
+ *
687
+ * $since 1.0.0
688
+ *
689
+ * @param array $field
690
+ * @param array $field_atts
691
+ * @param array $form_data
692
+ */
693
+ public function field_display( $field, $field_atts, $form_data ) {
694
+ }
695
+
696
+ /**
697
+ * Display field input errors if present.
698
+ *
699
+ * $since 1.0.0
700
+ *
701
+ * @param string $key
702
+ * @param array $field
703
+ */
704
+ public function field_display_error( $key, $field ) {
705
+
706
+ // Need an error.
707
+ if ( empty( $field['properties']['error']['value'][ $key ] ) ) {
708
+ return;
709
+ }
710
+
711
+ printf(
712
+ '<label class="everest-forms-error" for="%s">%s</label>',
713
+ esc_attr( $field['properties']['inputs'][ $key ]['id'] ),
714
+ esc_html( $field['properties']['error']['value'][ $key ] )
715
+ );
716
+ }
717
+
718
+ /**
719
+ * Display field input sublabel if present.
720
+ *
721
+ * $since 1.0.0
722
+ *
723
+ * @param string $key
724
+ * @param string $position
725
+ * @param array $field
726
+ */
727
+ public function field_display_sublabel( $key, $position, $field ) {
728
+
729
+ // Need a sublabel value.
730
+ if ( empty( $field['properties']['inputs'][ $key ]['sublabel']['value'] ) ) {
731
+ return;
732
+ }
733
+
734
+ $pos = ! empty( $field['properties']['inputs'][ $key ]['sublabel']['position'] ) ? $field['properties']['inputs'][ $key ]['sublabel']['position'] : 'after';
735
+ $hidden = ! empty( $field['properties']['inputs'][ $key ]['sublabel']['hidden'] ) ? 'everest-forms-sublabel-hide' : '';
736
+
737
+ if ( $pos !== $position ) {
738
+ return;
739
+ }
740
+
741
+ printf(
742
+ '<label for="%s" class="everest-forms-field-sublabel %s %s">%s</label>',
743
+ esc_attr( $field['properties']['inputs'][ $key ]['id'] ),
744
+ sanitize_html_class( $pos ),
745
+ $hidden,
746
+ $field['properties']['inputs'][ $key ]['sublabel']['value']
747
+ );
748
+ }
749
+
750
+ /**
751
+ * Validates field on form submit.
752
+ *
753
+ * $since 1.0.0
754
+ *
755
+ * @param int $field_id
756
+ * @param array $field_submit
757
+ * @param array $form_data
758
+ */
759
+ public function validate( $field_id, $field_type, $field_submit, $form_data ) {
760
+ $required_field = isset( $form_data['form_fields'][ $field_id ]['required'] ) ? $form_data['form_fields'][ $field_id ]['required'] : false;
761
+
762
+ // Basic required check - If field is marked as required, check for entry data.
763
+ if ( false !== $required_field && ( empty( $field_submit ) && '0' !== $field_submit ) ) {
764
+ EVF()->process->errors[ $form_data['id'] ][ $field_id ] = apply_filters( 'everest_forms_required_label', get_option( 'evf_required_validation', __( 'This field is required.', 'everest-forms' ) ) );
765
+ update_option( 'evf_validation_error', 'yes');
766
+ }
767
+
768
+ // Type validations.
769
+ switch ( $field_type ) {
770
+ case 'url':
771
+ if( filter_var( $field_submit, FILTER_VALIDATE_URL ) === FALSE ){
772
+ $validation_text = get_option( 'evf_' . $field_type . '_validation', __( 'Please enter a valid url', 'everest-forms' ) );
773
+ }
774
+ break;
775
+ case 'email':
776
+ if ( ! is_email( $field_submit ) ) {
777
+ $validation_text = get_option( 'evf_' . $field_type . '_validation', __( 'Please enter a valid email address', 'everest-forms' ) );
778
+ }
779
+ break;
780
+ case 'number':
781
+ if ( is_numeric( $field_submit ) ){
782
+ $validation_text = get_option( 'evf_' . $field_type . '_validation', __( 'Please enter a valid number', 'everest-forms' ) );
783
+ }
784
+ break;
785
+ }
786
+
787
+ if( isset( $validation_text ) ){
788
+ EVF()->process->errors[ $form_data['id'] ][ $field_id ] = apply_filters( 'everest_forms_type_validation', $validation_text );
789
+ update_option( 'evf_validation_error', 'yes');
790
+ }
791
+ }
792
+
793
+ /**
794
+ * Formats and sanitizes field.
795
+ *
796
+ * $since 1.0.0
797
+ *
798
+ * @param int $field_id
799
+ * @param array $field_submit
800
+ * @param array $form_data
801
+ */
802
+ public function format( $field_id, $field_submit, $form_data ) {
803
+
804
+ if ( is_array( $field_submit ) ) {
805
+ $field_submit = array_filter( $field_submit );
806
+ $field_submit = implode( "\r\n", $field_submit );
807
+ }
808
+
809
+ $name = ! empty( $form_data['fields'][ $field_id ]['label'] ) ? sanitize_text_field( $form_data['fields'][ $field_id ]['label'] ) : '';
810
+
811
+ // Sanitize but keep line breaks.
812
+ $value = everest_forms_sanitize_textarea_field( $field_submit );
813
+
814
+ EVF()->process->fields[ $field_id ] = array(
815
+ 'name' => $name,
816
+ 'value' => $value,
817
+ 'id' => absint( $field_id ),
818
+ 'type' => $this->type,
819
+ );
820
+ }
821
+ }
includes/abstracts/abstract-evf-log-handler.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * Abstract EVF Log Handler Class
8
+ *
9
+ * @version 1.0.0
10
+ * @package EverestFroms/Abstracts
11
+ * @category Abstract Class
12
+ * @author WPEverest
13
+ */
14
+ abstract class EVF_Log_Handler implements EVF_Log_Handler_Interface {
15
+
16
+ /**
17
+ * Formats a timestamp for use in log messages.
18
+ *
19
+ * @param int $timestamp Log timestamp.
20
+ *
21
+ * @return string Formatted time for use in log entry.
22
+ */
23
+ protected static function format_time( $timestamp ) {
24
+ return date( 'c', $timestamp );
25
+ }
26
+
27
+ /**
28
+ * Builds a log entry text from level, timestamp and message.
29
+ *
30
+ * @param int $timestamp Log timestamp.
31
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
32
+ * @param string $message Log message.
33
+ * @param array $context Additional information for log handlers.
34
+ *
35
+ * @return string Formatted log entry.
36
+ */
37
+ protected static function format_entry( $timestamp, $level, $message, $context ) {
38
+ $time_string = self::format_time( $timestamp );
39
+ $level_string = strtoupper( $level );
40
+ $entry = "{$time_string} {$level_string} {$message}";
41
+
42
+ return apply_filters( 'everest_forms_format_log_entry', $entry, array(
43
+ 'timestamp' => $timestamp,
44
+ 'level' => $level,
45
+ 'message' => $message,
46
+ 'context' => $context,
47
+ ) );
48
+ }
49
+ }
includes/abstracts/abstract-evf-session.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // @codingStandardsIgnoreLine.
2
+ /**
3
+ * Handle data for the current customers session
4
+ *
5
+ * @version 1.0.0
6
+ * @package EverestForms\Abstracts
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * EVF_Session
15
+ */
16
+ abstract class EVF_Session {
17
+
18
+ /**
19
+ * Customer ID.
20
+ *
21
+ * @var int $_customer_id Customer ID.
22
+ */
23
+ protected $_customer_id;
24
+
25
+ /**
26
+ * Session Data.
27
+ *
28
+ * @var array $_data Data array.
29
+ */
30
+ protected $_data = array();
31
+
32
+ /**
33
+ * Dirty when the session needs saving.
34
+ *
35
+ * @var bool $_dirty When something changes
36
+ */
37
+ protected $_dirty = false;
38
+
39
+ /**
40
+ * Init hooks and session data. Extended by child classes.
41
+ */
42
+ public function init() {}
43
+
44
+ /**
45
+ * Cleanup session data. Extended by child classes.
46
+ */
47
+ public function cleanup_sessions() {}
48
+
49
+ /**
50
+ * Magic get method.
51
+ *
52
+ * @param mixed $key Key to get.
53
+ * @return mixed
54
+ */
55
+ public function __get( $key ) {
56
+ return $this->get( $key );
57
+ }
58
+
59
+ /**
60
+ * Magic set method.
61
+ *
62
+ * @param mixed $key Key to set.
63
+ * @param mixed $value Value to set.
64
+ */
65
+ public function __set( $key, $value ) {
66
+ $this->set( $key, $value );
67
+ }
68
+
69
+ /**
70
+ * Magic isset method.
71
+ *
72
+ * @param mixed $key Key to check.
73
+ * @return bool
74
+ */
75
+ public function __isset( $key ) {
76
+ return isset( $this->_data[ sanitize_title( $key ) ] );
77
+ }
78
+
79
+ /**
80
+ * Magic unset method.
81
+ *
82
+ * @param mixed $key Key to unset.
83
+ */
84
+ public function __unset( $key ) {
85
+ if ( isset( $this->_data[ $key ] ) ) {
86
+ unset( $this->_data[ $key ] );
87
+ $this->_dirty = true;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Get a session variable.
93
+ *
94
+ * @param string $key Key to get.
95
+ * @param mixed $default used if the session variable isn't set.
96
+ * @return array|string value of session variable
97
+ */
98
+ public function get( $key, $default = null ) {
99
+ $key = sanitize_key( $key );
100
+ return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
101
+ }
102
+
103
+ /**
104
+ * Set a session variable.
105
+ *
106
+ * @param string $key Key to set.
107
+ * @param mixed $value Value to set.
108
+ */
109
+ public function set( $key, $value ) {
110
+ if ( $value !== $this->get( $key ) ) {
111
+ $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
112
+ $this->_dirty = true;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Get customer ID.
118
+ *
119
+ * @return int
120
+ */
121
+ public function get_customer_id() {
122
+ return $this->_customer_id;
123
+ }
124
+ }
includes/admin/class-evf-add-form.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Functionality related to the admin TinyMCE editor.
5
+ *
6
+ * @class EVF_Add_Form
7
+ * @version 1.0.0
8
+ * @package EverestForms/Admin
9
+ * @category Admin
10
+ * @author WPEverest
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ if ( ! class_exists( 'EVF_Add_Form', false ) ) :
18
+
19
+ class EVF_Add_Form {
20
+
21
+ /**
22
+ * Primary class constructor.
23
+ */
24
+
25
+ public function __construct() {
26
+
27
+ add_action( 'media_buttons', array( $this, 'media_button' ), 15 );
28
+ }
29
+
30
+ /**
31
+ * Allow easy shortcode insertion via a custom media button.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param string $editor_id
36
+ */
37
+ function media_button( $editor_id ) {
38
+
39
+ if ( ! apply_filters( 'evf_display_media_button', is_admin(), $editor_id ) ) {
40
+ return;
41
+ }
42
+
43
+ // Setup the icon - cevfrently using a dashicon
44
+
45
+ $icon = '<span class="dashicons dashicons-list-view" style="line-height:25px; font-size:16px"></span>';
46
+ $login_icon = '<span class="dashicons dashicons-migrate" style="line-height:25px; font-size:16px"></span>';
47
+
48
+ printf( '<a href="#" class="button evf-insert-form-button" data-editor="%s" title="%s">%s %s</a>',
49
+ esc_attr( $editor_id ),
50
+ esc_attr__( 'Add Everest Form', 'everest-forms' ),
51
+ $icon,
52
+ __( 'Add Form', 'everest-forms' )
53
+ );
54
+
55
+ add_action( 'admin_footer', array( $this, 'shortcode_modal' ) );
56
+ }
57
+
58
+ function shortcode_modal() {
59
+
60
+ ?>
61
+ <div id="evf-modal-backdrop" style="display: none"></div>
62
+ <div id="evf-modal-wrap" style="display: none">
63
+ <form id="evf-modal" tabindex="-1">
64
+ <div id="evf-modal-title">
65
+ <?php _e( 'Insert Form', 'everest-forms' ); ?>
66
+ <button type="button" id="evf-modal-close"><span class="screen-reader-text"><?php _e( 'Close', 'everest-forms' ); ?></span></button>
67
+ </div>
68
+ <div id="evf-modal-inner">
69
+ <div id="evf-modal-options">
70
+ <?php
71
+ $forms = evf_get_all_forms();
72
+
73
+ if ( !empty( $forms ) ) {
74
+ printf( '<p><label for="evf-modal-select-form">%s</label></p>', __( 'Select a form below to insert', 'everest-forms' ) );
75
+ echo '<select id="evf-modal-select-form">';
76
+ foreach ( $forms as $form => $form_value) {
77
+ printf( '<option value="%d">%s</option>', $form, esc_html( $form_value ) );
78
+ }
79
+ echo '</select>';
80
+
81
+ } else {
82
+ echo '<p>';
83
+ __(printf( 'Whoops, you haven\'t created a form yet.'),'everest-forms');
84
+ echo '</p>';
85
+ }
86
+ ?>
87
+ </div>
88
+ </div>
89
+ <div class="submitbox">
90
+ <div id="evf-modal-cancel">
91
+ <a class="submitdelete deletion" href="#"><?php _e( 'Cancel', 'everest-forms' ); ?></a>
92
+ </div>
93
+ <?php if ( ! empty( $forms ) ) : ?>
94
+ <div id="evf-modal-update">
95
+ <button class="button button-primary" id="evf-modal-submit"><?php _e( 'Add Form', 'everest-forms' ); ?></button>
96
+ </div>
97
+ <?php endif; ?>
98
+ </div>
99
+ </form>
100
+ </div>
101
+
102
+ <?php
103
+ }
104
+ }
105
+
106
+ endif;
107
+
108
+ return new EVF_Add_Form();
includes/admin/class-evf-admin-assets.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Load assets
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.00
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Admin_Assets', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Assets Class.
19
+ */
20
+ class EVF_Admin_Assets {
21
+
22
+ /**
23
+ * Hook in tabs.
24
+ */
25
+ public function __construct() {
26
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
27
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
28
+ add_action( 'everest_forms_builder_scripts', array( $this, 'everest_forms_builder_scripts' ) );
29
+ }
30
+
31
+ /**
32
+ * Enqueue assets for the builder.
33
+ *
34
+ * @since 1.0.0
35
+ */
36
+ public function everest_forms_builder_scripts() {
37
+
38
+ // Remove conflicting scripts
39
+
40
+ do_action( 'everest_forms_builder_enqueues_before' );
41
+
42
+ wp_enqueue_style( 'everest_forms_admin_menu_styles', EVF()->plugin_url() . '/assets/css/everest-builder.css', array(), EVF_VERSION );
43
+ wp_enqueue_style( 'jquery-confirm-style', EVF()->plugin_url() . '/assets/js/jquery-confirm/jquery-confirm.min.css', array(), '3.3.0' );
44
+
45
+ wp_enqueue_script(
46
+ 'evf-admin-helper',
47
+ EVF()->plugin_url() . '/assets/js/admin/admin-helper.js',
48
+ array(
49
+
50
+ 'jquery',
51
+ 'jquery-blockui',
52
+ 'jquery-tiptip',
53
+ 'jquery-ui-sortable',
54
+ 'jquery-ui-widget',
55
+ 'jquery-ui-core',
56
+ 'jquery-ui-tabs',
57
+ 'jquery-ui-draggable',
58
+ 'jquery-ui-droppable',
59
+ 'jquery-tiptip',
60
+
61
+ ),
62
+ EVF_VERSION
63
+ );
64
+
65
+ wp_enqueue_script(
66
+ 'evf-panel-builder',
67
+ EVF()->plugin_url() . '/assets/js/admin/everest-panel-builder.js',
68
+ array( 'evf-admin-helper', 'jquery-confirm-script' ),
69
+ EVF_VERSION
70
+ );
71
+
72
+ // JS
73
+
74
+ wp_enqueue_media();
75
+
76
+
77
+ $strings = array(
78
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
79
+ 'evf_field_drop_nonce' => wp_create_nonce( 'everest_forms_field_drop' ),
80
+ 'evf_save_form' => wp_create_nonce( 'everest_forms_save_form' ),
81
+ 'evf_get_next_id' => wp_create_nonce( 'everest_forms_get_next_id' ),
82
+ 'form_id' => isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0,
83
+ 'are_you_sure_want_to_delete_this' => __( 'Are you sure want to delete this', 'everest-forms' ),
84
+ 'field' => __( 'field', 'everest-forms' ),
85
+ 'confirm' => __( 'Confirm', 'everest-forms' ),
86
+ 'cancel' => __( 'Cancel', 'everest-forms' ),
87
+ 'delete_confirm_title' => __( 'Delete Confirmation', 'everest-forms' ),
88
+ 'duplicate_confirm_title' => __( 'Duplicate Confirmation', 'everest-forms' ),
89
+ 'are_you_sure_want_to_duplicate_this' => __( 'Are you sure want to duplicate this', 'everest-forms' ),
90
+ 'are_you_sure_want_to_delete_row' => __( 'Are you sure want to delete this row?', 'everest-forms' ),
91
+ 'copy_of' => __( 'Copy of ', 'everest-forms' ),
92
+ 'ok' => __( 'Ok', 'everest-forms' ),
93
+ 'could_not_delete_single_row_title' => __( 'Could not delete', 'everest-forms' ),
94
+ 'could_not_delete_single_row_content' => __( 'Could not delete single row.', 'everest-forms' ),
95
+ 'could_not_delete_single_choice' => __( 'Could not delete single choice.', 'everest-forms' ),
96
+ 'could_not_delete_single_choice_content' => __( 'Could not delete single choice.', 'everest-forms' ),
97
+ 'tab' => isset( $_GET['tab'] ) ? $_GET['tab'] : ''
98
+
99
+
100
+ );
101
+ $strings = apply_filters( 'everest_forms_builder_strings', $strings );
102
+
103
+
104
+ wp_localize_script(
105
+ 'evf-panel-builder',
106
+ 'evf_data',
107
+ $strings
108
+ );
109
+
110
+ // Hook
111
+
112
+ }
113
+
114
+ /**
115
+ * Enqueue styles.
116
+ */
117
+ public function admin_styles() {
118
+ global $wp_scripts;
119
+
120
+ $screen = get_current_screen();
121
+ $screen_id = $screen ? $screen->id : '';
122
+
123
+
124
+ $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.11.4';
125
+
126
+ // Register admin styles
127
+ wp_register_style( 'everest_forms_admin_menu_styles', EVF()->plugin_url() . '/assets/css/menu.css', array(), EVF_VERSION );
128
+
129
+ wp_register_style ( 'evf_add_form_css', EVF()->plugin_url() . '/assets/css/evf-add-form.css', array(), EVF_VERSION );
130
+ wp_enqueue_style('evf_add_form_css');
131
+
132
+ // JQuery confirm registration
133
+ // Add RTL support for admin styles
134
+ wp_style_add_data( 'everest_forms_admin_menu_styles', 'rtl', 'replace' );
135
+
136
+ // Sitewide menu CSS
137
+
138
+ wp_register_style( 'evf-admin-setting-style', EVF()->plugin_url() . '/assets/css/admin-settings.css', array(), EVF_VERSION );
139
+
140
+ if ( $screen_id === 'everest-forms_page_evf-settings' ) {
141
+ wp_enqueue_style( 'evf-admin-setting-style' );
142
+ }
143
+
144
+ }
145
+
146
+
147
+ /**
148
+ * Enqueue scripts.
149
+ */
150
+ public function admin_scripts() {
151
+ global $wp_query, $post;
152
+
153
+ $screen = get_current_screen();
154
+ $screen_id = $screen ? $screen->id : '';
155
+ $evf_screen_id = sanitize_title( __( 'EverestForms', 'everest-forms' ) );
156
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
157
+
158
+ // Register scripts
159
+ wp_register_script( 'everest_forms_builder', EVF()->plugin_url() . '/assets/js/admin/everest-builder' . $suffix . '.js', array(
160
+ 'jquery',
161
+ ), EVF_VERSION );
162
+
163
+ wp_register_script( 'everest_forms_settings', EVF()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array(
164
+ 'jquery',
165
+ ), EVF_VERSION );
166
+
167
+
168
+ wp_register_script( 'jquery-confirm-script', EVF()->plugin_url() . '/assets/js/jquery-confirm/jquery-confirm.min.js', array(
169
+ 'jquery',
170
+ ), '3.3.0' );
171
+ wp_register_script( 'everest_forms_admin', EVF()->plugin_url() . '/assets/js/admin/everest-forms-admin' . $suffix . '.js', array(
172
+ 'jquery',
173
+ 'jquery-blockui',
174
+ 'jquery-ui-sortable',
175
+ 'jquery-ui-widget',
176
+ 'jquery-ui-core',
177
+ 'jquery-tiptip'
178
+ ), EVF_VERSION );
179
+ wp_register_script( 'jquery-blockui', EVF()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
180
+ wp_register_script( 'jquery-tiptip', EVF()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
181
+ wp_register_script( 'evf_add_form_js', EVF()->plugin_url() . '/assets/js/admin/evf-add-form' . $suffix . '.js', 'jquery' );
182
+ wp_localize_script( 'evf_add_form_js', 'everest_add_form_params', array(
183
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
184
+ 'create_form_nonce' => wp_create_nonce( 'everest_forms_create_form' ),
185
+ ) );
186
+
187
+ wp_enqueue_script('evf_add_form_js');
188
+
189
+ if ( 'everest-forms_page_evf-settings' === $screen_id ) {
190
+ wp_enqueue_script( 'everest_forms_settings' );
191
+
192
+ }
193
+ // EverestForms admin pages
194
+ if ( in_array( $screen_id, evf_get_screen_ids() ) ) {
195
+
196
+ wp_enqueue_script( 'everest_forms_admin' );
197
+
198
+ $params = array(
199
+
200
+ 'urls' => array(
201
+ 'import_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ),
202
+ 'export_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
203
+ ),
204
+ );
205
+
206
+ wp_localize_script( 'everest_forms_admin', 'everest_forms_admin', $params );
207
+ }
208
+ }
209
+ }
210
+
211
+ endif;
212
+
213
+ return new EVF_Admin_Assets();
includes/admin/class-evf-admin-form-builder.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin
4
+ *
5
+ * @package EverestForms/Admin
6
+ * @version 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * EVF_Admin_Form_Builder Class.
15
+ */
16
+ class EVF_Admin_Form_Builder {
17
+
18
+ /**
19
+ * Current view (panel)
20
+ *
21
+ * @since 1.0.0
22
+ * @var string
23
+ */
24
+ public $tab_view;
25
+
26
+ /**
27
+ * Available panels.
28
+ *
29
+ * @since 1.0.0
30
+ * @var array
31
+ */
32
+ public $admin_form_panels;
33
+
34
+ /**
35
+ * Current form.
36
+ *
37
+ * @since 1.0.0
38
+ * @var object
39
+ */
40
+ public $form;
41
+
42
+ /**
43
+ * Current template information.
44
+ *
45
+ * @since 1.0.0
46
+ * @var array
47
+ */
48
+ public $template;
49
+
50
+ private $sec_post_id;
51
+
52
+ /**
53
+ * Primary class constructor.
54
+ *
55
+ * @since 1.0.0
56
+ */
57
+ public function __construct() {
58
+
59
+ // Maybe load form builder
60
+
61
+ $this->init();
62
+ }
63
+
64
+ /**
65
+ * Determing if the user is viewing the builder, if so, party on.
66
+ *
67
+ * @since 1.0.0
68
+ */
69
+ public function init() {
70
+
71
+ // Check what page we are on
72
+ $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
73
+
74
+ if ( ! 'edit-evf-form' === $page ) {
75
+ return;
76
+ }
77
+
78
+ // Load conditionally.
79
+ if ( ! isset( $_GET['tab'], $_GET['form_id'] ) ) {
80
+ add_action( 'everest_form_admin_form_template_page', array( $this, 'output_template' ) );
81
+ } elseif ( isset( $_GET['tab'], $_GET['form_id'] ) ) {
82
+ // Load form if found
83
+ $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : false;
84
+
85
+ $this->form = EVF()->form->get( $form_id );
86
+
87
+ $this->tab_view = isset( $_GET['tab'] ) ? $_GET['tab'] : 'Fields';
88
+
89
+ // Default for new field is the setup panel
90
+ $this->load_admin_panels();
91
+
92
+ add_action( 'everest_form_admin_form_builder_page', array( $this, 'output' ) );
93
+
94
+ // Provide hook for addons
95
+ do_action( 'everest_forms_builder_init', $this->tab_view );
96
+
97
+ do_action( 'everest_forms_builder_scripts' );
98
+ }
99
+ }
100
+
101
+ public function load_admin_panels() {
102
+
103
+ // Abstract class
104
+ require_once EVF_ABSPATH . 'includes/abstracts/abstract-evf-admin-form-panel.php';
105
+
106
+ $this->admin_form_panels = apply_filters( 'everest_forms_builder_panels', array(
107
+ 'fields',
108
+ 'settings',
109
+ ) );
110
+
111
+ foreach ( $this->admin_form_panels as $panel ) {
112
+
113
+ $panel = 'class-evf-' . $panel . '-panel';
114
+
115
+ if ( file_exists( EVF_ABSPATH . 'includes/admin/form-panels/' . $panel . '.php' ) ) {
116
+
117
+ require_once EVF_ABSPATH . 'includes/admin/form-panels/' . $panel . '.php';
118
+
119
+ }
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Load the appropriate files to build the page.
125
+ *
126
+ * @since 1.0.0
127
+ */
128
+ public function output() {
129
+ $form_id = $this->form ? absint( $this->form->ID ) : '';
130
+ $form_data = $this->form ? evf_decode( $this->form->post_content ) : false;
131
+ $form_data['form_field_id'] = isset( $form_data['form_field_id'] ) ? $form_data['form_field_id'] : 0;
132
+
133
+ ?>
134
+ <div id="everest-forms-builder">
135
+ <form name="everest-forms-builder" id="everest-forms-builder-form" method="post" data-id="<?php echo $form_id; ?>">
136
+ <input type="hidden" name="id" value="<?php echo $form_id; ?>">
137
+ <input type="hidden" value="<?php echo( $form_data['form_field_id'] ); ?>" name="form_field_id" id="everest-forms-field-id">
138
+
139
+ <!-- Panel toggle buttons -->
140
+ <div class="evf-builder-tabs clearfix" id="evf-builder-tabs">
141
+ <ul class="evf-tab-lists">
142
+ <?php do_action( 'everest_forms_builder_panel_buttons', $this->form, $this->tab_view ); ?>
143
+ <li class="evf-panel-field-options-button evf-disabled-tab" data-panel="field-options">
144
+ <a href="#"><span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Options', 'everest-forms' ); ?></a>
145
+ </li>
146
+ </ul>
147
+ <button type="button" name="save_form" class="evf_save_form_action_button"><?php esc_html_e( 'Save', 'everest-forms' ); ?></button>
148
+ </div>
149
+
150
+ <div class="evf-tab-content">
151
+ <?php do_action( 'everest_forms_builder_panels', $this->form, $this->tab_view ); ?>
152
+ <div style="clear:both"></div>
153
+ </div>
154
+ </form>
155
+ </div>
156
+ <?php
157
+ }
158
+
159
+ public function output_template() {
160
+
161
+ wp_enqueue_script( 'everest_forms_builder' );
162
+ wp_enqueue_script( 'everest_forms_settings' );
163
+ wp_enqueue_script( 'everest_forms_admin' );
164
+
165
+ include_once( dirname( __FILE__ ) . '/views/html-admin-form-modal.php' );
166
+ wp_enqueue_style( 'evf-form-modal-style', EVF()->plugin_url() . '/assets/css/evf-form-modal.css', array(), EVF_VERSION );
167
+
168
+ wp_enqueue_script( 'evf-admin-form-modal', EVF()->plugin_url() . '/assets/js/admin/evf-form-modal.js', array( 'underscore', 'backbone', 'wp-util' ), EVF_VERSION );
169
+
170
+ $core_templates = apply_filters( 'everest_forms_templates_core', array(
171
+ 'blank-form' => array(
172
+ 'slug' => 'blank',
173
+ 'name' => __( 'Blank Form', 'everest-forms' ),
174
+ ),
175
+ 'contact-form' => array(
176
+ 'slug' => 'contact',
177
+ 'name' => __( 'Contact Form', 'everest-forms' ),
178
+ ),
179
+ ) );
180
+ ?>
181
+ <div class ="wrap everest-forms">
182
+ <form id="everest-forms" class="everest-forms-setup" name="everest-forms-setup" method="post">
183
+ <div class="everest-forms-setup-form-name">
184
+ <span class="title"><?php _e( 'Form Name', 'everest-forms' ); ?></span>
185
+ <input type="text" id="everest-forms-setup-name" class="widefat everest-forms-setup-name" placeholder="<?php _e( 'Enter your form name here&hellip;', 'everest-forms' ); ?>">
186
+ </div>
187
+ <div class="evf-setup-title">
188
+ <?php esc_html_e( 'Select A Template', 'everest-forms' ); ?>
189
+ <p class="desc">
190
+ <?php esc_html_e( 'To speed up the process, you can select from one of our pre-made templates listed below:', 'everest-forms' ); ?>
191
+ </p>
192
+ </div>
193
+ <div class="evf-setup-templates">
194
+ <?php foreach ( $core_templates as $template ) : ?>
195
+ <div class="evf-template" id="everest-forms-template-<?php echo esc_attr( $template['slug'] ); ?>">
196
+ <img src="<?php echo esc_url( EVF()->plugin_url(). "/assets/images/{$template['slug']}-form.jpg" ); ?>" />
197
+ <div class="evf-template-overlay">
198
+ <a href="#" class="evf-button evf-button-rounded evf-template-select" data-template-name-raw="<?php echo esc_attr( $template['name'] ); ?>" data-template-name="<?php printf( _x( '%s template', 'Template name', 'everest-forms' ), esc_attr( $template['name'] ) ); ?>" data-template="<?php echo esc_attr( $template['slug'] ); ?>"><?php printf( _x( 'Create a %s', 'Template name', 'everest-forms' ), esc_html( $template['name'] ) ); ?></a>
199
+ </div>
200
+ </div>
201
+ <?php endforeach; ?>
202
+ </div>
203
+ <div class="clear"></div>
204
+ </form>
205
+ </div>
206
+ <?php
207
+ }
208
+ }
209
+
210
+ new EVF_Admin_Form_Builder();
includes/admin/class-evf-admin-form-list.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form List Page
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin/Form List Page
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * EVF_Admin_Form_List Class.
17
+ */
18
+ class EVF_Admin_Form_List {
19
+
20
+ /**
21
+ * Handles output of the reports page in admin.
22
+ */
23
+ public static function output() {
24
+
25
+ $evf_form_list = new EVF_Admin_Form_Table_List();
26
+ $evf_form_list->prepare_items();
27
+ include_once( dirname( __FILE__ ) . '/views/html-admin-page-forms.php' );
28
+
29
+ add_action( 'everest_form_list_admin_footer', array( __CLASS__, 'everest_form_list_admin_footer' ), 10, 1 );
30
+ }
31
+
32
+ public static function everest_form_list_admin_footer( $screen_id ) {
33
+
34
+ if ( $screen_id === 'toplevel_page_everest-forms' ) {
35
+
36
+ include_once( dirname( __FILE__ ) . '/views/html-admin-form-modal.php' );
37
+
38
+
39
+ wp_enqueue_style( 'evf-form-modal-style', EVF()->plugin_url() . '/assets/css/evf-form-modal.css', array(), EVF_VERSION );
40
+
41
+ wp_enqueue_script(
42
+ 'evf-admin-form-modal',
43
+ EVF()->plugin_url() . '/assets/js/admin/evf-form-modal.js',
44
+ array(
45
+ 'underscore',
46
+ 'backbone',
47
+ 'wp-util',
48
+
49
+ ),
50
+ EVF_VERSION
51
+ );
52
+
53
+ $strings = array(
54
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
55
+ 'evf_new_form_nonce' => wp_create_nonce( 'evf_new_form' ),
56
+
57
+ );
58
+ $strings = apply_filters( 'everest_forms_builder_modal_strings', $strings );
59
+
60
+
61
+ wp_localize_script(
62
+ 'evf-admin-form-modal',
63
+ 'evf_form_modal_data',
64
+ $strings
65
+ );
66
+
67
+ }
68
+
69
+ }
70
+
71
+ }
includes/admin/class-evf-admin-form-table-list.php ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Form Table List
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'WP_List_Table' ) ) {
16
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
17
+ }
18
+
19
+ class EVF_Admin_Form_Table_List extends WP_List_Table {
20
+
21
+ public $post_type_config = array(
22
+ 'singular' => 'everest_form',
23
+ 'plural' => 'everest_forms',
24
+ 'type' => 'everest_form'
25
+ );
26
+
27
+ /**
28
+ * Initialize the log table list.
29
+ */
30
+ public function __construct() {
31
+ parent::__construct( array(
32
+ 'singular' => $this->post_type_config['singular'],
33
+ 'plural' => $this->post_type_config['plural'],
34
+ 'ajax' => false,
35
+ ) );
36
+ }
37
+
38
+
39
+ /**
40
+ * Get list columns.
41
+ *
42
+ * @return array
43
+ */
44
+ public function get_columns() {
45
+ return array(
46
+ 'cb' => '<input type="checkbox" />',
47
+ 'title' => __( 'Title', 'everest-forms' ),
48
+ 'shortcode' => __( 'Shortcode', 'everest-forms' ),
49
+ 'author' => __( 'Author', 'everest-forms' ),
50
+ 'date' => __( 'Date', 'everest-forms' ),
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Return shortcode column.
56
+ *
57
+ * @param object $posts
58
+ *
59
+ * @return string
60
+ */
61
+ function column_shortcode( $posts ) {
62
+
63
+ $shortcode = '[everest_form id="' . $posts->ID . '"]';
64
+
65
+ return sprintf( '<span class="shortcode"><input type="text" onfocus="this.select();" readonly="readonly" value=\'%s\' class="large-text code"></span>', $shortcode );
66
+
67
+ }
68
+
69
+ /**
70
+ * Return author column.
71
+ *
72
+ * @param object $posts
73
+ *
74
+ * @return string
75
+ */
76
+ function column_author( $posts ) {
77
+ $user = get_user_by( 'id', $posts->post_author );
78
+
79
+ if ( ! $user ) {
80
+ return '<span class="na">&ndash;</span>';
81
+ }
82
+
83
+ $user_name = ! empty( $user->data->display_name ) ? $user->data->display_name : $user->data->user_login;
84
+
85
+ if ( current_user_can( 'edit_user' ) ) {
86
+ return '<a href="' . esc_url( add_query_arg( array(
87
+ 'user_id' => $user->ID,
88
+ ), admin_url( 'user-edit.php' ) ) ) . '">' . esc_html( $user_name ) . '</a>';
89
+ }
90
+
91
+ return esc_html( $user_name );
92
+ }
93
+
94
+ /**
95
+ * Return date column.
96
+ *
97
+ * @param object $posts
98
+ *
99
+ * @return string
100
+ */
101
+ function column_date( $posts ) {
102
+ $post = get_post( $posts->ID );
103
+
104
+ if ( ! $post ) {
105
+ return;
106
+ }
107
+
108
+ $t_time = mysql2date( __( 'Y/m/d g:i:s A', 'everest-forms' ),
109
+ $post->post_date, true );
110
+ $m_time = $post->post_date;
111
+ $time = mysql2date( 'G', $post->post_date )
112
+ - get_option( 'gmt_offset' ) * 3600;
113
+
114
+ $time_diff = time() - $time;
115
+
116
+ if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 ) {
117
+ $h_time = sprintf(
118
+ __( '%s ago', 'everest-forms' ), human_time_diff( $time ) );
119
+ } else {
120
+ $h_time = mysql2date( __( 'Y/m/d', 'everest-forms' ), $m_time );
121
+ }
122
+
123
+ return '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
124
+ }
125
+
126
+ /**
127
+ * Return title column.
128
+ *
129
+ * @param object $posts
130
+ *
131
+ * @return string
132
+ */
133
+ public function column_title( $posts ) {
134
+ $edit_link = admin_url( 'admin.php?page=edit-evf-form&amp;tab=fields&amp;form_id=' . $posts->ID );
135
+ $title = _draft_or_post_title( $posts->ID );
136
+ $post_type_object = get_post_type_object( $this->post_type_config['type'] );
137
+ $post_status = $posts->post_status;
138
+
139
+ // Title
140
+ $output = '<strong>';
141
+ if ( 'trash' == $post_status ) {
142
+ $output .= esc_html( $title );
143
+ } else {
144
+ $output .= '<a href="' . esc_url( $edit_link ) . '" class="row-title">' . esc_html( $title ) . '</a>';
145
+ }
146
+ $output .= '</strong>';
147
+
148
+ // Get actions.
149
+ if ( current_user_can( $post_type_object->cap->edit_post, $posts->ID ) && 'trash' !== $post_status ) {
150
+ $actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit', 'everest-forms' ) . '</a>';
151
+ }
152
+
153
+ if ( current_user_can( $post_type_object->cap->delete_post, $posts->ID ) ) {
154
+ if ( 'trash' == $post_status ) {
155
+ $actions['untrash'] = '<a aria-label="' . esc_attr__( 'Restore this item from the Trash', 'everest-forms' ) . '" href="' . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $posts->ID ) ), 'untrash-post_' . $posts->ID ) . '">' . esc_html__( 'Restore', 'everest-forms' ) . '</a>';
156
+ } elseif ( EMPTY_TRASH_DAYS ) {
157
+ $actions['trash'] = '<a class="submitdelete" aria-label="' . esc_attr__( 'Move this item to the Trash', 'everest-forms' ) . '" href="' . get_delete_post_link( $posts->ID ) . '">' . esc_html__( 'Trash', 'everest-forms' ) . '</a>';
158
+ }
159
+ if ( 'trash' == $post_status || ! EMPTY_TRASH_DAYS ) {
160
+ $actions['delete'] = '<a class="submitdelete" aria-label="' . esc_attr__( 'Delete this item permanently', 'everest-forms' ) . '" href="' . get_delete_post_link( $posts->ID, '', true ) . '">' . esc_html__( 'Delete permanently', 'everest-forms' ) . '</a>';
161
+ }
162
+ }
163
+ $duplicate_nonce = wp_create_nonce( 'everest_forms_form_duplicate' . $posts->ID );
164
+ $duplicate_link = admin_url( 'admin.php?page=everest-forms&action=duplicate&_wpnonce=' . $duplicate_nonce . '&form=' . $posts->ID );
165
+
166
+ if ( current_user_can( $post_type_object->cap->edit_post, $posts->ID ) && 'publish' === $post_status ) {
167
+ $actions['duplicate'] = '<a href="' . esc_url( $duplicate_link ) . '">' . __( 'Duplicate', 'everest-forms' ) . '</a>';
168
+ }
169
+
170
+ $row_actions = array();
171
+
172
+ foreach ( $actions as $action => $link ) {
173
+ $row_actions[] = '<span class="' . esc_attr( $action ) . '">' . $link . '</span>';
174
+ }
175
+
176
+ $output .= '<div class="row-actions">' . implode( ' | ', $row_actions ) . '</div>';
177
+
178
+ return $output;
179
+ }
180
+
181
+ protected function get_views() {
182
+ $status_links = array();
183
+ $num_posts = wp_count_posts( $this->post_type_config['type'], 'readable' );
184
+ $class = '';
185
+ $total_posts = array_sum( (array) $num_posts );
186
+
187
+
188
+ // Subtract post types that are not included in the admin all list.
189
+ $post_stati = get_post_stati( array( 'show_in_admin_all_list' => false ) );
190
+ foreach ( $post_stati as $state ) {
191
+
192
+ $total_posts -= isset( $num_posts->$state ) ? $num_posts->$state : 0;
193
+ }
194
+
195
+
196
+ $class = empty( $class ) && empty( $_REQUEST['status'] ) ? ' class="current"' : '';
197
+ /* translators: %s: count */
198
+ $status_links['all'] = "<a href='admin.php?page=everest-forms'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'everest-forms' ), number_format_i18n( $total_posts ) ) . '</a>';
199
+
200
+ foreach (
201
+ get_post_stati( array(
202
+ 'show_in_admin_status_list' => true,
203
+ ), 'objects' ) as $status
204
+ ) {
205
+ $class = '';
206
+ $status_name = $status->name;
207
+
208
+ if ( ! in_array( $status_name, array(
209
+ 'publish',
210
+ 'draft',
211
+ 'pending',
212
+ 'trash',
213
+ 'future',
214
+ 'private',
215
+ 'auto-draft'
216
+ ) )
217
+ ) {
218
+ continue;
219
+ }
220
+
221
+ if ( empty( $num_posts->$status_name ) ) {
222
+ continue;
223
+ }
224
+
225
+ if ( isset( $_REQUEST['status'] ) && $status_name == $_REQUEST['status'] ) {
226
+ $class = ' class="current"';
227
+ }
228
+
229
+ $label = $this->get_status_label( $status_name, $status );
230
+
231
+ $status_links[ $status_name ] = "<a href='admin.php?page=everest-forms&amp;status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
232
+ }
233
+
234
+ return $status_links;
235
+ }
236
+
237
+ /**
238
+ * Get the status label for licenses.
239
+ *
240
+ * @param string $status_name
241
+ * @param stdClass $status
242
+ *
243
+ * @return array
244
+ */
245
+ private function get_status_label( $status_name, $status ) {
246
+ switch ( $status_name ) {
247
+ case 'publish' :
248
+ /* translators: %s: count */
249
+ $label = array(
250
+ 'singular' => __( 'Published <span class="count">(%s)</span>', 'everest-forms' ),
251
+ 'plural' => __( 'Published <span class="count">(%s)</span>', 'everest-forms' ),
252
+ 'context' => '',
253
+ 'domain' => 'everest-forms',
254
+ );
255
+ break;
256
+ case 'draft' :
257
+ /* translators: %s: count */
258
+ $label = array(
259
+ 'singular' => __( 'Draft <span class="count">(%s)</span>', 'everest-forms' ),
260
+ 'plural' => __( 'Draft <span class="count">(%s)</span>', 'everest-forms' ),
261
+ 'context' => '',
262
+ 'domain' => 'everest-forms',
263
+ );
264
+ break;
265
+ case 'pending' :
266
+ /* translators: %s: count */
267
+ $label = array(
268
+ 'singular' => __( 'Pending <span class="count">(%s)</span>', 'everest-forms' ),
269
+ 'plural' => __( 'Pending <span class="count">(%s)</span>', 'everest-forms' ),
270
+ 'context' => '',
271
+ 'domain' => 'everest-forms',
272
+ );
273
+ break;
274
+
275
+ default:
276
+ $label = $status->label_count;
277
+ break;
278
+ }
279
+
280
+ return $label;
281
+ }
282
+
283
+ /**
284
+ * Column cb.
285
+ *
286
+ * @param array $post
287
+ *
288
+ * @return string
289
+ */
290
+ public function column_cb( $post ) {
291
+ return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $post->ID );
292
+ }
293
+
294
+ /**
295
+ * Get a list of sortable columns.
296
+ *
297
+ * @return array
298
+ */
299
+ protected function get_sortable_columns() {
300
+ return array(
301
+ 'title' => array( 'title', false ),
302
+ 'author' => array( 'author', false ),
303
+ 'date' => array( 'date', false ),
304
+ );
305
+ }
306
+
307
+ /**
308
+ * Get bulk actions.
309
+ *
310
+ * @return array
311
+ */
312
+ protected function get_bulk_actions() {
313
+ if ( isset( $_GET['status'] ) && 'trash' == $_GET['status'] ) {
314
+ return array(
315
+ 'untrash' => __( 'Restore', 'everest-forms' ),
316
+ 'delete' => __( 'Delete permanently', 'everest-forms' ),
317
+ );
318
+ }
319
+
320
+ return array(
321
+ 'trash' => __( 'Move to trash', 'everest-forms' ),
322
+ );
323
+ }
324
+
325
+ /**
326
+ * Extra controls to be displayed between bulk actions and pagination.
327
+ *
328
+ * @param string $which
329
+ */
330
+ protected function extra_tablenav( $which ) {
331
+
332
+ if ( 'top' == $which && isset( $_GET['status'] ) && 'trash' == $_GET['status'] && current_user_can( 'delete_posts' ) ) {
333
+ echo '<div class="alignleft actions"><a id="delete_all" class="button apply" href="' . esc_url( wp_nonce_url( admin_url( 'admin.php?page=everest-forms&status=trash&empty_trash=1' ), 'empty_trash' ) ) . '">' . __( 'Empty trash', 'everest-forms' ) . '</a></div>';
334
+ }
335
+ }
336
+
337
+ /**
338
+ * Get a list of hidden columns.
339
+ *
340
+ * @return array
341
+ */
342
+ protected function get_hidden_columns() {
343
+ return get_hidden_columns( $this->screen );
344
+ }
345
+
346
+ /**
347
+ * Prepare table list items.
348
+ *
349
+ * @global wpdb $wpdb
350
+ */
351
+ public function prepare_items() {
352
+ global $wpdb;
353
+
354
+ $this->prepare_column_headers();
355
+ $per_page = $this->get_items_per_page( 'everest_forms_per_page_list', 20 );
356
+ $columns = $this->get_columns();
357
+ $hidden = $this->get_hidden_columns();
358
+ $sortable = $this->get_sortable_columns();
359
+
360
+ // Column headers
361
+ $this->_column_headers = array( $columns, $hidden, $sortable );
362
+
363
+ $current_page = $this->get_pagenum();
364
+
365
+ // Query args
366
+ $args = array(
367
+ 'post_type' => $this->post_type_config['type'],
368
+ 'posts_per_page' => $per_page,
369
+ 'ignore_sticky_posts' => true,
370
+ 'paged' => $current_page,
371
+ );
372
+
373
+ // Handle the status query
374
+ if ( ! empty( $_REQUEST['status'] ) ) {
375
+ $args['post_status'] = sanitize_text_field( $_REQUEST['status'] );
376
+ }
377
+
378
+ $args['s'] = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
379
+ $args['orderby'] = isset( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date_created';
380
+ $args['order'] = isset( $_REQUEST['order'] ) && 'ASC' === strtoupper( $_REQUEST['order'] ) ? 'ASC' : 'DESC';
381
+
382
+ // Get the registrations
383
+ $posts = new WP_Query( $args );
384
+ $this->items = $posts->posts;
385
+
386
+ // Set the pagination
387
+ $this->set_pagination_args( array(
388
+ 'total_items' => $posts->found_posts,
389
+ 'per_page' => $per_page,
390
+ 'total_pages' => $posts->max_num_pages,
391
+ ) );
392
+ }
393
+
394
+ /**
395
+ * Set _column_headers property for table list
396
+ */
397
+ protected function prepare_column_headers() {
398
+ $this->_column_headers = array(
399
+ $this->get_columns(),
400
+ array(),
401
+ $this->get_sortable_columns(),
402
+ );
403
+ }
404
+ }
includes/admin/class-evf-admin-menus.php ADDED
@@ -0,0 +1,477 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup menus in WP admin.
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( class_exists( 'EVF_Admin_Menus', false ) ) {
16
+ return new EVF_Admin_Menus();
17
+ }
18
+
19
+ /**
20
+ * EVF_Admin_Menus Class.
21
+ */
22
+ class EVF_Admin_Menus {
23
+
24
+ /**
25
+ * Hook in tabs.
26
+ */
27
+ public function __construct() {
28
+ add_action( 'admin_init', array( $this, 'actions' ) );
29
+
30
+ // Add menus.
31
+ add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
32
+ add_action( 'admin_menu', array( $this, 'forms_menu' ), 20 );
33
+ add_action( 'admin_menu', array( $this, 'add_new_form' ), 30 );
34
+ add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
35
+ add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
36
+
37
+ add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 11, 3 );
38
+ add_filter( 'admin_footer', array( $this, 'admin_footer' ), 1 );
39
+
40
+ // Admin bar menus.
41
+ if ( apply_filters( 'everest_forms_show_admin_bar', true ) ) {
42
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 99 );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Returns a base64 URL for the SVG for use in the menu.
48
+ *
49
+ * @param bool $base64 Whether or not to return base64-encoded SVG.
50
+ * @return string
51
+ */
52
+ private function get_icon_svg( $base64 = true ) {
53
+ $svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><g><path fill="#82878c" d="M4.5 0v3H0v17h20V0H4.5zM9 19H1V4h8v15zm10 0h-9V3H5.5V1H19v18zM6.5 6h-4V5h4v1zm1 2v1h-5V8h5zm-5 3h3v1h-3v-1z"/></g></svg>';
54
+
55
+ if ( $base64 ) {
56
+ return 'data:image/svg+xml;base64,' . base64_encode( $svg );
57
+ }
58
+
59
+ return $svg;
60
+ }
61
+
62
+ /**
63
+ * Add menu items.
64
+ */
65
+ public function admin_menu() {
66
+ $form_page = add_menu_page( __( 'Everest Forms', 'everest-forms' ), __( 'Everest Forms', 'everest-forms' ), 'manage_everest_forms', 'everest-forms', null, $this->get_icon_svg(), '55.5' );
67
+
68
+ add_action( 'load-' . $form_page, array( $this, 'everest_forms_page_init' ) );
69
+ add_action( 'manage_' . $form_page . '_columns', array( $this, 'everest_forms_columns' ) );
70
+ }
71
+
72
+ /**
73
+ * Add menu items.
74
+ */
75
+ public function forms_menu() {
76
+ add_submenu_page( 'everest-forms', __( 'All Forms', 'everest-forms' ), __( 'All Forms', 'everest-forms' ), 'manage_everest_forms', 'everest-forms', array( $this, 'everest_forms_page' ) );
77
+ }
78
+
79
+ /**
80
+ * Add menu items.
81
+ */
82
+ public function add_new_form() {
83
+ add_submenu_page( 'everest-forms', __( 'Add New', 'everest-forms' ), __( 'Add New', 'everest-forms' ), 'manage_everest_forms', 'edit-evf-form', array( $this, 'add_everest_forms' ) );
84
+ }
85
+
86
+ /**
87
+ * Everest forms admin actions.
88
+ */
89
+ public function actions() {
90
+
91
+ if ( isset( $_GET['page'] ) && 'everest-forms' === $_GET['page'] ) {
92
+ // Bulk actions
93
+ if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['everest_form'] ) ) {
94
+ $this->bulk_actions();
95
+ }
96
+ // Empty trash
97
+ if ( isset( $_GET['empty_trash'] ) ) {
98
+ $this->empty_trash();
99
+ }
100
+
101
+ $action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : '';
102
+
103
+ $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( $_GET['_wpnonce'] ) : '';
104
+
105
+ $form_id = isset( $_GET['form'] ) && is_numeric( $_GET['form'] ) ? $_GET['form'] : '';
106
+
107
+ if ( ! empty( $action ) && ! empty( $nonce ) && ! empty( $form_id ) ) {
108
+
109
+ $flag = wp_verify_nonce( $nonce, 'everest_forms_form_duplicate' . $form_id );
110
+
111
+ if ( $flag == true && ! is_wp_error( $flag ) ) {
112
+
113
+ if ( 'duplicate' === $action ) {
114
+
115
+ $this->duplicate( $form_id );
116
+
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Bulk trash.
125
+ *
126
+ * @param array $forms
127
+ * @param boolean $delete
128
+ */
129
+ private function bulk_trash( $forms, $delete = false ) {
130
+ foreach ( $forms as $form_id ) {
131
+ if ( $delete ) {
132
+ wp_delete_post( $form_id, true );
133
+ } else {
134
+ wp_trash_post( $form_id );
135
+ }
136
+ }
137
+
138
+ $type = ! EMPTY_TRASH_DAYS || $delete ? 'deleted' : 'trashed';
139
+ $qty = count( $forms );
140
+ $status = isset( $_GET['status'] ) ? '&status=' . sanitize_text_field( $_GET['status'] ) : '';
141
+
142
+ // Redirect to registrations page
143
+ wp_redirect( admin_url( 'admin.php?page=everest-forms' . $status . '&' . $type . '=' . $qty ) );
144
+ exit();
145
+ }
146
+
147
+ /**
148
+ * Bulk untrash.
149
+ *
150
+ * @param array $forms
151
+ */
152
+ private function bulk_untrash( $forms ) {
153
+ foreach ( $forms as $form_id ) {
154
+ wp_untrash_post( $form_id );
155
+ }
156
+
157
+ $qty = count( $forms );
158
+
159
+ // Redirect to registrations page
160
+ wp_redirect( admin_url( 'admin.php?page=everest-forms&status=trash&untrashed=' . $qty ) );
161
+ exit();
162
+ }
163
+
164
+ /**
165
+ * Empty Trash.
166
+ */
167
+ private function empty_trash() {
168
+ if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'empty_trash' ) ) {
169
+ wp_die( __( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
170
+ }
171
+
172
+ if ( ! current_user_can( 'delete_everest_forms' ) ) {
173
+ wp_die( __( 'You do not have permissions to delete forms!', 'everest-forms' ) );
174
+ }
175
+
176
+ $registration = get_posts( array(
177
+ 'post_type' => 'everest_form',
178
+ 'ignore_sticky_posts' => true,
179
+ 'nopaging' => true,
180
+ 'post_status' => 'trash',
181
+ 'fields' => 'ids',
182
+ ) );
183
+
184
+ foreach ( $registration as $webhook_id ) {
185
+ wp_delete_post( $webhook_id, true );
186
+ }
187
+
188
+ $qty = count( $registration );
189
+
190
+ // Redirect to registrations page
191
+ wp_redirect( admin_url( 'admin.php?page=everest-forms&deleted=' . $qty ) );
192
+ exit();
193
+ }
194
+
195
+ /**
196
+ * Duplicate form
197
+ */
198
+ private function duplicate( $form_id ) {
199
+
200
+ if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'everest_forms_form_duplicate' . $form_id ) ) {
201
+ wp_die( __( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
202
+ }
203
+
204
+ if ( ! current_user_can( 'duplicate_everest_form' ) ) {
205
+ wp_die( __( 'You do not have permissions to delete forms!', 'everest-forms' ) );
206
+ }
207
+ $post = get_post( $form_id );
208
+ $current_user = wp_get_current_user();
209
+ $new_post_author = $current_user->ID;
210
+
211
+ /*
212
+ * if post data exists, create the post duplicate
213
+ */
214
+ if ( isset( $post ) && $post != null ) {
215
+
216
+ if ( 'publish' !== $post->post_status ) {
217
+
218
+ return false;
219
+ }
220
+
221
+ /*
222
+ * new post data array
223
+ */
224
+ $args = array(
225
+ 'comment_status' => $post->comment_status,
226
+ 'ping_status' => $post->ping_status,
227
+ 'post_author' => $new_post_author,
228
+ 'post_content' => $post->post_content,
229
+ 'post_excerpt' => $post->post_excerpt,
230
+ 'post_name' => $post->post_name,
231
+ 'post_parent' => $post->post_parent,
232
+ 'post_password' => $post->post_password,
233
+ 'post_status' => $post->post_status,
234
+ 'post_title' => __( 'Copy of ', 'everest-forms' ) . $post->post_title,
235
+ 'post_type' => $post->post_type,
236
+ 'to_ping' => $post->to_ping,
237
+ 'menu_order' => $post->menu_order
238
+ );
239
+
240
+ /*
241
+ * insert the post by wp_insert_post() function
242
+ */
243
+ $new_post_id = wp_insert_post( $args );
244
+
245
+ /*
246
+ * duplicate all post meta just in two SQL queries
247
+ */
248
+ global $wpdb;
249
+ $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d", $form_id ) );
250
+
251
+ if ( count( $post_meta_infos ) != 0 ) {
252
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
253
+ foreach ( $post_meta_infos as $meta_info ) {
254
+ $meta_key = $meta_info->meta_key;
255
+ if ( $meta_key == '_wp_old_slug' ) {
256
+ continue;
257
+ }
258
+ $meta_value = addslashes( $meta_info->meta_value );
259
+ $sql_query_sel[] = "SELECT $new_post_id, '$meta_key', '$meta_value'";
260
+ }
261
+ if ( count( $sql_query_sel ) > 0 ) {
262
+ $sql_query .= implode( " UNION ALL ", $sql_query_sel );
263
+ }
264
+ $wpdb->query( $sql_query );
265
+ }
266
+
267
+ /*
268
+ * duplicate all post meta just in two SQL queries
269
+ */
270
+ global $wpdb;
271
+ $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d", $form_id ) );
272
+
273
+ if ( count( $post_meta_infos ) != 0 ) {
274
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
275
+ foreach ( $post_meta_infos as $meta_info ) {
276
+ $meta_key = $meta_info->meta_key;
277
+ if ( $meta_key == '_wp_old_slug' ) {
278
+ continue;
279
+ }
280
+ $meta_value = addslashes( $meta_info->meta_value );
281
+ $sql_query_sel[] = "SELECT $new_post_id, '$meta_key', '$meta_value'";
282
+ }
283
+ $sql_query .= implode( " UNION ALL ", $sql_query_sel );
284
+ $wpdb->query( $sql_query );
285
+ }
286
+
287
+ /*
288
+ * finally, redirect to the edit post screen for the new draft
289
+ */
290
+ //wp_redirect( admin_url( 'admin.php?page=everest-forms&edit-registration=' . $new_post_id ) );
291
+ wp_redirect( admin_url( 'admin.php?page=everest-forms' ) );
292
+ exit;
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Bulk actions.
298
+ */
299
+ private function bulk_actions() {
300
+ if ( ! current_user_can( 'edit_everest_forms' ) ) {
301
+ wp_die( __( 'You do not have permissions to edit forms!', 'everest-forms' ) );
302
+ }
303
+
304
+ $forms = array_map( 'absint', (array) $_REQUEST['everest_form'] );
305
+
306
+ switch ( $_REQUEST['action'] ) {
307
+ case 'trash' :
308
+ $this->bulk_trash( $forms );
309
+ break;
310
+ case 'untrash' :
311
+ $this->bulk_untrash( $forms );
312
+ break;
313
+ case 'delete' :
314
+ $this->bulk_trash( $forms, true );
315
+ break;
316
+ default :
317
+ break;
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Init the settings page.
323
+ */
324
+ public function everest_forms_page() {
325
+ EVF_Admin_Form_List::output();
326
+ }
327
+
328
+ /**
329
+ * Loads screen options into memory.
330
+ */
331
+ public function everest_forms_page_init() {
332
+ $args = array(
333
+ 'label' => __( 'Forms per page', 'everest-forms' ),
334
+ 'default' => 20,
335
+ 'option' => 'everest_forms_per_page_list'
336
+ );
337
+ add_screen_option( 'per_page', $args );
338
+ }
339
+
340
+ /**
341
+ * Validate screen options on update.
342
+ */
343
+ public function set_screen_option( $status, $option, $value ) {
344
+ if ( 'everest_forms_per_page_list' == $option ) {
345
+ return $value;
346
+ }
347
+
348
+ }
349
+
350
+ /**
351
+ * Define custom columns for licenses.
352
+ *
353
+ * @param array $columns
354
+ *
355
+ * @return array
356
+ */
357
+ public function everest_forms_columns( $columns ) {
358
+ $columns['cb'] = '<input type="checkbox" />';
359
+ $columns['title'] = __( 'Title', 'everest-forms' );
360
+ $columns['shortcode'] = __( 'Shortcode', 'everest-forms' );
361
+ $columns['author'] = __( 'Author', 'everest-forms' );
362
+ $columns['date'] = __( 'Date', 'everest-forms' );
363
+
364
+ return $columns;
365
+ }
366
+
367
+ /**
368
+ * Add menu item.
369
+ */
370
+ public function settings_menu() {
371
+ $settings_page = add_submenu_page( 'everest-forms', __( 'Everest Forms settings', 'everest-forms' ), __( 'Settings', 'everest-forms' ), 'manage_everest_forms', 'evf-settings', array(
372
+ $this,
373
+ 'settings_page'
374
+ ) );
375
+
376
+ add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) );
377
+ }
378
+
379
+ /**
380
+ * Loads gateways and shipping methods into memory for use within settings.
381
+ */
382
+ public function settings_page_init() {
383
+ global $current_tab, $current_section;
384
+
385
+ // Include settings pages
386
+ EVF_Admin_Settings::get_settings_pages();
387
+
388
+ // Get current tab/section
389
+ $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] );
390
+ $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] );
391
+
392
+
393
+ // Save settings if data has been posted
394
+ if ( ! empty( $_POST ) ) {
395
+ EVF_Admin_Settings::save();
396
+ }
397
+
398
+ // Add any posted messages
399
+ if ( ! empty( $_GET['evf_error'] ) ) {
400
+ EVF_Admin_Settings::add_error( stripslashes( $_GET['evf_error'] ) );
401
+ }
402
+
403
+ if ( ! empty( $_GET['evf_message'] ) ) {
404
+ EVF_Admin_Settings::add_message( stripslashes( $_GET['evf_message'] ) );
405
+ }
406
+ }
407
+
408
+ /**
409
+ * Add menu item.
410
+ */
411
+ public function status_menu() {
412
+ add_submenu_page( 'everest-forms', __( 'Everest Forms status', 'everest-forms' ), __( 'Status', 'everest-forms' ), 'manage_everest_forms', 'evf-status', array(
413
+ $this,
414
+ 'status_page'
415
+ ) );
416
+ }
417
+
418
+ /**
419
+ * Init the add registration page.
420
+ */
421
+ public function add_everest_forms() {
422
+ if ( isset( $_GET['tab'], $_GET['form_id'] ) ) {
423
+ do_action( 'everest_form_admin_form_builder_page' );
424
+ } else {
425
+ do_action( 'everest_form_admin_form_template_page' );
426
+ }
427
+ }
428
+
429
+ /**
430
+ * Init the select template page.
431
+ */
432
+ public function everest_forms_template() {
433
+ do_action( 'everest_form_admin_form_template_page' );
434
+ }
435
+
436
+ /**
437
+ * Init the settings page.
438
+ */
439
+ public function settings_page() {
440
+ EVF_Admin_Settings::output();
441
+ }
442
+
443
+ /**
444
+ * Init the status page.
445
+ */
446
+ public function status_page() {
447
+ EVF_Admin_Status::output();
448
+ }
449
+
450
+ public function admin_footer() {
451
+ $screen = get_current_screen();
452
+
453
+ do_action( 'everest_form_list_admin_footer', $screen->id );
454
+ }
455
+
456
+ /**
457
+ * Add "Everest Forms" link in admin bar main menu.
458
+ *
459
+ * @since 1.0.0
460
+ * @param WP_Admin_Bar $wp_admin_bar Admin bar instance.
461
+ */
462
+ public function admin_bar_menus( $wp_admin_bar ) {
463
+ if ( ! is_admin_bar_showing() || ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
464
+ return;
465
+ }
466
+
467
+ $args = array(
468
+ 'id' => 'everest_forms',
469
+ 'title' => 'Everest Forms',
470
+ 'href' => admin_url( 'admin.php?page=everest-forms-builder' ),
471
+ 'parent' => 'new-content',
472
+ );
473
+ $wp_admin_bar->add_node( $args );
474
+ }
475
+ }
476
+
477
+ return new EVF_Admin_Menus();
includes/admin/class-evf-admin-notices.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Display notices in admin
4
+ *
5
+ * @package EverestForms\Admin
6
+ * @version 1.0.0
7
+ * @since 1.0.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * EVF_Admin_Notices Class.
16
+ */
17
+ class EVF_Admin_Notices {
18
+
19
+ /**
20
+ * Stores notices.
21
+ *
22
+ * @var array
23
+ */
24
+ private static $notices = array();
25
+
26
+ /**
27
+ * Array of notices - name => callback.
28
+ *
29
+ * @var array
30
+ */
31
+ private static $core_notices = array(
32
+ 'update' => 'update_notice',
33
+ );
34
+
35
+ /**
36
+ * Constructor.
37
+ */
38
+ public static function init() {
39
+ self::$notices = get_option( 'everest_forms_admin_notices', array() );
40
+
41
+ add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) );
42
+ add_action( 'shutdown', array( __CLASS__, 'store_notices' ) );
43
+
44
+ if ( current_user_can( 'manage_everest_forms' ) ) {
45
+ add_action( 'admin_print_styles', array( __CLASS__, 'add_notices' ) );
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Store notices to DB
51
+ */
52
+ public static function store_notices() {
53
+ update_option( 'everest_forms_admin_notices', self::get_notices() );
54
+ }
55
+
56
+ /**
57
+ * Get notices.
58
+ *
59
+ * @return array
60
+ */
61
+ public static function get_notices() {
62
+ return self::$notices;
63
+ }
64
+
65
+ /**
66
+ * Remove all notices.
67
+ */
68
+ public static function remove_all_notices() {
69
+ self::$notices = array();
70
+ }
71
+
72
+ /**
73
+ * Show a notice.
74
+ *
75
+ * @param string $name Notice name.
76
+ */
77
+ public static function add_notice( $name ) {
78
+ self::$notices = array_unique( array_merge( self::get_notices(), array( $name ) ) );
79
+ }
80
+
81
+ /**
82
+ * Remove a notice from being displayed.
83
+ *
84
+ * @param string $name Notice name.
85
+ */
86
+ public static function remove_notice( $name ) {
87
+ self::$notices = array_diff( self::get_notices(), array( $name ) );
88
+ delete_option( 'everest_forms_admin_notice_' . $name );
89
+ }
90
+
91
+ /**
92
+ * See if a notice is being shown.
93
+ *
94
+ * @param string $name Notice name.
95
+ * @return boolean
96
+ */
97
+ public static function has_notice( $name ) {
98
+ return in_array( $name, self::get_notices(), true );
99
+ }
100
+
101
+ /**
102
+ * Hide a notice if the GET variable is set.
103
+ */
104
+ public static function hide_notices() {
105
+ if ( isset( $_GET['evf-hide-notice'] ) && isset( $_GET['_evf_notice_nonce'] ) ) { // WPCS: input var okay, CSRF ok.
106
+ if ( ! wp_verify_nonce( wp_unslash( $_GET['_evf_notice_nonce'] ), 'everest_forms_hide_notices_nonce' ) ) { // WPCS: input var ok, sanitization ok.
107
+ wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
108
+ }
109
+
110
+ if ( ! current_user_can( 'manage_everest_forms' ) ) {
111
+ wp_die( esc_html__( 'Cheatin&#8217; huh?', 'everest-forms' ) );
112
+ }
113
+
114
+ $hide_notice = sanitize_text_field( wp_unslash( $_GET['evf-hide-notice'] ) ); // WPCS: input var okay, CSRF ok.
115
+ self::remove_notice( $hide_notice );
116
+ do_action( 'everest_forms_hide_' . $hide_notice . '_notice' );
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Add notices + styles if needed.
122
+ */
123
+ public static function add_notices() {
124
+ $notices = self::get_notices();
125
+
126
+ if ( ! empty( $notices ) ) {
127
+ wp_enqueue_style( 'everest-forms-activation', plugins_url( '/assets/css/activation.css', EVF_PLUGIN_FILE ), array(), EVF_VERSION );
128
+
129
+ // Add RTL support.
130
+ wp_style_add_data( 'everest-forms-activation', 'rtl', 'replace' );
131
+
132
+ foreach ( $notices as $notice ) {
133
+ if ( ! empty( self::$core_notices[ $notice ] ) && apply_filters( 'everest_forms_show_admin_notice', true, $notice ) ) {
134
+ add_action( 'admin_notices', array( __CLASS__, self::$core_notices[ $notice ] ) );
135
+ } else {
136
+ add_action( 'admin_notices', array( __CLASS__, 'output_custom_notices' ) );
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Add a custom notice.
144
+ *
145
+ * @param string $name Notice name.
146
+ * @param string $notice_html Notice html.
147
+ */
148
+ public static function add_custom_notice( $name, $notice_html ) {
149
+ self::add_notice( $name );
150
+ update_option( 'everest_forms_admin_notice_' . $name, wp_kses_post( $notice_html ) );
151
+ }
152
+
153
+ /**
154
+ * Output any stored custom notices.
155
+ */
156
+ public static function output_custom_notices() {
157
+ $notices = self::get_notices();
158
+
159
+ if ( ! empty( $notices ) ) {
160
+ foreach ( $notices as $notice ) {
161
+ if ( empty( self::$core_notices[ $notice ] ) ) {
162
+ $notice_html = get_option( 'everest_forms_admin_notice_' . $notice );
163
+
164
+ if ( $notice_html ) {
165
+ include 'views/html-notice-custom.php';
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ /**
173
+ * If we need to update, include a message with the update button.
174
+ */
175
+ public static function update_notice() {
176
+ if ( version_compare( get_option( 'everest_forms_db_version' ), EVF_VERSION, '<' ) ) {
177
+ $updater = new EVF_Background_Updater();
178
+ if ( $updater->is_updating() || ! empty( $_GET['do_update_everest_forms'] ) ) { // WPCS: input var okay, CSRF ok.
179
+ include 'views/html-notice-updating.php';
180
+ } else {
181
+ include 'views/html-notice-update.php';
182
+ }
183
+ } else {
184
+ include 'views/html-notice-updated.php';
185
+ }
186
+ }
187
+ }
188
+
189
+ EVF_Admin_Notices::init();
includes/admin/class-evf-admin-post-types.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post Types Admin
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Admin_Post_Types', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Post_Types Class.
19
+ *
20
+ * Handles the edit posts views and some functionality on the edit post screen for EVF post types.
21
+ */
22
+ class EVF_Admin_Post_Types {
23
+
24
+ /**
25
+ * Constructor.
26
+ */
27
+ public function __construct() {
28
+ }
29
+
30
+
31
+ }
32
+
33
+ endif;
34
+
35
+ new EVF_Admin_Post_Types();
includes/admin/class-evf-admin-settings.php ADDED
@@ -0,0 +1,755 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin Settings Class
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Admin_Settings', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Settings Class.
19
+ */
20
+ class EVF_Admin_Settings {
21
+
22
+ /**
23
+ * Setting pages.
24
+ *
25
+ * @var array
26
+ */
27
+ private static $settings = array();
28
+
29
+ /**
30
+ * Error messages.
31
+ *
32
+ * @var array
33
+ */
34
+ private static $errors = array();
35
+
36
+ /**
37
+ * Update messages.
38
+ *
39
+ * @var array
40
+ */
41
+ private static $messages = array();
42
+
43
+ /**
44
+ * Include the settings page classes.
45
+ */
46
+ public static function get_settings_pages() {
47
+ if ( empty( self::$settings ) ) {
48
+
49
+ $settings = array();
50
+
51
+ include_once( dirname( __FILE__ ) . '/settings/class-evf-settings-page.php' );
52
+
53
+ $settings[] = include( 'settings/class-evf-settings-general.php' );
54
+ $settings[] = include( 'settings/class-evf-settings-recaptcha.php' );
55
+ $settings[] = include( 'settings/class-evf-settings-email.php' );
56
+ $settings[] = include( 'settings/class-evf-settings-validation.php' );
57
+
58
+ self::$settings = apply_filters( 'everest_forms_get_settings_pages', $settings );
59
+ }
60
+
61
+ return self::$settings;
62
+ }
63
+
64
+ /**
65
+ * Save the settings.
66
+ */
67
+ public static function save() {
68
+ global $current_tab;
69
+
70
+ if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'everest-forms-settings' ) ) {
71
+ die( __( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
72
+ }
73
+
74
+ // Trigger actions
75
+ do_action( 'everest_forms_settings_save');
76
+ do_action( 'everest_forms_update_options' );
77
+
78
+ self::add_message( __( 'Your settings have been saved.', 'everest-forms' ) );
79
+
80
+ // Clear any unwanted data and flush rules
81
+ wp_schedule_single_event( time(), 'everest_forms_flush_rewrite_rules' );
82
+
83
+ do_action( 'everest_forms_settings_saved' );
84
+ }
85
+
86
+ /**
87
+ * Add a message.
88
+ *
89
+ * @param string $text
90
+ */
91
+ public static function add_message( $text ) {
92
+ self::$messages[] = $text;
93
+ }
94
+
95
+ /**
96
+ * Add an error.
97
+ *
98
+ * @param string $text
99
+ */
100
+ public static function add_error( $text ) {
101
+ self::$errors[] = $text;
102
+ }
103
+
104
+ /**
105
+ * Output messages + errors.
106
+ */
107
+ public static function show_messages() {
108
+ if ( sizeof( self::$errors ) > 0 ) {
109
+ foreach ( self::$errors as $error ) {
110
+ echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>';
111
+ }
112
+ } elseif ( sizeof( self::$messages ) > 0 ) {
113
+ foreach ( self::$messages as $message ) {
114
+ echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
115
+ }
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Settings page.
121
+ *
122
+ * Handles the display of the main everest-forms settings page in admin.
123
+ */
124
+ public static function output() {
125
+ global $current_section, $current_tab;
126
+
127
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
128
+
129
+ do_action( 'everest_forms_settings_start' );
130
+
131
+ wp_enqueue_script( 'everest_forms_settings', EVF()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), EVF()->version, true );
132
+
133
+ wp_localize_script( 'everest_forms_settings', 'everest_forms_settings_params', array(
134
+ 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'everest-forms' ),
135
+ ) );
136
+ // Include settings pages
137
+ self::get_settings_pages();
138
+
139
+ $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] );
140
+
141
+ $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] );
142
+ // Get tabs for the settings page
143
+ $tabs = apply_filters( 'everest_forms_settings_tabs_array', array() );
144
+
145
+ include( dirname( __FILE__ ) . '/views/html-admin-settings.php' );
146
+ }
147
+
148
+ /**
149
+ * Get a setting from the settings API.
150
+ *
151
+ * @param string $option_name
152
+ * @param mixed $default
153
+ *
154
+ * @return mixed
155
+ */
156
+ public static function get_option( $option_name, $default = '' ) {
157
+ // Array value
158
+ if ( strstr( $option_name, '[' ) ) {
159
+
160
+ parse_str( $option_name, $option_array );
161
+
162
+ // Option name is first key
163
+ $option_name = current( array_keys( $option_array ) );
164
+
165
+ // Get value
166
+ $option_values = get_option( $option_name, '' );
167
+
168
+ $key = key( $option_array[ $option_name ] );
169
+
170
+ if ( isset( $option_values[ $key ] ) ) {
171
+ $option_value = $option_values[ $key ];
172
+ } else {
173
+ $option_value = null;
174
+ }
175
+
176
+ // Single value
177
+ } else {
178
+ $option_value = get_option( $option_name, null );
179
+ }
180
+
181
+ if ( is_array( $option_value ) ) {
182
+ $option_value = array_map( 'stripslashes', $option_value );
183
+ } elseif ( ! is_null( $option_value ) ) {
184
+ $option_value = stripslashes( $option_value );
185
+ }
186
+
187
+ return ( null === $option_value ) ? $default : $option_value;
188
+ }
189
+
190
+ /**
191
+ * Output admin fields.
192
+ *
193
+ * Loops though the everest-forms options array and outputs each field.
194
+ *
195
+ * @param array[] $options Opens array to output
196
+ */
197
+ public static function output_fields( $options ) {
198
+ foreach ( $options as $value ) {
199
+ if ( ! isset( $value['type'] ) ) {
200
+ continue;
201
+ }
202
+ if ( ! isset( $value['id'] ) ) {
203
+ $value['id'] = '';
204
+ }
205
+ if ( ! isset( $value['title'] ) ) {
206
+ $value['title'] = isset( $value['name'] ) ? $value['name'] : '';
207
+ }
208
+ if ( ! isset( $value['class'] ) ) {
209
+ $value['class'] = '';
210
+ }
211
+ if ( ! isset( $value['css'] ) ) {
212
+ $value['css'] = '';
213
+ }
214
+ if ( ! isset( $value['default'] ) ) {
215
+ $value['default'] = '';
216
+ }
217
+ if ( ! isset( $value['desc'] ) ) {
218
+ $value['desc'] = '';
219
+ }
220
+ if ( ! isset( $value['desc_tip'] ) ) {
221
+ $value['desc_tip'] = false;
222
+ }
223
+ if ( ! isset( $value['placeholder'] ) ) {
224
+ $value['placeholder'] = '';
225
+ }
226
+
227
+ // Custom attribute handling
228
+ $custom_attributes = array();
229
+
230
+ if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
231
+ foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
232
+ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
233
+ }
234
+ }
235
+
236
+ // Description handling
237
+ $field_description = self::get_field_description( $value );
238
+ extract( $field_description );
239
+
240
+ // Switch based on type
241
+ switch ( $value['type'] ) {
242
+
243
+ // Section Titles
244
+ case 'title':
245
+ if ( ! empty( $value['title'] ) ) {
246
+ echo '<h2>' . esc_html( $value['title'] ) . '</h2>';
247
+ }
248
+ if ( ! empty( $value['desc'] ) ) {
249
+ echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) );
250
+ }
251
+ echo '<table class="form-table">' . "\n\n";
252
+ if ( ! empty( $value['id'] ) ) {
253
+ do_action( 'everest_forms_settings_' . sanitize_title( $value['id'] ) );
254
+ }
255
+ break;
256
+
257
+ // Section Ends
258
+ case 'sectionend':
259
+ if ( ! empty( $value['id'] ) ) {
260
+ do_action( 'everest_forms_settings_' . sanitize_title( $value['id'] ) . '_end' );
261
+ }
262
+ echo '</table>';
263
+ if ( ! empty( $value['id'] ) ) {
264
+ do_action( 'everest_forms_settings_' . sanitize_title( $value['id'] ) . '_after' );
265
+ }
266
+ break;
267
+
268
+ // Standard text inputs and subtypes like 'number'
269
+ case 'text':
270
+ case 'email':
271
+ case 'number':
272
+ case 'password' :
273
+ $option_value = self::get_option( $value['id'], $value['default'] );
274
+
275
+ ?><tr valign="top">
276
+ <th scope="row" class="titledesc">
277
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
278
+ <?php echo $tooltip_html; ?>
279
+ </th>
280
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
281
+ <input
282
+ name="<?php echo esc_attr( $value['id'] ); ?>"
283
+ id="<?php echo esc_attr( $value['id'] ); ?>"
284
+ type="<?php echo esc_attr( $value['type'] ); ?>"
285
+ style="<?php echo esc_attr( $value['css'] ); ?>"
286
+ value="<?php echo esc_attr( $option_value ); ?>"
287
+ class="<?php echo esc_attr( $value['class'] ); ?>"
288
+ placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
289
+ <?php echo implode( ' ', $custom_attributes ); ?>
290
+ /> <?php echo $description; ?>
291
+ </td>
292
+ </tr><?php
293
+ break;
294
+
295
+ // Color picker.
296
+ case 'color' :
297
+ $option_value = self::get_option( $value['id'], $value['default'] );
298
+
299
+ ?><tr valign="top">
300
+ <th scope="row" class="titledesc">
301
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
302
+ <?php echo $tooltip_html; ?>
303
+ </th>
304
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">&lrm;
305
+ <span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"></span>
306
+ <input
307
+ name="<?php echo esc_attr( $value['id'] ); ?>"
308
+ id="<?php echo esc_attr( $value['id'] ); ?>"
309
+ type="text"
310
+ dir="ltr"
311
+ style="<?php echo esc_attr( $value['css'] ); ?>"
312
+ value="<?php echo esc_attr( $option_value ); ?>"
313
+ class="<?php echo esc_attr( $value['class'] ); ?>colorpick"
314
+ placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
315
+ <?php echo implode( ' ', $custom_attributes ); ?>
316
+ />&lrm; <?php echo $description; ?>
317
+ <div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
318
+ </td>
319
+ </tr><?php
320
+ break;
321
+
322
+ // Textarea
323
+ case 'textarea':
324
+
325
+ $option_value = self::get_option( $value['id'], $value['default'] );
326
+
327
+ ?><tr valign="top">
328
+ <th scope="row" class="titledesc">
329
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
330
+ <?php echo $tooltip_html; ?>
331
+ </th>
332
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
333
+ <?php echo $description; ?>
334
+
335
+ <textarea
336
+ name="<?php echo esc_attr( $value['id'] ); ?>"
337
+ id="<?php echo esc_attr( $value['id'] ); ?>"
338
+ style="<?php echo esc_attr( $value['css'] ); ?>"
339
+ class="<?php echo esc_attr( $value['class'] ); ?>"
340
+ placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
341
+ <?php echo implode( ' ', $custom_attributes ); ?>
342
+ ><?php echo esc_textarea( $option_value ); ?></textarea>
343
+ </td>
344
+ </tr><?php
345
+ break;
346
+
347
+ // Select boxes
348
+ case 'select' :
349
+ case 'multiselect' :
350
+
351
+ $option_value = self::get_option( $value['id'], $value['default'] );
352
+
353
+ ?><tr valign="top">
354
+ <th scope="row" class="titledesc">
355
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
356
+ <?php echo $tooltip_html; ?>
357
+ </th>
358
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
359
+ <select
360
+ name="<?php echo esc_attr( $value['id'] ); ?><?php echo ( 'multiselect' === $value['type'] ) ? '[]' : ''; ?>"
361
+ id="<?php echo esc_attr( $value['id'] ); ?>"
362
+ style="<?php echo esc_attr( $value['css'] ); ?>"
363
+ class="<?php echo esc_attr( $value['class'] ); ?>"
364
+ <?php echo implode( ' ', $custom_attributes ); ?>
365
+ <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
366
+ >
367
+ <?php
368
+ foreach ( $value['options'] as $key => $val ) {
369
+ ?>
370
+ <option value="<?php echo esc_attr( $key ); ?>" <?php
371
+
372
+ if ( is_array( $option_value ) ) {
373
+ selected( in_array( $key, $option_value ), true );
374
+ } else {
375
+ selected( $option_value, $key );
376
+ }
377
+
378
+ ?>><?php echo $val ?></option>
379
+ <?php
380
+ }
381
+ ?>
382
+ </select> <?php echo $description; ?>
383
+ </td>
384
+ </tr><?php
385
+ break;
386
+
387
+ // Radio inputs
388
+ case 'radio' :
389
+
390
+ $option_value = self::get_option( $value['id'], $value['default'] );
391
+
392
+ ?><tr valign="top">
393
+ <th scope="row" class="titledesc">
394
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
395
+ <?php echo $tooltip_html; ?>
396
+ </th>
397
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
398
+ <fieldset>
399
+ <?php echo $description; ?>
400
+ <ul>
401
+ <?php
402
+ foreach ( $value['options'] as $key => $val ) {
403
+ ?>
404
+ <li>
405
+ <label><input
406
+ name="<?php echo esc_attr( $value['id'] ); ?>"
407
+ value="<?php echo $key; ?>"
408
+ type="radio"
409
+ style="<?php echo esc_attr( $value['css'] ); ?>"
410
+ class="<?php echo esc_attr( $value['class'] ); ?>"
411
+ <?php echo implode( ' ', $custom_attributes ); ?>
412
+ <?php checked( $key, $option_value ); ?>
413
+ /> <?php echo $val ?></label>
414
+ </li>
415
+ <?php
416
+ }
417
+ ?>
418
+ </ul>
419
+ </fieldset>
420
+ </td>
421
+ </tr><?php
422
+ break;
423
+
424
+ // Checkbox input
425
+ case 'checkbox' :
426
+
427
+ $option_value = self::get_option( $value['id'], $value['default'] );
428
+ $visibility_class = array();
429
+
430
+ if ( ! isset( $value['hide_if_checked'] ) ) {
431
+ $value['hide_if_checked'] = false;
432
+ }
433
+ if ( ! isset( $value['show_if_checked'] ) ) {
434
+ $value['show_if_checked'] = false;
435
+ }
436
+ if ( 'yes' == $value['hide_if_checked'] || 'yes' == $value['show_if_checked'] ) {
437
+ $visibility_class[] = 'hidden_option';
438
+ }
439
+ if ( 'option' == $value['hide_if_checked'] ) {
440
+ $visibility_class[] = 'hide_options_if_checked';
441
+ }
442
+ if ( 'option' == $value['show_if_checked'] ) {
443
+ $visibility_class[] = 'show_options_if_checked';
444
+ }
445
+
446
+ if ( ! isset( $value['checkboxgroup'] ) || 'start' == $value['checkboxgroup'] ) {
447
+ ?>
448
+ <tr valign="top" class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>">
449
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
450
+ <td class="forminp forminp-checkbox">
451
+ <fieldset>
452
+ <?php
453
+ } else {
454
+ ?>
455
+ <fieldset class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>">
456
+ <?php
457
+ }
458
+
459
+ if ( ! empty( $value['title'] ) ) {
460
+ ?>
461
+ <legend class="screen-reader-text"><span><?php echo esc_html( $value['title'] ) ?></span></legend>
462
+ <?php
463
+ }
464
+
465
+ ?>
466
+ <label for="<?php echo $value['id'] ?>">
467
+ <input
468
+ name="<?php echo esc_attr( $value['id'] ); ?>"
469
+ id="<?php echo esc_attr( $value['id'] ); ?>"
470
+ type="checkbox"
471
+ class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
472
+ value="1"
473
+ <?php checked( $option_value, 'yes' ); ?>
474
+ <?php echo implode( ' ', $custom_attributes ); ?>
475
+ /> <?php echo $description ?>
476
+ </label> <?php echo $tooltip_html; ?>
477
+ <?php
478
+
479
+ if ( ! isset( $value['checkboxgroup'] ) || 'end' == $value['checkboxgroup'] ) {
480
+ ?>
481
+ </fieldset>
482
+ </td>
483
+ </tr>
484
+ <?php
485
+ } else {
486
+ ?>
487
+ </fieldset>
488
+ <?php
489
+ }
490
+ break;
491
+
492
+ // Image width settings
493
+ case 'image_width' :
494
+
495
+ $image_size = str_replace( '_image_size', '', $value['id'] );
496
+ $size = evf_get_image_size( $image_size );
497
+ $width = isset( $size['width'] ) ? $size['width'] : $value['default']['width'];
498
+ $height = isset( $size['height'] ) ? $size['height'] : $value['default']['height'];
499
+ $crop = isset( $size['crop'] ) ? $size['crop'] : $value['default']['crop'];
500
+ $disabled_attr = '';
501
+ $disabled_message = '';
502
+
503
+ if ( has_filter( 'everest_forms_get_image_size_' . $image_size ) ) {
504
+ $disabled_attr = 'disabled="disabled"';
505
+ $disabled_message = "<p><small>" . __( 'The settings of this image size have been disabled because its values are being overwritten by a filter.', 'everest-forms' ) . "</small></p>";
506
+ }
507
+
508
+ ?><tr valign="top">
509
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?> <?php echo $tooltip_html . $disabled_message; ?></th>
510
+ <td class="forminp image_width_settings">
511
+
512
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> &times; <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
513
+
514
+ <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" value="1" <?php checked( 1, $crop ); ?> /> <?php _e( 'Hard crop?', 'everest-forms' ); ?></label>
515
+
516
+ </td>
517
+ </tr><?php
518
+ break;
519
+
520
+ // Single page selects
521
+ case 'single_select_page' :
522
+
523
+ $args = array(
524
+ 'name' => $value['id'],
525
+ 'id' => $value['id'],
526
+ 'sort_column' => 'menu_order',
527
+ 'sort_order' => 'ASC',
528
+ 'show_option_none' => ' ',
529
+ 'class' => $value['class'],
530
+ 'echo' => false,
531
+ 'selected' => absint( self::get_option( $value['id'] ) ),
532
+ );
533
+
534
+ if ( isset( $value['args'] ) ) {
535
+ $args = wp_parse_args( $value['args'], $args );
536
+ }
537
+
538
+ ?><tr valign="top" class="single_select_page">
539
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?> <?php echo $tooltip_html; ?></th>
540
+ <td class="forminp">
541
+ <?php echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page&hellip;', 'everest-forms' ) . "' style='" . $value['css'] . "' class='" . $value['class'] . "' id=", wp_dropdown_pages( $args ) ); ?> <?php echo $description; ?>
542
+ </td>
543
+ </tr><?php
544
+ break;
545
+ case 'tinymce':
546
+
547
+ $settings = array(
548
+ 'name' => esc_attr($value['id']),
549
+ 'id' => esc_attr( $value['id'] ),
550
+ 'style' => esc_attr( $value['css'] ),
551
+ 'default' => esc_attr($value['default']),
552
+ 'media_buttons' => false,
553
+ 'class'=> esc_attr( $value['class'] ),
554
+ 'quicktags' => array( 'buttons' => 'em,strong,link' ),
555
+ 'tinymce' => array(
556
+ 'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
557
+ 'theme_advanced_buttons2' => '',
558
+ ),
559
+ 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
560
+ );
561
+
562
+ $option_value = self::get_option( $value['id'], $value['default'] );
563
+
564
+ ?><tr valign="top" class="<?php echo esc_attr( $value['class'] ); ?>">
565
+ <th scope="row" class="titledesc">
566
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
567
+ <?php echo $tooltip_html; ?>
568
+ </th>
569
+ <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
570
+ <?php echo $description; ?>
571
+
572
+ <?php wp_editor($option_value, $value['id'], $settings);?>
573
+ </td>
574
+ </tr><?php
575
+ break;
576
+
577
+ // Default: run an action
578
+ default:
579
+ do_action( 'everest_forms_admin_field_' . $value['type'], $value );
580
+ break;
581
+ }
582
+ }
583
+ }
584
+
585
+ /**
586
+ * Helper function to get the formatted description and tip HTML for a
587
+ * given form field. Plugins can call this when implementing their own custom
588
+ * settings types.
589
+ *
590
+ * @param array $value The form field value array
591
+ *
592
+ * @return array The description and tip as a 2 element array
593
+ */
594
+ public static function get_field_description( $value ) {
595
+ $description = '';
596
+ $tooltip_html = '';
597
+
598
+ if ( true === $value['desc_tip'] ) {
599
+ $tooltip_html = $value['desc'];
600
+ } elseif ( ! empty( $value['desc_tip'] ) ) {
601
+ $description = $value['desc'];
602
+ $tooltip_html = $value['desc_tip'];
603
+ } elseif ( ! empty( $value['desc'] ) ) {
604
+ $description = $value['desc'];
605
+ }
606
+
607
+ if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ) ) ) {
608
+ $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>';
609
+ } elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) {
610
+ $description = wp_kses_post( $description );
611
+ } elseif ( $description ) {
612
+ $description = '<span class="description">' . wp_kses_post( $description ) . '</span>';
613
+ }
614
+
615
+ if ( $tooltip_html && in_array( $value['type'], array( 'checkbox' ) ) ) {
616
+ $tooltip_html = '<p class="description">' . $tooltip_html . '</p>';
617
+ } elseif ( $tooltip_html ) {
618
+ $tooltip_html = evf_help_tip( $tooltip_html );
619
+ }
620
+
621
+ return array(
622
+ 'description' => $description,
623
+ 'tooltip_html' => $tooltip_html,
624
+ );
625
+ }
626
+
627
+ /**
628
+ * Save admin fields.
629
+ *
630
+ * Loops though the everest-forms options array and outputs each field.
631
+ *
632
+ * @param array $options Options array to output
633
+ * @param array $data Optional. Data to use for saving. Defaults to $_POST.
634
+ *
635
+ * @return bool
636
+ */
637
+ public static function save_fields( $options, $data = null ) {
638
+
639
+ if ( is_null( $data ) ) {
640
+ $data = $_POST;
641
+ }
642
+ if ( empty( $data ) ) {
643
+ return false;
644
+ }
645
+
646
+
647
+ // Options to update will be stored here and saved later.
648
+ $update_options = array();
649
+
650
+ // Loop options and get values to save.
651
+ foreach ( $options as $option ) {
652
+ if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
653
+ continue;
654
+ }
655
+
656
+ // Get posted value.
657
+ if ( strstr( $option['id'], '[' ) ) {
658
+ parse_str( $option['id'], $option_name_array );
659
+ $option_name = current( array_keys( $option_name_array ) );
660
+ $setting_name = key( $option_name_array[ $option_name ] );
661
+ $raw_value = isset( $data[ $option_name ][ $setting_name ] ) ? wp_unslash( $data[ $option_name ][ $setting_name ] ) : null;
662
+ } else {
663
+ $option_name = $option['id'];
664
+ $setting_name = '';
665
+ $raw_value = isset( $data[ $option['id'] ] ) ? wp_unslash( $data[ $option['id'] ] ) : null;
666
+ }
667
+
668
+ // Format the value based on option type.
669
+ switch ( $option['type'] ) {
670
+ case 'checkbox' :
671
+ $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
672
+ break;
673
+ case 'textarea' :
674
+ $value = wp_kses_post( trim( $raw_value ) );
675
+ break;
676
+ case 'multiselect' :
677
+ case 'multi_select_countries' :
678
+ $value = array_filter( array_map( 'evf_clean', (array) $raw_value ) );
679
+ break;
680
+ case 'image_width' :
681
+ $value = array();
682
+ if ( isset( $raw_value['width'] ) ) {
683
+ $value['width'] = evf_clean( $raw_value['width'] );
684
+ $value['height'] = evf_clean( $raw_value['height'] );
685
+ $value['crop'] = isset( $raw_value['crop'] ) ? 1 : 0;
686
+ } else {
687
+ $value['width'] = $option['default']['width'];
688
+ $value['height'] = $option['default']['height'];
689
+ $value['crop'] = $option['default']['crop'];
690
+ }
691
+ break;
692
+ case 'select':
693
+ $allowed_values = empty( $option['options'] ) ? array() : array_keys( $option['options'] );
694
+ if ( empty( $option['default'] ) && empty( $allowed_values ) ) {
695
+ $value = null;
696
+ break;
697
+ }
698
+ $default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] );
699
+ $value = in_array( $raw_value, $allowed_values ) ? $raw_value : $default;
700
+ break;
701
+ case 'tinymce':
702
+ $value = wpautop( $raw_value );
703
+ break;
704
+ default :
705
+ $value = evf_clean( $raw_value );
706
+ break;
707
+ }
708
+
709
+
710
+ /**
711
+ * Sanitize the value of an option.
712
+ * @since 1.0.0
713
+ */
714
+ $value = apply_filters( 'everest_forms_admin_settings_sanitize_option', $value, $option, $raw_value );
715
+
716
+ /**
717
+ * Sanitize the value of an option by option name.
718
+ * @since 1.0.0
719
+ */
720
+ $value = apply_filters( "everest_forms_admin_settings_sanitize_option_$option_name", $value, $option, $raw_value );
721
+
722
+ if ( is_null( $value ) ) {
723
+ continue;
724
+ }
725
+
726
+ // Check if option is an array and handle that differently to single values.
727
+ if ( $option_name && $setting_name ) {
728
+ if ( ! isset( $update_options[ $option_name ] ) ) {
729
+ $update_options[ $option_name ] = get_option( $option_name, array() );
730
+ }
731
+ if ( ! is_array( $update_options[ $option_name ] ) ) {
732
+ $update_options[ $option_name ] = array();
733
+ }
734
+ $update_options[ $option_name ][ $setting_name ] = $value;
735
+ } else {
736
+ $update_options[ $option_name ] = $value;
737
+ }
738
+
739
+ /**
740
+ * Fire an action before saved.
741
+ * @deprecated 2.4.0 - doesn't allow manipulation of values!
742
+ */
743
+ do_action( 'everest_forms_update_option', $option );
744
+ }
745
+
746
+ // Save all options in our array.
747
+ foreach ( $update_options as $name => $value ) {
748
+ update_option( $name, $value );
749
+ }
750
+
751
+ return true;
752
+ }
753
+ }
754
+
755
+ endif;
includes/admin/class-evf-admin-status.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Debug/Status page
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin/System Status
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * EVF_Admin_Status Class.
17
+ */
18
+ class EVF_Admin_Status {
19
+
20
+ /**
21
+ * Handles output of the reports page in admin.
22
+ */
23
+ public static function output() {
24
+ include_once( dirname( __FILE__ ) . '/views/html-admin-page-status.php' );
25
+ }
26
+
27
+
28
+ /**
29
+ * Show the logs page.
30
+ */
31
+ public static function status_logs() {
32
+
33
+ self::status_logs_file();
34
+
35
+ }
36
+
37
+ /**
38
+ * Show the log page contents for file log handler.
39
+ */
40
+ public static function status_logs_file() {
41
+
42
+ $logs = self::scan_log_files();
43
+
44
+ if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( $_REQUEST['log_file'] ) ] ) ) {
45
+ $viewed_log = $logs[ sanitize_title( $_REQUEST['log_file'] ) ];
46
+ } elseif ( ! empty( $logs ) ) {
47
+ $viewed_log = current( $logs );
48
+ }
49
+
50
+ $handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
51
+
52
+ if ( ! empty( $_REQUEST['handle'] ) ) {
53
+ self::remove_log();
54
+ }
55
+
56
+ include_once( 'views/html-admin-page-status-logs.php' );
57
+ }
58
+
59
+
60
+ /**
61
+ * Retrieve metadata from a file. Based on WP Core's get_file_data function.
62
+ * @since 1.0.0
63
+ *
64
+ * @param string $file Path to the file
65
+ *
66
+ * @return string
67
+ */
68
+ public static function get_file_version( $file ) {
69
+
70
+ // Avoid notices if file does not exist
71
+ if ( ! file_exists( $file ) ) {
72
+ return '';
73
+ }
74
+
75
+ // We don't need to write to the file, so just open for reading.
76
+ $fp = fopen( $file, 'r' );
77
+
78
+ // Pull only the first 8kiB of the file in.
79
+ $file_data = fread( $fp, 8192 );
80
+
81
+ // PHP will close file handle, but we are good citizens.
82
+ fclose( $fp );
83
+
84
+ // Make sure we catch CR-only line endings.
85
+ $file_data = str_replace( "\r", "\n", $file_data );
86
+ $version = '';
87
+
88
+ if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) {
89
+ $version = _cleanup_header_comment( $match[1] );
90
+ }
91
+
92
+ return $version;
93
+ }
94
+
95
+ /**
96
+ * Return the log file handle.
97
+ *
98
+ * @param string $filename
99
+ *
100
+ * @return string
101
+ */
102
+ public static function get_log_file_handle( $filename ) {
103
+ return substr( $filename, 0, strlen( $filename ) > 37 ? strlen( $filename ) - 37 : strlen( $filename ) - 4 );
104
+ }
105
+
106
+ /**
107
+ * Scan the template files.
108
+ *
109
+ * @param string $template_path
110
+ *
111
+ * @return array
112
+ */
113
+ public static function scan_template_files( $template_path ) {
114
+
115
+ $files = @scandir( $template_path );
116
+ $result = array();
117
+
118
+ if ( ! empty( $files ) ) {
119
+
120
+ foreach ( $files as $key => $value ) {
121
+
122
+ if ( ! in_array( $value, array( ".", ".." ) ) ) {
123
+
124
+ if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
125
+ $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
126
+ foreach ( $sub_files as $sub_file ) {
127
+ $result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
128
+ }
129
+ } else {
130
+ $result[] = $value;
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ return $result;
137
+ }
138
+
139
+ /**
140
+ * Scan the log files.
141
+ * @return array
142
+ */
143
+ public static function scan_log_files() {
144
+ $files = @scandir( EVF_LOG_DIR );
145
+ $result = array();
146
+
147
+ if ( ! empty( $files ) ) {
148
+
149
+ foreach ( $files as $key => $value ) {
150
+
151
+ if ( ! in_array( $value, array( '.', '..' ) ) ) {
152
+ if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
153
+ $result[ sanitize_title( $value ) ] = $value;
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ return $result;
160
+ }
161
+
162
+
163
+ /**
164
+ * Remove/delete the chosen file.
165
+ */
166
+ public static function remove_log() {
167
+ if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'remove_log' ) ) {
168
+ wp_die( __( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
169
+ }
170
+
171
+ if ( ! empty( $_REQUEST['handle'] ) ) {
172
+ $log_handler = new EVF_Log_Handler_File();
173
+ $log_handler->remove( $_REQUEST['handle'] );
174
+ }
175
+
176
+ wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=evf-status&tab=logs' ) ) );
177
+ exit();
178
+ }
179
+ }
includes/admin/class-evf-admin.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin
4
+ *
5
+ * @class EVF_Admin
6
+ * @author WPEverest
7
+ * @category Admin
8
+ * @package EverestForms/Admin
9
+ * @version 1.0.0
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit; // Exit if accessed directly
14
+ }
15
+
16
+ /**
17
+ * EVF_Admin class.
18
+ */
19
+ class EVF_Admin {
20
+
21
+ /**
22
+ * Constructor.
23
+ */
24
+ public function __construct() {
25
+ add_action( 'init', array( $this, 'includes' ) );
26
+ add_action( 'current_screen', array( $this, 'conditional_includes' ) );
27
+ add_action( 'admin_init', array( $this, 'admin_redirects' ) );
28
+ add_action( 'admin_footer', 'evf_print_js', 25 );
29
+ add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
30
+ }
31
+
32
+ /**
33
+ * Include any classes we need within admin.
34
+ */
35
+ public function includes() {
36
+ include_once( dirname( __FILE__ ) . '/evf-admin-functions.php' );
37
+ include_once( dirname( __FILE__ ) . '/class-evf-admin-post-types.php' );
38
+ include_once( dirname( __FILE__ ) . '/class-evf-admin-menus.php' );
39
+ include_once( dirname( __FILE__ ) . '/class-evf-admin-notices.php' );
40
+ include_once( dirname( __FILE__ ) . '/class-evf-admin-assets.php' );
41
+ include_once( dirname( __FILE__ ) . '/class-evf-admin-form-builder.php' );
42
+ include_once( dirname( __FILE__ ) . '/class-evf-add-form.php' );
43
+
44
+ }
45
+
46
+ /**
47
+ * Include admin files conditionally.
48
+ */
49
+ public function conditional_includes() {
50
+ if ( ! $screen = get_current_screen() ) {
51
+ return;
52
+ }
53
+
54
+ switch ( $screen->id ) {
55
+ case 'dashboard' :
56
+ //include( 'class-evf-admin-dashboard.php' );
57
+ break;
58
+ case 'options-permalink' :
59
+ //include( 'class-evf-admin-permalink-settings.php' );
60
+ break;
61
+ case 'plugins' :
62
+ //include( 'plugin-updates/class-evf-plugins-screen-updates.php' );
63
+ break;
64
+ case 'update-core' :
65
+ //include( 'plugin-updates/class-evf-updates-screen-updates.php' );
66
+ break;
67
+ case 'users' :
68
+ case 'user' :
69
+ case 'profile' :
70
+ case 'user-edit' :
71
+ //include( 'class-evf-admin-profile.php' );
72
+ break;
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Handle redirects to setup/welcome page after install and updates.
78
+ *
79
+ * For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
80
+ */
81
+ public function admin_redirects() {
82
+ // Nonced plugin install redirects (whitelisted)
83
+ if ( ! empty( $_GET['evf-install-plugin-redirect'] ) ) {
84
+ $plugin_slug = evf_clean( $_GET['evf-install-plugin-redirect'] );
85
+
86
+ $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug );
87
+ wp_safe_redirect( $url );
88
+ exit;
89
+ }
90
+
91
+ // Setup wizard redirect
92
+ if ( get_transient( '_evf_activation_redirect' ) ) {
93
+ delete_transient( '_evf_activation_redirect' );
94
+
95
+ if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'evf-settings' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_everest_forms' ) || apply_filters( 'everest_forms_prevent_automatic_wizard_redirect', false ) ) {
96
+ return;
97
+ }
98
+
99
+ // If the user needs to install, send them to the setup wizard
100
+ if ( EVF_Admin_Notices::has_notice( 'install' ) ) {
101
+ wp_safe_redirect( admin_url( 'admin.php?page=evf-settings' ) );
102
+ exit;
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Change the admin footer text on EverestForms admin pages.
109
+ *
110
+ * @since 1.0.0
111
+ *
112
+ * @param string $footer_text
113
+ *
114
+ * @return string
115
+ */
116
+ public function admin_footer_text( $footer_text ) {
117
+ if ( ! current_user_can( 'manage_everest_forms' ) || ! function_exists( 'evf_get_screen_ids' ) ) {
118
+ return $footer_text;
119
+ }
120
+ $current_screen = get_current_screen();
121
+ $evf_pages = evf_get_screen_ids();
122
+
123
+ // Check to make sure we're on a EverestForms admin page.
124
+ if ( isset( $current_screen->id ) && apply_filters( 'everest_forms_display_admin_footer_text', in_array( $current_screen->id, $evf_pages ) ) ) {
125
+ // Change the footer text
126
+ if ( ! get_option( 'everest_forms_admin_footer_text_rated' ) ) {
127
+ $footer_text = sprintf(
128
+ /* translators: 1: EverestForms 2:: five stars */
129
+ __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'everest-forms' ),
130
+ sprintf( '<strong>%s</strong>', esc_html__( 'Everest Forms', 'everest-forms' ) ),
131
+ '<a href="https://wordpress.org/support/plugin/everest-forms/reviews?rate=5#new-post" target="_blank" class="evf-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'everest-forms' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
132
+ );
133
+ evf_enqueue_js( "
134
+ jQuery( 'a.evf-rating-link' ).click( function() {
135
+ jQuery.post( '" . EVF()->ajax_url() . "', { action: 'everest_forms_rated' } );
136
+ jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
137
+ });
138
+ " );
139
+ } else {
140
+ $footer_text = __( 'Thank you for selling with EverestForms.', 'everest-forms' );
141
+ }
142
+ }
143
+
144
+ return $footer_text;
145
+ }
146
+
147
+ /**
148
+ * Check on a Jetpack install queued by the Setup Wizard.
149
+ *
150
+ * See: EVF_Admin_Setup_Wizard::install_jetpack()
151
+ */
152
+ public function setup_wizard_check_jetpack() {
153
+ $jetpack_active = class_exists( 'Jetpack' );
154
+
155
+ wp_send_json_success( array(
156
+ 'is_active' => $jetpack_active ? 'yes' : 'no',
157
+ ) );
158
+ }
159
+
160
+ }
161
+
162
+ return new EVF_Admin();
includes/admin/evf-admin-functions.php ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin Functions
4
+ *
5
+ * @package EverestForms/Admin/Functions
6
+ * @version 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Get all EverestForms screen ids.
15
+ *
16
+ * @return array
17
+ */
18
+ function evf_get_screen_ids() {
19
+
20
+ $evf_screen_id = sanitize_title( __( 'Everest Forms', 'everest-forms' ) );
21
+ $screen_ids = array(
22
+ 'toplevel_page_' . $evf_screen_id,
23
+ $evf_screen_id . '_page_edit-evf-form',
24
+ $evf_screen_id . '_page_evf-settings',
25
+ $evf_screen_id . '_page_evf-status',
26
+ $evf_screen_id . '_page_evf-addons',
27
+ );
28
+
29
+ return apply_filters( 'everest_forms_screen_ids', $screen_ids );
30
+ }
31
+
32
+ /**
33
+ * Create a page and store the ID in an option.
34
+ *
35
+ * @param mixed $slug Slug for the new page
36
+ * @param string $option Option name to store the page's ID
37
+ * @param string $page_title (default: '') Title for the new page
38
+ * @param string $page_content (default: '') Content for the new page
39
+ * @param int $post_parent (default: 0) Parent for the new page
40
+ *
41
+ * @return int page ID
42
+ */
43
+ function evf_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) {
44
+ global $wpdb;
45
+
46
+ $option_value = get_option( $option );
47
+
48
+ if ( $option_value > 0 && ( $page_object = get_post( $option_value ) ) ) {
49
+ if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array(
50
+ 'pending',
51
+ 'trash',
52
+ 'future',
53
+ 'auto-draft'
54
+ ) )
55
+ ) {
56
+ // Valid page is already in place
57
+ return $page_object->ID;
58
+ }
59
+ }
60
+
61
+ if ( strlen( $page_content ) > 0 ) {
62
+ // Search for an existing page with the specified page content (typically a shortcode)
63
+ $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
64
+ } else {
65
+ // Search for an existing page with the specified page slug
66
+ $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_name = %s LIMIT 1;", $slug ) );
67
+ }
68
+
69
+ $valid_page_found = apply_filters( 'everest_forms_create_page_id', $valid_page_found, $slug, $page_content );
70
+
71
+ if ( $valid_page_found ) {
72
+ if ( $option ) {
73
+ update_option( $option, $valid_page_found );
74
+ }
75
+
76
+ return $valid_page_found;
77
+ }
78
+
79
+ // Search for a matching valid trashed page
80
+ if ( strlen( $page_content ) > 0 ) {
81
+ // Search for an existing page with the specified page content (typically a shortcode)
82
+ $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
83
+ } else {
84
+ // Search for an existing page with the specified page slug
85
+ $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) );
86
+ }
87
+
88
+ if ( $trashed_page_found ) {
89
+ $page_id = $trashed_page_found;
90
+ $page_data = array(
91
+ 'ID' => $page_id,
92
+ 'post_status' => 'publish',
93
+ );
94
+ wp_update_post( $page_data );
95
+ } else {
96
+ $page_data = array(
97
+ 'post_status' => 'publish',
98
+ 'post_type' => 'page',
99
+ 'post_author' => 1,
100
+ 'post_name' => $slug,
101
+ 'post_title' => $page_title,
102
+ 'post_content' => $page_content,
103
+ 'post_parent' => $post_parent,
104
+ 'comment_status' => 'closed',
105
+ );
106
+ $page_id = wp_insert_post( $page_data );
107
+ }
108
+
109
+ if ( $option ) {
110
+ update_option( $option, $page_id );
111
+ }
112
+
113
+ return $page_id;
114
+ }
115
+
116
+ /**
117
+ * Output admin fields.
118
+ *
119
+ * Loops though the EverestFormsoptions array and outputs each field.
120
+ *
121
+ * @param array $options Opens array to output
122
+ */
123
+ function everest_forms_admin_fields( $options ) {
124
+
125
+ if ( ! class_exists( 'EVF_Admin_Settings', false ) ) {
126
+ include( dirname( __FILE__ ) . '/class-evf-admin-settings.php' );
127
+ }
128
+
129
+ EVF_Admin_Settings::output_fields( $options );
130
+ }
131
+
132
+ /**
133
+ * Update all settings which are passed.
134
+ *
135
+ * @param array $options
136
+ * @param array $data
137
+ */
138
+ function everest_forms_update_options( $options, $data = null ) {
139
+
140
+ if ( ! class_exists( 'EVF_Admin_Settings', false ) ) {
141
+ include( dirname( __FILE__ ) . '/class-evf-admin-settings.php' );
142
+ }
143
+
144
+ EVF_Admin_Settings::save_fields( $options, $data );
145
+ }
146
+
147
+ /**
148
+ * Get a setting from the settings API.
149
+ *
150
+ * @param mixed $option_name
151
+ * @param mixed $default
152
+ *
153
+ * @return string
154
+ */
155
+ function everest_forms_settings_get_option( $option_name, $default = '' ) {
156
+
157
+ if ( ! class_exists( 'EVF_Admin_Settings', false ) ) {
158
+ include( dirname( __FILE__ ) . '/class-evf-admin-settings.php' );
159
+ }
160
+
161
+ return EVF_Admin_Settings::get_option( $option_name, $default );
162
+ }
163
+
164
+ /**
165
+ * Outputs fields to be used on panels (settings etc).
166
+ *
167
+ * @since 1.0.0
168
+ *
169
+ * @param string $option
170
+ * @param string $panel
171
+ * @param string $field
172
+ * @param array $form_data
173
+ * @param string $label
174
+ * @param array $args
175
+ * @param boolean $echo
176
+ *
177
+ * @return string
178
+ */
179
+ function everest_forms_panel_field( $option, $panel, $field, $form_data, $label, $args = array(), $echo = true ) {
180
+
181
+ // Required params
182
+ if ( empty( $option ) || empty( $panel ) || empty( $field ) ) {
183
+ return '';
184
+ }
185
+
186
+ // Setup basic vars
187
+ $panel = esc_attr( $panel );
188
+ $field = esc_attr( $field );
189
+ $panel_id = sanitize_html_class( $panel );
190
+ $parent = ! empty( $args['parent'] ) ? esc_attr( $args['parent'] ) : '';
191
+ $subsection = ! empty( $args['subsection'] ) ? esc_attr( $args['subsection'] ) : '';
192
+ $label = ! empty( $label ) ? $label : '';
193
+ $class = ! empty( $args['class'] ) ? esc_attr( $args['class'] ) : '';
194
+ $input_class = ! empty( $args['input_class'] ) ? esc_attr( $args['input_class'] ) : '';
195
+ $default = isset( $args['default'] ) ? $args['default'] : '';
196
+ $tinymce = isset( $args['tinymce'] ) ? $args['tinymce'] : '';
197
+ $placeholder = ! empty( $args['placeholder'] ) ? esc_attr( $args['placeholder'] ) : '';
198
+ $data_attr = '';
199
+ $output = '';
200
+
201
+ // Check if we should store values in a parent array
202
+ if ( ! empty( $parent ) ) {
203
+ if ( ! empty( $subsection ) ) {
204
+ $field_name = sprintf( '%s[%s][%s][%s]', $parent, $panel, $subsection, $field );
205
+ $value = isset( $form_data[ $parent ][ $panel ][ $subsection ][ $field ] ) ? $form_data[ $parent ][ $panel ][ $subsection ][ $field ] : $default;
206
+ $panel_id = sanitize_html_class( $panel . '-' . $subsection );
207
+ } else {
208
+ $field_name = sprintf( '%s[%s][%s]', $parent, $panel, $field );
209
+ $value = isset( $form_data[ $parent ][ $panel ][ $field ] ) ? $form_data[ $parent ][ $panel ][ $field ] : $default;
210
+ }
211
+ } else {
212
+ $field_name = sprintf( '%s[%s]', $panel, $field );
213
+ $value = isset( $form_data[ $panel ][ $field ] ) ? $form_data[ $panel ][ $field ] : $default;
214
+ }
215
+
216
+ // Check for data attributes
217
+ if ( ! empty( $args['data'] ) ) {
218
+ foreach ( $args['data'] as $key => $val ) {
219
+ if ( is_array( $val ) ) {
220
+ $val = wp_json_encode( $val );
221
+ }
222
+ $data_attr .= ' data-' . $key . '=\'' . $val . '\'';
223
+ }
224
+ }
225
+
226
+ // Determine what field type to output
227
+ switch ( $option ) {
228
+
229
+ // Text input
230
+ case 'text':
231
+
232
+ $type = ! empty( $args['type'] ) ? esc_attr( $args['type'] ) : 'text';
233
+ $output = sprintf(
234
+ '<input type="%s" id="everest-forms-panel-field-%s-%s" name="%s" value="%s" placeholder="%s" class="%s" %s>',
235
+ $type,
236
+ sanitize_html_class( $panel_id ),
237
+ sanitize_html_class( $field ),
238
+ $field_name,
239
+ esc_attr( $value ),
240
+ $placeholder,
241
+ $input_class,
242
+ $data_attr
243
+ );
244
+ break;
245
+
246
+ // Textarea
247
+ case 'textarea':
248
+ $rows = ! empty( $args['rows'] ) ? (int) $args['rows'] : '3';
249
+ $output = sprintf(
250
+ '<textarea id="everest-forms-panel-field-%s-%s" name="%s" rows="%d" placeholder="%s" class="%s" %s>%s</textarea>',
251
+ sanitize_html_class( $panel_id ),
252
+ sanitize_html_class( $field ),
253
+ $field_name,
254
+ $rows,
255
+ $placeholder,
256
+ $input_class,
257
+ $data_attr,
258
+ esc_textarea( $value )
259
+ );
260
+ break;
261
+
262
+ // TinyMCE
263
+ case 'tinymce':
264
+ $args = wp_parse_args( $tinymce, array(
265
+ 'media_buttons' => false,
266
+ 'tinymce' => false,
267
+ ) );
268
+ $args['textarea_name'] = $field_name;
269
+ $args['teeny'] = true;
270
+ $id = 'everest-forms-panel-field-' . sanitize_html_class( $panel_id ) . '-' . sanitize_html_class( $field );
271
+ $id = str_replace( '-', '_', $id );
272
+ ob_start();
273
+ wp_editor( $value, $id, $args );
274
+ $output = ob_get_clean();
275
+ break;
276
+
277
+ // Checkbox
278
+ case 'checkbox':
279
+ $checked = checked( '1', $value, false );
280
+ $checkbox = sprintf(
281
+ '<input type="checkbox" id="everest-forms-panel-field-%s-%s" name="%s" value="1" class="%s" %s %s>',
282
+ sanitize_html_class( $panel_id ),
283
+ sanitize_html_class( $field ),
284
+ $field_name,
285
+ $input_class,
286
+ $checked,
287
+ $data_attr
288
+ );
289
+ $output = sprintf(
290
+ '<label for="everest-forms-panel-field-%s-%s" class="inline">%s',
291
+ sanitize_html_class( $panel_id ),
292
+ sanitize_html_class( $field ),
293
+ $checkbox . $label
294
+ );
295
+ if ( ! empty( $args['tooltip'] ) ) {
296
+ $output .= sprintf( ' <i class="dashicons dashicons-editor-help everest-forms-help-tooltip" title="%s"></i>', esc_attr( $args['tooltip'] ) );
297
+ }
298
+ $output .= '</label>';
299
+ break;
300
+
301
+ // Radio
302
+ case 'radio':
303
+ $options = $args['options'];
304
+ $x = 1;
305
+ $output = '';
306
+ foreach ( $options as $key => $item ) {
307
+ if ( empty( $item['label'] ) ) {
308
+ continue;
309
+ }
310
+ $checked = checked( $key, $value, false );
311
+ $output .= sprintf(
312
+ '<span class="row"><input type="radio" id="everest-forms-panel-field-%s-%s-%d" name="%s" value="%s" class="%s" %s %s>',
313
+ sanitize_html_class( $panel_id ),
314
+ sanitize_html_class( $field ),
315
+ $x,
316
+ $field_name,
317
+ $key,
318
+ $input_class,
319
+ $checked,
320
+ $data_attr
321
+ );
322
+ $output .= sprintf(
323
+ '<label for="everest-forms-panel-field-%s-%s-%d" class="inline">%s',
324
+ sanitize_html_class( $panel_id ),
325
+ sanitize_html_class( $field ),
326
+ $x,
327
+ $item['label']
328
+ );
329
+ if ( ! empty( $item['tooltip'] ) ) {
330
+ $output .= sprintf( ' <i class="dashicons dashicons-editor-help everest-forms-help-tooltip" title="%s"></i>', esc_attr( $item['tooltip'] ) );
331
+ }
332
+ $output .= '</label></span>';
333
+ $x ++;
334
+ }
335
+ break;
336
+
337
+ // Select
338
+ case 'select':
339
+ if ( empty( $args['options'] ) && empty( $args['field_map'] ) ) {
340
+ return '';
341
+ }
342
+
343
+ if ( ! empty( $args['field_map'] ) ) {
344
+ $options = array();
345
+ $available_fields = evf_get_form_fields( $form_data, $args['field_map'] );
346
+ if ( ! empty( $available_fields ) ) {
347
+ foreach ( $available_fields as $id => $available_field ) {
348
+ $lbl = ! empty( $available_field['label'] ) ? esc_attr( $available_field['label'] ) : __( 'Field #', 'everest-forms' ) . $id;
349
+ $options[ $id ] = $lbl;
350
+ }
351
+ }
352
+ $input_class .= ' everest-forms-field-map-select';
353
+ $data_attr .= ' data-field-map-allowed="' . implode( ' ', $args['field_map'] ) . '"';
354
+ if ( ! empty( $placeholder ) ) {
355
+ $data_attr .= ' data-field-map-placeholder="' . esc_attr( $placeholder ) . '"';
356
+ }
357
+ } else {
358
+ $options = $args['options'];
359
+ }
360
+
361
+ $output = sprintf(
362
+ '<select id="everest-forms-panel-field-%s-%s" name="%s" class="%s" %s>',
363
+ sanitize_html_class( $panel_id ),
364
+ sanitize_html_class( $field ),
365
+ $field_name,
366
+ $input_class,
367
+ $data_attr
368
+ );
369
+
370
+ if ( ! empty( $placeholder ) ) {
371
+ $output .= '<option value="">' . $placeholder . '</option>';
372
+ }
373
+
374
+ foreach ( $options as $key => $item ) {
375
+ $output .= sprintf( '<option value="%s" %s>%s</option>', esc_attr( $key ), selected( $key, $value, false ), $item );
376
+ }
377
+
378
+ $output .= '</select>';
379
+ break;
380
+ }
381
+
382
+ // Put the pieces together....
383
+ $field_open = sprintf(
384
+ '<div id="everest-forms-panel-field-%s-%s-wrap" class="everest-forms-panel-field %s %s">',
385
+ sanitize_html_class( $panel_id ),
386
+ sanitize_html_class( $field ),
387
+ $class,
388
+ 'everest-forms-panel-field-' . sanitize_html_class( $option )
389
+ );
390
+ $field_open .= ! empty( $args['before'] ) ? $args['before'] : '';
391
+ if ( ! in_array( $option, array( 'checkbox' ), true ) && ! empty( $label ) ) {
392
+ $field_label = sprintf(
393
+ '<label for="everest-forms-panel-field-%s-%s">%s',
394
+ sanitize_html_class( $panel_id ),
395
+ sanitize_html_class( $field ),
396
+ $label
397
+ );
398
+ if ( ! empty( $args['tooltip'] ) ) {
399
+ $field_label .= sprintf( ' <i class="dashicons dashicons-editor-help everest-forms-help-tooltip" title="%s"></i>', esc_attr( $args['tooltip'] ) );
400
+ }
401
+ if ( ! empty( $args['after_tooltip'] ) ) {
402
+ $field_label .= $args['after_tooltip'];
403
+ }
404
+
405
+ $field_label .= '</label>';
406
+ } else {
407
+ $field_label = '';
408
+ }
409
+ $field_close = ! empty( $args['after'] ) ? $args['after'] : '';
410
+ $field_close .= '</div>';
411
+ $output = $field_open . $field_label . $output . $field_close;
412
+
413
+ // Wash our hands.
414
+ if ( $echo ) {
415
+ echo $output;
416
+ } else {
417
+ return $output;
418
+ }
419
+ }
includes/admin/form-panels/class-evf-fields-panel.php ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin
4
+ *
5
+ * @package EverestForms/Admin/FormPanel
6
+ * @version 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * EVF_Fields_Panel class.
15
+ */
16
+ class EVF_Fields_Panel extends EVF_Admin_Form_Panel {
17
+
18
+ /**
19
+ * All systems go.
20
+ */
21
+ public function init() {
22
+ // Define panel information.
23
+ $this->name = __( 'Fields', 'everest-forms' );
24
+ $this->slug = 'fields';
25
+ $this->icon = 'dashicons dashicons-archive';
26
+ $this->order = 10;
27
+ $this->sidebar = true;
28
+
29
+ if ( $this->form ) {
30
+ add_action( 'everest_forms_builder_fields', array( $this, 'fields' ) );
31
+ add_action( 'everest_forms_builder_fields_options', array( $this, 'fields_options' ) );
32
+ add_action( 'everest_forms_builder_preview', array( $this, 'preview' ) );
33
+ }
34
+ add_action( 'everest_forms_builder_fields', array( $this, 'fields' ) );
35
+ }
36
+
37
+ /**
38
+ * Enqueue assets for the Fields panel.
39
+ */
40
+ public function enqueues() {}
41
+
42
+ /**
43
+ * Outputs the Field panel sidebar.
44
+ */
45
+ public function panel_sidebar() {
46
+ ?>
47
+ <div class="everest-forms-add-fields everest-forms-tab-content">
48
+ <?php do_action( 'everest_forms_builder_fields', $this->form ); ?>
49
+ </div>
50
+ <div class="everest-forms-field-options everest-forms-tab-content">
51
+ <?php do_action( 'everest_forms_builder_fields_options', $this->form ); ?>
52
+ </div>
53
+ <?php
54
+ }
55
+
56
+ /**
57
+ * Outputs the Field panel primary content.
58
+ *
59
+ * @since 1.0.0
60
+ */
61
+ public function panel_content() {
62
+ ?>
63
+ <div class="everest-forms-preview-wrap">
64
+
65
+ <div class="everest-forms-preview">
66
+
67
+ <div class="everest-forms-title-desc">
68
+ <h2 class="everest-forms-form-name"><?php echo esc_html( $this->form->post_title ); echo ' (ID #'.$this->form->ID.')'; ?></h2>
69
+
70
+ </div>
71
+
72
+ <div class="everest-forms-field-wrap">
73
+ <?php do_action( 'everest_forms_builder_preview', $this->form ); ?>
74
+ </div>
75
+
76
+ <?php
77
+ //$submit = ! empty( $this->form_data['settings']['submit_text'] ) ? esc_attr( $this->form_data['settings']['submit_text'] ) : __( 'Submit', 'everest-forms' );
78
+ //printf( '<p class="everest-forms-field-submit"><input type="submit" value="%s" class="everest-forms-field-submit-button"></p>', $submit );
79
+ ?>
80
+
81
+ </div>
82
+
83
+ </div>
84
+ <?php
85
+ }
86
+
87
+ /**
88
+ * Builder field butttons.
89
+ *
90
+ * @since 1.0.0
91
+ */
92
+ public function fields() {
93
+
94
+ $fields = array(
95
+ 'general' => array(
96
+ 'group_name' => __( 'General Fields', 'everest-forms' ),
97
+ 'fields' => array(),
98
+ ),
99
+ 'advanced' => array(
100
+ 'group_name' => __( 'Advanced Fields', 'everest-forms' ),
101
+ 'fields' => array(),
102
+ ),
103
+ );
104
+ $fields = apply_filters( 'everest_forms_builder_fields_buttons', $fields );
105
+
106
+ // Output the buttons
107
+ foreach ( $fields as $id => $group ) {
108
+
109
+ usort( $group['fields'], array( $this, 'field_order' ) );
110
+
111
+ echo '<div class="everest-forms-add-fields-group open">';
112
+
113
+ echo '<a href="#" class="everest-forms-add-fields-heading" data-group="' . esc_attr( $id ) . '">';
114
+
115
+ echo esc_html( $group['group_name'] );
116
+
117
+ echo '<i class="handlediv hidden"></i>';
118
+
119
+ echo '</a>';
120
+
121
+ echo '<div class="evf-registered-buttons">';
122
+
123
+ foreach ( $group['fields'] as $field ) {
124
+
125
+ $class = ! empty( $field['class'] ) ? sanitize_html_class( $field['class'] ) : '';
126
+
127
+ echo '<button type="button" class="evf-registered-item ' . $class . '" id="everest-forms-add-fields-' . esc_attr( $field['type'] ) . '" data-field-type="' . esc_attr( $field['type'] ) . '">';
128
+ if ( $field['icon'] ) {
129
+ echo '<i class="' . esc_attr( $field['icon'] ) . '"></i> ';
130
+ }
131
+ echo esc_html( $field['name'] );
132
+ echo '</button>';
133
+ }
134
+
135
+ echo '</div>';
136
+
137
+ echo '</div>';
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Editor Field Options.
143
+ *
144
+ * @since 1.0.0
145
+ */
146
+ public function fields_options() {
147
+
148
+ // Check to make sure the form actually has fields created already
149
+ if ( empty( $this->form_data['form_fields'] ) ) {
150
+ printf( '<p class="no-fields">%s</p>', __( "You don't have any fields yet.", 'everest-forms' ) );
151
+
152
+ return;
153
+ }
154
+
155
+ $fields = $this->form_data['form_fields'];
156
+
157
+ foreach ( $fields as $field ) {
158
+
159
+ $class = apply_filters( 'everest_forms_builder_field_option_class', '', $field );
160
+
161
+ printf( '<div class="everest-forms-field-option everest-forms-field-option-%s %s" id="everest-forms-field-option-%s" data-field-id="%s">', esc_attr( $field['type'] ), $class, $field['id'], $field['id'] );
162
+
163
+ printf( '<input type="hidden" name="form_fields[%s][id]" value="%s" class="everest-forms-field-option-hidden-id">', $field['id'], $field['id'] );
164
+
165
+ printf( '<input type="hidden" name="form_fields[%s][type]" value="%s" class="everest-forms-field-option-hidden-type">', $field['id'], esc_attr( $field['type'] ) );
166
+
167
+ do_action( "everest_forms_builder_fields_options_{$field['type']}", $field );
168
+
169
+ echo '</div>';
170
+ }
171
+ }
172
+
173
+ /**
174
+ *
175
+ *
176
+ * @since 1.0.0
177
+ */
178
+ public function preview() {
179
+
180
+
181
+ $this->everest_forms_builder_preview();
182
+
183
+ }
184
+
185
+ /**
186
+ * @param $field
187
+ */
188
+ public function field_preview( $field ) {
189
+
190
+ $field['required'] = isset( $field['required'] ) ? $field['required'] : 0;
191
+ $css = ! empty( $field['size'] ) ? 'size-' . esc_attr( $field['size'] ) : '';
192
+ $css .= ! empty( $field['label_hide'] ) && $field['label_hide'] == '1' ? ' label_hide' : '';
193
+ $css .= ! empty( $field['sublabel_hide'] ) && $field['sublabel_hide'] == '1' ? ' sublabel_hide' : '';
194
+ $css .= ! empty( $field['required'] ) && $field['required'] == '1' ? ' required' : '';
195
+ $css = apply_filters( 'everest_forms_field_preview_class', $css, $field );
196
+ printf( '<div class="everest-forms-field everest-forms-field-%s %s %s" id="everest-forms-field-%s" data-field-id="%s" data-field-type="%s">', $field['type'], $field['required'], 'test', $field['id'], $field['id'], $field['type'] );
197
+ printf( '<div class="evf-field-action">' );
198
+ printf( '<a href="#" class="everest-forms-field-duplicate" title="%s"><span class="dashicons dashicons-media-default"></span></a>', __( 'Duplicate Field', 'everest-forms' ) );
199
+ printf( '<a href="#" class="everest-forms-field-delete" title="%s"><span class="dashicons dashicons-trash"></span></a>', __( 'Delete Field', 'everest-forms' ) );
200
+ printf( '<a href="#" class="everest-forms-field-setting" title="%s"><span class="dashicons dashicons-admin-generic"></span></a>', __( 'Settings', 'everest-forms' ) );
201
+ printf( '</div>' );
202
+ do_action( "everest_forms_builder_fields_previews_{$field['type']}", $field );
203
+
204
+ echo '</div>';
205
+
206
+ }
207
+
208
+ /**
209
+ * @param $form
210
+ */
211
+ public function everest_forms_builder_preview() {
212
+
213
+ $form_data = $this->form_data;
214
+
215
+ $fields = isset( $form_data['form_fields'] ) ? $form_data['form_fields'] : array();
216
+ echo '<div class="evf-admin-field-container">';
217
+ echo '<div class="evf-admin-field-wrapper">';
218
+ $number_of_rows = isset( $form_data['structure'] ) ? count( $form_data['structure'] ) : 1;
219
+ $grid_number = 1;
220
+ for ( $row = 1; $row <= $number_of_rows; $row ++ ) {
221
+ echo '<div class="evf-admin-row" data-row-id="' . $row . '">';
222
+ $row_grid = isset( $form_data['structure'][ 'row_' . $row ] ) ? $form_data['structure'][ 'row_' . $row ] : array();
223
+ $active_grid = count( $row_grid ) > 0 ? count( $row_grid ) : EVF()->form_grid;
224
+ $total_grid = EVF()->form_grid;
225
+ $active_grid = $active_grid > $total_grid ? $total_grid : $active_grid;
226
+ echo '<div class="evf-toggle-row">';
227
+ echo '<div class="evf-delete-row"><span class="dashicons dashicons-trash"></span></div>';
228
+ echo '<span class="evf-show-grid">' . __( 'Edit', 'everest-forms' ) . '</span>';
229
+ echo '<div class="evf-toggle-row-content">';
230
+ echo '<span>' . __( 'Row Settings', 'everest-forms' ) . '</span>';
231
+ echo '<small>' . __( 'Select the type of row', 'everest-forms' ) . '</small>';
232
+ echo '<div class="clear"></div>';
233
+ for ( $grid_active = 1; $grid_active <= $total_grid; $grid_active ++ ) {
234
+ $class = 'evf-grid-selector';
235
+ if ( $grid_active === $active_grid ) {
236
+ $class .= ' active';
237
+ }
238
+ echo '<div class="' . $class . '" data-evf-grid="' . $grid_active . '">';
239
+ $gaps = 15;
240
+ $width = ( 100 - $gaps ) / $grid_active;
241
+ $margin = ( $gaps / $grid_active ) / 2;
242
+ for ( $row_icon = 1; $row_icon <= $grid_active; $row_icon ++ ) {
243
+ echo '<span style="width:' . $width . '%; margin-left:' . $margin . '%; margin-right:' . $margin . '%"></span>';
244
+ }
245
+ echo '</div>';
246
+ }
247
+
248
+ echo '</div>';
249
+ echo '</div>';
250
+
251
+ echo '<div class="clear evf-clear"></div>';
252
+
253
+ $grid_class = 'evf-admin-grid evf-grid-' . ( $active_grid );
254
+ for ( $grid_start = 1; $grid_start <= $active_grid; $grid_start ++ ) {
255
+
256
+ echo '<div class="' . $grid_class . ' " data-grid-id="' . $grid_start . '">';
257
+
258
+ $grid_fields = isset( $row_grid[ 'grid_' . $grid_start ] ) && is_array( $row_grid[ 'grid_' . $grid_start ] ) ? $row_grid[ 'grid_' . $grid_start ] : array();
259
+
260
+ foreach ( $grid_fields as $field_id ) {
261
+
262
+ if ( isset( $fields[ $field_id ] ) ) {
263
+ $this->field_preview( $fields[ $field_id ] );
264
+ }
265
+
266
+ }
267
+
268
+ echo '</div>';
269
+ $grid_number ++;
270
+ }
271
+ echo '<div class="clear evf-clear"></div>';
272
+ echo '</div >';
273
+
274
+ }
275
+ echo '</div>';
276
+ echo '<div class="clear evf-clear"></div>';
277
+ echo '<div class="evf-add-row"><span class="dashicons dashicons-plus-alt"></span></div>';
278
+ echo '</div >';
279
+ }
280
+
281
+ /**
282
+ * Sort Add Field buttons by order provided.
283
+ *
284
+ * @since 1.0.0
285
+ */
286
+ function field_order( $a, $b ) {
287
+ return $a['order'] - $b['order'];
288
+ }
289
+ }
290
+
291
+ new EVF_Fields_Panel;
includes/admin/form-panels/class-evf-settings-panel.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Admin
4
+ *
5
+ * @class EVF_Admin
6
+ * @author WPEverest
7
+ * @category Admin
8
+ * @package EverestForms/Admin/FormPanel
9
+ * @version 1.0.0
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit; // Exit if accessed directly
14
+ }
15
+
16
+ /**
17
+ * EVF_Settings_Panel class.
18
+ */
19
+ class EVF_Settings_Panel extends EVF_Admin_Form_Panel {
20
+
21
+ /**
22
+ * All systems go.
23
+ *
24
+ * @since 1.0.0
25
+ */
26
+ public function init() {
27
+
28
+ // Define panel information
29
+ $this->name = __( 'Settings', 'everest-forms' );
30
+ $this->slug = 'settings';
31
+ $this->icon = 'dashicons dashicons-admin-tools';
32
+ $this->order = 10;
33
+ $this->sidebar = true;
34
+ }
35
+
36
+ /**
37
+ * Enqueue assets for the Setting panel.
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ public function enqueues() {
42
+
43
+
44
+ }
45
+
46
+ /**
47
+ * Outputs the Settings panel sidebar.
48
+ *
49
+ * @since 1.0.0
50
+ */
51
+ public function panel_sidebar() {
52
+
53
+ $sections = array(
54
+ 'general' => __( 'General', 'everest-forms' ),
55
+ 'email' => __( 'Email', 'everest-forms' ),
56
+ );
57
+ $sections = apply_filters( 'everest_forms_builder_settings_section', $sections, $this->form_data );
58
+ foreach ( $sections as $slug => $section ) {
59
+ $this->panel_sidebar_section( $section, $slug );
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Outputs the Settings panel primary content.
65
+ *
66
+ * @since 1.0.0
67
+ */
68
+ public function panel_content() {
69
+
70
+ // --------------------------------------------------------------------//
71
+ // General
72
+ // --------------------------------------------------------------------//
73
+ echo '<div class="evf-content-section evf-content-general-settings">';
74
+ echo '<div class="evf-content-section-title">';
75
+ _e( 'General', 'everest-forms' );
76
+ echo '</div>';
77
+ everest_forms_panel_field(
78
+ 'text',
79
+ 'settings',
80
+ 'form_title',
81
+ $this->form_data,
82
+ __( 'Form Name', 'everest-forms' ),
83
+ array(
84
+ 'default' => $this->form->post_title,
85
+ )
86
+ );
87
+ everest_forms_panel_field(
88
+ 'checkbox',
89
+ 'settings',
90
+ 'recaptcha_support',
91
+ $this->form_data,
92
+ sprintf( __( 'Enable %1$s %2$s reCaptcha %3$s support', 'everest-forms' ), '<a title="', 'Please make sure the site key and secret are not empty in setting page." href="' . admin_url() . 'admin.php?page=evf-settings&tab=recaptcha" target="_blank">', '</a>' ),
93
+ array(
94
+ 'default' => '0',
95
+ )
96
+ );
97
+ everest_forms_panel_field(
98
+ 'textarea',
99
+ 'settings',
100
+ 'successful_form_submission_message',
101
+ $this->form_data,
102
+ __( 'Successful form submission message', 'everest-forms' ),
103
+ array(
104
+ 'default' => isset( $this->form->successful_form_submission_message ) ? $this->form->successful_form_submission_message : get_option( 'everest_forms_successful_form_submission_message', __('Thanks for contacting us! We will be in touch with you shortly','everest-forms')),
105
+ )
106
+ );
107
+ everest_forms_panel_field(
108
+ 'select',
109
+ 'settings',
110
+ 'redirect_to',
111
+ $this->form_data,
112
+ __( 'Redirect To', 'everest-forms' ),
113
+ array(
114
+ 'default' => '0',
115
+ 'options' => array(
116
+ '0' => __( 'Same Page', 'everest-forms' ),
117
+ '1' => __( 'Custom Page', 'everest-forms' ),
118
+ '2' => __( 'External URL', 'everest-forms' ),
119
+ ),
120
+ )
121
+ );
122
+ everest_forms_panel_field(
123
+ 'select',
124
+ 'settings',
125
+ 'custom_page',
126
+ $this->form_data,
127
+ __( 'Custom Page', 'everest-forms' ),
128
+ array(
129
+ 'default' => '0',
130
+ 'options' => $this->evf_get_all_pages(),
131
+ )
132
+ );
133
+ everest_forms_panel_field(
134
+ 'text',
135
+ 'settings',
136
+ 'external_url',
137
+ $this->form_data,
138
+ __( 'External URL', 'everest-forms' ),
139
+ array(
140
+ 'default' => isset( $this->form->external_url ) ? $this->form->external_url : '',
141
+ )
142
+ );
143
+ everest_forms_panel_field(
144
+ 'select',
145
+ 'settings',
146
+ 'layout_class',
147
+ $this->form_data,
148
+ __( 'Layout Design', 'everest-forms' ),
149
+ array(
150
+ 'default' => '0',
151
+ 'options' => array(
152
+ 'default' => __( 'Default', 'everest-forms' ),
153
+ 'layout-two' => __( 'Classic Layout', 'everest-forms' ),
154
+ ),
155
+ )
156
+ );
157
+ everest_forms_panel_field(
158
+ 'text',
159
+ 'settings',
160
+ 'form_class',
161
+ $this->form_data,
162
+ __( 'Form Class', 'everest-forms' ),
163
+ array(
164
+ 'default' => isset( $this->form->form_class ) ? $this->form->form_class : '',
165
+ )
166
+ );
167
+ everest_forms_panel_field(
168
+ 'text',
169
+ 'settings',
170
+ 'submit_button_text',
171
+ $this->form_data,
172
+ __( 'Submit button text', 'everest-forms' ),
173
+ array(
174
+ 'default' => isset( $this->form_setting['submit_button_text'] ) ? $this->form_setting['submit_button_text'] : get_option( 'everest_forms_form_submit_button_label', __( 'Submit', 'everest-forms' ) ),
175
+ )
176
+ );
177
+ do_action( 'everest_forms_general_settings', $this );
178
+
179
+ echo '</div>';
180
+
181
+ // --------------------------------------------------------------------//
182
+ // Email
183
+ // --------------------------------------------------------------------//
184
+ echo '<div class="evf-content-section evf-content-email-settings">';
185
+ echo '<div class="evf-content-section-title">';
186
+ _e( 'Email', 'everest-forms' );
187
+ echo '</div>';
188
+ everest_forms_panel_field(
189
+ 'text',
190
+ 'settings[email]',
191
+ 'evf_to_email',
192
+ $this->form_data,
193
+ __( 'To Address', 'everest-forms' ),
194
+ array(
195
+ 'default' => isset( $this->form_setting['email']['evf_to_email'] ) ? $this->form_setting['email']['evf_to_email'] : get_option( 'evf_to_email', get_option( 'admin_email' ) ),
196
+ )
197
+ );
198
+ everest_forms_panel_field(
199
+ 'text',
200
+ 'settings[email]',
201
+ 'evf_from_name',
202
+ $this->form_data,
203
+ __( 'From Name', 'everest-forms' ),
204
+ array(
205
+ 'default' => isset( $this->form_setting['email']['evf_from_name'] ) ? $this->form_setting['email']['evf_from_name'] : get_option( 'evf_from_name', evf_sender_name() ),
206
+ )
207
+ );
208
+ everest_forms_panel_field(
209
+ 'text',
210
+ 'settings[email]',
211
+ 'evf_from_email',
212
+ $this->form_data,
213
+ __( 'From Address', 'everest-forms' ),
214
+ array(
215
+ 'default' => isset( $this->form_setting['email']['evf_from_email'] ) ? $this->form_setting['email']['evf_from_email'] : get_option( 'evf_from_address', evf_sender_address() ),
216
+ )
217
+ );
218
+ everest_forms_panel_field(
219
+ 'text',
220
+ 'settings[email]',
221
+ 'evf_email_subject',
222
+ $this->form_data,
223
+ __( 'Email Subject', 'everest-forms' ),
224
+ array(
225
+ 'default' => isset( $this->form_setting['email']['evf_email_subject'] ) ? $this->form_setting['email']['evf_email_subject'] : get_option( 'evf_email_subject', __( 'New Form Entry', 'everest-forms' ) ),
226
+ )
227
+ );
228
+ everest_forms_panel_field(
229
+ 'tinymce',
230
+ 'settings[email]',
231
+ 'evf_email_message',
232
+ $this->form_data,
233
+ __( 'Email Message', 'everest-forms' ),
234
+ array(
235
+ 'default' => isset( $this->form_setting['email']['evf_email_message'] ) ? $this->form_setting['email']['evf_email_message'] : get_option( 'evf_email_message', __( '{all_fields}', 'everest-forms' ) ),
236
+ )
237
+ );
238
+ do_action( 'everest_forms_email_settings', $this );
239
+
240
+ echo '</div>';
241
+
242
+ do_action( 'everest_forms_settings_panel_content', $this );
243
+ }
244
+
245
+ public function evf_get_all_pages(){
246
+ foreach(get_pages() as $page){
247
+ $pages[$page->ID] = $page->post_title; ;
248
+ }
249
+ return $pages;
250
+ }
251
+ }
252
+
253
+ new EVF_Settings_Panel;
includes/admin/settings/class-evf-settings-email.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Email Settings
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Settings_Email', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Settings_Email.
19
+ */
20
+ class EVF_Settings_Email extends EVF_Settings_Page {
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public function __construct() {
26
+ $this->id = 'email';
27
+ $this->icon = 'dashicons dashicons-email';
28
+ $this->label = __( 'Email', 'everest-forms' );
29
+
30
+ parent::__construct();
31
+ }
32
+
33
+ /**
34
+ * Get settings array.
35
+ *
36
+ * @return array
37
+ */
38
+ public function get_settings() {
39
+
40
+ $settings = apply_filters(
41
+ 'everest_forms_email_settings', array(
42
+
43
+ array(
44
+ 'title' => __( 'Email Settings', 'everest-forms' ),
45
+ 'type' => 'title',
46
+ 'desc' => '',
47
+ 'id' => 'email_options',
48
+ ),
49
+ array(
50
+ 'title' => __( 'To Address', 'everest-forms' ),
51
+ 'desc' => __( 'Enter the email address to send email', 'everest-forms' ),
52
+ 'id' => 'evf_to_email',
53
+ 'type' => 'text',
54
+ 'desc_tip' => true,
55
+ 'css' => 'min-width: 350px;',
56
+ 'default' => get_option('admin_email'),
57
+ ),
58
+ array(
59
+ 'title' => __( 'From Name', 'everest-forms' ),
60
+ 'desc' => __( 'Email senders name', 'everest-forms' ),
61
+ 'id' => 'evf_from_name',
62
+ 'type' => 'text',
63
+ 'desc_tip' => true,
64
+ 'css' => 'min-width: 350px;',
65
+ 'default' => evf_sender_name(),
66
+ ),
67
+ array(
68
+ 'title' => __( 'From Address', 'everest-forms' ),
69
+ 'desc' => __( 'Email senders address', 'everest-forms' ),
70
+ 'id' => 'evf_from_address',
71
+ 'type' => 'text',
72
+ 'desc_tip' => true,
73
+ 'css' => 'min-width: 350px;',
74
+ 'default' => evf_sender_address(),
75
+ ),
76
+ array(
77
+ 'title' => __( 'Email Subject', 'everest-forms' ),
78
+ 'desc' => __( 'Email Subject', 'everest-forms' ),
79
+ 'id' => 'evf_email_subject',
80
+ 'type' => 'text',
81
+ 'desc_tip' => true,
82
+ 'css' => 'min-width: 350px;',
83
+ 'default' => 'New Form Entry'
84
+ ),
85
+ array(
86
+ 'title' => __( 'Email Message', 'everest-forms' ),
87
+ 'desc' => __( 'Email Message', 'everest-forms' ),
88
+ 'id' => 'evf_email_message',
89
+ 'type' => 'tinymce',
90
+ 'desc_tip' => true,
91
+ 'css' => 'max-width: 350px;',
92
+ 'default' => '{all_fields}'
93
+ ),
94
+ array(
95
+ 'type' => 'sectionend',
96
+ 'id' => 'email_options',
97
+ ),
98
+
99
+ )
100
+ );
101
+
102
+
103
+ return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings );
104
+ }
105
+
106
+ /**
107
+ * Save settings.
108
+ */
109
+ public function save() {
110
+ $settings = $this->get_settings();
111
+
112
+
113
+ EVF_Admin_Settings::save_fields( $settings );
114
+ }
115
+ }
116
+
117
+ endif;
118
+
119
+ return new EVF_Settings_Email();
includes/admin/settings/class-evf-settings-general.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms General Settings
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Settings_General', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Settings_General.
19
+ */
20
+ class EVF_Settings_General extends EVF_Settings_Page {
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public function __construct() {
26
+ $this->id = 'general';
27
+ $this->icon = 'dashicons dashicons-admin-settings';
28
+ $this->label = __( 'General', 'everest-forms' );
29
+
30
+ parent::__construct();
31
+ }
32
+
33
+ /**
34
+ * Get settings array.
35
+ *
36
+ * @return array
37
+ */
38
+ public function get_settings() {
39
+
40
+ $settings = apply_filters(
41
+ 'everest_forms_general_settings', array(
42
+
43
+ array(
44
+ 'title' => __( 'General Options', 'everest-forms' ),
45
+ 'type' => 'title',
46
+ 'desc' => '',
47
+ 'id' => 'general_options',
48
+ ),
49
+ array(
50
+ 'title' => __( 'Form Submit Button Label', 'everest-forms' ),
51
+ 'desc' => __( 'Button label to register', 'everest-forms' ),
52
+ 'id' => 'everest_forms_form_submit_button_label',
53
+ 'type' => 'text',
54
+ 'desc_tip' => true,
55
+ 'css' => 'min-width: 350px;',
56
+ 'default' => __('Submit','everest-forms'),
57
+ ),
58
+ array(
59
+ 'title' => __( 'Successful Form Submission Message', 'everest-forms' ),
60
+ 'desc' => __( 'Enter the text message after successful form submission.', 'everest-forms' ),
61
+ 'id' => 'everest_forms_successful_form_submission_message',
62
+ 'type' => 'textarea',
63
+ 'desc_tip' => true,
64
+ 'css' => 'min-width: 350px; min-height: 200px;',
65
+ 'default' => __('Thanks for contacting us! We will be in touch with you shortly.','everest-forms'),
66
+ ),
67
+
68
+ array(
69
+ 'type' => 'sectionend',
70
+ 'id' => 'general_options',
71
+ ),
72
+
73
+ )
74
+ );
75
+ return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings );
76
+ }
77
+
78
+ /**
79
+ * Save settings.
80
+ */
81
+ public function save() {
82
+ $settings = $this->get_settings();
83
+
84
+ EVF_Admin_Settings::save_fields( $settings );
85
+ }
86
+ }
87
+
88
+ endif;
89
+
90
+ return new EVF_Settings_General();
includes/admin/settings/class-evf-settings-page.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Settings Page/Tab
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Settings_Page', false ) ) :
16
+
17
+ /**
18
+ * EVF_Settings_Page.
19
+ */
20
+ abstract class EVF_Settings_Page {
21
+ /**
22
+ * Setting page id.
23
+ *
24
+ * @var string
25
+ */
26
+ protected $id = '';
27
+
28
+ /**
29
+ * Setting page label.
30
+ *
31
+ * @var string
32
+ */
33
+ protected $label = '';
34
+
35
+ /**
36
+ * Constructor.
37
+ */
38
+ protected $icon = '';
39
+
40
+ /**
41
+ * EVF_Settings_Page constructor.
42
+ */
43
+ public function __construct() {
44
+ add_filter( 'everest_forms_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
45
+ add_action( 'everest_forms_sections_' . $this->id, array( $this, 'output_sections' ) );
46
+ add_action( 'everest_forms_settings_' . $this->id, array( $this, 'output' ) );
47
+ add_action( 'everest_forms_settings_save', array( $this, 'save' ) );
48
+ }
49
+
50
+ /**
51
+ * Get settings page ID.
52
+ * @since 1.0.0
53
+ * @return string
54
+ */
55
+ public function get_id() {
56
+ return $this->id;
57
+ }
58
+
59
+ /**
60
+ * Get settings page label.
61
+ * @since 1.0.0
62
+ * @return string
63
+ */
64
+ public function get_label() {
65
+ return $this->label;
66
+ }
67
+
68
+ /**
69
+ * Get settings page ICON.
70
+ * @since 1.0.0
71
+ * @return string
72
+ */
73
+ public function get_icon() {
74
+ return $this->icon;
75
+ }
76
+
77
+ /**
78
+ * Add this page to settings.
79
+ *
80
+ * @param array $pages
81
+ *
82
+ * @return mixed
83
+ */
84
+ public function add_settings_page( $pages ) {
85
+ $pages[ $this->id ] = array(
86
+ 'icon' => $this->icon,
87
+ 'label' => $this->label,
88
+ );
89
+
90
+ return $pages;
91
+ }
92
+
93
+ /**
94
+ * Get settings array.
95
+ *
96
+ * @return array
97
+ */
98
+ public function get_settings() {
99
+ return apply_filters( 'everest_forms_get_settings_' . $this->id, array() );
100
+ }
101
+
102
+ /**
103
+ * Get sections.
104
+ *
105
+ * @return array
106
+ */
107
+ public function get_sections() {
108
+ return apply_filters( 'everest_forms_get_sections_' . $this->id, array() );
109
+ }
110
+
111
+ /**
112
+ * Output sections.
113
+ */
114
+ public function output_sections() {
115
+ global $current_section;
116
+
117
+ $sections = $this->get_sections();
118
+
119
+ if ( empty( $sections ) || 1 === sizeof( $sections ) ) {
120
+ return;
121
+ }
122
+
123
+ echo '<ul class="subsubsub">';
124
+
125
+ $array_keys = array_keys( $sections );
126
+
127
+ foreach ( $sections as $id => $label ) {
128
+ echo '<li><a href="' . admin_url( 'admin.php?page=evf-settings&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
129
+ }
130
+ echo '</ul><br class="clear" />';
131
+ }
132
+
133
+ /**
134
+ * Output the settings.
135
+ */
136
+ public function output() {
137
+
138
+ $settings = $this->get_settings();
139
+
140
+ EVF_Admin_Settings::output_fields( $settings );
141
+ }
142
+
143
+ /**
144
+ * Save settings.
145
+ */
146
+ public function save() {
147
+ global $current_section;
148
+
149
+ $settings = $this->get_settings();
150
+ EVF_Admin_Settings::save_fields( $settings );
151
+
152
+ if ( $current_section ) {
153
+ do_action( 'everest_forms_update_options_' . $this->id . '_' . $current_section );
154
+ }
155
+ }
156
+ }
157
+
158
+ endif;
includes/admin/settings/class-evf-settings-recaptcha.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms reCAPTCHA Settings
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Settings_reCAPTCHA', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Settings_reCAPTCHA.
19
+ */
20
+ class EVF_Settings_reCAPTCHA extends EVF_Settings_Page {
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public function __construct() {
26
+ $this->id = 'recaptcha';
27
+ $this->icon = 'dashicons dashicons-lock';
28
+ $this->label = __( 'reCAPTCHA', 'everest-forms' );
29
+
30
+ parent::__construct();
31
+ }
32
+
33
+ /**
34
+ * Get settings array.
35
+ *
36
+ * @return array
37
+ */
38
+ public function get_settings() {
39
+
40
+ $settings = apply_filters(
41
+ 'everest_forms_recaptcha_settings', array(
42
+
43
+ array(
44
+ 'title' => __( 'Google reCaptcha Integation', 'everest-forms' ),
45
+ 'type' => 'title',
46
+ 'desc' => '',
47
+ 'id' => 'integration_options',
48
+ ),
49
+
50
+ array(
51
+ 'title' => __( 'Site Key', 'everest-forms' ),
52
+ 'desc' => sprintf( __('Get site key from google %1$s reCaptcha %2$s.', 'everest-forms' ), '<a href="https://www.google.com/recaptcha" target="_blank">', '</a>' ), 'id' => 'evf_recaptcha_site_key',
53
+ 'default' => '',
54
+ 'type' => 'text',
55
+ 'class' => '',
56
+ 'css' => 'min-width: 350px;',
57
+ 'desc_tip' => true,
58
+
59
+ ),
60
+ array(
61
+ 'title' => __( 'Secret Key', 'everest-forms' ),
62
+ 'desc' => sprintf( __('Get secret key from google %1$s reCaptcha %2$s.', 'everest-forms' ), '<a href="https://www.google.com/recaptcha" target="_blank">', '</a>' ),
63
+ 'id' => 'evf_recaptcha_site_secret',
64
+ 'default' => '',
65
+ 'type' => 'text',
66
+ 'class' => '',
67
+ 'css' => 'min-width: 350px;',
68
+ 'desc_tip' => true,
69
+
70
+ ),
71
+
72
+
73
+ array(
74
+ 'type' => 'sectionend',
75
+ 'id' => 'integration_options',
76
+ ),
77
+
78
+ )
79
+ );
80
+
81
+
82
+ return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings );
83
+ }
84
+
85
+ /**
86
+ * Save settings.
87
+ */
88
+ public function save() {
89
+ $settings = $this->get_settings();
90
+
91
+
92
+ EVF_Admin_Settings::save_fields( $settings );
93
+ }
94
+ }
95
+
96
+ endif;
97
+
98
+ return new EVF_Settings_reCAPTCHA();
includes/admin/settings/class-evf-settings-validation.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Validation Settings
4
+ *
5
+ * @author WPEverest
6
+ * @category Admin
7
+ * @package EverestForms/Admin
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ if ( ! class_exists( 'EVF_Settings_Validation', false ) ) :
16
+
17
+ /**
18
+ * EVF_Admin_Settings_Validation.
19
+ */
20
+ class EVF_Settings_Validation extends EVF_Settings_Page {
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public function __construct() {
26
+ $this->id = 'validation';
27
+ $this->icon = 'dashicons dashicons-warning';
28
+ $this->label = __( 'Validations', 'everest-forms' );
29
+
30
+ parent::__construct();
31
+ }
32
+
33
+ /**
34
+ * Get settings array.
35
+ *
36
+ * @return array
37
+ */
38
+ public function get_settings() {
39
+
40
+ $settings = apply_filters(
41
+ 'everest_forms_validation_settings', array(
42
+
43
+ array(
44
+ 'title' => __( 'Validation Messages', 'everest-forms' ),
45
+ 'type' => 'title',
46
+ 'desc' => 'These messages are displayed to the user as they fill out a form in real-time.',
47
+ 'id' => 'validation_options',
48
+ ),
49
+ array(
50
+ 'title' => __( 'Required', 'everest-forms' ),
51
+ 'desc' => __( 'Enter the message for the required form field', 'everest-forms' ),
52
+ 'id' => 'evf_required_validation',
53
+ 'type' => 'text',
54
+ 'desc_tip' => true,
55
+ 'css' => 'min-width: 350px;',
56
+ 'default' => __('This field is required.','everest-forms'),
57
+ ),
58
+ array(
59
+ 'title' => __( 'Website URL', 'everest-forms' ),
60
+ 'desc' => __( 'Enter the message for the valid website url', 'everest-forms' ),
61
+ 'id' => 'evf_url_validation',
62
+ 'type' => 'text',
63
+ 'desc_tip' => true,
64
+ 'css' => 'min-width: 350px;',
65
+ 'default' => __('Please enter a valid URL.','everest-forms'),
66
+ ),
67
+ array(
68
+ 'title' => __( 'Email', 'everest-forms' ),
69
+ 'desc' => __( 'Enter the message for the valid email', 'everest-forms' ),
70
+ 'id' => 'evf_email_validation',
71
+ 'type' => 'text',
72
+ 'desc_tip' => true,
73
+ 'css' => 'min-width: 350px;',
74
+ 'default' => __('Please enter a valid email address.','everest-forms'),
75
+ ),
76
+ array(
77
+ 'title' => __( 'Number', 'everest-forms' ),
78
+ 'desc' => __( 'Enter the message for the valid number', 'everest-forms' ),
79
+ 'id' => 'evf_number_validation',
80
+ 'type' => 'text',
81
+ 'desc_tip' => true,
82
+ 'css' => 'min-width: 350px;',
83
+ 'default' => __('Please enter a valid number.','everest-forms'),
84
+ ),
85
+ array(
86
+ 'title' => __( 'reCAPTCHA', 'everest-forms' ),
87
+ 'desc' => __( 'Enter the message for the valid recaptcha', 'everest-forms' ),
88
+ 'id' => 'evf_recaptcha_validation',
89
+ 'type' => 'text',
90
+ 'desc_tip' => true,
91
+ 'css' => 'min-width: 350px;',
92
+ 'default' => __('Invalid reCaptcha Code.','everest-forms'),
93
+ ),
94
+ array(
95
+ 'type' => 'sectionend',
96
+ 'id' => 'validation_options',
97
+ ),
98
+
99
+ )
100
+ );
101
+
102
+ return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings );
103
+ }
104
+
105
+ /**
106
+ * Save settings.
107
+ */
108
+ public function save() {
109
+ $settings = $this->get_settings();
110
+
111
+
112
+ EVF_Admin_Settings::save_fields( $settings );
113
+ }
114
+ }
115
+
116
+ endif;
117
+
118
+ return new EVF_Settings_Validation();
includes/admin/views/html-admin-form-modal.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /**
2
+ * Admin View: Page - Form Modal
3
+ */
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ } ?>
8
+ <script type="text/template" id="tmpl-evf-add-new-form">
9
+ <div class="evf-backbone-modal evf-reservation-schedule">
10
+ <div class="evf-backbone-modal-content">
11
+ <section class="evf-backbone-modal-main" role="main">
12
+ <header class="evf-backbone-modal-header">
13
+ <h1><?php _e( 'Create new form', 'everest-forms' ); ?></h1>
14
+ <button class="modal-close modal-close-link dashicons dashicons-no-alt">
15
+ <span
16
+ class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'everest-forms' ); ?></span>
17
+ </button>
18
+ </header>
19
+ <article>
20
+ <form action="" method="post">
21
+
22
+ <label for="evf-modal-form-name"><?php echo __( 'Form Title', 'everest-forms' ) ?></label>
23
+ <input type="text" name="evf-modal-form-name" id="evf-modal-form-name"/>
24
+ </form>
25
+ </article>
26
+ <footer>
27
+ <div class="inner">
28
+ <button id="btn-ok"
29
+ class="button button-primary button-large"><?php _e( 'Create', 'everest-forms' ); ?></button>
30
+ </div>
31
+ </footer>
32
+ </section>
33
+ </div>
34
+ </div>
35
+ <div class="evf-backbone-modal-backdrop modal-close"></div>
36
+ </script>
includes/admin/views/html-admin-page-forms.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Page - Forms List
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+ ?>
10
+ <div class="wrap">
11
+ <h1><?php _e( 'All Forms', 'everest-forms' ); ?> <a
12
+ href="<?php echo 'admin.php?&page=edit-evf-form';?>"
13
+ class="add-new-h2"><?php _e( 'Add New', 'everest-forms' ); ?></a></h1>
14
+ <form id="evf-list-management" method="post">
15
+ <input type="hidden" name="page" value="everest-forms"/>
16
+ <?php
17
+ $evf_form_list->views();
18
+ $evf_form_list->search_box( __( 'Search Form', 'everest-forms' ), 'everest-forms' );
19
+ $evf_form_list->display();
20
+
21
+ wp_nonce_field( 'save', 'everest-forms_nonce' );
22
+ ?>
23
+ </form>
24
+ </div>
includes/admin/views/html-admin-page-status-logs.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Page - Status Logs
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ ?>
11
+ <?php if ( $logs ) : ?>
12
+ <div id="log-viewer-select">
13
+ <div class="alignleft">
14
+ <h2>
15
+ <?php echo esc_html( $viewed_log ); ?>
16
+ <?php if ( ! empty( $handle ) ) : ?>
17
+ <a class="page-title-action" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'handle' => $handle ), admin_url( 'admin.php?page=evf-status&tab=logs' ) ), 'remove_log' ) ); ?>" class="button"><?php esc_html_e( 'Delete log', 'everest-forms' );?></a>
18
+ <?php endif; ?>
19
+ </h2>
20
+ </div>
21
+ <div class="alignright">
22
+ <form action="<?php echo admin_url( 'admin.php?page=evf-status&tab=logs' ); ?>" method="post">
23
+ <select name="log_file">
24
+ <?php foreach ( $logs as $log_key => $log_file ) : ?>
25
+ <option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), filemtime( EVF_LOG_DIR . $log_file ) ); ?>)</option>
26
+ <?php endforeach; ?>
27
+ </select>
28
+ <input type="submit" class="button" value="<?php esc_attr_e( 'View', 'everest-forms' ); ?>" />
29
+ </form>
30
+ </div>
31
+ <div class="clear"></div>
32
+ </div>
33
+ <div id="log-viewer">
34
+ <pre><?php echo esc_html( file_get_contents( EVF_LOG_DIR . $viewed_log ) ); ?></pre>
35
+ </div>
36
+ <?php else : ?>
37
+ <div class="updated everest-forms-message inline"><p><?php _e( 'There are currently no logs to view.', 'everest-forms' ); ?></p></div>
38
+ <?php endif; ?>
includes/admin/views/html-admin-page-status.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Page - Status
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ $current_tab = ! empty( $_REQUEST['tab'] ) ? sanitize_title( $_REQUEST['tab'] ) : 'logs';
11
+ $tabs = array(
12
+ 'logs' => __( 'Logs', 'everest-forms' ),
13
+ );
14
+ $tabs = apply_filters( 'everest_forms_admin_status_tabs', $tabs );
15
+ ?>
16
+ <div class="wrap everest-forms">
17
+ <nav class="nav-tab-wrapper evf-nav-tab-wrapper">
18
+ <?php
19
+ foreach ( $tabs as $name => $label ) {
20
+ echo '<a href="' . admin_url( 'admin.php?page=evf-status&tab=' . $name ) . '" class="nav-tab ';
21
+ if ( $current_tab == $name ) {
22
+ echo 'nav-tab-active';
23
+ }
24
+ echo '">' . $label . '</a>';
25
+ }
26
+ ?>
27
+ </nav>
28
+ <h1 class="screen-reader-text"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1>
29
+ <?php
30
+ switch ( $current_tab ) {
31
+ case "tools" :
32
+ EVF_Admin_Status::status_logs();
33
+ break;
34
+ case "logs" :
35
+ EVF_Admin_Status::status_logs();
36
+ break;
37
+ default :
38
+ EVF_Admin_Status::status_logs();
39
+ break;
40
+ }
41
+ ?>
42
+ </div>
includes/admin/views/html-admin-settings.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Settings
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ $tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'everest_forms_sections_' . $current_tab ) || has_action( 'everest_forms_settings_' . $current_tab ) || has_action( 'everest_forms_settings_tabs_' . $current_tab );
10
+ $current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : '';
11
+
12
+ if ( ! $tab_exists ) {
13
+ wp_safe_redirect( admin_url( 'admin.php?page=evf-settings' ) );
14
+ exit;
15
+ }
16
+ ?>
17
+ <div class="everest-forms">
18
+ <form method="<?php echo esc_attr( apply_filters( 'everest_forms_settings_form_method_tab_' . $current_tab, 'post' ) ); ?>" id="mainform" action="" enctype="multipart/form-data">
19
+ <nav class="nav-tab-wrapper evf-nav-tab-wrapper">
20
+ <?php
21
+
22
+ foreach ( $tabs as $slug => $tab ) {
23
+ echo '<a href="' . esc_html( admin_url( 'admin.php?page=evf-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '" data-key="' . esc_attr( $slug ) . '"><span class="' . esc_attr( $tab['icon'] ) . '"></span>' . esc_html( $tab['label'] ) . '</a>';
24
+ }
25
+
26
+ do_action( 'everest_forms_settings_tabs' );
27
+
28
+ ?>
29
+ </nav>
30
+ <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label['label'] ); ?></h1>
31
+ <?php
32
+ do_action( 'everest_forms_sections_' . $current_tab );
33
+
34
+ self::show_messages();
35
+ foreach ( $tabs as $tab_key => $tab_data ) {
36
+
37
+ ?>
38
+ <div data-conent-key="<?php echo $tab_key; ?>"
39
+ class="evf-setting-tab-content <?php echo( $current_tab == $tab_key ? 'active' : '' ); ?>"> <?php
40
+ do_action( 'everest_forms_settings_' . $tab_key );
41
+ ?>
42
+ </div>
43
+ <?php } ?>
44
+ <?php
45
+ do_action( 'everest_forms_settings_tabs_' . $current_tab );
46
+ ?>
47
+
48
+ <div style="clear:both"></div>
49
+ <p class="submit">
50
+ <?php if ( empty( $GLOBALS['hide_save_button'] ) ) : ?>
51
+ <input name="save" class="button-primary everest-forms-save-button" type="submit"
52
+ value="<?php esc_attr_e( 'Save changes', 'everest-forms' ); ?>"/>
53
+ <?php endif; ?>
54
+ <?php wp_nonce_field( 'everest-forms-settings' ); ?>
55
+ </p>
56
+ </form>
57
+ </div>
includes/admin/views/html-notice-custom.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Custom Notices
4
+ *
5
+ * @package EverestForms\Admin\Notice
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ ?>
13
+ <div id="message" class="updated everest-forms-message">
14
+ <a class="everest-forms-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'evf-hide-notice', $notice ), 'everest_forms_hide_notices_nonce', '_evf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'everest-forms' ); ?></a>
15
+
16
+ <?php echo wp_kses_post( wpautop( $notice_html ) ); ?>
17
+ </div>
includes/admin/views/html-notice-update.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Update
4
+ *
5
+ * @package EverestForms\Admin\Notice
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ ?>
13
+ <div id="message" class="updated everest-forms-message evf-connect">
14
+ <p><strong><?php esc_html_e( 'Everest Forms data update', 'everest-forms' ); ?></strong> &#8211; <?php esc_html_e( 'We need to update your store database to the latest version.', 'everest-forms' ); ?></p>
15
+ <p class="submit"><a href="<?php echo esc_url( add_query_arg( 'do_update_everest_forms', 'true', admin_url( 'admin.php?page=evf-settings' ) ) ); ?>" class="evf-update-now button-primary"><?php esc_html_e( 'Run the updater', 'everest-forms' ); ?></a></p>
16
+ </div>
17
+ <script type="text/javascript">
18
+ jQuery( '.evf-update-now' ).click( 'click', function() {
19
+ return window.confirm( '<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'everest-forms' ) ); ?>' );
20
+ });
21
+ </script>
includes/admin/views/html-notice-updated.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Updated
4
+ *
5
+ * @package EverestForms\Admin\Notice
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ ?>
13
+ <div id="message" class="updated everest-forms-message evf-connect everest-forms-message--success">
14
+ <a class="everest-forms-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'evf-hide-notice', 'update', remove_query_arg( 'do_update_everest_forms' ) ), 'everest_forms_hide_notices_nonce', '_evf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'everest-forms' ); ?></a>
15
+
16
+ <p><?php esc_html_e( 'Everest Forms data update complete. Thank you for updating to the latest version!', 'everest-forms' ); ?></p>
17
+ </div>
includes/admin/views/html-notice-updating.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Updating
4
+ *
5
+ * @package EverestForms\Admin\Notice
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ ?>
13
+ <div id="message" class="updated everest-forms-message evf-connect">
14
+ <p><strong><?php esc_html_e( 'Everest Forms data update', 'everest-forms' ); ?></strong> &#8211; <?php esc_html_e( 'Your database is being updated in the background.', 'everest-forms' ); ?> <a href="<?php echo esc_url( add_query_arg( 'force_update_everest_forms', 'true', admin_url( 'admin.php?page=evf-settings' ) ) ); ?>"><?php esc_html_e( 'Taking a while? Click here to run it now.', 'everest-forms' ); ?></a></p>
15
+ </div>
includes/class-everest-forms.php ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms setup
4
+ *
5
+ * @author WPEverest
6
+ * @category Classes
7
+ * @package EverestForms
8
+ * @since 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly.
13
+ }
14
+
15
+ /**
16
+ * Main EverestForms Class.
17
+ *
18
+ * @class EverestForms
19
+ * @version 1.0.0
20
+ */
21
+ final class EverestForms {
22
+
23
+ /**
24
+ * EverestForms version.
25
+ *
26
+ * @var string
27
+ */
28
+ public $version = '1.0.0';
29
+
30
+ /**
31
+ * The form data handler instance.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @var object everest_forms_Form_Handler
36
+ */
37
+ public $form;
38
+
39
+ /**
40
+ * The entry data handler instance.
41
+ *
42
+ * @since 1.0.0
43
+ *
44
+ * @var object everest_forms_Entry_Handler
45
+ */
46
+ public $entry;
47
+
48
+ /*
49
+ * Number of grid in form
50
+ */
51
+ public $form_grid = 2;
52
+
53
+ /**
54
+ * The front-end instance.
55
+ *
56
+ * @since 1.0.0
57
+ *
58
+ * @var object everest_forms_Frontend
59
+ */
60
+ public $frontend;
61
+
62
+ /**
63
+ * The process instance.
64
+ *
65
+ * @since 1.0.0
66
+ *
67
+ * @var object everest_forms_Process
68
+ */
69
+ public $process;
70
+
71
+ /**
72
+ * The smart tags instance.
73
+ *
74
+ * @since 1.0.0
75
+ *
76
+ * @var object everest_forms_Smart_Tags
77
+ */
78
+ public $smart_tags;
79
+ /**
80
+ * The single instance of the class.
81
+ *
82
+ * @var EverestForms
83
+ * @since 1.0.0
84
+ */
85
+ protected static $_instance = null;
86
+
87
+ /**
88
+ * Session instance.
89
+ *
90
+ * @var EVF_Session|EVF_Session_Handler
91
+ */
92
+ public $session = null;
93
+
94
+ /**
95
+ * Main EverestForms Instance.
96
+ *
97
+ * Ensures only one instance of EverestForms is loaded or can be loaded.
98
+ *
99
+ * @since 1.0.0
100
+ * @static
101
+ * @see EVF()
102
+ * @return EverestForms - Main instance.
103
+ */
104
+ public static function instance() {
105
+ if ( is_null( self::$_instance ) ) {
106
+ self::$_instance = new self();
107
+ }
108
+
109
+ return self::$_instance;
110
+ }
111
+
112
+ /**
113
+ * Cloning is forbidden.
114
+ *
115
+ * @since 1.0.0
116
+ */
117
+ public function __clone() {
118
+ evf_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'everest-forms' ), '1.0.0' );
119
+ }
120
+
121
+ /**
122
+ * Unserializing instances of this class is forbidden.
123
+ *
124
+ * @since 1.0.0
125
+ */
126
+ public function __wakeup() {
127
+ evf_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'everest-forms' ), '1.0.0' );
128
+ }
129
+
130
+ /**
131
+ * EverestForms Constructor.
132
+ */
133
+ public function __construct() {
134
+ $this->define_constants();
135
+ $this->includes();
136
+ $this->init_hooks();
137
+ add_action( 'plugins_loaded', array( $this, 'objects' ), 10 );
138
+ }
139
+
140
+ /**
141
+ * Hook into actions and filters.
142
+ *
143
+ * @since 1.0.0
144
+ */
145
+ private function init_hooks() {
146
+ register_activation_hook( EVF_PLUGIN_FILE, array( 'EVF_Install', 'install' ) );
147
+ register_shutdown_function( array( $this, 'log_errors' ) );
148
+ add_action( 'after_setup_theme', array( $this, 'include_template_functions' ), 11 );
149
+ add_action( 'init', array( $this, 'init' ), 0 );
150
+ add_action( 'init', array( 'EVF_Shortcodes', 'init' ) );
151
+ add_action( 'init', array( 'EVF_Template_Loader', 'init' ) );
152
+ }
153
+
154
+ /**
155
+ * Ensures fatal errors are logged so they can be picked up in the status report.
156
+ *
157
+ * @since 1.0.0
158
+ */
159
+ public function log_errors() {
160
+ $error = error_get_last();
161
+ if ( E_ERROR === $error['type'] ) {
162
+ $logger = evf_get_logger();
163
+ $logger->critical(
164
+ $error['message'] . PHP_EOL,
165
+ array(
166
+ 'source' => 'fatal-errors',
167
+ )
168
+ );
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Define EVF Constants.
174
+ */
175
+ private function define_constants() {
176
+ $upload_dir = wp_upload_dir( null, false );
177
+ $this->define( 'EVF_ABSPATH', dirname( EVF_PLUGIN_FILE ) . '/' );
178
+ $this->define( 'EVF_PLUGIN_BASENAME', plugin_basename( EVF_PLUGIN_FILE ) );
179
+ $this->define( 'EVF_VERSION', $this->version );
180
+ $this->define( 'EVF_LOG_DIR', $upload_dir['basedir'] . '/evf-logs/' );
181
+ $this->define( 'EVF_SESSION_CACHE_GROUP', 'evf_session_id' );
182
+ $this->define( 'EVF_TEMPLATE_DEBUG_MODE', false );
183
+ }
184
+
185
+ /**
186
+ * Define constant if not already set.
187
+ *
188
+ * @param string $name Constant name.
189
+ * @param string|bool $value Constant value.
190
+ */
191
+ private function define( $name, $value ) {
192
+ if ( ! defined( $name ) ) {
193
+ define( $name, $value );
194
+ }
195
+ }
196
+
197
+ /**
198
+ * What type of request is this?
199
+ *
200
+ * @param string $type admin, ajax, cron or frontend.
201
+ * @return bool
202
+ */
203
+ private function is_request( $type ) {
204
+ switch ( $type ) {
205
+ case 'admin':
206
+ return is_admin();
207
+ case 'ajax':
208
+ return defined( 'DOING_AJAX' );
209
+ case 'cron':
210
+ return defined( 'DOING_CRON' );
211
+ case 'frontend':
212
+ return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Include required core files used in admin and on the frontend.
218
+ */
219
+ public function includes() {
220
+ /**
221
+ * Class autoloader.
222
+ */
223
+ include_once EVF_ABSPATH . 'includes/class-evf-autoloader.php';
224
+
225
+ /**
226
+ * Interfaces.
227
+ */
228
+ include_once EVF_ABSPATH . 'includes/interfaces/class-evf-logger-interface.php';
229
+ include_once EVF_ABSPATH . 'includes/interfaces/class-evf-log-handler-interface.php';
230
+
231
+ /**
232
+ * Abstract classes.
233
+ */
234
+ include_once EVF_ABSPATH . 'includes/abstracts/abstract-evf-log-handler.php';
235
+ include_once EVF_ABSPATH . 'includes/abstracts/abstract-evf-session.php';
236
+
237
+ /**
238
+ * Core classes.
239
+ */
240
+ include_once EVF_ABSPATH . 'includes/evf-core-functions.php';
241
+ include_once EVF_ABSPATH . 'includes/class-evf-post-types.php';
242
+ include_once EVF_ABSPATH . 'includes/class-evf-install.php';
243
+ include_once EVF_ABSPATH . 'includes/class-evf-ajax.php';
244
+ include_once EVF_ABSPATH . 'includes/class-evf-emails.php';
245
+ include_once EVF_ABSPATH . 'includes/class-evf-cache-helper.php';
246
+ include_once EVF_ABSPATH . 'includes/class-evf-field-item.php';
247
+
248
+ if ( $this->is_request( 'admin' ) ) {
249
+ include_once EVF_ABSPATH . 'includes/admin/class-evf-admin.php';
250
+ }
251
+
252
+ /**
253
+ * Forms feature.
254
+ */
255
+ require_once EVF_ABSPATH . 'includes/class-evf-forms-feature.php';
256
+
257
+ if ( $this->is_request( 'frontend' ) ) {
258
+ $this->frontend_includes();
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Include required frontend files.
264
+ */
265
+ public function frontend_includes() {
266
+ include_once EVF_ABSPATH . 'includes/evf-notice-functions.php';
267
+ include_once EVF_ABSPATH . 'includes/class-evf-template-loader.php'; // Template Loader.
268
+ include_once EVF_ABSPATH . 'includes/class-evf-frontend-scripts.php'; // Frontend Scripts.
269
+ include_once EVF_ABSPATH . 'includes/class-evf-shortcodes.php'; // Shortcodes class.
270
+ include_once EVF_ABSPATH . 'includes/class-evf-session-handler.php'; // Session handler class.
271
+ }
272
+
273
+ /**
274
+ * Function used to Init EverestForms Template Functions - This makes them pluggable by plugins and themes.
275
+ */
276
+ public function include_template_functions() {
277
+ include_once EVF_ABSPATH . 'includes/evf-template-functions.php';
278
+ }
279
+
280
+ /**
281
+ * Init EverestForms when WordPress Initialises.
282
+ */
283
+ public function init() {
284
+ // Before init action.
285
+ do_action( 'before_everest_forms_init' );
286
+
287
+ // Set up localisation.
288
+ $this->load_plugin_textdomain();
289
+
290
+ // Classes/actions loaded for the frontend and for ajax requests.
291
+ if ( $this->is_request( 'frontend' ) ) {
292
+ // Session class, handles session data for users - can be overwritten if custom handler is needed.
293
+ $session_class = apply_filters( 'everest_forms_session_handler', 'EVF_Session_Handler' );
294
+ $this->session = new $session_class();
295
+ $this->session->init();
296
+ }
297
+
298
+ // Init action.
299
+ do_action( 'everest_forms_init' );
300
+ }
301
+
302
+ /**
303
+ * Setup objects.
304
+ *
305
+ * @since 1.0.0
306
+ */
307
+ public function objects() {
308
+
309
+ // Global objects.
310
+ $this->form = new EVF_Form_Handler;
311
+ //$this->frontend = new EVF_Forms_Frontend;
312
+ $this->task = new EVF_Form_Task;
313
+ //$this->smart_tags = new EVF_Forms_Smart_Tags;
314
+
315
+ // Hook now that all of the EverestForms stuff is loaded.
316
+ do_action( 'everest_forms_loaded' );
317
+ }
318
+
319
+ /**
320
+ * Load Localisation files.
321
+ *
322
+ * Note: the first-loaded translation file overrides any following ones if the same translation is present.
323
+ *
324
+ * Locales found in:
325
+ * - WP_LANG_DIR/everest-forms/everest-forms-LOCALE.mo
326
+ * - WP_LANG_DIR/plugins/everest-forms-LOCALE.mo
327
+ */
328
+ public
329
+ function load_plugin_textdomain() {
330
+ $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
331
+ $locale = apply_filters( 'plugin_locale', $locale, 'everest_forms' );
332
+
333
+ unload_textdomain( 'everest-forms' );
334
+ load_textdomain( 'everest-forms', WP_LANG_DIR . '/everest-forms/everest-forms-' . $locale . '.mo' );
335
+ load_plugin_textdomain( 'everest-forms', false, plugin_basename( dirname( EVF_PLUGIN_FILE ) ) . '/i18n/languages' );
336
+ }
337
+
338
+ /**
339
+ * Get the plugin url.
340
+ *
341
+ * @return string
342
+ */
343
+ public
344
+ function plugin_url() {
345
+ return untrailingslashit( plugins_url( '/', EVF_PLUGIN_FILE ) );
346
+ }
347
+
348
+ /**
349
+ * Get the plugin path.
350
+ *
351
+ * @return string
352
+ */
353
+ public
354
+ function plugin_path() {
355
+ return untrailingslashit( plugin_dir_path( EVF_PLUGIN_FILE ) );
356
+ }
357
+
358
+ /**
359
+ * Get the template path.
360
+ *
361
+ * @return string
362
+ */
363
+ public
364
+ function template_path() {
365
+ return apply_filters( 'everest_forms_template_path', 'everest-forms/' );
366
+ }
367
+
368
+ /**
369
+ * Get Ajax URL.
370
+ *
371
+ * @return string
372
+ */
373
+ public
374
+ function ajax_url() {
375
+ return admin_url( 'admin-ajax.php', 'relative' );
376
+ }
377
+ }
includes/class-evf-ajax.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ /**
8
+ * EverestForms EVF_AJAX.
9
+ *
10
+ * AJAX Event Handler.
11
+ *
12
+ * @class EVF_AJAX
13
+ * @package EverestForms/Classes
14
+ * @category Class
15
+ * @author WPEverest
16
+ */
17
+ class EVF_AJAX {
18
+
19
+ /**
20
+ * Hook in ajax handlers.
21
+ */
22
+ public static function init() {
23
+ add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
24
+ add_action( 'template_redirect', array( __CLASS__, 'do_evf_ajax' ), 0 );
25
+ self::add_ajax_events();
26
+ }
27
+
28
+
29
+ /**
30
+ * Set EVF AJAX constant and headers.
31
+ */
32
+ public static function define_ajax() {
33
+ if ( ! empty( $_GET['ev-ajax'] ) ) {
34
+ evf_maybe_define_constant( 'DOING_AJAX', true );
35
+ evf_maybe_define_constant( 'EVF_DOING_AJAX', true );
36
+ if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
37
+ @ini_set( 'display_errors', 0 ); // Turn off display_errors during AJAX events to prevent malformed JSON
38
+ }
39
+ $GLOBALS['wpdb']->hide_errors();
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Send headers for EVF Ajax Requests.
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ private static function evf_ajax_headers() {
49
+ send_origin_headers();
50
+ @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
51
+ @header( 'X-Robots-Tag: noindex' );
52
+ send_nosniff_header();
53
+ nocache_headers();
54
+ status_header( 200 );
55
+ }
56
+
57
+ /**
58
+ * Check for EVF Ajax request and fire action.
59
+ */
60
+ public static function do_evf_ajax() {
61
+ global $wp_query;
62
+
63
+ if ( ! empty( $_GET['evf-ajax'] ) ) {
64
+ $wp_query->set( 'evf-ajax', sanitize_text_field( $_GET['evf-ajax'] ) );
65
+ }
66
+
67
+ if ( $action = $wp_query->get( 'evf-ajax' ) ) {
68
+ self::evf_ajax_headers();
69
+ do_action( 'evf_ajax_' . sanitize_text_field( $action ) );
70
+ wp_die();
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Hook in methods - uses WordPress ajax handlers (admin-ajax).
76
+ */
77
+ public static function add_ajax_events() {
78
+ $ajax_events = array(
79
+ 'save_form' => false,
80
+ 'create_form' => false,
81
+ 'get_next_id' => false,
82
+ );
83
+
84
+ foreach ( $ajax_events as $ajax_event => $nopriv ) {
85
+ add_action( 'wp_ajax_everest_forms_' . $ajax_event, array( __CLASS__, $ajax_event ) );
86
+
87
+ if ( $nopriv ) {
88
+ add_action( 'wp_ajax_nopriv_everest_forms_' . $ajax_event, array( __CLASS__, $ajax_event ) );
89
+
90
+ // EVF AJAX can be used for frontend ajax requests.
91
+ add_action( 'evf_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
92
+ }
93
+ }
94
+ }
95
+
96
+ public static function get_next_id() {
97
+ // Run a security check.
98
+ check_ajax_referer( 'everest_forms_get_next_id', 'security' );
99
+
100
+ $form_id = isset( $_POST['form_id'] ) ? absint( $_POST['form_id'] ) : 0;
101
+ if ( $form_id < 1 ) {
102
+ wp_send_json_error( array(
103
+ 'error' => __( 'Invalid form', 'everest-forms' )
104
+ ) );
105
+ }
106
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
107
+ wp_send_json_error();
108
+ }
109
+ $field_key = EVF()->form->field_unique_key( $form_id );
110
+ $field_id_array = explode( '-', $field_key );
111
+ $new_field_id = ( $field_id_array[ count( $field_id_array ) - 1 ] + 1 );
112
+ wp_send_json_success(
113
+ array(
114
+ 'field_id' => $new_field_id,
115
+ 'field_key' => $field_key
116
+ )
117
+ );
118
+ }
119
+
120
+ /**
121
+ * AJAX create new form.
122
+ */
123
+ public static function create_form() {
124
+ ob_start();
125
+
126
+ check_ajax_referer( 'everest_forms_create_form', 'security' );
127
+
128
+ if ( ! current_user_can( 'edit_everest_forms' ) ) {
129
+ wp_die( -1 );
130
+ }
131
+
132
+ $title = isset( $_POST['title'] ) ? $_POST['title'] : __( 'Blank Form', 'everest-forms' );
133
+ $template = isset( $_POST['template'] ) ? $_POST['template'] : 'blank';
134
+
135
+ $form_id = EVF()->form->create( $title, $template );
136
+
137
+ if ( $form_id ) {
138
+ $data = array(
139
+ 'id' => $form_id,
140
+ 'redirect' => add_query_arg(
141
+ array(
142
+ 'tab' => 'fields',
143
+ 'form_id' => $form_id,
144
+ ),
145
+ admin_url( 'admin.php?page=edit-evf-form' )
146
+ ),
147
+ );
148
+
149
+ wp_send_json_success( $data );
150
+ }
151
+
152
+ wp_send_json_error( array(
153
+ 'error' => __( 'Something went wrong, please try again later', 'everest-forms' )
154
+ ) );
155
+ }
156
+
157
+ public static function save_form() {
158
+
159
+ check_ajax_referer( 'everest_forms_save_form', 'security' );
160
+
161
+ // Check for permissions
162
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
163
+ die( __( 'You do not have permission.', 'everest-forms' ) );
164
+ }
165
+
166
+ // Check for form data
167
+ if ( empty( $_POST['form_data'] ) ) {
168
+ die( __( 'No data provided', 'everest-forms' ) );
169
+ }
170
+
171
+ $form_post = json_decode( stripslashes( $_POST['form_data'] ) );
172
+
173
+ $data = array();
174
+
175
+ if ( ! is_null( $form_post ) && $form_post ) {
176
+ foreach ( $form_post as $post_input_data ) {
177
+ // For input names that are arrays (e.g. `menu-item-db-id[3][4][5]`),
178
+ // derive the array path keys via regex and set the value in $_POST.
179
+ preg_match( '#([^\[]*)(\[(.+)\])?#', $post_input_data->name, $matches );
180
+
181
+ $array_bits = array( $matches[1] );
182
+
183
+ if ( isset( $matches[3] ) ) {
184
+ $array_bits = array_merge( $array_bits, explode( '][', $matches[3] ) );
185
+ }
186
+
187
+ $new_post_data = array();
188
+
189
+ // Build the new array value from leaf to trunk.
190
+ for ( $i = count( $array_bits ) - 1; $i >= 0; $i -- ) {
191
+ if ( $i === count( $array_bits ) - 1 ) {
192
+ $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value );
193
+ } else {
194
+ $new_post_data = array(
195
+ $array_bits[ $i ] => $new_post_data,
196
+ );
197
+ }
198
+ }
199
+
200
+ $data = array_replace_recursive( $data, $new_post_data );
201
+ }
202
+ }
203
+
204
+ $form_id = EVF()->form->update( $data['id'], $data );
205
+
206
+ do_action( 'everest_forms_save_form', $form_id, $data );
207
+
208
+ if ( ! $form_id ) {
209
+ die( __( 'An error occurred and the form could not be saved', 'everest-forms' ) );
210
+ } else {
211
+ wp_send_json_success(
212
+ array(
213
+ 'form_name' => esc_html( $data['settings']['form_title'] ),
214
+ 'redirect_url' => admin_url( 'admin.php?page=everest-forms' ),
215
+ )
216
+ );
217
+ }
218
+ }
219
+ }
220
+
221
+ EVF_AJAX::init();
includes/class-evf-autoloader.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * EverestForms Autoloader.
8
+ *
9
+ * @class EVF_Autoloader
10
+ * @version 1.0.0
11
+ * @package EverestForms/Classes
12
+ * @category Class
13
+ * @author WPEverest
14
+ */
15
+ class EVF_Autoloader {
16
+
17
+ /**
18
+ * Path to the includes directory.
19
+ *
20
+ * @var string
21
+ */
22
+ private $include_path = '';
23
+
24
+ /**
25
+ * The Constructor.
26
+ */
27
+ public function __construct() {
28
+ if ( function_exists( "__autoload" ) ) {
29
+ spl_autoload_register( "__autoload" );
30
+ }
31
+
32
+ spl_autoload_register( array( $this, 'autoload' ) );
33
+
34
+ $this->include_path = untrailingslashit( plugin_dir_path( EVF_PLUGIN_FILE ) ) . '/includes/';
35
+ }
36
+
37
+ /**
38
+ * Take a class name and turn it into a file name.
39
+ *
40
+ * @param string $class
41
+ *
42
+ * @return string
43
+ */
44
+ private function get_file_name_from_class( $class ) {
45
+ return 'class-' . str_replace( '_', '-', $class ) . '.php';
46
+ }
47
+
48
+ /**
49
+ * Include a class file.
50
+ *
51
+ * @param string $path
52
+ *
53
+ * @return bool successful or not
54
+ */
55
+ private function load_file( $path ) {
56
+ if ( $path && is_readable( $path ) ) {
57
+ include_once( $path );
58
+
59
+ return true;
60
+ }
61
+
62
+ return false;
63
+ }
64
+
65
+ /**
66
+ * Auto-load EVF classes on demand to reduce memory consumption.
67
+ *
68
+ * @param string $class
69
+ */
70
+ public function autoload( $class ) {
71
+ $class = strtolower( $class );
72
+
73
+ if ( 0 !== strpos( $class, 'evf_' ) ) {
74
+ return;
75
+ }
76
+
77
+ $file = $this->get_file_name_from_class( $class );
78
+ $path = '';
79
+
80
+ if ( 0 === strpos( $class, 'evf_shortcode_' ) ) {
81
+ $path = $this->include_path . 'shortcodes/';
82
+ } elseif ( 0 === strpos( $class, 'evf_meta_box' ) ) {
83
+ $path = $this->include_path . 'admin/meta-boxes/';
84
+ } elseif ( 0 === strpos( $class, 'evf_admin' ) ) {
85
+ $path = $this->include_path . 'admin/';
86
+ } elseif ( 0 === strpos( $class, 'evf_log_handler_' ) ) {
87
+ $path = $this->include_path . 'log-handlers/';
88
+ }
89
+
90
+ if ( empty( $path ) || ! $this->load_file( $path . $file ) ) {
91
+ $this->load_file( $this->include_path . $file );
92
+ }
93
+ }
94
+ }
95
+
96
+ new EVF_Autoloader();
includes/class-evf-background-updater.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Background Updater
4
+ *
5
+ * Uses https://github.com/A5hleyRich/wp-background-processing to handle DB
6
+ * updates in the background.
7
+ *
8
+ * @package EverestForms\Classes
9
+ * @since 1.0.0
10
+ */
11
+
12
+ defined( 'ABSPATH' ) || exit;
13
+
14
+ if ( ! class_exists( 'WP_Async_Request', false ) ) {
15
+ include_once( dirname( __FILE__ ) . '/libraries/wp-async-request.php' );
16
+ }
17
+
18
+ if ( ! class_exists( 'WP_Background_Process', false ) ) {
19
+ include_once( dirname( __FILE__ ) . '/libraries/wp-background-process.php' );
20
+ }
21
+
22
+ /**
23
+ * EVF_Background_Updater Class.
24
+ */
25
+ class EVF_Background_Updater extends WP_Background_Process {
26
+
27
+ /**
28
+ * Initiate new background process.
29
+ */
30
+ public function __construct() {
31
+ // Uses unique prefix per blog so each blog has separate queue.
32
+ $this->prefix = 'wp_' . get_current_blog_id();
33
+ $this->action = 'evf_updater';
34
+
35
+ parent::__construct();
36
+ }
37
+
38
+ /**
39
+ * Dispatch updater.
40
+ *
41
+ * Updater will still run via cron job if this fails for any reason.
42
+ */
43
+ public function dispatch() {
44
+ $dispatched = parent::dispatch();
45
+ $logger = evf_get_logger();
46
+
47
+ if ( is_wp_error( $dispatched ) ) {
48
+ $logger->error(
49
+ sprintf( 'Unable to dispatch EverestFormsupdater: %s', $dispatched->get_error_message() ),
50
+ array( 'source' => 'evf_db_updates' )
51
+ );
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Handle cron healthcheck
57
+ *
58
+ * Restart the background process if not already running
59
+ * and data exists in the queue.
60
+ */
61
+ public function handle_cron_healthcheck() {
62
+ if ( $this->is_process_running() ) {
63
+ // Background process already running.
64
+ return;
65
+ }
66
+
67
+ if ( $this->is_queue_empty() ) {
68
+ // No data to process.
69
+ $this->clear_scheduled_event();
70
+ return;
71
+ }
72
+
73
+ $this->handle();
74
+ }
75
+
76
+ /**
77
+ * Schedule fallback event.
78
+ */
79
+ protected function schedule_event() {
80
+ if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
81
+ wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier );
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Is the updater running?
87
+ *
88
+ * @return boolean
89
+ */
90
+ public function is_updating() {
91
+ return false === $this->is_queue_empty();
92
+ }
93
+
94
+ /**
95
+ * Task
96
+ *
97
+ * Override this method to perform any actions required on each
98
+ * queue item. Return the modified item for further processing
99
+ * in the next pass through. Or, return false to remove the
100
+ * item from the queue.
101
+ *
102
+ * @param string $callback Update callback function.
103
+ * @return mixed
104
+ */
105
+ protected function task( $callback ) {
106
+ evf_maybe_define_constant( 'EVF_UPDATING', true );
107
+
108
+ $logger = evf_get_logger();
109
+
110
+ include_once( dirname( __FILE__ ) . '/evf-update-functions.php' );
111
+
112
+ if ( is_callable( $callback ) ) {
113
+ $logger->info( sprintf( 'Running %s callback', $callback ), array( 'source' => 'evf_db_updates' ) );
114
+ call_user_func( $callback );
115
+ $logger->info( sprintf( 'Finished %s callback', $callback ), array( 'source' => 'evf_db_updates' ) );
116
+ } else {
117
+ $logger->notice( sprintf( 'Could not find %s callback', $callback ), array( 'source' => 'evf_db_updates' ) );
118
+ }
119
+
120
+ return false;
121
+ }
122
+
123
+ /**
124
+ * Complete
125
+ *
126
+ * Override if applicable, but ensure that the below actions are
127
+ * performed, or, call parent::complete().
128
+ */
129
+ protected function complete() {
130
+ $logger = evf_get_logger();
131
+ $logger->info( 'Data update complete', array( 'source' => 'evf_db_updates' ) );
132
+ EVF_Install::update_db_version();
133
+ parent::complete();
134
+ }
135
+ }
includes/class-evf-cache-helper.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cache Helper Class
4
+ *
5
+ * @class EVF_Cache_Helper
6
+ * @version 1.0.0
7
+ * @package EverestForms/Classes
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * EVF_Cache_Helper Class.
16
+ */
17
+ class EVF_Cache_Helper {
18
+
19
+ /**
20
+ * Hook in methods.
21
+ */
22
+ public static function init() {
23
+ add_action( 'admin_notices', array( __CLASS__, 'notices' ) );
24
+ }
25
+
26
+ /**
27
+ * Get prefix for use with wp_cache_set. Allows all cache in a group to be invalidated at once.
28
+ *
29
+ * @param string $group Group of cache to get.
30
+ * @return string
31
+ */
32
+ public static function get_cache_prefix( $group ) {
33
+ $prefix = wp_cache_get( 'evf_' . $group . '_cache_prefix', $group );
34
+
35
+ if ( false === $prefix ) {
36
+ $prefix = 1;
37
+ wp_cache_set( 'evf_' . $group . '_cache_prefix', $prefix, $group );
38
+ }
39
+
40
+ return 'evf_cache_' . $prefix . '_';
41
+ }
42
+
43
+ /**
44
+ * Increment group cache prefix (invalidates cache).
45
+ *
46
+ * @param string $group Group of cache to clear.
47
+ */
48
+ public static function incr_cache_prefix( $group ) {
49
+ wp_cache_incr( 'evf_' . $group . '_cache_prefix', 1, $group );
50
+ }
51
+
52
+ /**
53
+ * Set constants to prevent caching by some plugins.
54
+ *
55
+ * @param mixed $return Value to return. Previously hooked into a filter.
56
+ * @return mixed
57
+ */
58
+ public static function set_nocache_constants( $return = true ) {
59
+ evf_maybe_define_constant( 'DONOTCACHEPAGE', true );
60
+ evf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
61
+ evf_maybe_define_constant( 'DONOTCACHEDB', true );
62
+ return $return;
63
+ }
64
+
65
+ /**
66
+ * Notices function.
67
+ */
68
+ public static function notices() {
69
+ if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) {
70
+ return;
71
+ }
72
+
73
+ $config = w3_instance( 'W3_Config' );
74
+ $enabled = $config->get_integer( 'dbcache.enabled' );
75
+ $settings = array_map( 'trim', $config->get_array( 'dbcache.reject.sql' ) );
76
+
77
+ if ( $enabled && ! in_array( '_evf_session_', $settings, true ) ) {
78
+ ?>
79
+ <div class="error">
80
+ <p><?php echo wp_kses_post( sprintf( __( 'In order for <strong>database caching</strong> to work with Everest Forms you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'everest-forms' ), '<code>_evf_session_</code>', esc_url( admin_url( 'admin.php?page=w3tc_dbcache' ) ) ) ); ?></p>
81
+ </div>
82
+ <?php
83
+ }
84
+ }
85
+ }
86
+
87
+ EVF_Cache_Helper::init();
includes/class-evf-emails.php ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly
5
+ }
6
+
7
+ /**
8
+ * Transactional Emails Controller
9
+ *
10
+ * EverestForms Emails Class which handles the sending on transactional emails and email templates. This class loads in available emails.
11
+ *
12
+ * @class EVF_Emails
13
+ * @version 1.0.0
14
+ * @package EverestForms/Classes/Emails
15
+ * @category Class
16
+ * @author WPEverest
17
+ */
18
+ class EVF_Emails {
19
+
20
+ /**
21
+ * Holds the from address.
22
+ *
23
+ * @since 1.0.0
24
+ *
25
+ * @var string
26
+ */
27
+ private $from_address;
28
+
29
+ /**
30
+ * Holds the from name.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @var string
35
+ */
36
+ private $from_name;
37
+
38
+ /**
39
+ * Holds the reply-to address.
40
+ *
41
+ * @since 1.0.0
42
+ *
43
+ * @var string
44
+ */
45
+ private $reply_to = false;
46
+
47
+ /**
48
+ * Holds the carbon copy addresses.
49
+ *
50
+ * @since 1.0.0
51
+ *
52
+ * @var string
53
+ */
54
+ private $cc = false;
55
+
56
+ /**
57
+ * Holds the email content type.
58
+ *
59
+ * @since 1.0.0
60
+ *
61
+ * @var string
62
+ */
63
+ private $content_type;
64
+
65
+ /**
66
+ * Holds the email headers.
67
+ *
68
+ * @since 1.0.0
69
+ *
70
+ * @var string
71
+ */
72
+ private $headers;
73
+
74
+ /**
75
+ * Whether to send email in HTML.
76
+ *
77
+ * @since 1.0.0
78
+ *
79
+ * @var bool
80
+ */
81
+ private $html = true;
82
+
83
+ /**
84
+ * The email template to use.
85
+ *
86
+ * @since 1.0.0
87
+ *
88
+ * @var string
89
+ */
90
+ private $template;
91
+
92
+ /**
93
+ * Form data.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @var array
98
+ */
99
+ public $form_data = array();
100
+
101
+ /**
102
+ * Fields, formatted, and sanitized.
103
+ *
104
+ * @since 1.0.0
105
+ *
106
+ * @var array
107
+ */
108
+ public $fields = array();
109
+
110
+ /**
111
+ * Entry ID.
112
+ *
113
+ * @since 1.0.0
114
+ *
115
+ * @var int
116
+ */
117
+ public $entry_id = '';
118
+
119
+ /**
120
+ * Get things going.
121
+ *
122
+ * @since 1.0.0
123
+ */
124
+ public function __construct() {
125
+
126
+ if ( 'none' === $this->get_template() ) {
127
+ $this->html = false;
128
+ }
129
+ add_action( 'everest_forms_email_send_before', array( $this, 'send_before' ) );
130
+ add_action( 'everest_forms_email_send_after', array( $this, 'send_after' ) );
131
+
132
+ }
133
+
134
+ /**
135
+ * Set a property.
136
+ *
137
+ * @since 1.0.0
138
+ *
139
+ * @param string $key
140
+ * @param mixed $value
141
+ */
142
+ public function __set( $key, $value ) {
143
+
144
+ $this->$key = $value;
145
+ }
146
+
147
+ /**
148
+ * Get the email from name.
149
+ *
150
+ * @since 1.0.0
151
+ *
152
+ * @return string The email from name
153
+ */
154
+ public function get_from_name() {
155
+ $this->from_name = isset ( $this->from_name ) ? $this->from_name : evf_sender_name();
156
+ return apply_filters( 'everest_forms_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
157
+ }
158
+
159
+ /**
160
+ * Get the email from address.
161
+ *
162
+ * @since 1.0.0
163
+ *
164
+ * @return string The email from address.
165
+ */
166
+ public function get_from_address() {
167
+ $this->from_address = isset ( $this->from_address ) ? $this->from_address : evf_sender_address();
168
+ return apply_filters( 'everest_forms_email_from_address', $this->from_address, $this );
169
+ }
170
+
171
+ /**
172
+ * Get the email reply-to.
173
+ *
174
+ * @since 1.0.0
175
+ *
176
+ * @return string The email reply-to address.
177
+ */
178
+ public function get_reply_to() {
179
+
180
+ if ( ! empty( $this->reply_to ) ) {
181
+
182
+ if ( ! is_email( $this->reply_to ) ) {
183
+ $this->reply_to = false;
184
+ }
185
+ }
186
+ return apply_filters( 'everest_forms_email_reply_to', $this->reply_to, $this );
187
+ }
188
+
189
+ /**
190
+ * Get the email carbon copy addresses.
191
+ *
192
+ * @since 1.0.0
193
+ *
194
+ * @return string The email reply-to address.
195
+ */
196
+ public function get_cc() {
197
+
198
+ if ( ! empty( $this->cc ) ) {
199
+
200
+ $addresses = array_map( 'trim', explode( ',', $this->cc ) );
201
+
202
+ foreach ( $addresses as $key => $address ) {
203
+ if ( ! is_email( $address ) ) {
204
+ unset( $addresses[ $key ] );
205
+ }
206
+ }
207
+
208
+ $this->cc = implode( ',', $addresses );
209
+ }
210
+
211
+ return apply_filters( 'everest_forms_email_cc', $this->cc, $this );
212
+ }
213
+
214
+ /**
215
+ * Get the email content type.
216
+ *
217
+ * @since 1.0.0
218
+ *
219
+ * @return string The email content type.
220
+ */
221
+ public function get_content_type() {
222
+
223
+ if ( ! $this->content_type && $this->html ) {
224
+ $this->content_type = apply_filters( 'everest_forms_email_default_content_type', 'text/html', $this );
225
+ } elseif ( ! $this->html ) {
226
+ $this->content_type = 'text/plain';
227
+ }
228
+
229
+ return apply_filters( 'everest_forms_email_content_type', $this->content_type, $this );
230
+ }
231
+
232
+ /**
233
+ * Get the email headers.
234
+ *
235
+ * @since 1.0.0
236
+ *
237
+ * @return string The email headers.
238
+ */
239
+ public function get_headers() {
240
+
241
+ if ( ! $this->headers ) {
242
+ $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
243
+ if ( $this->get_reply_to() ) {
244
+ $this->headers .= "Reply-To: {$this->get_reply_to()}\r\n";
245
+ }
246
+ if ( $this->get_cc() ) {
247
+ $this->headers .= "Cc: {$this->get_cc()}\r\n";
248
+ }
249
+ $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
250
+ }
251
+
252
+ return apply_filters( 'everest_forms_email_headers', $this->headers, $this );
253
+ }
254
+
255
+ /**
256
+ * Build the email.
257
+ *
258
+ * @since 1.0.0
259
+ *
260
+ * @param string $message The email message.
261
+ *
262
+ * @return string
263
+ */
264
+ public function build_email( $message ) {
265
+
266
+ if ( false === $this->html ) {
267
+
268
+ return apply_filters( 'everest_forms_email_message', $message, $this );
269
+ }
270
+
271
+ ob_start();
272
+
273
+ $this->get_template_part( 'header', $this->get_template(), true );
274
+
275
+ // Hooks into the email header
276
+ do_action( 'everest_forms_email_header', $this );
277
+
278
+ $this->get_template_part( 'body', $this->get_template(), true );
279
+
280
+ // Hooks into the email body
281
+ do_action( 'everest_forms_email_body', $this );
282
+
283
+ $this->get_template_part( 'footer', $this->get_template(), true );
284
+
285
+ // Hooks into the email footer
286
+ do_action( 'everest_forms_email_footer', $this );
287
+
288
+ $message = nl2br( $message );
289
+
290
+ $body = ob_get_clean();
291
+
292
+ $message = make_clickable( $message );
293
+
294
+ return apply_filters( 'everest_forms_email_message', $message, $this );
295
+ }
296
+
297
+ /**
298
+ * Send the email.
299
+ *
300
+ * @since 1.0.0
301
+ *
302
+ * @param string $to The To address.
303
+ * @param string $subject The subject line of the email.
304
+ * @param string $message The body of the email.
305
+ * @param string|array $attachments Attachments to the email.
306
+ *
307
+ * @return bool
308
+ */
309
+ public function send( $to, $subject, $message, $attachments = array() ) {
310
+
311
+ if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
312
+ evf_doing_it_wrong( __FUNCTION__, __( 'You cannot send emails with EVF_Emails until init/admin_init has been reached', 'everest-forms' ), null );
313
+ return false;
314
+ }
315
+
316
+ // Don't send anything if emails have been disabled
317
+ if ( $this->is_email_disabled() ) {
318
+ return false;
319
+ }
320
+
321
+ // Don't send if email address is invalid
322
+ if ( ! is_email( $to ) ) {
323
+ return false;
324
+ }
325
+
326
+ // Hooks before email is sent
327
+ do_action( 'everest_forms_email_send_before', $this );
328
+
329
+ $message = $this->build_email( $message );
330
+ $attachments = apply_filters( 'everest_forms_email_attachments', $attachments, $this );
331
+ $subject = wp_specialchars_decode( $subject );
332
+
333
+ // Let's do this
334
+ $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
335
+
336
+ // Hooks after the email is sent
337
+ do_action( 'everest_forms_email_send_after', $this );
338
+
339
+ // return $sent;
340
+ }
341
+
342
+ /**
343
+ * Add filters/actions before the email is sent.
344
+ *
345
+ * @since 1.0.0
346
+ */
347
+ public function send_before() {
348
+
349
+ add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
350
+ add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
351
+ add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
352
+ }
353
+
354
+ /**
355
+ * Remove filters/actions after the email is sent.
356
+ *
357
+ * @since 1.0.0
358
+ */
359
+ public function send_after() {
360
+
361
+ remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
362
+ remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
363
+ remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
364
+ }
365
+
366
+ /**
367
+ * Converts text formatted HTML. This is primarily for turning line breaks
368
+ * into <p> and <br/> tags.
369
+ *
370
+ * @since 1.0.0
371
+ *
372
+ * @param string $message
373
+ *
374
+ * @return string
375
+ */
376
+ public function text_to_html( $message ) {
377
+
378
+ if ( 'text/html' === $this->content_type || true === $this->html ) {
379
+ $message = wpautop( $message );
380
+ }
381
+
382
+ return $message;
383
+ }
384
+
385
+ /**
386
+ * Process the all fields smart tag if present.
387
+ *
388
+ * @since 1.0.0
389
+ *
390
+ * @param bool $html
391
+ *
392
+ * @return string
393
+ */
394
+ public function everest_forms_html_field_value( $html = true ) {
395
+
396
+ if ( empty( $this->fields ) ) {
397
+ return '';
398
+ }
399
+
400
+ $message = '';
401
+
402
+ if ( $html ) {
403
+
404
+ // HTML emails ---------------------------------------------------//
405
+ ob_start();
406
+
407
+ // Hooks into the email field
408
+ do_action( 'everest_forms_email_field', $this );
409
+
410
+ $this->get_template_part( 'field', $this->get_template(), true );
411
+
412
+ $field_template = ob_get_clean();
413
+
414
+ $x = 1;
415
+ foreach ( $this->fields as $field ) {
416
+
417
+ if (
418
+ ! apply_filters( 'everest_forms_email_display_empty_fields', false ) &&
419
+ ( empty( $field['value'] ) && '0' !== $field['value'] )
420
+ ) {
421
+ continue;
422
+ }
423
+
424
+ $field_val = empty( $field['value'] ) && '0' !== $field['value'] ? '<em>' . __( '(empty)', 'everest-forms' ) . '</em>' : $field['value'];
425
+ $field_name = ! empty( $field['name'] ) ? $field['name'] : __( 'Field ID #', 'everest-forms' ) . absint( $field['id'] );
426
+
427
+ $field_item = $field_template;
428
+ if ( 1 === $x ) {
429
+ $field_item = str_replace( 'border-top:1px solid #dddddd;', '', $field_item );
430
+ }
431
+ $field_value = apply_filters( 'everest_forms_html_field_value', stripslashes( wp_specialchars_decode( $field_val ) ), $field, $this->form_data, 'email-html' );
432
+
433
+ $message .= wpautop( $field_item );
434
+ $x ++;
435
+ }
436
+ } else {
437
+
438
+ // Plain Text emails ---------------------------------------------//
439
+ foreach ( $this->fields as $field ) {
440
+
441
+ if ( ! apply_filters( 'everest_forms_email_display_empty_fields', false ) && ( empty( $field['value'] ) && '0' !== $field['value'] ) ) {
442
+ continue;
443
+ }
444
+
445
+ $field_val = empty( $field['value'] ) && '0' !== $field['value'] ? __( '(empty)', 'everest-forms' ) : $field['value'];
446
+ $field_name = ! empty( $field['name'] ) ? $field['name'] : __( 'Field ID #', 'everest-forms' ) . ( $field['id'] );
447
+
448
+ $message .= '--- ' . wp_specialchars_decode( $field_name ) . " ---\r\n";
449
+ $field_value = stripslashes( wp_specialchars_decode( $field_val ) ) . "\r\n\r\n";
450
+ $message .= apply_filters( 'everest_forms_plaintext_field_value', $field_value, $field, $this->form_data );
451
+ }
452
+ }
453
+
454
+ if ( empty( $message ) ) {
455
+ $empty_message = __( 'An empty form was submitted.', 'everest-forms' );
456
+ $message = $html ? wpautop( $empty_message ) : $empty_message;
457
+ }
458
+
459
+ return $message;
460
+ }
461
+
462
+ /**
463
+ * Email kill switch if needed.
464
+ *
465
+ * @since 1.0.0
466
+ *
467
+ * @return bool
468
+ */
469
+ public function is_email_disabled() {
470
+
471
+ $disabled = (bool) apply_filters( 'everest_forms_disable_all_emails', false, $this );
472
+
473
+ return $disabled;
474
+ }
475
+
476
+ /**
477
+ * Get the enabled email template.
478
+ *
479
+ * @since 1.0.0
480
+ *
481
+ * @return string When filtering return 'none' to switch to text/plain email.
482
+ */
483
+ public function get_template() {
484
+
485
+
486
+ return apply_filters( 'everest_forms_email_template', $this->template );
487
+ }
488
+
489
+ /**
490
+ * Retrieves a template part. Taken from bbPress.
491
+ *
492
+ * @since 1.0.0
493
+ *
494
+ * @param string $slug
495
+ * @param string $name Optional. Default null.
496
+ * @param bool $load
497
+ *
498
+ * @return string
499
+ */
500
+ public function get_template_part( $slug, $name = null, $load = true ) {
501
+
502
+ // Setup possible parts
503
+ $templates = array();
504
+ if ( isset( $name ) ) {
505
+ $templates[] = $slug . '-' . $name . '.php';
506
+ }
507
+ $templates[] = $slug . '.php';
508
+
509
+ // Return the part that is found
510
+ return $this->locate_template( $templates, $load, false );
511
+ }
512
+
513
+ /**
514
+ * Retrieve the name of the highest priority template file that exists.
515
+ *
516
+ * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
517
+ * inherit from a parent theme can just overload one file. If the template is
518
+ * not found in either of those, it looks in the theme-compat folder last.
519
+ *
520
+ * Taken from bbPress.
521
+ *
522
+ * @since 1.0.0
523
+ *
524
+ * @param string|array $template_names Template file(s) to search for, in order.
525
+ * @param bool $load If true the template file will be loaded if it is found.
526
+ * @param bool $require_once Whether to require_once or require. Default true.
527
+ * Has no effect if $load is false.
528
+ *
529
+ * @return string The template filename if one is located.
530
+ */
531
+ public function locate_template( $template_names, $load = false, $require_once = true ) {
532
+
533
+ // No file found yet
534
+ $located = false;
535
+
536
+ // Try to find a template file
537
+ foreach ( (array) $template_names as $template_name ) {
538
+
539
+ // Continue if template is empty
540
+ if ( empty( $template_name ) ) {
541
+ continue;
542
+ }
543
+
544
+ // Trim off any slashes from the template name
545
+ $template_name = ltrim( $template_name, '/' );
546
+
547
+ // try locating this template file by looping through the template paths
548
+ foreach ( $this->get_theme_template_paths() as $template_path ) {
549
+ if ( file_exists( $template_path . $template_name ) ) {
550
+ $located = $template_path . $template_name;
551
+ break;
552
+ }
553
+ }
554
+ }
555
+
556
+ if ( ( true === $load ) && ! empty( $located ) ) {
557
+ load_template( $located, $require_once );
558
+ }
559
+
560
+ return $located;
561
+ }
562
+
563
+ /**
564
+ * Returns a list of paths to check for template locations
565
+ *
566
+ * @since 1.0.0
567
+ *
568
+ * @return array
569
+ */
570
+ public function get_theme_template_paths() {
571
+
572
+ $template_dir = 'everest_forms-email';
573
+
574
+ $file_paths = array(
575
+ 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
576
+ 10 => trailingslashit( get_template_directory() ) . $template_dir,
577
+ 100 => EVF_PLUGIN_FILE . 'includes/emails/templates',
578
+ );
579
+
580
+ $file_paths = apply_filters( 'everest_forms_email_template_paths', $file_paths );
581
+
582
+ // sort the file paths based on priority
583
+ ksort( $file_paths, SORT_NUMERIC );
584
+
585
+ return array_map( 'trailingslashit', $file_paths );
586
+ }
587
+
588
+ }
includes/class-evf-field-item.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Fields
4
+ *
5
+ * @author WPEverest
6
+ * @category Classes
7
+ * @package EverestForms
8
+ * @since 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly.
13
+ }
14
+
15
+ /**
16
+ * Everest Forms Field Class
17
+ *
18
+ * @class EverestForms
19
+ * @version 1.0.0
20
+ */
21
+ class EVF_Field_Item {
22
+ /**
23
+ * Primary class constructor.
24
+ *
25
+ * @since 1.0.0
26
+ */
27
+ public function __construct() {
28
+
29
+ $this->init();
30
+ }
31
+
32
+ /**
33
+ * Load and init the base field class.
34
+ *
35
+ * @since 1.0.0
36
+ */
37
+ public function init() {
38
+
39
+ // Parent class template
40
+ require_once EVF_ABSPATH . 'includes/abstracts/abstract-evf-form-fields.php';
41
+
42
+ // Load default fields on WP init
43
+ add_action( 'init', array( $this, 'load' ) );
44
+ }
45
+
46
+ /**
47
+ * Load default field types.
48
+ *
49
+ * @since 1.0.0
50
+ */
51
+ public function load() {
52
+
53
+ $fields = apply_filters( 'everest_forms_load_fields', array(
54
+ 'first-name',
55
+ 'last-name',
56
+ 'text',
57
+ 'textarea',
58
+ 'select',
59
+ 'radio',
60
+ 'checkbox',
61
+ 'email',
62
+ 'url',
63
+ 'hidden',
64
+ 'html',
65
+ 'name',
66
+ 'password',
67
+ 'address',
68
+ 'phone',
69
+ 'date-time',
70
+ 'number',
71
+
72
+ ) );
73
+
74
+ foreach ( $fields as $field ) {
75
+
76
+ $field_class_path = ( EVF_ABSPATH . 'includes/form-fields/class-evf-field-' . $field . '.php' );
77
+ if ( file_exists( $field_class_path ) ) {
78
+ require_once $field_class_path;
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ new EVF_Field_Item;
includes/class-evf-form-handler.php ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * form handler.
5
+ *
6
+ * Contains a bunch of helper methods as well.
7
+ *
8
+ * @package EverestForms
9
+ * @author WPEverest
10
+ * @since 1.0.0
11
+ */
12
+ class EVF_Form_Handler {
13
+
14
+ /**
15
+ * Constructor.
16
+ */
17
+ public function __construct() {
18
+
19
+ }
20
+
21
+ /**
22
+ * Fetches forms
23
+ *
24
+ * @since 1.0.0
25
+ * @param mixed $id
26
+ * @param array $args
27
+ * @return array|bool|null|WP_Post
28
+ */
29
+ public function get( $id = '', $args = array() ) {
30
+
31
+ $args = apply_filters( 'everest_forms_get_form_args', $args );
32
+
33
+ if ( false === $id ) {
34
+ return false;
35
+ }
36
+
37
+ if ( ! empty( $id ) ) {
38
+
39
+ // @todo add $id array support
40
+ // If ID is provided, we get a single form
41
+ $forms = get_post( absint( $id ) );
42
+
43
+ if ( ! empty( $args['content_only'] ) && ! empty( $forms ) && 'everest_form' === $forms->post_type ) {
44
+
45
+ $forms = evf_decode( $forms->post_content );
46
+ }
47
+ } else {
48
+
49
+ // No ID provided, get multiple forms
50
+ $defaults = array(
51
+ 'post_type' => 'everest-forms',
52
+ 'orderby' => 'id',
53
+ 'order' => 'ASC',
54
+ 'no_found_rows' => true,
55
+ 'nopaging' => true,
56
+ );
57
+
58
+ $args = wp_parse_args( $args, $defaults );
59
+
60
+ $args['post_type'] = 'everest-forms';
61
+
62
+ $forms = get_posts( $args );
63
+ }
64
+
65
+ if ( empty( $forms ) ) {
66
+ return false;
67
+ }
68
+
69
+ return $forms;
70
+ }
71
+
72
+ /**
73
+ * Delete forms.
74
+ *
75
+ * @since 1.0.0
76
+ * @param array $ids
77
+ * @return boolean
78
+ */
79
+ public function delete( $ids = array() ) {
80
+
81
+ // Check for permissions
82
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
83
+ return false;
84
+ }
85
+
86
+ if ( ! is_array( $ids ) ) {
87
+ $ids = array( $ids );
88
+ }
89
+
90
+ $ids = array_map( 'absint', $ids );
91
+
92
+ foreach ( $ids as $id ) {
93
+
94
+ $form = wp_delete_post( $id, true );
95
+
96
+ if ( class_exists( 'EVF_Entry_Handler' ) ) {
97
+ /// Delete entry if exists
98
+ }
99
+
100
+ if ( ! $form ) {
101
+ return false;
102
+ }
103
+ }
104
+
105
+ return true;
106
+ }
107
+
108
+ /**
109
+ * Create new form.
110
+ *
111
+ * @since 1.0.0
112
+ * @param string $title
113
+ * @param array $args
114
+ * @param array $data
115
+ * @return mixed
116
+ */
117
+ public static function create( $title = '', $template = 'blank', $args = array(), $data = array() ) {
118
+ if ( empty( $title ) || ! current_user_can( 'manage_everest_forms' ) ) {
119
+ return false;
120
+ }
121
+
122
+ $args = apply_filters( 'everest_forms_create_form_args', $args, $data );
123
+ $form_content = array(
124
+ 'form_field_id' => '1',
125
+ 'settings' => array(
126
+ 'form_title' => sanitize_text_field( $title ),
127
+ 'form_desc' => '',
128
+ ),
129
+ );
130
+
131
+ // Check for template and format the form content.
132
+ if ( in_array( $template, array( 'contact' ), true ) ) {
133
+ include_once( dirname( __FILE__ ) . "/templates/{$template}.php" );
134
+ $form_content = $form_template[ $template ];
135
+ }
136
+
137
+ // Create a form.
138
+ $form_id = wp_insert_post( array(
139
+ 'post_title' => esc_html( $title ),
140
+ 'post_status' => 'publish',
141
+ 'post_type' => 'everest_form',
142
+ 'post_content' => '{}',
143
+ ) );
144
+
145
+ if ( $form_id ) {
146
+ $form_data = wp_parse_args( $args, array(
147
+ 'ID' => $form_id,
148
+ 'post_title' => esc_html( $title ),
149
+ 'post_content' => evf_encode( array_merge( array( 'id' => $form_id ), $form_content ) ),
150
+ ) );
151
+
152
+ wp_update_post( $form_data );
153
+ }
154
+
155
+ do_action( 'everest_forms_create_form', $form_id, $form_data, $data );
156
+
157
+ return $form_id;
158
+ }
159
+
160
+ /**
161
+ * Updates form
162
+ *
163
+ * @since 1.0.0
164
+ * @param string $form_id
165
+ * @param array $data
166
+ * @param array $args
167
+ * @return mixed
168
+ * @internal param string $title
169
+ */
170
+ public function update( $form_id = '', $data = array(), $args = array() ) {
171
+
172
+ // This filter breaks forms if they contain HTML
173
+ remove_filter( 'content_save_pre', 'balanceTags', 50 );
174
+
175
+ // Check for permissions
176
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
177
+ return false;
178
+ }
179
+
180
+ if ( empty( $data ) ) {
181
+ return false;
182
+ }
183
+
184
+ if ( empty( $form_id ) ) {
185
+ $form_id = $data['form_id'];
186
+ }
187
+
188
+ $data = wp_unslash( $data );
189
+
190
+ if ( ! empty( $data['settings']['form_title'] ) ) {
191
+ $title = $data['settings']['form_title'];
192
+ } else {
193
+ $title = get_the_title( $form_id );
194
+ }
195
+
196
+ if ( ! empty( $data['settings']['form_desc'] ) ) {
197
+ $desc = $data['settings']['form_desc'];
198
+ } else {
199
+ $desc = '';
200
+ }
201
+
202
+ $data['form_field_id'] = ! empty( $data['form_field_id'] ) ? absint( $data['form_field_id'] ) : '0';
203
+
204
+
205
+ // Sanitize - don't allow tags for users who do not have appropriate cap
206
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
207
+ array_walk_recursive( $data, 'wp_strip_all_tags' );
208
+ }
209
+
210
+ $form = array(
211
+ 'ID' => $form_id,
212
+ 'post_title' => esc_html( $title ),
213
+ 'post_excerpt' => $desc,
214
+ 'post_content' => evf_encode( $data ),
215
+ );
216
+ $form = apply_filters( 'everest_forms_save_form_args', $form, $data, $args );
217
+ $form_id = wp_update_post( $form );
218
+
219
+ do_action( 'everest_forms_save_form', $form_id, $form );
220
+
221
+ return $form_id;
222
+ }
223
+
224
+ /**
225
+ * Duplicate forms.
226
+ *
227
+ * @since 1.0.0
228
+ * @param array $ids
229
+ * @return boolean
230
+ */
231
+ public function duplicate( $ids = array() ) {
232
+
233
+ // Check for permissions.
234
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
235
+ return false;
236
+ }
237
+
238
+ if ( ! is_array( $ids ) ) {
239
+ $ids = array( $ids );
240
+ }
241
+
242
+ $ids = array_map( 'absint', $ids );
243
+
244
+ foreach ( $ids as $id ) {
245
+
246
+ // Get original entry.
247
+ $form = get_post( $id );
248
+
249
+ // Confirm form exists.
250
+ if ( ! $form || empty( $form ) ) {
251
+ return false;
252
+ }
253
+
254
+ // Get the form data.
255
+ $new_form_data = evf_decode( $form->post_content );
256
+
257
+ // Remove form ID from title if present.
258
+ $new_form_data['settings']['form_title'] = str_replace( '(ID #' . absint( $id ) . ')', '', $new_form_data['settings']['form_title'] );
259
+
260
+ // Create the duplicate form.
261
+ $new_form = array(
262
+ 'post_author' => $form->post_author,
263
+ 'post_content' => evf_encode( $new_form_data ),
264
+ 'post_excerpt' => $form->post_excerpt,
265
+ 'post_status' => $form->post_status,
266
+ 'post_title' => $new_form_data['settings']['form_title'],
267
+ 'post_type' => $form->post_type,
268
+ );
269
+ $new_form_id = wp_insert_post( $new_form );
270
+
271
+ if ( ! $new_form_id || is_wp_error( $new_form_id ) ) {
272
+ return false;
273
+ }
274
+
275
+ // Set new form name.
276
+ $new_form_data['settings']['form_title'] .= ' (ID #' . absint( $new_form_id ) . ')';
277
+
278
+ // Set new form ID.
279
+ $new_form_data['id'] = absint( $new_form_id );
280
+
281
+ // Update new duplicate form.
282
+ $new_form_id = $this->update( $new_form_id, $new_form_data );
283
+
284
+ if ( ! $new_form_id || is_wp_error( $new_form_id ) ) {
285
+ return false;
286
+ }
287
+ }
288
+
289
+ return true;
290
+ }
291
+
292
+ /**
293
+ * Get the next available field ID and increment by one.
294
+ *
295
+ * @since 1.0.0
296
+ * @param int $form_id
297
+ * @return mixed int or false
298
+ */
299
+ public function field_unique_key( $form_id ) {
300
+ if ( ! current_user_can( apply_filters( 'everest_forms_manage_cap', 'manage_options' ) ) ) {
301
+ return false;
302
+ }
303
+
304
+ if ( empty( $form_id ) ) {
305
+ return false;
306
+ }
307
+
308
+
309
+ $form = $this->get( $form_id, array(
310
+ 'content_only' => true,
311
+ ) );
312
+
313
+ if ( ! empty( $form['form_field_id'] ) ) {
314
+ $form_field_id = absint( $form['form_field_id'] );
315
+ $form['form_field_id'] ++;
316
+ } else {
317
+ $form_field_id = '0';
318
+ $form['form_field_id'] = '1';
319
+ }
320
+
321
+ $this->update( $form_id, $form );
322
+
323
+ $field_id = evf_get_random_string() . '-' . $form_field_id;
324
+
325
+ return $field_id;
326
+ }
327
+
328
+
329
+ /**
330
+ * Get private meta information for a form field.
331
+ *
332
+ * @since 1.0.0
333
+ * @param string $form_id
334
+ * @param string $field_id
335
+ * @return bool
336
+ */
337
+ public function get_field( $form_id, $field_id = '' ) {
338
+
339
+ if ( empty( $form_id ) ) {
340
+ return false;
341
+ }
342
+
343
+ $data = $this->get( $form_id, array(
344
+ 'content_only' => true,
345
+ ) );
346
+
347
+ return isset( $data['form_fields'][ $field_id ] ) ? $data['form_fields'][ $field_id ] : false;
348
+ }
349
+ }
includes/class-evf-form-task.php ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Process form data
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Form_Task {
14
+
15
+ /**
16
+ * Holds errors.
17
+ *
18
+ * @since 1.0.0
19
+ * @var array
20
+ */
21
+ public $errors;
22
+
23
+ /**
24
+ * Holds formatted fields.
25
+ *
26
+ * @since 1.0.0
27
+ * @var array
28
+ */
29
+ public $form_fields;
30
+
31
+ /**
32
+ * Holds the ID of a successful entry.
33
+ *
34
+ * @since 1.0.0
35
+ * @var int
36
+ */
37
+ public $entry_id = 0;
38
+
39
+ /**
40
+ * Primary class constructor.
41
+ *
42
+ * @since 1.0.0
43
+ */
44
+ public function __construct() {
45
+ add_action( 'wp', array( $this, 'listen_task' ) );
46
+ }
47
+
48
+ /**
49
+ * Listen to see if this is a return callback or a posted form entry.
50
+ *
51
+ * @since 1.0.0
52
+ */
53
+ public function listen_task() {
54
+ if ( ! empty( $_GET['everest_forms_return'] ) ) {
55
+ $this->entry_confirmation_redirect( '', $_GET['everest_forms_return'] );
56
+ }
57
+
58
+ if ( ! empty( $_POST['everest_forms']['id'] ) ) {
59
+ $this->do_task( stripslashes_deep( $_POST['everest_forms'] ) );
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Do task of form entry
65
+ *
66
+ * @since 1.0.0
67
+ * @param array $entry $_POST object.
68
+ */
69
+ public function do_task( $entry ) {
70
+ try {
71
+ if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'everest-forms_process_submit' ) ) {
72
+ evf_add_notice( __( 'We were unable to process your form, please try again.', 'everest-forms' ) );
73
+ return;
74
+ }
75
+
76
+ $this->errors = array();
77
+ $this->form_fields = array();
78
+ $form_id = absint( $entry['id'] );
79
+ $form = EVF()->form->get( $form_id );
80
+
81
+ // Validate form is real and active (published).
82
+ if ( ! $form || 'publish' !== $form->post_status ) {
83
+ evf_add_notice( __('Invalid form. Please check again.', 'everest-forms') ,'error');
84
+ return;
85
+ }
86
+
87
+ // Formatted form data for hooks
88
+ $form_data = apply_filters( 'everest_forms_process_before_form_data', evf_decode( $form->post_content ), $entry );
89
+
90
+ // Pre-process/validate hooks and filter. Data is not validated or cleaned yet so use with caution.
91
+ $entry = apply_filters( 'everest_forms_process_before_filter', $entry, $form_data );
92
+
93
+ do_action( 'everest_forms_process_before', $entry, $form_data );
94
+ do_action( "everest_forms_process_before_{$form_id}", $entry, $form_data );
95
+
96
+ // Validate fields.
97
+ foreach ( $form_data['form_fields'] as $field ) {
98
+ $field_id = $field['id'];
99
+ $field_type = $field['type'];
100
+ $field_submit = isset( $entry['form_fields'][ $field_id ] ) ? $entry['form_fields'][ $field_id ] : '';
101
+ do_action( "everest_forms_process_validate_{$field_type}", $field_id, $field_type, $field_submit, $form_data );
102
+ }
103
+
104
+ // Recaptcha Validation
105
+ if( isset( $form_data['settings']['recaptcha_support'] ) && 1 == $form_data['settings']['recaptcha_support'] && empty( $_POST['g-recaptcha-response'] ) ){
106
+ evf_add_notice( get_option('evf_recaptcha_validation', __('Invalid recaptcha code.', 'everest-forms') ),'error');
107
+ update_option( 'evf_validation_error', 'yes');
108
+ }
109
+
110
+ if( get_option( 'evf_validation_error' ) === 'yes' ){
111
+ delete_option( 'evf_validation_error' );
112
+ return;
113
+ }
114
+
115
+ $errors = apply_filters( 'everest_forms_process_initial_errors', $this->errors, $form_data );
116
+
117
+ if ( ! empty( $errors[ $form_id ] ) ) {
118
+ if ( empty( $this->errors[ $form_id ]['header'] ) ) {
119
+ $this->errors[ $form_id ]['header'] = __( 'Form has not been submitted, please see the errors below.', 'everest-forms' );
120
+ }
121
+ }
122
+
123
+ $is_spam = false;
124
+
125
+ // Only trigger the processing (saving/sending entries, etc) if the entry.
126
+ // is not spam.
127
+ if ( ! $is_spam ) {
128
+
129
+ // Pass the form created date into the form data.
130
+ $form_data['created'] = $form->post_date;
131
+
132
+ // Format fields
133
+ foreach ( (array) $form_data['form_fields'] as $field ) {
134
+
135
+ $field_id = $field['id'];
136
+ $field_type = $field['type'];
137
+ $field_submit = isset( $entry['fields'][ $field_id ] ) ? $entry['fields'][ $field_id ] : '';
138
+
139
+ do_action( "everest_forms_process_format_{$field_type}", $field_id, $field_submit, $form_data );
140
+ }
141
+
142
+ // This hook is for internal purposes and should not be leveraged.
143
+ do_action( 'everest_forms_process_format_after', $form_data );
144
+
145
+ // Process hooks/filter - this is where most addons should hook
146
+ // because at this point we have completed all field validation and
147
+ // formatted the data.
148
+ $this->form_fields = apply_filters( 'everest_forms_process_filter', $this->form_fields, $entry, $form_data );
149
+
150
+ do_action( 'everest_forms_process', $this->form_fields, $entry, $form_data );
151
+ do_action( "everest_forms_process_{$form_id}", $this->form_fields, $entry, $form_data );
152
+
153
+ $this->form_fields = apply_filters( 'everest_forms_process_after_filter', $this->form_fields, $entry, $form_data );
154
+
155
+ // One last error check - don't proceed if there are any errors.
156
+ if ( ! empty( $this->errors[ $form_id ] ) ) {
157
+ if ( empty( $this->errors[ $form_id ]['header'] ) ) {
158
+ $this->errors[ $form_id ]['header'] = __( 'Form has not been submitted, please see the errors below.', 'everest-forms' );
159
+ }
160
+
161
+ return;
162
+ }
163
+
164
+ // Success - add entry to database.
165
+ $entry_id = $this->entry_save( $this->form_fields, $entry, $form_data['id'], $form_data );
166
+
167
+ // Success - send email notification.
168
+ $this->entry_email( $this->form_fields, $entry, $form_data, $entry_id, 'entry' );
169
+
170
+ // Pass completed and formatted fields in POST.
171
+ $_POST['everest-forms']['complete'] = $this->form_fields;
172
+
173
+ // Pass entry ID in POST.
174
+ $_POST['everest-forms']['entry_id'] = $entry_id;
175
+
176
+ // Post-process hooks.
177
+ do_action( 'everest_forms_process_complete', $this->form_fields, $entry, $form_data, $entry_id );
178
+ do_action( "everest_forms_process_complete_{$form_id}", $this->form_fields, $entry, $form_data, $entry_id );
179
+ }
180
+ } catch ( Exception $e ) {
181
+ evf_add_notice( $e->getMessage(), 'error' );
182
+ }
183
+
184
+ evf_add_notice( isset( $form_data['settings']['successful_form_submission_message'] ) ? $form_data['settings']['successful_form_submission_message'] : __( 'Thanks for contacting us! We will be in touch with you shortly.', 'everest-forms' ), 'success' );
185
+
186
+ $this->entry_confirmation_redirect( $form_data );
187
+ }
188
+
189
+ /**
190
+ * Validate the form return hash.
191
+ *
192
+ * @since 1.0.0
193
+ *
194
+ * @param string $hash
195
+ *
196
+ * @return mixed false for invalid or form id
197
+ */
198
+ public function validate_return_hash( $hash = '' ) {
199
+
200
+ $query_args = base64_decode( $hash );
201
+ parse_str( $query_args );
202
+
203
+ // Verify hash matches.
204
+ if ( wp_hash( $form_id . ',' . $entry_id ) !== $hash ) {
205
+ return false;
206
+ }
207
+
208
+ // Get lead and verify it is attached to the form we received with it.
209
+ $entry = EVF()->entry->get( $entry_id );
210
+
211
+ if ( $form_id != $entry->form_id ) {
212
+ return false;
213
+ }
214
+
215
+ return $form_id;
216
+ }
217
+
218
+ /**
219
+ * Redirects user to a page or URL specified in the form confirmation settings.
220
+ *
221
+ * @since 1.0.0
222
+ *
223
+ * @param array|string $form_data
224
+ * @param string $hash
225
+ */
226
+ public function entry_confirmation_redirect( $form_data = '', $hash = '' ) {
227
+
228
+ $_POST = array(); //clear fields after successful form submission
229
+
230
+ if ( ! empty( $hash ) ) {
231
+
232
+ $form_id = $this->validate_return_hash( $hash );
233
+
234
+ if ( ! $form_id ) {
235
+ return;
236
+ }
237
+
238
+ // Get form
239
+ $form_data = EVF()->form->get( $form_id, array(
240
+ 'content_only' => true,
241
+ ) );
242
+ }
243
+ $settings = $form_data['settings'];
244
+ if( isset( $settings['redirect_to'] ) && '1' == $settings['redirect_to'] ) {
245
+ ?>
246
+ <script>
247
+ var redirect = '<?php echo get_permalink( $settings['custom_page'] ); ?>';
248
+ window.setTimeout(function () {
249
+ window.location.href = redirect;
250
+ }, 3000)
251
+ </script>
252
+ <?php
253
+ }
254
+ else if ( isset( $settings['redirect_to'] ) && '2' == $settings['redirect_to']){
255
+ ?><script>
256
+ window.setTimeout(function () {
257
+ window.location.href = '<?php echo $settings['external_url'];?>';
258
+ }, 3000)
259
+ </script>
260
+ <?php
261
+ }
262
+
263
+ // Redirect if needed, to either a page or URL, after form processing.
264
+ if ( ! empty( $form_data['settings']['confirmation_type'] ) && 'message' !== $form_data['settings']['confirmation_type'] ) {
265
+
266
+ if ( 'redirect' === $form_data['settings']['confirmation_type'] ) {
267
+ $url = apply_filters( 'everest_forms_process_smart_tags', $form_data['settings']['confirmation_redirect'], $form_data, $this->form_fields, $this->entry_id );
268
+ }
269
+
270
+ if ( 'page' === $form_data['settings']['confirmation_type'] ) {
271
+ $url = get_permalink( (int) $form_data['settings']['confirmation_page'] );
272
+ }
273
+ }
274
+
275
+ if ( ! empty( $form_data['id'] ) ) {
276
+ $form_id = $form_data['id'];
277
+ } else {
278
+ return;
279
+ }
280
+ if ( ! empty( $url ) ) {
281
+ $url = apply_filters( 'everest_forms_process_redirect_url', $url, $form_id, $this->form_fields );
282
+ wp_redirect( esc_url_raw( $url ) );
283
+ do_action( 'everest_forms_process_redirect', $form_id );
284
+ do_action( "everest_forms_process_redirect_{$form_id}", $form_id );
285
+ exit;
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Sends entry email notifications.
291
+ *
292
+ * @since 1.0.0
293
+ *
294
+ * @param array $fields
295
+ * @param array $entry
296
+ * @param array $form_data
297
+ * @param array $entry_id
298
+ * @param string $context
299
+ */
300
+ public function entry_email( $fields, $entry, $form_data, $entry_id, $context = '' ) {
301
+
302
+ // Provide the opportunity to override via a filter
303
+ if ( ! apply_filters( 'everest_forms_entry_email', true, $fields, $entry, $form_data ) ) {
304
+ return;
305
+ }
306
+
307
+ $fields = apply_filters( 'everest_forms_entry_email_data', $fields, $entry, $form_data );
308
+
309
+ $email_notifications = isset( $form_data['settings']['email'] ) ? $form_data['settings']['email'] : array();
310
+
311
+ // $this->send_entry_email( $entry, $form_data );
312
+
313
+
314
+ if ( empty( $email_notifications['evf_to_email'] ) ) {
315
+ return;
316
+ }
317
+
318
+ $form_fields = isset( $form_data['form_fields'] ) ? $form_data['form_fields'] : array();
319
+
320
+ $data_html = '';
321
+
322
+ foreach ( $form_fields as $field_key => $field ) {
323
+
324
+ $field_type = isset( $field['type'] ) ? $field['type'] : '';
325
+
326
+ $label = isset( $field['label'] ) ? $field['label'] : '';
327
+
328
+ $field_value = isset( $entry['form_fields'][ $field_key ] ) ? $entry['form_fields'][ $field_key ] : '';
329
+
330
+ if( $field_type == 'email' ){
331
+ $user_email = $field_value;
332
+ }
333
+ if ( ! empty( $field_type ) ) {
334
+
335
+ $process_field_email = apply_filters( 'everest_forms_entry_email_' . $field_type, true );
336
+
337
+ if ( $process_field_email ) {
338
+
339
+ if ( is_array( $field_value ) ) {
340
+ $field_value = implode( ',', $field_value );
341
+ }
342
+ $data_html .= $label . ' : ' . $field_value . PHP_EOL;
343
+ }
344
+ }
345
+ }
346
+
347
+ $email = array();
348
+
349
+ $email['evf_email_subject'] = ! empty( $email_notifications['evf_email_subject'] ) ? $email_notifications['evf_email_subject'] : sprintf( _x( 'New %s Entry', 'Form name', 'everest-forms' ), $form_data['settings']['form_title'] );
350
+ $email['evf_from_email'] = ! empty( $email_notifications['evf_from_email'] ) ? $email_notifications['evf_from_email'] : evf_sender_address();
351
+ $email['evf_from_name'] = ! empty( $email_notifications['evf_from_name'] ) ? $email_notifications['evf_from_name'] : evf_sender_name();
352
+ $email['evf_to_email'] = ! empty( $email_notifications['evf_to_email'] ) ? $email_notifications['evf_to_email'] : false;
353
+ $email['evf_email_header'] = ! empty( $email_notifications['evf_email_header'] ) ? $email_notifications['evf_email_header'] : '';
354
+
355
+ if ( ! empty( $email_notifications['evf_email_message'] ) ) {
356
+ if ( trim( '{all_fields}' ) == $email_notifications['evf_email_message'] ){
357
+ $email['evf_email_message'] = $data_html;
358
+ }
359
+ else {
360
+ $email['evf_email_message'] = $email_notifications['evf_from_email'];
361
+ }
362
+ }
363
+
364
+ // Create new email.
365
+ $emails = new EVF_Emails;
366
+ $emails->__set( 'form_data', $form_data );
367
+ $emails->__set( 'fields', $fields );
368
+ $emails->__set( 'entry_id', $this->entry_id );
369
+ $emails->__set( 'from_name', $email['evf_from_name'] );
370
+ $emails->__set( 'from_address', $email['evf_from_email'] );
371
+ $emails->__set( 'headers', $email['evf_email_header'] );
372
+ $emails->__set( 'reply_to', isset( $user_email ) ? $user_email : $email['evf_from_email'] );
373
+
374
+ // Go.
375
+ $status = $emails->send( trim( $email['evf_to_email'] ), $email['evf_email_subject'], $email['evf_email_message'] );
376
+
377
+ $_POST['evf_success'] = isset( $status ) ? true : false;
378
+
379
+ return $status;
380
+
381
+ }
382
+
383
+ /**
384
+ * @param $entry
385
+ * @param $form_data
386
+ *
387
+ * @return bool
388
+ */
389
+ // public function send_entry_email( $entry, $form_data ) {
390
+
391
+ // $send_entry_email = apply_filters( 'everest_forms_entry_data_email', true );
392
+
393
+ // if ( ! $send_entry_email ) {
394
+
395
+ // return false;
396
+ // }
397
+
398
+ // $form_fields = isset( $form_data['form_fields'] ) ? $form_data['form_fields'] : array();
399
+
400
+ // $data_html = '';
401
+
402
+ // foreach ( $form_fields as $field_key => $field ) {
403
+
404
+ // $field_type = isset( $field['type'] ) ? $field['type'] : '';
405
+
406
+ // $label = isset( $field['label'] ) ? $field['label'] : '';
407
+
408
+ // $field_value = isset( $entry['form_fields'][ $field_key ] ) ? $entry['form_fields'][ $field_key ] : '';
409
+
410
+ // if ( ! empty( $field_type ) ) {
411
+
412
+ // $process_field_email = apply_filters( 'everest_forms_entry_email_' . $field_type, true );
413
+
414
+ // if ( $process_field_email ) {
415
+
416
+ // if ( is_array( $field_value ) ) {
417
+ // $field_value = implode( ',', $field_value );
418
+ // }
419
+ // $data_html .= $label . ' : ' . $field_value . PHP_EOL;
420
+
421
+ // }
422
+ // }
423
+ // }
424
+
425
+ // $admin_email = get_option( 'admin_email' );
426
+
427
+ // $emails = new EVF_Emails;
428
+
429
+ // $status = $emails->send( $admin_email, __( 'New entry recieved', 'everest-forms' ), $data_html );
430
+
431
+
432
+ // $_POST['evf_success'] = isset( $status ) ? true : false;
433
+
434
+ // return $status;
435
+ // }
436
+
437
+ /**
438
+ * Saves entry to database.
439
+ *
440
+ * @since 1.0.0
441
+ *
442
+ * @param array $fields
443
+ * @param array $entry
444
+ * @param int $form_id
445
+ * @param array|string $form_data
446
+ *
447
+ * @return int
448
+ */
449
+ public function entry_save( $fields, $entry, $form_id, $form_data = '' ) {
450
+
451
+ do_action( 'everest_forms_process_entry_save', $fields, $entry, $form_id, $form_data );
452
+
453
+ return $this->entry_id;
454
+ }
455
+ }
includes/class-evf-forms-feature.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms features
4
+ *
5
+ * @author WPEverest
6
+ * @category Classes
7
+ * @package EverestForms
8
+ * @since 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit; // Exit if accessed directly.
13
+ }
14
+
15
+ /**
16
+ * Main EverestForms Class.
17
+ *
18
+ * @class EverestForms
19
+ * @version 1.0.0
20
+ */
21
+ class EVF_Forms_Features {
22
+
23
+ /**
24
+ * Primary class constructor.
25
+ *
26
+ * @since 1.0.0
27
+ */
28
+ public function __construct() {
29
+
30
+ add_action( 'everest_forms_form_settings_notifications', array( $this, 'form_settings_notifications' ), 8, 1 );
31
+ //add_filter( 'everest_forms_builder_fields_buttons', array( $this, 'form_fields' ), 20 );
32
+ //add_filter( 'everest_forms_builder_preview', array( $this, 'everest_forms_builder_preview' ), 20, 1 );
33
+ //add_action( 'everest_forms_builder_panel_buttons', array( $this, 'form_panels' ), 20 );
34
+ }
35
+
36
+
37
+
38
+ /**
39
+ * Form notification settings, supports multiple notifications.
40
+ *
41
+ * @since 1.0.0
42
+ *
43
+ * @param object $settings
44
+ */
45
+ public function form_settings_notifications( $settings ) {
46
+
47
+
48
+ // Fetch next ID and handle backwards compatibility
49
+ if ( empty( $settings->form_data['settings']['notifications'] ) ) {
50
+ $settings->form_data['settings']['notifications'][1]['email'] = ! empty( $settings->form_data['settings']['notification_email'] ) ? $settings->form_data['settings']['notification_email'] : '{
51
+ admin_email}';
52
+ $settings->form_data['settings']['notifications'][1]['subject'] = ! empty( $settings->form_data['settings']['notification_subject'] ) ? $settings->form_data['settings']['notification_subject'] : sprintf( __( 'New %s Entry', 'everest-forms' ), $settings->form->post_title );
53
+ $settings->form_data['settings']['notifications'][1]['sender_name'] = ! empty( $settings->form_data['settings']['notification_fromname'] ) ? $settings->form_data['settings']['notification_fromname'] : get_bloginfo( 'name' );
54
+ $settings->form_data['settings']['notifications'][1]['sender_address'] = ! empty( $settings->form_data['settings']['notification_fromaddress'] ) ? $settings->form_data['settings']['notification_fromaddress'] : '{
55
+ admin_email}';
56
+ $settings->form_data['settings']['notifications'][1]['replyto'] = ! empty( $settings->form_data['settings']['notification_replyto'] ) ? $settings->form_data['settings']['notification_replyto'] : '';
57
+ }
58
+ $id = 1;
59
+
60
+ echo ' < div class="everest-forms-panel-content-section-title" > ';
61
+ _e( 'Notifications', 'everest-forms' );
62
+ echo ' </div > ';
63
+
64
+ everest_forms_panel_field(
65
+ 'select',
66
+ 'settings',
67
+ 'notification_enable',
68
+ $settings->form_data,
69
+ __( 'Notifications', 'everest-forms' ),
70
+ array(
71
+ 'default' => '1',
72
+ 'options' => array(
73
+ '1' => __( 'On', 'everest-forms' ),
74
+ '0' => __( 'Off', 'everest-forms' ),
75
+ ),
76
+ )
77
+ );
78
+
79
+ echo ' < div class="everest-forms-notification" > ';
80
+
81
+ echo '<div class="everest-forms-notification-header" > ';
82
+ echo '<span > ' . __( 'Default Notification', 'everest-forms' ) . ' </span > ';
83
+ echo '</div > ';
84
+
85
+
86
+ everest_forms_panel_field(
87
+ 'text',
88
+ 'notifications',
89
+ 'subject',
90
+ $settings->form_data,
91
+ __( 'Email Subject', 'everest-forms' ),
92
+ array(
93
+ 'default' => sprintf( _x( 'New Entry: %s', 'Form name', 'everest-forms' ), $settings->form->post_title ),
94
+ 'smarttags' => array(
95
+ 'type' => 'all',
96
+ ),
97
+ 'parent' => 'settings',
98
+ 'subsection' => $id,
99
+ )
100
+ );
101
+ echo ' </div > ';
102
+ }
103
+
104
+
105
+ /**
106
+ * Display/register additional fields available in the Pro version.
107
+ *
108
+ * @since 1.0.0
109
+ *
110
+ * @param array $fields
111
+ *
112
+ * @return array
113
+ */
114
+ public function form_fields( $fields ) {
115
+ $fields['advance']['fields'][] = array(
116
+ 'icon' => 'dashicons dashicons-admin-links',
117
+ 'name' => 'Website / URL',
118
+ 'type' => 'url',
119
+ 'order' => '1',
120
+ 'class' => 'upgrade - modal',
121
+ );
122
+
123
+ return $fields;
124
+ }
125
+
126
+ /**
127
+ * Display/register additional panels available in the Pro version.
128
+ *
129
+ * @since 1.0.0
130
+ */
131
+ public function form_panels() {
132
+ ?>
133
+ <button class="everest-forms-panel-tet-button upgrade-modal" data-panel="payments">
134
+ <i class="fa fa-usd"></i><span><?php _e( 'Payments', 'everest-forms' ); ?></span>
135
+ </button>
136
+ <?php
137
+ }
138
+ }
139
+
140
+ new EVF_Forms_Features;
includes/class-evf-frontend-scripts.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle frontend scripts
4
+ *
5
+ * @class EVF_Frontend_Scripts
6
+ * @version 1.0.0
7
+ * @package EverestForms/Classes/
8
+ * @category Class
9
+ * @author WPEverest
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * EVF_Frontend_Scripts Class.
18
+ */
19
+ class EVF_Frontend_Scripts {
20
+
21
+ /**
22
+ * Contains an array of script handles registered by EVF.
23
+ * @var array
24
+ */
25
+ private static $scripts = array();
26
+
27
+ /**
28
+ * Contains an array of script handles registered by EVF.
29
+ * @var array
30
+ */
31
+ private static $styles = array();
32
+
33
+ /**
34
+ * Contains an array of script handles localized by EVF.
35
+ * @var array
36
+ */
37
+ private static $wp_localize_scripts = array();
38
+
39
+ /**
40
+ * Hook in methods.
41
+ */
42
+ public static function init() {
43
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
44
+ add_action( 'wp_print_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
45
+ add_action( 'wp_print_footer_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
46
+ }
47
+
48
+ /**
49
+ * Get styles for the frontend.
50
+ *
51
+ * @return array
52
+ */
53
+ public static function get_styles() {
54
+ return apply_filters( 'everest_forms_enqueue_styles', array(
55
+ 'everest-forms-general' => array(
56
+ 'src' => self::get_asset_url( 'assets/css/everest-forms.css' ),
57
+ 'deps' => '',
58
+ 'version' => EVF_VERSION,
59
+ 'media' => 'all',
60
+ 'has_rtl' => true,
61
+ ),
62
+ ) );
63
+ }
64
+
65
+ /**
66
+ * Return asset URL.
67
+ *
68
+ * @param string $path
69
+ *
70
+ * @return string
71
+ */
72
+ private static function get_asset_url( $path ) {
73
+ return apply_filters( 'everest_forms_get_asset_url', plugins_url( $path, EVF_PLUGIN_FILE ), $path );
74
+ }
75
+
76
+ /**
77
+ * Register a script for use.
78
+ *
79
+ * @uses wp_register_script()
80
+ * @access private
81
+ *
82
+ * @param string $handle
83
+ * @param string $path
84
+ * @param string[] $deps
85
+ * @param string $version
86
+ * @param boolean $in_footer
87
+ */
88
+ private static function register_script( $handle, $path, $deps = array( 'jquery' ), $version = EVF_VERSION, $in_footer = true ) {
89
+ self::$scripts[] = $handle;
90
+ wp_register_script( $handle, $path, $deps, $version, $in_footer );
91
+ }
92
+
93
+ /**
94
+ * Register and enqueue a script for use.
95
+ *
96
+ * @uses wp_enqueue_script()
97
+ * @access private
98
+ *
99
+ * @param string $handle
100
+ * @param string $path
101
+ * @param string[] $deps
102
+ * @param string $version
103
+ * @param boolean $in_footer
104
+ */
105
+ private static function enqueue_script( $handle, $path = '', $deps = array( 'jquery' ), $version = EVF_VERSION, $in_footer = true ) {
106
+ if ( ! in_array( $handle, self::$scripts ) && $path ) {
107
+ self::register_script( $handle, $path, $deps, $version, $in_footer );
108
+ }
109
+ wp_enqueue_script( $handle );
110
+ }
111
+
112
+ /**
113
+ * Register a style for use.
114
+ *
115
+ * @uses wp_register_style()
116
+ * @access private
117
+ *
118
+ * @param string $handle
119
+ * @param string $path
120
+ * @param string[] $deps
121
+ * @param string $version
122
+ * @param string $media
123
+ * @param boolean $has_rtl
124
+ */
125
+ private static function register_style( $handle, $path, $deps = array(), $version = EVF_VERSION, $media = 'all', $has_rtl = false ) {
126
+ self::$styles[] = $handle;
127
+ wp_register_style( $handle, $path, $deps, $version, $media );
128
+
129
+ if ( $has_rtl ) {
130
+ wp_style_add_data( $handle, 'rtl', 'replace' );
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Register and enqueue a styles for use.
136
+ *
137
+ * @uses wp_enqueue_style()
138
+ * @access private
139
+ *
140
+ * @param string $handle
141
+ * @param string $path
142
+ * @param string[] $deps
143
+ * @param string $version
144
+ * @param string $media
145
+ * @param boolean $has_rtl
146
+ */
147
+ private static function enqueue_style( $handle, $path = '', $deps = array(), $version = EVF_VERSION, $media = 'all', $has_rtl = false ) {
148
+ if ( ! in_array( $handle, self::$styles ) && $path ) {
149
+ self::register_style( $handle, $path, $deps, $version, $media, $has_rtl );
150
+ }
151
+ wp_enqueue_style( $handle );
152
+ }
153
+
154
+ /**
155
+ * Register all EVF scripts.
156
+ */
157
+ private static function register_scripts() {
158
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
159
+ $register_scripts = array(
160
+ 'everest-forms' => array(
161
+ 'src' => self::get_asset_url( 'assets/js/frontend/everest-forms' . $suffix . '.js' ),
162
+ 'deps' => array( 'jquery', 'jquery-ui-datepicker' ),
163
+ 'version' => EVF_VERSION,
164
+ ),
165
+ 'evf-google-recaptcha' => array(
166
+ 'src' => 'https://www.google.com/recaptcha/api.js?onload=onloadEVFCallback&render=explicit',
167
+ 'deps' => array(),
168
+ 'version' => EVF_VERSION,
169
+ ),
170
+ );
171
+ foreach ( $register_scripts as $name => $props ) {
172
+ self::register_script( $name, $props['src'], $props['deps'], $props['version'] );
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Register all EVF sty;es.
178
+ */
179
+ private static function register_styles() {
180
+ $register_styles = array(
181
+ 'select2' => array(
182
+ 'src' => self::get_asset_url( 'assets/css/select2.css' ),
183
+ 'deps' => array(),
184
+ 'version' => EVF_VERSION,
185
+ 'has_rtl' => false,
186
+ ),
187
+ 'evf-jquery-ui-datepicker' => array(
188
+ 'src' => self::get_asset_url( 'assets/css/jquery-ui-datepicker/jquery-ui-datepicker.css' ),
189
+ 'deps' => array(),
190
+ 'version' => EVF_VERSION,
191
+ 'has_rtl' => true,
192
+ ),
193
+ );
194
+ foreach ( $register_styles as $name => $props ) {
195
+ self::register_style( $name, $props['src'], $props['deps'], $props['version'], 'all', $props['has_rtl'] );
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Register/queue frontend scripts.
201
+ */
202
+ public static function load_scripts() {
203
+ global $post;
204
+
205
+ if ( ! did_action( 'before_everest_forms_init' ) ) {
206
+ return;
207
+ }
208
+
209
+ self::register_scripts();
210
+ self::register_styles();
211
+
212
+ // Global frontend scripts.
213
+ self::enqueue_script( 'everest-forms' );
214
+ self::enqueue_style( 'evf-jquery-ui-datepicker' );
215
+
216
+ // Load dashicons styles.
217
+ wp_enqueue_style( 'dashicons' );
218
+
219
+ // CSS Styles.
220
+ if ( $enqueue_styles = self::get_styles() ) {
221
+ foreach ( $enqueue_styles as $handle => $args ) {
222
+ if ( ! isset( $args['has_rtl'] ) ) {
223
+ $args['has_rtl'] = false;
224
+ }
225
+
226
+ self::enqueue_style( $handle, $args['src'], $args['deps'], $args['version'], $args['media'], $args['has_rtl'] );
227
+ }
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Localize a EVF script once.
233
+ * @access private
234
+ *
235
+ * @param string $handle
236
+ */
237
+ private static function localize_script( $handle ) {
238
+ if ( ! in_array( $handle, self::$wp_localize_scripts ) && wp_script_is( $handle ) && ( $data = self::get_script_data( $handle ) ) ) {
239
+ $name = str_replace( '-', '_', $handle ) . '_params';
240
+ self::$wp_localize_scripts[] = $handle;
241
+ wp_localize_script( $handle, $name, apply_filters( $name, $data ) );
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Return data for script handles.
247
+ * @access private
248
+ *
249
+ * @param string $handle
250
+ *
251
+ * @return array|bool
252
+ */
253
+ private static function get_script_data( $handle ) {
254
+ global $wp;
255
+
256
+ switch ( $handle ) {
257
+ case 'everest-forms' :
258
+ return array(
259
+ 'ajax_url' => EVF()->ajax_url(),
260
+ 'everest_forms_data_save' => wp_create_nonce( 'everest_forms_data_save_nonce' ),
261
+ );
262
+ break;
263
+ }
264
+
265
+ return false;
266
+ }
267
+
268
+ /**
269
+ * Localize scripts only when enqueued.
270
+ */
271
+ public static function localize_printed_scripts() {
272
+ foreach ( self::$scripts as $handle ) {
273
+ self::localize_script( $handle );
274
+ }
275
+ }
276
+ }
277
+
278
+ EVF_Frontend_Scripts::init();
includes/class-evf-install.php ADDED
@@ -0,0 +1,703 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Installation related functions and actions.
4
+ *
5
+ * @package EverestForms\Classes
6
+ * @version 1.0.0
7
+ */
8
+
9
+ defined( 'ABSPATH' ) || exit;
10
+
11
+ /**
12
+ * EVF_Install Class.
13
+ */
14
+ class EVF_Install {
15
+
16
+ /**
17
+ * DB updates and callbacks that need to be run per version.
18
+ *
19
+ * @var array
20
+ */
21
+ private static $db_updates = array(
22
+ '1.0.0' => array(
23
+ 'evf_update_100_db_version',
24
+ ),
25
+ );
26
+
27
+ /**
28
+ * Background update class.
29
+ *
30
+ * @var object
31
+ */
32
+ private static $background_updater;
33
+
34
+ /**
35
+ * Hook in tabs.
36
+ */
37
+ public static function init() {
38
+ add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
39
+ add_action( 'init', array( __CLASS__, 'init_background_updater' ), 5 );
40
+ add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
41
+ add_filter( 'plugin_action_links_' . EVF_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
42
+ add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
43
+ add_filter( 'wpmu_drop_tables', array( __CLASS__, 'wpmu_drop_tables' ) );
44
+ add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) );
45
+ add_action( 'everest_forms_plugin_background_installer', array( __CLASS__, 'background_installer' ), 10, 2 );
46
+ add_action( 'everest_forms_theme_background_installer', array( __CLASS__, 'background_installer' ), 10, 2 );
47
+ }
48
+
49
+ /**
50
+ * Init background updates
51
+ */
52
+ public static function init_background_updater() {
53
+ include_once( dirname( __FILE__ ) . '/class-evf-background-updater.php' );
54
+ self::$background_updater = new EVF_Background_Updater();
55
+ }
56
+
57
+ /**
58
+ * Check EverestForms version and run the updater is required.
59
+ *
60
+ * This check is done on all requests and runs if the versions do not match.
61
+ */
62
+ public static function check_version() {
63
+ if ( ! defined( 'IFRAME_REQUEST' ) && get_option( 'everest_forms_version' ) !== EVF()->version ) {
64
+ self::install();
65
+ do_action( 'everest_forms_updated' );
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Install actions when a update button is clicked within the admin area.
71
+ *
72
+ * This function is hooked into admin_init to affect admin only.
73
+ */
74
+ public static function install_actions() {
75
+ if ( ! empty( $_GET['do_update_everest_forms'] ) ) {
76
+ self::update();
77
+ EVF_Admin_Notices::add_notice( 'update' );
78
+ }
79
+ if ( ! empty( $_GET['force_update_everest_forms'] ) ) {
80
+ do_action( 'wp_' . get_current_blog_id() . '_evf_updater_cron' );
81
+ wp_safe_redirect( admin_url( 'admin.php?page=evf-settings' ) );
82
+ exit;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Install EVF.
88
+ */
89
+ public static function install() {
90
+ if ( ! is_blog_installed() ) {
91
+ return;
92
+ }
93
+
94
+ // Check if we are not already running this routine.
95
+ if ( 'yes' === get_transient( 'evf_installing' ) ) {
96
+ return;
97
+ }
98
+
99
+ // If we made it till here nothing is running yet, lets set the transient now.
100
+ set_transient( 'evf_installing', 'yes', MINUTE_IN_SECONDS * 10 );
101
+ evf_maybe_define_constant( 'EVF_INSTALLING', true );
102
+
103
+ self::remove_admin_notices();
104
+ self::create_options();
105
+ self::create_tables();
106
+ self::create_roles();
107
+ self::setup_environment();
108
+ self::create_cron_jobs();
109
+ self::create_forms();
110
+ self::maybe_enable_setup_wizard();
111
+ self::update_evf_version();
112
+ self::maybe_update_db_version();
113
+
114
+ delete_transient( 'evf_installing' );
115
+
116
+ do_action( 'everest_forms_flush_rewrite_rules' );
117
+ do_action( 'everest_forms_installed' );
118
+ }
119
+
120
+ /**
121
+ * Reset any notices added to admin.
122
+ */
123
+ private static function remove_admin_notices() {
124
+ include_once( dirname( __FILE__ ) . '/admin/class-evf-admin-notices.php' );
125
+ EVF_Admin_Notices::remove_all_notices();
126
+ }
127
+
128
+ /**
129
+ * Setup EVF environment - post types, taxonomies, endpoints.
130
+ */
131
+ private static function setup_environment() {
132
+ EVF_Post_Types::register_post_types();
133
+ }
134
+
135
+ /**
136
+ * Is this a brand new EVF install?
137
+ *
138
+ * @return boolean
139
+ */
140
+ private static function is_new_install() {
141
+ return is_null( get_option( 'everest_forms_version', null ) ) && is_null( get_option( 'everest_forms_db_version', null ) );
142
+ }
143
+
144
+ /**
145
+ * Is a DB update needed?
146
+ *
147
+ * @return boolean
148
+ */
149
+ private static function needs_db_update() {
150
+ $current_db_version = get_option( 'everest_forms_db_version', null );
151
+ $updates = self::get_db_update_callbacks();
152
+
153
+ return ! is_null( $current_db_version ) && version_compare( $current_db_version, max( array_keys( $updates ) ), '<' );
154
+ }
155
+
156
+ /**
157
+ * See if we need the wizard or not.
158
+ */
159
+ private static function maybe_enable_setup_wizard() {
160
+ if ( apply_filters( 'everest_forms_enable_setup_wizard', self::is_new_install() ) ) {
161
+ set_transient( '_evf_activation_redirect', 1, 30 );
162
+ }
163
+ }
164
+
165
+ /**
166
+ * See if we need to show or run database updates during install.
167
+ */
168
+ private static function maybe_update_db_version() {
169
+ if ( self::needs_db_update() ) {
170
+ if ( apply_filters( 'everest_forms_enable_auto_update_db', false ) ) {
171
+ self::init_background_updater();
172
+ self::update();
173
+ } else {
174
+ EVF_Admin_Notices::add_notice( 'update' );
175
+ }
176
+ } else {
177
+ self::update_db_version();
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Update EVF version to current.
183
+ */
184
+ private static function update_evf_version() {
185
+ delete_option( 'everest_forms_version' );
186
+ add_option( 'everest_forms_version', EVF()->version );
187
+ }
188
+
189
+ /**
190
+ * Get list of DB update callbacks.
191
+ *
192
+ * @return array
193
+ */
194
+ public static function get_db_update_callbacks() {
195
+ return self::$db_updates;
196
+ }
197
+
198
+ /**
199
+ * Push all needed DB updates to the queue for processing.
200
+ */
201
+ private static function update() {
202
+ $current_db_version = get_option( 'everest_forms_db_version' );
203
+ $logger = evf_get_logger();
204
+ $update_queued = false;
205
+
206
+ foreach ( self::get_db_update_callbacks() as $version => $update_callbacks ) {
207
+ if ( version_compare( $current_db_version, $version, '<' ) ) {
208
+ foreach ( $update_callbacks as $update_callback ) {
209
+ $logger->info(
210
+ sprintf( 'Queuing %s - %s', $version, $update_callback ),
211
+ array( 'source' => 'evf_db_updates' )
212
+ );
213
+ self::$background_updater->push_to_queue( $update_callback );
214
+ $update_queued = true;
215
+ }
216
+ }
217
+ }
218
+
219
+ if ( $update_queued ) {
220
+ self::$background_updater->save()->dispatch();
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Update DB version to current.
226
+ *
227
+ * @param string|null $version New EverestForms DB version or null.
228
+ */
229
+ public static function update_db_version( $version = null ) {
230
+ delete_option( 'everest_forms_db_version' );
231
+ add_option( 'everest_forms_db_version', is_null( $version ) ? EVF()->version : $version );
232
+ }
233
+
234
+ /**
235
+ * Add more cron schedules.
236
+ *
237
+ * @param array $schedules List of WP scheduled cron jobs.
238
+ * @return array
239
+ */
240
+ public static function cron_schedules( $schedules ) {
241
+ $schedules['monthly'] = array(
242
+ 'interval' => 2635200,
243
+ 'display' => __( 'Monthly', 'everest-forms' ),
244
+ );
245
+
246
+ return $schedules;
247
+ }
248
+
249
+ /**
250
+ * Create cron jobs (clear them first).
251
+ */
252
+ private static function create_cron_jobs() {
253
+ wp_clear_scheduled_hook( 'everest_forms_cleanup_sessions' );
254
+ wp_schedule_event( time(), 'twicedaily', 'everest_forms_cleanup_sessions' );
255
+ }
256
+
257
+ /**
258
+ * Default options.
259
+ *
260
+ * Sets up the default options used on the settings page.
261
+ */
262
+ private static function create_options() {
263
+ // Include settings so that we can run through defaults.l
264
+ include_once( dirname( __FILE__ ) . '/admin/class-evf-admin-settings.php' );
265
+
266
+ $settings = EVF_Admin_Settings::get_settings_pages();
267
+
268
+ foreach ( $settings as $section ) {
269
+ if ( ! method_exists( $section, 'get_settings' ) ) {
270
+ continue;
271
+ }
272
+ $subsections = array_unique( array_merge( array( '' ), array_keys( $section->get_sections() ) ) );
273
+
274
+ foreach ( $subsections as $subsection ) {
275
+ foreach ( $section->get_settings( $subsection ) as $value ) {
276
+ if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
277
+ $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
278
+ add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }
284
+
285
+ /**
286
+ * Set up the database tables which the plugin needs to function.
287
+ */
288
+ private static function create_tables() {
289
+ global $wpdb;
290
+
291
+ $wpdb->hide_errors();
292
+
293
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
294
+
295
+ dbDelta( self::get_schema() );
296
+ }
297
+
298
+ /**
299
+ * Get Table schema.
300
+ *
301
+ * https://github.com/everest-forms/everest-forms/wiki/Database-Description/
302
+ *
303
+ * A note on indexes; Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
304
+ * As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
305
+ * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
306
+ *
307
+ * Changing indexes may cause duplicate index notices in logs due to https://core.trac.wordpress.org/ticket/34870 but dropping
308
+ * indexes first causes too much load on some servers/larger DB.
309
+ *
310
+ * @return string
311
+ */
312
+ private static function get_schema() {
313
+ global $wpdb;
314
+
315
+ $collate = '';
316
+
317
+ if ( $wpdb->has_cap( 'collation' ) ) {
318
+ $collate = $wpdb->get_charset_collate();
319
+ }
320
+
321
+ $tables = "
322
+ CREATE TABLE {$wpdb->prefix}evf_sessions (
323
+ session_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
324
+ session_key char(32) NOT NULL,
325
+ session_value longtext NOT NULL,
326
+ session_expiry BIGINT UNSIGNED NOT NULL,
327
+ PRIMARY KEY (session_key),
328
+ UNIQUE KEY session_id (session_id)
329
+ ) $collate;
330
+ ";
331
+
332
+ return $tables;
333
+ }
334
+
335
+ /**
336
+ * Create roles and capabilities.
337
+ */
338
+ public static function create_roles() {
339
+ global $wp_roles;
340
+
341
+ if ( ! class_exists( 'WP_Roles' ) ) {
342
+ return;
343
+ }
344
+
345
+ if ( ! isset( $wp_roles ) ) {
346
+ $wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
347
+ }
348
+
349
+ $capabilities = self::get_core_capabilities();
350
+
351
+ foreach ( $capabilities as $cap_group ) {
352
+ foreach ( $cap_group as $cap ) {
353
+ $wp_roles->add_cap( 'administrator', $cap );
354
+ }
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Get capabilities for EverestForms - these are assigned to admin during installation or reset.
360
+ *
361
+ * @return array
362
+ */
363
+ private static function get_core_capabilities() {
364
+ $capabilities = array();
365
+
366
+ $capabilities['core'] = array(
367
+ 'manage_everest_forms'
368
+ );
369
+
370
+ $capability_types = array( 'everest_form' );
371
+
372
+ foreach ( $capability_types as $capability_type ) {
373
+
374
+ $capabilities[ $capability_type ] = array(
375
+ // Post type
376
+ "edit_{$capability_type}",
377
+ "duplicate_{$capability_type}",
378
+ "read_{$capability_type}",
379
+ "delete_{$capability_type}",
380
+ "edit_{$capability_type}s",
381
+ "edit_others_{$capability_type}s",
382
+ "publish_{$capability_type}s",
383
+ "read_private_{$capability_type}s",
384
+ "delete_{$capability_type}s",
385
+ "delete_private_{$capability_type}s",
386
+ "delete_published_{$capability_type}s",
387
+ "delete_others_{$capability_type}s",
388
+ "edit_private_{$capability_type}s",
389
+ "edit_published_{$capability_type}s",
390
+
391
+ // Terms
392
+ "manage_{$capability_type}_terms",
393
+ "edit_{$capability_type}_terms",
394
+ "delete_{$capability_type}_terms",
395
+ "assign_{$capability_type}_terms",
396
+ );
397
+ }
398
+
399
+ return $capabilities;
400
+ }
401
+
402
+ /**
403
+ * Remove EverestForms roles.
404
+ */
405
+ public static function remove_roles() {
406
+ global $wp_roles;
407
+
408
+ if ( ! class_exists( 'WP_Roles' ) ) {
409
+ return;
410
+ }
411
+
412
+ if ( ! isset( $wp_roles ) ) {
413
+ $wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
414
+ }
415
+
416
+ $capabilities = self::get_core_capabilities();
417
+
418
+ foreach ( $capabilities as $cap_group ) {
419
+ foreach ( $cap_group as $cap ) {
420
+ $wp_roles->remove_cap( 'administrator', $cap );
421
+ }
422
+ }
423
+ }
424
+
425
+ /**
426
+ * Create default contact form.
427
+ */
428
+ public static function create_forms() {
429
+ include_once dirname( __FILE__ ) . '/class-evf-form-handler.php';
430
+
431
+ $has_posts = get_posts( 'post_type=everest_form' );
432
+
433
+ if ( 0 === count( $has_posts ) ) {
434
+ $default_form_id = EVF_Form_Handler::create( __( 'Contact Form', 'everest-forms' ), 'contact' );
435
+ update_option( 'evf_default_form_page_id', $default_form_id );
436
+ }
437
+ }
438
+
439
+ /**
440
+ * Display action links in the Plugins list table.
441
+ *
442
+ * @param array $actions Plugin Action links.
443
+ * @return array
444
+ */
445
+ public static function plugin_action_links( $actions ) {
446
+ $new_actions = array(
447
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=evf-settings' ) . '" aria-label="' . esc_attr__( 'View Everest Forms Settings', 'everest-forms' ) . '">' . esc_html__( 'Settings', 'everest-forms' ) . '</a>',
448
+ );
449
+
450
+ return array_merge( $new_actions, $actions );
451
+ }
452
+
453
+ /**
454
+ * Display row meta in the Plugins list table.
455
+ *
456
+ * @param array $plugin_meta Plugin Row Meta.
457
+ * @param string $plugin_file Plugin Row Meta.
458
+ * @return array
459
+ */
460
+ public static function plugin_row_meta( $plugin_meta, $plugin_file ) {
461
+ if ( EVF_PLUGIN_BASENAME == $plugin_file ) {
462
+ $new_plugin_meta = array(
463
+ 'docs' => '<a href="' . esc_url( apply_filters( 'everest_forms_docs_url', 'https://docs.wpeverest.com/documentation/plugins/everest-forms/' ) ) . '" aria-label="' . esc_attr__( 'View Everest Forms documentation', 'everest-forms' ) . '">' . esc_html__( 'Docs', 'everest-forms' ) . '</a>',
464
+ 'support' => '<a href="' . esc_url( apply_filters( 'everest_forms_support_url', 'https://wpeverest.com/support-forum/' ) ) . '" aria-label="' . esc_attr__( 'Visit premium customer support', 'everest-forms' ) . '">' . esc_html__( 'Premium support', 'everest-forms' ) . '</a>',
465
+ );
466
+
467
+ return array_merge( $plugin_meta, $new_plugin_meta );
468
+ }
469
+
470
+ return (array) $plugin_meta;
471
+ }
472
+
473
+ /**
474
+ * Uninstall tables when MU blog is deleted.
475
+ *
476
+ * @param array $tables List of tables that will be deleted by WP.
477
+ * @return string[]
478
+ */
479
+ public static function wpmu_drop_tables( $tables ) {
480
+ global $wpdb;
481
+
482
+ $tables[] = $wpdb->prefix . 'evf_sessions';
483
+
484
+ return $tables;
485
+ }
486
+
487
+ /**
488
+ * Get slug from path
489
+ *
490
+ * @param string $key Plugin relative path. Example: woocommerce/woocommerce.php.
491
+ * @return string
492
+ */
493
+ private static function format_plugin_slug( $key ) {
494
+ $slug = explode( '/', $key );
495
+ $slug = explode( '.', end( $slug ) );
496
+ return $slug[0];
497
+ }
498
+
499
+ /**
500
+ * Install a plugin from .org in the background via a cron job (used by
501
+ * installer - opt in).
502
+ *
503
+ * @param string $plugin_to_install_id Plugin ID.
504
+ * @param array $plugin_to_install Plugin information.
505
+ * @throws Exception If unable to proceed with plugin installation.
506
+ */
507
+ public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
508
+ // Explicitly clear the event.
509
+ wp_clear_scheduled_hook( 'everest_forms_plugin_background_installer', func_get_args() );
510
+
511
+ if ( ! empty( $plugin_to_install['repo-slug'] ) ) {
512
+ require_once ABSPATH . 'wp-admin/includes/file.php';
513
+ require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
514
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
515
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
516
+
517
+ WP_Filesystem();
518
+
519
+ $skin = new Automatic_Upgrader_Skin();
520
+ $upgrader = new WP_Upgrader( $skin );
521
+ $installed_plugins = array_map( array( __CLASS__, 'format_plugin_slug' ), array_keys( get_plugins() ) );
522
+ $plugin_slug = $plugin_to_install['repo-slug'];
523
+ $plugin = $plugin_slug . '/' . $plugin_slug . '.php';
524
+ $installed = false;
525
+ $activate = false;
526
+
527
+ // See if the plugin is installed already.
528
+ if ( in_array( $plugin_to_install['repo-slug'], $installed_plugins ) ) {
529
+ $installed = true;
530
+ $activate = ! is_plugin_active( $plugin );
531
+ }
532
+
533
+ // Install this thing!
534
+ if ( ! $installed ) {
535
+ // Suppress feedback.
536
+ ob_start();
537
+
538
+ try {
539
+ $plugin_information = plugins_api(
540
+ 'plugin_information',
541
+ array(
542
+ 'slug' => $plugin_to_install['repo-slug'],
543
+ 'fields' => array(
544
+ 'short_description' => false,
545
+ 'sections' => false,
546
+ 'requires' => false,
547
+ 'rating' => false,
548
+ 'ratings' => false,
549
+ 'downloaded' => false,
550
+ 'last_updated' => false,
551
+ 'added' => false,
552
+ 'tags' => false,
553
+ 'homepage' => false,
554
+ 'donate_link' => false,
555
+ 'author_profile' => false,
556
+ 'author' => false,
557
+ ),
558
+ )
559
+ );
560
+
561
+ if ( is_wp_error( $plugin_information ) ) {
562
+ throw new Exception( $plugin_information->get_error_message() );
563
+ }
564
+
565
+ $package = $plugin_information->download_link;
566
+ $download = $upgrader->download_package( $package );
567
+
568
+ if ( is_wp_error( $download ) ) {
569
+ throw new Exception( $download->get_error_message() );
570
+ }
571
+
572
+ $working_dir = $upgrader->unpack_package( $download, true );
573
+
574
+ if ( is_wp_error( $working_dir ) ) {
575
+ throw new Exception( $working_dir->get_error_message() );
576
+ }
577
+
578
+ $result = $upgrader->install_package(
579
+ array(
580
+ 'source' => $working_dir,
581
+ 'destination' => WP_PLUGIN_DIR,
582
+ 'clear_destination' => false,
583
+ 'abort_if_destination_exists' => false,
584
+ 'clear_working' => true,
585
+ 'hook_extra' => array(
586
+ 'type' => 'plugin',
587
+ 'action' => 'install',
588
+ ),
589
+ )
590
+ );
591
+
592
+ if ( is_wp_error( $result ) ) {
593
+ throw new Exception( $result->get_error_message() );
594
+ }
595
+
596
+ $activate = true;
597
+
598
+ } catch ( Exception $e ) {
599
+ EVF_Admin_Notices::add_custom_notice(
600
+ $plugin_to_install_id . '_install_error',
601
+ sprintf(
602
+ // translators: 1: plugin name, 2: error message, 3: URL to install plugin manually.
603
+ __( '%1$s could not be installed (%2$s). <a href="%3$s">Please install it manually by clicking here.</a>', 'everest-forms' ),
604
+ $plugin_to_install['name'],
605
+ $e->getMessage(),
606
+ esc_url( admin_url( 'index.php?wc-install-plugin-redirect=' . $plugin_to_install['repo-slug'] ) )
607
+ )
608
+ );
609
+ }
610
+
611
+ // Discard feedback.
612
+ ob_end_clean();
613
+ }
614
+
615
+ wp_clean_plugins_cache();
616
+
617
+ // Activate this thing.
618
+ if ( $activate ) {
619
+ try {
620
+ $result = activate_plugin( $plugin );
621
+
622
+ if ( is_wp_error( $result ) ) {
623
+ throw new Exception( $result->get_error_message() );
624
+ }
625
+ } catch ( Exception $e ) {
626
+ EVF_Admin_Notices::add_custom_notice(
627
+ $plugin_to_install_id . '_install_error',
628
+ sprintf(
629
+ // translators: 1: plugin name, 2: URL to WP plugin page.
630
+ __( '%1$s was installed but could not be activated. <a href="%2$s">Please activate it manually by clicking here.</a>', 'everest-forms' ),
631
+ $plugin_to_install['name'],
632
+ admin_url( 'plugins.php' )
633
+ )
634
+ );
635
+ }
636
+ }
637
+ }
638
+ }
639
+
640
+ /**
641
+ * Install a theme from .org in the background via a cron job (used by installer - opt in).
642
+ *
643
+ * @param string $theme_slug Theme slug.
644
+ * @throws Exception If unable to proceed with theme installation.
645
+ */
646
+ public static function theme_background_installer( $theme_slug ) {
647
+ // Explicitly clear the event.
648
+ wp_clear_scheduled_hook( 'everest_forms_theme_background_installer', func_get_args() );
649
+
650
+ if ( ! empty( $theme_slug ) ) {
651
+ // Suppress feedback.
652
+ ob_start();
653
+
654
+ try {
655
+ $theme = wp_get_theme( $theme_slug );
656
+
657
+ if ( ! $theme->exists() ) {
658
+ require_once ABSPATH . 'wp-admin/includes/file.php';
659
+ include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
660
+ include_once ABSPATH . 'wp-admin/includes/theme.php';
661
+
662
+ WP_Filesystem();
663
+
664
+ $skin = new Automatic_Upgrader_Skin();
665
+ $upgrader = new Theme_Upgrader( $skin );
666
+ $api = themes_api(
667
+ 'theme_information', array(
668
+ 'slug' => $theme_slug,
669
+ 'fields' => array( 'sections' => false ),
670
+ )
671
+ );
672
+ $result = $upgrader->install( $api->download_link );
673
+
674
+ if ( is_wp_error( $result ) ) {
675
+ throw new Exception( $result->get_error_message() );
676
+ } elseif ( is_wp_error( $skin->result ) ) {
677
+ throw new Exception( $skin->result->get_error_message() );
678
+ } elseif ( is_null( $result ) ) {
679
+ throw new Exception( 'Unable to connect to the filesystem. Please confirm your credentials.' );
680
+ }
681
+ }
682
+
683
+ switch_theme( $theme_slug );
684
+ } catch ( Exception $e ) {
685
+ EVF_Admin_Notices::add_custom_notice(
686
+ $theme_slug . '_install_error',
687
+ sprintf(
688
+ // translators: 1: theme slug, 2: error message, 3: URL to install theme manually.
689
+ __( '%1$s could not be installed (%2$s). <a href="%3$s">Please install it manually by clicking here.</a>', 'everest-forms' ),
690
+ $theme_slug,
691
+ $e->getMessage(),
692
+ esc_url( admin_url( 'update.php?action=install-theme&theme=' . $theme_slug . '&_wpnonce=' . wp_create_nonce( 'install-theme_' . $theme_slug ) ) )
693
+ )
694
+ );
695
+ }
696
+
697
+ // Discard feedback.
698
+ ob_end_clean();
699
+ }
700
+ }
701
+ }
702
+
703
+ EVF_Install::init();
includes/class-evf-log-levels.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly
5
+ }
6
+
7
+ /**
8
+ * Standard log levels
9
+ *
10
+ * @class EVF_Log_Levels
11
+ * @version 1.0.0
12
+ * @package EverestForms/Classes
13
+ * @category Class
14
+ * @author WPEverest
15
+ */
16
+ abstract class EVF_Log_Levels {
17
+
18
+ /**
19
+ * Log Levels
20
+ *
21
+ * Description of levels:
22
+ * 'emergency': System is unusable.
23
+ * 'alert': Action must be taken immediately.
24
+ * 'critical': Critical conditions.
25
+ * 'error': Error conditions.
26
+ * 'warning': Warning conditions.
27
+ * 'notice': Normal but significant condition.
28
+ * 'info': Informational messages.
29
+ * 'debug': Debug-level messages.
30
+ *
31
+ * @see @link {https://tools.ietf.org/html/rfc5424}
32
+ */
33
+ const EMERGENCY = 'emergency';
34
+ const ALERT = 'alert';
35
+ const CRITICAL = 'critical';
36
+ const ERROR = 'error';
37
+ const WARNING = 'warning';
38
+ const NOTICE = 'notice';
39
+ const INFO = 'info';
40
+ const DEBUG = 'debug';
41
+
42
+ /**
43
+ * Level strings mapped to integer severity.
44
+ *
45
+ * @var array
46
+ */
47
+ protected static $level_to_severity = array(
48
+ self::EMERGENCY => 800,
49
+ self::ALERT => 700,
50
+ self::CRITICAL => 600,
51
+ self::ERROR => 500,
52
+ self::WARNING => 400,
53
+ self::NOTICE => 300,
54
+ self::INFO => 200,
55
+ self::DEBUG => 100,
56
+ );
57
+
58
+ /**
59
+ * Severity integers mapped to level strings.
60
+ *
61
+ * This is the inverse of $level_severity.
62
+ *
63
+ * @var array
64
+ */
65
+ protected static $severity_to_level = array(
66
+ 800 => self::EMERGENCY,
67
+ 700 => self::ALERT,
68
+ 600 => self::CRITICAL,
69
+ 500 => self::ERROR,
70
+ 400 => self::WARNING,
71
+ 300 => self::NOTICE,
72
+ 200 => self::INFO,
73
+ 100 => self::DEBUG,
74
+ );
75
+
76
+
77
+ /**
78
+ * Validate a level string.
79
+ *
80
+ * @param string $level
81
+ *
82
+ * @return bool True if $level is a valid level.
83
+ */
84
+ public static function is_valid_level( $level ) {
85
+ return array_key_exists( strtolower( $level ), self::$level_to_severity );
86
+ }
87
+
88
+ /**
89
+ * Translate level string to integer.
90
+ *
91
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
92
+ *
93
+ * @return int 100 (debug) - 800 (emergency) or 0 if not recognized
94
+ */
95
+ public static function get_level_severity( $level ) {
96
+ if ( self::is_valid_level( $level ) ) {
97
+ $severity = self::$level_to_severity[ strtolower( $level ) ];
98
+ } else {
99
+ $severity = 0;
100
+ }
101
+
102
+ return $severity;
103
+ }
104
+
105
+ /**
106
+ * Translate severity integer to level string.
107
+ *
108
+ * @param int $severity
109
+ *
110
+ * @return bool|string False if not recognized. Otherwise string representation of level.
111
+ */
112
+ public static function get_severity_level( $severity ) {
113
+ if ( array_key_exists( $severity, self::$severity_to_level ) ) {
114
+ return self::$severity_to_level[ $severity ];
115
+ } else {
116
+ return false;
117
+ }
118
+ }
119
+
120
+ }
includes/class-evf-logger.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * Provides logging capabilities for debugging purposes.
8
+ *
9
+ * @class EVF_Logger
10
+ * @version 1.0.0
11
+ * @package EverestForms/Classes
12
+ * @category Class
13
+ * @author WPEverest
14
+ */
15
+ class EVF_Logger implements EVF_Logger_Interface {
16
+
17
+ /**
18
+ * Stores registered log handlers.
19
+ *
20
+ * @var array
21
+ */
22
+ protected $handlers;
23
+
24
+ /**
25
+ * Minimum log level this handler will process.
26
+ *
27
+ * @var int Integer representation of minimum log level to handle.
28
+ */
29
+ protected $threshold;
30
+
31
+ /**
32
+ * Constructor for the logger.
33
+ *
34
+ * @param array $handlers Optional. Array of log handlers. If $handlers is not provided,
35
+ * the filter 'everest_forms_register_log_handlers' will be used to define the handlers.
36
+ * If $handlers is provided, the filter will not be applied and the handlers will be
37
+ * used directly.
38
+ * @param string $threshold Optional. Define an explicit threshold. May be configured
39
+ * via EVF_LOG_THRESHOLD. By default, all logs will be processed.
40
+ */
41
+ public function __construct( $handlers = null, $threshold = null ) {
42
+ if ( null === $handlers ) {
43
+ $handlers = apply_filters( 'everest_forms_register_log_handlers', array() );
44
+ }
45
+
46
+ $register_handlers = array();
47
+
48
+ if ( ! empty( $handlers ) && is_array( $handlers ) ) {
49
+ foreach ( $handlers as $handler ) {
50
+ $implements = class_implements( $handler );
51
+ if ( is_object( $handler ) && is_array( $implements ) && in_array( 'EVF_Log_Handler_Interface', $implements ) ) {
52
+ $register_handlers[] = $handler;
53
+ } else {
54
+ _doing_it_wrong(
55
+ __METHOD__,
56
+ sprintf(
57
+ /* translators: 1: class name 2: EVF_Log_Handler_Interface */
58
+ __( 'The provided handler %1$s does not implement %2$s.', 'everest-forms' ),
59
+ '<code>' . esc_html( is_object( $handler ) ? get_class( $handler ) : $handler ) . '</code>',
60
+ '<code>EVF_Log_Handler_Interface</code>'
61
+ ),
62
+ '1.0.0'
63
+ );
64
+ }
65
+ }
66
+ }
67
+
68
+ if ( null !== $threshold ) {
69
+ $threshold = EVF_Log_Levels::get_level_severity( $threshold );
70
+ } elseif ( defined( 'EVF_LOG_THRESHOLD' ) && EVF_Log_Levels::is_valid_level( EVF_LOG_THRESHOLD ) ) {
71
+ $threshold = EVF_Log_Levels::get_level_severity( EVF_LOG_THRESHOLD );
72
+ } else {
73
+ $threshold = null;
74
+ }
75
+
76
+ $this->handlers = $register_handlers;
77
+ $this->threshold = $threshold;
78
+ }
79
+
80
+ /**
81
+ * Determine whether to handle or ignore log.
82
+ *
83
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
84
+ *
85
+ * @return bool True if the log should be handled.
86
+ */
87
+ protected function should_handle( $level ) {
88
+ if ( null === $this->threshold ) {
89
+ return true;
90
+ }
91
+
92
+ return $this->threshold <= EVF_Log_Levels::get_level_severity( $level );
93
+ }
94
+
95
+ /**
96
+ * Add a log entry.
97
+ *
98
+ * This is not the preferred method for adding log messages. Please use log() or any one of
99
+ * the level methods (debug(), info(), etc.). This method may be deprecated in the future.
100
+ *
101
+ * @param string $handle
102
+ * @param string $message
103
+ * @param string $level
104
+ *
105
+ * @return bool
106
+ */
107
+ public function add( $handle, $message, $level = EVF_Log_Levels::NOTICE ) {
108
+ $message = apply_filters( 'everest_forms_logger_add_message', $message, $handle );
109
+ $this->log( $level, $message, array( 'source' => $handle, '_legacy' => true ) );
110
+
111
+ return true;
112
+ }
113
+
114
+ /**
115
+ * Add a log entry.
116
+ *
117
+ * @param string $level One of the following:
118
+ * 'emergency': System is unusable.
119
+ * 'alert': Action must be taken immediately.
120
+ * 'critical': Critical conditions.
121
+ * 'error': Error conditions.
122
+ * 'warning': Warning conditions.
123
+ * 'notice': Normal but significant condition.
124
+ * 'info': Informational messages.
125
+ * 'debug': Debug-level messages.
126
+ * @param string $message Log message.
127
+ * @param array $context Optional. Additional information for log handlers.
128
+ */
129
+ public function log( $level, $message, $context = array() ) {
130
+ if ( ! EVF_Log_Levels::is_valid_level( $level ) ) {
131
+ /* translators: 1: EVF_Logger::log 2: level */
132
+ _doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'everest-forms' ), '<code>EVF_Logger::log</code>', $level ), '3.0' );
133
+ }
134
+
135
+ if ( $this->should_handle( $level ) ) {
136
+ $timestamp = current_time( 'timestamp' );
137
+ $message = apply_filters( 'everest_forms_logger_log_message', $message, $level, $context );
138
+
139
+ foreach ( $this->handlers as $handler ) {
140
+ $handler->handle( $timestamp, $level, $message, $context );
141
+ }
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Adds an emergency level message.
147
+ *
148
+ * System is unusable.
149
+ *
150
+ * @see EVF_Logger::log
151
+ *
152
+ * @param string $message
153
+ * @param array $context
154
+ */
155
+ public function emergency( $message, $context = array() ) {
156
+ $this->log( EVF_Log_Levels::EMERGENCY, $message, $context );
157
+ }
158
+
159
+ /**
160
+ * Adds an alert level message.
161
+ *
162
+ * Action must be taken immediately.
163
+ * Example: Entire website down, database unavailable, etc.
164
+ *
165
+ * @see EVF_Logger::log
166
+ *
167
+ * @param string $message
168
+ * @param array $context
169
+ */
170
+ public function alert( $message, $context = array() ) {
171
+ $this->log( EVF_Log_Levels::ALERT, $message, $context );
172
+ }
173
+
174
+ /**
175
+ * Adds a critical level message.
176
+ *
177
+ * Critical conditions.
178
+ * Example: Application component unavailable, unexpected exception.
179
+ *
180
+ * @see EVF_Logger::log
181
+ *
182
+ * @param string $message
183
+ * @param array $context
184
+ */
185
+ public function critical( $message, $context = array() ) {
186
+ $this->log( EVF_Log_Levels::CRITICAL, $message, $context );
187
+ }
188
+
189
+ /**
190
+ * Adds an error level message.
191
+ *
192
+ * Runtime errors that do not require immediate action but should typically be logged
193
+ * and monitored.
194
+ *
195
+ * @see EVF_Logger::log
196
+ *
197
+ * @param string $message
198
+ * @param array $context
199
+ */
200
+ public function error( $message, $context = array() ) {
201
+ $this->log( EVF_Log_Levels::ERROR, $message, $context );
202
+ }
203
+
204
+ /**
205
+ * Adds a warning level message.
206
+ *
207
+ * Exceptional occurrences that are not errors.
208
+ *
209
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
210
+ * necessarily wrong.
211
+ *
212
+ * @see EVF_Logger::log
213
+ *
214
+ * @param string $message
215
+ * @param array $context
216
+ */
217
+ public function warning( $message, $context = array() ) {
218
+ $this->log( EVF_Log_Levels::WARNING, $message, $context );
219
+ }
220
+
221
+ /**
222
+ * Adds a notice level message.
223
+ *
224
+ * Normal but significant events.
225
+ *
226
+ * @see EVF_Logger::log
227
+ *
228
+ * @param string $message
229
+ * @param array $context
230
+ */
231
+ public function notice( $message, $context = array() ) {
232
+ $this->log( EVF_Log_Levels::NOTICE, $message, $context );
233
+ }
234
+
235
+ /**
236
+ * Adds a info level message.
237
+ *
238
+ * Interesting events.
239
+ * Example: User logs in, SQL logs.
240
+ *
241
+ * @see EVF_Logger::log
242
+ *
243
+ * @param string $message
244
+ * @param array $context
245
+ */
246
+ public function info( $message, $context = array() ) {
247
+ $this->log( EVF_Log_Levels::INFO, $message, $context );
248
+ }
249
+
250
+ /**
251
+ * Adds a debug level message.
252
+ *
253
+ * Detailed debug information.
254
+ *
255
+ * @see EVF_Logger::log
256
+ *
257
+ * @param string $message
258
+ * @param array $context
259
+ */
260
+ public function debug( $message, $context = array() ) {
261
+ $this->log( EVF_Log_Levels::DEBUG, $message, $context );
262
+ }
263
+
264
+ /**
265
+ * Clear entries from chosen file.
266
+ *
267
+ *
268
+ * @param string $handle
269
+ *
270
+ * @return bool
271
+ */
272
+ public function clear( $handle ) {
273
+ $handler = new EVF_Log_Handler_File();
274
+
275
+ return $handler->clear( $handle );
276
+ }
277
+ }
includes/class-evf-post-types.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post Types
4
+ *
5
+ * Registers post types and taxonomies.
6
+ *
7
+ * @package EverestForms/Classes
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * EVF_Post_Types Class.
17
+ */
18
+ class EVF_Post_Types {
19
+
20
+ /**
21
+ * Hook in methods.
22
+ */
23
+ public static function init() {
24
+ add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
25
+ add_action( 'everest_forms_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
26
+ }
27
+
28
+
29
+ /**
30
+ * Register core post types.
31
+ */
32
+ public static function register_post_types() {
33
+ if ( ! is_blog_installed() || post_type_exists( 'everest_form' ) ) {
34
+ return;
35
+ }
36
+
37
+ do_action( 'everest_forms_register_post_type' );
38
+
39
+ $supports = array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'publicize', 'wpcom-markdown' );
40
+
41
+ register_post_type( 'everest_form',
42
+ apply_filters( 'everest_forms_register_post_type_product',
43
+ array(
44
+ 'labels' => array(
45
+ 'name' => __( 'Forms', 'everest-forms' ),
46
+ 'singular_name' => __( 'Form', 'everest-forms' ),
47
+ 'all_items' => __( 'All Forms', 'everest-forms' ),
48
+ 'menu_name' => _x( 'Forms', 'Admin menu name', 'everest-forms' ),
49
+ 'add_new' => __( 'Add New', 'everest-forms' ),
50
+ 'add_new_item' => __( 'Add new form', 'everest-forms' ),
51
+ 'edit' => __( 'Edit', 'everest-forms' ),
52
+ 'edit_item' => __( 'Edit form', 'everest-forms' ),
53
+ 'new_item' => __( 'New form', 'everest-forms' ),
54
+ 'view_item' => __( 'View form', 'everest-forms' ),
55
+ 'search_items' => __( 'Search forms', 'everest-forms' ),
56
+ 'not_found' => __( 'No forms found', 'everest-forms' ),
57
+ 'not_found_in_trash' => __( 'No forms found in trash', 'everest-forms' ),
58
+ 'parent' => __( 'Parent forms', 'everest-forms' ),
59
+ 'featured_image' => __( 'Form image', 'everest-forms' ),
60
+ 'set_featured_image' => __( 'Set form image', 'everest-forms' ),
61
+ 'remove_featured_image' => __( 'Remove form image', 'everest-forms' ),
62
+ 'use_featured_image' => __( 'Use as form image', 'everest-forms' ),
63
+ 'insert_into_item' => __( 'Insert into form', 'everest-forms' ),
64
+ 'uploaded_to_this_item' => __( 'Uploaded to this form', 'everest-forms' ),
65
+ 'filter_items_list' => __( 'Filter forms', 'everest-forms' ),
66
+ 'items_list_navigation' => __( 'Forms navigation', 'everest-forms' ),
67
+ 'items_list' => __( 'Forms list', 'everest-forms' ),
68
+ ),
69
+ 'public' => false,
70
+ 'show_ui' => true,
71
+ 'description' => __( 'This is where you can add new forms.', 'everest-forms' ),
72
+ 'capability_type' => 'everest_form',
73
+ 'map_meta_cap' => true,
74
+ 'publicly_queryable' => true,
75
+ 'exclude_from_search' => false,
76
+ 'show_in_rest' => true,
77
+ 'show_in_menu' => false,
78
+ 'hierarchical' => false,
79
+ 'rewrite' => false,
80
+ 'query_var' => false,
81
+ 'supports' => false,
82
+ 'show_in_nav_menus' => false,
83
+ 'show_in_admin_bar' => false,
84
+ )
85
+ )
86
+ );
87
+
88
+ do_action( 'everest_forms_after_register_post_type' );
89
+
90
+ }
91
+
92
+
93
+ /**
94
+ * Flush rewrite rules.
95
+ */
96
+ public static function flush_rewrite_rules() {
97
+ flush_rewrite_rules();
98
+ }
99
+
100
+
101
+ }
102
+
103
+ EVF_Post_Types::init();
includes/class-evf-session-handler.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle data for the current customers session.
4
+ * Implements the EVF_Session abstract class.
5
+ *
6
+ * @package EverestForms/Classes
7
+ * @version 1.0.0
8
+ * @since 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * EVF_Session_Handler Class.
17
+ */
18
+ class EVF_Session_Handler extends EVF_Session {
19
+
20
+ /**
21
+ * Cookie name used for the session.
22
+ *
23
+ * @var string cookie name
24
+ */
25
+ protected $_cookie;
26
+
27
+ /**
28
+ * Stores session expiry.
29
+ *
30
+ * @var string session due to expire timestamp
31
+ */
32
+ protected $_session_expiring;
33
+
34
+ /**
35
+ * Stores session due to expire timestamp.
36
+ *
37
+ * @var string session expiration timestamp
38
+ */
39
+ protected $_session_expiration;
40
+
41
+ /**
42
+ * True when the cookie exists.
43
+ *
44
+ * @var bool Based on whether a cookie exists.
45
+ */
46
+ protected $_has_cookie = false;
47
+
48
+ /**
49
+ * Table name for session data.
50
+ *
51
+ * @var string Custom session table name
52
+ */
53
+ protected $_table;
54
+
55
+ /**
56
+ * Constructor for the session class.
57
+ */
58
+ public function __construct() {
59
+ $this->_cookie = apply_filters( 'everest_forms_cookie', 'wp_everest_forms_session_' . COOKIEHASH );
60
+ $this->_table = $GLOBALS['wpdb']->prefix . 'evf_sessions';
61
+ }
62
+
63
+ /**
64
+ * Init hooks and session data.
65
+ */
66
+ public function init() {
67
+ $cookie = $this->get_session_cookie();
68
+
69
+ if ( $cookie ) {
70
+ $this->_customer_id = $cookie[0];
71
+ $this->_session_expiration = $cookie[1];
72
+ $this->_session_expiring = $cookie[2];
73
+ $this->_has_cookie = true;
74
+
75
+ // Update session if its close to expiring.
76
+ if ( time() > $this->_session_expiring ) {
77
+ $this->set_session_expiration();
78
+ $this->update_session_timestamp( $this->_customer_id, $this->_session_expiration );
79
+ }
80
+ } else {
81
+ $this->set_session_expiration();
82
+ $this->_customer_id = $this->generate_customer_id();
83
+ }
84
+
85
+ $this->_data = $this->get_session_data();
86
+
87
+ add_action( 'shutdown', array( $this, 'save_data' ), 20 );
88
+ add_action( 'wp_logout', array( $this, 'destroy_session' ) );
89
+
90
+ if ( ! is_user_logged_in() ) {
91
+ add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ) );
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Return true if the current user has an active session, i.e. a cookie to retrieve values.
97
+ *
98
+ * @return bool
99
+ */
100
+ public function has_session() {
101
+ return isset( $_COOKIE[ $this->_cookie ] ) || $this->_has_cookie || is_user_logged_in(); // @codingStandardsIgnoreLine.
102
+ }
103
+
104
+ /**
105
+ * Set session expiration.
106
+ */
107
+ public function set_session_expiration() {
108
+ $this->_session_expiring = time() + intval( apply_filters( 'evf_session_expiring', 60 * 60 * 47 ) ); // 47 Hours.
109
+ $this->_session_expiration = time() + intval( apply_filters( 'evf_session_expiration', 60 * 60 * 48 ) ); // 48 Hours.
110
+ }
111
+
112
+ /**
113
+ * Generate a unique customer ID for guests, or return user ID if logged in.
114
+ *
115
+ * Uses Portable PHP password hashing framework to generate a unique cryptographically strong ID.
116
+ *
117
+ * @return int|string
118
+ */
119
+ public function generate_customer_id() {
120
+ if ( is_user_logged_in() ) {
121
+ return get_current_user_id();
122
+ } else {
123
+ require_once ABSPATH . 'wp-includes/class-phpass.php';
124
+ $hasher = new PasswordHash( 8, false );
125
+ return md5( $hasher->get_random_bytes( 32 ) );
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Get session cookie.
131
+ *
132
+ * @return bool|array
133
+ */
134
+ public function get_session_cookie() {
135
+ $cookie_value = isset( $_COOKIE[ $this->_cookie ] ) ? wp_unslash( $_COOKIE[ $this->_cookie ] ) : false; // @codingStandardsIgnoreLine.
136
+
137
+ if ( empty( $cookie_value ) || ! is_string( $cookie_value ) ) {
138
+ return false;
139
+ }
140
+
141
+ list( $customer_id, $session_expiration, $session_expiring, $cookie_hash ) = explode( '||', $cookie_value );
142
+
143
+ // Validate hash.
144
+ $to_hash = $customer_id . '|' . $session_expiration;
145
+ $hash = hash_hmac( 'md5', $to_hash, wp_hash( $to_hash ) );
146
+
147
+ if ( empty( $cookie_hash ) || ! hash_equals( $hash, $cookie_hash ) ) {
148
+ return false;
149
+ }
150
+
151
+ return array( $customer_id, $session_expiration, $session_expiring, $cookie_hash );
152
+ }
153
+
154
+ /**
155
+ * Get session data.
156
+ *
157
+ * @return array
158
+ */
159
+ public function get_session_data() {
160
+ return $this->has_session() ? (array) $this->get_session( $this->_customer_id, array() ) : array();
161
+ }
162
+
163
+ /**
164
+ * Gets a cache prefix. This is used in session names so the entire cache can be invalidated with 1 function call.
165
+ *
166
+ * @return string
167
+ */
168
+ private function get_cache_prefix() {
169
+ return EVF_Cache_Helper::get_cache_prefix( EVF_SESSION_CACHE_GROUP );
170
+ }
171
+
172
+ /**
173
+ * Save data.
174
+ */
175
+ public function save_data() {
176
+ // Dirty if something changed - prevents saving nothing new.
177
+ if ( $this->_dirty && $this->has_session() ) {
178
+ global $wpdb;
179
+
180
+ $wpdb->replace( // @codingStandardsIgnoreLine.
181
+ $this->_table,
182
+ array(
183
+ 'session_key' => $this->_customer_id,
184
+ 'session_value' => maybe_serialize( $this->_data ),
185
+ 'session_expiry' => $this->_session_expiration,
186
+ ),
187
+ array(
188
+ '%s',
189
+ '%s',
190
+ '%d',
191
+ )
192
+ );
193
+
194
+ wp_cache_set( $this->get_cache_prefix() . $this->_customer_id, $this->_data, EVF_SESSION_CACHE_GROUP, $this->_session_expiration - time() );
195
+ $this->_dirty = false;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Destroy all session data.
201
+ */
202
+ public function destroy_session() {
203
+ evf_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, apply_filters( 'evf_session_use_secure_cookie', false ) );
204
+
205
+ $this->delete_session( $this->_customer_id );
206
+
207
+ $this->_data = array();
208
+ $this->_dirty = false;
209
+ $this->_customer_id = $this->generate_customer_id();
210
+ }
211
+
212
+ /**
213
+ * When a user is logged out, ensure they have a unique nonce by using the customer/session ID.
214
+ *
215
+ * @param int $uid User ID.
216
+ * @return string
217
+ */
218
+ public function nonce_user_logged_out( $uid ) {
219
+ return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid;
220
+ }
221
+
222
+ /**
223
+ * Cleanup session data from the database and clear caches.
224
+ */
225
+ public function cleanup_sessions() {
226
+ global $wpdb;
227
+
228
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $this->_table WHERE session_expiry < %d", time() ) ); // @codingStandardsIgnoreLine.
229
+
230
+ if ( class_exists( 'EVF_Cache_Helper' ) ) {
231
+ EVF_Cache_Helper::incr_cache_prefix( EVF_SESSION_CACHE_GROUP );
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Returns the session.
237
+ *
238
+ * @param string $customer_id Custo ID.
239
+ * @param mixed $default Default session value.
240
+ * @return string|array
241
+ */
242
+ public function get_session( $customer_id, $default = false ) {
243
+ global $wpdb;
244
+
245
+ if ( defined( 'WP_SETUP_CONFIG' ) ) {
246
+ return false;
247
+ }
248
+
249
+ // Try to get it from the cache, it will return false if not present or if object cache not in use.
250
+ $value = wp_cache_get( $this->get_cache_prefix() . $customer_id, EVF_SESSION_CACHE_GROUP );
251
+
252
+ if ( false === $value ) {
253
+ $value = $wpdb->get_var( $wpdb->prepare( "SELECT session_value FROM $this->_table WHERE session_key = %s", $customer_id ) ); // @codingStandardsIgnoreLine.
254
+
255
+ if ( is_null( $value ) ) {
256
+ $value = $default;
257
+ }
258
+
259
+ wp_cache_add( $this->get_cache_prefix() . $customer_id, $value, EVF_SESSION_CACHE_GROUP, $this->_session_expiration - time() );
260
+ }
261
+
262
+ return maybe_unserialize( $value );
263
+ }
264
+
265
+ /**
266
+ * Delete the session from the cache and database.
267
+ *
268
+ * @param int $customer_id Customer ID.
269
+ */
270
+ public function delete_session( $customer_id ) {
271
+ global $wpdb;
272
+
273
+ wp_cache_delete( $this->get_cache_prefix() . $customer_id, EVF_SESSION_CACHE_GROUP );
274
+
275
+ $wpdb->delete( // @codingStandardsIgnoreLine.
276
+ $this->_table,
277
+ array(
278
+ 'session_key' => $customer_id,
279
+ )
280
+ );
281
+ }
282
+
283
+ /**
284
+ * Update the session expiry timestamp.
285
+ *
286
+ * @param string $customer_id Customer ID.
287
+ * @param int $timestamp Timestamp to expire the cookie.
288
+ */
289
+ public function update_session_timestamp( $customer_id, $timestamp ) {
290
+ global $wpdb;
291
+
292
+ // @codingStandardsIgnoreStart.
293
+ $wpdb->update(
294
+ $this->_table,
295
+ array(
296
+ 'session_expiry' => $timestamp,
297
+ ),
298
+ array(
299
+ 'session_key' => $customer_id,
300
+ ),
301
+ array(
302
+ '%d'
303
+ )
304
+ );
305
+ // @codingStandardsIgnoreEnd.
306
+ }
307
+ }
includes/class-evf-shortcodes.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcodes
4
+ *
5
+ * @author Automattic
6
+ * @category Class
7
+ * @package EverestForms/Classes
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * EverestForms Shortcodes class.
17
+ */
18
+ class EVF_Shortcodes {
19
+
20
+ /**
21
+ * Init shortcodes.
22
+ */
23
+ public static function init() {
24
+ self::init_shortcode_hooks();
25
+ $shortcodes = array(
26
+ 'everest_form' => __CLASS__ . '::form',
27
+ );
28
+
29
+ foreach ( $shortcodes as $shortcode => $function ) {
30
+ add_shortcode( apply_filters( "{$shortcode}_shortcode_tag", $shortcode ), $function );
31
+ }
32
+
33
+ }
34
+
35
+ /**
36
+ * Shortcode Wrapper.
37
+ *
38
+ * @param string[] $function Callback function.
39
+ * @param array $atts Attributes. Default to empty array.
40
+ * @param array $wrapper Customer wrapper data.
41
+ *
42
+ * @return string
43
+ */
44
+ public static function shortcode_wrapper(
45
+ $function,
46
+ $atts = array(),
47
+ $wrapper = array(
48
+ 'class' => 'everest-forms',
49
+ 'before' => null,
50
+ 'after' => null,
51
+ )
52
+ ) {
53
+ ob_start();
54
+
55
+ // @codingStandardsIgnoreStart
56
+ echo empty( $wrapper['before'] ) ? '<div class="' . esc_attr( $wrapper['class'] ) . '">' : $wrapper['before'];
57
+ call_user_func( $function, $atts );
58
+ echo empty( $wrapper['after'] ) ? '</div>' : $wrapper['after'];
59
+
60
+ // @codingStandardsIgnoreEnd
61
+
62
+ return ob_get_clean();
63
+ }
64
+
65
+
66
+ /**
67
+ * test page shortcode.
68
+ *
69
+ * @param array $atts Attributes.
70
+ *
71
+ * @return string
72
+ */
73
+ public static function form( $atts ) {
74
+ return self::shortcode_wrapper( array( 'EVF_Shortcode_Form', 'output' ), $atts );
75
+ }
76
+
77
+ public static function init_shortcode_hooks() {
78
+ self::shortcode_wrapper( array( 'EVF_Shortcode_Form', 'hooks' ) );
79
+ }
80
+
81
+ }
includes/class-evf-template-loader.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Loader
4
+ *
5
+ * @version 1.0.0
6
+ * @package EverestForms\Classes
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * EVF_Template_Loader Class.
15
+ */
16
+ class EVF_Template_Loader {
17
+
18
+ /**
19
+ * Hook in methods.
20
+ */
21
+ public static function init() {
22
+ add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
23
+ }
24
+
25
+ /**
26
+ * Load a template.
27
+ *
28
+ * Handles template usage so that we can use our own templates instead of the themes.
29
+ *
30
+ * Templates are in the 'templates' folder. everest-forms looks for theme.
31
+ * overrides in /theme/everest-forms/ by default.
32
+ *
33
+ * For beginners, it also looks for a everest-forms.php template first. If the user adds.
34
+ * this to the theme (containing a everest-forms() inside) this will be used for all.
35
+ * everest-forms templates.
36
+ *
37
+ * @param string $template Template to load.
38
+ * @return string
39
+ */
40
+ public static function template_loader( $template ) {
41
+ if ( is_embed() ) {
42
+ return $template;
43
+ }
44
+
45
+ if ( $default_file = self::get_template_loader_default_file() ) {
46
+ /**
47
+ * Filter hook to choose which files to find before EverestForms does it's own logic.
48
+ *
49
+ * @since 1.0.0
50
+ * @var array
51
+ */
52
+ $search_files = self::get_template_loader_files( $default_file );
53
+ $template = locate_template( $search_files );
54
+
55
+ if ( ! $template || EVF_TEMPLATE_DEBUG_MODE ) {
56
+ $template = EVF()->plugin_path() . '/templates/' . $default_file;
57
+ }
58
+ }
59
+
60
+ return $template;
61
+ }
62
+
63
+ /**
64
+ * Get the default filename for a template.
65
+ *
66
+ * @since 1.0.0
67
+ * @return string
68
+ */
69
+ private static function get_template_loader_default_file() {
70
+ return '';
71
+ }
72
+
73
+ /**
74
+ * Get an array of filenames to search for a given template.
75
+ *
76
+ * @since 1.0.0
77
+ * @param string $default_file The default file name.
78
+ * @return string[]
79
+ */
80
+ private static function get_template_loader_files( $default_file ) {
81
+ $search_files = apply_filters( 'everest_forms_template_loader_files', array(), $default_file );
82
+ $search_files[] = 'everest-forms.php';
83
+
84
+ if ( is_page_template() ) {
85
+ $search_files[] = get_page_template_slug();
86
+ }
87
+
88
+ $search_files[] = $default_file;
89
+ $search_files[] = EVF()->template_path() . $default_file;
90
+
91
+ return array_unique( $search_files );
92
+ }
93
+ }
includes/class-evf-validation.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contains Validation functions
4
+ *
5
+ * @version 1.0.0
6
+ * @package EverestForms/Classes
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * EVF_Validation Class.
15
+ */
16
+ class EVF_Validation {
17
+
18
+ /**
19
+ * Validates an email using WordPress native is_email function.
20
+ *
21
+ * @param string $email Email address to validate.
22
+ * @return bool
23
+ */
24
+ public static function is_email( $email ) {
25
+ return is_email( $email );
26
+ }
27
+
28
+ /**
29
+ * Validates a phone number using a regular expression.
30
+ *
31
+ * @param string $phone Phone number to validate.
32
+ * @return bool
33
+ */
34
+ public static function is_phone( $phone ) {
35
+ if ( 0 < strlen( trim( preg_replace( '/[\s\#0-9_\-\+\/\(\)]/', '', $phone ) ) ) ) {
36
+ return false;
37
+ }
38
+
39
+ return true;
40
+ }
41
+
42
+ /**
43
+ * Format the phone number.
44
+ *
45
+ * @param mixed $tel Phone number to format.
46
+ * @return string
47
+ */
48
+ public static function format_phone( $tel ) {
49
+ return evf_format_phone_number( $tel );
50
+ }
51
+ }
includes/evf-core-functions.php ADDED
@@ -0,0 +1,1035 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Core Functions
4
+ *
5
+ * General core functions available on both the front-end and admin.
6
+ *
7
+ * @package EverestForms/Functions
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ // Include core functions (available in both admin and frontend).
16
+ include EVF_ABSPATH . 'includes/evf-user-functions.php';
17
+ require EVF_ABSPATH . 'includes/evf-deprecated-functions.php';
18
+ include EVF_ABSPATH . 'includes/evf-formatting-functions.php';
19
+
20
+ /**
21
+ * Define a constant if it is not already defined.
22
+ *
23
+ * @since 1.0.0
24
+ * @param string $name Constant name.
25
+ * @param string $value Value.
26
+ */
27
+ function evf_maybe_define_constant( $name, $value ) {
28
+ if ( ! defined( $name ) ) {
29
+ define( $name, $value );
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get template part (for templates like the shop-loop).
35
+ *
36
+ * EVF_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.
37
+ *
38
+ * @access public
39
+ *
40
+ * @param mixed $slug
41
+ * @param string $name (default: '')
42
+ */
43
+ function evf_get_template_part( $slug, $name = '' ) {
44
+ $template = '';
45
+
46
+ // Look in yourtheme/slug-name.php and yourtheme/everest-forms/slug-name.php
47
+ if ( $name && ! EVF_TEMPLATE_DEBUG_MODE ) {
48
+ $template = locate_template( array( "{$slug}-{$name}.php", EVF()->template_path() . "{$slug}-{$name}.php" ) );
49
+ }
50
+
51
+ // Get default slug-name.php
52
+ if ( ! $template && $name && file_exists( EVF()->plugin_path() . "/templates/{$slug}-{$name}.php" ) ) {
53
+ $template = EVF()->plugin_path() . "/templates/{$slug}-{$name}.php";
54
+ }
55
+
56
+ // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/everest-forms/slug.php
57
+ if ( ! $template && ! EVF_TEMPLATE_DEBUG_MODE ) {
58
+ $template = locate_template( array( "{$slug}.php", EVF()->template_path() . "{$slug}.php" ) );
59
+ }
60
+
61
+ // Allow 3rd party plugins to filter template file from their plugin.
62
+ $template = apply_filters( 'evf_get_template_part', $template, $slug, $name );
63
+
64
+ if ( $template ) {
65
+ load_template( $template, false );
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Get other templates passing attributes and including the file.
71
+ *
72
+ * @access public
73
+ *
74
+ * @param string $template_name
75
+ * @param array $args (default: array())
76
+ * @param string $template_path (default: '')
77
+ * @param string $default_path (default: '')
78
+ */
79
+ function evf_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
80
+ if ( ! empty( $args ) && is_array( $args ) ) {
81
+ extract( $args );
82
+ }
83
+
84
+ $located = evf_locate_template( $template_name, $template_path, $default_path );
85
+
86
+ if ( ! file_exists( $located ) ) {
87
+ _doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'everest-forms' ), '<code>' . $located . '</code>' ), '1.0.0' );
88
+
89
+ return;
90
+ }
91
+
92
+ // Allow 3rd party plugin filter template file from their plugin.
93
+ $located = apply_filters( 'evf_get_template', $located, $template_name, $args, $template_path, $default_path );
94
+
95
+ do_action( 'everest_forms_before_template_part', $template_name, $template_path, $located, $args );
96
+
97
+ include( $located );
98
+
99
+ do_action( 'everest_forms_after_template_part', $template_name, $template_path, $located, $args );
100
+ }
101
+
102
+
103
+ /**
104
+ * Like evf_get_template, but returns the HTML instead of outputting.
105
+ *
106
+ * @see evf_get_template
107
+ * @since 1.0.0
108
+ *
109
+ * @param string $template_name
110
+ * @param array $args
111
+ * @param string $template_path
112
+ * @param string $default_path
113
+ *
114
+ * @return string
115
+ */
116
+ function evf_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
117
+ ob_start();
118
+ evf_get_template( $template_name, $args, $template_path, $default_path );
119
+
120
+ return ob_get_clean();
121
+ }
122
+
123
+ /**
124
+ * Locate a template and return the path for inclusion.
125
+ *
126
+ * This is the load order:
127
+ *
128
+ * yourtheme / $template_path / $template_name
129
+ * yourtheme / $template_name
130
+ * $default_path / $template_name
131
+ *
132
+ * @access public
133
+ *
134
+ * @param string $template_name
135
+ * @param string $template_path (default: '')
136
+ * @param string $default_path (default: '')
137
+ *
138
+ * @return string
139
+ */
140
+ function evf_locate_template( $template_name, $template_path = '', $default_path = '' ) {
141
+ if ( ! $template_path ) {
142
+ $template_path = EVF()->template_path();
143
+ }
144
+
145
+ if ( ! $default_path ) {
146
+ $default_path = EVF()->plugin_path() . '/templates/';
147
+ }
148
+
149
+ // Look within passed path within the theme - this is priority.
150
+ $template = locate_template(
151
+ array(
152
+ trailingslashit( $template_path ) . $template_name,
153
+ $template_name,
154
+ )
155
+ );
156
+
157
+ // Get default template/
158
+ if ( ! $template || EVF_TEMPLATE_DEBUG_MODE ) {
159
+ $template = $default_path . $template_name;
160
+ }
161
+
162
+ // Return what we found.
163
+ return apply_filters( 'everest_forms_locate_template', $template, $template_name, $template_path );
164
+ }
165
+
166
+ /**
167
+ * Send HTML emails from EverestForms.
168
+ *
169
+ * @param mixed $to
170
+ * @param mixed $subject
171
+ * @param mixed $message
172
+ * @param string $headers (default: "Content-Type: text/html\r\n")
173
+ * @param string $attachments (default: "")
174
+ */
175
+ function evf_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
176
+ $mailer = EVF()->mailer();
177
+
178
+ $mailer->send( $to, $subject, $message, $headers, $attachments );
179
+ }
180
+
181
+ /**
182
+ * Queue some JavaScript code to be output in the footer.
183
+ *
184
+ * @param string $code
185
+ */
186
+ function evf_enqueue_js( $code ) {
187
+ global $evf_queued_js;
188
+
189
+ if ( empty( $evf_queued_js ) ) {
190
+ $evf_queued_js = '';
191
+ }
192
+
193
+ $evf_queued_js .= "\n" . $code . "\n";
194
+ }
195
+
196
+ /**
197
+ * Output any queued javascript code in the footer.
198
+ */
199
+ function evf_print_js() {
200
+ global $evf_queued_js;
201
+
202
+ if ( ! empty( $evf_queued_js ) ) {
203
+ // Sanitize.
204
+ $evf_queued_js = wp_check_invalid_utf8( $evf_queued_js );
205
+ $evf_queued_js = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", $evf_queued_js );
206
+ $evf_queued_js = str_replace( "\r", '', $evf_queued_js );
207
+
208
+ $js = "<!-- Everest Forms JavaScript -->\n<script type=\"text/javascript\">\njQuery(function($) { $evf_queued_js });\n</script>\n";
209
+
210
+ /**
211
+ * Queued jsfilter.
212
+ *
213
+ * @since 1.0.0
214
+ * @param string $js JavaScript code.
215
+ */
216
+ echo apply_filters( 'everest_forms_queued_js', $js );
217
+
218
+ unset( $evf_queued_js );
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Set a cookie - wrapper for setcookie using WP constants.
224
+ *
225
+ * @param string $name Name of the cookie being set.
226
+ * @param string $value Value of the cookie.
227
+ * @param integer $expire Expiry of the cookie.
228
+ * @param bool $secure Whether the cookie should be served only over https.
229
+ */
230
+ function evf_setcookie( $name, $value, $expire = 0, $secure = false ) {
231
+ if ( ! headers_sent() ) {
232
+ setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure );
233
+ } elseif ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
234
+ headers_sent( $file, $line );
235
+ trigger_error( "{$name} cookie cannot be set - headers already sent by {$file} on line {$line}", E_USER_NOTICE );
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Get a log file path.
241
+ *
242
+ * @since 1.0.0
243
+ *
244
+ * @param string $handle name.
245
+ *
246
+ * @return string the log file path.
247
+ */
248
+ function evf_get_log_file_path( $handle ) {
249
+ return EVF_Log_Handler_File::get_log_file_path( $handle );
250
+ }
251
+
252
+ /**
253
+ * Recursively get page children.
254
+ *
255
+ * @param int $page_id
256
+ *
257
+ * @return int[]
258
+ */
259
+ function evf_get_page_children( $page_id ) {
260
+ $page_ids = get_posts( array(
261
+ 'post_parent' => $page_id,
262
+ 'post_type' => 'page',
263
+ 'numberposts' => - 1,
264
+ 'post_status' => 'any',
265
+ 'fields' => 'ids',
266
+ ) );
267
+
268
+ if ( ! empty( $page_ids ) ) {
269
+ foreach ( $page_ids as $page_id ) {
270
+ $page_ids = array_merge( $page_ids, evf_get_page_children( $page_id ) );
271
+ }
272
+ }
273
+
274
+ return $page_ids;
275
+ }
276
+
277
+ /**
278
+ * Get user agent string.
279
+ * @since 1.0.0
280
+ * @return string
281
+ */
282
+ function evf_get_user_agent() {
283
+ return isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
284
+ }
285
+
286
+ // This function can be removed when WP 3.9.2 or greater is required.
287
+ if ( ! function_exists( 'hash_equals' ) ) :
288
+ /**
289
+ * Compare two strings in constant time.
290
+ *
291
+ * This function was added in PHP 5.6.
292
+ * It can leak the length of a string.
293
+ *
294
+ * @since 1.0.0
295
+ *
296
+ * @param string $a Expected string.
297
+ * @param string $b Actual string.
298
+ *
299
+ * @return bool Whether strings are equal.
300
+ */
301
+ function hash_equals( $a, $b ) {
302
+ $a_length = strlen( $a );
303
+ if ( strlen( $b ) !== $a_length ) {
304
+ return false;
305
+ }
306
+ $result = 0;
307
+
308
+ // Do not attempt to "optimize" this.
309
+ for ( $i = 0; $i < $a_length; $i ++ ) {
310
+ $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
311
+ }
312
+
313
+ return 0 === $result;
314
+ }
315
+ endif;
316
+
317
+ /**
318
+ * Generate a rand hash.
319
+ *
320
+ * @since 1.0.0
321
+ * @return string
322
+ */
323
+ function evf_rand_hash() {
324
+ if ( function_exists( 'openssl_random_pseudo_bytes' ) ) {
325
+ return bin2hex( openssl_random_pseudo_bytes( 20 ) );
326
+ } else {
327
+ return sha1( wp_rand() );
328
+ }
329
+ }
330
+
331
+ /**
332
+ * Find all possible combinations of values from the input array and return in a logical order.
333
+ * @since 1.0.0
334
+ *
335
+ * @param array $input
336
+ *
337
+ * @return array
338
+ */
339
+ function evf_array_cartesian( $input ) {
340
+ $input = array_filter( $input );
341
+ $results = array();
342
+ $indexes = array();
343
+ $index = 0;
344
+
345
+ // Generate indexes from keys and values so we have a logical sort order
346
+ foreach ( $input as $key => $values ) {
347
+ foreach ( $values as $value ) {
348
+ $indexes[ $key ][ $value ] = $index ++;
349
+ }
350
+ }
351
+
352
+ // Loop over the 2D array of indexes and generate all combinations
353
+ foreach ( $indexes as $key => $values ) {
354
+ // When result is empty, fill with the values of the first looped array
355
+ if ( empty( $results ) ) {
356
+ foreach ( $values as $value ) {
357
+ $results[] = array( $key => $value );
358
+ }
359
+
360
+ // Second and subsequent input sub-array merging.
361
+ } else {
362
+ foreach ( $results as $result_key => $result ) {
363
+ foreach ( $values as $value ) {
364
+ // If the key is not set, we can set it
365
+ if ( ! isset( $results[ $result_key ][ $key ] ) ) {
366
+ $results[ $result_key ][ $key ] = $value;
367
+ // If the key is set, we can add a new combination to the results array
368
+ } else {
369
+ $new_combination = $results[ $result_key ];
370
+ $new_combination[ $key ] = $value;
371
+ $results[] = $new_combination;
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ // Sort the indexes
379
+ arsort( $results );
380
+
381
+ // Convert indexes back to values
382
+ foreach ( $results as $result_key => $result ) {
383
+ $converted_values = array();
384
+
385
+ // Sort the values
386
+ arsort( $results[ $result_key ] );
387
+
388
+ // Convert the values
389
+ foreach ( $results[ $result_key ] as $key => $value ) {
390
+ $converted_values[ $key ] = array_search( $value, $indexes[ $key ] );
391
+ }
392
+
393
+ $results[ $result_key ] = $converted_values;
394
+ }
395
+
396
+ return $results;
397
+ }
398
+
399
+ /**
400
+ * Run a MySQL transaction query, if supported.
401
+ *
402
+ * @param string $type start (default), commit, rollback
403
+ *
404
+ * @since 1.0.0
405
+ */
406
+ function evf_transaction_query( $type = 'start' ) {
407
+ global $wpdb;
408
+
409
+ $wpdb->hide_errors();
410
+
411
+ evf_maybe_define_constant( 'EVF_USE_TRANSACTIONS', true );
412
+
413
+ if ( EVF_USE_TRANSACTIONS ) {
414
+ switch ( $type ) {
415
+ case 'commit' :
416
+ $wpdb->query( 'COMMIT' );
417
+ break;
418
+ case 'rollback' :
419
+ $wpdb->query( 'ROLLBACK' );
420
+ break;
421
+ default :
422
+ $wpdb->query( 'START TRANSACTION' );
423
+ break;
424
+ }
425
+ }
426
+ }
427
+
428
+ /**
429
+ * Outputs a "back" link so admin screens can easily jump back a page.
430
+ *
431
+ * @param string $label Title of the page to return to.
432
+ * @param string $url URL of the page to return to.
433
+ */
434
+ function evf_back_link( $label, $url ) {
435
+ echo '<small class="evf-admin-breadcrumb"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '">&#x2934;</a></small>';
436
+ }
437
+
438
+ /**
439
+ * Display a EverestForms help tip.
440
+ *
441
+ * @since 1.0.0
442
+ *
443
+ * @param string $tip Help tip text
444
+ * @param bool $allow_html Allow sanitized HTML if true or escape
445
+ *
446
+ * @return string
447
+ */
448
+ function evf_help_tip( $tip, $allow_html = false ) {
449
+ if ( $allow_html ) {
450
+ $tip = evf_sanitize_tooltip( $tip );
451
+ } else {
452
+ $tip = esc_attr( $tip );
453
+ }
454
+
455
+ return '<span class="evf-help-tip" data-tip="' . $tip . '"></span>';
456
+ }
457
+
458
+ /**
459
+ * Wrapper for set_time_limit to see if it is enabled.
460
+ * @since 1.0.0
461
+ *
462
+ * @param int $limit
463
+ */
464
+ function evf_set_time_limit( $limit = 0 ) {
465
+ if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
466
+ @set_time_limit( $limit );
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Get a shared logger instance.
472
+ *
473
+ * Use the everest_forms_logging_class filter to change the logging class. You may provide one of the following:
474
+ * - a class name which will be instantiated as `new $class` with no arguments
475
+ * - an instance which will be used directly as the logger
476
+ * In either case, the class or instance *must* implement EVF_Logger_Interface.
477
+ *
478
+ * @see EVF_Logger_Interface
479
+ *
480
+ * @return EVF_Logger
481
+ */
482
+ function evf_get_logger() {
483
+ static $logger = null;
484
+ if ( null === $logger ) {
485
+ $class = apply_filters( 'everest_forms_logging_class', 'EVF_Logger' );
486
+ $implements = class_implements( $class );
487
+ if ( is_array( $implements ) && in_array( 'EVF_Logger_Interface', $implements ) ) {
488
+ if ( is_object( $class ) ) {
489
+ $logger = $class;
490
+ } else {
491
+ $logger = new $class;
492
+ }
493
+ } else {
494
+ _doing_it_wrong(
495
+ __FUNCTION__,
496
+ sprintf(
497
+ /* translators: 1: class name 2: everest_forms_logging_class 3: EVF_Logger_Interface */
498
+ __( 'The class %1$s provided by %2$s filter must implement %3$s.', 'everest-forms' ),
499
+ '<code>' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '</code>',
500
+ '<code>everest_forms_logging_class</code>',
501
+ '<code>EVF_Logger_Interface</code>'
502
+ ),
503
+ '1.0.0'
504
+ );
505
+ $logger = new EVF_Logger();
506
+ }
507
+ }
508
+
509
+ return $logger;
510
+ }
511
+
512
+ /**
513
+ * Prints human-readable information about a variable.
514
+ *
515
+ * Some server environments blacklist some debugging functions. This function provides a safe way to
516
+ * turn an expression into a printable, readable form without calling blacklisted functions.
517
+ *
518
+ * @since 1.0.0
519
+ *
520
+ * @param mixed $expression The expression to be printed.
521
+ * @param bool $return Optional. Default false. Set to true to return the human-readable string.
522
+ *
523
+ * @return string|bool False if expression could not be printed. True if the expression was printed.
524
+ * If $return is true, a string representation will be returned.
525
+ */
526
+ function evf_print_r( $expression, $return = false ) {
527
+ $alternatives = array(
528
+ array( 'func' => 'print_r', 'args' => array( $expression, true ) ),
529
+ array( 'func' => 'var_export', 'args' => array( $expression, true ) ),
530
+ array( 'func' => 'json_encode', 'args' => array( $expression ) ),
531
+ array( 'func' => 'serialize', 'args' => array( $expression ) ),
532
+ );
533
+
534
+ $alternatives = apply_filters( 'everest_forms_print_r_alternatives', $alternatives, $expression );
535
+
536
+ foreach ( $alternatives as $alternative ) {
537
+ if ( function_exists( $alternative['func'] ) ) {
538
+ $res = call_user_func_array( $alternative['func'], $alternative['args'] );
539
+ if ( $return ) {
540
+ return $res;
541
+ } else {
542
+ echo $res;
543
+
544
+ return true;
545
+ }
546
+ }
547
+ }
548
+
549
+ return false;
550
+ }
551
+
552
+ /**
553
+ * Registers the default log handler.
554
+ *
555
+ * @since 1.0.0
556
+ *
557
+ * @param array $handlers
558
+ *
559
+ * @return array
560
+ */
561
+ function evf_register_default_log_handler( $handlers ) {
562
+
563
+ if ( defined( 'EVF_LOG_HANDLER' ) && class_exists( EVF_LOG_HANDLER ) ) {
564
+ $handler_class = EVF_LOG_HANDLER;
565
+ $default_handler = new $handler_class();
566
+ } else {
567
+ $default_handler = new EVF_Log_Handler_File();
568
+ }
569
+
570
+ array_push( $handlers, $default_handler );
571
+
572
+ return $handlers;
573
+ }
574
+
575
+ add_filter( 'everest_forms_register_log_handlers', 'evf_register_default_log_handler' );
576
+
577
+ /**
578
+ * Based on wp_list_pluck, this calls a method instead of returning a property.
579
+ *
580
+ * @since 1.0.0
581
+ *
582
+ * @param array $list List of objects or arrays
583
+ * @param int|string $callback_or_field Callback method from the object to place instead of the entire object
584
+ * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
585
+ * Default null.
586
+ *
587
+ * @return array Array of values.
588
+ */
589
+ function evf_list_pluck( $list, $callback_or_field, $index_key = null ) {
590
+ // Use wp_list_pluck if this isn't a callback
591
+ $first_el = current( $list );
592
+ if ( ! is_object( $first_el ) || ! is_callable( array( $first_el, $callback_or_field ) ) ) {
593
+ return wp_list_pluck( $list, $callback_or_field, $index_key );
594
+ }
595
+ if ( ! $index_key ) {
596
+ /*
597
+ * This is simple. Could at some point wrap array_column()
598
+ * if we knew we had an array of arrays.
599
+ */
600
+ foreach ( $list as $key => $value ) {
601
+ $list[ $key ] = $value->{$callback_or_field}();
602
+ }
603
+
604
+ return $list;
605
+ }
606
+
607
+ /*
608
+ * When index_key is not set for a particular item, push the value
609
+ * to the end of the stack. This is how array_column() behaves.
610
+ */
611
+ $newlist = array();
612
+ foreach ( $list as $value ) {
613
+ // Get index. @since 1.0.0
614
+ if ( is_callable( array( $value, $index_key ) ) ) {
615
+ $newlist[ $value->{$index_key}() ] = $value->{$callback_or_field}();
616
+ } elseif ( isset( $value->$index_key ) ) {
617
+ $newlist[ $value->$index_key ] = $value->{$callback_or_field}();
618
+ } else {
619
+ $newlist[] = $value->{$callback_or_field}();
620
+ }
621
+ }
622
+
623
+ return $newlist;
624
+ }
625
+
626
+ /**
627
+ * Switch EverestForms to site language.
628
+ *
629
+ * @since 1.0.0
630
+ */
631
+ function evf_switch_to_site_locale() {
632
+ if ( function_exists( 'switch_to_locale' ) ) {
633
+ switch_to_locale( get_locale() );
634
+
635
+ // Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
636
+ add_filter( 'plugin_locale', 'get_locale' );
637
+
638
+ // Init EVF locale.
639
+ EVF()->load_plugin_textdomain();
640
+ }
641
+ }
642
+
643
+ /**
644
+ * Switch EverestForms language to original.
645
+ *
646
+ * @since 1.0.0
647
+ */
648
+ function evf_restore_locale() {
649
+ if ( function_exists( 'restore_previous_locale' ) ) {
650
+ restore_previous_locale();
651
+
652
+ // Remove filter.
653
+ remove_filter( 'plugin_locale', 'get_locale' );
654
+
655
+ // Init EVF locale.
656
+ EVF()->load_plugin_textdomain();
657
+ }
658
+ }
659
+
660
+ /**
661
+ * Get an item of post data if set, otherwise return a default value.
662
+ *
663
+ * @since 1.0.0
664
+ *
665
+ * @param string $key
666
+ * @param string $default
667
+ *
668
+ * @return mixed value sanitized by evf_clean
669
+ */
670
+ function evf_get_post_data_by_key( $key, $default = '' ) {
671
+ return evf_clean( evf_get_var( $_POST[ $key ], $default ) );
672
+ }
673
+
674
+ /**
675
+ * Get data if set, otherwise return a default value or null. Prevents notices when data is not set.
676
+ *
677
+ * @since 1.0.0
678
+ *
679
+ * @param mixed $var
680
+ * @param string $default
681
+ *
682
+ * @return mixed value sanitized by evf_clean
683
+ */
684
+ function evf_get_var( &$var, $default = null ) {
685
+ return isset( $var ) ? $var : $default;
686
+ }
687
+
688
+ /**
689
+ * Delete expired transients.
690
+ *
691
+ * Deletes all expired transients. The multi-table delete syntax is used.
692
+ * to delete the transient record from table a, and the corresponding.
693
+ * transient_timeout record from table b.
694
+ *
695
+ * Based on code inside core's upgrade_network() function.
696
+ *
697
+ * @since 1.0.0
698
+ * @return int Number of transients that were cleared.
699
+ */
700
+ function evf_delete_expired_transients() {
701
+ global $wpdb;
702
+
703
+ $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
704
+ WHERE a.option_name LIKE %s
705
+ AND a.option_name NOT LIKE %s
706
+ AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
707
+ AND b.option_value < %d";
708
+ $rows = $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', time() ) ); // WPCS: unprepared SQL ok.
709
+
710
+ $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
711
+ WHERE a.option_name LIKE %s
712
+ AND a.option_name NOT LIKE %s
713
+ AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
714
+ AND b.option_value < %d";
715
+ $rows2 = $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', time() ) ); // WPCS: unprepared SQL ok.
716
+
717
+ return absint( $rows + $rows2 );
718
+ }
719
+ add_action( 'everest_forms_installed', 'evf_delete_expired_transients' );
720
+
721
+ /**
722
+ * Make a URL relative, if possible.
723
+ *
724
+ * @since 1.0.0
725
+ * @param string $url URL to make relative.
726
+ * @return string
727
+ */
728
+ function evf_get_relative_url( $url ) {
729
+ return evf_is_external_resource( $url ) ? $url : str_replace( array( 'http://', 'https://' ), '//', $url );
730
+ }
731
+
732
+ /**
733
+ * See if a resource is remote.
734
+ *
735
+ * @since 1.0.0
736
+ * @param string $url URL to check.
737
+ * @return bool
738
+ */
739
+ function evf_is_external_resource( $url ) {
740
+ $wp_base = str_replace( array( 'http://', 'https://' ), '//', get_home_url( null, '/', 'http' ) );
741
+ return strstr( $url, '://' ) && strstr( $wp_base, $url );
742
+ }
743
+
744
+ /**
745
+ * See if theme/s is activate or not.
746
+ *
747
+ * @since 1.0.0
748
+ * @param string|array $theme Theme name or array of theme names to check.
749
+ * @return boolean
750
+ */
751
+ function evf_is_active_theme( $theme ) {
752
+ return is_array( $theme ) ? in_array( get_template(), $theme, true ) : get_template() === $theme;
753
+ }
754
+
755
+ /**
756
+ * Cleans up session data - cron callback.
757
+ *
758
+ * @since 1.0.0
759
+ */
760
+ function evf_cleanup_session_data() {
761
+ $session_class = apply_filters( 'everest_forms_session_handler', 'EVF_Session_Handler' );
762
+ $session = new $session_class();
763
+
764
+ if ( is_callable( array( $session, 'cleanup_sessions' ) ) ) {
765
+ $session->cleanup_sessions();
766
+ }
767
+ }
768
+ add_action( 'everest_forms_cleanup_sessions', 'evf_cleanup_session_data' );
769
+
770
+ /**
771
+ * Retrieve actual fields from a form.
772
+ *
773
+ * Non-posting elements such as section divider, page break, and HTML are
774
+ * automatically excluded. Optionally a white list can be provided.
775
+ *
776
+ * @since 1.0.0
777
+ *
778
+ * @param mixed $form
779
+ * @param array $whitelist
780
+ *
781
+ * @return mixed boolean or array
782
+ */
783
+ function evf_get_form_fields( $form = false, $whitelist = array() ) {
784
+
785
+ // Accept form (post) object or form ID
786
+ if ( is_object( $form ) ) {
787
+ $form = json_decode( $form->post_content );
788
+ } elseif ( is_numeric( $form ) ) {
789
+ $form = EVF()->form->get(
790
+ $form,
791
+ array(
792
+ 'content_only' => true,
793
+ )
794
+ );
795
+ }
796
+
797
+ if ( ! is_array( $form ) || empty( $form['fields'] ) ) {
798
+ return false;
799
+ }
800
+
801
+ // White list of field types to allow
802
+ $allowed_form_fields = array(
803
+ 'text',
804
+ 'textarea',
805
+ 'select',
806
+ 'radio',
807
+ 'checkbox',
808
+ 'email',
809
+ 'address',
810
+ 'url',
811
+ 'name',
812
+ 'hidden',
813
+ 'date-time',
814
+ 'phone',
815
+ 'number',
816
+ 'file-upload',
817
+ 'payment-single',
818
+ 'payment-multiple',
819
+ 'payment-select',
820
+ 'payment-total',
821
+ );
822
+ $allowed_form_fields = apply_filters( 'everest_forms_allowed_form_fields', $allowed_form_fields );
823
+
824
+ $whitelist = ! empty( $whitelist ) ? $whitelist : $allowed_form_fields;
825
+
826
+ $form_fields = $form['fields'];
827
+
828
+ foreach ( $form_fields as $id => $form_field ) {
829
+ if ( ! in_array( $form_field['type'], $whitelist, true ) ) {
830
+ unset( $form_fields[ $id ] );
831
+ }
832
+ }
833
+
834
+ return $form_fields;
835
+ }
836
+
837
+ /**
838
+ * @param $string
839
+ *
840
+ * @return string
841
+ */
842
+ function everest_forms_sanitize_textarea_field( $string ) {
843
+
844
+ if ( empty( $string ) || ! is_string( $string ) ) {
845
+ return $string;
846
+ }
847
+
848
+ if ( function_exists( 'sanitize_textarea_field' ) ) {
849
+ $string = sanitize_textarea_field( $string );
850
+ } else {
851
+ $string = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $string ) ) );
852
+ }
853
+
854
+ return $string;
855
+ }
856
+
857
+ /**
858
+ * @param string $id
859
+ * @param array $class
860
+ * @param array $datas
861
+ * @param array $atts
862
+ * @param bool $echo
863
+ *
864
+ * @return string
865
+ */
866
+ function evf_html_attributes( $id = '', $class = array(), $datas = array(), $atts = array(), $echo = false ) {
867
+
868
+ $output = '';
869
+ $id = trim( $id );
870
+
871
+ if ( ! empty( $id ) ) {
872
+ $output = 'id="' . sanitize_html_class( $id ) . '" ';
873
+ }
874
+
875
+ if ( ! empty( $class ) ) {
876
+ $output .= 'class="' . evf_sanitize_classes( $class, true ) . '" ';
877
+ }
878
+
879
+ if ( ! empty( $datas ) ) {
880
+ foreach ( $datas as $data => $val ) {
881
+ $output .= 'data-' . sanitize_html_class( $data ) . '="' . esc_attr( $val ) . '" ';
882
+ }
883
+ }
884
+
885
+ if ( ! empty( $atts ) ) {
886
+ foreach ( $atts as $att => $val ) {
887
+ if ( '0' == $val || ! empty( $val ) ) {
888
+ $output .= sanitize_html_class( $att ) . '="' . esc_attr( $val ) . '" ';
889
+ }
890
+ }
891
+ }
892
+
893
+ if ( $echo ) {
894
+ echo trim( $output );
895
+ } else {
896
+ return trim( $output );
897
+ }
898
+ }
899
+
900
+ /**
901
+ * @param $classes
902
+ * @param bool $convert
903
+ *
904
+ * @return array|string
905
+ */
906
+ function evf_sanitize_classes( $classes, $convert = false ) {
907
+
908
+ $array = is_array( $classes );
909
+ $css = array();
910
+
911
+ if ( ! empty( $classes ) ) {
912
+ if ( ! $array ) {
913
+ $classes = explode( ' ', trim( $classes ) );
914
+ }
915
+ foreach ( $classes as $class ) {
916
+ $css[] = sanitize_html_class( $class );
917
+ }
918
+ }
919
+ if ( $array ) {
920
+ return $convert ? implode( ' ', $css ) : $css;
921
+ } else {
922
+ return $convert ? $css : implode( ' ', $css );
923
+ }
924
+ }
925
+
926
+ /**
927
+ * Performs json_decode and unslash.
928
+ *
929
+ * @since 1.0.0
930
+ *
931
+ * @param string $data
932
+ *
933
+ * @return array|bool
934
+ */
935
+ function evf_decode( $data ) {
936
+
937
+ if ( ! $data || empty( $data ) ) {
938
+ return false;
939
+ }
940
+
941
+ return wp_unslash( json_decode( $data, true ) );
942
+ }
943
+
944
+ /**
945
+ * Performs json_encode and wp_slash.
946
+ *
947
+ * @since 1.0.0
948
+ *
949
+ * @param mixed $data
950
+ *
951
+ * @return string
952
+ */
953
+ function evf_encode( $data = false ) {
954
+
955
+ if ( empty( $data ) ) {
956
+ return false;
957
+ }
958
+
959
+ return wp_slash( wp_json_encode( $data ) );
960
+ }
961
+
962
+ /**
963
+ * @param $min
964
+ * @param $max
965
+ *
966
+ * @return mixed
967
+ */
968
+ function evf_crypto_rand_secure( $min, $max ) {
969
+ $range = $max - $min;
970
+ if ( $range < 1 ) {
971
+ return $min;
972
+ } // not so random...
973
+ $log = ceil( log( $range, 2 ) );
974
+ $bytes = (int) ( $log / 8 ) + 1; // length in bytes
975
+ $bits = (int) $log + 1; // length in bits
976
+ $filter = (int) ( 1 << $bits ) - 1; // set all lower bits to 1
977
+ do {
978
+ $rnd = hexdec( bin2hex( openssl_random_pseudo_bytes( $bytes ) ) );
979
+ $rnd = $rnd & $filter; // discard irrelevant bits
980
+ } while ( $rnd > $range );
981
+
982
+ return $min + $rnd;
983
+ }
984
+
985
+ /**
986
+ * @param int $length
987
+ *
988
+ * @return string
989
+ */
990
+ function evf_get_random_string( $length = 10 ) {
991
+ $string = "";
992
+ $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
993
+ $codeAlphabet .= "abcdefghijklmnopqrstuvwxyz";
994
+ $codeAlphabet .= "0123456789";
995
+ $max = strlen( $codeAlphabet ); // edited
996
+ for ( $i = 0; $i < $length; $i ++ ) {
997
+ $string .= $codeAlphabet[ evf_crypto_rand_secure( 0, $max - 1 ) ];
998
+ }
999
+
1000
+ return $string;
1001
+ }
1002
+
1003
+ function evf_sender_name() {
1004
+ $sender_name = get_option( 'evf_forms_email_from_name', esc_attr( get_bloginfo( 'name', 'display' ) ) );
1005
+ return $sender_name;
1006
+ }
1007
+
1008
+ function evf_sender_address() {
1009
+ $sitename = strtolower( $_SERVER['SERVER_NAME'] );
1010
+ if ( substr( $sitename, 0, 4 ) == 'www.' ) {
1011
+ $sitename = substr( $sitename, 4 );
1012
+ }
1013
+
1014
+ $from_email = 'wordpress@' . $sitename;
1015
+ $sender_email = get_option( 'evf_forms_email_from_address', $from_email );
1016
+
1017
+ return $sender_email;
1018
+ }
1019
+
1020
+ function evf_get_all_forms() {
1021
+
1022
+ $args = array(
1023
+ 'post_type' => 'everest_form',
1024
+ 'status' => 'publish',
1025
+ );
1026
+
1027
+ $posts_array = get_posts( $args );
1028
+
1029
+ foreach ( $posts_array as $post ) {
1030
+
1031
+ $all_forms[ $post->ID ] = $post->post_title;
1032
+ }
1033
+
1034
+ return $all_forms;
1035
+ }
includes/evf-deprecated-functions.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Deprecated Functions
4
+ *
5
+ * Where functions come to die.
6
+ *
7
+ * @package EverestForms\Functions
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Runs a deprecated action with notice only if used.
17
+ *
18
+ * @since 1.0.0
19
+ * @param string $tag The name of the action hook.
20
+ * @param array $args Array of additional function arguments to be passed to do_action().
21
+ * @param string $version The version of UsageMonitor that deprecated the hook.
22
+ * @param string $replacement The hook that should have been used.
23
+ * @param string $message A message regarding the change.
24
+ */
25
+ function evf_do_deprecated_action( $tag, $args, $version, $replacement = null, $message = null ) {
26
+ if ( ! has_action( $tag ) ) {
27
+ return;
28
+ }
29
+
30
+ evf_deprecated_hook( $tag, $version, $replacement, $message );
31
+ do_action_ref_array( $tag, $args );
32
+ }
33
+
34
+ /**
35
+ * Wrapper for deprecated functions so we can apply some extra logic.
36
+ *
37
+ * @since 1.0.0
38
+ * @param string $function Function used.
39
+ * @param string $version Version the message was added in.
40
+ * @param string $replacement Replacement for the called function.
41
+ */
42
+ function evf_deprecated_function( $function, $version, $replacement = null ) {
43
+ // @codingStandardsIgnoreStart
44
+ if ( is_ajax() ) {
45
+ do_action( 'deprecated_function_run', $function, $replacement, $version );
46
+ $log_string = "The {$function} function is deprecated since version {$version}.";
47
+ $log_string .= $replacement ? " Replace with {$replacement}." : '';
48
+ error_log( $log_string );
49
+ } else {
50
+ _deprecated_function( $function, $version, $replacement );
51
+ }
52
+ // @codingStandardsIgnoreEnd
53
+ }
54
+
55
+ /**
56
+ * Wrapper for deprecated hook so we can apply some extra logic.
57
+ *
58
+ * @since 1.0.0
59
+ * @param string $hook The hook that was used.
60
+ * @param string $version The version of WordPress that deprecated the hook.
61
+ * @param string $replacement The hook that should have been used.
62
+ * @param string $message A message regarding the change.
63
+ */
64
+ function evf_deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
65
+ // @codingStandardsIgnoreStart
66
+ if ( is_ajax() ) {
67
+ do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
68
+
69
+ $message = empty( $message ) ? '' : ' ' . $message;
70
+ $log_string = "{$hook} is deprecated since version {$version}";
71
+ $log_string .= $replacement ? "! Use {$replacement} instead." : ' with no alternative available.';
72
+
73
+ error_log( $log_string . $message );
74
+ } else {
75
+ _deprecated_hook( $hook, $version, $replacement, $message );
76
+ }
77
+ // @codingStandardsIgnoreEnd
78
+ }
79
+
80
+ /**
81
+ * When catching an exception, this allows us to log it if unexpected.
82
+ *
83
+ * @since 1.0.0
84
+ * @param Exception $exception_object The exception object.
85
+ * @param string $function The function which threw exception.
86
+ * @param array $args The args passed to the function.
87
+ */
88
+ function evf_caught_exception( $exception_object, $function = '', $args = array() ) {
89
+ // @codingStandardsIgnoreStart
90
+ $message = $exception_object->getMessage();
91
+ $message .= '. Args: ' . print_r( $args, true ) . '.';
92
+
93
+ do_action( 'usagemonitor_caught_exception', $exception_object, $function, $args );
94
+ error_log( "Exception caught in {$function}. {$message}." );
95
+ // @codingStandardsIgnoreEnd
96
+ }
97
+
98
+ /**
99
+ * Wrapper for evf_doing_it_wrong.
100
+ *
101
+ * @since 1.0.0
102
+ * @param string $function Function used.
103
+ * @param string $message Message to log.
104
+ * @param string $version Version the message was added in.
105
+ */
106
+ function evf_doing_it_wrong( $function, $message, $version ) {
107
+ // @codingStandardsIgnoreStart
108
+ $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
109
+
110
+ if ( is_ajax() ) {
111
+ do_action( 'doing_it_wrong_run', $function, $message, $version );
112
+ error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
113
+ } else {
114
+ _doing_it_wrong( $function, $message, $version );
115
+ }
116
+ // @codingStandardsIgnoreEnd
117
+ }
118
+
119
+ /**
120
+ * Wrapper for deprecated arguments so we can apply some extra logic.
121
+ *
122
+ * @since 1.0.0
123
+ * @param string $argument Argument used.
124
+ * @param string $version Version the message was added in.
125
+ * @param string $message A message regarding the change.
126
+ */
127
+ function evf_deprecated_argument( $argument, $version, $message = null ) {
128
+ // @codingStandardsIgnoreStart
129
+ if ( is_ajax() ) {
130
+ do_action( 'deprecated_argument_run', $argument, $message, $version );
131
+ error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
132
+ } else {
133
+ _deprecated_argument( $argument, $version, $message );
134
+ }
135
+ // @codingStandardsIgnoreEnd
136
+ }
includes/evf-formatting-functions.php ADDED
@@ -0,0 +1,515 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Formatting
4
+ *
5
+ * Functions for formatting data.
6
+ *
7
+ * @author WPEverest
8
+ * @category Core
9
+ * @package WPEverest/Functions
10
+ * @version 1.0.0
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit; // Exit if accessed directly
15
+ }
16
+
17
+ /**
18
+ * Converts a string (e.g. yes or no) to a bool.
19
+ * @since 1.0.0
20
+ * @param string $string
21
+ * @return bool
22
+ */
23
+ function evf_string_to_bool( $string ) {
24
+ return is_bool( $string ) ? $string : ( 'yes' === $string || 1 === $string || 'true' === $string || '1' === $string );
25
+ }
26
+
27
+ /**
28
+ * Converts a bool to a string.
29
+ * @since 1.0.0
30
+ * @param bool $bool
31
+ * @return string yes or no
32
+ */
33
+ function evf_bool_to_string( $bool ) {
34
+ if ( ! is_bool( $bool ) ) {
35
+ $bool = evf_string_to_bool( $bool );
36
+ }
37
+ return true === $bool ? 'yes' : 'no';
38
+ }
39
+
40
+ /**
41
+ * Explode a string into an array by $delimiter and remove empty values.
42
+ * @since 1.0.0
43
+ * @param string $string
44
+ * @param string $delimiter
45
+ * @return array
46
+ */
47
+ function evf_string_to_array( $string, $delimiter = ',' ) {
48
+ return is_array( $string ) ? $string : array_filter( explode( $delimiter, $string ) );
49
+ }
50
+
51
+ /**
52
+ * Sanitize taxonomy names. Slug format (no spaces, lowercase).
53
+ *
54
+ * urldecode is used to reverse munging of UTF8 characters.
55
+ *
56
+ * @param mixed $taxonomy
57
+ * @return string
58
+ */
59
+ function evf_sanitize_taxonomy_name( $taxonomy ) {
60
+ return apply_filters( 'sanitize_taxonomy_name', urldecode( sanitize_title( urldecode( $taxonomy ) ) ), $taxonomy );
61
+ }
62
+
63
+ /**
64
+ * Sanitize permalink values before insertion into DB.
65
+ *
66
+ * Cannot use evf_clean because it sometimes strips % chars and breaks the user's setting.
67
+ *
68
+ * @since 1.0.0
69
+ * @param string $value
70
+ * @return string
71
+ */
72
+ function evf_sanitize_permalink( $value ) {
73
+ global $wpdb;
74
+
75
+ $value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
76
+
77
+ if ( is_wp_error( $value ) ) {
78
+ $value = '';
79
+ }
80
+
81
+ $value = esc_url_raw( $value );
82
+ $value = str_replace( 'http://', '', $value );
83
+ return untrailingslashit( $value );
84
+ }
85
+
86
+ /**
87
+ * Gets the filename part of a download URL.
88
+ *
89
+ * @param string $file_url
90
+ * @return string
91
+ */
92
+ function evf_get_filename_from_url( $file_url ) {
93
+ $parts = parse_url( $file_url );
94
+ if ( isset( $parts['path'] ) ) {
95
+ return basename( $parts['path'] );
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Clean variables using sanitize_text_field. Arrays are cleaned recursively.
101
+ * Non-scalar values are ignored.
102
+ * @param string|array $var
103
+ * @return string|array
104
+ */
105
+ function evf_clean( $var ) {
106
+ if ( is_array( $var ) ) {
107
+ return array_map( 'evf_clean', $var );
108
+ } else {
109
+ return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Run evf_clean over posted textarea but maintain line breaks.
115
+ * @since 1.0.0
116
+ * @param string $var
117
+ * @return string
118
+ */
119
+ function evf_sanitize_textarea( $var ) {
120
+ return implode( "\n", array_map( 'evf_clean', explode( "\n", $var ) ) );
121
+ }
122
+
123
+ /**
124
+ * Sanitize a string destined to be a tooltip.
125
+ *
126
+ * @param string $var
127
+ * @return string
128
+ */
129
+ function evf_sanitize_tooltip( $var ) {
130
+ return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
131
+ 'br' => array(),
132
+ 'em' => array(),
133
+ 'strong' => array(),
134
+ 'small' => array(),
135
+ 'span' => array(),
136
+ 'ul' => array(),
137
+ 'li' => array(),
138
+ 'ol' => array(),
139
+ 'p' => array(),
140
+ ) ) );
141
+ }
142
+
143
+ function evf_sanitize_array_combine( $array ) {
144
+ if ( empty( $array ) || ! is_array( $array ) ) {
145
+ return $array;
146
+ }
147
+
148
+ return implode( "\n", array_map( 'sanitize_text_field', $array ) );
149
+ }
150
+
151
+ /**
152
+ * Merge two arrays.
153
+ *
154
+ * @param array $a1
155
+ * @param array $a2
156
+ * @return array
157
+ */
158
+ function evf_array_overlay( $a1, $a2 ) {
159
+ foreach ( $a1 as $k => $v ) {
160
+ if ( ! array_key_exists( $k, $a2 ) ) {
161
+ continue;
162
+ }
163
+ if ( is_array( $v ) && is_array( $a2[ $k ] ) ) {
164
+ $a1[ $k ] = evf_array_overlay( $v, $a2[ $k ] );
165
+ } else {
166
+ $a1[ $k ] = $a2[ $k ];
167
+ }
168
+ }
169
+ return $a1;
170
+ }
171
+
172
+ /**
173
+ * let_to_num function.
174
+ *
175
+ * This function transforms the php.ini notation for numbers (like '2M') to an integer.
176
+ *
177
+ * @param $size
178
+ * @return int
179
+ */
180
+ function evf_let_to_num( $size ) {
181
+ $l = substr( $size, -1 );
182
+ $ret = substr( $size, 0, -1 );
183
+ switch ( strtoupper( $l ) ) {
184
+ case 'P':
185
+ $ret *= 1024;
186
+ case 'T':
187
+ $ret *= 1024;
188
+ case 'G':
189
+ $ret *= 1024;
190
+ case 'M':
191
+ $ret *= 1024;
192
+ case 'K':
193
+ $ret *= 1024;
194
+ }
195
+ return $ret;
196
+ }
197
+
198
+ /**
199
+ * EverestForms Date Format - Allows to change date format for everything EverestForms.
200
+ *
201
+ * @return string
202
+ */
203
+ function evf_date_format() {
204
+ return apply_filters( 'everest_forms_date_format', get_option( 'date_format' ) );
205
+ }
206
+
207
+ /**
208
+ * EverestForms Time Format - Allows to change time format for everything EverestForms.
209
+ *
210
+ * @return string
211
+ */
212
+ function evf_time_format() {
213
+ return apply_filters( 'everest_forms_time_format', get_option( 'time_format' ) );
214
+ }
215
+
216
+ /**
217
+ * Convert mysql datetime to PHP timestamp, forcing UTC. Wrapper for strtotime.
218
+ *
219
+ * @since 1.0.0
220
+ *
221
+ * @param string $time_string
222
+ * @param int|null $from_timestamp
223
+ *
224
+ * @return int
225
+ */
226
+ function evf_string_to_timestamp( $time_string, $from_timestamp = null ) {
227
+ $original_timezone = date_default_timezone_get();
228
+
229
+ // @codingStandardsIgnoreStart
230
+ date_default_timezone_set( 'UTC' );
231
+
232
+ if ( null === $from_timestamp ) {
233
+ $next_timestamp = strtotime( $time_string );
234
+ } else {
235
+ $next_timestamp = strtotime( $time_string, $from_timestamp );
236
+ }
237
+
238
+ date_default_timezone_set( $original_timezone );
239
+ // @codingStandardsIgnoreEnd
240
+
241
+ return $next_timestamp;
242
+ }
243
+
244
+ /**
245
+ * Callback which can flatten post meta (gets the first value if it's an array).
246
+ *
247
+ * @since 1.0.0
248
+ * @param array $value
249
+ * @return mixed
250
+ */
251
+ function evf_flatten_meta_callback( $value ) {
252
+ return is_array( $value ) ? current( $value ) : $value;
253
+ }
254
+
255
+ if ( ! function_exists( 'evf_rgb_from_hex' ) ) {
256
+
257
+ /**
258
+ * Hex darker/lighter/contrast functions for colors.
259
+ *
260
+ * @param mixed $color
261
+ *
262
+ * @return array
263
+ */
264
+ function evf_rgb_from_hex( $color ) {
265
+ $color = str_replace( '#', '', $color );
266
+ // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
267
+ $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
268
+
269
+ $rgb = array();
270
+ $rgb['R'] = hexdec( $color{0} . $color{1} );
271
+ $rgb['G'] = hexdec( $color{2} . $color{3} );
272
+ $rgb['B'] = hexdec( $color{4} . $color{5} );
273
+
274
+ return $rgb;
275
+ }
276
+ }
277
+
278
+ if ( ! function_exists( 'evf_hex_darker' ) ) {
279
+
280
+ /**
281
+ * Hex darker/lighter/contrast functions for colors.
282
+ *
283
+ * @param mixed $color
284
+ * @param int $factor (default: 30)
285
+ * @return string
286
+ */
287
+ function evf_hex_darker( $color, $factor = 30 ) {
288
+ $base = evf_rgb_from_hex( $color );
289
+ $color = '#';
290
+
291
+ foreach ( $base as $k => $v ) {
292
+ $amount = $v / 100;
293
+ $amount = round( $amount * $factor );
294
+ $new_decimal = $v - $amount;
295
+
296
+ $new_hex_component = dechex( $new_decimal );
297
+ if ( strlen( $new_hex_component ) < 2 ) {
298
+ $new_hex_component = "0" . $new_hex_component;
299
+ }
300
+ $color .= $new_hex_component;
301
+ }
302
+
303
+ return $color;
304
+ }
305
+ }
306
+
307
+ if ( ! function_exists( 'evf_hex_lighter' ) ) {
308
+
309
+ /**
310
+ * Hex darker/lighter/contrast functions for colors.
311
+ *
312
+ * @param mixed $color
313
+ * @param int $factor (default: 30)
314
+ * @return string
315
+ */
316
+ function evf_hex_lighter( $color, $factor = 30 ) {
317
+ $base = evf_rgb_from_hex( $color );
318
+ $color = '#';
319
+
320
+ foreach ( $base as $k => $v ) {
321
+ $amount = 255 - $v;
322
+ $amount = $amount / 100;
323
+ $amount = round( $amount * $factor );
324
+ $new_decimal = $v + $amount;
325
+
326
+ $new_hex_component = dechex( $new_decimal );
327
+ if ( strlen( $new_hex_component ) < 2 ) {
328
+ $new_hex_component = "0" . $new_hex_component;
329
+ }
330
+ $color .= $new_hex_component;
331
+ }
332
+
333
+ return $color;
334
+ }
335
+ }
336
+
337
+ if ( ! function_exists( 'evf_light_or_dark' ) ) {
338
+
339
+ /**
340
+ * Detect if we should use a light or dark color on a background color.
341
+ *
342
+ * @param mixed $color
343
+ * @param string $dark (default: '#000000')
344
+ * @param string $light (default: '#FFFFFF')
345
+ * @return string
346
+ */
347
+ function evf_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
348
+
349
+ $hex = str_replace( '#', '', $color );
350
+
351
+ $c_r = hexdec( substr( $hex, 0, 2 ) );
352
+ $c_g = hexdec( substr( $hex, 2, 2 ) );
353
+ $c_b = hexdec( substr( $hex, 4, 2 ) );
354
+
355
+ $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
356
+
357
+ return $brightness > 155 ? $dark : $light;
358
+ }
359
+ }
360
+
361
+ if ( ! function_exists( 'evf_format_hex' ) ) {
362
+
363
+ /**
364
+ * Format string as hex.
365
+ *
366
+ * @param string $hex
367
+ * @return string
368
+ */
369
+ function evf_format_hex( $hex ) {
370
+
371
+ $hex = trim( str_replace( '#', '', $hex ) );
372
+
373
+ if ( strlen( $hex ) == 3 ) {
374
+ $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
375
+ }
376
+
377
+ return $hex ? '#' . $hex : null;
378
+ }
379
+ }
380
+
381
+ /**
382
+ * Format phone numbers.
383
+ *
384
+ * @param string $phone Phone number.
385
+ * @return string
386
+ */
387
+ function evf_format_phone_number( $phone ) {
388
+ return str_replace( '.', '-', $phone );
389
+ }
390
+
391
+ /**
392
+ * Wrapper for mb_strtoupper which see's if supported first.
393
+ *
394
+ * @since 1.0.0
395
+ * @param string $string
396
+ * @return string
397
+ */
398
+ function evf_strtoupper( $string ) {
399
+ return function_exists( 'mb_strtoupper' ) ? mb_strtoupper( $string ) : strtoupper( $string );
400
+ }
401
+
402
+ /**
403
+ * Make a string lowercase.
404
+ * Try to use mb_strtolower() when available.
405
+ *
406
+ * @since 1.0.0
407
+ * @param string $string
408
+ * @return string
409
+ */
410
+ function evf_strtolower( $string ) {
411
+ return function_exists( 'mb_strtolower' ) ? mb_strtolower( $string ) : strtolower( $string );
412
+ }
413
+
414
+ /**
415
+ * Trim a string and append a suffix.
416
+ * @param string $string
417
+ * @param integer $chars
418
+ * @param string $suffix
419
+ * @return string
420
+ */
421
+ function evf_trim_string( $string, $chars = 200, $suffix = '...' ) {
422
+ if ( strlen( $string ) > $chars ) {
423
+ if ( function_exists( 'mb_substr' ) ) {
424
+ $string = mb_substr( $string, 0, ( $chars - mb_strlen( $suffix ) ) ) . $suffix;
425
+ } else {
426
+ $string = substr( $string, 0, ( $chars - strlen( $suffix ) ) ) . $suffix;
427
+ }
428
+ }
429
+ return $string;
430
+ }
431
+
432
+ /**
433
+ * Format content to display shortcodes.
434
+ *
435
+ * @since 1.0.0
436
+ * @param string $raw_string
437
+ * @return string
438
+ */
439
+ function evf_format_content( $raw_string ) {
440
+ return apply_filters( 'everest_forms_format_content', apply_filters( 'everest_forms_short_description', $raw_string ), $raw_string );
441
+ }
442
+
443
+ /**
444
+ * Process oEmbeds.
445
+ *
446
+ * @since 1.0.0
447
+ * @param string $content
448
+ * @return string
449
+ */
450
+ function evf_do_oembeds( $content ) {
451
+ global $wp_embed;
452
+
453
+ $content = $wp_embed->autoembed( $content );
454
+
455
+ return $content;
456
+ }
457
+
458
+ /**
459
+ * Array merge and sum function.
460
+ *
461
+ * Source: https://gist.github.com/Nickology/f700e319cbafab5eaedc
462
+ *
463
+ * @since 1.0.0
464
+ * @return array
465
+ */
466
+ function evf_array_merge_recursive_numeric() {
467
+ $arrays = func_get_args();
468
+
469
+ // If there's only one array, it's already merged.
470
+ if ( 1 === count( $arrays ) ) {
471
+ return $arrays[0];
472
+ }
473
+
474
+ // Remove any items in $arrays that are NOT arrays.
475
+ foreach ( $arrays as $key => $array ) {
476
+ if ( ! is_array( $array ) ) {
477
+ unset( $arrays[ $key ] );
478
+ }
479
+ }
480
+
481
+ // We start by setting the first array as our final array.
482
+ // We will merge all other arrays with this one.
483
+ $final = array_shift( $arrays );
484
+
485
+ foreach ( $arrays as $b ) {
486
+ foreach ( $final as $key => $value ) {
487
+ // If $key does not exist in $b, then it is unique and can be safely merged.
488
+ if ( ! isset( $b[ $key ] ) ) {
489
+ $final[ $key ] = $value;
490
+ } else {
491
+ // If $key is present in $b, then we need to merge and sum numeric values in both.
492
+ if ( is_numeric( $value ) && is_numeric( $b[ $key ] ) ) {
493
+ // If both values for these keys are numeric, we sum them.
494
+ $final[ $key ] = $value + $b[ $key ];
495
+ } elseif ( is_array( $value ) && is_array( $b[ $key ] ) ) {
496
+ // If both values are arrays, we recursively call ourself.
497
+ $final[ $key ] = evf_array_merge_recursive_numeric( $value, $b[ $key ] );
498
+ } else {
499
+ // If both keys exist but differ in type, then we cannot merge them.
500
+ // In this scenario, we will $b's value for $key is used.
501
+ $final[ $key ] = $b[ $key ];
502
+ }
503
+ }
504
+ }
505
+
506
+ // Finally, we need to merge any keys that exist only in $b.
507
+ foreach ( $b as $key => $value ) {
508
+ if ( ! isset( $final[ $key ] ) ) {
509
+ $final[ $key ] = $value;
510
+ }
511
+ }
512
+ }
513
+
514
+ return $final;
515
+ }
includes/evf-notice-functions.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Everest Forms Message Functions
4
+ *
5
+ * Functions for error/message handling and display.
6
+ *
7
+ * @package EverestForms/Functions
8
+ * @version 1.0.0
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Get the count of notices added, either for all notices (default) or for one.
17
+ * particular notice type specified by $notice_type.
18
+ *
19
+ * @since 1.0.0
20
+ * @param string $notice_type Optional. The name of the notice type - either error, success or notice.
21
+ * @return int
22
+ */
23
+ function evf_notice_count( $notice_type = '' ) {
24
+ if ( ! did_action( 'everest_forms_init' ) ) {
25
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
26
+ return;
27
+ }
28
+
29
+ $notice_count = 0;
30
+ $all_notices = EVF()->session->get( 'evf_notices', array() );
31
+
32
+ if ( isset( $all_notices[ $notice_type ] ) ) {
33
+
34
+ $notice_count = count( $all_notices[ $notice_type ] );
35
+
36
+ } elseif ( empty( $notice_type ) ) {
37
+
38
+ foreach ( $all_notices as $notices ) {
39
+ $notice_count += count( $notices );
40
+ }
41
+ }
42
+
43
+ return $notice_count;
44
+ }
45
+
46
+ /**
47
+ * Check if a notice has already been added.
48
+ *
49
+ * @since 1.0.0
50
+ * @param string $message The text to display in the notice.
51
+ * @param string $notice_type Optional. The name of the notice type - either error, success or notice.
52
+ * @return bool
53
+ */
54
+ function evf_has_notice( $message, $notice_type = 'success' ) {
55
+ if ( ! did_action( 'everest_forms_init' ) ) {
56
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
57
+ return false;
58
+ }
59
+
60
+ $notices = EVF()->session->get( 'evf_notices', array() );
61
+ $notices = isset( $notices[ $notice_type ] ) ? $notices[ $notice_type ] : array();
62
+ return array_search( $message, $notices, true ) !== false;
63
+ }
64
+
65
+ /**
66
+ * Add and store a notice.
67
+ *
68
+ * @since 1.0.0
69
+ * @param string $message The text to display in the notice.
70
+ * @param string $notice_type Optional. The name of the notice type - either error, success or notice.
71
+ */
72
+ function evf_add_notice( $message, $notice_type = 'success' ) {
73
+ if ( ! did_action( 'everest_forms_init' ) ) {
74
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
75
+ return;
76
+ }
77
+
78
+ $notices = EVF()->session->get( 'evf_notices', array() );
79
+
80
+ // Backward compatibility.
81
+ if ( 'success' === $notice_type ) {
82
+ $message = apply_filters( 'everest_forms_add_message', $message );
83
+ }
84
+
85
+ $notices[ $notice_type ][] = apply_filters( 'everest_forms_add_' . $notice_type, $message );
86
+
87
+ EVF()->session->set( 'evf_notices', $notices );
88
+ }
89
+
90
+ /**
91
+ * Set all notices at once.
92
+ *
93
+ * @since 1.0.0
94
+ * @param mixed $notices Array of notices.
95
+ */
96
+ function evf_set_notices( $notices ) {
97
+ if ( ! did_action( 'everest_forms_init' ) ) {
98
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
99
+ return;
100
+ }
101
+ EVF()->session->set( 'evf_notices', $notices );
102
+ }
103
+
104
+ /**
105
+ * Unset all notices.
106
+ *
107
+ * @since 1.0.0
108
+ */
109
+ function evf_clear_notices() {
110
+ if ( ! did_action( 'everest_forms_init' ) ) {
111
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
112
+ return;
113
+ }
114
+ EVF()->session->set( 'evf_notices', null );
115
+ }
116
+
117
+ /**
118
+ * Prints messages and errors which are stored in the session, then clears them.
119
+ *
120
+ * @since 1.0.0
121
+ */
122
+ function evf_print_notices() {
123
+ if ( ! did_action( 'everest_forms_init' ) ) {
124
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
125
+ return;
126
+ }
127
+
128
+ $all_notices = EVF()->session->get( 'evf_notices', array() );
129
+ $notice_types = apply_filters( 'everest_forms_notice_types', array( 'error', 'success', 'notice' ) );
130
+
131
+ foreach ( $notice_types as $notice_type ) {
132
+ if ( evf_notice_count( $notice_type ) > 0 ) {
133
+ evf_get_template( "notices/{$notice_type}.php", array(
134
+ 'messages' => array_filter( $all_notices[ $notice_type ] ),
135
+ ) );
136
+ }
137
+ }
138
+
139
+ evf_clear_notices();
140
+ }
141
+ add_action( 'evf_display_fields_before', 'evf_print_notices', 10 );
142
+
143
+ /**
144
+ * Print a single notice immediately.
145
+ *
146
+ * @since 1.0.0
147
+ * @param string $message The text to display in the notice.
148
+ * @param string $notice_type Optional. The name of the notice type - either error, success or notice.
149
+ */
150
+ function evf_print_notice( $message, $notice_type = 'success' ) {
151
+ if ( 'success' === $notice_type ) {
152
+ $message = apply_filters( 'everest_forms_add_message', $message );
153
+ }
154
+
155
+ evf_get_template( "notices/{$notice_type}.php", array(
156
+ 'messages' => array( apply_filters( 'everest_forms_add_' . $notice_type, $message ) ),
157
+ ) );
158
+ }
159
+
160
+ /**
161
+ * Returns all queued notices, optionally filtered by a notice type.
162
+ *
163
+ * @since 1.0.0
164
+ * @param string $notice_type Optional. The name of the notice type - either error, success or notice.
165
+ * @return array|mixed
166
+ */
167
+ function evf_get_notices( $notice_type = '' ) {
168
+ if ( ! did_action( 'everest_forms_init' ) ) {
169
+ evf_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before everest_forms_init.', 'everest-forms' ), '1.0' );
170
+ return;
171
+ }
172
+
173
+ $all_notices = EVF()->session->get( 'evf_notices', array() );
174
+
175
+ if ( empty( $notice_type ) ) {
176
+ $notices = $all_notices;
177
+ } elseif ( isset( $all_notices[ $notice_type ] ) ) {
178
+ $notices = $all_notices[ $notice_type ];
179
+ } else {
180
+ $notices = array();
181
+ }
182
+
183
+ return $notices;
184
+ }
185
+
186
+ /**
187
+ * Add notices for WP Errors.
188
+ *
189
+ * @param WP_Error $errors Errors.
190
+ */
191
+ function evf_add_wp_error_notices( $errors ) {
192
+ if ( is_wp_error( $errors ) && $errors->get_error_messages() ) {
193
+ foreach ( $errors->get_error_messages() as $error ) {
194
+ evf_add_notice( $error, 'error' );
195
+ }
196
+ }
197
+ }
includes/evf-template-functions.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Template
4
+ *
5
+ * Functions for the templating system.
6
+ *
7
+ * @author WPEveresst
8
+ * @category Core
9
+ * @package EverestForms/Functions
10
+ * @version 1.0.0
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit; // Exit if accessed directly
15
+ }
16
+
17
+ /**
18
+ * Handle redirects before content is output - hooked into template_redirect so is_page works.
19
+ */
20
+ function evf_template_redirect() {
21
+ global $wp_query, $wp;
22
+
23
+
24
+ }
25
+
26
+ add_action( 'template_redirect', 'evf_template_redirect' );
27
+
28
+ /**
29
+ * Output generator tag to aid debugging.
30
+ *
31
+ * @access public
32
+ *
33
+ * @param string $gen
34
+ * @param string $type
35
+ *
36
+ * @return string
37
+ */
38
+ function evf_generator_tag( $gen, $type ) {
39
+ switch ( $type ) {
40
+ case 'html':
41
+ $gen .= "\n" . '<meta name="generator" content="EverestForms ' . esc_attr( EVF_VERSION ) . '">';
42
+ break;
43
+ case 'xhtml':
44
+ $gen .= "\n" . '<meta name="generator" content="EverestForms ' . esc_attr( EVF_VERSION ) . '" />';
45
+ break;
46
+ }
47
+
48
+ return $gen;
49
+ }
50
+
51
+ /**
52
+ * Add body classes for EVF pages.
53
+ *
54
+ * @param array $classes
55
+ *
56
+ * @return array
57
+ */
58
+ function evf_body_class( $classes ) {
59
+ $classes = (array) $classes;
60
+
61
+ return array_unique( $classes );
62
+ }
63
+
64
+
65
+ /**
66
+ * Outputs hidden form inputs for each query string variable.
67
+ * @since 1.0.0
68
+ *
69
+ * @param array $values Name value pairs.
70
+ * @param array $exclude Keys to exclude.
71
+ * @param string $current_key Current key we are outputting.
72
+ * @param bool $return
73
+ *
74
+ * @return string
75
+ */
76
+ function evf_query_string_form_fields( $values = null, $exclude = array(), $current_key = '', $return = false ) {
77
+ if ( is_null( $values ) ) {
78
+ $values = $_GET;
79
+ }
80
+ $html = '';
81
+
82
+ foreach ( $values as $key => $value ) {
83
+ if ( in_array( $key, $exclude, true ) ) {
84
+ continue;
85
+ }
86
+ if ( $current_key ) {
87
+ $key = $current_key . '[' . $key . ']';
88
+ }
89
+ if ( is_array( $value ) ) {
90
+ $html .= evf_query_string_form_fields( $value, $exclude, $key, true );
91
+ } else {
92
+ $html .= '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '" />';
93
+ }
94
+ }
95
+
96
+ if ( $return ) {
97
+ return $html;
98
+ } else {
99
+ echo $html;
100
+ }
101
+ }
includes/evf-user-functions.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms User Functions
4
+ *
5
+ * Functions for users.
6
+ *
7
+ * @author WPEverest
8
+ * @category Core
9
+ * @package EverestForms/Functions
10
+ * @version 1.0.0
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit; // Exit if accessed directly
15
+ }
includes/form-fields/class-evf-field-checkbox.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+
7
+ /**
8
+ * checkbox
9
+ *
10
+ * @package EverestForms
11
+ * @author WPEverest
12
+ * @since 1.0.0
13
+ */
14
+ class EVF_Field_Checkbox extends EVF_Form_Fields {
15
+
16
+ /**
17
+ * Primary class constructor.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ public function init() {
22
+
23
+ // Define field type information
24
+ $this->name = __( 'Checkboxes', 'everest-forms' );
25
+ $this->type = 'checkbox';
26
+ $this->icon = 'evf-icon evf-icon-checkbox';
27
+ $this->order = 13;
28
+ $this->group = 'advanced';
29
+ $this->defaults = array(
30
+ 1 => array(
31
+ 'label' => __( 'First Choice', 'everest-forms' ),
32
+ 'value' => '',
33
+ 'default' => '',
34
+ ),
35
+ 2 => array(
36
+ 'label' => __( 'Second Choice', 'everest-forms' ),
37
+ 'value' => '',
38
+ 'default' => '',
39
+ ),
40
+ 3 => array(
41
+ 'label' => __( 'Third Choice', 'everest-forms' ),
42
+ 'value' => '',
43
+ 'default' => '',
44
+ ),
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Field options panel inside the builder.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @param array $field
54
+ */
55
+ public function field_options( $field ) {
56
+
57
+ // --------------------------------------------------------------------//
58
+ // Basic field options
59
+ // --------------------------------------------------------------------//
60
+
61
+ // Options open markup
62
+ $this->field_option( 'basic-options', $field, array(
63
+ 'markup' => 'open',
64
+ ) );
65
+
66
+ // Label
67
+ $this->field_option( 'label', $field );
68
+
69
+ // Choices
70
+ $this->field_option( 'choices', $field );
71
+
72
+ // Description
73
+ $this->field_option( 'description', $field );
74
+
75
+ // Required toggle
76
+ $this->field_option( 'required', $field );
77
+
78
+ // Options close markup
79
+ $this->field_option( 'basic-options', $field, array(
80
+ 'markup' => 'close',
81
+ ) );
82
+
83
+ // --------------------------------------------------------------------//
84
+ // Advanced field options
85
+ // --------------------------------------------------------------------//
86
+
87
+ // Options open markup
88
+ $this->field_option( 'advanced-options', $field, array(
89
+ 'markup' => 'open',
90
+ ) );
91
+
92
+ // Show Values toggle option. This option will only show if already used
93
+ // or if manually enabled by a filter.
94
+ if ( ! empty( $field['show_values'] ) || apply_filters( 'everest_forms_fields_show_options_setting', false ) ) {
95
+ $show_values = $this->field_element(
96
+ 'checkbox',
97
+ $field,
98
+ array(
99
+ 'slug' => 'show_values',
100
+ 'value' => isset( $field['show_values'] ) ? $field['show_values'] : '0',
101
+ 'desc' => __( 'Show Values', 'everest-forms' ),
102
+ 'tooltip' => __( 'Check this to manually set form field values.', 'everest-forms' ),
103
+ ),
104
+ false
105
+ );
106
+ $this->field_element( 'row', $field, array(
107
+ 'slug' => 'show_values',
108
+ 'content' => $show_values,
109
+ ) );
110
+ }
111
+
112
+ // Input columns
113
+ $this->field_option( 'input_columns', $field );
114
+
115
+ // Hide label
116
+ $this->field_option( 'label_hide', $field );
117
+
118
+ // Custom CSS classes
119
+ $this->field_option( 'css', $field );
120
+
121
+ // Options close markup
122
+ $this->field_option( 'advanced-options', $field, array(
123
+ 'markup' => 'close',
124
+ ) );
125
+ }
126
+
127
+ /**
128
+ * Field preview inside the builder.
129
+ *
130
+ * @since 1.0.0
131
+ *
132
+ * @param array $field
133
+ */
134
+ public function field_preview( $field ) {
135
+
136
+ $values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
137
+ $dynamic = ! empty( $field['dynamic_choices'] ) ? $field['dynamic_choices'] : false;
138
+
139
+ // Label
140
+ $this->field_preview_option( 'label', $field );
141
+
142
+ // Field checkbox elements
143
+ echo '<ul class="primary-input">';
144
+
145
+ // Notify if currently empty
146
+ if ( empty( $values ) ) {
147
+ $values = array(
148
+ 'label' => __( '(empty)', 'everest-forms' ),
149
+ );
150
+ }
151
+
152
+ // Individual checkbox options
153
+ foreach ( $values as $key => $value ) {
154
+
155
+ $default = isset( $value['default'] ) ? $value['default'] : '';
156
+ $selected = checked( '1', $default, false );
157
+
158
+ printf( '<li><input type="checkbox" %s disabled>%s</li>', $selected, $value['label'] );
159
+ }
160
+
161
+ echo '</ul>';
162
+
163
+ // Dynamic population is enabled and contains more than 20 items
164
+ if ( isset( $total ) && $total > 20 ) {
165
+ echo '<div class="everest-forms-alert-dynamic everest-forms-alert everest-forms-alert-warning">';
166
+ printf( __( 'Showing the first 20 choices.<br> All %d choices will be displayed when viewing the form.', 'everest-forms' ), absint( $total ) );
167
+ echo '</div>';
168
+ }
169
+
170
+ // Description
171
+ $this->field_preview_option( 'description', $field );
172
+ }
173
+
174
+ /**
175
+ * Field display on the form front-end.
176
+ *
177
+ * @since 1.0.0
178
+ *
179
+ * @param array $field
180
+ * @param array $field_atts
181
+ * @param array $form_data
182
+ */
183
+ public function field_display( $field, $field_atts, $form_data ) {
184
+
185
+ // Setup and sanitize the necessary data
186
+ $field = apply_filters( 'everest_forms_checkbox_field_display', $field, $field_atts, $form_data );
187
+ $field_required = ! empty( $field['required'] ) ? ' required' : '';
188
+ $field_class = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_class'] ) );
189
+ $field_id = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_id'] ) );
190
+ $field_data = '';
191
+ $form_id = $form_data['id'];
192
+ $choices = isset( $field['choices'] ) ? $field['choices'] : array();
193
+ if ( ! empty( $field_atts['input_data'] ) ) {
194
+ foreach ( $field_atts['input_data'] as $key => $val ) {
195
+ $field_data .= ' data-' . $key . '="' . $val . '"';
196
+ }
197
+ }
198
+ // List.
199
+ printf( '<ul id="%s" class="%s" %s>', $field_id, $field_class, $field_data );
200
+
201
+ foreach ( $choices as $key => $choice ) {
202
+
203
+ $selected = isset( $choice['default'] ) ? '1' : '0';
204
+ $val = isset( $field['show_values'] ) ? esc_attr( $choice['value'] ) : esc_attr( $choice['label'] );
205
+ $depth = isset( $choice['depth'] ) ? absint( $choice['depth'] ) : 1;
206
+
207
+ printf( '<li class="choice-%d depth-%d">', $key, $depth );
208
+
209
+ // Checkbox elements
210
+ printf( '<input type="checkbox" id="everest-forms-%d-field_%s_%d" name="everest_forms[form_fields][%s][]" value="%s" %s %s>',
211
+ $form_id,
212
+ $field['id'],
213
+ $key,
214
+ $field['id'],
215
+ $val,
216
+ checked( '1', $selected, false ),
217
+ $field_required
218
+ );
219
+
220
+ printf( '<label class="everest-forms-field-label-inline" for="everest-forms-%d-field_%d_%d">%s</label>', $form_id, $field['id'], $key, wp_kses_post( $choice['label'] ) );
221
+
222
+ echo '</li>';
223
+ }
224
+
225
+ echo '</ul>';
226
+ }
227
+
228
+ /**
229
+ * Formats and sanitizes field.
230
+ *
231
+ * @since 1.0.0
232
+ *
233
+ * @param int $field_id
234
+ * @param array $field_submit
235
+ * @param array $form_data
236
+ */
237
+ public function format( $field_id, $field_submit, $form_data ) {
238
+
239
+ $field_submit = (array) $field_submit;
240
+ $field = $form_data['form_fields'][ $field_id ];
241
+ $dynamic = ! empty( $field['dynamic_choices'] ) ? $field['dynamic_choices'] : false;
242
+ $name = sanitize_text_field( $field['label'] );
243
+ $value_raw = evf_sanitize_array_combine( $field_submit );
244
+
245
+ $data = array(
246
+ 'name' => $name,
247
+ 'value' => '',
248
+ 'value_raw' => $value_raw,
249
+ 'id' => absint( $field_id ),
250
+ 'type' => $this->type,
251
+ );
252
+
253
+ if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
254
+
255
+ // Dynamic population is enabled using post type
256
+ $value_raw = implode( ',', array_map( 'absint', $field_submit ) );
257
+ $data['value_raw'] = $value_raw;
258
+ $data['dynamic'] = 'post_type';
259
+ $data['dynamic_items'] = $value_raw;
260
+ $data['dynamic_post_type'] = $field['dynamic_post_type'];
261
+ $posts = array();
262
+
263
+ foreach ( $field_submit as $id ) {
264
+ $post = get_post( $id );
265
+
266
+ if ( ! is_wp_error( $post ) && ! empty( $post ) && $data['dynamic_post_type'] === $post->post_type ) {
267
+ $posts[] = esc_html( $post->post_title );
268
+ }
269
+ }
270
+
271
+ $data['value'] = ! empty( $posts ) ? evf_sanitize_array_combine( $posts ) : '';
272
+
273
+ } elseif ( 'taxonomy' === $dynamic && ! empty( $field['dynamic_taxonomy'] ) ) {
274
+
275
+ // Dynamic population is enabled using taxonomy
276
+ $value_raw = implode( ',', array_map( 'absint', $field_submit ) );
277
+ $data['value_raw'] = $value_raw;
278
+ $data['dynamic'] = 'taxonomy';
279
+ $data['dynamic_items'] = $value_raw;
280
+ $data['dynamic_taxonomy'] = $field['dynamic_taxonomy'];
281
+ $terms = array();
282
+
283
+ foreach ( $field_submit as $id ) {
284
+ $term = get_term( $id, $field['dynamic_taxonomy'] );
285
+
286
+ if ( ! is_wp_error( $term ) && ! empty( $term ) ) {
287
+ $terms[] = esc_html( $term->name );
288
+ }
289
+ }
290
+
291
+ $data['value'] = ! empty( $terms ) ? evf_sanitize_array_combine( $terms ) : '';
292
+
293
+ } else {
294
+
295
+ // Normal processing, dynamic population is off
296
+
297
+ // If show_values is true, that means values posted are the raw values
298
+ // and not the labels. So we need to get the label values.
299
+ if ( ! empty( $field['show_values'] ) && '1' == $field['show_values'] ) {
300
+
301
+ $value = array();
302
+
303
+ foreach ( $field_submit as $field_submit_single ) {
304
+ foreach ( $field['choices'] as $choice ) {
305
+ if ( $choice['value'] == $field_submit_single ) {
306
+ $value[] = $choice['label'];
307
+ break;
308
+ }
309
+ }
310
+ }
311
+
312
+ $data['value'] = ! empty( $value ) ? evf_sanitize_array_combine( $value ) : '';
313
+
314
+ } else {
315
+ $data['value'] = $value_raw;
316
+ }
317
+ }
318
+ }
319
+ }
320
+
321
+ new EVF_Field_Checkbox;
includes/form-fields/class-evf-field-date-time.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Date field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Date extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'Date', 'everest-forms' );
24
+ $this->type = 'date';
25
+ $this->icon = 'evf-icon evf-icon-date-time';
26
+ $this->order = 7;
27
+ $this->group = 'advanced';
28
+ }
29
+
30
+ /**
31
+ * Field options panel inside the builder.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param array $field
36
+ */
37
+ public function field_options( $field ) {
38
+
39
+ // -------------------------------------------------------------------//
40
+ // Basic field options.
41
+ // -------------------------------------------------------------------//
42
+
43
+ $args = array(
44
+ 'markup' => 'open',
45
+ );
46
+ $this->field_option( 'basic-options', $field, $args );
47
+
48
+ // Label.
49
+ $this->field_option( 'label', $field );
50
+
51
+ // Description.
52
+ $this->field_option( 'description', $field );
53
+
54
+ // Required toggle.
55
+ $this->field_option( 'required', $field );
56
+
57
+ // Options close markup.
58
+ $args = array(
59
+ 'markup' => 'close',
60
+ );
61
+ $this->field_option( 'basic-options', $field, $args );
62
+
63
+ // --------------------------------------------------------------------//
64
+ // Advanced field options.
65
+ // --------------------------------------------------------------------//
66
+
67
+ // Options open markup.
68
+ $args = array(
69
+ 'markup' => 'open',
70
+ );
71
+ $this->field_option( 'advanced-options', $field, $args );
72
+
73
+ // Hide label.
74
+ $this->field_option( 'label_hide', $field );
75
+
76
+
77
+ // Custom CSS classes.
78
+ $this->field_option( 'css', $field );
79
+
80
+ // Options close markup.
81
+ $args = array(
82
+ 'markup' => 'close',
83
+ );
84
+ $this->field_option( 'advanced-options', $field, $args );
85
+ }
86
+
87
+ /**
88
+ * Field preview inside the builder.
89
+ *
90
+ * @since 1.0.0
91
+ *
92
+ * @param array $field
93
+ */
94
+ public function field_preview( $field ) {
95
+
96
+ // Define data.
97
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
98
+
99
+ // Label.
100
+ $this->field_preview_option( 'label', $field );
101
+
102
+ // Primary input.
103
+ echo '<input type="date" placeholder="' . $placeholder . '" class="primary-input" disabled>';
104
+
105
+ // Description.
106
+ $this->field_preview_option( 'description', $field );
107
+ }
108
+
109
+ /**
110
+ * Field display on the form front-end.
111
+ *
112
+ * @since 1.0.0
113
+ *
114
+ * @param array $field
115
+ * @param array $deprecated
116
+ * @param array $form_data
117
+ */
118
+ public function field_display( $field, $deprecated, $form_data ) {
119
+
120
+ // Define data.
121
+ $primary = $field['properties']['inputs']['primary'];
122
+
123
+ $class = array_merge( array( 'date-picker-field' ), $primary['class'] );
124
+
125
+ // Primary field.
126
+ printf( '<input type="text" %s %s>',
127
+ evf_html_attributes( $primary['id'], $class, $primary['data'], $primary['attr'] ),
128
+ $primary['required']
129
+ );
130
+ }
131
+ }
132
+
133
+ new EVF_Field_Date;
includes/form-fields/class-evf-field-email.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Email field
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Email extends EVF_Form_Fields {
14
+
15
+
16
+ /**
17
+ * Primary class constructor.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ public function init() {
22
+
23
+ // Define field type information.
24
+ $this->name = __( 'Email', 'everest-forms' );
25
+ $this->type = 'email';
26
+ $this->icon = 'evf-icon evf-icon-email';
27
+ $this->order = 5;
28
+
29
+ }
30
+
31
+ public function field_options( $field ) {
32
+
33
+ // -------------------------------------------------------------------//
34
+ // Basic field options.
35
+ // -------------------------------------------------------------------//
36
+
37
+ // Options open markup.
38
+ $args = array(
39
+ 'markup' => 'open',
40
+ );
41
+ $this->field_option( 'basic-options', $field, $args );
42
+
43
+ // Label.
44
+ $this->field_option( 'label', $field );
45
+
46
+ // Description.
47
+ $this->field_option( 'description', $field );
48
+
49
+ // Required toggle.
50
+ $this->field_option( 'required', $field );
51
+
52
+ // Options close markup.
53
+ $args = array(
54
+ 'markup' => 'close',
55
+ );
56
+ $this->field_option( 'basic-options', $field, $args );
57
+
58
+ // -------------------------------------------------------------------//
59
+ // Advanced field options.
60
+ // -------------------------------------------------------------------//
61
+
62
+ // Options open markup.
63
+ $args = array(
64
+ 'markup' => 'open',
65
+ );
66
+ $this->field_option( 'advanced-options', $field, $args );
67
+
68
+ // Size.
69
+ $this->field_option( 'size', $field );
70
+
71
+ // Placeholder.
72
+ $this->field_option( 'placeholder', $field );
73
+
74
+ // Hide Label.
75
+ $this->field_option( 'label_hide', $field );
76
+
77
+ // Default value.
78
+ $this->field_option( 'default_value', $field );
79
+
80
+ // Custom CSS classes.
81
+ $this->field_option( 'css', $field );
82
+
83
+ // Options close markup.
84
+ $args = array(
85
+ 'markup' => 'close',
86
+ );
87
+ $this->field_option( 'advanced-options', $field, $args );
88
+ }
89
+
90
+ /**
91
+ * Field preview inside the builder.
92
+ *
93
+ * @since 1.0.0
94
+ *
95
+ * @param array $field
96
+ */
97
+ public function field_preview( $field ) {
98
+
99
+ // Define data.
100
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
101
+ $confirm_placeholder = ! empty( $field['confirmation_placeholder'] ) ? esc_attr( $field['confirmation_placeholder'] ) : '';
102
+ $confirm = ! empty( $field['confirmation'] ) ? 'enabled' : 'disabled';
103
+
104
+ // Label.
105
+ $this->field_preview_option( 'label', $field );
106
+ ?>
107
+
108
+ <div class="everest-forms-confirm everest-forms-confirm-<?php echo $confirm; ?>">
109
+
110
+ <div class="everest-forms-confirm-primary">
111
+ <input type="email" placeholder="<?php echo $placeholder; ?>" class="primary-input" disabled>
112
+ </div>
113
+
114
+ </div>
115
+
116
+ <?php
117
+ // Description.
118
+ $this->field_preview_option( 'description', $field );
119
+ }
120
+
121
+ /**
122
+ * Field display on the form front-end.
123
+ *
124
+ * @since 1.0.0
125
+ *
126
+ * @param array $field
127
+ * @param array $deprecated
128
+ * @param array $form_data
129
+ */
130
+ public function field_display( $field, $deprecated, $form_data ) {
131
+
132
+ // Define data.
133
+ $form_id = absint( $form_data['id'] );
134
+ $confirmation = ! empty( $field['confirmation'] );
135
+ $primary = $field['properties']['inputs']['primary'];
136
+ $secondary = ! empty( $field['properties']['inputs']['secondary'] ) ? $field['properties']['inputs']['secondary'] : '';
137
+
138
+ // Standard email field.
139
+ if ( ! $confirmation ) {
140
+
141
+ // Primary field.
142
+ printf( '<input type="email" %s %s>',
143
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
144
+ $primary['required']
145
+ );
146
+
147
+ // Confirmation email field configuration.
148
+ } else {
149
+
150
+ // Row wrapper.
151
+ echo '<div class="everest-forms-field-row everest-forms-field-' . sanitize_html_class( $field['size'] ) . '">';
152
+
153
+ // Primary field.
154
+ echo '<div ' . evf_html_attributes( false, $primary['block'] ) . '>';
155
+ $this->field_display_sublabel( 'primary', 'before', $field );
156
+ printf( '<input type="email" %s %s>',
157
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
158
+ $primary['required']
159
+ );
160
+ $this->field_display_sublabel( 'primary', 'after', $field );
161
+ $this->field_display_error( 'primary', $field );
162
+ echo '</div>';
163
+
164
+ // Secondary field.
165
+ echo '<div ' . evf_html_attributes( false, $secondary['block'] ) . '>';
166
+ $this->field_display_sublabel( 'secondary', 'before', $field );
167
+ printf( '<input type="email" %s %s>',
168
+ evf_html_attributes( $secondary['id'], $secondary['class'], $secondary['data'], $secondary['attr'] ),
169
+ $secondary['required']
170
+ );
171
+ $this->field_display_sublabel( 'secondary', 'after', $field );
172
+ $this->field_display_error( 'secondary', $field );
173
+ echo '</div>';
174
+
175
+ echo '</div>';
176
+
177
+ } // End if().
178
+ }
179
+
180
+ /**
181
+ * Formats and sanitizes field.
182
+ *
183
+ * @since 1.0.0
184
+ *
185
+ * @param int $field_id
186
+ * @param array $field_submit
187
+ * @param array $form_data
188
+ */
189
+ public function format( $field_id, $field_submit, $form_data ) {
190
+
191
+ // Define data.
192
+ if ( is_array( $field_submit ) ) {
193
+ $value = ! empty( $field_submit['primary'] ) ? $field_submit['primary'] : '';
194
+ } else {
195
+ $value = ! empty( $field_submit ) ? $field_submit : '';
196
+ }
197
+
198
+ $name = ! empty( $form_data['fields'][ $field_id ] ['label'] ) ? $form_data['fields'][ $field_id ]['label'] : '';
199
+
200
+ }
201
+
202
+
203
+ }
204
+
205
+ new EVF_Field_Email;
includes/form-fields/class-evf-field-first-name.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * First name field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_First_Name extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'First Name', 'everest-forms' );
24
+ $this->type = 'first-name';
25
+ $this->icon = 'evf-icon evf-icon-first-name';
26
+ $this->order = 1;
27
+ }
28
+
29
+ /**
30
+ * Field options panel inside the builder.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param array $field
35
+ */
36
+ public function field_options( $field ) {
37
+
38
+ // -------------------------------------------------------------------//
39
+ // Basic field options.
40
+ // -------------------------------------------------------------------//
41
+
42
+ $args = array(
43
+ 'markup' => 'open',
44
+ );
45
+ $this->field_option( 'basic-options', $field, $args );
46
+
47
+ // Label.
48
+ $this->field_option( 'label', $field );
49
+
50
+ // Description.
51
+ $this->field_option( 'description', $field );
52
+
53
+ // Required toggle.
54
+ $this->field_option( 'required', $field );
55
+
56
+ // Options close markup.
57
+ $args = array(
58
+ 'markup' => 'close',
59
+ );
60
+ $this->field_option( 'basic-options', $field, $args );
61
+
62
+ // --------------------------------------------------------------------//
63
+ // Advanced field options.
64
+ // --------------------------------------------------------------------//
65
+
66
+ // Options open markup.
67
+ $args = array(
68
+ 'markup' => 'open',
69
+ );
70
+ $this->field_option( 'advanced-options', $field, $args );
71
+
72
+
73
+
74
+ // Placeholder.
75
+ $this->field_option( 'placeholder', $field );
76
+
77
+ // Hide label.
78
+ $this->field_option( 'label_hide', $field );
79
+
80
+
81
+ // Custom CSS classes.
82
+ $this->field_option( 'css', $field );
83
+
84
+ // Options close markup.
85
+ $args = array(
86
+ 'markup' => 'close',
87
+ );
88
+ $this->field_option( 'advanced-options', $field, $args );
89
+ }
90
+
91
+ /**
92
+ * Field preview inside the builder.
93
+ *
94
+ * @since 1.0.0
95
+ *
96
+ * @param array $field
97
+ */
98
+ public function field_preview( $field ) {
99
+
100
+ // Define data.
101
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
102
+
103
+ // Label.
104
+ $this->field_preview_option( 'label', $field );
105
+
106
+ // Primary input.
107
+ echo '<input type="text" placeholder="' . $placeholder . '" class="primary-input" disabled>';
108
+
109
+ // Description.
110
+ $this->field_preview_option( 'description', $field );
111
+ }
112
+
113
+ /**
114
+ * Field display on the form front-end.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @param array $field
119
+ * @param array $deprecated
120
+ * @param array $form_data
121
+ */
122
+ public function field_display( $field, $deprecated, $form_data ) {
123
+
124
+ // Define data.
125
+ $primary = $field['properties']['inputs']['primary'];
126
+ // Primary field.
127
+ printf( '<input type="text" %s %s>',
128
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
129
+ $primary['required']
130
+ );
131
+ }
132
+ }
133
+
134
+ new EVF_Field_First_Name;
includes/form-fields/class-evf-field-last-name.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * First name field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Last_Name extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'Last Name', 'everest-forms' );
24
+ $this->type = 'last-name';
25
+ $this->icon = 'evf-icon evf-icon-last-name';
26
+ $this->order = 2;
27
+ }
28
+
29
+ /**
30
+ * Field options panel inside the builder.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param array $field
35
+ */
36
+ public function field_options( $field ) {
37
+
38
+ // -------------------------------------------------------------------//
39
+ // Basic field options.
40
+ // -------------------------------------------------------------------//
41
+
42
+ $args = array(
43
+ 'markup' => 'open',
44
+ );
45
+ $this->field_option( 'basic-options', $field, $args );
46
+
47
+ // Label.
48
+ $this->field_option( 'label', $field );
49
+
50
+ // Description.
51
+ $this->field_option( 'description', $field );
52
+
53
+ // Required toggle.
54
+ $this->field_option( 'required', $field );
55
+
56
+ // Options close markup.
57
+ $args = array(
58
+ 'markup' => 'close',
59
+ );
60
+ $this->field_option( 'basic-options', $field, $args );
61
+
62
+ // --------------------------------------------------------------------//
63
+ // Advanced field options.
64
+ // --------------------------------------------------------------------//
65
+
66
+ // Options open markup.
67
+ $args = array(
68
+ 'markup' => 'open',
69
+ );
70
+ $this->field_option( 'advanced-options', $field, $args );
71
+
72
+
73
+
74
+ // Placeholder.
75
+ $this->field_option( 'placeholder', $field );
76
+
77
+ // Hide label.
78
+ $this->field_option( 'label_hide', $field );
79
+
80
+
81
+ // Custom CSS classes.
82
+ $this->field_option( 'css', $field );
83
+
84
+ // Options close markup.
85
+ $args = array(
86
+ 'markup' => 'close',
87
+ );
88
+ $this->field_option( 'advanced-options', $field, $args );
89
+ }
90
+
91
+ /**
92
+ * Field preview inside the builder.
93
+ *
94
+ * @since 1.0.0
95
+ *
96
+ * @param array $field
97
+ */
98
+ public function field_preview( $field ) {
99
+
100
+ // Define data.
101
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
102
+
103
+ // Label.
104
+ $this->field_preview_option( 'label', $field );
105
+
106
+ // Primary input.
107
+ echo '<input type="text" placeholder="' . $placeholder . '" class="primary-input" disabled>';
108
+
109
+ // Description.
110
+ $this->field_preview_option( 'description', $field );
111
+ }
112
+
113
+ /**
114
+ * Field display on the form front-end.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @param array $field
119
+ * @param array $deprecated
120
+ * @param array $form_data
121
+ */
122
+ public function field_display( $field, $deprecated, $form_data ) {
123
+
124
+ // Define data.
125
+ $primary = $field['properties']['inputs']['primary'];
126
+ // Primary field.
127
+ printf( '<input type="text" %s %s>',
128
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
129
+ $primary['required']
130
+ );
131
+ }
132
+ }
133
+
134
+ new EVF_Field_Last_Name;
includes/form-fields/class-evf-field-number.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Number field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Number extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'Number', 'everest-forms' );
24
+ $this->type = 'number';
25
+ $this->icon = 'evf-icon evf-icon-number';
26
+ $this->order = 9;
27
+ $this->group = 'advanced';
28
+ }
29
+
30
+ /**
31
+ * Field options panel inside the builder.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param array $field
36
+ */
37
+ public function field_options( $field ) {
38
+
39
+ // -------------------------------------------------------------------//
40
+ // Basic field options.
41
+ // -------------------------------------------------------------------//
42
+
43
+ $args = array(
44
+ 'markup' => 'open',
45
+ );
46
+ $this->field_option( 'basic-options', $field, $args );
47
+
48
+ // Label.
49
+ $this->field_option( 'label', $field );
50
+
51
+ // Description.
52
+ $this->field_option( 'description', $field );
53
+
54
+ // Required toggle.
55
+ $this->field_option( 'required', $field );
56
+
57
+ // Options close markup.
58
+ $args = array(
59
+ 'markup' => 'close',
60
+ );
61
+ $this->field_option( 'basic-options', $field, $args );
62
+
63
+ // --------------------------------------------------------------------//
64
+ // Advanced field options.
65
+ // --------------------------------------------------------------------//
66
+
67
+ // Options open markup.
68
+ $args = array(
69
+ 'markup' => 'open',
70
+ );
71
+ $this->field_option( 'advanced-options', $field, $args );
72
+
73
+
74
+
75
+ // Placeholder.
76
+ $this->field_option( 'placeholder', $field );
77
+
78
+ // Hide label.
79
+ $this->field_option( 'label_hide', $field );
80
+
81
+
82
+ // Custom CSS classes.
83
+ $this->field_option( 'css', $field );
84
+
85
+ // Options close markup.
86
+ $args = array(
87
+ 'markup' => 'close',
88
+ );
89
+ $this->field_option( 'advanced-options', $field, $args );
90
+ }
91
+
92
+ /**
93
+ * Field preview inside the builder.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @param array $field
98
+ */
99
+ public function field_preview( $field ) {
100
+
101
+ // Define data.
102
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
103
+
104
+ // Label.
105
+ $this->field_preview_option( 'label', $field );
106
+
107
+ // Primary input.
108
+ echo '<input type="number" placeholder="' . $placeholder . '" class="primary-input" disabled>';
109
+
110
+ // Description.
111
+ $this->field_preview_option( 'description', $field );
112
+ }
113
+
114
+ /**
115
+ * Field display on the form front-end.
116
+ *
117
+ * @since 1.0.0
118
+ *
119
+ * @param array $field
120
+ * @param array $deprecated
121
+ * @param array $form_data
122
+ */
123
+ public function field_display( $field, $deprecated, $form_data ) {
124
+
125
+ // Define data.
126
+ $primary = $field['properties']['inputs']['primary'];
127
+ // Primary field.
128
+ printf( '<input type="number" %s %s>',
129
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
130
+ $primary['required']
131
+ );
132
+ }
133
+ }
134
+
135
+ new EVF_Field_Number;
includes/form-fields/class-evf-field-radio.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+
7
+ /**
8
+ * Radio
9
+ *
10
+ * @package EverestForms
11
+ * @author WPEverest
12
+ * @since 1.0.0
13
+ */
14
+ class EVF_Field_Radio extends EVF_Form_Fields {
15
+
16
+ /**
17
+ * Primary class constructor.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ public function init() {
22
+
23
+ // Define field type information
24
+ $this->name = __( 'Radio', 'everest-forms' );
25
+ $this->type = 'radio';
26
+ $this->icon = 'evf-icon evf-icon-radio';
27
+ $this->order = 15;
28
+ $this->group = 'advanced';
29
+ $this->defaults = array(
30
+ 1 => array(
31
+ 'label' => __( 'First Choice', 'everest-forms' ),
32
+ 'value' => '',
33
+ 'default' => '',
34
+ ),
35
+ 2 => array(
36
+ 'label' => __( 'Second Choice', 'everest-forms' ),
37
+ 'value' => '',
38
+ 'default' => '',
39
+ ),
40
+ 3 => array(
41
+ 'label' => __( 'Third Choice', 'everest-forms' ),
42
+ 'value' => '',
43
+ 'default' => '',
44
+ ),
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Field options panel inside the builder.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @param array $field
54
+ */
55
+ public function field_options( $field ) {
56
+
57
+ // --------------------------------------------------------------------//
58
+ // Basic field options
59
+ // --------------------------------------------------------------------//
60
+
61
+ // Options open markup
62
+ $this->field_option( 'basic-options', $field, array(
63
+ 'markup' => 'open',
64
+ ) );
65
+
66
+ // Label
67
+ $this->field_option( 'label', $field );
68
+
69
+ // Choices
70
+ $this->field_option( 'choices', $field );
71
+
72
+ // Description
73
+ $this->field_option( 'description', $field );
74
+
75
+ // Required toggle
76
+ $this->field_option( 'required', $field );
77
+
78
+ // Options close markup
79
+ $this->field_option( 'basic-options', $field, array(
80
+ 'markup' => 'close',
81
+ ) );
82
+
83
+ // --------------------------------------------------------------------//
84
+ // Advanced field options
85
+ // --------------------------------------------------------------------//
86
+
87
+ // Options open markup
88
+ $this->field_option( 'advanced-options', $field, array(
89
+ 'markup' => 'open',
90
+ ) );
91
+
92
+ // Show Values toggle option. This option will only show if already used
93
+ // or if manually enabled by a filter.
94
+ if ( ! empty( $field['show_values'] ) || apply_filters( 'everest_forms_fields_show_options_setting', false ) ) {
95
+ $show_values = $this->field_element(
96
+ 'checkbox',
97
+ $field,
98
+ array(
99
+ 'slug' => 'show_values',
100
+ 'value' => isset( $field['show_values'] ) ? $field['show_values'] : '0',
101
+ 'desc' => __( 'Show Values', 'everest-forms' ),
102
+ 'tooltip' => __( 'Check this to manually set form field values.', 'everest-forms' ),
103
+ ),
104
+ false
105
+ );
106
+ $this->field_element( 'row', $field, array(
107
+ 'slug' => 'show_values',
108
+ 'content' => $show_values,
109
+ ) );
110
+ }
111
+
112
+ // Input columns
113
+ $this->field_option( 'input_columns', $field );
114
+
115
+ // Hide label
116
+ $this->field_option( 'label_hide', $field );
117
+
118
+ // Custom CSS classes
119
+ $this->field_option( 'css', $field );
120
+
121
+ // Options close markup
122
+ $this->field_option( 'advanced-options', $field, array(
123
+ 'markup' => 'close',
124
+ ) );
125
+ }
126
+
127
+ /**
128
+ * Field preview inside the builder.
129
+ *
130
+ * @since 1.0.0
131
+ *
132
+ * @param array $field
133
+ */
134
+ public function field_preview( $field ) {
135
+
136
+ $values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
137
+ $dynamic = ! empty( $field['dynamic_choices'] ) ? $field['dynamic_choices'] : false;
138
+
139
+ // Label
140
+ $this->field_preview_option( 'label', $field );
141
+
142
+ // Field checkbox elements
143
+ echo '<ul class="primary-input">';
144
+
145
+ // Notify if currently empty
146
+ if ( empty( $values ) ) {
147
+ $values = array(
148
+ 'label' => __( '(empty)', 'everest-forms' ),
149
+ );
150
+ }
151
+
152
+ // Individual checkbox options
153
+ foreach ( $values as $key => $value ) {
154
+
155
+ $default = isset( $value['default'] ) ? $value['default'] : '';
156
+ $selected = checked( '1', $default, false );
157
+
158
+ printf( '<li><input type="radio" %s disabled>%s</li>', $selected, $value['label'] );
159
+ }
160
+
161
+ echo '</ul>';
162
+
163
+ // Dynamic population is enabled and contains more than 20 items
164
+ if ( isset( $total ) && $total > 20 ) {
165
+ echo '<div class="everest-forms-alert-dynamic everest-forms-alert everest-forms-alert-warning">';
166
+ printf( __( 'Showing the first 20 choices.<br> All %d choices will be displayed when viewing the form.', 'everest-forms' ), absint( $total ) );
167
+ echo '</div>';
168
+ }
169
+
170
+ // Description
171
+ $this->field_preview_option( 'description', $field );
172
+ }
173
+
174
+ /**
175
+ * Field display on the form front-end.
176
+ *
177
+ * @since 1.0.0
178
+ *
179
+ * @param array $field
180
+ * @param array $field_atts
181
+ * @param array $form_data
182
+ */
183
+ public function field_display( $field, $field_atts, $form_data ) {
184
+
185
+ // Setup and sanitize the necessary data
186
+ $field = apply_filters( 'everest_forms_radio_field_display', $field, $field_atts, $form_data );
187
+ $field_required = ! empty( $field['required'] ) ? ' required' : '';
188
+ $field_class = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_class'] ) );
189
+ $field_id = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_id'] ) );
190
+ $field_data = '';
191
+ $form_id = $form_data['id'];
192
+ $choices = isset( $field['choices'] ) ? $field['choices'] : array();
193
+ if ( ! empty( $field_atts['input_data'] ) ) {
194
+ foreach ( $field_atts['input_data'] as $key => $val ) {
195
+ $field_data .= ' data-' . $key . '="' . $val . '"';
196
+ }
197
+ }
198
+ // List.
199
+ printf( '<ul id="%s" class="%s" %s>', $field_id, $field_class, $field_data );
200
+
201
+ foreach ( $choices as $key => $choice ) {
202
+
203
+ $selected = isset( $choice['default'] ) ? '1' : '0';
204
+ $val = isset( $field['show_values'] ) ? esc_attr( $choice['value'] ) : esc_attr( $choice['label'] );
205
+ $depth = isset( $choice['depth'] ) ? absint( $choice['depth'] ) : 1;
206
+
207
+ printf( '<li class="choice-%d depth-%d">', $key, $depth );
208
+
209
+ // Checkbox elements
210
+ printf( '<input type="radio" id="everest-forms-%d-field_%s_%d" name="everest_forms[form_fields][%s][]" value="%s" %s %s>',
211
+ $form_id,
212
+ $field['id'],
213
+ $key,
214
+ $field['id'],
215
+ $val,
216
+ checked( '1', $selected, false ),
217
+ $field_required
218
+ );
219
+
220
+ printf( '<label class="everest-forms-field-label-inline" for="everest-forms-%d-field_%d_%d">%s</label>', $form_id, $field['id'], $key, wp_kses_post( $choice['label'] ) );
221
+
222
+ echo '</li>';
223
+ }
224
+
225
+ echo '</ul>';
226
+ }
227
+
228
+ /**
229
+ * Formats and sanitizes field.
230
+ *
231
+ * @since 1.0.0
232
+ *
233
+ * @param int $field_id
234
+ * @param array $field_submit
235
+ * @param array $form_data
236
+ */
237
+ public function format( $field_id, $field_submit, $form_data ) {
238
+
239
+ $field_submit = (array) $field_submit;
240
+ $field = $form_data['form_fields'][ $field_id ];
241
+ $dynamic = ! empty( $field['dynamic_choices'] ) ? $field['dynamic_choices'] : false;
242
+ $name = sanitize_text_field( $field['label'] );
243
+ $value_raw = evf_sanitize_array_combine( $field_submit );
244
+
245
+ $data = array(
246
+ 'name' => $name,
247
+ 'value' => '',
248
+ 'value_raw' => $value_raw,
249
+ 'id' => absint( $field_id ),
250
+ 'type' => $this->type,
251
+ );
252
+
253
+ if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
254
+
255
+ // Dynamic population is enabled using post type
256
+ $value_raw = implode( ',', array_map( 'absint', $field_submit ) );
257
+ $data['value_raw'] = $value_raw;
258
+ $data['dynamic'] = 'post_type';
259
+ $data['dynamic_items'] = $value_raw;
260
+ $data['dynamic_post_type'] = $field['dynamic_post_type'];
261
+ $posts = array();
262
+
263
+ foreach ( $field_submit as $id ) {
264
+ $post = get_post( $id );
265
+
266
+ if ( ! is_wp_error( $post ) && ! empty( $post ) && $data['dynamic_post_type'] === $post->post_type ) {
267
+ $posts[] = esc_html( $post->post_title );
268
+ }
269
+ }
270
+
271
+ $data['value'] = ! empty( $posts ) ? evf_sanitize_array_combine( $posts ) : '';
272
+
273
+ } elseif ( 'taxonomy' === $dynamic && ! empty( $field['dynamic_taxonomy'] ) ) {
274
+
275
+ // Dynamic population is enabled using taxonomy
276
+ $value_raw = implode( ',', array_map( 'absint', $field_submit ) );
277
+ $data['value_raw'] = $value_raw;
278
+ $data['dynamic'] = 'taxonomy';
279
+ $data['dynamic_items'] = $value_raw;
280
+ $data['dynamic_taxonomy'] = $field['dynamic_taxonomy'];
281
+ $terms = array();
282
+
283
+ foreach ( $field_submit as $id ) {
284
+ $term = get_term( $id, $field['dynamic_taxonomy'] );
285
+
286
+ if ( ! is_wp_error( $term ) && ! empty( $term ) ) {
287
+ $terms[] = esc_html( $term->name );
288
+ }
289
+ }
290
+
291
+ $data['value'] = ! empty( $terms ) ? evf_sanitize_array_combine( $terms ) : '';
292
+
293
+ } else {
294
+
295
+ // Normal processing, dynamic population is off
296
+
297
+ // If show_values is true, that means values posted are the raw values
298
+ // and not the labels. So we need to get the label values.
299
+ if ( ! empty( $field['show_values'] ) && '1' == $field['show_values'] ) {
300
+
301
+ $value = array();
302
+
303
+ foreach ( $field_submit as $field_submit_single ) {
304
+ foreach ( $field['choices'] as $choice ) {
305
+ if ( $choice['value'] == $field_submit_single ) {
306
+ $value[] = $choice['label'];
307
+ break;
308
+ }
309
+ }
310
+ }
311
+
312
+ $data['value'] = ! empty( $value ) ? evf_sanitize_array_combine( $value ) : '';
313
+
314
+ } else {
315
+ $data['value'] = $value_raw;
316
+ }
317
+ }
318
+ }
319
+ }
320
+
321
+ new EVF_Field_Radio;
includes/form-fields/class-evf-field-select.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Select
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Select extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information
23
+ $this->name = __( 'Select', 'everest-forms' );
24
+ $this->type = 'select';
25
+ $this->icon = 'evf-icon evf-icon-dropdown';
26
+ $this->order = 17;
27
+ $this->group = 'advanced';
28
+ $this->defaults = array(
29
+ 1 => array(
30
+ 'label' => __( 'Option 1', 'everest-forms' ),
31
+ 'value' => '',
32
+ 'default' => '',
33
+ ),
34
+ 2 => array(
35
+ 'label' => __( 'Option 2', 'everest-forms' ),
36
+ 'value' => '',
37
+ 'default' => '',
38
+ ),
39
+ );
40
+ }
41
+
42
+ /**
43
+ * Field options panel inside the builder.
44
+ *
45
+ * @since 1.0.0
46
+ *
47
+ * @param array $field
48
+ */
49
+ public function field_options( $field ) {
50
+
51
+ // --------------------------------------------------------------------//
52
+ // Basic field options.
53
+ // --------------------------------------------------------------------//
54
+
55
+ // Options open markup.
56
+ $this->field_option( 'basic-options', $field, array(
57
+ 'markup' => 'open',
58
+ ) );
59
+
60
+ // Label.
61
+ $this->field_option( 'label', $field );
62
+
63
+ // Choices.
64
+ $this->field_option( 'choices', $field );
65
+
66
+ // Description.
67
+ $this->field_option( 'description', $field );
68
+
69
+ // Required toggle.
70
+ $this->field_option( 'required', $field );
71
+
72
+ // Options close markup.
73
+ $this->field_option( 'basic-options', $field, array(
74
+ 'markup' => 'close',
75
+ ) );
76
+
77
+ // --------------------------------------------------------------------//
78
+ // Advanced field options.
79
+ // --------------------------------------------------------------------//
80
+
81
+ // Options open markup.
82
+ $this->field_option( 'advanced-options', $field, array(
83
+ 'markup' => 'open',
84
+ ) );
85
+
86
+
87
+ // Size.
88
+ $this->field_option( 'size', $field );
89
+
90
+ // Placeholder.
91
+ $this->field_option( 'placeholder', $field );
92
+
93
+ // Hide label.
94
+ $this->field_option( 'label_hide', $field );
95
+
96
+ // Custom CSS classes.
97
+ $this->field_option( 'css', $field );
98
+
99
+ // Options close markup.
100
+ $this->field_option( 'advanced-options', $field, array(
101
+ 'markup' => 'close',
102
+ ) );
103
+ }
104
+
105
+ /**
106
+ * Field preview inside the builder.
107
+ *
108
+ * @since 1.0.0
109
+ *
110
+ * @param array $field
111
+ */
112
+ public function field_preview( $field ) {
113
+
114
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
115
+ $values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
116
+
117
+ // Label.
118
+ $this->field_preview_option( 'label', $field );
119
+
120
+ // Field select element.
121
+ echo '<select class="primary-input" disabled>';
122
+
123
+ // Optional placeholder.
124
+ if ( ! empty( $placeholder ) ) {
125
+ printf( '<option value="" class="placeholder">%s</option>', $placeholder );
126
+ }
127
+ // Notify if currently empty.
128
+ if ( empty( $values ) ) {
129
+ $values = array(
130
+ 'label' => __( '(empty)', 'everest-forms' ),
131
+ );
132
+ }
133
+
134
+ // Build the select options (even though user can only see 1st option).
135
+ foreach ( $values as $key => $value ) {
136
+
137
+ $default = isset( $value['default'] ) ? $value['default'] : '';
138
+ $selected = ! empty( $placeholder ) ? '' : selected( '1', $default, false );
139
+
140
+ printf( '<option %s>%s</option>', $selected, $value['label'] );
141
+ }
142
+
143
+ echo '</select>';
144
+
145
+ // Description.
146
+ $this->field_preview_option( 'description', $field );
147
+ }
148
+
149
+ /**
150
+ * Field display on the form front-end.
151
+ *
152
+ * @since 1.0.0
153
+ *
154
+ * @param array $field
155
+ * @param array $field_atts
156
+ * @param array $form_data
157
+ */
158
+ public function field_display( $field, $field_atts, $form_data ) {
159
+
160
+ // Setup and sanitize the necessary data.
161
+ $field = apply_filters( 'everest_forms_select_field_display', $field, $field_atts, $form_data );
162
+ $field_placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
163
+ $field_required = ! empty( $field['required'] ) ? ' required' : '';
164
+ $field_class = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_class'] ) );
165
+ $field_id = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_id'] ) );
166
+ $field_data = '';
167
+ $choices = $field['choices'];
168
+ $has_default = false;
169
+
170
+ if ( ! empty( $field_atts['input_data'] ) ) {
171
+ foreach ( $field_atts['input_data'] as $key => $val ) {
172
+ $field_data .= ' data-' . $key . '="' . $val . '"';
173
+ }
174
+ }
175
+
176
+ // Check to see if any of the options have selected by default.
177
+ foreach ( $choices as $choice ) {
178
+ if ( isset( $choice['default'] ) ) {
179
+ $has_default = true;
180
+ break;
181
+ }
182
+ }
183
+
184
+ // Primary select field.
185
+ printf( '<select name="everest_forms[form_fields][%d]" id="%s" class="%s" %s %s>',
186
+ $field['id'],
187
+ $field_id,
188
+ $field_class,
189
+ $field_required,
190
+ $field_data
191
+ );
192
+
193
+ // Optional placeholder.
194
+ if ( ! empty( $field_placeholder ) ) {
195
+ printf( '<option value="" class="placeholder" disabled %s>%s</option>', selected( false, $has_default, false ), $field_placeholder );
196
+ }
197
+ // Build the select options.
198
+ foreach ( $choices as $key => $choice ) {
199
+
200
+ $selected = isset( $choice['default'] ) && empty( $field_placeholder ) ? '1' : '0';
201
+ $val = isset( $field['show_values'] ) ? esc_attr( $choice['value'] ) : esc_attr( $choice['label'] );
202
+
203
+ printf( '<option value="%s" %s>%s</option>', $val, selected( '1', $selected, false ), $choice['label'] );
204
+ }
205
+
206
+ echo '</select>';
207
+ }
208
+
209
+ /**
210
+ * Formats and sanitizes field.
211
+ *
212
+ * @since 1.0.0
213
+ *
214
+ * @param int $field_id
215
+ * @param string $field_submit
216
+ * @param array $form_data
217
+ */
218
+ public function format( $field_id, $field_submit, $form_data ) {
219
+
220
+ $field = $form_data['form_fields'][ $field_id ];
221
+ $name = sanitize_text_field( $field['label'] );
222
+ $value_raw = sanitize_text_field( $field_submit );
223
+ $value = '';
224
+
225
+ $data = array(
226
+ 'name' => $name,
227
+ 'value' => '',
228
+ 'value_raw' => $value_raw,
229
+ 'id' => absint( $field_id ),
230
+ 'type' => $this->type,
231
+ );
232
+
233
+
234
+ // Normal processing, dynamic population is off.
235
+
236
+ // If show_values is true, that means values posted are the raw values
237
+ // and not the labels. So we need to get the label values.
238
+ if ( ! empty( $field['show_values'] ) && '1' == $field['show_values'] ) {
239
+
240
+ foreach ( $field['choices'] as $choice ) {
241
+ if ( $choice['value'] === $field_submit ) {
242
+ $value = $choice['label'];
243
+ break;
244
+ }
245
+ }
246
+
247
+ $data['value'] = sanitize_text_field( $value );
248
+
249
+ } else {
250
+ $data['value'] = $value_raw;
251
+ }
252
+ }
253
+ }
254
+
255
+ new EVF_Field_Select;
includes/form-fields/class-evf-field-text.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Single line text field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Text extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'Text', 'everest-forms' );
24
+ $this->type = 'text';
25
+ $this->icon = 'evf-icon evf-icon-text';
26
+ $this->order = 3;
27
+ }
28
+
29
+ /**
30
+ * Field options panel inside the builder.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param array $field
35
+ */
36
+ public function field_options( $field ) {
37
+
38
+ // -------------------------------------------------------------------//
39
+ // Basic field options.
40
+ // -------------------------------------------------------------------//
41
+
42
+ $args = array(
43
+ 'markup' => 'open',
44
+ );
45
+ $this->field_option( 'basic-options', $field, $args );
46
+
47
+ // Label.
48
+ $this->field_option( 'label', $field );
49
+
50
+ // Description.
51
+ $this->field_option( 'description', $field );
52
+
53
+ // Required toggle.
54
+ $this->field_option( 'required', $field );
55
+
56
+ // Options close markup.
57
+ $args = array(
58
+ 'markup' => 'close',
59
+ );
60
+ $this->field_option( 'basic-options', $field, $args );
61
+
62
+ // --------------------------------------------------------------------//
63
+ // Advanced field options.
64
+ // --------------------------------------------------------------------//
65
+
66
+ // Options open markup.
67
+ $args = array(
68
+ 'markup' => 'open',
69
+ );
70
+ $this->field_option( 'advanced-options', $field, $args );
71
+
72
+
73
+
74
+ // Placeholder.
75
+ $this->field_option( 'placeholder', $field );
76
+
77
+ // Hide label.
78
+ $this->field_option( 'label_hide', $field );
79
+
80
+
81
+ // Custom CSS classes.
82
+ $this->field_option( 'css', $field );
83
+
84
+ // Options close markup.
85
+ $args = array(
86
+ 'markup' => 'close',
87
+ );
88
+ $this->field_option( 'advanced-options', $field, $args );
89
+ }
90
+
91
+ /**
92
+ * Field preview inside the builder.
93
+ *
94
+ * @since 1.0.0
95
+ *
96
+ * @param array $field
97
+ */
98
+ public function field_preview( $field ) {
99
+
100
+ // Define data.
101
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
102
+
103
+ // Label.
104
+ $this->field_preview_option( 'label', $field );
105
+
106
+ // Primary input.
107
+ echo '<input type="text" placeholder="' . $placeholder . '" class="primary-input" disabled>';
108
+
109
+ // Description.
110
+ $this->field_preview_option( 'description', $field );
111
+ }
112
+
113
+ /**
114
+ * Field display on the form front-end.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @param array $field
119
+ * @param array $deprecated
120
+ * @param array $form_data
121
+ */
122
+ public function field_display( $field, $deprecated, $form_data ) {
123
+
124
+ // Define data.
125
+ $primary = $field['properties']['inputs']['primary'];
126
+ // Primary field.
127
+ printf( '<input type="text" %s %s>',
128
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
129
+ $primary['required']
130
+ );
131
+ }
132
+ }
133
+
134
+ new EVF_Field_Text;
includes/form-fields/class-evf-field-textarea.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Paragraph text field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEVerest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_Textarea extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information
23
+ $this->name = __( 'Paragraph Text', 'everest-forms' );
24
+ $this->type = 'textarea';
25
+ $this->icon = 'evf-icon evf-icon-paragraph';
26
+ $this->order = 4;
27
+ }
28
+
29
+ /**
30
+ * Field options panel inside the builder.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param array $field
35
+ */
36
+ public function field_options( $field ) {
37
+
38
+ // -------------------------------------------------------------------//
39
+ // Basic field options.
40
+ // -------------------------------------------------------------------//
41
+
42
+ // Options open markup.
43
+ $args = array(
44
+ 'markup' => 'open',
45
+ );
46
+ $this->field_option( 'basic-options', $field, $args );
47
+
48
+ // Label.
49
+ $this->field_option( 'label', $field );
50
+
51
+ // Description
52
+ $this->field_option( 'description', $field );
53
+
54
+ // Required toggle.
55
+ $this->field_option( 'required', $field );
56
+
57
+ // Options close markup.
58
+ $args = array(
59
+ 'markup' => 'close',
60
+ );
61
+ $this->field_option( 'basic-options', $field, $args );
62
+
63
+ // -------------------------------------------------------------------//
64
+ // Advanced field options.
65
+ // -------------------------------------------------------------------//
66
+
67
+ // Options open markup.
68
+ $args = array(
69
+ 'markup' => 'open',
70
+ );
71
+ $this->field_option( 'advanced-options', $field, $args );
72
+
73
+ // Size.
74
+ $this->field_option( 'size', $field );
75
+
76
+ // Placeholder.
77
+ $this->field_option( 'placeholder', $field );
78
+
79
+ // Hide label.
80
+ $this->field_option( 'label_hide', $field );
81
+
82
+ // Custom CSS classes.
83
+ $this->field_option( 'css', $field );
84
+
85
+ // Options close markup.
86
+ $args = array(
87
+ 'markup' => 'close',
88
+ );
89
+ $this->field_option( 'advanced-options', $field, $args );
90
+ }
91
+
92
+ /**
93
+ * Field preview inside the builder.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @param array $field
98
+ */
99
+ public function field_preview( $field ) {
100
+
101
+ // Define data.
102
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
103
+
104
+ // Label.
105
+ $this->field_preview_option( 'label', $field );
106
+
107
+ // Primary input.
108
+ echo '<textarea placeholder="' . $placeholder . '" class="primary-input" disabled></textarea>';
109
+
110
+ // Description.
111
+ $this->field_preview_option( 'description', $field );
112
+ }
113
+
114
+ /**
115
+ * Field display on the form front-end.
116
+ *
117
+ * @since 1.0.0
118
+ *
119
+ * @param array $field
120
+ * @param array $deprecated
121
+ * @param array $form_data
122
+ */
123
+ public function field_display( $field, $deprecated, $form_data ) {
124
+
125
+ // Define data.
126
+ $primary = $field['properties']['inputs']['primary'];
127
+ $value = '';
128
+
129
+ if ( ! empty( $primary['attr']['value'] ) ) {
130
+ $value = $primary['attr']['value'];
131
+ unset( $primary['attr']['value'] );
132
+
133
+ $value = everest_forms_sanitize_textarea_field( $value );
134
+ }
135
+
136
+ // Primary field.
137
+ printf(
138
+ '<textarea %s %s>%s</textarea>',
139
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
140
+ $primary['required'],
141
+ $value
142
+ );
143
+ }
144
+ }
145
+
146
+ new EVF_Field_Textarea;
includes/form-fields/class-evf-field-url.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * URL field.
8
+ *
9
+ * @package EverestForms
10
+ * @author WPEverest
11
+ * @since 1.0.0
12
+ */
13
+ class EVF_Field_URL extends EVF_Form_Fields {
14
+
15
+ /**
16
+ * Primary class constructor.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ public function init() {
21
+
22
+ // Define field type information.
23
+ $this->name = __( 'Website', 'everest-forms' );
24
+ $this->type = 'url';
25
+ $this->icon = 'evf-icon evf-icon-website';
26
+ $this->order = 11;
27
+ $this->group = 'advanced';
28
+ }
29
+
30
+ /**
31
+ * Field options panel inside the builder.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param array $field
36
+ */
37
+ public function field_options( $field ) {
38
+
39
+ // -------------------------------------------------------------------//
40
+ // Basic field options.
41
+ // -------------------------------------------------------------------//
42
+
43
+ $args = array(
44
+ 'markup' => 'open',
45
+ );
46
+ $this->field_option( 'basic-options', $field, $args );
47
+
48
+ // Label.
49
+ $this->field_option( 'label', $field );
50
+
51
+ // Description.
52
+ $this->field_option( 'description', $field );
53
+
54
+ // Required toggle.
55
+ $this->field_option( 'required', $field );
56
+
57
+ // Options close markup.
58
+ $args = array(
59
+ 'markup' => 'close',
60
+ );
61
+ $this->field_option( 'basic-options', $field, $args );
62
+
63
+ // --------------------------------------------------------------------//
64
+ // Advanced field options.
65
+ // --------------------------------------------------------------------//
66
+
67
+ // Options open markup.
68
+ $args = array(
69
+ 'markup' => 'open',
70
+ );
71
+ $this->field_option( 'advanced-options', $field, $args );
72
+
73
+
74
+
75
+ // Placeholder.
76
+ $this->field_option( 'placeholder', $field );
77
+
78
+ // Hide label.
79
+ $this->field_option( 'label_hide', $field );
80
+
81
+
82
+ // Custom CSS classes.
83
+ $this->field_option( 'css', $field );
84
+
85
+ // Options close markup.
86
+ $args = array(
87
+ 'markup' => 'close',
88
+ );
89
+ $this->field_option( 'advanced-options', $field, $args );
90
+ }
91
+
92
+ /**
93
+ * Field preview inside the builder.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @param array $field
98
+ */
99
+ public function field_preview( $field ) {
100
+
101
+ // Define data.
102
+ $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '';
103
+
104
+ // Label.
105
+ $this->field_preview_option( 'label', $field );
106
+
107
+ // Primary input.
108
+ echo '<input type="url" placeholder="' . $placeholder . '" class="primary-input" disabled>';
109
+
110
+ // Description.
111
+ $this->field_preview_option( 'description', $field );
112
+ }
113
+
114
+ /**
115
+ * Field display on the form front-end.
116
+ *
117
+ * @since 1.0.0
118
+ *
119
+ * @param array $field
120
+ * @param array $deprecated
121
+ * @param array $form_data
122
+ */
123
+ public function field_display( $field, $deprecated, $form_data ) {
124
+
125
+ // Define data.
126
+ $primary = $field['properties']['inputs']['primary'];
127
+ // Primary field.
128
+ printf( '<input type="url" %s %s>',
129
+ evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
130
+ $primary['required']
131
+ );
132
+ }
133
+ }
134
+
135
+ new EVF_Field_URL;
includes/interfaces/class-evf-log-handler-interface.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * EVF Log Handler Interface
8
+ *
9
+ * Functions that must be defined to correctly fulfill log handler API.
10
+ *
11
+ * @version 1.0.0
12
+ * @category Interface
13
+ * @author WPEverest
14
+ */
15
+ interface EVF_Log_Handler_Interface {
16
+
17
+ /**
18
+ * Handle a log entry.
19
+ *
20
+ * @param int $timestamp Log timestamp.
21
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
22
+ * @param string $message Log message.
23
+ * @param array $context Additional information for log handlers.
24
+ *
25
+ * @return bool False if value was not handled and true if value was handled.
26
+ */
27
+ public function handle( $timestamp, $level, $message, $context );
28
+ }
includes/interfaces/class-evf-logger-interface.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * EVF Logger Interface
8
+ *
9
+ * Functions that must be defined to correctly fulfill logger API.
10
+ *
11
+ * @version 1.0.0
12
+ * @category Interface
13
+ * @author WPEverest
14
+ */
15
+ interface EVF_Logger_Interface {
16
+
17
+ /**
18
+ * Add a log entry.
19
+ *
20
+ * This is not the preferred method for adding log messages. Please use log() or any one of
21
+ * the level methods (debug(), info(), etc.). This method may be deprecated in the future.
22
+ *
23
+ * @param string $handle
24
+ * @param string $message
25
+ * @param string $level
26
+ *
27
+ * @return bool True if log was added, otherwise false.
28
+ */
29
+ public function add( $handle, $message, $level = EVF_Log_Levels::NOTICE );
30
+
31
+ /**
32
+ * Add a log entry.
33
+ *
34
+ * @param string $level One of the following:
35
+ * 'emergency': System is unusable.
36
+ * 'alert': Action must be taken immediately.
37
+ * 'critical': Critical conditions.
38
+ * 'error': Error conditions.
39
+ * 'warning': Warning conditions.
40
+ * 'notice': Normal but significant condition.
41
+ * 'info': Informational messages.
42
+ * 'debug': Debug-level messages.
43
+ * @param string $message Log message.
44
+ * @param array $context Optional. Additional information for log handlers.
45
+ */
46
+ public function log( $level, $message, $context = array() );
47
+
48
+ /**
49
+ * Adds an emergency level message.
50
+ *
51
+ * System is unusable.
52
+ *
53
+ * @param string $message Log message.
54
+ * @param array $context Optional. Additional information for log handlers.
55
+ */
56
+ public function emergency( $message, $context = array() );
57
+
58
+ /**
59
+ * Adds an alert level message.
60
+ *
61
+ * Action must be taken immediately.
62
+ * Example: Entire website down, database unavailable, etc.
63
+ *
64
+ * @param string $message Log message.
65
+ * @param array $context Optional. Additional information for log handlers.
66
+ */
67
+ public function alert( $message, $context = array() );
68
+
69
+ /**
70
+ * Adds a critical level message.
71
+ *
72
+ * Critical conditions.
73
+ * Example: Application component unavailable, unexpected exception.
74
+ *
75
+ * @param string $message Log message.
76
+ * @param array $context Optional. Additional information for log handlers.
77
+ */
78
+ public function critical( $message, $context = array() );
79
+
80
+ /**
81
+ * Adds an error level message.
82
+ *
83
+ * Runtime errors that do not require immediate action but should typically be logged
84
+ * and monitored.
85
+ *
86
+ * @param string $message Log message.
87
+ * @param array $context Optional. Additional information for log handlers.
88
+ */
89
+ public function error( $message, $context = array() );
90
+
91
+ /**
92
+ * Adds a warning level message.
93
+ *
94
+ * Exceptional occurrences that are not errors.
95
+ *
96
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
97
+ * necessarily wrong.
98
+ *
99
+ * @param string $message Log message.
100
+ * @param array $context Optional. Additional information for log handlers.
101
+ */
102
+ public function warning( $message, $context = array() );
103
+
104
+ /**
105
+ * Adds a notice level message.
106
+ *
107
+ * Normal but significant events.
108
+ *
109
+ * @param string $message Log message.
110
+ * @param array $context Optional. Additional information for log handlers.
111
+ */
112
+ public function notice( $message, $context = array() );
113
+
114
+ /**
115
+ * Adds a info level message.
116
+ *
117
+ * Interesting events.
118
+ * Example: User logs in, SQL logs.
119
+ *
120
+ * @param string $message Log message.
121
+ * @param array $context Optional. Additional information for log handlers.
122
+ */
123
+ public function info( $message, $context = array() );
124
+
125
+ /**
126
+ * Adds a debug level message.
127
+ *
128
+ * Detailed debug information.
129
+ *
130
+ * @param string $message Log message.
131
+ * @param array $context Optional. Additional information for log handlers.
132
+ */
133
+ public function debug( $message, $context = array() );
134
+ }
includes/libraries/class-emogrifier.php ADDED
@@ -0,0 +1,1555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class provides functions for converting CSS styles into inline style attributes in your HTML code.
4
+ *
5
+ * For more information, please see the README.md file.
6
+ *
7
+ * @version 1.2.0
8
+ *
9
+ * @author Cameron Brooks
10
+ * @author Jaime Prado
11
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
12
+ * @author Roman Ožana <ozana@omdesign.cz>
13
+ * @author Sander Kruger <s.kruger@invessel.com>
14
+ */
15
+ // @codingStandardsIgnoreFile
16
+ class Emogrifier
17
+ {
18
+ /**
19
+ * @var int
20
+ */
21
+ const CACHE_KEY_CSS = 0;
22
+
23
+ /**
24
+ * @var int
25
+ */
26
+ const CACHE_KEY_SELECTOR = 1;
27
+
28
+ /**
29
+ * @var int
30
+ */
31
+ const CACHE_KEY_XPATH = 2;
32
+
33
+ /**
34
+ * @var int
35
+ */
36
+ const CACHE_KEY_CSS_DECLARATIONS_BLOCK = 3;
37
+
38
+ /**
39
+ * @var int
40
+ */
41
+ const CACHE_KEY_COMBINED_STYLES = 4;
42
+
43
+ /**
44
+ * for calculating nth-of-type and nth-child selectors
45
+ *
46
+ * @var int
47
+ */
48
+ const INDEX = 0;
49
+
50
+ /**
51
+ * for calculating nth-of-type and nth-child selectors
52
+ *
53
+ * @var int
54
+ */
55
+ const MULTIPLIER = 1;
56
+
57
+ /**
58
+ * @var string
59
+ */
60
+ const ID_ATTRIBUTE_MATCHER = '/(\\w+)?\\#([\\w\\-]+)/';
61
+
62
+ /**
63
+ * @var string
64
+ */
65
+ const CLASS_ATTRIBUTE_MATCHER = '/(\\w+|[\\*\\]])?((\\.[\\w\\-]+)+)/';
66
+
67
+ /**
68
+ * @var string
69
+ */
70
+ const CONTENT_TYPE_META_TAG = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
71
+
72
+ /**
73
+ * @var string
74
+ */
75
+ const DEFAULT_DOCUMENT_TYPE = '<!DOCTYPE html>';
76
+
77
+ /**
78
+ * @var string
79
+ */
80
+ private $html = '';
81
+
82
+ /**
83
+ * @var string
84
+ */
85
+ private $css = '';
86
+
87
+ /**
88
+ * @var bool[]
89
+ */
90
+ private $excludedSelectors = array();
91
+
92
+ /**
93
+ * @var string[]
94
+ */
95
+ private $unprocessableHtmlTags = array( 'wbr' );
96
+
97
+ /**
98
+ * @var bool[]
99
+ */
100
+ private $allowedMediaTypes = array( 'all' => true, 'screen' => true, 'print' => true );
101
+
102
+ /**
103
+ * @var mixed[]
104
+ */
105
+ private $caches = array(
106
+ self::CACHE_KEY_CSS => array(),
107
+ self::CACHE_KEY_SELECTOR => array(),
108
+ self::CACHE_KEY_XPATH => array(),
109
+ self::CACHE_KEY_CSS_DECLARATIONS_BLOCK => array(),
110
+ self::CACHE_KEY_COMBINED_STYLES => array(),
111
+ );
112
+
113
+ /**
114
+ * the visited nodes with the XPath paths as array keys
115
+ *
116
+ * @var \DOMElement[]
117
+ */
118
+ private $visitedNodes = array();
119
+
120
+ /**
121
+ * the styles to apply to the nodes with the XPath paths as array keys for the outer array
122
+ * and the attribute names/values as key/value pairs for the inner array
123
+ *
124
+ * @var string[][]
125
+ */
126
+ private $styleAttributesForNodes = array();
127
+
128
+ /**
129
+ * Determines whether the "style" attributes of tags in the the HTML passed to this class should be preserved.
130
+ * If set to false, the value of the style attributes will be discarded.
131
+ *
132
+ * @var bool
133
+ */
134
+ private $isInlineStyleAttributesParsingEnabled = true;
135
+
136
+ /**
137
+ * Determines whether the <style> blocks in the HTML passed to this class should be parsed.
138
+ *
139
+ * If set to true, the <style> blocks will be removed from the HTML and their contents will be applied to the HTML
140
+ * via inline styles.
141
+ *
142
+ * If set to false, the <style> blocks will be left as they are in the HTML.
143
+ *
144
+ * @var bool
145
+ */
146
+ private $isStyleBlocksParsingEnabled = true;
147
+
148
+ /**
149
+ * Determines whether elements with the `display: none` property are
150
+ * removed from the DOM.
151
+ *
152
+ * @var bool
153
+ */
154
+ private $shouldKeepInvisibleNodes = true;
155
+
156
+ /**
157
+ * @var string[]
158
+ */
159
+ private $xPathRules = array(
160
+ // child
161
+ '/\\s*>\\s*/' => '/',
162
+ // adjacent sibling
163
+ '/\\s+\\+\\s+/' => '/following-sibling::*[1]/self::',
164
+ // descendant
165
+ '/\\s+(?=.*[^\\]]{1}$)/' => '//',
166
+ // :first-child
167
+ '/([^\\/]+):first-child/i' => '*[1]/self::\\1',
168
+ // :last-child
169
+ '/([^\\/]+):last-child/i' => '*[last()]/self::\\1',
170
+ // attribute only
171
+ '/^\\[(\\w+|\\w+\\=[\'"]?\\w+[\'"]?)\\]/' => '*[@\\1]',
172
+ // attribute
173
+ '/(\\w)\\[(\\w+)\\]/' => '\\1[@\\2]',
174
+ // exact attribute
175
+ '/(\\w)\\[(\\w+)\\=[\'"]?([\\w\\s]+)[\'"]?\\]/' => '\\1[@\\2="\\3"]',
176
+ // element attribute~=
177
+ '/([\\w\\*]+)\\[(\\w+)[\\s]*\\~\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/'
178
+ => '\\1[contains(concat(" ", @\\2, " "), concat(" ", "\\3", " "))]',
179
+ // element attribute^=
180
+ '/([\\w\\*]+)\\[(\\w+)[\\s]*\\^\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/' => '\\1[starts-with(@\\2, "\\3")]',
181
+ // element attribute*=
182
+ '/([\\w\\*]+)\\[(\\w+)[\\s]*\\*\\=[\\s]*[\'"]?([\\w-_\\s\\/:;]+)[\'"]?\\]/' => '\\1[contains(@\\2, "\\3")]',
183
+ // element attribute$=
184
+ '/([\\w\\*]+)\\[(\\w+)[\\s]*\\$\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/'
185
+ => '\\1[substring(@\\2, string-length(@\\2) - string-length("\\3") + 1) = "\\3"]',
186
+ // element attribute|=
187
+ '/([\\w\\*]+)\\[(\\w+)[\\s]*\\|\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/'
188
+ => '\\1[@\\2="\\3" or starts-with(@\\2, concat("\\3", "-"))]',
189
+ );
190
+
191
+ /**
192
+ * Determines whether CSS styles that have an equivalent HTML attribute
193
+ * should be mapped and attached to those elements.
194
+ *
195
+ * @var bool
196
+ */
197
+ private $shouldMapCssToHtml = false;
198
+
199
+ /**
200
+ * This multi-level array contains simple mappings of CSS properties to
201
+ * HTML attributes. If a mapping only applies to certain HTML nodes or
202
+ * only for certain values, the mapping is an object with a whitelist
203
+ * of nodes and values.
204
+ *
205
+ * @var mixed[][]
206
+ */
207
+ private $cssToHtmlMap = array(
208
+ 'background-color' => array(
209
+ 'attribute' => 'bgcolor',
210
+ ),
211
+ 'text-align' => array(
212
+ 'attribute' => 'align',
213
+ 'nodes' => array('p', 'div', 'td'),
214
+ 'values' => array('left', 'right', 'center', 'justify'),
215
+ ),
216
+ 'float' => array(
217
+ 'attribute' => 'align',
218
+ 'nodes' => array('table', 'img'),
219
+ 'values' => array('left', 'right'),
220
+ ),
221
+ 'border-spacing' => array(
222
+ 'attribute' => 'cellspacing',
223
+ 'nodes' => array('table'),
224
+ ),
225
+ );
226
+
227
+ public static $_media = '';
228
+
229
+ /**
230
+ * The constructor.
231
+ *
232
+ * @param string $html the HTML to emogrify, must be UTF-8-encoded
233
+ * @param string $css the CSS to merge, must be UTF-8-encoded
234
+ */
235
+ public function __construct($html = '', $css = '')
236
+ {
237
+ $this->setHtml($html);
238
+ $this->setCss($css);
239
+ }
240
+
241
+ /**
242
+ * The destructor.
243
+ */
244
+ public function __destruct()
245
+ {
246
+ $this->purgeVisitedNodes();
247
+ }
248
+
249
+ /**
250
+ * Sets the HTML to emogrify.
251
+ *
252
+ * @param string $html the HTML to emogrify, must be UTF-8-encoded
253
+ *
254
+ * @return void
255
+ */
256
+ public function setHtml($html)
257
+ {
258
+ $this->html = $html;
259
+ }
260
+
261
+ /**
262
+ * Sets the CSS to merge with the HTML.
263
+ *
264
+ * @param string $css the CSS to merge, must be UTF-8-encoded
265
+ *
266
+ * @return void
267
+ */
268
+ public function setCss($css)
269
+ {
270
+ $this->css = $css;
271
+ }
272
+
273
+ /**
274
+ * Applies $this->css to $this->html and returns the HTML with the CSS
275
+ * applied.
276
+ *
277
+ * This method places the CSS inline.
278
+ *
279
+ * @return string
280
+ *
281
+ * @throws \BadMethodCallException
282
+ */
283
+ public function emogrify()
284
+ {
285
+ if ($this->html === '') {
286
+ throw new BadMethodCallException('Please set some HTML first before calling emogrify.', 1390393096);
287
+ }
288
+
289
+ self::$_media = ''; // reset.
290
+
291
+ $xmlDocument = $this->createXmlDocument();
292
+ $this->process($xmlDocument);
293
+
294
+ return $xmlDocument->saveHTML();
295
+ }
296
+
297
+ /**
298
+ * Applies $this->css to $this->html and returns only the HTML content
299
+ * within the <body> tag.
300
+ *
301
+ * This method places the CSS inline.
302
+ *
303
+ * @return string
304
+ *
305
+ * @throws \BadMethodCallException
306
+ */
307
+ public function emogrifyBodyContent()
308
+ {
309
+ if ($this->html === '') {
310
+ throw new BadMethodCallException('Please set some HTML first before calling emogrify.', 1390393096);
311
+ }
312
+
313
+ $xmlDocument = $this->createXmlDocument();
314
+ $this->process($xmlDocument);
315
+
316
+ $innerDocument = new DOMDocument();
317
+ foreach ($xmlDocument->documentElement->getElementsByTagName('body')->item(0)->childNodes as $childNode) {
318
+ $innerDocument->appendChild($innerDocument->importNode($childNode, true));
319
+ }
320
+
321
+ return html_entity_decode($innerDocument->saveHTML());
322
+ }
323
+
324
+ /**
325
+ * Applies $this->css to $xmlDocument.
326
+ *
327
+ * This method places the CSS inline.
328
+ *
329
+ * @param \DOMDocument $xmlDocument
330
+ *
331
+ * @return void
332
+ *
333
+ * @throws \InvalidArgumentException
334
+ */
335
+ protected function process(DOMDocument $xmlDocument)
336
+ {
337
+ $xPath = new DOMXPath($xmlDocument);
338
+ $this->clearAllCaches();
339
+
340
+ // Before be begin processing the CSS file, parse the document and normalize all existing CSS attributes.
341
+ // This changes 'DISPLAY: none' to 'display: none'.
342
+ // We wouldn't have to do this if DOMXPath supported XPath 2.0.
343
+ // Also store a reference of nodes with existing inline styles so we don't overwrite them.
344
+ $this->purgeVisitedNodes();
345
+
346
+ set_error_handler(array($this, 'handleXpathError'), E_WARNING);
347
+
348
+ $nodesWithStyleAttributes = $xPath->query('//*[@style]');
349
+ if ($nodesWithStyleAttributes !== false) {
350
+ /** @var \DOMElement $node */
351
+ foreach ($nodesWithStyleAttributes as $node) {
352
+ if ($this->isInlineStyleAttributesParsingEnabled) {
353
+ $this->normalizeStyleAttributes($node);
354
+ } else {
355
+ $node->removeAttribute('style');
356
+ }
357
+ }
358
+ }
359
+
360
+ // grab any existing style blocks from the html and append them to the existing CSS
361
+ // (these blocks should be appended so as to have precedence over conflicting styles in the existing CSS)
362
+ $allCss = $this->css;
363
+
364
+ if ($this->isStyleBlocksParsingEnabled) {
365
+ $allCss .= $this->getCssFromAllStyleNodes($xPath);
366
+ }
367
+
368
+ $cssParts = $this->splitCssAndMediaQuery($allCss);
369
+ $excludedNodes = $this->getNodesToExclude($xPath);
370
+ $cssRules = $this->parseCssRules($cssParts['css']);
371
+ foreach ($cssRules as $cssRule) {
372
+ // query the body for the xpath selector
373
+ $nodesMatchingCssSelectors = $xPath->query($this->translateCssToXpath($cssRule['selector']));
374
+ // ignore invalid selectors
375
+ if ($nodesMatchingCssSelectors === false) {
376
+ continue;
377
+ }
378
+
379
+ /** @var \DOMElement $node */
380
+ foreach ($nodesMatchingCssSelectors as $node) {
381
+ if (in_array($node, $excludedNodes, true)) {
382
+ continue;
383
+ }
384
+
385
+ // if it has a style attribute, get it, process it, and append (overwrite) new stuff
386
+ if ($node->hasAttribute('style')) {
387
+ // break it up into an associative array
388
+ $oldStyleDeclarations = $this->parseCssDeclarationsBlock($node->getAttribute('style'));
389
+ } else {
390
+ $oldStyleDeclarations = array();
391
+ }
392
+ $newStyleDeclarations = $this->parseCssDeclarationsBlock($cssRule['declarationsBlock']);
393
+ if ($this->shouldMapCssToHtml) {
394
+ $this->mapCssToHtmlAttributes($newStyleDeclarations, $node);
395
+ }
396
+ $node->setAttribute(
397
+ 'style',
398
+ $this->generateStyleStringFromDeclarationsArrays($oldStyleDeclarations, $newStyleDeclarations)
399
+ );
400
+ }
401
+ }
402
+
403
+ restore_error_handler();
404
+
405
+ if ($this->isInlineStyleAttributesParsingEnabled) {
406
+ $this->fillStyleAttributesWithMergedStyles();
407
+ }
408
+
409
+ if ($this->shouldKeepInvisibleNodes) {
410
+ $this->removeInvisibleNodes($xPath);
411
+ }
412
+
413
+ $this->copyCssWithMediaToStyleNode($xmlDocument, $xPath, $cssParts['media']);
414
+ }
415
+
416
+ /**
417
+ * Applies $styles to $node.
418
+ *
419
+ * This method maps CSS styles to HTML attributes and adds those to the
420
+ * node.
421
+ *
422
+ * @param string[] $styles the new CSS styles taken from the global styles to be applied to this node
423
+ * @param \DOMNode $node node to apply styles to
424
+ *
425
+ * @return void
426
+ */
427
+ private function mapCssToHtmlAttributes(array $styles, DOMNode $node)
428
+ {
429
+ foreach ($styles as $property => $value) {
430
+ // Strip !important indicator
431
+ $value = trim(str_replace('!important', '', $value));
432
+ $this->mapCssToHtmlAttribute($property, $value, $node);
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Tries to apply the CSS style to $node as an attribute.
438
+ *
439
+ * This method maps a CSS rule to HTML attributes and adds those to the node.
440
+ *
441
+ * @param string $property the name of the CSS property to map
442
+ * @param string $value the value of the style rule to map
443
+ * @param \DOMNode $node node to apply styles to
444
+ *
445
+ * @return void
446
+ */
447
+ private function mapCssToHtmlAttribute($property, $value, DOMNode $node)
448
+ {
449
+ if (!$this->mapSimpleCssProperty($property, $value, $node)) {
450
+ $this->mapComplexCssProperty($property, $value, $node);
451
+ }
452
+ }
453
+
454
+ /**
455
+ * Looks up the CSS property in the mapping table and maps it if it matches the conditions.
456
+ *
457
+ * @param string $property the name of the CSS property to map
458
+ * @param string $value the value of the style rule to map
459
+ * @param \DOMNode $node node to apply styles to
460
+ *
461
+ * @return bool true if the property cab be mapped using the simple mapping table
462
+ */
463
+ private function mapSimpleCssProperty($property, $value, DOMNode $node)
464
+ {
465
+ if (!isset($this->cssToHtmlMap[$property])) {
466
+ return false;
467
+ }
468
+
469
+ $mapping = $this->cssToHtmlMap[$property];
470
+ $nodesMatch = !isset($mapping['nodes']) || in_array($node->nodeName, $mapping['nodes'], true);
471
+ $valuesMatch = !isset($mapping['values']) || in_array($value, $mapping['values'], true);
472
+ if (!$nodesMatch || !$valuesMatch) {
473
+ return false;
474
+ }
475
+
476
+ $node->setAttribute($mapping['attribute'], $value);
477
+
478
+ return true;
479
+ }
480
+
481
+ /**
482
+ * Maps CSS properties that need special transformation to an HTML attribute.
483
+ *
484
+ * @param string $property the name of the CSS property to map
485
+ * @param string $value the value of the style rule to map
486
+ * @param \DOMNode $node node to apply styles to
487
+ *
488
+ * @return void
489
+ */
490
+ private function mapComplexCssProperty($property, $value, DOMNode $node)
491
+ {
492
+ $nodeName = $node->nodeName;
493
+ $isTable = $nodeName === 'table';
494
+ $isImage = $nodeName === 'img';
495
+ $isTableOrImage = $isTable || $isImage;
496
+
497
+ switch ($property) {
498
+ case 'background':
499
+ // Parse out the color, if any
500
+ $styles = explode(' ', $value);
501
+ $first = $styles[0];
502
+ if (!is_numeric(substr($first, 0, 1)) && substr($first, 0, 3) !== 'url') {
503
+ // This is not a position or image, assume it's a color
504
+ $node->setAttribute('bgcolor', $first);
505
+ }
506
+ break;
507
+ case 'width':
508
+ // intentional fall-through
509
+ case 'height':
510
+ // Only parse values in px and %, but not values like "auto".
511
+ if (preg_match('/^\d+(px|%)$/', $value)) {
512
+ // Remove 'px'. This regex only conserves numbers and %
513
+ $number = preg_replace('/[^0-9.%]/', '', $value);
514
+ $node->setAttribute($property, $number);
515
+ }
516
+ break;
517
+ case 'margin':
518
+ if ($isTableOrImage) {
519
+ $margins = $this->parseCssShorthandValue($value);
520
+ if ($margins['left'] === 'auto' && $margins['right'] === 'auto') {
521
+ $node->setAttribute('align', 'center');
522
+ }
523
+ }
524
+ break;
525
+ case 'border':
526
+ if ($isTableOrImage) {
527
+ if ($value === 'none' || $value === '0') {
528
+ $node->setAttribute('border', '0');
529
+ }
530
+ }
531
+ break;
532
+ default:
533
+ }
534
+ }
535
+
536
+ /**
537
+ * Parses a shorthand CSS value and splits it into individual values
538
+ *
539
+ * @param string $value a string of CSS value with 1, 2, 3 or 4 sizes
540
+ * For example: padding: 0 auto;
541
+ * '0 auto' is split into top: 0, left: auto, bottom: 0,
542
+ * right: auto.
543
+ *
544
+ * @return string[] an array of values for top, right, bottom and left (using these as associative array keys)
545
+ */
546
+ private function parseCssShorthandValue($value)
547
+ {
548
+ $values = preg_split('/\\s+/', $value);
549
+
550
+ $css = array();
551
+ $css['top'] = $values[0];
552
+ $css['right'] = (count($values) > 1) ? $values[1] : $css['top'];
553
+ $css['bottom'] = (count($values) > 2) ? $values[2] : $css['top'];
554
+ $css['left'] = (count($values) > 3) ? $values[3] : $css['right'];
555
+
556
+ return $css;
557
+ }
558
+
559
+ /**
560
+ * Extracts and parses the individual rules from a CSS string.
561
+ *
562
+ * @param string $css a string of raw CSS code
563
+ *
564
+ * @return string[][] an array of string sub-arrays with the keys
565
+ * "selector" (the CSS selector(s), e.g., "*" or "h1"),
566
+ * "declarationsBLock" (the semicolon-separated CSS declarations for that selector(s),
567
+ * e.g., "color: red; height: 4px;"),
568
+ * and "line" (the line number e.g. 42)
569
+ */
570
+ private function parseCssRules($css)
571
+ {
572
+ $cssKey = md5($css);
573
+ if (!isset($this->caches[self::CACHE_KEY_CSS][$cssKey])) {
574
+ // process the CSS file for selectors and definitions
575
+ preg_match_all('/(?:^|[\\s^{}]*)([^{]+){([^}]*)}/mis', $css, $matches, PREG_SET_ORDER);
576
+
577
+ $cssRules = array();
578
+ /** @var string[] $cssRule */
579
+ foreach ($matches as $key => $cssRule) {
580
+ $cssDeclaration = trim($cssRule[2]);
581
+ if ($cssDeclaration === '') {
582
+ continue;
583
+ }
584
+
585
+ $selectors = explode(',', $cssRule[1]);
586
+ foreach ($selectors as $selector) {
587
+ // don't process pseudo-elements and behavioral (dynamic) pseudo-classes;
588
+ // only allow structural pseudo-classes
589
+ $hasPseudoElement = strpos($selector, '::') !== false;
590
+ $hasAnyPseudoClass = (bool) preg_match('/:[a-zA-Z]/', $selector);
591
+ $hasSupportedPseudoClass = (bool) preg_match('/:\\S+\\-(child|type\\()/i', $selector);
592
+ if ($hasPseudoElement || ($hasAnyPseudoClass && !$hasSupportedPseudoClass)) {
593
+ continue;
594
+ }
595
+
596
+ $cssRules[] = array(
597
+ 'selector' => trim($selector),
598
+ 'declarationsBlock' => $cssDeclaration,
599
+ // keep track of where it appears in the file, since order is important
600
+ 'line' => $key,
601
+ );
602
+ }
603
+ }
604
+
605
+ usort($cssRules, array($this, 'sortBySelectorPrecedence'));
606
+
607
+ $this->caches[self::CACHE_KEY_CSS][$cssKey] = $cssRules;
608
+ }
609
+
610
+ return $this->caches[self::CACHE_KEY_CSS][$cssKey];
611
+ }
612
+
613
+ /**
614
+ * Disables the parsing of inline styles.
615
+ *
616
+ * @return void
617
+ */
618
+ public function disableInlineStyleAttributesParsing()
619
+ {
620
+ $this->isInlineStyleAttributesParsingEnabled = false;
621
+ }
622
+
623
+ /**
624
+ * Disables the parsing of <style> blocks.
625
+ *
626
+ * @return void
627
+ */
628
+ public function disableStyleBlocksParsing()
629
+ {
630
+ $this->isStyleBlocksParsingEnabled = false;
631
+ }
632
+
633
+ /**
634
+ * Disables the removal of elements with `display: none` properties.
635
+ *
636
+ * @return void
637
+ */
638
+ public function disableInvisibleNodeRemoval()
639
+ {
640
+ $this->shouldKeepInvisibleNodes = false;
641
+ }
642
+
643
+ /**
644
+ * Enables the attachment/override of HTML attributes for which a
645
+ * corresponding CSS property has been set.
646
+ *
647
+ * @return void
648
+ */
649
+ public function enableCssToHtmlMapping()
650
+ {
651
+ $this->shouldMapCssToHtml = true;
652
+ }
653
+
654
+ /**
655
+ * Clears all caches.
656
+ *
657
+ * @return void
658
+ */
659
+ private function clearAllCaches()
660
+ {
661
+ $this->clearCache(self::CACHE_KEY_CSS);
662
+ $this->clearCache(self::CACHE_KEY_SELECTOR);
663
+ $this->clearCache(self::CACHE_KEY_XPATH);
664
+ $this->clearCache(self::CACHE_KEY_CSS_DECLARATIONS_BLOCK);
665
+ $this->clearCache(self::CACHE_KEY_COMBINED_STYLES);
666
+ }
667
+
668
+ /**
669
+ * Clears a single cache by key.
670
+ *
671
+ * @param int $key the cache key, must be CACHE_KEY_CSS, CACHE_KEY_SELECTOR, CACHE_KEY_XPATH
672
+ * or CACHE_KEY_CSS_DECLARATION_BLOCK
673
+ *
674
+ * @return void
675
+ *
676
+ * @throws \InvalidArgumentException
677
+ */
678
+ private function clearCache($key)
679
+ {
680
+ $allowedCacheKeys = array(
681
+ self::CACHE_KEY_CSS,
682
+ self::CACHE_KEY_SELECTOR,
683
+ self::CACHE_KEY_XPATH,
684
+ self::CACHE_KEY_CSS_DECLARATIONS_BLOCK,
685
+ self::CACHE_KEY_COMBINED_STYLES,
686
+ );
687
+ if (!in_array($key, $allowedCacheKeys, true)) {
688
+ throw new InvalidArgumentException('Invalid cache key: ' . $key, 1391822035);
689
+ }
690
+
691
+ $this->caches[$key] = array();
692
+ }
693
+
694
+ /**
695
+ * Purges the visited nodes.
696
+ *
697
+ * @return void
698
+ */
699
+ private function purgeVisitedNodes()
700
+ {
701
+ $this->visitedNodes = array();
702
+ $this->styleAttributesForNodes = array();
703
+ }
704
+
705
+ /**
706
+ * Marks a tag for removal.
707
+ *
708
+ * There are some HTML tags that DOMDocument cannot process, and it will throw an error if it encounters them.
709
+ * In particular, DOMDocument will complain if you try to use HTML5 tags in an XHTML document.
710
+ *
711
+ * Note: The tags will not be removed if they have any content.
712
+ *
713
+ * @param string $tagName the tag name, e.g., "p"
714
+ *
715
+ * @return void
716
+ */
717
+ public function addUnprocessableHtmlTag($tagName)
718
+ {
719
+ $this->unprocessableHtmlTags[] = $tagName;
720
+ }
721
+
722
+ /**
723
+ * Drops a tag from the removal list.
724
+ *
725
+ * @param string $tagName the tag name, e.g., "p"
726
+ *
727
+ * @return void
728
+ */
729
+ public function removeUnprocessableHtmlTag($tagName)
730
+ {
731
+ $key = array_search($tagName, $this->unprocessableHtmlTags, true);
732
+ if ($key !== false) {
733
+ unset($this->unprocessableHtmlTags[$key]);
734
+ }
735
+ }
736
+
737
+ /**
738
+ * Marks a media query type to keep.
739
+ *
740
+ * @param string $mediaName the media type name, e.g., "braille"
741
+ *
742
+ * @return void
743
+ */
744
+ public function addAllowedMediaType($mediaName)
745
+ {
746
+ $this->allowedMediaTypes[$mediaName] = true;
747
+ }
748
+
749
+ /**
750
+ * Drops a media query type from the allowed list.
751
+ *
752
+ * @param string $mediaName the tag name, e.g., "braille"
753
+ *
754
+ * @return void
755
+ */
756
+ public function removeAllowedMediaType($mediaName)
757
+ {
758
+ if (isset($this->allowedMediaTypes[$mediaName])) {
759
+ unset($this->allowedMediaTypes[$mediaName]);
760
+ }
761
+ }
762
+
763
+ /**
764
+ * Adds a selector to exclude nodes from emogrification.
765
+ *
766
+ * Any nodes that match the selector will not have their style altered.
767
+ *
768
+ * @param string $selector the selector to exclude, e.g., ".editor"
769
+ *
770
+ * @return void
771
+ */
772
+ public function addExcludedSelector($selector)
773
+ {
774
+ $this->excludedSelectors[$selector] = true;
775
+ }
776
+
777
+ /**
778
+ * No longer excludes the nodes matching this selector from emogrification.
779
+ *
780
+ * @param string $selector the selector to no longer exclude, e.g., ".editor"
781
+ *
782
+ * @return void
783
+ */
784
+ public function removeExcludedSelector($selector)
785
+ {
786
+ if (isset($this->excludedSelectors[$selector])) {
787
+ unset($this->excludedSelectors[$selector]);
788
+ }
789
+ }
790
+
791
+ /**
792
+ * This removes styles from your email that contain display:none.
793
+ * We need to look for display:none, but we need to do a case-insensitive search. Since DOMDocument only
794
+ * supports XPath 1.0, lower-case() isn't available to us. We've thus far only set attributes to lowercase,
795
+ * not attribute values. Consequently, we need to translate() the letters that would be in 'NONE' ("NOE")
796
+ * to lowercase.
797
+ *
798
+ * @param \DOMXPath $xPath
799
+ *
800
+ * @return void
801
+ */
802
+ private function removeInvisibleNodes(DOMXPath $xPath)
803
+ {
804
+ $nodesWithStyleDisplayNone = $xPath->query(
805
+ '//*[contains(translate(translate(@style," ",""),"NOE","noe"),"display:none")]'
806
+ );
807
+ if ($nodesWithStyleDisplayNone->length === 0) {
808
+ return;
809
+ }
810
+
811
+ // The checks on parentNode and is_callable below ensure that if we've deleted the parent node,
812
+ // we don't try to call removeChild on a nonexistent child node
813
+ /** @var \DOMNode $node */
814
+ foreach ($nodesWithStyleDisplayNone as $node) {
815
+ if ($node->parentNode && is_callable(array($node->parentNode, 'removeChild'))) {
816
+ $node->parentNode->removeChild($node);
817
+ }
818
+ }
819
+ }
820
+
821
+ private function normalizeStyleAttributes_callback( $m ) {
822
+ return strtolower( $m[0] );
823
+ }
824
+
825
+ /**
826
+ * Normalizes the value of the "style" attribute and saves it.
827
+ *
828
+ * @param \DOMElement $node
829
+ *
830
+ * @return void
831
+ */
832
+ private function normalizeStyleAttributes(DOMElement $node)
833
+ {
834
+ $normalizedOriginalStyle = preg_replace_callback(
835
+ '/[A-z\\-]+(?=\\:)/S',
836
+ array( $this, 'normalizeStyleAttributes_callback' ),
837
+ $node->getAttribute('style')
838
+ );
839
+
840
+ // in order to not overwrite existing style attributes in the HTML, we
841
+ // have to save the original HTML styles
842
+ $nodePath = $node->getNodePath();
843
+ if (!isset($this->styleAttributesForNodes[$nodePath])) {
844
+ $this->styleAttributesForNodes[$nodePath] = $this->parseCssDeclarationsBlock($normalizedOriginalStyle);
845
+ $this->visitedNodes[$nodePath] = $node;
846
+ }
847
+
848
+ $node->setAttribute('style', $normalizedOriginalStyle);
849
+ }
850
+
851
+ /**
852
+ * Merges styles from styles attributes and style nodes and applies them to the attribute nodes
853
+ *
854
+ * @return void
855
+ */
856
+ private function fillStyleAttributesWithMergedStyles()
857
+ {
858
+ foreach ($this->styleAttributesForNodes as $nodePath => $styleAttributesForNode) {
859
+ $node = $this->visitedNodes[$nodePath];
860
+ $currentStyleAttributes = $this->parseCssDeclarationsBlock($node->getAttribute('style'));
861
+ $node->setAttribute(
862
+ 'style',
863
+ $this->generateStyleStringFromDeclarationsArrays(
864
+ $currentStyleAttributes,
865
+ $styleAttributesForNode
866
+ )
867
+ );
868
+ }
869
+ }
870
+
871
+ /**
872
+ * This method merges old or existing name/value array with new name/value array
873
+ * and then generates a string of the combined style suitable for placing inline.
874
+ * This becomes the single point for CSS string generation allowing for consistent
875
+ * CSS output no matter where the CSS originally came from.
876
+ *
877
+ * @param string[] $oldStyles
878
+ * @param string[] $newStyles
879
+ *
880
+ * @return string
881
+ */
882
+ private function generateStyleStringFromDeclarationsArrays(array $oldStyles, array $newStyles)
883
+ {
884
+ $combinedStyles = array_merge($oldStyles, $newStyles);
885
+ $cacheKey = serialize($combinedStyles);
886
+ if (isset($this->caches[self::CACHE_KEY_COMBINED_STYLES][$cacheKey])) {
887
+ return $this->caches[self::CACHE_KEY_COMBINED_STYLES][$cacheKey];
888
+ }
889
+
890
+ foreach ($oldStyles as $attributeName => $attributeValue) {
891
+ if (!isset($newStyles[$attributeName])) {
892
+ continue;
893
+ }
894
+
895
+ $newAttributeValue = $newStyles[$attributeName];
896
+ if ($this->attributeValueIsImportant($attributeValue)
897
+ && !$this->attributeValueIsImportant($newAttributeValue)
898
+ ) {
899
+ $combinedStyles[$attributeName] = $attributeValue;
900
+ }
901
+ }
902
+
903
+ $style = '';
904
+ foreach ($combinedStyles as $attributeName => $attributeValue) {
905
+ $style .= strtolower(trim($attributeName)) . ': ' . trim($attributeValue) . '; ';
906
+ }
907
+ $trimmedStyle = rtrim($style);
908
+
909
+ $this->caches[self::CACHE_KEY_COMBINED_STYLES][$cacheKey] = $trimmedStyle;
910
+
911
+ return $trimmedStyle;
912
+ }
913
+
914
+ /**
915
+ * Checks whether $attributeValue is marked as !important.
916
+ *
917
+ * @param string $attributeValue
918
+ *
919
+ * @return bool
920
+ */
921
+ private function attributeValueIsImportant($attributeValue)
922
+ {
923
+ return strtolower(substr(trim($attributeValue), -10)) === '!important';
924
+ }
925
+
926
+ /**
927
+ * Applies $css to $xmlDocument, limited to the media queries that actually apply to the document.
928
+ *
929
+ * @param \DOMDocument $xmlDocument the document to match against
930
+ * @param \DOMXPath $xPath
931
+ * @param string $css a string of CSS
932
+ *
933
+ * @return void
934
+ */
935
+ private function copyCssWithMediaToStyleNode(DOMDocument $xmlDocument, DOMXPath $xPath, $css)
936
+ {
937
+ if ($css === '') {
938
+ return;
939
+ }
940
+
941
+ $mediaQueriesRelevantForDocument = array();
942
+
943
+ foreach ($this->extractMediaQueriesFromCss($css) as $mediaQuery) {
944
+ foreach ($this->parseCssRules($mediaQuery['css']) as $selector) {
945
+ if ($this->existsMatchForCssSelector($xPath, $selector['selector'])) {
946
+ $mediaQueriesRelevantForDocument[] = $mediaQuery['query'];
947
+ break;
948
+ }
949
+ }
950
+ }
951
+
952
+ $this->addStyleElementToDocument($xmlDocument, implode($mediaQueriesRelevantForDocument));
953
+ }
954
+
955
+ /**
956
+ * Extracts the media queries from $css while skipping empty media queries.
957
+ *
958
+ * @param string $css
959
+ *
960
+ * @return string[][] numeric array with string sub-arrays with the keys "css" and "query"
961
+ */
962
+ private function extractMediaQueriesFromCss($css)
963
+ {
964
+ preg_match_all('/@media\\b[^{]*({((?:[^{}]+|(?1))*)})/', $css, $rawMediaQueries, PREG_SET_ORDER);
965
+ $parsedQueries = array();
966
+
967
+ foreach ($rawMediaQueries as $mediaQuery) {
968
+ if ($mediaQuery[2] !== '') {
969
+ $parsedQueries[] = array(
970
+ 'css' => $mediaQuery[2],
971
+ 'query' => $mediaQuery[0],
972
+ );
973
+ }
974
+ }
975
+
976
+ return $parsedQueries;
977
+ }
978
+
979
+ /**
980
+ * Checks whether there is at least one matching element for $cssSelector.
981
+ *
982
+ * @param \DOMXPath $xPath
983
+ * @param string $cssSelector
984
+ *
985
+ * @return bool
986
+ */
987
+ private function existsMatchForCssSelector(DOMXPath $xPath, $cssSelector)
988
+ {
989
+ $nodesMatchingSelector = $xPath->query($this->translateCssToXpath($cssSelector));
990
+
991
+ return $nodesMatchingSelector !== false && $nodesMatchingSelector->length !== 0;
992
+ }
993
+
994
+ /**
995
+ * Returns CSS content.
996
+ *
997
+ * @param \DOMXPath $xPath
998
+ *
999
+ * @return string
1000
+ */
1001
+ private function getCssFromAllStyleNodes(DOMXPath $xPath)
1002
+ {
1003
+ $styleNodes = $xPath->query('//style');
1004
+
1005
+ if ($styleNodes === false) {
1006
+ return '';
1007
+ }
1008
+
1009
+ $css = '';
1010
+ /** @var \DOMNode $styleNode */
1011
+ foreach ($styleNodes as $styleNode) {
1012
+ $css .= "\n\n" . $styleNode->nodeValue;
1013
+ $styleNode->parentNode->removeChild($styleNode);
1014
+ }
1015
+
1016
+ return $css;
1017
+ }
1018
+
1019
+ /**
1020
+ * Adds a style element with $css to $document.
1021
+ *
1022
+ * This method is protected to allow overriding.
1023
+ *
1024
+ * @see https://github.com/jjriv/emogrifier/issues/103
1025
+ *
1026
+ * @param \DOMDocument $document
1027
+ * @param string $css
1028
+ *
1029
+ * @return void
1030
+ */
1031
+ protected function addStyleElementToDocument(DOMDocument $document, $css)
1032
+ {
1033
+ $styleElement = $document->createElement('style', $css);
1034
+ $styleAttribute = $document->createAttribute('type');
1035
+ $styleAttribute->value = 'text/css';
1036
+ $styleElement->appendChild($styleAttribute);
1037
+
1038
+ $head = $this->getOrCreateHeadElement($document);
1039
+ $head->appendChild($styleElement);
1040
+ }
1041
+
1042
+ /**
1043
+ * Returns the existing or creates a new head element in $document.
1044
+ *
1045
+ * @param \DOMDocument $document
1046
+ *
1047
+ * @return \DOMNode the head element
1048
+ */
1049
+ private function getOrCreateHeadElement(DOMDocument $document)
1050
+ {
1051
+ $head = $document->getElementsByTagName('head')->item(0);
1052
+
1053
+ if ($head === null) {
1054
+ $head = $document->createElement('head');
1055
+ $html = $document->getElementsByTagName('html')->item(0);
1056
+ $html->insertBefore($head, $document->getElementsByTagName('body')->item(0));
1057
+ }
1058
+
1059
+ return $head;
1060
+ }
1061
+
1062
+ /**
1063
+ * Splits input CSS code to an array where:
1064
+ *
1065
+ * - key "css" will be contains clean CSS code
1066
+ * - key "media" will be contains all valuable media queries
1067
+ *
1068
+ * Example:
1069
+ *
1070
+ * The CSS code
1071
+ *
1072
+ * "@import "file.css"; h1 { color:red; } @media { h1 {}} @media tv { h1 {}}"
1073
+ *
1074
+ * will be parsed into the following array:
1075
+ *
1076
+ * "css" => "h1 { color:red; }"
1077
+ * "media" => "@media { h1 {}}"
1078
+ *
1079
+ * @param string $css
1080
+ *
1081
+ * @return string[]
1082
+ */
1083
+ private function splitCssAndMediaQuery($css)
1084
+ {
1085
+ $cssWithoutComments = preg_replace('/\\/\\*.*\\*\\//sU', '', $css);
1086
+
1087
+ $mediaTypesExpression = '';
1088
+ if (!empty($this->allowedMediaTypes)) {
1089
+ $mediaTypesExpression = '|' . implode('|', array_keys($this->allowedMediaTypes));
1090
+ }
1091
+
1092
+ $cssForAllowedMediaTypes = preg_replace_callback(
1093
+ '#@media\\s+(?:only\\s)?(?:[\\s{\\(]' . $mediaTypesExpression . ')\\s?[^{]+{.*}\\s*}\\s*#misU',
1094
+ array( $this, '_media_concat' ),
1095
+ $cssWithoutComments
1096
+ );
1097
+
1098
+ // filter the CSS
1099
+ $search = array(
1100
+ 'import directives' => '/^\\s*@import\\s[^;]+;/misU',
1101
+ 'remaining media enclosures' => '/^\\s*@media\\s[^{]+{(.*)}\\s*}\\s/misU',
1102
+ );
1103
+
1104
+ $cleanedCss = preg_replace($search, '', $cssForAllowedMediaTypes);
1105
+
1106
+ return array('css' => $cleanedCss, 'media' => self::$_media);
1107
+ }
1108
+
1109
+ private function _media_concat( $matches ) {
1110
+ self::$_media .= $matches[0];
1111
+ }
1112
+
1113
+ /**
1114
+ * Creates a DOMDocument instance with the current HTML.
1115
+ *
1116
+ * @return \DOMDocument
1117
+ */
1118
+ private function createXmlDocument()
1119
+ {
1120
+ $xmlDocument = new DOMDocument;
1121
+ $xmlDocument->encoding = 'UTF-8';
1122
+ $xmlDocument->strictErrorChecking = false;
1123
+ $xmlDocument->formatOutput = true;
1124
+ $libXmlState = libxml_use_internal_errors(true);
1125
+ $xmlDocument->loadHTML($this->getUnifiedHtml());
1126
+ libxml_clear_errors();
1127
+ libxml_use_internal_errors($libXmlState);
1128
+ $xmlDocument->normalizeDocument();
1129
+
1130
+ return $xmlDocument;
1131
+ }
1132
+
1133
+ /**
1134
+ * Returns the HTML with the unprocessable HTML tags removed and
1135
+ * with added document type and Content-Type meta tag if needed.
1136
+ *
1137
+ * @return string the unified HTML
1138
+ *
1139
+ * @throws \BadMethodCallException
1140
+ */
1141
+ private function getUnifiedHtml()
1142
+ {
1143
+ $htmlWithoutUnprocessableTags = $this->removeUnprocessableTags($this->html);
1144
+ $htmlWithDocumentType = $this->ensureDocumentType($htmlWithoutUnprocessableTags);
1145
+
1146
+ return $this->addContentTypeMetaTag($htmlWithDocumentType);
1147
+ }
1148
+
1149
+ /**
1150
+ * Removes the unprocessable tags from $html (if this feature is enabled).
1151
+ *
1152
+ * @param string $html
1153
+ *
1154
+ * @return string the reworked HTML with the unprocessable tags removed
1155
+ */
1156
+ private function removeUnprocessableTags($html)
1157
+ {
1158
+ if (empty($this->unprocessableHtmlTags)) {
1159
+ return $html;
1160
+ }
1161
+
1162
+ $unprocessableHtmlTags = implode('|', $this->unprocessableHtmlTags);
1163
+
1164
+ return preg_replace(
1165
+ '/<\\/?(' . $unprocessableHtmlTags . ')[^>]*>/i',
1166
+ '',
1167
+ $html
1168
+ );
1169
+ }
1170
+
1171
+ /**
1172
+ * Makes sure that the passed HTML has a document type.
1173
+ *
1174
+ * @param string $html
1175
+ *
1176
+ * @return string HTML with document type
1177
+ */
1178
+ private function ensureDocumentType($html)
1179
+ {
1180
+ $hasDocumentType = stripos($html, '<!DOCTYPE') !== false;
1181
+ if ($hasDocumentType) {
1182
+ return $html;
1183
+ }
1184
+
1185
+ return self::DEFAULT_DOCUMENT_TYPE . $html;
1186
+ }
1187
+
1188
+ /**
1189
+ * Adds a Content-Type meta tag for the charset.
1190
+ *
1191
+ * @param string $html
1192
+ *
1193
+ * @return string the HTML with the meta tag added
1194
+ */
1195
+ private function addContentTypeMetaTag($html)
1196
+ {
1197
+ $hasContentTypeMetaTag = stristr($html, 'Content-Type') !== false;
1198
+ if ($hasContentTypeMetaTag) {
1199
+ return $html;
1200
+ }
1201
+
1202
+ // We are trying to insert the meta tag to the right spot in the DOM.
1203
+ // If we just prepended it to the HTML, we would lose attributes set to the HTML tag.
1204
+ $hasHeadTag = stripos($html, '<head') !== false;
1205
+ $hasHtmlTag = stripos($html, '<html') !== false;
1206
+
1207
+ if ($hasHeadTag) {
1208
+ $reworkedHtml = preg_replace('/<head(.*?)>/i', '<head$1>' . self::CONTENT_TYPE_META_TAG, $html);
1209
+ } elseif ($hasHtmlTag) {
1210
+ $reworkedHtml = preg_replace(
1211
+ '/<html(.*?)>/i',
1212
+ '<html$1><head>' . self::CONTENT_TYPE_META_TAG . '</head>',
1213
+ $html
1214
+ );
1215
+ } else {
1216
+ $reworkedHtml = self::CONTENT_TYPE_META_TAG . $html;
1217
+ }
1218
+
1219
+ return $reworkedHtml;
1220
+ }
1221
+
1222
+ /**
1223
+ * @param string[] $a
1224
+ * @param string[] $b
1225
+ *
1226
+ * @return int
1227
+ */
1228
+ private function sortBySelectorPrecedence(array $a, array $b)
1229
+ {
1230
+ $precedenceA = $this->getCssSelectorPrecedence($a['selector']);
1231
+ $precedenceB = $this->getCssSelectorPrecedence($b['selector']);
1232
+
1233
+ // We want these sorted in ascending order so selectors with lesser precedence get processed first and
1234
+ // selectors with greater precedence get sorted last.
1235
+ $precedenceForEquals = ($a['line'] < $b['line'] ? -1 : 1);
1236
+ $precedenceForNotEquals = ($precedenceA < $precedenceB ? -1 : 1);
1237
+ return ($precedenceA === $precedenceB) ? $precedenceForEquals : $precedenceForNotEquals;
1238
+ }
1239
+
1240
+ /**
1241
+ * @param string $selector
1242
+ *
1243
+ * @return int
1244
+ */
1245
+ private function getCssSelectorPrecedence($selector)
1246
+ {
1247
+ $selectorKey = md5($selector);
1248
+ if (!isset($this->caches[self::CACHE_KEY_SELECTOR][$selectorKey])) {
1249
+ $precedence = 0;
1250
+ $value = 100;
1251
+ // ids: worth 100, classes: worth 10, elements: worth 1
1252
+ $search = array('\\#','\\.','');
1253
+
1254
+ foreach ($search as $s) {
1255
+ if (trim($selector) === '') {
1256
+ break;
1257
+ }
1258
+ $number = 0;
1259
+ $selector = preg_replace('/' . $s . '\\w+/', '', $selector, -1, $number);
1260
+ $precedence += ($value * $number);
1261
+ $value /= 10;
1262
+ }
1263
+ $this->caches[self::CACHE_KEY_SELECTOR][$selectorKey] = $precedence;
1264
+ }
1265
+
1266
+ return $this->caches[self::CACHE_KEY_SELECTOR][$selectorKey];
1267
+ }
1268
+
1269
+ private function translateCssToXpath_callback( $matches ) {
1270
+ return strtolower($matches[0]);
1271
+ }
1272
+
1273
+ /**
1274
+ * Maps a CSS selector to an XPath query string.
1275
+ *
1276
+ * @see http://plasmasturm.org/log/444/
1277
+ *
1278
+ * @param string $cssSelector a CSS selector
1279
+ *
1280
+ * @return string the corresponding XPath selector
1281
+ */
1282
+ private function translateCssToXpath($cssSelector)
1283
+ {
1284
+ $paddedSelector = ' ' . $cssSelector . ' ';
1285
+ $lowercasePaddedSelector = preg_replace_callback(
1286
+ '/\\s+\\w+\\s+/',
1287
+ array( $this, 'translateCssToXpath_callback' ),
1288
+ $paddedSelector
1289
+ );
1290
+
1291
+ $trimmedLowercaseSelector = trim($lowercasePaddedSelector);
1292
+ $xPathKey = md5($trimmedLowercaseSelector);
1293
+ if (!isset($this->caches[self::CACHE_KEY_XPATH][$xPathKey])) {
1294
+ $roughXpath = '//' . preg_replace(
1295
+ array_keys($this->xPathRules),
1296
+ $this->xPathRules,
1297
+ $trimmedLowercaseSelector
1298
+ );
1299
+ $xPathWithIdAttributeMatchers = preg_replace_callback(
1300
+ self::ID_ATTRIBUTE_MATCHER,
1301
+ array($this, 'matchIdAttributes'),
1302
+ $roughXpath
1303
+ );
1304
+ $xPathWithIdAttributeAndClassMatchers = preg_replace_callback(
1305
+ self::CLASS_ATTRIBUTE_MATCHER,
1306
+ array($this, 'matchClassAttributes'),
1307
+ $xPathWithIdAttributeMatchers
1308
+ );
1309
+
1310
+ // Advanced selectors are going to require a bit more advanced emogrification.
1311
+ // When we required PHP 5.3, we could do this with closures.
1312
+ $xPathWithIdAttributeAndClassMatchers = preg_replace_callback(
1313
+ '/([^\\/]+):nth-child\\(\\s*(odd|even|[+\\-]?\\d|[+\\-]?\\d?n(\\s*[+\\-]\\s*\\d)?)\\s*\\)/i',
1314
+ array($this, 'translateNthChild'),
1315
+ $xPathWithIdAttributeAndClassMatchers
1316
+ );
1317
+ $finalXpath = preg_replace_callback(
1318
+ '/([^\\/]+):nth-of-type\\(\s*(odd|even|[+\\-]?\\d|[+\\-]?\\d?n(\\s*[+\\-]\\s*\\d)?)\\s*\\)/i',
1319
+ array($this, 'translateNthOfType'),
1320
+ $xPathWithIdAttributeAndClassMatchers
1321
+ );
1322
+
1323
+ $this->caches[self::CACHE_KEY_SELECTOR][$xPathKey] = $finalXpath;
1324
+ }
1325
+ return $this->caches[self::CACHE_KEY_SELECTOR][$xPathKey];
1326
+ }
1327
+
1328
+ /**
1329
+ * @param string[] $match
1330
+ *
1331
+ * @return string
1332
+ */
1333
+ private function matchIdAttributes(array $match)
1334
+ {
1335
+ return ($match[1] !== '' ? $match[1] : '*') . '[@id="' . $match[2] . '"]';
1336
+ }
1337
+
1338
+ /**
1339
+ * @param string[] $match
1340
+ *
1341
+ * @return string
1342
+ */
1343
+ private function matchClassAttributes(array $match)
1344
+ {
1345
+ return ($match[1] !== '' ? $match[1] : '*') . '[contains(concat(" ",@class," "),concat(" ","' .
1346
+ implode(
1347
+ '"," "))][contains(concat(" ",@class," "),concat(" ","',
1348
+ explode('.', substr($match[2], 1))
1349
+ ) . '"," "))]';
1350
+ }
1351
+
1352
+ /**
1353
+ * @param string[] $match
1354
+ *
1355
+ * @return string
1356
+ */
1357
+ private function translateNthChild(array $match)
1358
+ {
1359
+ $parseResult = $this->parseNth($match);
1360
+
1361
+ if (isset($parseResult[self::MULTIPLIER])) {
1362
+ if ($parseResult[self::MULTIPLIER] < 0) {
1363
+ $parseResult[self::MULTIPLIER] = abs($parseResult[self::MULTIPLIER]);
1364
+ $xPathExpression = sprintf(
1365
+ '*[(last() - position()) mod %u = %u]/self::%s',
1366
+ $parseResult[self::MULTIPLIER],
1367
+ $parseResult[self::INDEX],
1368
+ $match[1]
1369
+ );
1370
+ } else {
1371
+ $xPathExpression = sprintf(
1372
+ '*[position() mod %u = %u]/self::%s',
1373
+ $parseResult[self::MULTIPLIER],
1374
+ $parseResult[self::INDEX],
1375
+ $match[1]
1376
+ );
1377
+ }
1378
+ } else {
1379
+ $xPathExpression = sprintf('*[%u]/self::%s', $parseResult[self::INDEX], $match[1]);
1380
+ }
1381
+
1382
+ return $xPathExpression;
1383
+ }
1384
+
1385
+ /**
1386
+ * @param string[] $match
1387
+ *
1388
+ * @return string
1389
+ */
1390
+ private function translateNthOfType(array $match)
1391
+ {
1392
+ $parseResult = $this->parseNth($match);
1393
+
1394
+ if (isset($parseResult[self::MULTIPLIER])) {
1395
+ if ($parseResult[self::MULTIPLIER] < 0) {
1396
+ $parseResult[self::MULTIPLIER] = abs($parseResult[self::MULTIPLIER]);
1397
+ $xPathExpression = sprintf(
1398
+ '%s[(last() - position()) mod %u = %u]',
1399
+ $match[1],
1400
+ $parseResult[self::MULTIPLIER],
1401
+ $parseResult[self::INDEX]
1402
+ );
1403
+ } else {
1404
+ $xPathExpression = sprintf(
1405
+ '%s[position() mod %u = %u]',
1406
+ $match[1],
1407
+ $parseResult[self::MULTIPLIER],
1408
+ $parseResult[self::INDEX]
1409
+ );
1410
+ }
1411
+ } else {
1412
+ $xPathExpression = sprintf('%s[%u]', $match[1], $parseResult[self::INDEX]);
1413
+ }
1414
+
1415
+ return $xPathExpression;
1416
+ }
1417
+
1418
+ /**
1419
+ * @param string[] $match
1420
+ *
1421
+ * @return int[]
1422
+ */
1423
+ private function parseNth(array $match)
1424
+ {
1425
+ if (in_array(strtolower($match[2]), array('even', 'odd'), true)) {
1426
+ // we have "even" or "odd"
1427
+ $index = strtolower($match[2]) === 'even' ? 0 : 1;
1428
+ return array(self::MULTIPLIER => 2, self::INDEX => $index);
1429
+ }
1430
+ if (stripos($match[2], 'n') === false) {
1431
+ // if there is a multiplier
1432
+ $index = (int) str_replace(' ', '', $match[2]);
1433
+ return array(self::INDEX => $index);
1434
+ }
1435
+
1436
+ if (isset($match[3])) {
1437
+ $multipleTerm = str_replace($match[3], '', $match[2]);
1438
+ $index = (int) str_replace(' ', '', $match[3]);
1439
+ } else {
1440
+ $multipleTerm = $match[2];
1441
+ $index = 0;
1442
+ }
1443
+
1444
+ $multiplier = str_ireplace('n', '', $multipleTerm);
1445
+
1446
+ if ($multiplier === '') {
1447
+ $multiplier = 1;
1448
+ } elseif ($multiplier === '0') {
1449
+ return array(self::INDEX => $index);
1450
+ } else {
1451
+ $multiplier = (int) $multiplier;
1452
+ }
1453
+
1454
+ while ($index < 0) {
1455
+ $index += abs($multiplier);
1456
+ }
1457
+
1458
+ return array(self::MULTIPLIER => $multiplier, self::INDEX => $index);
1459
+ }
1460
+
1461
+ /**
1462
+ * Parses a CSS declaration block into property name/value pairs.
1463
+ *
1464
+ * Example:
1465
+ *
1466
+ * The declaration block
1467
+ *
1468
+ * "color: #000; font-weight: bold;"
1469
+ *
1470
+ * will be parsed into the following array:
1471
+ *
1472
+ * "color" => "#000"
1473
+ * "font-weight" => "bold"
1474
+ *
1475
+ * @param string $cssDeclarationsBlock the CSS declarations block without the curly braces, may be empty
1476
+ *
1477
+ * @return string[]
1478
+ * the CSS declarations with the property names as array keys and the property values as array values
1479
+ */
1480
+ private function parseCssDeclarationsBlock($cssDeclarationsBlock)
1481
+ {
1482
+ if (isset($this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock])) {
1483
+ return $this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock];
1484
+ }
1485
+
1486
+ $properties = array();
1487
+ $declarations = preg_split('/;(?!base64|charset)/', $cssDeclarationsBlock);
1488
+
1489
+ foreach ($declarations as $declaration) {
1490
+ $matches = array();
1491
+ if (!preg_match('/^([A-Za-z\\-]+)\\s*:\\s*(.+)$/', trim($declaration), $matches)) {
1492
+ continue;
1493
+ }
1494
+
1495
+ $propertyName = strtolower($matches[1]);
1496
+ $propertyValue = $matches[2];
1497
+ $properties[$propertyName] = $propertyValue;
1498
+ }
1499
+ $this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock] = $properties;
1500
+
1501
+ return $properties;
1502
+ }
1503
+
1504
+ /**
1505
+ * Find the nodes that are not to be emogrified.
1506
+ *
1507
+ * @param \DOMXPath $xPath
1508
+ *
1509
+ * @return \DOMElement[]
1510
+ */
1511
+ private function getNodesToExclude(DOMXPath $xPath)
1512
+ {
1513
+ $excludedNodes = array();
1514
+ foreach (array_keys($this->excludedSelectors) as $selectorToExclude) {
1515
+ foreach ($xPath->query($this->translateCssToXpath($selectorToExclude)) as $node) {
1516
+ $excludedNodes[] = $node;
1517
+ }
1518
+ }
1519
+
1520
+ return $excludedNodes;
1521
+ }
1522
+
1523
+ /**
1524
+ * Handles invalid xPath expression warnings, generated by process() method,
1525
+ * during querying \DOMDocument and trigger \InvalidArgumentException
1526
+ * with invalid selector.
1527
+ *
1528
+ * @param int $type
1529
+ * @param string $message
1530
+ * @param string $file
1531
+ * @param int $line
1532
+ * @param array $context
1533
+ *
1534
+ * @return bool always false
1535
+ *
1536
+ * @throws \InvalidArgumentException
1537
+ */
1538
+ public function handleXpathError($type, $message, $file, $line, array $context)
1539
+ {
1540
+ if ($type === E_WARNING && isset($context['cssRule']['selector'])) {
1541
+ throw new InvalidArgumentException(
1542
+ sprintf(
1543
+ '%s in selector >> %s << in %s on line %s',
1544
+ $message,
1545
+ $context['cssRule']['selector'],
1546
+ $file,
1547
+ $line
1548
+ )
1549
+ );
1550
+ }
1551
+
1552
+ // the normal error handling continues when handler return false
1553
+ return false;
1554
+ }
1555
+ }
includes/libraries/wp-async-request.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Abstract WP_Async_Request class.
8
+ *
9
+ * @package WP-Background-Processing
10
+ * @abstract
11
+ */
12
+ abstract class WP_Async_Request {
13
+
14
+ /**
15
+ * Prefix
16
+ *
17
+ * (default value: 'wp')
18
+ *
19
+ * @var string
20
+ * @access protected
21
+ */
22
+ protected $prefix = 'wp';
23
+
24
+ /**
25
+ * Action
26
+ *
27
+ * (default value: 'async_request')
28
+ *
29
+ * @var string
30
+ * @access protected
31
+ */
32
+ protected $action = 'async_request';
33
+
34
+ /**
35
+ * Identifier
36
+ *
37
+ * @var mixed
38
+ * @access protected
39
+ */
40
+ protected $identifier;
41
+
42
+ /**
43
+ * Data
44
+ *
45
+ * (default value: array())
46
+ *
47
+ * @var array
48
+ * @access protected
49
+ */
50
+ protected $data = array();
51
+
52
+ /**
53
+ * Initiate new async request
54
+ */
55
+ public function __construct() {
56
+ $this->identifier = $this->prefix . '_' . $this->action;
57
+
58
+ add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
59
+ add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
60
+ }
61
+
62
+ /**
63
+ * Set data used during the request
64
+ *
65
+ * @param array $data Data.
66
+ *
67
+ * @return $this
68
+ */
69
+ public function data( $data ) {
70
+ $this->data = $data;
71
+
72
+ return $this;
73
+ }
74
+
75
+ /**
76
+ * Dispatch the async request
77
+ *
78
+ * @return array|WP_Error
79
+ */
80
+ public function dispatch() {
81
+ $url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
82
+ $args = $this->get_post_args();
83
+
84
+ return wp_remote_post( esc_url_raw( $url ), $args );
85
+ }
86
+
87
+ /**
88
+ * Get query args
89
+ *
90
+ * @return array
91
+ */
92
+ protected function get_query_args() {
93
+ if ( property_exists( $this, 'query_args' ) ) {
94
+ return $this->query_args;
95
+ }
96
+
97
+ return array(
98
+ 'action' => $this->identifier,
99
+ 'nonce' => wp_create_nonce( $this->identifier ),
100
+ );
101
+ }
102
+
103
+ /**
104
+ * Get query URL
105
+ *
106
+ * @return string
107
+ */
108
+ protected function get_query_url() {
109
+ if ( property_exists( $this, 'query_url' ) ) {
110
+ return $this->query_url;
111
+ }
112
+
113
+ return admin_url( 'admin-ajax.php' );
114
+ }
115
+
116
+ /**
117
+ * Get post args
118
+ *
119
+ * @return array
120
+ */
121
+ protected function get_post_args() {
122
+ if ( property_exists( $this, 'post_args' ) ) {
123
+ return $this->post_args;
124
+ }
125
+
126
+ return array(
127
+ 'timeout' => 0.01,
128
+ 'blocking' => false,
129
+ 'body' => $this->data,
130
+ 'cookies' => $_COOKIE,
131
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
132
+ );
133
+ }
134
+
135
+ /**
136
+ * Maybe handle
137
+ *
138
+ * Check for correct nonce and pass to handler.
139
+ */
140
+ public function maybe_handle() {
141
+ // Don't lock up other requests while processing
142
+ session_write_close();
143
+
144
+ check_ajax_referer( $this->identifier, 'nonce' );
145
+
146
+ $this->handle();
147
+
148
+ wp_die();
149
+ }
150
+
151
+ /**
152
+ * Handle
153
+ *
154
+ * Override this method to perform any actions required
155
+ * during the async request.
156
+ */
157
+ abstract protected function handle();
158
+ }
includes/libraries/wp-background-process.php ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * Abstract WP_Background_Process class.
8
+ *
9
+ * @abstract
10
+ * @package WP-Background-Processing
11
+ * @extends WP_Async_Request
12
+ */
13
+ abstract class WP_Background_Process extends WP_Async_Request {
14
+
15
+ /**
16
+ * Action
17
+ *
18
+ * (default value: 'background_process')
19
+ *
20
+ * @var string
21
+ * @access protected
22
+ */
23
+ protected $action = 'background_process';
24
+
25
+ /**
26
+ * Start time of current process.
27
+ *
28
+ * (default value: 0)
29
+ *
30
+ * @var int
31
+ * @access protected
32
+ */
33
+ protected $start_time = 0;
34
+
35
+ /**
36
+ * Cron_hook_identifier
37
+ *
38
+ * @var mixed
39
+ * @access protected
40
+ */
41
+ protected $cron_hook_identifier;
42
+
43
+ /**
44
+ * Cron_interval_identifier
45
+ *
46
+ * @var mixed
47
+ * @access protected
48
+ */
49
+ protected $cron_interval_identifier;
50
+
51
+ /**
52
+ * Initiate new background process
53
+ */
54
+ public function __construct() {
55
+ parent::__construct();
56
+
57
+ $this->cron_hook_identifier = $this->identifier . '_cron';
58
+ $this->cron_interval_identifier = $this->identifier . '_cron_interval';
59
+
60
+ add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
61
+ add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
62
+ }
63
+
64
+ /**
65
+ * Dispatch
66
+ *
67
+ * @access public
68
+ * @return void
69
+ */
70
+ public function dispatch() {
71
+ // Schedule the cron healthcheck.
72
+ $this->schedule_event();
73
+
74
+ // Perform remote post.
75
+ return parent::dispatch();
76
+ }
77
+
78
+ /**
79
+ * Push to queue
80
+ *
81
+ * @param mixed $data Data.
82
+ *
83
+ * @return $this
84
+ */
85
+ public function push_to_queue( $data ) {
86
+ $this->data[] = $data;
87
+
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Save queue
93
+ *
94
+ * @return $this
95
+ */
96
+ public function save() {
97
+ $key = $this->generate_key();
98
+
99
+ if ( ! empty( $this->data ) ) {
100
+ update_site_option( $key, $this->data );
101
+ }
102
+
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * Update queue
108
+ *
109
+ * @param string $key Key.
110
+ * @param array $data Data.
111
+ *
112
+ * @return $this
113
+ */
114
+ public function update( $key, $data ) {
115
+ if ( ! empty( $data ) ) {
116
+ update_site_option( $key, $data );
117
+ }
118
+
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Delete queue
124
+ *
125
+ * @param string $key Key.
126
+ *
127
+ * @return $this
128
+ */
129
+ public function delete( $key ) {
130
+ delete_site_option( $key );
131
+
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * Generate key
137
+ *
138
+ * Generates a unique key based on microtime. Queue items are
139
+ * given a unique key so that they can be merged upon save.
140
+ *
141
+ * @param int $length Length.
142
+ *
143
+ * @return string
144
+ */
145
+ protected function generate_key( $length = 64 ) {
146
+ $unique = md5( microtime() . rand() );
147
+ $prepend = $this->identifier . '_batch_';
148
+
149
+ return substr( $prepend . $unique, 0, $length );
150
+ }
151
+
152
+ /**
153
+ * Maybe process queue
154
+ *
155
+ * Checks whether data exists within the queue and that
156
+ * the process is not already running.
157
+ */
158
+ public function maybe_handle() {
159
+ // Don't lock up other requests while processing
160
+ session_write_close();
161
+
162
+ if ( $this->is_process_running() ) {
163
+ // Background process already running.
164
+ wp_die();
165
+ }
166
+
167
+ if ( $this->is_queue_empty() ) {
168
+ // No data to process.
169
+ wp_die();
170
+ }
171
+
172
+ check_ajax_referer( $this->identifier, 'nonce' );
173
+
174
+ $this->handle();
175
+
176
+ wp_die();
177
+ }
178
+
179
+ /**
180
+ * Is queue empty
181
+ *
182
+ * @return bool
183
+ */
184
+ protected function is_queue_empty() {
185
+ global $wpdb;
186
+
187
+ $table = $wpdb->options;
188
+ $column = 'option_name';
189
+
190
+ if ( is_multisite() ) {
191
+ $table = $wpdb->sitemeta;
192
+ $column = 'meta_key';
193
+ }
194
+
195
+ $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
196
+
197
+ $count = $wpdb->get_var( $wpdb->prepare( "
198
+ SELECT COUNT(*)
199
+ FROM {$table}
200
+ WHERE {$column} LIKE %s
201
+ ", $key ) );
202
+
203
+ return ( $count > 0 ) ? false : true;
204
+ }
205
+
206
+ /**
207
+ * Is process running
208
+ *
209
+ * Check whether the current process is already running
210
+ * in a background process.
211
+ */
212
+ protected function is_process_running() {
213
+ if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
214
+ // Process already running.
215
+ return true;
216
+ }
217
+
218
+ return false;
219
+ }
220
+
221
+ /**
222
+ * Lock process
223
+ *
224
+ * Lock the process so that multiple instances can't run simultaneously.
225
+ * Override if applicable, but the duration should be greater than that
226
+ * defined in the time_exceeded() method.
227
+ */
228
+ protected function lock_process() {
229
+ $this->start_time = time(); // Set start time of current process.
230
+
231
+ $lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
232
+ $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
233
+
234
+ set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
235
+ }
236
+
237
+ /**
238
+ * Unlock process
239
+ *
240
+ * Unlock the process so that other instances can spawn.
241
+ *
242
+ * @return $this
243
+ */
244
+ protected function unlock_process() {
245
+ delete_site_transient( $this->identifier . '_process_lock' );
246
+
247
+ return $this;
248
+ }
249
+
250
+ /**
251
+ * Get batch
252
+ *
253
+ * @return stdClass Return the first batch from the queue
254
+ */
255
+ protected function get_batch() {
256
+ global $wpdb;
257
+
258
+ $table = $wpdb->options;
259
+ $column = 'option_name';
260
+ $key_column = 'option_id';
261
+ $value_column = 'option_value';
262
+
263
+ if ( is_multisite() ) {
264
+ $table = $wpdb->sitemeta;
265
+ $column = 'meta_key';
266
+ $key_column = 'meta_id';
267
+ $value_column = 'meta_value';
268
+ }
269
+
270
+ $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
271
+
272
+ $query = $wpdb->get_row( $wpdb->prepare( "
273
+ SELECT *
274
+ FROM {$table}
275
+ WHERE {$column} LIKE %s
276
+ ORDER BY {$key_column} ASC
277
+ LIMIT 1
278
+ ", $key ) );
279
+
280
+ $batch = new stdClass();
281
+ $batch->key = $query->$column;
282
+ $batch->data = maybe_unserialize( $query->$value_column );
283
+
284
+ return $batch;
285
+ }
286
+
287
+ /**
288
+ * Handle
289
+ *
290
+ * Pass each queue item to the task handler, while remaining
291
+ * within server memory and time limit constraints.
292
+ */
293
+ protected function handle() {
294
+ $this->lock_process();
295
+
296
+ do {
297
+ $batch = $this->get_batch();
298
+
299
+ foreach ( $batch->data as $key => $value ) {
300
+ $task = $this->task( $value );
301
+
302
+ if ( false !== $task ) {
303
+ $batch->data[ $key ] = $task;
304
+ } else {
305
+ unset( $batch->data[ $key ] );
306
+ }
307
+
308
+ if ( $this->time_exceeded() || $this->memory_exceeded() ) {
309
+ // Batch limits reached.
310
+ break;
311
+ }
312
+ }
313
+
314
+ // Update or delete current batch.
315
+ if ( ! empty( $batch->data ) ) {
316
+ $this->update( $batch->key, $batch->data );
317
+ } else {
318
+ $this->delete( $batch->key );
319
+ }
320
+ } while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
321
+
322
+ $this->unlock_process();
323
+
324
+ // Start next batch or complete process.
325
+ if ( ! $this->is_queue_empty() ) {
326
+ $this->dispatch();
327
+ } else {
328
+ $this->complete();
329
+ }
330
+ }
331
+
332
+ /**
333
+ * Memory exceeded
334
+ *
335
+ * Ensures the batch process never exceeds 90%
336
+ * of the maximum WordPress memory.
337
+ *
338
+ * @return bool
339
+ */
340
+ protected function memory_exceeded() {
341
+ $memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
342
+ $current_memory = memory_get_usage( true );
343
+ $return = false;
344
+
345
+ if ( $current_memory >= $memory_limit ) {
346
+ $return = true;
347
+ }
348
+
349
+ return apply_filters( $this->identifier . '_memory_exceeded', $return );
350
+ }
351
+
352
+ /**
353
+ * Get memory limit
354
+ *
355
+ * @return int
356
+ */
357
+ protected function get_memory_limit() {
358
+ if ( function_exists( 'ini_get' ) ) {
359
+ $memory_limit = ini_get( 'memory_limit' );
360
+ } else {
361
+ // Sensible default.
362
+ $memory_limit = '128M';
363
+ }
364
+
365
+ if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
366
+ // Unlimited, set to 32GB.
367
+ $memory_limit = '32000M';
368
+ }
369
+
370
+ return intval( $memory_limit ) * 1024 * 1024;
371
+ }
372
+
373
+ /**
374
+ * Time exceeded.
375
+ *
376
+ * Ensures the batch never exceeds a sensible time limit.
377
+ * A timeout limit of 30s is common on shared hosting.
378
+ *
379
+ * @return bool
380
+ */
381
+ protected function time_exceeded() {
382
+ $finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
383
+ $return = false;
384
+
385
+ if ( time() >= $finish ) {
386
+ $return = true;
387
+ }
388
+
389
+ return apply_filters( $this->identifier . '_time_exceeded', $return );
390
+ }
391
+
392
+ /**
393
+ * Complete.
394
+ *
395
+ * Override if applicable, but ensure that the below actions are
396
+ * performed, or, call parent::complete().
397
+ */
398
+ protected function complete() {
399
+ // Unschedule the cron healthcheck.
400
+ $this->clear_scheduled_event();
401
+ }
402
+
403
+ /**
404
+ * Schedule cron healthcheck
405
+ *
406
+ * @access public
407
+ * @param mixed $schedules Schedules.
408
+ * @return mixed
409
+ */
410
+ public function schedule_cron_healthcheck( $schedules ) {
411
+ $interval = apply_filters( $this->identifier . '_cron_interval', 5 );
412
+
413
+ if ( property_exists( $this, 'cron_interval' ) ) {
414
+ $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval_identifier );
415
+ }
416
+
417
+ // Adds every 5 minutes to the existing schedules.
418
+ $schedules[ $this->identifier . '_cron_interval' ] = array(
419
+ 'interval' => MINUTE_IN_SECONDS * $interval,
420
+ 'display' => sprintf( __( 'Every %d minutes', 'everest-forms' ), $interval ),
421
+ );
422
+
423
+ return $schedules;
424
+ }
425
+
426
+ /**
427
+ * Handle cron healthcheck
428
+ *
429
+ * Restart the background process if not already running
430
+ * and data exists in the queue.
431
+ */
432
+ public function handle_cron_healthcheck() {
433
+ if ( $this->is_process_running() ) {
434
+ // Background process already running.
435
+ exit;
436
+ }
437
+
438
+ if ( $this->is_queue_empty() ) {
439
+ // No data to process.
440
+ $this->clear_scheduled_event();
441
+ exit;
442
+ }
443
+
444
+ $this->handle();
445
+
446
+ exit;
447
+ }
448
+
449
+ /**
450
+ * Schedule event
451
+ */
452
+ protected function schedule_event() {
453
+ if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
454
+ wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
455
+ }
456
+ }
457
+
458
+ /**
459
+ * Clear scheduled event
460
+ */
461
+ protected function clear_scheduled_event() {
462
+ $timestamp = wp_next_scheduled( $this->cron_hook_identifier );
463
+
464
+ if ( $timestamp ) {
465
+ wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
466
+ }
467
+ }
468
+
469
+ /**
470
+ * Cancel Process
471
+ *
472
+ * Stop processing queue items, clear cronjob and delete batch.
473
+ *
474
+ */
475
+ public function cancel_process() {
476
+ if ( ! $this->is_queue_empty() ) {
477
+ $batch = $this->get_batch();
478
+
479
+ $this->delete( $batch->key );
480
+
481
+ wp_clear_scheduled_hook( $this->cron_hook_identifier );
482
+ }
483
+
484
+ }
485
+
486
+ /**
487
+ * Task
488
+ *
489
+ * Override this method to perform any actions required on each
490
+ * queue item. Return the modified item for further processing
491
+ * in the next pass through. Or, return false to remove the
492
+ * item from the queue.
493
+ *
494
+ * @param mixed $item Queue item to iterate over.
495
+ *
496
+ * @return mixed
497
+ */
498
+ abstract protected function task( $item );
499
+
500
+ }
includes/log-handlers/class-evf-log-handler-file.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ /**
7
+ * Handles log entries by writing to a file.
8
+ *
9
+ * @class EVF_Log_Handler_File
10
+ * @version 1.0.0
11
+ * @package EverestForms/Classes/Log_Handlers
12
+ * @category Class
13
+ * @author WPEverest
14
+ */
15
+ class EVF_Log_Handler_File extends EVF_Log_Handler {
16
+
17
+ /**
18
+ * Stores open file handles.
19
+ *
20
+ * @var array
21
+ */
22
+ protected $handles = array();
23
+
24
+ /**
25
+ * File size limit for log files in bytes.
26
+ *
27
+ * @var int
28
+ */
29
+ protected $log_size_limit;
30
+
31
+ /**
32
+ * Cache logs that could not be written.
33
+ *
34
+ * If a log is written too early in the request, pluggable functions may be unavailable. These
35
+ * logs will be cached and written on 'plugins_loaded' action.
36
+ *
37
+ * @var array
38
+ */
39
+ protected $cached_logs = array();
40
+
41
+ /**
42
+ * Constructor for the logger.
43
+ *
44
+ * @param int $log_size_limit Optional. Size limit for log files. Default 5mb.
45
+ */
46
+ public function __construct( $log_size_limit = null ) {
47
+
48
+ if ( null === $log_size_limit ) {
49
+ $log_size_limit = 5 * 1024 * 1024;
50
+ }
51
+
52
+ $this->log_size_limit = $log_size_limit;
53
+
54
+ add_action( 'plugins_loaded', array( $this, 'write_cached_logs' ) );
55
+ }
56
+
57
+ /**
58
+ * Destructor.
59
+ *
60
+ * Cleans up open file handles.
61
+ */
62
+ public function __destruct() {
63
+ foreach ( $this->handles as $handle ) {
64
+ if ( is_resource( $handle ) ) {
65
+ fclose( $handle );
66
+ }
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Handle a log entry.
72
+ *
73
+ * @param int $timestamp Log timestamp.
74
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
75
+ * @param string $message Log message.
76
+ * @param array $context {
77
+ * Additional information for log handlers.
78
+ *
79
+ * @type string $source Optional. Determines log file to write to. Default 'log'.
80
+ * @type bool $_legacy Optional. Default false. True to use outdated log format
81
+ * originally used in deprecated EVF_Logger::add calls.
82
+ * }
83
+ *
84
+ * @return bool False if value was not handled and true if value was handled.
85
+ */
86
+ public function handle( $timestamp, $level, $message, $context ) {
87
+
88
+ if ( isset( $context['source'] ) && $context['source'] ) {
89
+ $handle = $context['source'];
90
+ } else {
91
+ $handle = 'log';
92
+ }
93
+
94
+ $entry = self::format_entry( $timestamp, $level, $message, $context );
95
+
96
+ return $this->add( $entry, $handle );
97
+ }
98
+
99
+ /**
100
+ * Builds a log entry text from timestamp, level and message.
101
+ *
102
+ * @param int $timestamp Log timestamp.
103
+ * @param string $level emergency|alert|critical|error|warning|notice|info|debug
104
+ * @param string $message Log message.
105
+ * @param array $context Additional information for log handlers.
106
+ *
107
+ * @return string Formatted log entry.
108
+ */
109
+ protected static function format_entry( $timestamp, $level, $message, $context ) {
110
+
111
+ if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) {
112
+ if ( isset( $context['source'] ) && $context['source'] ) {
113
+ $handle = $context['source'];
114
+ } else {
115
+ $handle = 'log';
116
+ }
117
+ $message = apply_filters( 'everest_forms_logger_add_message', $message, $handle );
118
+ $time = date_i18n( 'm-d-Y @ H:i:s' );
119
+ $entry = "{$time} - {$message}";
120
+ } else {
121
+ $entry = parent::format_entry( $timestamp, $level, $message, $context );
122
+ }
123
+
124
+ return $entry;
125
+ }
126
+
127
+ /**
128
+ * Open log file for writing.
129
+ *
130
+ * @param string $handle Log handle.
131
+ * @param string $mode Optional. File mode. Default 'a'.
132
+ * @return bool Success.
133
+ */
134
+ protected function open( $handle, $mode = 'a' ) {
135
+ if ( $this->is_open( $handle ) ) {
136
+ return true;
137
+ }
138
+
139
+ $file = self::get_log_file_path( $handle );
140
+
141
+ if ( $file ) {
142
+ if ( ! file_exists( $file ) ) {
143
+ $temphandle = @fopen( $file, 'w+' );
144
+ @fclose( $temphandle );
145
+
146
+ if ( defined( 'FS_CHMOD_FILE' ) ) {
147
+ @chmod( $file, FS_CHMOD_FILE );
148
+ }
149
+ }
150
+
151
+ if ( $resource = @fopen( $file, $mode ) ) {
152
+ $this->handles[ $handle ] = $resource;
153
+ return true;
154
+ }
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+ /**
161
+ * Check if a handle is open.
162
+ *
163
+ * @param string $handle Log handle.
164
+ * @return bool True if $handle is open.
165
+ */
166
+ protected function is_open( $handle ) {
167
+ return array_key_exists( $handle, $this->handles ) && is_resource( $this->handles[ $handle ] );
168
+ }
169
+
170
+ /**
171
+ * Close a handle.
172
+ *
173
+ * @param string $handle
174
+ * @return bool success
175
+ */
176
+ protected function close( $handle ) {
177
+ $result = false;
178
+
179
+ if ( $this->is_open( $handle ) ) {
180
+ $result = fclose( $this->handles[ $handle ] );
181
+ unset( $this->handles[ $handle ] );
182
+ }
183
+
184
+ return $result;
185
+ }
186
+
187
+ /**
188
+ * Add a log entry to chosen file.
189
+ *
190
+ * @param string $entry Log entry text
191
+ * @param string $handle Log entry handle
192
+ *
193
+ * @return bool True if write was successful.
194
+ */
195
+ protected function add( $entry, $handle ) {
196
+ $result = false;
197
+
198
+ if ( $this->should_rotate( $handle ) ) {
199
+ $this->log_rotate( $handle );
200
+ }
201
+
202
+ if ( $this->open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
203
+ $result = fwrite( $this->handles[ $handle ], $entry . PHP_EOL );
204
+ } else {
205
+ $this->cache_log( $entry, $handle );
206
+ }
207
+
208
+ return false !== $result;
209
+ }
210
+
211
+ /**
212
+ * Clear entries from chosen file.
213
+ *
214
+ * @param string $handle
215
+ *
216
+ * @return bool
217
+ */
218
+ public function clear( $handle ) {
219
+ $result = false;
220
+
221
+ // Close the file if it's already open.
222
+ $this->close( $handle );
223
+
224
+ /**
225
+ * $this->open( $handle, 'w' ) == Open the file for writing only. Place the file pointer at
226
+ * the beginning of the file, and truncate the file to zero length.
227
+ */
228
+ if ( $this->open( $handle, 'w' ) && is_resource( $this->handles[ $handle ] ) ) {
229
+ $result = true;
230
+ }
231
+
232
+ do_action( 'everest_forms_log_clear', $handle );
233
+
234
+ return $result;
235
+ }
236
+
237
+ /**
238
+ * Remove/delete the chosen file.
239
+ *
240
+ * @param string $handle
241
+ *
242
+ * @return bool
243
+ */
244
+ public function remove( $handle ) {
245
+ $removed = false;
246
+ $file = self::get_log_file_path( $handle );
247
+
248
+ if ( $file ) {
249
+ if ( is_file( $file ) && is_writable( $file ) ) {
250
+ $this->close( $handle ); // Close first to be certain no processes keep it alive after it is unlinked.
251
+ $removed = unlink( $file );
252
+ }
253
+ do_action( 'everest_forms_log_remove', $handle, $removed );
254
+ }
255
+
256
+ return $removed;
257
+ }
258
+
259
+ /**
260
+ * Check if log file should be rotated.
261
+ *
262
+ * Compares the size of the log file to determine whether it is over the size limit.
263
+ *
264
+ * @param string $handle Log handle
265
+ * @return bool True if if should be rotated.
266
+ */
267
+ protected function should_rotate( $handle ) {
268
+ $file = self::get_log_file_path( $handle );
269
+ if ( $file ) {
270
+ if ( $this->is_open( $handle ) ) {
271
+ $file_stat = fstat( $this->handles[ $handle ] );
272
+ return $file_stat['size'] > $this->log_size_limit;
273
+ } elseif ( file_exists( $file ) ) {
274
+ return filesize( $file ) > $this->log_size_limit;
275
+ } else {
276
+ return false;
277
+ }
278
+ } else {
279
+ return false;
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Rotate log files.
285
+ *
286
+ * Logs are rotated by prepending '.x' to the '.log' suffix.
287
+ * The current log plus 10 historical logs are maintained.
288
+ * For example:
289
+ * base.9.log -> [ REMOVED ]
290
+ * base.8.log -> base.9.log
291
+ * ...
292
+ * base.0.log -> base.1.log
293
+ * base.log -> base.0.log
294
+ *
295
+ * @param string $handle Log handle
296
+ */
297
+ protected function log_rotate( $handle ) {
298
+ for ( $i = 8; $i >= 0; $i-- ) {
299
+ $this->increment_log_infix( $handle, $i );
300
+ }
301
+ $this->increment_log_infix( $handle );
302
+ }
303
+
304
+ /**
305
+ * Increment a log file suffix.
306
+ *
307
+ * @param string $handle Log handle
308
+ * @param null|int $number Optional. Default null. Log suffix number to be incremented.
309
+ * @return bool True if increment was successful, otherwise false.
310
+ */
311
+ protected function increment_log_infix( $handle, $number = null ) {
312
+ if ( null === $number ) {
313
+ $suffix = '';
314
+ $next_suffix = '.0';
315
+ } else {
316
+ $suffix = '.' . $number;
317
+ $next_suffix = '.' . ($number + 1);
318
+ }
319
+
320
+ $rename_from = self::get_log_file_path( "{$handle}{$suffix}" );
321
+ $rename_to = self::get_log_file_path( "{$handle}{$next_suffix}" );
322
+
323
+ if ( $this->is_open( $rename_from ) ) {
324
+ $this->close( $rename_from );
325
+ }
326
+
327
+ if ( is_writable( $rename_from ) ) {
328
+ return rename( $rename_from, $rename_to );
329
+ } else {
330
+ return false;
331
+ }
332
+
333
+ }
334
+
335
+ /**
336
+ * Get a log file path.
337
+ *
338
+ * @param string $handle Log name.
339
+ * @return bool|string The log file path or false if path cannot be determined.
340
+ */
341
+ public static function get_log_file_path( $handle ) {
342
+ if ( function_exists( 'wp_hash' ) ) {
343
+ return trailingslashit( EVF_LOG_DIR ) . sanitize_file_name( $handle . '-' . wp_hash( $handle ) . '.log' );
344
+ } else {
345
+ _doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'everest-forms' ), '3.0' );
346
+ return false;
347
+ }
348
+ }
349
+
350
+ /**
351
+ * Cache log to write later.
352
+ *
353
+ * @param string $entry Log entry text
354
+ * @param string $handle Log entry handle
355
+ */
356
+ protected function cache_log( $entry, $handle ) {
357
+ $this->cached_logs[] = array(
358
+ 'entry' => $entry,
359
+ 'handle' => $handle,
360
+ );
361
+ }
362
+
363
+ /**
364
+ * Write cached logs.
365
+ */
366
+ public function write_cached_logs() {
367
+ foreach ( $this->cached_logs as $log ) {
368
+ $this->add( $log['entry'], $log['handle'] );
369
+ }
370
+ }
371
+
372
+ }
includes/shortcodes/class-evf-shortcode-form.php ADDED
@@ -0,0 +1,575 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ /**
8
+ * form Shortcode
9
+ *
10
+ * Used on the show frontend form
11
+ *
12
+ * @author WPEverest
13
+ * @category Shortcodes
14
+ * @package EverestForms/Shortcodes/Form
15
+ * @version 1.0.0
16
+ */
17
+ class EVF_Shortcode_Form {
18
+
19
+ public static function hooks() {
20
+ add_action( 'evf_frontend_output_success', array( 'EVF_Shortcode_Form', 'confirmation' ), 10, 2 );
21
+ add_action( 'evf_frontend_output', array( 'EVF_Shortcode_Form', 'form_field' ), 10, 2 );
22
+ add_action( 'evf_frontend_output', array( 'EVF_Shortcode_Form', 'footer' ), 10, 2 );
23
+ add_action( 'evf_display_field_before', array( 'EVF_Shortcode_Form', 'wrapper_start' ), 5, 2 );
24
+ add_action( 'evf_display_field_before', array( 'EVF_Shortcode_Form', 'label' ), 15, 2 );
25
+ add_action( 'evf_display_field_before', array( 'EVF_Shortcode_Form', 'description' ), 20, 2 );
26
+ add_action( 'evf_display_field_after', array( 'EVF_Shortcode_Form', 'messages' ), 3, 2 );
27
+ add_action( 'evf_display_field_after', array( 'EVF_Shortcode_Form', 'description' ), 5, 2 );
28
+ add_action( 'evf_display_field_after', array( 'EVF_Shortcode_Form', 'wrapper_end' ), 15, 2 );
29
+ }
30
+
31
+ /**
32
+ * @param $form_data
33
+ * @param $title
34
+ */
35
+ public static function footer( $form_data, $title ) {
36
+ $form_id = absint( $form_data['id'] );
37
+ $settings = isset( $form_data['settings'] ) ? $form_data['settings'] : '' ;
38
+
39
+ $submit = apply_filters( 'evf_field_submit', isset( $settings['submit_button_text'] ) ? $settings['submit_button_text'] : __( 'Submit', 'everest-forms' ), $form_data );
40
+ $process = '';
41
+ $classes = '';
42
+ $visible = '';
43
+
44
+ echo '<div class="evf-submit-container" ' . $visible . '>';
45
+
46
+ echo '<input type="hidden" name="everest_forms[id]" value="' . $form_id . '">';
47
+
48
+ echo '<input type="hidden" name="everest_forms[author]" value="' . absint( get_the_author_meta( 'ID' ) ) . '">';
49
+
50
+ if ( is_singular() ) {
51
+ echo '<input type="hidden" name="everest_forms[post_id]" value="' . get_the_ID() . '">';
52
+ }
53
+
54
+ do_action( 'evf_display_submit_before', $form_data );
55
+
56
+ printf(
57
+ '<button type="submit" name="everest_forms[submit]" class="evf-submit %s" id="evf-submit-%d" value="evf-submit" %s>%s</button>',
58
+ $classes,
59
+ $form_id,
60
+ $process,
61
+ $submit
62
+ );
63
+
64
+ do_action( 'evf_display_submit_after', $form_data );
65
+
66
+ echo '</div>';
67
+ }
68
+
69
+ /**
70
+ * @param $field
71
+ * @param $form_data
72
+ */
73
+ public static function messages( $field, $form_data ) {
74
+
75
+ $error = $field['properties']['error'];
76
+
77
+
78
+ if ( empty( $error['value'] ) || is_array( $error['value'] ) ) {
79
+ return;
80
+ }
81
+
82
+ printf( '<label %s>%s</label>',
83
+ evf_html_attributes( $error['id'], $error['class'], $error['data'], $error['attr'] ),
84
+ esc_html( $error['value'] )
85
+ );
86
+ }
87
+
88
+ public static function description( $field, $form_data ) {
89
+
90
+ $action = current_action();
91
+
92
+ $description = $field['properties']['description'];
93
+
94
+ // If the description is empty don't proceed.
95
+ if ( empty( $description['value'] ) ) {
96
+ return;
97
+ }
98
+
99
+ // Determine positioning.
100
+ if ( 'evf_display_field_before' === $action && 'before' !== $description['position'] ) {
101
+ return;
102
+ }
103
+ if ( 'evf_display_field_after' === $action && 'after' !== $description['position'] ) {
104
+ return;
105
+ }
106
+
107
+ if ( 'before' === $description['position'] ) {
108
+ $description['class'][] = 'evf-field-description-before';
109
+ }
110
+
111
+ printf( '<div %s>%s</div>',
112
+ evf_html_attributes( $description['id'], $description['class'], $description['data'], $description['attr'] ),
113
+ $description['value']
114
+ );
115
+ }
116
+
117
+ public static function label( $field, $form_data ) {
118
+
119
+
120
+ $label = $field['properties']['label'];
121
+
122
+ // If the label is empty or disabled don't proceed.
123
+ if ( empty( $label['value'] ) || $label['disabled'] ) {
124
+ return;
125
+ }
126
+
127
+ $required = $label['required'] ? apply_filters( 'evf_field_required_label', ' <abbr class="required" title="' . esc_attr__( 'Required', 'everest-forms' ) . '">*</abbr>' ) : '';
128
+
129
+ printf( '<label %s>%s%s</label>',
130
+ evf_html_attributes( $label['id'], $label['class'], $label['data'], $label['attr'] ),
131
+ esc_html( $label['value'] ),
132
+ $required
133
+ );
134
+ }
135
+
136
+ /**
137
+ * @param $form_data
138
+ */
139
+ public static function confirmation( $form_data ) {
140
+
141
+ $settings = $form_data['settings'];
142
+ $success_message = isset( $settings['successful_form_submission_message'] ) ? $settings['successful_form_submission_message'] : __( 'Thanks for contacting us! We will be in touch with you shortly.', 'everest-forms' );
143
+
144
+ // Only display if a confirmation message has been configured.
145
+ if ( ! empty( $settings['confirmation_type'] ) ) {
146
+ $success_message = $settings['confirmation_type'];
147
+ }
148
+
149
+ $form_id = absint( $form_data['id'] );
150
+ $message = apply_filters( 'everest_forms_frontend_confirmation_message', $success_message, $form_data );
151
+ $class = 'everest-forms-confirmation-container';
152
+ printf(
153
+ '<div class="%s" id="evf-confirmation-%d">%s</div>',
154
+ $class,
155
+ $form_id,
156
+ wpautop( $message )
157
+ );
158
+ }
159
+
160
+ /**
161
+ * @param $field
162
+ * @param $form_data
163
+ */
164
+ public static function wrapper_end( $field, $form_data ) {
165
+ echo '</div>';
166
+ }
167
+
168
+ /**
169
+ * @param $field
170
+ * @param $form_data
171
+ */
172
+ public static function wrapper_start( $field, $form_data ) {
173
+ $container = $field['properties']['container'];
174
+ $container['data']['field-id'] = absint( $field['id'] );
175
+
176
+ printf(
177
+ '<div %s>',
178
+ evf_html_attributes( $container['id'], $container['class'], $container['data'], $container['attr'] )
179
+ );
180
+ }
181
+
182
+ /**
183
+ * @param $form_data
184
+ * @param $title
185
+ */
186
+ public static function form_field( $form_data, $title ) {
187
+ if ( empty( $form_data['form_fields'] ) ) {
188
+ return;
189
+ }
190
+
191
+ $structure = isset( $form_data['structure'] ) ? $form_data['structure'] : array();
192
+
193
+ // Form fields area.
194
+ echo '<div class="evf-field-container">';
195
+
196
+ do_action( 'evf_display_fields_before', $form_data );
197
+
198
+ wp_nonce_field( 'everest-forms_process_submit' );
199
+
200
+ foreach ( $structure as $row_key => $row ) {
201
+
202
+ echo '<div class="evf-frontend-row" data-row="' . $row_key . '">';
203
+
204
+ foreach ( $row as $grid_key => $grid ) {
205
+
206
+ $number_of_grid = count( $row );
207
+
208
+ echo '<div class="evf-frontend-grid evf-grid-' . $number_of_grid . '" data-grid="' . $grid_key . '">';
209
+
210
+ if ( ! is_array( $grid ) ) {
211
+ $grid = array();
212
+ }
213
+
214
+ foreach ( $grid as $field_key ) {
215
+
216
+ $field = isset( $form_data['form_fields'][ $field_key ] ) ? $form_data['form_fields'][ $field_key ] : array();
217
+
218
+ $field = apply_filters( 'evf_field_data', $field, $form_data );
219
+
220
+ if ( empty( $field ) ) {
221
+ continue;
222
+ }
223
+
224
+ $attributes = self::get_field_attributes( $field, $form_data );
225
+
226
+ // Get field properties.
227
+ $properties = self::get_field_properties( $field, $form_data, $attributes );
228
+
229
+ // Add properties to the field so it's available everywhere.
230
+ $field['properties'] = $properties;
231
+
232
+ do_action( 'evf_display_field_before', $field, $form_data );
233
+
234
+ do_action( "evf_display_field_{$field['type']}", $field, $attributes, $form_data );
235
+
236
+ do_action( 'evf_display_field_after', $field, $form_data );
237
+ }
238
+
239
+ echo '</div>';
240
+
241
+ }
242
+ echo '</div>';
243
+
244
+ echo self::process_recaptcha( $form_data );
245
+ }
246
+
247
+ // Loop through all the fields we have.
248
+ /*foreach ( $form_data['form_fields'] as $field ) {
249
+
250
+ $field = apply_filters( 'evf_field_data', $field, $form_data );
251
+
252
+ if ( empty( $field ) ) {
253
+ continue;
254
+ }
255
+
256
+
257
+ $attributes = self::get_field_attributes( $field, $form_data );
258
+
259
+ // Get field properties.
260
+ $properties = self::get_field_properties( $field, $form_data, $attributes );
261
+
262
+ // Add properties to the field so it's available everywhere.
263
+ $field['properties'] = $properties;
264
+
265
+ do_action( 'evf_display_field_before', $field, $form_data );
266
+
267
+
268
+ do_action( "evf_display_field_{$field['type']}", $field, $attributes, $form_data );
269
+
270
+
271
+ do_action( 'evf_display_field_after', $field, $form_data );
272
+
273
+ }*/ // End foreach().
274
+
275
+ do_action( 'evf_display_fields_after', $form_data );
276
+
277
+ echo '</div>';
278
+ }
279
+
280
+ public static function process_recaptcha( $form_data ){
281
+
282
+ $recaptcha_enable = 'no';
283
+
284
+ if( isset( $form_data['settings']['recaptcha_support'] ) && $form_data['settings']['recaptcha_support'] == 1 ){
285
+ $recaptcha_enable = 'yes';
286
+ }
287
+
288
+ $recaptcha_site_key = get_option( 'evf_recaptcha_site_key', - 1 );
289
+
290
+ $recaptcha_site_secret = get_option( 'evf_recaptcha_site_secret', - 1 );
291
+
292
+ if ( empty( $recaptcha_site_key ) ) {
293
+
294
+ $recaptcha_site_key = - 1;
295
+ }
296
+ if ( empty( $recaptcha_site_secret ) ) {
297
+
298
+ $recaptcha_site_secret = - 1;
299
+ }
300
+ if ( 'yes' == $recaptcha_enable ) {
301
+
302
+ wp_enqueue_script( 'evf-google-recaptcha' );
303
+
304
+ wp_localize_script( 'evf-google-recaptcha', 'evf_google_recaptcha_code', array(
305
+
306
+ 'site_key' => $recaptcha_site_key,
307
+
308
+ 'site_secret' => $recaptcha_site_secret,
309
+
310
+ 'is_captcha_enable' => true,
311
+
312
+ ) );
313
+ }
314
+
315
+ $recaptcha_node = '<div id="evf-recaptcha-node" style="width:100px;max-width: 100px; float:left">
316
+ <div id="evf_node_recaptcha" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;">
317
+ </div>
318
+ </div>';
319
+
320
+ if ( 'no' === $recaptcha_enable ) {
321
+
322
+ $recaptcha_node = '<div id="evf-recaptcha-node" style="width:100px;max-width: 100px; float:left"></div>';
323
+
324
+ }
325
+ if ( 'yes' === $recaptcha_enable && - 1 !== $recaptcha_site_key && - 1 !== $recaptcha_site_secret ) {
326
+
327
+ $recaptcha_node = '<div id="evf-recaptcha-node" style="width:100px;max-width: 100px; float:left">
328
+ <div id="evf_node_recaptcha" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;">
329
+ </div>
330
+ </div>';
331
+ }
332
+ return $recaptcha_node;
333
+
334
+ }
335
+
336
+ /**
337
+ * @param $field
338
+ * @param $form_data
339
+ *
340
+ * @return array
341
+ */
342
+ private static function get_field_attributes( $field, $form_data ) {
343
+ $form_id = absint( $form_data['id'] );
344
+ $field_id = ( $field['id'] );
345
+ $attributes = array(
346
+ 'field_class' => array( 'evf-field', 'evf-field-' . sanitize_html_class( $field['type'] ), 'form-row' ),
347
+ 'field_id' => array( sprintf( 'evf-%d-field_%s-container', $form_id, $field_id ) ),
348
+ 'field_style' => '',
349
+ 'label_class' => array( 'evf-field-label' ),
350
+ 'label_id' => '',
351
+ 'description_class' => array( 'evf-field-description' ),
352
+ 'description_id' => array(),
353
+ 'input_id' => array( sprintf( 'evf-%d-field_%s', $form_id, $field_id ) ),
354
+ 'input_class' => array( 'input-text' ),
355
+ 'input_data' => array(),
356
+ );
357
+
358
+ // Check user field defined classes.
359
+ if ( ! empty( $field['css'] ) ) {
360
+ $attributes['field_class'] = array_merge( $attributes['field_class'], evf_sanitize_classes( $field['css'], true ) );
361
+ }
362
+
363
+ // Check label visibility.
364
+ if ( ! empty( $field['label_hide'] ) ) {
365
+ $attributes['label_class'][] = 'evf-label-hide';
366
+ }
367
+ // Check size.
368
+ if ( ! empty( $field['size'] ) ) {
369
+ $attributes['input_class'][] = 'evf-field-' . sanitize_html_class( $field['size'] );
370
+ }
371
+ // Check if required.
372
+ if ( ! empty( $field['required'] ) ) {
373
+ $attributes['field_class'][] = 'validate-required';
374
+ }
375
+
376
+ // Check if extra validation required.
377
+ if ( in_array( $field['type'], array( 'email', 'phone' ) ) ) {
378
+ $attributes['field_class'][] = 'validate-' . esc_attr( $field['type'] );
379
+ }
380
+
381
+ // Check if there are errors.
382
+ // if ( ! empty( EVF()->process->errors[ $form_id ][ $field_id ] ) ) {
383
+ // $attributes['input_class'][] = 'evf-error';
384
+ // }
385
+
386
+ // This filter is deprecated, filter the properties (below) instead.
387
+ $attributes = apply_filters( 'evf_field_atts', $attributes, $field, $form_data );
388
+
389
+ return $attributes;
390
+ }
391
+
392
+
393
+ private static function get_field_properties( $field, $form_data, $attributes = array() ) {
394
+ // This filter is for backwards compatibility purposes.
395
+ $types = array(
396
+ 'text',
397
+ 'textarea',
398
+ 'number',
399
+ 'email',
400
+ 'hidden',
401
+ 'url',
402
+ 'html',
403
+ 'divider',
404
+ 'password',
405
+ 'phone',
406
+ 'address'
407
+ );
408
+ if ( in_array( $field['type'], $types, true ) ) {
409
+ $field = apply_filters( "evf_{$field['type']}_field_display", $field, $attributes, $form_data );
410
+ }
411
+
412
+ $form_id = absint( $form_data['id'] );
413
+ $field_id = ( $field['id'] );
414
+
415
+ $properties = array(
416
+ 'container' => array(
417
+ 'attr' => array(
418
+ 'style' => $attributes['field_style'],
419
+ ),
420
+ 'class' => $attributes['field_class'],
421
+ 'data' => array(),
422
+ 'id' => implode( '', array_slice( $attributes['field_id'], 0 ) ),
423
+ ),
424
+ 'label' => array(
425
+ 'attr' => array(
426
+ 'for' => sprintf( 'evf-%d-field_%s', $form_id, $field_id ),
427
+ ),
428
+ 'class' => $attributes['label_class'],
429
+ 'data' => array(),
430
+ 'disabled' => ! empty( $field['label_disable'] ) ? true : false,
431
+ 'hidden' => ! empty( $field['label_hide'] ) ? true : false,
432
+ 'id' => $attributes['label_id'],
433
+ 'required' => ! empty( $field['required'] ) ? true : false,
434
+ 'value' => ! empty( $field['label'] ) ? $field['label'] : '',
435
+ ),
436
+ 'inputs' => array(
437
+ 'primary' => array(
438
+ 'attr' => array(
439
+ 'name' => "everest_forms[form_fields][{$field_id}]",
440
+ 'value' => ( isset( $field['default_value'] ) && ! empty( $field['default_value'] ) ) ? apply_filters( 'evf_process_smart_tags', $field['default_value'], $form_data ) : ( isset( $_POST['everest_forms']['form_fields'][$field_id] ) ? $_POST['everest_forms']['form_fields'][$field_id] : '' ),
441
+ 'placeholder' => isset( $field['placeholder'] ) ? $field['placeholder'] : '',
442
+ ),
443
+ 'class' => $attributes['input_class'],
444
+ 'data' => $attributes['input_data'],
445
+ 'id' => implode( array_slice( $attributes['input_id'], 0 ) ),
446
+ 'required' => ! empty( $field['required'] ) ? 'required' : '',
447
+ ),
448
+ ),
449
+ 'error' => array(
450
+ 'attr' => array(
451
+ 'for' => sprintf( 'evf-%d-field_%s', $form_id, $field_id ),
452
+ ),
453
+ 'class' => array( 'evf-error' ),
454
+ 'data' => array(),
455
+ 'id' => '',
456
+ 'value' => ! empty( EVF()->process->errors[ $form_id ][ $field_id ] ) ? EVF()->process->errors[ $form_id ][ $field_id ] : '',
457
+ ),
458
+ 'description' => array(
459
+ 'attr' => array(),
460
+ 'class' => $attributes['description_class'],
461
+ 'data' => array(),
462
+ 'id' => implode( '', array_slice( $attributes['description_id'], 0 ) ),
463
+ 'position' => 'after',
464
+ 'value' => ! empty( $field['description'] ) ? $field['description'] : '',
465
+ ),
466
+ );
467
+
468
+ // Dynamic value support.
469
+ if ( apply_filters( 'evf_frontend_dynamic_values', false ) ) {
470
+ if ( empty( $properties['inputs']['primary']['attr']['value'] ) && ! empty( $_GET["f$field_id}"] ) ) {
471
+ $properties['inputs']['primary']['attr']['value'] = sanitize_text_field( $_GET["f{$field_id}"] );
472
+ }
473
+ }
474
+
475
+ $properties = apply_filters( "evf_field_properties_{$field['type']}", $properties, $field, $form_data );
476
+ $properties = apply_filters( 'evf_field_properties', $properties, $field, $form_data );
477
+
478
+ return $properties;
479
+ }
480
+
481
+ /**
482
+ * Output the shortcode.
483
+ *
484
+ * @param array $atts
485
+ */
486
+ public static function output( $atts ) {
487
+ global $wp;
488
+ $atts = shortcode_atts( array(
489
+ 'id' => false,
490
+ 'title' => false,
491
+ ), $atts, 'output' );
492
+
493
+ ob_start();
494
+
495
+ self::view( $atts['id'], $atts['title'] );
496
+
497
+ echo ob_get_clean();
498
+
499
+ }
500
+
501
+ /**
502
+ * Form view.
503
+ *
504
+ * @param int $id
505
+ * @param bool $title
506
+ */
507
+ private static function view( $id, $title = false ) {
508
+ if ( empty( $id ) ) {
509
+ return;
510
+ }
511
+
512
+ // Grab the form data, if not found then we bail.
513
+ $form = EVF()->form->get( (int) $id );
514
+
515
+ if ( empty( $form ) || $form->post_status !== 'publish' ) {
516
+ return;
517
+ }
518
+
519
+ // Basic information.
520
+ $form_data = evf_decode( $form->post_content );
521
+ $form_id = absint( $form->ID );
522
+ $action = esc_url_raw( remove_query_arg( 'evf-forms' ) );
523
+ $title = filter_var( $title, FILTER_VALIDATE_BOOLEAN );
524
+
525
+ // If the form does not contain any fields do not proceed.
526
+ if ( empty( $form_data['form_fields'] ) ) {
527
+ echo '<!-- EverestForms: no fields, form hidden -->';
528
+ return;
529
+ }
530
+
531
+ // Before output hook.
532
+ do_action( 'evf_frontend_output_before', $form_data, $form );
533
+
534
+ // Allow filter to return early if some condition is not met.
535
+ if ( ! apply_filters( 'evf_frontend_load', true, $form_data, null ) ) {
536
+ return;
537
+ }
538
+
539
+
540
+ $success = isset( $_POST['evf_success'] ) && $_POST['evf_success'] ? true : false;
541
+ if ( $success && ! empty( $form_data ) ) {
542
+ do_action( 'evf_frontend_output_success', $form_data );
543
+ return;
544
+ }
545
+
546
+ $action = apply_filters( 'evf_frontend_form_action', $action, $form_data, null );
547
+
548
+ $layout = isset( $form_data['settings']['layout_class'] ) ? $form_data['settings']['layout_class'] : '';
549
+
550
+ $class = isset( $form_data['settings']['form_class'] ) ? $form_data['settings']['form_class'] : '';
551
+
552
+ // Begin to build the output
553
+ printf(
554
+ '<div class="evf-container %s %s" id="evf-%d">',
555
+ $class,
556
+ $layout,
557
+ $form_id
558
+ );
559
+
560
+ printf(
561
+ '<form method="post" id="evf-form-%d" class="everest-form" action="%s" enctype="multipart/form-data" evf-formid="%d">',
562
+ $form_id,
563
+ $action,
564
+ $form_id
565
+ );
566
+ do_action( 'evf_frontend_output', $form_data, $title );
567
+
568
+ echo '</form>';
569
+
570
+ echo '</div>';
571
+
572
+ do_action( 'evf_frontend_output_after', $form_data, $form );
573
+ }
574
+
575
+ }
includes/templates/contact.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contact form Template.
4
+ *
5
+ * @package EverestForms\Templates
6
+ * @version 1.0.0
7
+ * @since 1.0.0
8
+ */
9
+
10
+ defined( 'ABSPATH' ) || exit;
11
+
12
+ $form_template['contact'] = array(
13
+ 'form_field_id' => '1',
14
+ 'form_fields' => array(
15
+ 'lVizlNhYus-1' => array(
16
+ 'id' => 'lVizlNhYus-1',
17
+ 'type' => 'text',
18
+ 'label' => 'Name',
19
+ 'description' => '',
20
+ 'required' => '1',
21
+ 'placeholder' => '',
22
+ 'css' => '',
23
+ ),
24
+ 'xJivsqAS2c-2' => array(
25
+ "id" => "xJivsqAS2c-2",
26
+ "type" => "text",
27
+ "label" => "Subject",
28
+ 'description' => '',
29
+ 'required' => '1',
30
+ 'placeholder' => '',
31
+ 'css' => '',
32
+ ),
33
+ 'XYnMdkQDKM-3' => array(
34
+ 'id' => 'XYnMdkQDKM-3',
35
+ 'type' => 'email',
36
+ 'label' => 'Email',
37
+ 'description' => '',
38
+ 'required' => '1',
39
+ 'placeholder' => '',
40
+ 'default_value' => '',
41
+ 'css' => '',
42
+ ),
43
+ 'YalaPcQ0DO-4' => array(
44
+ 'id' => 'YalaPcQ0DO-4',
45
+ 'type' => 'textarea',
46
+ 'label' => 'Message',
47
+ 'description' => '',
48
+ 'placeholder' => '',
49
+ 'css' => '',
50
+ ),
51
+ ),
52
+ 'settings' => array(
53
+ 'form_title' => sanitize_text_field( $title ),
54
+ 'form_desc' => '',
55
+ 'successful_form_submission_message' => get_option( 'everest_forms_successful_form_submission_message', __( 'Thanks for contacting us! We will be in touch with you shortly.','everest-forms' ) ),
56
+ 'redirect_to' => '0',
57
+ 'custom_page' => '2',
58
+ 'external_url' => '',
59
+ 'layout_class' => 'default',
60
+ 'form_class' => '',
61
+ 'submit_button_text' => get_option( 'everest_forms_form_submit_button_label', __( 'Submit', 'everest-forms') ),
62
+ 'email' => array(
63
+ "evf_to_email" => get_option( 'evf_to_email', get_option( 'admin_email' ) ),
64
+ "evf_from_name" => get_option( 'evf_from_name', evf_sender_name() ),
65
+ "evf_from_email" => get_option( 'evf_from_name', evf_sender_address() ),
66
+ "evf_email_subject" => get_option( 'evf_email_subject', __('New Form Entry','everest-forms' ) ),
67
+ "evf_email_message" => get_option( 'evf_email_message', '{all_fields}' ),
68
+ )
69
+ ),
70
+ 'structure' => array(
71
+ 'row_1' => array(
72
+ 'grid_1' => array(
73
+ 'lVizlNhYus-1',
74
+ 'XYnMdkQDKM-3',
75
+ 'xJivsqAS2c-2',
76
+ 'YalaPcQ0DO-4',
77
+ ),
78
+ ),
79
+ ),
80
+ );
languages/everest-forms.pot ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2017 WPEverest
2
+ # This file is distributed under the same license as the EverestForms package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: EverestForms 1.0.0\n"
6
+ "Report-Msgid-Bugs-To: wpeverest@gmail.com\n"
7
+ "POT-Creation-Date: 2017-11-02 06:53:19+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
+ "X-Generator: grunt-wp-i18n1.0.1\n"
15
+
16
+ #. Plugin Name of the plugin/theme
17
+ msgid "EverestForms"
18
+ msgstr ""
19
+
20
+ #: includes/admin/class-evf-admin-help.php:43
21
+ #: includes/admin/class-evf-admin-help.php:47
22
+ msgid "General Settings"
23
+ msgstr ""
24
+
25
+ #: includes/admin/class-evf-admin-help.php:76
26
+ #: includes/admin/class-evf-admin-help.php:77
27
+ msgid "Guided Tour"
28
+ msgstr ""
29
+
30
+ #: includes/admin/class-evf-admin-help.php:83
31
+ #: includes/admin/class-evf-admin-help.php:85
32
+ msgid "Help &amp; Support"
33
+ msgstr ""
34
+
35
+ #: includes/admin/class-evf-admin-help.php:87
36
+ msgid ""
37
+ "Should you need help understanding, using, or extending EverestForms, <a "
38
+ "href=\"%s\">please read our documentation</a>. You will find all kinds of "
39
+ "resources including snippets, tutorials and much more."
40
+ msgstr ""
41
+
42
+ #: includes/admin/class-evf-admin-help.php:91
43
+ msgid ""
44
+ "For further assistance with EverestFormscore you can use the <a "
45
+ "href=\"%1$s\">community forum</a>. If you need help with premium extensions "
46
+ "sold by EverestForms, please <a href=\"%2$s\">use our helpdesk</a>."
47
+ msgstr ""
48
+
49
+ #: includes/admin/class-evf-admin-help.php:95
50
+ msgid ""
51
+ "Before asking for help we recommend checking the system status page to "
52
+ "identify any problems with your configuration."
53
+ msgstr ""
54
+
55
+ #: includes/admin/class-evf-admin-help.php:96
56
+ #: includes/admin/class-evf-admin-help.php:105
57
+ msgid "System status"
58
+ msgstr ""
59
+
60
+ #: includes/admin/class-evf-admin-help.php:96
61
+ msgid "Community forum"
62
+ msgstr ""
63
+
64
+ #: includes/admin/class-evf-admin-help.php:96
65
+ msgid "EverestFormshelpdesk"
66
+ msgstr ""
67
+
68
+ #: includes/admin/class-evf-admin-help.php:101
69
+ #: includes/admin/class-evf-admin-help.php:103
70
+ msgid "Found a bug?"
71
+ msgstr ""
72
+
73
+ #: includes/admin/class-evf-admin-help.php:104
74
+ msgid ""
75
+ "If you find a bug within EverestFormscore you can create a ticket via <a "
76
+ "href=\"%1$s\">Github issues</a>. Ensure you read the <a "
77
+ "href=\"%2$s\">contribution guide</a> prior to submitting your report. To "
78
+ "help us solve your issue, please be as descriptive as possible and include "
79
+ "your <a href=\"%3$s\">system status report</a>."
80
+ msgstr ""
81
+
82
+ #: includes/admin/class-evf-admin-help.php:105
83
+ msgid "Report a bug"
84
+ msgstr ""
85
+
86
+ #: includes/admin/class-evf-admin-help.php:111
87
+ #: includes/admin/class-evf-admin-help.php:113
88
+ msgid "Education"
89
+ msgstr ""
90
+
91
+ #: includes/admin/class-evf-admin-help.php:114
92
+ msgid ""
93
+ "If you would like to learn about using EverestFormsfrom an expert, consider "
94
+ "following a EverestFormscourse offered by one of our educational partners."
95
+ msgstr ""
96
+
97
+ #: includes/admin/class-evf-admin-help.php:115
98
+ msgid "View education partners"
99
+ msgstr ""
100
+
101
+ #: includes/admin/class-evf-admin-help.php:120
102
+ #: includes/admin/class-evf-admin-help.php:122
103
+ #: includes/admin/class-evf-admin-help.php:124
104
+ msgid "Setup wizard"
105
+ msgstr ""
106
+
107
+ #: includes/admin/class-evf-admin-help.php:123
108
+ msgid ""
109
+ "If you need to access the setup wizard again, please click on the button "
110
+ "below."
111
+ msgstr ""
112
+
113
+ #: includes/admin/class-evf-admin-help.php:129
114
+ msgid "For more information:"
115
+ msgstr ""
116
+
117
+ #: includes/admin/class-evf-admin-help.php:130
118
+ msgid "About EverestForms"
119
+ msgstr ""
120
+
121
+ #: includes/admin/class-evf-admin-help.php:131
122
+ msgid "WordPress.org project"
123
+ msgstr ""
124
+
125
+ #: includes/admin/class-evf-admin-help.php:132
126
+ msgid "Github project"
127
+ msgstr ""
128
+
129
+ #: includes/admin/class-evf-admin-help.php:133
130
+ msgid "Official themes"
131
+ msgstr ""
132
+
133
+ #: includes/admin/class-evf-admin-help.php:134
134
+ msgid "Official extensions"
135
+ msgstr ""
136
+
137
+ #: includes/admin/class-evf-admin-menus.php:43
138
+ msgid "Everest Forms"
139
+ msgstr ""
140
+
141
+ #: includes/admin/class-evf-admin-menus.php:51
142
+ msgid "Everest Forms settings"
143
+ msgstr ""
144
+
145
+ #: includes/admin/class-evf-admin-menus.php:51
146
+ #: includes/class-evf-install.php:821
147
+ msgid "Settings"
148
+ msgstr ""
149
+
150
+ #: includes/admin/class-evf-admin-menus.php:91
151
+ msgid "Everest Forms status"
152
+ msgstr ""
153
+
154
+ #: includes/admin/class-evf-admin-menus.php:91
155
+ msgid "Status"
156
+ msgstr ""
157
+
158
+ #: includes/admin/class-evf-admin-notices.php:117
159
+ #: includes/admin/class-evf-admin-settings.php:68
160
+ #: includes/admin/class-evf-admin-status.php:168
161
+ msgid "Action failed. Please refresh the page and retry."
162
+ msgstr ""
163
+
164
+ #: includes/admin/class-evf-admin-notices.php:121
165
+ #: includes/class-everest-forms.php:63 includes/class-everest-forms.php:72
166
+ #: includes/class-evf-emails.php:54 includes/class-evf-emails.php:63
167
+ msgid "Cheatin&#8217; huh?"
168
+ msgstr ""
169
+
170
+ #: includes/admin/class-evf-admin-settings.php:76
171
+ msgid "Your settings have been saved."
172
+ msgstr ""
173
+
174
+ #: includes/admin/class-evf-admin-settings.php:134
175
+ msgid "The changes you made will be lost if you navigate away from this page."
176
+ msgstr ""
177
+
178
+ #: includes/admin/class-evf-admin-settings.php:500
179
+ msgid ""
180
+ "The settings of this image size have been disabled because its values are "
181
+ "being overwritten by a filter."
182
+ msgstr ""
183
+
184
+ #: includes/admin/class-evf-admin-settings.php:509
185
+ msgid "Hard crop?"
186
+ msgstr ""
187
+
188
+ #: includes/admin/class-evf-admin-settings.php:536
189
+ msgid "Select a page&hellip;"
190
+ msgstr ""
191
+
192
+ #: includes/admin/class-evf-admin.php:125
193
+ msgid "HTML email template"
194
+ msgstr ""
195
+
196
+ #: includes/admin/class-evf-admin.php:169
197
+ #. translators: 1: EverestForms 2:: five stars
198
+ msgid "If you like %1$s please leave us a %2$s rating. A huge thanks in advance!"
199
+ msgstr ""
200
+
201
+ #: includes/admin/class-evf-admin.php:171
202
+ msgid "Thanks :)"
203
+ msgstr ""
204
+
205
+ #: includes/admin/class-evf-admin.php:180
206
+ msgid "Thank you for selling with EverestForms."
207
+ msgstr ""
208
+
209
+ #: includes/admin/settings/class-evf-settings-general.php:27
210
+ msgid "General"
211
+ msgstr ""
212
+
213
+ #: includes/admin/settings/class-evf-settings-general.php:43
214
+ msgid "Store Address"
215
+ msgstr ""
216
+
217
+ #: includes/admin/settings/class-evf-settings-general.php:45
218
+ msgid ""
219
+ "This is where your business is located. Tax rates and shipping rates will "
220
+ "use this address."
221
+ msgstr ""
222
+
223
+ #: includes/admin/settings/class-evf-settings-general.php:50
224
+ msgid "Address line 1"
225
+ msgstr ""
226
+
227
+ #: includes/admin/settings/class-evf-settings-general.php:51
228
+ msgid "The street address for your business location."
229
+ msgstr ""
230
+
231
+ #: includes/admin/settings/class-evf-settings-general.php:61
232
+ msgid "General options"
233
+ msgstr ""
234
+
235
+ #: includes/admin/settings/class-evf-settings-general.php:68
236
+ msgid "Selling location(s)"
237
+ msgstr ""
238
+
239
+ #: includes/admin/settings/class-evf-settings-general.php:69
240
+ msgid "This option lets you limit which countries you are willing to sell to."
241
+ msgstr ""
242
+
243
+ #: includes/admin/settings/class-evf-settings-general.php:77
244
+ msgid "Sell to all countries"
245
+ msgstr ""
246
+
247
+ #: includes/admin/settings/class-evf-settings-general.php:78
248
+ msgid "Sell to all countries, except for&hellip;"
249
+ msgstr ""
250
+
251
+ #: includes/admin/settings/class-evf-settings-general.php:79
252
+ msgid "Sell to specific countries"
253
+ msgstr ""
254
+
255
+ #: includes/admin/views/html-admin-page-status-logs.php:17
256
+ msgid "Delete log"
257
+ msgstr ""
258
+
259
+ #: includes/admin/views/html-admin-page-status-logs.php:28
260
+ msgid "View"
261
+ msgstr ""
262
+
263
+ #: includes/admin/views/html-admin-page-status-logs.php:37
264
+ msgid "There are currently no logs to view."
265
+ msgstr ""
266
+
267
+ #: includes/admin/views/html-admin-page-status.php:12
268
+ msgid "Logs"
269
+ msgstr ""
270
+
271
+ #: includes/admin/views/html-admin-settings.php:31
272
+ msgid "Save changes"
273
+ msgstr ""
274
+
275
+ #: includes/admin/views/html-notice-custom.php:12
276
+ #: includes/admin/views/html-notice-updated.php:12
277
+ msgid "Dismiss"
278
+ msgstr ""
279
+
280
+ #: includes/admin/views/html-notice-install.php:12
281
+ msgid ""
282
+ "<strong>Welcome to EverestForms</strong> &#8211; You&lsquo;re almost ready "
283
+ "to start creating form :)"
284
+ msgstr ""
285
+
286
+ #: includes/admin/views/html-notice-install.php:13
287
+ msgid "Run the Setup Wizard"
288
+ msgstr ""
289
+
290
+ #: includes/admin/views/html-notice-install.php:13
291
+ msgid "Skip setup"
292
+ msgstr ""
293
+
294
+ #: includes/admin/views/html-notice-update.php:12
295
+ #: includes/admin/views/html-notice-updating.php:12
296
+ msgid "EverestFormsdata update"
297
+ msgstr ""
298
+
299
+ #: includes/admin/views/html-notice-update.php:12
300
+ msgid "We need to update your store database to the latest version."
301
+ msgstr ""
302
+
303
+ #: includes/admin/views/html-notice-update.php:13
304
+ msgid "Run the updater"
305
+ msgstr ""
306
+
307
+ #: includes/admin/views/html-notice-update.php:17
308
+ msgid ""
309
+ "It is strongly recommended that you backup your database before proceeding. "
310
+ "Are you sure you wish to run the updater now?"
311
+ msgstr ""
312
+
313
+ #: includes/admin/views/html-notice-updated.php:14
314
+ msgid ""
315
+ "EverestFormsdata update complete. Thank you for updating to the latest "
316
+ "version!"
317
+ msgstr ""
318
+
319
+ #: includes/admin/views/html-notice-updating.php:12
320
+ msgid "Your database is being updated in the background."
321
+ msgstr ""
322
+
323
+ #: includes/admin/views/html-notice-updating.php:12
324
+ msgid "Taking a while? Click here to run it now."
325
+ msgstr ""
326
+
327
+ #: includes/class-evf-admin-menus.php:97
328
+ msgid "Everest Form"
329
+ msgstr ""
330
+
331
+ #: includes/class-evf-install.php:262
332
+ msgid "Monthly"
333
+ msgstr ""
334
+
335
+ #: includes/class-evf-install.php:636
336
+ msgid "Customer"
337
+ msgstr ""
338
+
339
+ #: includes/class-evf-install.php:641
340
+ msgid "Shop manager"
341
+ msgstr ""
342
+
343
+ #: includes/class-evf-install.php:821
344
+ msgid "View EverestFormssettings"
345
+ msgstr ""
346
+
347
+ #: includes/class-evf-install.php:838
348
+ msgid "View EverestFormsdocumentation"
349
+ msgstr ""
350
+
351
+ #: includes/class-evf-install.php:838
352
+ msgid "Docs"
353
+ msgstr ""
354
+
355
+ #: includes/class-evf-install.php:839
356
+ msgid "View EverestFormsAPI docs"
357
+ msgstr ""
358
+
359
+ #: includes/class-evf-install.php:839
360
+ msgid "API docs"
361
+ msgstr ""
362
+
363
+ #: includes/class-evf-install.php:840
364
+ msgid "Visit premium customer support"
365
+ msgstr ""
366
+
367
+ #: includes/class-evf-install.php:840
368
+ msgid "Premium support"
369
+ msgstr ""
370
+
371
+ #: includes/class-evf-install.php:990 includes/class-evf-install.php:1075
372
+ msgid ""
373
+ "%1$s could not be installed (%2$s). <a href=\"%3$s\">Please install it "
374
+ "manually by clicking here.</a>"
375
+ msgstr ""
376
+
377
+ #: includes/class-evf-install.php:1017
378
+ msgid ""
379
+ "%1$s was installed but could not be activated. <a href=\"%2$s\">Please "
380
+ "activate it manually by clicking here.</a>"
381
+ msgstr ""
382
+
383
+ #: includes/class-evf-logger.php:58
384
+ #. translators: 1: class name 2: EVF_Log_Handler_Interface
385
+ msgid "The provided handler %1$s does not implement %2$s."
386
+ msgstr ""
387
+
388
+ #: includes/class-evf-logger.php:132
389
+ #. translators: 1: EVF_Logger::log 2: level
390
+ msgid "%1$s was called with an invalid level \"%2$s\"."
391
+ msgstr ""
392
+
393
+ #: includes/class-evf-post-types.php:48
394
+ msgid "Forms"
395
+ msgstr ""
396
+
397
+ #: includes/class-evf-post-types.php:49
398
+ msgid "Form"
399
+ msgstr ""
400
+
401
+ #: includes/class-evf-post-types.php:50
402
+ msgid "All Forms"
403
+ msgstr ""
404
+
405
+ #: includes/class-evf-post-types.php:52
406
+ msgid "Add New"
407
+ msgstr ""
408
+
409
+ #: includes/class-evf-post-types.php:53
410
+ msgid "Add new form"
411
+ msgstr ""
412
+
413
+ #: includes/class-evf-post-types.php:54
414
+ msgid "Edit"
415
+ msgstr ""
416
+
417
+ #: includes/class-evf-post-types.php:55
418
+ msgid "Edit form"
419
+ msgstr ""
420
+
421
+ #: includes/class-evf-post-types.php:56
422
+ msgid "New form"
423
+ msgstr ""
424
+
425
+ #: includes/class-evf-post-types.php:57 includes/class-evf-post-types.php:58
426
+ msgid "View form"
427
+ msgstr ""
428
+
429
+ #: includes/class-evf-post-types.php:59
430
+ msgid "Search forms"
431
+ msgstr ""
432
+
433
+ #: includes/class-evf-post-types.php:60
434
+ msgid "No forms found"
435
+ msgstr ""
436
+
437
+ #: includes/class-evf-post-types.php:61
438
+ msgid "No forms found in trash"
439
+ msgstr ""
440
+
441
+ #: includes/class-evf-post-types.php:62
442
+ msgid "Parent forms"
443
+ msgstr ""
444
+
445
+ #: includes/class-evf-post-types.php:63
446
+ msgid "Form image"
447
+ msgstr ""
448
+
449
+ #: includes/class-evf-post-types.php:64
450
+ msgid "Set form image"
451
+ msgstr ""
452
+
453
+ #: includes/class-evf-post-types.php:65
454
+ msgid "Remove form image"
455
+ msgstr ""
456
+
457
+ #: includes/class-evf-post-types.php:66
458
+ msgid "Use as form image"
459
+ msgstr ""
460
+
461
+ #: includes/class-evf-post-types.php:67
462
+ msgid "Insert into form"
463
+ msgstr ""
464
+
465
+ #: includes/class-evf-post-types.php:68
466
+ msgid "Uploaded to this form"
467
+ msgstr ""
468
+
469
+ #: includes/class-evf-post-types.php:69
470
+ msgid "Filter forms"
471
+ msgstr ""
472
+
473
+ #: includes/class-evf-post-types.php:70
474
+ msgid "Forms navigation"
475
+ msgstr ""
476
+
477
+ #: includes/class-evf-post-types.php:71
478
+ msgid "Forms list"
479
+ msgstr ""
480
+
481
+ #: includes/class-evf-post-types.php:73
482
+ msgid "This is where you can add new forms."
483
+ msgstr ""
484
+
485
+ #: includes/evf-core-functions.php:90
486
+ msgid "%s does not exist."
487
+ msgstr ""
488
+
489
+ #: includes/evf-core-functions.php:502
490
+ #. translators: 1: class name 2: everest_forms_logging_class 3:
491
+ #. EVF_Logger_Interface
492
+ msgid "The class %1$s provided by %2$s filter must implement %3$s."
493
+ msgstr ""
494
+
495
+ #: includes/evf-notice-functions.php:27 includes/evf-notice-functions.php:58
496
+ #: includes/evf-notice-functions.php:76 includes/evf-notice-functions.php:100
497
+ #: includes/evf-notice-functions.php:114 includes/evf-notice-functions.php:127
498
+ #: includes/evf-notice-functions.php:174
499
+ msgid "This function should not be called before everest_forms_init."
500
+ msgstr ""
501
+
502
+ #: includes/libraries/wp-background-process.php:420
503
+ msgid "Every %d minutes"
504
+ msgstr ""
505
+
506
+ #: includes/log-handlers/class-evf-log-handler-file.php:345
507
+ msgid "This method should not be called before plugins_loaded."
508
+ msgstr ""
509
+
510
+ #. Plugin URI of the plugin/theme
511
+ msgid "https://wpeverest.com/wordpress-plugins/everest-forms/"
512
+ msgstr ""
513
+
514
+ #. Description of the plugin/theme
515
+ msgid "WordPress form builder."
516
+ msgstr ""
517
+
518
+ #. Author of the plugin/theme
519
+ msgid "WPEverest"
520
+ msgstr ""
521
+
522
+ #. Author URI of the plugin/theme
523
+ msgid "https://wpeverest.com"
524
+ msgstr ""
525
+
526
+ #: includes/class-evf-install.php:301
527
+ msgctxt "Page slug"
528
+ msgid "shop"
529
+ msgstr ""
530
+
531
+ #: includes/class-evf-install.php:306
532
+ msgctxt "Page slug"
533
+ msgid "cart"
534
+ msgstr ""
535
+
536
+ #: includes/class-evf-install.php:311
537
+ msgctxt "Page slug"
538
+ msgid "checkout"
539
+ msgstr ""
540
+
541
+ #: includes/class-evf-install.php:316
542
+ msgctxt "Page slug"
543
+ msgid "my-account"
544
+ msgstr ""
545
+
546
+ #: includes/class-evf-install.php:302
547
+ msgctxt "Page title"
548
+ msgid "Shop"
549
+ msgstr ""
550
+
551
+ #: includes/class-evf-install.php:307
552
+ msgctxt "Page title"
553
+ msgid "Cart"
554
+ msgstr ""
555
+
556
+ #: includes/class-evf-install.php:312
557
+ msgctxt "Page title"
558
+ msgid "Checkout"
559
+ msgstr ""
560
+
561
+ #: includes/class-evf-install.php:317
562
+ msgctxt "Page title"
563
+ msgid "My account"
564
+ msgstr ""
565
+
566
+ #: includes/class-evf-post-types.php:51
567
+ msgctxt "Admin menu name"
568
+ msgid "Forms"
569
+ msgstr ""
license.txt ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Everest Forms - Easily allows to create form.
2
+
3
+ Copyright 2016 by the contributors
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ This program incorporates work covered by the following copyright and
19
+ permission notices:
20
+
21
+ Everest Forms - Easily allows to create form.
22
+
23
+ Everest Forms is Copyright (c) 2016 WPEverest
24
+
25
+ Everest Forms is released under the GPL
26
+
27
+ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
28
+
29
+ GNU GENERAL PUBLIC LICENSE
30
+ Version 3, 29 June 2007
31
+
32
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
33
+ Everyone is permitted to copy and distribute verbatim copies
34
+ of this license document, but changing it is not allowed.
35
+
36
+ Preamble
37
+
38
+ The GNU General Public License is a free, copyleft license for
39
+ software and other kinds of works.
40
+
41
+ The licenses for most software and other practical works are designed
42
+ to take away your freedom to share and change the works. By contrast,
43
+ the GNU General Public License is intended to guarantee your freedom to
44
+ share and change all versions of a program--to make sure it remains free
45
+ software for all its users. We, the Free Software Foundation, use the
46
+ GNU General Public License for most of our software; it applies also to
47
+ any other work released this way by its authors. You can apply it to
48
+ your programs, too.
49
+
50
+ When we speak of free software, we are referring to freedom, not
51
+ price. Our General Public Licenses are designed to make sure that you
52
+ have the freedom to distribute copies of free software (and charge for
53
+ them if you wish), that you receive source code or can get it if you
54
+ want it, that you can change the software or use pieces of it in new
55
+ free programs, and that you know you can do these things.
56
+
57
+ To protect your rights, we need to prevent others from denying you
58
+ these rights or asking you to surrender the rights. Therefore, you have
59
+ certain responsibilities if you distribute copies of the software, or if
60
+ you modify it: responsibilities to respect the freedom of others.
61
+
62
+ For example, if you distribute copies of such a program, whether
63
+ gratis or for a fee, you must pass on to the recipients the same
64
+ freedoms that you received. You must make sure that they, too, receive
65
+ or can get the source code. And you must show them these terms so they
66
+ know their rights.
67
+
68
+ Developers that use the GNU GPL protect your rights with two steps:
69
+ (1) assert copyright on the software, and (2) offer you this License
70
+ giving you legal permission to copy, distribute and/or modify it.
71
+
72
+ For the developers' and authors' protection, the GPL clearly explains
73
+ that there is no warranty for this free software. For both users' and
74
+ authors' sake, the GPL requires that modified versions be marked as
75
+ changed, so that their problems will not be attributed erroneously to
76
+ authors of previous versions.
77
+
78
+ Some devices are designed to deny users access to install or run
79
+ modified versions of the software inside them, although the manufacturer
80
+ can do so. This is fundamentally incompatible with the aim of
81
+ protecting users' freedom to change the software. The systematic
82
+ pattern of such abuse occurs in the area of products for individuals to
83
+ use, which is precisely where it is most unacceptable. Therefore, we
84
+ have designed this version of the GPL to prohibit the practice for those
85
+ products. If such problems arise substantially in other domains, we
86
+ stand ready to extend this provision to those domains in future versions
87
+ of the GPL, as needed to protect the freedom of users.
88
+
89
+ Finally, every program is threatened constantly by software patents.
90
+ States should not allow patents to restrict development and use of
91
+ software on general-purpose computers, but in those that do, we wish to
92
+ avoid the special danger that patents applied to a free program could
93
+ make it effectively proprietary. To prevent this, the GPL assures that
94
+ patents cannot be used to render the program non-free.
95
+
96
+ The precise terms and conditions for copying, distribution and
97
+ modification follow.
98
+
99
+ TERMS AND CONDITIONS
100
+
101
+ 0. Definitions.
102
+
103
+ "This License" refers to version 3 of the GNU General Public License.
104
+
105
+ "Copyright" also means copyright-like laws that apply to other kinds of
106
+ works, such as semiconductor masks.
107
+
108
+ "The Program" refers to any copyrightable work licensed under this
109
+ License. Each licensee is addressed as "you". "Licensees" and
110
+ "recipients" may be individuals or organizations.
111
+
112
+ To "modify" a work means to copy from or adapt all or part of the work
113
+ in a fashion requiring copyright permission, other than the making of an
114
+ exact copy. The resulting work is called a "modified version" of the
115
+ earlier work or a work "based on" the earlier work.
116
+
117
+ A "covered work" means either the unmodified Program or a work based
118
+ on the Program.
119
+
120
+ To "propagate" a work means to do anything with it that, without
121
+ permission, would make you directly or secondarily liable for
122
+ infringement under applicable copyright law, except executing it on a
123
+ computer or modifying a private copy. Propagation includes copying,
124
+ distribution (with or without modification), making available to the
125
+ public, and in some countries other activities as well.
126
+
127
+ To "convey" a work means any kind of propagation that enables other
128
+ parties to make or receive copies. Mere interaction with a user through
129
+ a computer network, with no transfer of a copy, is not conveying.
130
+
131
+ An interactive user interface displays "Appropriate Legal Notices"
132
+ to the extent that it includes a convenient and prominently visible
133
+ feature that (1) displays an appropriate copyright notice, and (2)
134
+ tells the user that there is no warranty for the work (except to the
135
+ extent that warranties are provided), that licensees may convey the
136
+ work under this License, and how to view a copy of this License. If
137
+ the interface presents a list of user commands or options, such as a
138
+ menu, a prominent item in the list meets this criterion.
139
+
140
+ 1. Source Code.
141
+
142
+ The "source code" for a work means the preferred form of the work
143
+ for making modifications to it. "Object code" means any non-source
144
+ form of a work.
145
+
146
+ A "Standard Interface" means an interface that either is an official
147
+ standard defined by a recognized standards body, or, in the case of
148
+ interfaces specified for a particular programming language, one that
149
+ is widely used among developers working in that language.
150
+
151
+ The "System Libraries" of an executable work include anything, other
152
+ than the work as a whole, that (a) is included in the normal form of
153
+ packaging a Major Component, but which is not part of that Major
154
+ Component, and (b) serves only to enable use of the work with that
155
+ Major Component, or to implement a Standard Interface for which an
156
+ implementation is available to the public in source code form. A
157
+ "Major Component", in this context, means a major essential component
158
+ (kernel, window system, and so on) of the specific operating system
159
+ (if any) on which the executable work runs, or a compiler used to
160
+ produce the work, or an object code interpreter used to run it.
161
+
162
+ The "Corresponding Source" for a work in object code form means all
163
+ the source code needed to generate, install, and (for an executable
164
+ work) run the object code and to modify the work, including scripts to
165
+ control those activities. However, it does not include the work's
166
+ System Libraries, or general-purpose tools or generally available free
167
+ programs which are used unmodified in performing those activities but
168
+ which are not part of the work. For example, Corresponding Source
169
+ includes interface definition files associated with source files for
170
+ the work, and the source code for shared libraries and dynamically
171
+ linked subprograms that the work is specifically designed to require,
172
+ such as by intimate data communication or control flow between those
173
+ subprograms and other parts of the work.
174
+
175
+ The Corresponding Source need not include anything that users
176
+ can regenerate automatically from other parts of the Corresponding
177
+ Source.
178
+
179
+ The Corresponding Source for a work in source code form is that
180
+ same work.
181
+
182
+ 2. Basic Permissions.
183
+
184
+ All rights granted under this License are granted for the term of
185
+ copyright on the Program, and are irrevocable provided the stated
186
+ conditions are met. This License explicitly affirms your unlimited
187
+ permission to run the unmodified Program. The output from running a
188
+ covered work is covered by this License only if the output, given its
189
+ content, constitutes a covered work. This License acknowledges your
190
+ rights of fair use or other equivalent, as provided by copyright law.
191
+
192
+ You may make, run and propagate covered works that you do not
193
+ convey, without conditions so long as your license otherwise remains
194
+ in force. You may convey covered works to others for the sole purpose
195
+ of having them make modifications exclusively for you, or provide you
196
+ with facilities for running those works, provided that you comply with
197
+ the terms of this License in conveying all material for which you do
198
+ not control copyright. Those thus making or running the covered works
199
+ for you must do so exclusively on your behalf, under your direction
200
+ and control, on terms that prohibit them from making any copies of
201
+ your copyrighted material outside their relationship with you.
202
+
203
+ Conveying under any other circumstances is permitted solely under
204
+ the conditions stated below. Sublicensing is not allowed; section 10
205
+ makes it unnecessary.
206
+
207
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
208
+
209
+ No covered work shall be deemed part of an effective technological
210
+ measure under any applicable law fulfilling obligations under article
211
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
212
+ similar laws prohibiting or restricting circumvention of such
213
+ measures.
214
+
215
+ When you convey a covered work, you waive any legal power to forbid
216
+ circumvention of technological measures to the extent such circumvention
217
+ is effected by exercising rights under this License with respect to
218
+ the covered work, and you disclaim any intention to limit operation or
219
+ modification of the work as a means of enforcing, against the work's
220
+ users, your or third parties' legal rights to forbid circumvention of
221
+ technological measures.
222
+
223
+ 4. Conveying Verbatim Copies.
224
+
225
+ You may convey verbatim copies of the Program's source code as you
226
+ receive it, in any medium, provided that you conspicuously and
227
+ appropriately publish on each copy an appropriate copyright notice;
228
+ keep intact all notices stating that this License and any
229
+ non-permissive terms added in accord with section 7 apply to the code;
230
+ keep intact all notices of the absence of any warranty; and give all
231
+ recipients a copy of this License along with the Program.
232
+
233
+ You may charge any price or no price for each copy that you convey,
234
+ and you may offer support or warranty protection for a fee.
235
+
236
+ 5. Conveying Modified Source Versions.
237
+
238
+ You may convey a work based on the Program, or the modifications to
239
+ produce it from the Program, in the form of source code under the
240
+ terms of section 4, provided that you also meet all of these conditions:
241
+
242
+ a) The work must carry prominent notices stating that you modified
243
+ it, and giving a relevant date.
244
+
245
+ b) The work must carry prominent notices stating that it is
246
+ released under this License and any conditions added under section
247
+ 7. This requirement modifies the requirement in section 4 to
248
+ "keep intact all notices".
249
+
250
+ c) You must license the entire work, as a whole, under this
251
+ License to anyone who comes into possession of a copy. This
252
+ License will therefore apply, along with any applicable section 7
253
+ additional terms, to the whole of the work, and all its parts,
254
+ regardless of how they are packaged. This License gives no
255
+ permission to license the work in any other way, but it does not
256
+ invalidate such permission if you have separately received it.
257
+
258
+ d) If the work has interactive user interfaces, each must display
259
+ Appropriate Legal Notices; however, if the Program has interactive
260
+ interfaces that do not display Appropriate Legal Notices, your
261
+ work need not make them do so.
262
+
263
+ A compilation of a covered work with other separate and independent
264
+ works, which are not by their nature extensions of the covered work,
265
+ and which are not combined with it such as to form a larger program,
266
+ in or on a volume of a storage or distribution medium, is called an
267
+ "aggregate" if the compilation and its resulting copyright are not
268
+ used to limit the access or legal rights of the compilation's users
269
+ beyond what the individual works permit. Inclusion of a covered work
270
+ in an aggregate does not cause this License to apply to the other
271
+ parts of the aggregate.
272
+
273
+ 6. Conveying Non-Source Forms.
274
+
275
+ You may convey a covered work in object code form under the terms
276
+ of sections 4 and 5, provided that you also convey the
277
+ machine-readable Corresponding Source under the terms of this License,
278
+ in one of these ways:
279
+
280
+ a) Convey the object code in, or embodied in, a physical product
281
+ (including a physical distribution medium), accompanied by the
282
+ Corresponding Source fixed on a durable physical medium
283
+ customarily used for software interchange.
284
+
285
+ b) Convey the object code in, or embodied in, a physical product
286
+ (including a physical distribution medium), accompanied by a
287
+ written offer, valid for at least three years and valid for as
288
+ long as you offer spare parts or customer support for that product
289
+ model, to give anyone who possesses the object code either (1) a
290
+ copy of the Corresponding Source for all the software in the
291
+ product that is covered by this License, on a durable physical
292
+ medium customarily used for software interchange, for a price no
293
+ more than your reasonable cost of physically performing this
294
+ conveying of source, or (2) access to copy the
295
+ Corresponding Source from a network server at no charge.
296
+
297
+ c) Convey individual copies of the object code with a copy of the
298
+ written offer to provide the Corresponding Source. This
299
+ alternative is allowed only occasionally and noncommercially, and
300
+ only if you received the object code with such an offer, in accord
301
+ with subsection 6b.
302
+
303
+ d) Convey the object code by offering access from a designated
304
+ place (gratis or for a charge), and offer equivalent access to the
305
+ Corresponding Source in the same way through the same place at no
306
+ further charge. You need not require recipients to copy the
307
+ Corresponding Source along with the object code. If the place to
308
+ copy the object code is a network server, the Corresponding Source
309
+ may be on a different server (operated by you or a third party)
310
+ that supports equivalent copying facilities, provided you maintain
311
+ clear directions next to the object code saying where to find the
312
+ Corresponding Source. Regardless of what server hosts the
313
+ Corresponding Source, you remain obligated to ensure that it is
314
+ available for as long as needed to satisfy these requirements.
315
+
316
+ e) Convey the object code using peer-to-peer transmission, provided
317
+ you inform other peers where the object code and Corresponding
318
+ Source of the work are being offered to the general public at no
319
+ charge under subsection 6d.
320
+
321
+ A separable portion of the object code, whose source code is excluded
322
+ from the Corresponding Source as a System Library, need not be
323
+ included in conveying the object code work.
324
+
325
+ A "User Product" is either (1) a "consumer product", which means any
326
+ tangible personal property which is normally used for personal, family,
327
+ or household purposes, or (2) anything designed or sold for incorporation
328
+ into a dwelling. In determining whether a product is a consumer product,
329
+ doubtful cases shall be resolved in favor of coverage. For a particular
330
+ product received by a particular user, "normally used" refers to a
331
+ typical or common use of that class of product, regardless of the status
332
+ of the particular user or of the way in which the particular user
333
+ actually uses, or expects or is expected to use, the product. A product
334
+ is a consumer product regardless of whether the product has substantial
335
+ commercial, industrial or non-consumer uses, unless such uses represent
336
+ the only significant mode of use of the product.
337
+
338
+ "Installation Information" for a User Product means any methods,
339
+ procedures, authorization keys, or other information required to install
340
+ and execute modified versions of a covered work in that User Product from
341
+ a modified version of its Corresponding Source. The information must
342
+ suffice to ensure that the continued functioning of the modified object
343
+ code is in no case prevented or interfered with solely because
344
+ modification has been made.
345
+
346
+ If you convey an object code work under this section in, or with, or
347
+ specifically for use in, a User Product, and the conveying occurs as
348
+ part of a transaction in which the right of possession and use of the
349
+ User Product is transferred to the recipient in perpetuity or for a
350
+ fixed term (regardless of how the transaction is characterized), the
351
+ Corresponding Source conveyed under this section must be accompanied
352
+ by the Installation Information. But this requirement does not apply
353
+ if neither you nor any third party retains the ability to install
354
+ modified object code on the User Product (for example, the work has
355
+ been installed in ROM).
356
+
357
+ The requirement to provide Installation Information does not include a
358
+ requirement to continue to provide support service, warranty, or updates
359
+ for a work that has been modified or installed by the recipient, or for
360
+ the User Product in which it has been modified or installed. Access to a
361
+ network may be denied when the modification itself materially and
362
+ adversely affects the operation of the network or violates the rules and
363
+ protocols for communication across the network.
364
+
365
+ Corresponding Source conveyed, and Installation Information provided,
366
+ in accord with this section must be in a format that is publicly
367
+ documented (and with an implementation available to the public in
368
+ source code form), and must require no special password or key for
369
+ unpacking, reading or copying.
370
+
371
+ 7. Additional Terms.
372
+
373
+ "Additional permissions" are terms that supplement the terms of this
374
+ License by making exceptions from one or more of its conditions.
375
+ Additional permissions that are applicable to the entire Program shall
376
+ be treated as though they were included in this License, to the extent
377
+ that they are valid under applicable law. If additional permissions
378
+ apply only to part of the Program, that part may be used separately
379
+ under those permissions, but the entire Program remains governed by
380
+ this License without regard to the additional permissions.
381
+
382
+ When you convey a copy of a covered work, you may at your option
383
+ remove any additional permissions from that copy, or from any part of
384
+ it. (Additional permissions may be written to require their own
385
+ removal in certain cases when you modify the work.) You may place
386
+ additional permissions on material, added by you to a covered work,
387
+ for which you have or can give appropriate copyright permission.
388
+
389
+ Notwithstanding any other provision of this License, for material you
390
+ add to a covered work, you may (if authorized by the copyright holders of
391
+ that material) supplement the terms of this License with terms:
392
+
393
+ a) Disclaiming warranty or limiting liability differently from the
394
+ terms of sections 15 and 16 of this License; or
395
+
396
+ b) Requiring preservation of specified reasonable legal notices or
397
+ author attributions in that material or in the Appropriate Legal
398
+ Notices displayed by works containing it; or
399
+
400
+ c) Prohibiting misrepresentation of the origin of that material, or
401
+ requiring that modified versions of such material be marked in
402
+ reasonable ways as different from the original version; or
403
+
404
+ d) Limiting the use for publicity purposes of names of licensors or
405
+ authors of the material; or
406
+
407
+ e) Declining to grant rights under trademark law for use of some
408
+ trade names, trademarks, or service marks; or
409
+
410
+ f) Requiring indemnification of licensors and authors of that
411
+ material by anyone who conveys the material (or modified versions of
412
+ it) with contractual assumptions of liability to the recipient, for
413
+ any liability that these contractual assumptions directly impose on
414
+ those licensors and authors.
415
+
416
+ All other non-permissive additional terms are considered "further
417
+ restrictions" within the meaning of section 10. If the Program as you
418
+ received it, or any part of it, contains a notice stating that it is
419
+ governed by this License along with a term that is a further
420
+ restriction, you may remove that term. If a license document contains
421
+ a further restriction but permits relicensing or conveying under this
422
+ License, you may add to a covered work material governed by the terms
423
+ of that license document, provided that the further restriction does
424
+ not survive such relicensing or conveying.
425
+
426
+ If you add terms to a covered work in accord with this section, you
427
+ must place, in the relevant source files, a statement of the
428
+ additional terms that apply to those files, or a notice indicating
429
+ where to find the applicable terms.
430
+
431
+ Additional terms, permissive or non-permissive, may be stated in the
432
+ form of a separately written license, or stated as exceptions;
433
+ the above requirements apply either way.
434
+
435
+ 8. Termination.
436
+
437
+ You may not propagate or modify a covered work except as expressly
438
+ provided under this License. Any attempt otherwise to propagate or
439
+ modify it is void, and will automatically terminate your rights under
440
+ this License (including any patent licenses granted under the third
441
+ paragraph of section 11).
442
+
443
+ However, if you cease all violation of this License, then your
444
+ license from a particular copyright holder is reinstated (a)
445
+ provisionally, unless and until the copyright holder explicitly and
446
+ finally terminates your license, and (b) permanently, if the copyright
447
+ holder fails to notify you of the violation by some reasonable means
448
+ prior to 60 days after the cessation.
449
+
450
+ Moreover, your license from a particular copyright holder is
451
+ reinstated permanently if the copyright holder notifies you of the
452
+ violation by some reasonable means, this is the first time you have
453
+ received notice of violation of this License (for any work) from that
454
+ copyright holder, and you cure the violation prior to 30 days after
455
+ your receipt of the notice.
456
+
457
+ Termination of your rights under this section does not terminate the
458
+ licenses of parties who have received copies or rights from you under
459
+ this License. If your rights have been terminated and not permanently
460
+ reinstated, you do not qualify to receive new licenses for the same
461
+ material under section 10.
462
+
463
+ 9. Acceptance Not Required for Having Copies.
464
+
465
+ You are not required to accept this License in order to receive or
466
+ run a copy of the Program. Ancillary propagation of a covered work
467
+ occurring solely as a consequence of using peer-to-peer transmission
468
+ to receive a copy likewise does not require acceptance. However,
469
+ nothing other than this License grants you permission to propagate or
470
+ modify any covered work. These actions infringe copyright if you do
471
+ not accept this License. Therefore, by modifying or propagating a
472
+ covered work, you indicate your acceptance of this License to do so.
473
+
474
+ 10. Automatic Licensing of Downstream Recipients.
475
+
476
+ Each time you convey a covered work, the recipient automatically
477
+ receives a license from the original licensors, to run, modify and
478
+ propagate that work, subject to this License. You are not responsible
479
+ for enforcing compliance by third parties with this License.
480
+
481
+ An "entity transaction" is a transaction transferring control of an
482
+ organization, or substantially all assets of one, or subdividing an
483
+ organization, or merging organizations. If propagation of a covered
484
+ work results from an entity transaction, each party to that
485
+ transaction who receives a copy of the work also receives whatever
486
+ licenses to the work the party's predecessor in interest had or could
487
+ give under the previous paragraph, plus a right to possession of the
488
+ Corresponding Source of the work from the predecessor in interest, if
489
+ the predecessor has it or can get it with reasonable efforts.
490
+
491
+ You may not impose any further restrictions on the exercise of the
492
+ rights granted or affirmed under this License. For example, you may
493
+ not impose a license fee, royalty, or other charge for exercise of
494
+ rights granted under this License, and you may not initiate litigation
495
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
496
+ any patent claim is infringed by making, using, selling, offering for
497
+ sale, or importing the Program or any portion of it.
498
+
499
+ 11. Patents.
500
+
501
+ A "contributor" is a copyright holder who authorizes use under this
502
+ License of the Program or a work on which the Program is based. The
503
+ work thus licensed is called the contributor's "contributor version".
504
+
505
+ A contributor's "essential patent claims" are all patent claims
506
+ owned or controlled by the contributor, whether already acquired or
507
+ hereafter acquired, that would be infringed by some manner, permitted
508
+ by this License, of making, using, or selling its contributor version,
509
+ but do not include claims that would be infringed only as a
510
+ consequence of further modification of the contributor version. For
511
+ purposes of this definition, "control" includes the right to grant
512
+ patent sublicenses in a manner consistent with the requirements of
513
+ this License.
514
+
515
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
516
+ patent license under the contributor's essential patent claims, to
517
+ make, use, sell, offer for sale, import and otherwise run, modify and
518
+ propagate the contents of its contributor version.
519
+
520
+ In the following three paragraphs, a "patent license" is any express
521
+ agreement or commitment, however denominated, not to enforce a patent
522
+ (such as an express permission to practice a patent or covenant not to
523
+ sue for patent infringement). To "grant" such a patent license to a
524
+ party means to make such an agreement or commitment not to enforce a
525
+ patent against the party.
526
+
527
+ If you convey a covered work, knowingly relying on a patent license,
528
+ and the Corresponding Source of the work is not available for anyone
529
+ to copy, free of charge and under the terms of this License, through a
530
+ publicly available network server or other readily accessible means,
531
+ then you must either (1) cause the Corresponding Source to be so
532
+ available, or (2) arrange to deprive yourself of the benefit of the
533
+ patent license for this particular work, or (3) arrange, in a manner
534
+ consistent with the requirements of this License, to extend the patent
535
+ license to downstream recipients. "Knowingly relying" means you have
536
+ actual knowledge that, but for the patent license, your conveying the
537
+ covered work in a country, or your recipient's use of the covered work
538
+ in a country, would infringe one or more identifiable patents in that
539
+ country that you have reason to believe are valid.
540
+
541
+ If, pursuant to or in connection with a single transaction or
542
+ arrangement, you convey, or propagate by procuring conveyance of, a
543
+ covered work, and grant a patent license to some of the parties
544
+ receiving the covered work authorizing them to use, propagate, modify
545
+ or convey a specific copy of the covered work, then the patent license
546
+ you grant is automatically extended to all recipients of the covered
547
+ work and works based on it.
548
+
549
+ A patent license is "discriminatory" if it does not include within
550
+ the scope of its coverage, prohibits the exercise of, or is
551
+ conditioned on the non-exercise of one or more of the rights that are
552
+ specifically granted under this License. You may not convey a covered
553
+ work if you are a party to an arrangement with a third party that is
554
+ in the business of distributing software, under which you make payment
555
+ to the third party based on the extent of your activity of conveying
556
+ the work, and under which the third party grants, to any of the
557
+ parties who would receive the covered work from you, a discriminatory
558
+ patent license (a) in connection with copies of the covered work
559
+ conveyed by you (or copies made from those copies), or (b) primarily
560
+ for and in connection with specific products or compilations that
561
+ contain the covered work, unless you entered into that arrangement,
562
+ or that patent license was granted, prior to 28 March 2007.
563
+
564
+ Nothing in this License shall be construed as excluding or limiting
565
+ any implied license or other defenses to infringement that may
566
+ otherwise be available to you under applicable patent law.
567
+
568
+ 12. No Surrender of Others' Freedom.
569
+
570
+ If conditions are imposed on you (whether by court order, agreement or
571
+ otherwise) that contradict the conditions of this License, they do not
572
+ excuse you from the conditions of this License. If you cannot convey a
573
+ covered work so as to satisfy simultaneously your obligations under this
574
+ License and any other pertinent obligations, then as a consequence you may
575
+ not convey it at all. For example, if you agree to terms that obligate you
576
+ to collect a royalty for further conveying from those to whom you convey
577
+ the Program, the only way you could satisfy both those terms and this
578
+ License would be to refrain entirely from conveying the Program.
579
+
580
+ 13. Use with the GNU Affero General Public License.
581
+
582
+ Notwithstanding any other provision of this License, you have
583
+ permission to link or combine any covered work with a work licensed
584
+ under version 3 of the GNU Affero General Public License into a single
585
+ combined work, and to convey the resulting work. The terms of this
586
+ License will continue to apply to the part which is the covered work,
587
+ but the special requirements of the GNU Affero General Public License,
588
+ section 13, concerning interaction through a network will apply to the
589
+ combination as such.
590
+
591
+ 14. Revised Versions of this License.
592
+
593
+ The Free Software Foundation may publish revised and/or new versions of
594
+ the GNU General Public License from time to time. Such new versions will
595
+ be similar in spirit to the present version, but may differ in detail to
596
+ address new problems or concerns.
597
+
598
+ Each version is given a distinguishing version number. If the
599
+ Program specifies that a certain numbered version of the GNU General
600
+ Public License "or any later version" applies to it, you have the
601
+ option of following the terms and conditions either of that numbered
602
+ version or of any later version published by the Free Software
603
+ Foundation. If the Program does not specify a version number of the
604
+ GNU General Public License, you may choose any version ever published
605
+ by the Free Software Foundation.
606
+
607
+ If the Program specifies that a proxy can decide which future
608
+ versions of the GNU General Public License can be used, that proxy's
609
+ public statement of acceptance of a version permanently authorizes you
610
+ to choose that version for the Program.
611
+
612
+ Later license versions may give you additional or different
613
+ permissions. However, no additional obligations are imposed on any
614
+ author or copyright holder as a result of your choosing to follow a
615
+ later version.
616
+
617
+ 15. Disclaimer of Warranty.
618
+
619
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
620
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
621
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
622
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
623
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
624
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
625
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
626
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
627
+
628
+ 16. Limitation of Liability.
629
+
630
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
631
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
632
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
633
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
634
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
635
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
636
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
637
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
638
+ SUCH DAMAGES.
639
+
640
+ 17. Interpretation of Sections 15 and 16.
641
+
642
+ If the disclaimer of warranty and limitation of liability provided
643
+ above cannot be given local legal effect according to their terms,
644
+ reviewing courts shall apply local law that most closely approximates
645
+ an absolute waiver of all civil liability in connection with the
646
+ Program, unless a warranty or assumption of liability accompanies a
647
+ copy of the Program in return for a fee.
648
+
649
+ END OF TERMS AND CONDITIONS
650
+
651
+ How to Apply These Terms to Your New Programs
652
+
653
+ If you develop a new program, and you want it to be of the greatest
654
+ possible use to the public, the best way to achieve this is to make it
655
+ free software which everyone can redistribute and change under these terms.
656
+
657
+ To do so, attach the following notices to the program. It is safest
658
+ to attach them to the start of each source file to most effectively
659
+ state the exclusion of warranty; and each file should have at least
660
+ the "copyright" line and a pointer to where the full notice is found.
661
+
662
+ {one line to give the program's name and a brief idea of what it does.}
663
+ Copyright (C) {year} {name of author}
664
+
665
+ This program is free software: you can redistribute it and/or modify
666
+ it under the terms of the GNU General Public License as published by
667
+ the Free Software Foundation, either version 3 of the License, or
668
+ (at your option) any later version.
669
+
670
+ This program is distributed in the hope that it will be useful,
671
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
672
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
673
+ GNU General Public License for more details.
674
+
675
+ You should have received a copy of the GNU General Public License
676
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
677
+
678
+ Also add information on how to contact you by electronic and paper mail.
679
+
680
+ If the program does terminal interaction, make it output a short
681
+ notice like this when it starts in an interactive mode:
682
+
683
+ {project} Copyright (C) {year} {fullname}
684
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
685
+ This is free software, and you are welcome to redistribute it
686
+ under certain conditions; type `show c' for details.
687
+
688
+ The hypothetical commands `show w' and `show c' should show the appropriate
689
+ parts of the General Public License. Of course, your program's commands
690
+ might be different; for a GUI interface, you would use an "about box".
691
+
692
+ You should also get your employer (if you work as a programmer) or school,
693
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
694
+ For more information on this, and how to apply and follow the GNU GPL, see
695
+ <http://www.gnu.org/licenses/>.
696
+
697
+ The GNU General Public License does not permit incorporating your program
698
+ into proprietary programs. If your program is a subroutine library, you
699
+ may consider it more useful to permit linking proprietary applications with
700
+ the library. If this is what you want to do, use the GNU Lesser General
701
+ Public License instead of this License. But first, please read
702
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
readme.txt ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Everest Forms - Easy Contact Form and Form Builder ===
2
+ Contributors: WPEverest
3
+ Tags: form, form builder, easy form, clean form, login form, contact, contact form
4
+ Requires at least: 4.0
5
+ Tested up to: 4.9
6
+ Stable tag: 1.0.0
7
+ License: GPLv3
8
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
+
10
+ Drag and Drop form builder to easily create contact forms and more.
11
+
12
+ == Description ==
13
+ Everest Forms plugin provides you with an easy way to create any kind of forms including contact forms. Drag and Drop fields make ordering and creating forms so easy that even a beginner to WordPress can create beautiful forms within minutes. The plugin is a lightweight, extendible and 100% mobile responsive.
14
+
15
+
16
+ View [All features](https://wpeverest.com/wordpress-plugins/everest-forms/)
17
+
18
+ View [Demo](http://demo.wpeverest.com/everest-forms/)
19
+
20
+ Get [free support](https://wpeverest.com/support-forum/)
21
+
22
+ Check [documentation](http://docs.wpeverest.com/docs/everest-forms/)
23
+
24
+ ### Features And Options:
25
+ * Create unlimited forms without any restrictions
26
+ * Drag and Drop Form fields
27
+ * Supports all commonly used form fields including radio, dropdowns, checkboxes, date and more
28
+ * 100% responsive form template
29
+ * Supports multiple column layout
30
+ * Shortcode support
31
+ * Provides two different form template design
32
+ * Google Recaptcha Supported
33
+ * Editable successful form submission message
34
+ * Redirect option after submission
35
+ * Editable Email Settings
36
+ * Editable form validation message
37
+ * Translation ready
38
+
39
+ == Installation ==
40
+
41
+ 1. Install the plugin either via the WordPress.org plugin directory, or by uploading the files to your server (in the /wp-content/plugins/ directory).
42
+ 2. Activate the Everest Forms plugin through the 'Plugins' menu in WordPress.
43
+ 3. Go to User Everest Forms->Add New and start creating the form.
44
+
45
+ == Frequently Asked Questions ==
46
+
47
+ = What is the plugin license? =
48
+
49
+ * This plugin is released under a GPL license.
50
+
51
+ = Does the plugin work with any WordPress themes?
52
+
53
+ Yes, the plugin is designed to work with any themes that have been coded following WordPress guidelines.
54
+
55
+ == Screenshots ==
56
+
57
+ 1. Form Fields
58
+ 2. Form Field Options
59
+ 3. Form General Settings
60
+ 4. Form Email Settings
61
+ 5. Settings General
62
+ 6. Settings Recaptcha
63
+ 7. Settings Email
64
+ 8. Settings Validation
65
+ 9. Simple Contact Form 1
66
+ 10. Simple Contact Form 2
67
+ 11. Advance Form
68
+
69
+ == Changelog ==
70
+ = 1.0.0 - 02/02/2018 =
71
+ * Initial Release
templates/notices/error.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show error messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/everest-forms/notices/error.php.
6
+ *
7
+ * HOWEVER, on occasion Everest Forms will need to update template files and you
8
+ * and you (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.wpeverest.com/docs/everest-forms/template-structure/
14
+ * @package EverestForms/Templates
15
+ * @version 1.0.0
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+ ?>
20
+
21
+ <?php if ( $messages ) : ?>
22
+ <div class="everest-forms-notice everest-forms-notice--error" role="alert">
23
+ <?php if ( 1 === count( $messages ) ) : ?>
24
+ <?php echo wp_kses_post( $messages[0] ); ?>
25
+ <?php else : ?>
26
+ <ul class="everest-forms-notice-list">
27
+ <?php foreach ( $messages as $message ) : ?>
28
+ <li class="everest-forms-notice-list__item"><?php echo wp_kses_post( $message ); ?></li>
29
+ <?php endforeach; ?>
30
+ </ul>
31
+ <?php endif; ?>
32
+ </div>
33
+ <?php endif; ?>
templates/notices/notice.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/everest-forms/notices/notice.php.
6
+ *
7
+ * HOWEVER, on occasion Everest Forms will need to update template files and you
8
+ * and you (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.wpeverest.com/docs/everest-forms/template-structure/
14
+ * @package EverestForms/Templates
15
+ * @version 1.0.0
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+ ?>
20
+
21
+ <?php if ( $messages ) : ?>
22
+ <?php foreach ( $messages as $message ) : ?>
23
+ <div class="everest-forms-notice"><?php echo wp_kses_post( $message ); ?></div>
24
+ <?php endforeach; ?>
25
+ <?php endif; ?>
templates/notices/success.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show success messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/everest-forms/notices/success.php.
6
+ *
7
+ * HOWEVER, on occasion Everest Forms will need to update template files and you
8
+ * and you (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.wpeverest.com/docs/everest-forms/template-structure/
14
+ * @package EverestForms/Templates
15
+ * @version 1.0.0
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+ ?>
20
+
21
+ <?php if ( $messages ) : ?>
22
+ <?php foreach ( $messages as $message ) : ?>
23
+ <div class="everest-forms-notice everest-forms-notice--success" role="alert"><?php echo wp_kses_post( $message ); ?></div>
24
+ <?php endforeach; ?>
25
+ <?php endif; ?>
uninstall.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EverestForms Uninstall
4
+ *
5
+ * Uninstalls the plugin deletes user roles, tables, and options.
6
+ *
7
+ * @package EverestForms\Uninstaller
8
+ * @version 1.0.0
9
+ */
10
+
11
+ defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
12
+
13
+ global $wpdb;
14
+
15
+ wp_clear_scheduled_hook( 'everest_forms_cleanup_sessions' );
16
+
17
+ /*
18
+ * Only remove ALL data if EVF_REMOVE_ALL_DATA constant is set to true in user's
19
+ * wp-config.php. This is to prevent data loss when deleting the plugin from the backend
20
+ * and to ensure only the site owner can perform this action.
21
+ */
22
+ if ( defined( 'EVF_REMOVE_ALL_DATA' ) && true === EVF_REMOVE_ALL_DATA ) {
23
+ // Roles + caps.
24
+ include_once( dirname( __FILE__ ) . '/includes/class-evf-install.php' );
25
+ EVF_Install::remove_roles();
26
+
27
+ // Pages.
28
+ wp_trash_post( get_option( 'evf_default_form_page_id' ) );
29
+
30
+ // Tables.
31
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}evf_sessions" );
32
+
33
+ // Delete options.
34
+ $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'evf\_%';" );
35
+
36
+ // Delete posts + data.
37
+ $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'everest_form' );" );
38
+ $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
39
+
40
+ // Clear any cached data that has been removed.
41
+ wp_cache_flush();
42
+ }