WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress - Version 2.5.2

Version Description

Download this release

Release Info

Developer tareq1988
Plugin Icon 128x128 WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress
Version 2.5.2
Comparing to
See all releases

Code changes from version 2.5.1 to 2.5.2

Files changed (186) hide show
  1. .svnignore +0 -7
  2. admin/add-ons.php +100 -0
  3. admin/form-builder/assets/js/components/builder-stage/index.js +168 -0
  4. admin/form-builder/assets/js/components/builder-stage/template.php +75 -0
  5. admin/form-builder/assets/js/components/field-checkbox/index.js +41 -0
  6. admin/form-builder/assets/js/components/field-checkbox/template.php +12 -0
  7. admin/form-builder/assets/js/components/field-html_help_text/index.js +7 -0
  8. admin/form-builder/assets/js/components/field-html_help_text/template.php +1 -0
  9. admin/form-builder/assets/js/components/field-option-data/index.js +117 -0
  10. admin/form-builder/assets/js/components/field-option-data/template.php +65 -0
  11. admin/form-builder/assets/js/components/field-option-pro-feature-alert/index.js +13 -0
  12. admin/form-builder/assets/js/components/field-option-pro-feature-alert/template.php +6 -0
  13. admin/form-builder/assets/js/components/field-options/index.js +68 -0
  14. admin/form-builder/assets/js/components/field-options/template.php +47 -0
  15. admin/form-builder/assets/js/components/field-radio/index.js +23 -0
  16. admin/form-builder/assets/js/components/field-radio/template.php +13 -0
  17. admin/form-builder/assets/js/components/field-select/index.js +23 -0
  18. admin/form-builder/assets/js/components/field-select/template.php +10 -0
  19. admin/form-builder/assets/js/components/field-text-meta/index.js +40 -0
  20. admin/form-builder/assets/js/components/field-text-meta/template.php +9 -0
  21. admin/form-builder/assets/js/components/field-text/index.js +28 -0
  22. admin/form-builder/assets/js/components/field-text/template.php +21 -0
  23. admin/form-builder/assets/js/components/field-textarea/index.js +19 -0
  24. admin/form-builder/assets/js/components/field-textarea/template.php +7 -0
  25. admin/form-builder/assets/js/components/form-checkbox_field/index.js +10 -0
  26. admin/form-builder/assets/js/components/form-checkbox_field/template.php +16 -0
  27. admin/form-builder/assets/js/components/form-custom_hidden_field/index.js +10 -0
  28. admin/form-builder/assets/js/components/form-custom_hidden_field/template.php +10 -0
  29. admin/form-builder/assets/js/components/form-custom_html/index.js +16 -0
  30. admin/form-builder/assets/js/components/form-custom_html/template.php +1 -0
  31. admin/form-builder/assets/js/components/form-dropdown_field/index.js +10 -0
  32. admin/form-builder/assets/js/components/form-dropdown_field/template.php +16 -0
  33. admin/form-builder/assets/js/components/form-email_address/index.js +10 -0
  34. admin/form-builder/assets/js/components/form-email_address/template.php +10 -0
  35. admin/form-builder/assets/js/components/form-featured_image/index.js +10 -0
  36. admin/form-builder/assets/js/components/form-featured_image/template.php +11 -0
  37. admin/form-builder/assets/js/components/form-fields/index.js +117 -0
  38. admin/form-builder/assets/js/components/form-fields/template.php +49 -0
  39. admin/form-builder/assets/js/components/form-image_upload/index.js +10 -0
  40. admin/form-builder/assets/js/components/form-image_upload/template.php +11 -0
  41. admin/form-builder/assets/js/components/form-multiple_select/index.js +10 -0
  42. admin/form-builder/assets/js/components/form-multiple_select/template.php +17 -0
  43. admin/form-builder/assets/js/components/form-post_content/index.js +10 -0
  44. admin/form-builder/assets/js/components/form-post_content/template.php +20 -0
  45. admin/form-builder/assets/js/components/form-post_excerpt/index.js +10 -0
  46. admin/form-builder/assets/js/components/form-post_excerpt/template.php +9 -0
  47. admin/form-builder/assets/js/components/form-post_tags/index.js +10 -0
  48. admin/form-builder/assets/js/components/form-post_tags/template.php +11 -0
  49. admin/form-builder/assets/js/components/form-post_title/index.js +10 -0
  50. admin/form-builder/assets/js/components/form-post_title/template.php +10 -0
  51. admin/form-builder/assets/js/components/form-radio_field/index.js +10 -0
  52. admin/form-builder/assets/js/components/form-radio_field/template.php +16 -0
  53. admin/form-builder/assets/js/components/form-section_break/index.js +10 -0
  54. admin/form-builder/assets/js/components/form-section_break/template.php +4 -0
  55. admin/form-builder/assets/js/components/form-taxonomy/index.js +163 -0
  56. admin/form-builder/assets/js/components/form-taxonomy/template.php +41 -0
  57. admin/form-builder/assets/js/components/form-text_field/index.js +10 -0
  58. admin/form-builder/assets/js/components/form-text_field/template.php +10 -0
  59. admin/form-builder/assets/js/components/form-textarea_field/index.js +7 -0
  60. admin/form-builder/assets/js/components/form-textarea_field/template.php +13 -0
  61. admin/form-builder/assets/js/components/form-website_url/index.js +10 -0
  62. admin/form-builder/assets/js/components/form-website_url/template.php +10 -0
  63. admin/form-builder/assets/js/components/help-text/index.js +14 -0
  64. admin/form-builder/assets/js/components/help-text/template.php +1 -0
  65. admin/form-builder/assets/js/components/text-editor/editor.less +63 -0
  66. admin/form-builder/assets/js/components/text-editor/index.js +15 -0
  67. admin/form-builder/assets/js/components/text-editor/style.less +53 -0
  68. admin/form-builder/assets/js/components/text-editor/template.php +70 -0
  69. admin/form-builder/assets/js/form-builder-assets.js +46 -0
  70. admin/form-builder/assets/js/form-builder.js +458 -0
  71. admin/form-builder/assets/js/jquery-siaf-end.js +1 -0
  72. admin/form-builder/assets/js/jquery-siaf-start.js +2 -0
  73. admin/form-builder/assets/js/mixins/form-field.js +53 -0
  74. admin/form-builder/assets/js/mixins/global.js +67 -0
  75. admin/form-builder/assets/js/mixins/option-field.js +57 -0
  76. admin/form-builder/assets/less/form-builder.less +947 -0
  77. admin/form-builder/assets/less/mixins/center-block.less +7 -0
  78. admin/form-builder/assets/less/mixins/clearfix.less +22 -0
  79. admin/form-builder/assets/less/mixins/custom-mixins.less +70 -0
  80. admin/form-builder/assets/less/mixins/hide-text.less +21 -0
  81. admin/form-builder/assets/less/mixins/opacity.less +8 -0
  82. admin/form-builder/assets/less/mixins/reset-text.less +18 -0
  83. admin/form-builder/assets/less/mixins/size.less +10 -0
  84. admin/form-builder/assets/less/mixins/text-overflow.less +8 -0
  85. admin/form-builder/assets/less/mixins/vendor-prefixes.less +227 -0
  86. admin/form-builder/assets/less/variables.less +8 -0
  87. admin/form-builder/class-wpuf-admin-form-builder-ajax.php +64 -0
  88. admin/form-builder/class-wpuf-admin-form-builder.php +423 -0
  89. admin/form-builder/class-wpuf-form-builder-field-settings.php +785 -0
  90. admin/form-builder/views/form-builder.php +115 -0
  91. admin/form-handler.php +372 -0
  92. admin/form-template.php +218 -0
  93. admin/form.php +875 -0
  94. admin/html/form-settings-post-edit.php +100 -0
  95. admin/html/form-settings-post.php +251 -0
  96. admin/html/modal.php +106 -0
  97. admin/installer.php +177 -0
  98. admin/post-forms-list-table-view.php +36 -0
  99. admin/post-forms-list-table.php +418 -0
  100. admin/posting.php +434 -0
  101. admin/promotion.php +174 -0
  102. admin/settings-options.php +445 -0
  103. admin/settings.php +287 -0
  104. admin/subscription.php +609 -0
  105. admin/template-post.php +296 -0
  106. admin/template.php +664 -0
  107. admin/tools.php +445 -0
  108. admin/transactions.php +27 -0
  109. assets/css/admin.css +168 -0
  110. assets/css/chosen/chosen-sprite.png +0 -0
  111. assets/css/chosen/chosen-sprite@2x.png +0 -0
  112. assets/css/chosen/chosen.css +436 -0
  113. assets/css/formbuilder.css +344 -0
  114. assets/css/formbuilder.less +424 -0
  115. assets/css/frontend-forms.css +1161 -0
  116. assets/css/frontend-forms.less +1306 -0
  117. assets/css/images/ui-bg_diagonals-small_75_cccccc_40x40.png +0 -0
  118. assets/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  119. assets/css/images/ui-bg_flat_0_ffffff_40x100.png +0 -0
  120. assets/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  121. assets/css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  122. assets/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  123. assets/css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  124. assets/css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  125. assets/css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  126. assets/css/images/ui-icons_222222_256x240.png +0 -0
  127. assets/css/images/ui-icons_2e83ff_256x240.png +0 -0
  128. assets/css/images/ui-icons_454545_256x240.png +0 -0
  129. assets/css/images/ui-icons_888888_256x240.png +0 -0
  130. assets/css/images/ui-icons_cd0a0a_256x240.png +0 -0
  131. assets/css/jquery-ui-1.9.1.custom.css +461 -0
  132. assets/css/jquery.smallipop.css +117 -0
  133. assets/css/wpuf-form-builder.css +725 -0
  134. assets/css/wpuf.css +467 -0
  135. assets/images/add.png +0 -0
  136. assets/images/arrow-move.png +0 -0
  137. assets/images/arrows.png +0 -0
  138. assets/images/completed.png +0 -0
  139. assets/images/cross.png +0 -0
  140. assets/images/del.png +0 -0
  141. assets/images/delete.png +0 -0
  142. assets/images/edit.png +0 -0
  143. assets/images/help.png +0 -0
  144. assets/images/icon-minus.png +0 -0
  145. assets/images/icon-plus.png +0 -0
  146. assets/images/no-image.png +0 -0
  147. assets/images/paypal.png +0 -0
  148. assets/images/processing.png +0 -0
  149. assets/images/remove.png +0 -0
  150. assets/images/tick.png +0 -0
  151. assets/images/ufp.png +0 -0
  152. assets/images/wpspin_light.gif +0 -0
  153. assets/js/admin-shortcode.js +38 -0
  154. assets/js/chosen.jquery.js +1211 -0
  155. assets/js/conditional-logic.js +139 -0
  156. assets/js/conditional.js +321 -0
  157. assets/js/countries.json +245 -0
  158. assets/js/formbuilder.js +398 -0
  159. assets/js/formbuilder.min.js +1 -0
  160. assets/js/frontend-form.js +903 -0
  161. assets/js/frontend-form.min.js +1 -0
  162. assets/js/jquery-ui-timepicker-addon.js +1919 -0
  163. assets/js/jquery.smallipop-0.4.0.min.js +9 -0
  164. assets/js/jquery.validate.min.js +4 -0
  165. assets/js/subscriptions.js +307 -0
  166. assets/js/upload.js +214 -0
  167. assets/js/upload.min.js +1 -0
  168. assets/js/wpuf-form-builder-components.js +1065 -0
  169. assets/js/wpuf-form-builder-mixins.js +184 -0
  170. assets/js/wpuf-form-builder-wpuf-forms.js +135 -0
  171. assets/js/wpuf-form-builder.js +458 -0
  172. assets/js/wpuf-tmc-button.js +31 -0
  173. assets/vendor/clipboard/clipboard.js +778 -0
  174. assets/vendor/clipboard/clipboard.min.js +7 -0
  175. assets/vendor/vue/vue.js +0 -0
  176. assets/vendor/vue/vue.min.js +0 -0
  177. assets/vendor/vuex/vuex.js +0 -0
  178. assets/vendor/vuex/vuex.min.js +0 -0
  179. class/frontend-form-post.php +11 -11
  180. class/payment.php +1 -49
  181. class/post-form-template.php +20 -0
  182. class/render-form.php +115 -74
  183. class/subscription.php +8 -8
  184. includes/free/admin/shortcode-builder.php +87 -0
  185. includes/free/admin/shortcode-button.php +160 -0
  186. languages/wpuf.pot +205 -187
.svnignore DELETED
@@ -1,7 +0,0 @@
1
- includes/pro
2
- nbproject
3
- Gruntfile.js
4
- package.json
5
- docs.md
6
- changelog.txt
7
- plugin-deploy.sh
 
 
 
 
 
 
 
admin/add-ons.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e( 'WP User Frontend - Add-Ons', 'wpuf' ); ?></h2>
3
+
4
+ <?php
5
+ $add_ons = get_transient( 'wpuf_addons' );
6
+
7
+ if ( false === $add_ons ) {
8
+ $response = wp_remote_get( 'https://wedevs.com/api/wpuf/addons.php', array('timeout' => 15) );
9
+ $update = wp_remote_retrieve_body( $response );
10
+
11
+ if ( is_wp_error( $response ) || $response['response']['code'] != 200 ) {
12
+ return false;
13
+ }
14
+
15
+ set_transient( 'wpuf_addons', $update, 12 * HOUR_IN_SECONDS );
16
+ $add_ons = $update;
17
+ }
18
+
19
+ $add_ons = json_decode( $add_ons );
20
+
21
+ if ( count( $add_ons ) ) {
22
+ foreach ($add_ons as $addon) {
23
+ ?>
24
+
25
+ <div class="wpuf-addon">
26
+ <div class="wpuf-addon-thumb">
27
+ <a href="<?php echo $addon->url; ?>" target="_blank">
28
+ <img src="<?php echo $addon->thumbnail; ?>" alt="<?php echo esc_attr( $addon->title ); ?>" />
29
+ </a>
30
+ </div>
31
+
32
+ <div class="wpuf-detail">
33
+ <h3 class="title">
34
+ <a href="<?php echo $addon->url; ?>" target="_blank"><?php echo $addon->title; ?></a>
35
+ </h3>
36
+
37
+ <div class="text"><?php echo $addon->desc; ?></div>
38
+ </div>
39
+
40
+ <div class="wpuf-links">
41
+ <?php if ( class_exists( $addon->class ) ) { ?>
42
+ <a class="button button-disabled" href="<?php echo $addon->url; ?>" target="_blank">Installed</a>
43
+ <?php } else { ?>
44
+ <a class="button" href="<?php echo $addon->url; ?>" target="_blank">View Details</a>
45
+ <?php } ?>
46
+ </div>
47
+ </div>
48
+
49
+ <?php
50
+ }
51
+ } else {
52
+ echo '<div class="error"><p>Error fetching add-ons. Please refresh the page again.</p></div>';
53
+ }
54
+ ?>
55
+
56
+ <style type="text/css">
57
+ .wpuf-addon {
58
+ width: 22%;
59
+ float: left;
60
+ margin: 10px;
61
+ border: 1px solid #E6E6E6;
62
+ }
63
+
64
+ .wpuf-addon:nth-child(5n+1) {
65
+ clear: both;
66
+ }
67
+
68
+ .wpuf-addon-thumb img {
69
+ max-width: 100%;
70
+ /*max-height: 140px;*/
71
+ }
72
+
73
+ .wpuf-detail {
74
+ padding: 6px 10px 10px;
75
+ min-height: 110px;
76
+ background: #fff;
77
+ }
78
+
79
+ .wpuf-detail h3.title {
80
+ margin: 5px 0 10px;
81
+ padding: 0;
82
+ }
83
+
84
+ .wpuf-detail h3.title a {
85
+ text-decoration: none;
86
+ color: #111;
87
+ }
88
+
89
+ .wpuf-links {
90
+ padding: 10px;
91
+ background: #F5F5F5;
92
+ border-top: 1px solid #E6E6E6;
93
+ }
94
+
95
+ a.button.disabled {
96
+ background: #eee;
97
+ }
98
+ </style>
99
+
100
+ </div>
admin/form-builder/assets/js/components/builder-stage/index.js ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('builder-stage', {
2
+ template: '#tmpl-wpuf-builder-stage',
3
+
4
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.builder_stage),
5
+
6
+ computed: {
7
+ form_fields: function () {
8
+ return this.$store.state.form_fields;
9
+ },
10
+
11
+ field_settings: function () {
12
+ return this.$store.state.field_settings;
13
+ },
14
+
15
+ hidden_fields: function () {
16
+ return this.$store.state.form_fields.filter(function (item) {
17
+ return 'hidden' === item.input_type;
18
+ });
19
+ },
20
+
21
+ editing_form_id: function () {
22
+ return this.$store.state.editing_field_id;
23
+ },
24
+
25
+ pro_link: function () {
26
+ return wpuf_form_builder.pro_link;
27
+ }
28
+ },
29
+
30
+ mounted: function () {
31
+ var self = this;
32
+
33
+ // bind jquery ui sortable
34
+ $('#form-preview-stage .wpuf-form.sortable-list').sortable({
35
+ placeholder: 'form-preview-stage-dropzone',
36
+ items: '.field-items',
37
+ handle: '.control-buttons .move',
38
+ scroll: true,
39
+ update: function (e, ui) {
40
+ var item = ui.item[0],
41
+ data = item.dataset,
42
+ source = data.source,
43
+ toIndex = parseInt($(ui.item).index()),
44
+ payload = {
45
+ toIndex: toIndex
46
+ };
47
+
48
+ if ('panel' === source) {
49
+ // prepare the payload to add new form element
50
+ var field_template = ui.item[0].dataset.formField,
51
+ field = $.extend(true, {}, self.field_settings[field_template].field_props);
52
+
53
+ // add a random integer id
54
+ field.id = self.get_random_id();
55
+
56
+ // add meta key
57
+ if ('yes' === field.is_meta && !field.name) {
58
+ field.name = field.label.replace(/\W/g, '_').toLowerCase() + '_' + field.id;
59
+ }
60
+
61
+ payload.field = field;
62
+
63
+ // add new form element
64
+ self.$store.commit('add_form_field_element', payload);
65
+
66
+ // remove button from stage
67
+ $(this).find('.button.ui-draggable.ui-draggable-handle').remove();
68
+
69
+ } else if ('stage' === source) {
70
+ payload.fromIndex = parseInt(data.index);
71
+
72
+ self.$store.commit('swap_form_field_elements', payload);
73
+ }
74
+
75
+ }
76
+ });
77
+ },
78
+
79
+ methods: {
80
+
81
+ open_field_settings: function(field_id) {
82
+ this.$store.commit('open_field_settings', field_id);
83
+ },
84
+
85
+ clone_field: function(field_id, index) {
86
+ var payload = {
87
+ field_id: field_id,
88
+ index: index,
89
+ new_id: this.get_random_id()
90
+ };
91
+
92
+ // single instance checking
93
+ var field = _.find(this.$store.state.form_fields, function (item) {
94
+ return parseInt(item.id) === parseInt(payload.field_id);
95
+ });
96
+
97
+ // check if these are already inserted
98
+ if ( this.isSingleInstance( field.template ) && this.containsField( field.template ) ) {
99
+ swal({
100
+ title: "Oops...",
101
+ text: "You already have this field in the form"
102
+ });
103
+ return;
104
+ }
105
+
106
+ this.$store.commit('clone_form_field_element', payload);
107
+ },
108
+
109
+ delete_field: function(index) {
110
+ var self = this;
111
+
112
+ self.warn({
113
+ text: self.i18n.delete_field_warn_msg,
114
+ confirmButtonText: self.i18n.yes_delete_it,
115
+ cancelButtonText: self.i18n.no_cancel_it,
116
+ }, function (is_confirm) {
117
+ if (is_confirm) {
118
+ self.$store.commit('delete_form_field_element', index);
119
+ }
120
+ });
121
+ },
122
+
123
+ delete_hidden_field: function (field_id) {
124
+ var i = 0;
125
+
126
+ for (i = 0; i < this.form_fields.length; i++) {
127
+ if (parseInt(field_id) === parseInt(this.form_fields[i].id)) {
128
+ this.delete_field(i);
129
+ }
130
+ }
131
+ },
132
+
133
+ is_pro_feature: function (template) {
134
+ return (this.field_settings[template] && this.field_settings[template].pro_feature) ? true : false;
135
+ },
136
+
137
+ is_template_available: function (field) {
138
+ var template = field.template;
139
+
140
+ if (this.field_settings[template]) {
141
+ if (this.is_pro_feature(template)) {
142
+ return false;
143
+ }
144
+
145
+ return true;
146
+ }
147
+
148
+ // for example see 'mixin_builder_stage' mixin's 'is_taxonomy_template_available' method
149
+ if (_.isFunction(this['is_' + template + '_template_available'])) {
150
+ return this['is_' + template + '_template_available'].call(this, field);
151
+ }
152
+
153
+ return false;
154
+ },
155
+
156
+ is_full_width: function (template) {
157
+ if (this.field_settings[template] && this.field_settings[template].is_full_width) {
158
+ return true;
159
+ }
160
+
161
+ return false;
162
+ },
163
+
164
+ get_field_name: function (template) {
165
+ return this.field_settings[template].title;
166
+ }
167
+ }
168
+ });
admin/form-builder/assets/js/components/builder-stage/template.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="form-preview-stage">
2
+ <h4 v-if="!form_fields.length" class="text-center">
3
+ <?php _e( 'Add fields by dragging the fields from the right sidebar to this area.', 'wpuf' ) ?>
4
+ </h4>
5
+
6
+ <!-- {{ field_settings.label_position }} -->
7
+
8
+ <ul :class="['wpuf-form', 'sortable-list', 'form-label-' + label_type]">
9
+ <li
10
+ v-for="(field, index) in form_fields"
11
+ :key="field.id"
12
+ :class="[
13
+ 'field-items', 'wpuf-el', field.name, field.css, 'form-field-' + field.template,
14
+ ('hidden' === field.input_type) ? 'hidden-field' : '',
15
+ parseInt(editing_form_id) === parseInt(field.id) ? 'current-editing' : ''
16
+ ]"
17
+ :data-index="index"
18
+ data-source="stage"
19
+ >
20
+ <div v-if="!is_full_width(field.template)" class="wpuf-label">
21
+ <label :for="'wpuf-' + field.name ? field.name : 'cls'">
22
+ {{ field.label }} <span v-if="field.required && 'yes' === field.required" class="required">*</span>
23
+ </label>
24
+ </div>
25
+
26
+ <component v-if="is_template_available(field)" :is="'form-' + field.template" :field="field"></component>
27
+
28
+ <div v-if="is_pro_feature(field.template)" class="stage-pro-alert">
29
+ <label class="wpuf-pro-text-alert">
30
+ <a :href="pro_link" target="_blank"><strong>{{ get_field_name(field.template) }}</strong> <?php _e( 'is available in Pro Version', 'wpuf' ); ?></a>
31
+ </label>
32
+ </div>
33
+
34
+ <div v-if="is_template_available(field) && !is_failed_to_validate(field.template)" class="control-buttons">
35
+ <p>
36
+ <i class="fa fa-arrows move"></i>
37
+ <i class="fa fa-pencil" @click="open_field_settings(field.id)"></i>
38
+ <i class="fa fa-clone" @click="clone_field(field.id, index)"></i>
39
+ <i class="fa fa-trash-o" @click="delete_field(index)"></i>
40
+ </p>
41
+ </div>
42
+ </li>
43
+
44
+ <li v-if="!form_fields.length" class="field-items empty-list-item"></li>
45
+
46
+ <li class="wpuf-submit">
47
+ <div class="wpuf-label">&nbsp;</div>
48
+
49
+ <?php do_action( 'wpuf-form-builder-template-builder-stage-submit-area' ); ?>
50
+ </li>
51
+ </ul><!-- .wpuf-form -->
52
+
53
+ <div v-if="hidden_fields.length" class="hidden-field-list">
54
+ <h4><?php _e( 'Hidden Fields', 'wpuf' ); ?></h4>
55
+
56
+ <ul class="wpuf-form">
57
+ <li
58
+ v-for="(field, index) in hidden_fields"
59
+ :class="['field-items', parseInt(editing_form_id) === parseInt(field.id) ? 'current-editing' : '']"
60
+ >
61
+ <strong><?php _e('key', 'wpuf'); ?></strong>: {{ field.name }} | <strong><?php _e( 'value', 'wpuf' ); ?></strong>: {{ field.meta_value }}
62
+
63
+ <div class="control-buttons">
64
+ <p>
65
+ <i class="fa fa-pencil" @click="open_field_settings(field.id)"></i>
66
+ <i class="fa fa-clone" @click="clone_field(field.id, index)"></i>
67
+ <i class="fa fa-trash-o" @click="delete_hidden_field(field.id)"></i>
68
+ </p>
69
+ </div>
70
+ </li>
71
+ </ul>
72
+ </div>
73
+
74
+ <?php do_action( 'wpuf-form-builder-template-builder-stage-bottom-area' ); ?>
75
+ </div><!-- #form-preview-stage -->
admin/form-builder/assets/js/components/field-checkbox/index.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-checkbox', {
2
+ template: '#tmpl-wpuf-field-checkbox',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ var value = this.editing_form_field[this.option_field.name];
12
+
13
+ if (this.option_field.is_single_opt) {
14
+ var option = Object.keys(this.option_field.options)[0];
15
+
16
+ if (value === option) {
17
+ return true;
18
+
19
+ } else {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ return this.editing_form_field[this.option_field.name];
25
+ },
26
+
27
+ set: function (value) {
28
+ if (this.option_field.is_single_opt) {
29
+ value = value ? Object.keys(this.option_field.options)[0] : '';
30
+ }
31
+
32
+
33
+ this.$store.commit('update_editing_form_field', {
34
+ editing_field_id: this.editing_form_field.id,
35
+ field_name: this.option_field.name,
36
+ value: value
37
+ });
38
+ }
39
+ }
40
+ }
41
+ });
admin/form-builder/assets/js/components/field-checkbox/template.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-checkbox">
2
+ <label v-if="option_field.title" :class="option_field.title_class">
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+ </label>
5
+ <ul :class="[option_field.inline ? 'list-inline' : '']">
6
+ <li v-for="(option, key) in option_field.options">
7
+ <label>
8
+ <input type="checkbox" :value="key" v-model="value"> {{ option }}
9
+ </label>
10
+ </li>
11
+ </ul>
12
+ </div>
admin/form-builder/assets/js/components/field-html_help_text/index.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Vue.component('field-html_help_text', {
2
+ template: '#tmpl-wpuf-field-html_help_text',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+ });
admin/form-builder/assets/js/components/field-html_help_text/template.php ADDED
@@ -0,0 +1 @@
 
1
+ <div class="panel-field-opt panel-field-html-help-text" v-html="option_field.text"></div>
admin/form-builder/assets/js/components/field-option-data/index.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Common settings component for option based fields
3
+ * like select, multiselect, checkbox, radio
4
+ */
5
+ Vue.component('field-option-data', {
6
+ template: '#tmpl-wpuf-field-option-data',
7
+
8
+ mixins: [
9
+ wpuf_mixins.option_field_mixin
10
+ ],
11
+
12
+ data: function () {
13
+ return {
14
+ show_value: false,
15
+ options: [],
16
+ selected: []
17
+ };
18
+ },
19
+
20
+ computed: {
21
+ field_options: function () {
22
+ return this.editing_form_field.options;
23
+ },
24
+
25
+ field_selected: function () {
26
+ return this.editing_form_field.selected;
27
+ }
28
+ },
29
+
30
+ mounted: function () {
31
+ var self = this;
32
+
33
+ this.set_options();
34
+
35
+ $(this.$el).find('.option-field-option-chooser').sortable({
36
+ items: '.option-field-option',
37
+ handle: '.sort-handler',
38
+ update: function (e, ui) {
39
+ var item = ui.item[0],
40
+ data = item.dataset,
41
+ toIndex = parseInt($(ui.item).index()),
42
+ fromIndex = parseInt(data.index);
43
+
44
+ self.options.swap(fromIndex, toIndex);
45
+ }
46
+ });
47
+ },
48
+
49
+ methods: {
50
+ set_options: function () {
51
+ var self = this;
52
+ var field_options = $.extend(true, {}, this.editing_form_field.options);
53
+
54
+ _.each(field_options, function (label, value) {
55
+ self.options.push({label: label, value: value, id: self.get_random_id()});
56
+ });
57
+
58
+ if (this.option_field.is_multiple && !_.isArray(this.field_selected)) {
59
+ this.selected = [this.field_selected];
60
+ } else {
61
+ this.selected = this.field_selected;
62
+ }
63
+ },
64
+
65
+ // in case of select or radio buttons, user should deselect default value
66
+ clear_selection: function () {
67
+ this.selected = null;
68
+ },
69
+
70
+ add_option: function () {
71
+ var count = this.options.length,
72
+ new_opt = this.i18n.option + ' - ' + (count + 1);
73
+
74
+ this.options.push({
75
+ label: new_opt , value: new_opt, id: this.get_random_id()
76
+ });
77
+ },
78
+
79
+ delete_option: function (index) {
80
+ if (this.options.length === 1) {
81
+ this.warn({
82
+ text: this.i18n.last_choice_warn_msg,
83
+ showCancelButton: false,
84
+ confirmButtonColor: "#46b450",
85
+ });
86
+
87
+ return;
88
+ }
89
+
90
+ this.options.splice(index, 1);
91
+ },
92
+
93
+ set_option_label: function (index, label) {
94
+ this.options[index].value = label.toLocaleLowerCase().replace(' ', '_');
95
+ }
96
+ },
97
+
98
+ watch: {
99
+ options: {
100
+ deep: true,
101
+ handler: function (new_opts) {
102
+ var options = {},
103
+ i = 0;
104
+
105
+ for (i = 0; i < new_opts.length; i++) {
106
+ options[new_opts[i].value] = new_opts[i].label;
107
+ }
108
+
109
+ this.update_value('options', options);
110
+ }
111
+ },
112
+
113
+ selected: function (new_val) {
114
+ this.update_value('selected', new_val);
115
+ }
116
+ }
117
+ });
admin/form-builder/assets/js/components/field-option-data/template.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-text">
2
+ <label class="clearfix">
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+ <span class="pull-right">
5
+ <input type="checkbox" v-model="show_value"> <?php _e( 'Show values', 'wpuf' ); ?>
6
+ </span>
7
+ </label>
8
+
9
+ <ul :class="['option-field-option-chooser', show_value ? 'show-value' : '']">
10
+ <li class="clearfix margin-0 header">
11
+ <div class="selector">&nbsp;</div>
12
+
13
+ <div class="sort-handler">&nbsp;</div>
14
+
15
+ <div class="label">
16
+ <?php _e( 'Label', 'wpuf' ); ?>
17
+ </div>
18
+
19
+ <div v-if="show_value" class="value">
20
+ <?php _e( 'Value', 'wpuf' ) ?>
21
+ </div>
22
+
23
+ <div class="action-buttons">&nbsp;</div>
24
+ </li>
25
+ </ul>
26
+
27
+ <ul :class="['option-field-option-chooser margin-0', show_value ? 'show-value' : '']">
28
+ <li v-for="(option, index) in options" :key="option.id" :data-index="index" class="clearfix option-field-option">
29
+ <div class="selector">
30
+ <input
31
+ v-if="option_field.is_multiple"
32
+ type="checkbox"
33
+ :value="option.label"
34
+ v-model="selected"
35
+ >
36
+ <input
37
+ v-else
38
+ type="radio"
39
+ :value="option.label"
40
+ v-model="selected"
41
+ class="option-chooser-radio"
42
+ >
43
+ </div>
44
+
45
+ <div class="sort-handler">
46
+ <i class="fa fa-bars"></i>
47
+ </div>
48
+
49
+ <div class="label">
50
+ <input type="text" v-model="option.label" @input="set_option_label(index, option.label)">
51
+ </div>
52
+
53
+ <div v-if="show_value" class="value">
54
+ <input type="text" v-model="option.value">
55
+ </div>
56
+
57
+ <div class="action-buttons clearfix">
58
+ <i class="fa fa-plus-circle" @click="add_option"></i>
59
+ <i class="fa fa-minus-circle pull-right" @click="delete_option(index)"></i>
60
+ </div>
61
+ </li>
62
+ </ul>
63
+
64
+ <a v-if="!option_field.is_multiple && selected" href="#clear" @click.prevent="clear_selection"><?php _e( 'Clear Selection', 'wpuf' ); ?></a>
65
+ </div>
admin/form-builder/assets/js/components/field-option-pro-feature-alert/index.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-option-pro-feature-alert', {
2
+ template: '#tmpl-wpuf-field-option-pro-feature-alert',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ pro_link: function () {
10
+ return wpuf_form_builder.pro_link;
11
+ }
12
+ }
13
+ });
admin/form-builder/assets/js/components/field-option-pro-feature-alert/template.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-pro-feature">
2
+ <label>{{ option_field.title }}</label><br>
3
+ <label class="wpuf-pro-text-alert">
4
+ <a :href="pro_link" target="_blank"><?php _e( 'Available in Pro Version', 'wpuf' ); ?></a>
5
+ </label>
6
+ </div>
admin/form-builder/assets/js/components/field-options/index.js ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Sidebar field options panel
3
+ */
4
+ Vue.component('field-options', {
5
+ template: '#tmpl-wpuf-field-options',
6
+
7
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.field_options),
8
+
9
+ data: function() {
10
+ return {
11
+ show_basic_settings: true,
12
+ show_advanced_settings: false
13
+ };
14
+ },
15
+
16
+ computed: {
17
+ editing_field_id: function () {
18
+ this.show_basic_settings = true;
19
+ this.show_advanced_settings = false;
20
+
21
+ return parseInt(this.$store.state.editing_field_id);
22
+ },
23
+
24
+ editing_form_field: function () {
25
+ var self = this;
26
+ return _.find(this.$store.state.form_fields, function (item) {
27
+ return parseInt(item.id) === parseInt(self.editing_field_id);
28
+ });
29
+ },
30
+
31
+ settings: function() {
32
+ var settings = [],
33
+ template = this.editing_form_field.template;
34
+
35
+ if (_.isFunction(this['settings_' + template])) {
36
+ settings = this['settings_' + template].call(this, this.editing_form_field);
37
+ } else {
38
+ settings = this.$store.state.field_settings[template].settings;
39
+ }
40
+
41
+ return _.sortBy(settings, function (item) {
42
+ return parseInt(item.priority);
43
+ });
44
+ },
45
+
46
+ basic_settings: function () {
47
+ return this.settings.filter(function (item) {
48
+ return 'basic' === item.section;
49
+ });
50
+ },
51
+
52
+ advanced_settings: function () {
53
+ return this.settings.filter(function (item) {
54
+ return 'advanced' === item.section;
55
+ });
56
+ },
57
+
58
+ form_field_type_title: function() {
59
+ var template = this.editing_form_field.template;
60
+
61
+ if (_.isFunction(this['form_field_' + template + '_title'])) {
62
+ return this['form_field_' + template + '_title'].call(this, this.editing_form_field);
63
+ }
64
+
65
+ return this.$store.state.field_settings[template].title;
66
+ }
67
+ }
68
+ });
admin/form-builder/assets/js/components/field-options/template.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-form-builder-field-options">
2
+ <div v-if="!parseInt(editing_field_id)" class="options-fileds-section text-center">
3
+ <p>
4
+ <span class="loader"></span>
5
+ </p>
6
+ </div>
7
+
8
+ <div v-else>
9
+ <div class="option-fields-section">
10
+ <h3 class="section-title clearfix" @click="show_basic_settings = !show_basic_settings">
11
+ {{ form_field_type_title }} <i :class="[show_basic_settings ? 'fa fa-angle-down' : 'fa fa-angle-right']"></i>
12
+ </h3>
13
+
14
+ <transition name="slide-fade">
15
+ <div v-show="show_basic_settings" class="option-field-section-fields">
16
+ <component
17
+ v-for="option_field in basic_settings"
18
+ :key="option_field.name"
19
+ :is="'field-' + option_field.type"
20
+ :option_field="option_field"
21
+ :editing_form_field="editing_form_field"
22
+ ></component>
23
+ </div>
24
+ </transition>
25
+ </div>
26
+
27
+
28
+ <div v-if="advanced_settings.length" class="option-fields-section">
29
+ <h3 class="section-title" @click="show_advanced_settings = !show_advanced_settings">
30
+ {{ i18n.advanced_options }} <i :class="[show_advanced_settings ? 'fa fa-angle-down' : 'fa fa-angle-right']"></i>
31
+ </h3>
32
+
33
+ <transition name="slide-fade">
34
+ <div v-show="show_advanced_settings" class="option-field-section-fields">
35
+ <component
36
+ v-for="option_field in advanced_settings"
37
+ :key="option_field.name"
38
+ :is="'field-' + option_field.type"
39
+ :option_field="option_field"
40
+ :editing_form_field="editing_form_field"
41
+ ></component>
42
+ </div>
43
+ </transition>
44
+ </div>
45
+ </div>
46
+
47
+ </div>
admin/form-builder/assets/js/components/field-radio/index.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-radio', {
2
+ template: '#tmpl-wpuf-field-radio',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ return this.editing_form_field[this.option_field.name];
12
+ },
13
+
14
+ set: function (value) {
15
+ this.$store.commit('update_editing_form_field', {
16
+ editing_field_id: this.editing_form_field.id,
17
+ field_name: this.option_field.name,
18
+ value: value
19
+ });
20
+ }
21
+ }
22
+ }
23
+ });
admin/form-builder/assets/js/components/field-radio/template.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-radio">
2
+ <label v-if="option_field.title">
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+ </label>
5
+
6
+ <ul :class="[option_field.inline ? 'list-inline' : '']">
7
+ <li v-for="(option, key) in option_field.options">
8
+ <label>
9
+ <input type="radio" :value="key" v-model="value"> {{ option }}
10
+ </label>
11
+ </li>
12
+ </ul>
13
+ </div>
admin/form-builder/assets/js/components/field-select/index.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-select', {
2
+ template: '#tmpl-wpuf-field-select',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ return this.editing_form_field[this.option_field.name];
12
+ },
13
+
14
+ set: function (value) {
15
+ this.$store.commit('update_editing_form_field', {
16
+ editing_field_id: this.editing_form_field.id,
17
+ field_name: this.option_field.name,
18
+ value: value
19
+ });
20
+ }
21
+ }
22
+ }
23
+ });
admin/form-builder/assets/js/components/field-select/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-select">
2
+ <label v-if="option_field.title">
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+ </label>
5
+
6
+ <select class="opt-select-element" v-model="value">
7
+ <option value=""><?php _e( 'Select an option', 'wpuf' ); ?></option>
8
+ <option v-for="(option, key) in option_field.options" :value="key">{{ option }}</option>
9
+ </select>
10
+ </div>
admin/form-builder/assets/js/components/field-text-meta/index.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-text-meta', {
2
+ template: '#tmpl-wpuf-field-text-meta',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ return this.editing_form_field[this.option_field.name];
12
+ },
13
+
14
+ set: function (value) {
15
+ this.update_value(this.option_field.name, value);
16
+ }
17
+ }
18
+ },
19
+
20
+ created: function () {
21
+ if ('yes' === this.editing_form_field.is_meta) {
22
+ if (!this.value) {
23
+ this.value = this.editing_form_field.label.replace(/\W/g, '_').toLowerCase();
24
+ }
25
+
26
+ wpuf_form_builder.event_hub.$on('field-text-keyup', this.meta_key_autocomplete);
27
+ }
28
+ },
29
+
30
+ methods: {
31
+ meta_key_autocomplete: function (e, label_vm) {
32
+ if (
33
+ 'label' === label_vm.option_field.name &&
34
+ parseInt(this.editing_form_field.id) === parseInt(label_vm.editing_form_field.id)
35
+ ) {
36
+ this.value = label_vm.value.replace(/\W/g, '_').toLowerCase();
37
+ }
38
+ }
39
+ }
40
+ });
admin/form-builder/assets/js/components/field-text-meta/template.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-text panel-field-opt-text-meta">
2
+ <label>
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+ <input
5
+ type="text"
6
+ v-model="value"
7
+ >
8
+ </label>
9
+ </div>
admin/form-builder/assets/js/components/field-text/index.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-text', {
2
+ template: '#tmpl-wpuf-field-text',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ return this.editing_form_field[this.option_field.name];
12
+ },
13
+
14
+ set: function (value) {
15
+ this.update_value(this.option_field.name, value);
16
+ }
17
+ }
18
+ },
19
+
20
+ methods: {
21
+ on_focusout: function (e) {
22
+ wpuf_form_builder.event_hub.$emit('field-text-focusout', e, this);
23
+ },
24
+ on_keyup: function (e) {
25
+ wpuf_form_builder.event_hub.$emit('field-text-keyup', e, this);
26
+ }
27
+ }
28
+ });
admin/form-builder/assets/js/components/field-text/template.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-text">
2
+ <label>
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+
5
+ <input
6
+ v-if="option_field.variation && 'number' === option_field.variation"
7
+ type="number"
8
+ v-model="value"
9
+ @focusout="on_focusout"
10
+ @keyup="on_keyup"
11
+ >
12
+
13
+ <input
14
+ v-if="!option_field.variation"
15
+ type="text"
16
+ v-model="value"
17
+ @focusout="on_focusout"
18
+ @keyup="on_keyup"
19
+ >
20
+ </label>
21
+ </div>
admin/form-builder/assets/js/components/field-textarea/index.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('field-textarea', {
2
+ template: '#tmpl-wpuf-field-textarea',
3
+
4
+ mixins: [
5
+ wpuf_mixins.option_field_mixin
6
+ ],
7
+
8
+ computed: {
9
+ value: {
10
+ get: function () {
11
+ return this.editing_form_field[this.option_field.name];
12
+ },
13
+
14
+ set: function (value) {
15
+ this.update_value(this.option_field.name, value);
16
+ }
17
+ }
18
+ },
19
+ });
admin/form-builder/assets/js/components/field-textarea/template.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div class="panel-field-opt panel-field-opt-textarea">
2
+ <label>
3
+ {{ option_field.title }} <help-text v-if="option_field.help_text" :text="option_field.help_text"></help-text>
4
+
5
+ <textarea :rows="option_field.rows || 5" v-model="value"></textarea>
6
+ </label>
7
+ </div>
admin/form-builder/assets/js/components/form-checkbox_field/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Checkbox
3
+ */
4
+ Vue.component('form-checkbox_field', {
5
+ template: '#tmpl-wpuf-form-checkbox_field',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-checkbox_field/template.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
3
+ <li v-if="has_options" v-for="(label, val) in field.options">
4
+ <label>
5
+ <input
6
+ type="checkbox"
7
+ :value="label"
8
+ :checked="is_selected(label)"
9
+ :class="class_names('checkbox_btns')"
10
+ > {{ label }}
11
+ </label>
12
+ </li>
13
+ </ul>
14
+
15
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
16
+ </div>
admin/form-builder/assets/js/components/form-custom_hidden_field/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Hidden
3
+ */
4
+ Vue.component('form-custom_hidden_field', {
5
+ template: '#tmpl-wpuf-form-custom_hidden_field',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-custom_hidden_field/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="text"
4
+ :class="class_names('textfield')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
10
+ </div>
admin/form-builder/assets/js/components/form-custom_html/index.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Custom HTML
3
+ */
4
+ Vue.component('form-custom_html', {
5
+ template: '#tmpl-wpuf-form-custom_html',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ],
10
+
11
+ data: function () {
12
+ return {
13
+ raw_html: '<p>from data</p>'
14
+ };
15
+ }
16
+ });
admin/form-builder/assets/js/components/form-custom_html/template.php ADDED
@@ -0,0 +1 @@
 
1
+ <div class="wpuf-fields" v-html="field.html"></div>
admin/form-builder/assets/js/components/form-dropdown_field/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Dropdown/Select
3
+ */
4
+ Vue.component('form-dropdown_field', {
5
+ template: '#tmpl-wpuf-form-dropdown_field',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-dropdown_field/template.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <select
3
+ :class="class_names('select_lbl')"
4
+ >
5
+ <option v-if="field.first" value="">{{ field.first }}</option>
6
+
7
+ <option
8
+ v-if="has_options"
9
+ v-for="(label, val) in field.options"
10
+ :value="label"
11
+ :selected="is_selected(label)"
12
+ >{{ label }}</option>
13
+ </select>
14
+
15
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
16
+ </div>
admin/form-builder/assets/js/components/form-email_address/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Email
3
+ */
4
+ Vue.component('form-email_address', {
5
+ template: '#tmpl-wpuf-form-email_address',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-email_address/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="email"
4
+ :class="class_names('email')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
10
+ </div>
admin/form-builder/assets/js/components/form-featured_image/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Featured Image
3
+ */
4
+ Vue.component('form-featured_image', {
5
+ template: '#tmpl-wpuf-form-featured_image',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-featured_image/template.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
3
+ <div class="wpuf-attachment-upload-filelist" data-type="file" data-required="yes">
4
+ <a class="button file-selector" href="#">
5
+ <?php _e( 'Select Image', 'wpuf' ); ?>
6
+ </a>
7
+ </div>
8
+ </div>
9
+
10
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
11
+ </div>
admin/form-builder/assets/js/components/form-fields/index.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Sidebar form fields panel
3
+ */
4
+ Vue.component('form-fields', {
5
+ template: '#tmpl-wpuf-form-fields',
6
+
7
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.form_fields),
8
+
9
+ computed: {
10
+ panel_sections: function () {
11
+ return this.$store.state.panel_sections;
12
+ },
13
+
14
+ field_settings: function () {
15
+ return this.$store.state.field_settings;
16
+ },
17
+
18
+ form_fields: function () {
19
+ return this.$store.state.form_fields;
20
+ }
21
+ },
22
+
23
+ mounted: function () {
24
+ // bind jquery ui draggable
25
+ $(this.$el).find('.panel-form-field-buttons .button').draggable({
26
+ connectToSortable: '#form-preview-stage .wpuf-form',
27
+ helper: 'clone',
28
+ revert: 'invalid',
29
+ cancel: '.button-faded',
30
+ }).disableSelection();
31
+ },
32
+
33
+ methods: {
34
+ panel_toggle: function (index) {
35
+ this.$store.commit('panel_toggle', index);
36
+ },
37
+
38
+ add_form_field: function (field_template) {
39
+ var payload = {
40
+ toIndex: this.$store.state.form_fields.length,
41
+ };
42
+
43
+ // check if these are already inserted
44
+ if ( this.isSingleInstance( field_template ) && this.containsField( field_template ) ) {
45
+ swal({
46
+ title: "Oops...",
47
+ text: "You already have this field in the form"
48
+ });
49
+ return;
50
+ }
51
+
52
+ var field = $.extend(true, {}, this.$store.state.field_settings[field_template].field_props);
53
+
54
+ field.id = this.get_random_id();
55
+
56
+ if (!field.name && field.label) {
57
+ field.name = field.label.replace(/\W/g, '_').toLowerCase();
58
+
59
+ var same_template_fields = this.form_fields.filter(function (form_field) {
60
+ return (form_field.template === field.template);
61
+ });
62
+
63
+ if (same_template_fields.length) {
64
+ field.name += '_' + same_template_fields.length;
65
+ }
66
+ }
67
+
68
+ payload.field = field;
69
+
70
+ // add new form element
71
+ this.$store.commit('add_form_field_element', payload);
72
+ },
73
+
74
+ is_pro_feature: function (field) {
75
+ return this.field_settings[field].pro_feature;
76
+ },
77
+
78
+ alert_pro_feature: function (field) {
79
+ var title = this.field_settings[field].title;
80
+
81
+ swal({
82
+ title: '<i class="fa fa-lock"></i> ' + title + ' <br>' + this.i18n.is_a_pro_feature,
83
+ text: this.i18n.pro_feature_msg,
84
+ type: '',
85
+ html: true,
86
+ showCancelButton: true,
87
+ cancelButtonText: this.i18n.close,
88
+ confirmButtonColor: '#46b450',
89
+ confirmButtonText: this.i18n.upgrade_to_pro
90
+ }, function (is_confirm) {
91
+ if (is_confirm) {
92
+ window.open(wpuf_form_builder.pro_link, '_blank');
93
+ }
94
+ });
95
+ },
96
+
97
+ alert_invalidate_msg: function (field) {
98
+ var validator = this.field_settings[field].validator;
99
+
100
+ if (validator && validator.msg) {
101
+ this.warn({
102
+ title: validator.msg_title || '',
103
+ text: validator.msg,
104
+ html: true,
105
+ type: 'warning',
106
+ showCancelButton: false,
107
+ confirmButtonColor: '#46b450',
108
+ confirmButtonText: this.i18n.ok
109
+ });
110
+ }
111
+ },
112
+
113
+ get_invalidate_btn_class: function (field) {
114
+ return this.field_settings[field].validator.button_class;
115
+ }
116
+ }
117
+ });
admin/form-builder/assets/js/components/form-fields/template.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-form-builder-form-fields">
2
+ <template v-for="(section, index) in panel_sections">
3
+ <div v-if="section.fields.length" class="panel-form-field-group clearfix">
4
+ <h3 class="clearfix" @click="panel_toggle(index)">
5
+ {{ section.title }} <i :class="[section.show ? 'fa fa-angle-down' : 'fa fa-angle-right']"></i>
6
+ </h3>
7
+
8
+ <transition name="slide-fade">
9
+ <ul
10
+ v-show="section.show"
11
+ class="panel-form-field-buttons clearfix"
12
+ :id="'panel-form-field-buttons-' + section.id"
13
+ >
14
+ <template v-for="field in section.fields">
15
+ <li
16
+ v-if="is_pro_feature(field)"
17
+ class="button button-faded"
18
+ :data-form-field="field"
19
+ data-source="panel"
20
+ @click="alert_pro_feature(field)"
21
+ >
22
+ <i v-if="field_settings[field].icon" :class="['fa fa-' + field_settings[field].icon]" aria-hidden="true"></i> {{ field_settings[field].title }}
23
+ </li>
24
+
25
+ <li
26
+ v-if="is_failed_to_validate(field)"
27
+ :class="['button', get_invalidate_btn_class(field)]"
28
+ :data-form-field="field"
29
+ data-source="panel"
30
+ @click="alert_invalidate_msg(field)"
31
+ >
32
+ <i v-if="field_settings[field].icon" :class="['fa fa-' + field_settings[field].icon]" aria-hidden="true"></i> {{ field_settings[field].title }}
33
+ </li>
34
+
35
+ <li
36
+ v-if="!is_pro_feature(field) && !is_failed_to_validate(field)"
37
+ class="button"
38
+ :data-form-field="field"
39
+ data-source="panel"
40
+ @click="add_form_field(field)"
41
+ >
42
+ <i v-if="field_settings[field].icon" :class="['fa fa-' + field_settings[field].icon]" aria-hidden="true"></i> {{ field_settings[field].title }}
43
+ </li>
44
+ </template>
45
+ </ul>
46
+ </transition>
47
+ </div>
48
+ </template>
49
+ </div>
admin/form-builder/assets/js/components/form-image_upload/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Image Upload
3
+ */
4
+ Vue.component('form-image_upload', {
5
+ template: '#tmpl-wpuf-form-image_upload',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-image_upload/template.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
3
+ <div class="wpuf-attachment-upload-filelist" data-type="file" data-required="yes">
4
+ <a class="button file-selector wpuf_img_label_148" href="#">
5
+ <?php _e( 'Select Image', 'wpuf' ); ?>
6
+ </a>
7
+ </div>
8
+ </div>
9
+
10
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
11
+ </div>
admin/form-builder/assets/js/components/form-multiple_select/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Multi-Select
3
+ */
4
+ Vue.component('form-multiple_select', {
5
+ template: '#tmpl-wpuf-form-multiple_select',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-multiple_select/template.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <select
3
+ :class="class_names('multi_label')"
4
+ multiple
5
+ >
6
+ <option v-if="field.first" value="">{{ field.first }}</option>
7
+
8
+ <option
9
+ v-if="has_options"
10
+ v-for="(label, val) in field.options"
11
+ :value="label"
12
+ :selected="is_selected(label)"
13
+ >{{ label }}</option>
14
+ </select>
15
+
16
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
17
+ </div>
admin/form-builder/assets/js/components/form-post_content/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field Template: Post Content
3
+ */
4
+ Vue.component('form-post_content', {
5
+ template: '#tmpl-wpuf-form-post_content',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-post_content/template.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <div class="wp-media-buttons" v-if="field.insert_image == 'yes'">
3
+ <button type="button" class="button insert-media add_media" data-editor="content">
4
+ <span class="dashicons dashicons-admin-media insert-photo-icon"></span> <?php _e( 'Insert Photo', 'wpuf' ); ?>
5
+ </button>
6
+ </div>
7
+ <br v-if="field.insert_image == 'yes'" />
8
+
9
+ <textarea
10
+ v-if="'no' === field.rich"
11
+ :class="class_names('textareafield')"
12
+ :placeholder="field.placeholder"
13
+ :rows="field.rows"
14
+ :cols="field.cols"
15
+ >{{ field.default }}</textarea>
16
+
17
+ <text-editor v-if="'no' !== field.rich" :rich="field.rich"></text-editor>
18
+
19
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
20
+ </div>
admin/form-builder/assets/js/components/form-post_excerpt/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field Template: Post Excerpt
3
+ */
4
+ Vue.component('form-post_excerpt', {
5
+ template: '#tmpl-wpuf-form-post_excerpt',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-post_excerpt/template.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <textarea
3
+ :class="class_names('textareafield')"
4
+ :placeholder="field.placeholder"
5
+ :rows="field.rows"
6
+ :cols="field.cols"
7
+ >{{ field.default }}</textarea>
8
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
9
+ </div>
admin/form-builder/assets/js/components/form-post_tags/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: post_tags
3
+ */
4
+ Vue.component('form-post_tags', {
5
+ template: '#tmpl-wpuf-form-post_tags',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-post_tags/template.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="text"
4
+ :class="class_names('textfield')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+
10
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
11
+ </div>
admin/form-builder/assets/js/components/form-post_title/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Post Title
3
+ */
4
+ Vue.component('form-post_title', {
5
+ template: '#tmpl-wpuf-form-post_title',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-post_title/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="text"
4
+ :class="class_names('textfield')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
10
+ </div>
admin/form-builder/assets/js/components/form-radio_field/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Radio
3
+ */
4
+ Vue.component('form-radio_field', {
5
+ template: '#tmpl-wpuf-form-radio_field',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-radio_field/template.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
3
+ <li v-if="has_options" v-for="(label, val) in field.options">
4
+ <label>
5
+ <input
6
+ type="radio"
7
+ :value="label"
8
+ :checked="is_selected(label)"
9
+ :class="class_names('radio_btns')"
10
+ > {{ label }}
11
+ </label>
12
+ </li>
13
+ </ul>
14
+
15
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
16
+ </div>
admin/form-builder/assets/js/components/form-section_break/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Section Break
3
+ */
4
+ Vue.component('form-section_break', {
5
+ template: '#tmpl-wpuf-form-section_break',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-section_break/template.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <div class="wpuf-section-wrap">
2
+ <h2 class="wpuf-section-title">{{ field.label }}</h2>
3
+ <div class="wpuf-section-details">{{ field.description }}</div>
4
+ </div>
admin/form-builder/assets/js/components/form-taxonomy/index.js ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: taxonomy
3
+ */
4
+ Vue.component('form-taxonomy', {
5
+ template: '#tmpl-wpuf-form-taxonomy',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ],
10
+
11
+ computed: {
12
+ terms: function () {
13
+ var i;
14
+
15
+ for (i in wpuf_form_builder.wp_post_types) {
16
+ var taxonomies = wpuf_form_builder.wp_post_types[i];
17
+
18
+ if (taxonomies.hasOwnProperty(this.field.name)) {
19
+ var tax_field = taxonomies[this.field.name];
20
+
21
+ if (tax_field.terms) {
22
+ return tax_field.terms;
23
+ }
24
+ }
25
+ }
26
+
27
+ return [];
28
+ },
29
+
30
+ sorted_terms: function () {
31
+ var self = this;
32
+ var terms = $.extend(true, [], this.terms);
33
+
34
+ // selection type and terms
35
+ if (this.field.exclude_type && this.field.exclude) {
36
+ var filter_ids = this.field.exclude.split(',').map(function (id) {
37
+ id = id.trim();
38
+ id = parseInt(id);
39
+ return id;
40
+ }).filter(function (id) {
41
+ return isFinite(id);
42
+ });
43
+
44
+ terms = terms.filter(function (term) {
45
+
46
+ switch(self.field.exclude_type) {
47
+ case 'exclude':
48
+ return _.indexOf(filter_ids, term.term_id) < 0;
49
+
50
+ case 'include':
51
+ return _.indexOf(filter_ids, term.term_id) >= 0;
52
+
53
+ case 'child_of':
54
+ return _.indexOf(filter_ids, parseInt(term.parent)) >= 0;
55
+ }
56
+ });
57
+ }
58
+
59
+ // order
60
+ terms = _.sortBy(terms, function (term) {
61
+ return term[self.field.orderby];
62
+ });
63
+
64
+ if ('DESC' === this.field.order) {
65
+ terms = terms.reverse();
66
+ }
67
+
68
+ var parent_terms = terms.filter(function (term) {
69
+ return !term.parent;
70
+ });
71
+
72
+ parent_terms.map(function (parent) {
73
+ parent.children = self.get_child_terms(parent.term_id, terms);
74
+ });
75
+
76
+ return parent_terms.length ? parent_terms : terms;
77
+ }
78
+ },
79
+
80
+ methods: {
81
+ get_child_terms: function (parent_id, terms) {
82
+ var self = this;
83
+
84
+ var child_terms = terms.filter(function (term) {
85
+ return parseInt(term.parent) === parseInt(parent_id);
86
+ });
87
+
88
+ child_terms.map(function (child) {
89
+ child.children = self.get_child_terms(child.term_id, terms);
90
+ });
91
+
92
+ return child_terms;
93
+ },
94
+
95
+ get_term_dropdown_options: function () {
96
+ var self = this,
97
+ options = '';
98
+
99
+ _.each(self.sorted_terms, function (term) {
100
+ options += self.get_term_dropdown_options_children(term, 0);
101
+ });
102
+
103
+ return options;
104
+ },
105
+
106
+ get_term_dropdown_options_children: function (term, level) {
107
+ var self = this,
108
+ option = '';
109
+
110
+ var indent = '',
111
+ i = 0;
112
+
113
+ for (i = 0; i < level; i++) {
114
+ indent += '&nbsp;&nbsp;';
115
+ }
116
+
117
+ option += '<option value="' + term.id + '">' + indent + term.name + '</option>';
118
+
119
+ if (term.children.length) {
120
+ _.each(term.children, function (child_term) {
121
+ option += self.get_term_dropdown_options_children(child_term, (level + 1));
122
+ });
123
+ }
124
+
125
+ return option;
126
+ },
127
+
128
+ get_term_checklist: function () {
129
+ var self = this,
130
+ checklist = '';
131
+
132
+
133
+ checklist += '<ul class="wpuf-category-checklist">';
134
+
135
+ _.each(this.sorted_terms, function (term) {
136
+ checklist += self.get_term_checklist_li(term);
137
+ });
138
+
139
+ checklist += '</ul>';
140
+
141
+ return checklist;
142
+ },
143
+
144
+ get_term_checklist_li: function (term) {
145
+ var self = this,
146
+ li = '';
147
+
148
+ li += '<li><label class="selectit"><input type="checkbox"> ' + term.name + '</label></li>';
149
+
150
+ if (term.children.length) {
151
+ li += '<ul class="children">';
152
+
153
+ _.each(term.children, function (child_term) {
154
+ li += self.get_term_checklist_li(child_term);
155
+ });
156
+
157
+ li += '</ul>';
158
+ }
159
+
160
+ return li;
161
+ }
162
+ }
163
+ });
admin/form-builder/assets/js/components/form-taxonomy/template.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <select
3
+ v-if="'select' === field.type"
4
+ :class="field.name"
5
+ v-html="get_term_dropdown_options()"
6
+ >
7
+ </select>
8
+
9
+ <div v-if="'ajax' === field.type" class="category-wrap">
10
+ <div>
11
+ <select>
12
+ <option><?php _e( '— Select —', 'wpuf' ); ?></option>
13
+ <option v-for="term in sorted_terms" :value="term.id">{{ term.name }}</option>
14
+ </select>
15
+ </div>
16
+ </div>
17
+
18
+ <div v-if="'multiselect' === field.type" class="category-wrap">
19
+ <select
20
+ :class="field.name"
21
+ v-html="get_term_dropdown_options()"
22
+ multiple
23
+ >
24
+ </select>
25
+ </div>
26
+
27
+ <div v-if="'checkbox' === field.type" class="category-wrap">
28
+ <div v-html="get_term_checklist()"></div>
29
+ </div>
30
+
31
+ <input
32
+ v-if="'text' === field.type"
33
+ class="textfield"
34
+ type="text"
35
+ value=""
36
+ size="40"
37
+ autocomplete="off"
38
+ >
39
+
40
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
41
+ </div>
admin/form-builder/assets/js/components/form-text_field/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Text
3
+ */
4
+ Vue.component('form-text_field', {
5
+ template: '#tmpl-wpuf-form-text_field',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-text_field/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="text"
4
+ :class="class_names('textfield')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
10
+ </div>
admin/form-builder/assets/js/components/form-textarea_field/index.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Vue.component('form-textarea_field', {
2
+ template: '#tmpl-wpuf-form-textarea_field',
3
+
4
+ mixins: [
5
+ wpuf_mixins.form_field_mixin
6
+ ]
7
+ });
admin/form-builder/assets/js/components/form-textarea_field/template.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <textarea
3
+ v-if="'no' === field.rich"
4
+ :class="class_names('textareafield')"
5
+ :placeholder="field.placeholder"
6
+ :rows="field.rows"
7
+ :cols="field.cols"
8
+ >{{ field.default }}</textarea>
9
+
10
+ <text-editor v-if="'no' !== field.rich" :rich="field.rich"></text-editor>
11
+
12
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
13
+ </div>
admin/form-builder/assets/js/components/form-website_url/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Field template: Website URL
3
+ */
4
+ Vue.component('form-website_url', {
5
+ template: '#tmpl-wpuf-form-website_url',
6
+
7
+ mixins: [
8
+ wpuf_mixins.form_field_mixin
9
+ ]
10
+ });
admin/form-builder/assets/js/components/form-website_url/template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-fields">
2
+ <input
3
+ type="url"
4
+ :class="class_names('url')"
5
+ :placeholder="field.placeholder"
6
+ :value="field.default"
7
+ :size="field.size"
8
+ >
9
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
10
+ </div>
admin/form-builder/assets/js/components/help-text/index.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('help-text', {
2
+ template: '#tmpl-wpuf-help-text',
3
+
4
+ props: {
5
+ text: {
6
+ type: String,
7
+ default: ''
8
+ }
9
+ },
10
+
11
+ mounted: function () {
12
+ $(".wpuf-tooltip").tooltip();
13
+ }
14
+ });
admin/form-builder/assets/js/components/help-text/template.php ADDED
@@ -0,0 +1 @@
 
1
+ <i class="fa fa-question-circle field-helper-text wpuf-tooltip" data-placement="top" :title="text"></i>
admin/form-builder/assets/js/components/text-editor/editor.less ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
7
+ font-size: 14px;
8
+ line-height: 1.42857143;
9
+ color: #333;
10
+ background-color: #fff;
11
+ -ms-word-wrap: break-word;
12
+ word-wrap: break-word;
13
+
14
+ &[contenteditable="false"] {
15
+ opacity: .4;
16
+ pointer-events: none;
17
+ cursor: not-allowed;
18
+ }
19
+ }
20
+
21
+
22
+ // TYPOGRAPHY
23
+ h1, h2, h3, h4, h5, h6 {
24
+ font-family: inherit;
25
+ font-weight: normal;
26
+ line-height: 1.1;
27
+ color: inherit;
28
+ padding: 0;
29
+ }
30
+
31
+ h1, h2, h3 {
32
+ margin: 0 0 10px;
33
+ }
34
+
35
+ h1 {
36
+ font-size: 36px;
37
+ }
38
+
39
+ h2 {
40
+ font-size: 30px;
41
+ }
42
+
43
+ h3 {
44
+ font-size: 24px;
45
+ }
46
+
47
+ h4 {
48
+ font-size: 18px;
49
+ }
50
+
51
+ h5 {
52
+ font-size: 14px;
53
+ }
54
+
55
+ h6 {
56
+ font-size: 12px;
57
+ }
58
+
59
+ p {
60
+ margin: 0 0 10px;
61
+ font-size: inherit;
62
+ line-height: inherit;
63
+ }
admin/form-builder/assets/js/components/text-editor/index.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Vue.component('text-editor', {
2
+ template: '#tmpl-wpuf-text-editor',
3
+
4
+ props: ['rich'],
5
+
6
+ computed: {
7
+ site_url: function () {
8
+ return wpuf_form_builder.site_url;
9
+ },
10
+
11
+ is_full: function () {
12
+ return 'yes' === this.rich;
13
+ }
14
+ }
15
+ });
admin/form-builder/assets/js/components/text-editor/style.less ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mce-toolbar {
2
+ .mce-btn button {
3
+ padding: 2px;
4
+ }
5
+
6
+ .mce-ico {
7
+ font-size: 18px;
8
+ }
9
+ }
10
+
11
+ div.wp-link-input {
12
+ max-width: 130px;
13
+
14
+ input {
15
+ width: 100%;
16
+ }
17
+ }
18
+
19
+ div.wp-link-preview {
20
+ max-width: 130px;
21
+ }
22
+
23
+ .mce-i-shortcode {
24
+ background-image: url(../images/shortcode.png) !important;
25
+
26
+ & + .mce-caret {
27
+ display: none;
28
+ }
29
+ }
30
+
31
+ .mce-menu-item.mce-menu-section-title {
32
+ cursor: default;
33
+ border-top: 1px solid #ccc;
34
+
35
+ &:first-child {
36
+ border-top: none;
37
+ }
38
+
39
+ &:hover {
40
+ background-color: none;
41
+ }
42
+
43
+ span {
44
+ font-weight: bold;
45
+ }
46
+ }
47
+
48
+ // reset color cross button
49
+ .mce-grid-cell.mce-colorbtn-trans {
50
+ div[title="No color"] {
51
+ line-height: .5;
52
+ }
53
+ }
admin/form-builder/assets/js/components/text-editor/template.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpuf-text-editor">
2
+
3
+ <div class="wp-core-ui wp-editor-wrap tmce-active">
4
+ <link rel="stylesheet" :href="site_url + 'wp-includes/css/editor.css'" type="text/css" media="all">
5
+ <link rel="stylesheet" :href="site_url + 'wp-includes/js/tinymce/skins/lightgray/skin.min.css'" type="text/css" media="all">
6
+
7
+ <div class="wp-editor-container">
8
+ <div class="mce-tinymce mce-container mce-panel" style="visibility: hidden; border-width: 1px;">
9
+ <div class="mce-container-body mce-stack-layout">
10
+ <div class="mce-toolbar-grp mce-container mce-panel mce-stack-layout-item">
11
+ <div class="mce-container-body mce-stack-layout">
12
+ <div class="mce-container mce-toolbar mce-stack-layout-item">
13
+ <div class="mce-container-body mce-flow-layout">
14
+ <div class="mce-container mce-flow-layout-item mce-btn-group">
15
+ <div>
16
+ <div v-if="is_full" class="mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox mce-btn-has-text"><button type="button"><span class="mce-txt">Paragraph</span> <i class="mce-caret"></i></button></div>
17
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-bold"></i></button></div>
18
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-italic"></i></button></div>
19
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-bullist"></i></button></div>
20
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-numlist"></i></button></div>
21
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-blockquote"></i></button></div>
22
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-alignleft"></i></button></div>
23
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-aligncenter"></i></button></div>
24
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-alignright"></i></button></div>
25
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-link"></i></button></div>
26
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-unlink"></i></button></div>
27
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-wp_more"></i></button></div>
28
+ <div class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-fullscreen"></i></button></div>
29
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-wp_adv"></i></button></div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ <div class="mce-container mce-toolbar mce-stack-layout-item">
35
+ <div class="mce-container-body mce-flow-layout">
36
+ <div class="mce-container mce-flow-layout-item mce-btn-group">
37
+ <div>
38
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-strikethrough"></i></button></div>
39
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-hr"></i></button></div>
40
+ <div v-if="is_full" class="mce-widget mce-btn mce-colorbutton"><button type="button"><i class="mce-ico mce-i-forecolor"></i><span class="mce-preview"></span></button><button type="button" class="mce-open"> <i class="mce-caret"></i></button></div>
41
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-pastetext"></i></button></div>
42
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-removeformat"></i></button></div>
43
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-charmap"></i></button></div>
44
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-outdent"></i></button></div>
45
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-indent"></i></button></div>
46
+ <div class="mce-widget mce-btn mce-disabled"><button type="button"><i class="mce-ico mce-i-undo"></i></button></div>
47
+ <div class="mce-widget mce-btn mce-disabled"><button type="button"><i class="mce-ico mce-i-redo"></i></button></div>
48
+ <div v-if="is_full" class="mce-widget mce-btn"><button type="button"><i class="mce-ico mce-i-wp_help"></i></button></div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <div class="mce-edit-area mce-container mce-panel mce-stack-layout-item" style="border-width: 1px 0px 0px;">
56
+ <div style="width: 100%; height: 150px; display: block;"></div><!-- iframe replacement div -->
57
+ </div>
58
+ <div class="mce-statusbar mce-container mce-panel mce-stack-layout-item" style="border-width: 1px 0px 0px;">
59
+ <div class="mce-container-body mce-flow-layout">
60
+ <div class="mce-path mce-flow-layout-item">
61
+ <div class="mce-path-item" data-index="0" aria-level="0">p</div>
62
+ </div>
63
+ <div class="mce-flow-layout-item mce-resizehandle"><i class="mce-ico mce-i-resize"></i></div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </div>
admin/form-builder/assets/js/form-builder-assets.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Returns file paths of vue assets
3
+ */
4
+
5
+ /* global module, require */
6
+ function assets() {
7
+ 'use strict';
8
+
9
+ const grunt = require('grunt');
10
+ const fs = require('fs');
11
+ let paths = {
12
+ mixins: ['admin/form-builder/assets/js/jquery-siaf-start.js'],
13
+ components: ['admin/form-builder/assets/js/jquery-siaf-start.js']
14
+ };
15
+
16
+ // mixins
17
+ const mixinsPath = './admin/form-builder/assets/js/mixins/';
18
+ let mixins = fs.readdirSync(mixinsPath);
19
+
20
+ mixins.forEach((mixin) => {
21
+ const path = `${mixinsPath}${mixin}`;
22
+
23
+ if (grunt.file.isFile(path)) {
24
+ paths.mixins.push(path);
25
+ }
26
+ });
27
+
28
+ // components
29
+ const componentPath = './admin/form-builder/assets/js/components/';
30
+ let components = fs.readdirSync(componentPath);
31
+
32
+ components.forEach((component) => {
33
+ const path = `${componentPath}${component}`;
34
+
35
+ if (grunt.file.isDir(path)) {
36
+ paths.components.push(path + '/index.js');
37
+ }
38
+ });
39
+
40
+ paths.mixins.push('admin/form-builder/assets/js/jquery-siaf-end.js');
41
+ paths.components.push('admin/form-builder/assets/js/jquery-siaf-end.js');
42
+
43
+ return paths;
44
+ }
45
+
46
+ module.exports = assets();
admin/form-builder/assets/js/form-builder.js ADDED
@@ -0,0 +1,458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Only proceed if current page is a form builder page
6
+ */
7
+ if (!$('#wpuf-form-builder').length) {
8
+ return;
9
+ }
10
+
11
+ if (!Array.prototype.hasOwnProperty('swap')) {
12
+ Array.prototype.swap = function (from, to) {
13
+ this.splice(to, 0, this.splice(from, 1)[0]);
14
+ };
15
+ }
16
+
17
+ // check if an element is visible in browser viewport
18
+ function is_element_in_viewport (el) {
19
+ if (typeof jQuery === "function" && el instanceof jQuery) {
20
+ el = el[0];
21
+ }
22
+
23
+ var rect = el.getBoundingClientRect();
24
+
25
+ return (
26
+ rect.top >= 0 &&
27
+ rect.left >= 0 &&
28
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
29
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Vuex Store data
35
+ */
36
+ var wpuf_form_builder_store = new Vuex.Store({
37
+ state: {
38
+ post: wpuf_form_builder.post,
39
+ form_fields: wpuf_form_builder.form_fields,
40
+ panel_sections: wpuf_form_builder.panel_sections,
41
+ field_settings: wpuf_form_builder.field_settings,
42
+ notifications: wpuf_form_builder.notifications,
43
+ current_panel: 'form-fields',
44
+ editing_field_id: 0, // editing form field id
45
+ },
46
+
47
+ mutations: {
48
+ set_form_fields: function (state, form_fields) {
49
+ Vue.set(state, 'form_fields', form_fields);
50
+ },
51
+
52
+ // set the current panel
53
+ set_current_panel: function (state, panel) {
54
+ if ('field-options' !== state.current_panel &&
55
+ 'field-options' === panel &&
56
+ state.form_fields.length
57
+ ) {
58
+ state.editing_field_id = state.form_fields[0].id;
59
+ }
60
+
61
+ state.current_panel = panel;
62
+
63
+ // reset editing field id
64
+ if ('form-fields' === panel) {
65
+ state.editing_field_id = 0;
66
+ }
67
+ },
68
+
69
+ // add show property to every panel section
70
+ panel_add_show_prop: function (state) {
71
+ state.panel_sections.map(function (section, index) {
72
+ if (!section.hasOwnProperty('show')) {
73
+ Vue.set(state.panel_sections[index], 'show', true);
74
+ }
75
+ });
76
+ },
77
+
78
+ // toggle panel sections
79
+ panel_toggle: function (state, index) {
80
+ state.panel_sections[index].show = !state.panel_sections[index].show;
81
+ },
82
+
83
+ // open field settings panel
84
+ open_field_settings: function (state, field_id) {
85
+ var field = state.form_fields.filter(function(item) {
86
+ return parseInt(field_id) === parseInt(item.id);
87
+ });
88
+
89
+ if ('field-options' === state.current_panel && field[0].id === state.editing_field_id) {
90
+ return;
91
+ }
92
+
93
+ if (field.length) {
94
+ state.editing_field_id = 0;
95
+ state.current_panel = 'field-options';
96
+
97
+ setTimeout(function () {
98
+ state.editing_field_id = field[0].id;
99
+ }, 400);
100
+ }
101
+ },
102
+
103
+ update_editing_form_field: function (state, payload) {
104
+ var editing_field = _.find(state.form_fields, function (item) {
105
+ return parseInt(item.id) === parseInt(payload.editing_field_id);
106
+ });
107
+
108
+ editing_field[payload.field_name] = payload.value;
109
+ },
110
+
111
+ // add new form field element
112
+ add_form_field_element: function (state, payload) {
113
+ state.form_fields.splice(payload.toIndex, 0, payload.field);
114
+
115
+ // bring newly added element into viewport
116
+ Vue.nextTick(function () {
117
+ var el = $('#form-preview-stage .wpuf-form .field-items').eq(payload.toIndex);
118
+
119
+ if (el && !is_element_in_viewport(el.get(0))) {
120
+ $('#builder-stage section').scrollTo(el, 800, {offset: -50});
121
+ }
122
+ });
123
+ },
124
+
125
+ // sorting inside stage
126
+ swap_form_field_elements: function (state, payload) {
127
+ state.form_fields.swap(payload.fromIndex, payload.toIndex);
128
+ },
129
+
130
+ clone_form_field_element: function (state, payload) {
131
+ var field = _.find(state.form_fields, function (item) {
132
+ return parseInt(item.id) === parseInt(payload.field_id);
133
+ });
134
+
135
+ var clone = $.extend(true, {}, field),
136
+ index = parseInt(payload.index) + 1;
137
+
138
+ clone.id = payload.new_id;
139
+ clone.name = clone.name + '_copy';
140
+
141
+ state.form_fields.splice(index, 0, clone);
142
+ },
143
+
144
+ // delete a field
145
+ delete_form_field_element: function (state, index) {
146
+ state.current_panel = 'form-fields';
147
+ state.form_fields.splice(index, 1);
148
+ },
149
+
150
+ // set fields for a panel section
151
+ set_panel_section_fields: function (state, payload) {
152
+ var section = _.find(state.panel_sections, function (item) {
153
+ return item.id === payload.id;
154
+ });
155
+
156
+ section.fields = payload.fields;
157
+ },
158
+
159
+ // notifications
160
+ addNotification: function(state, payload) {
161
+ state.notifications.push(payload);
162
+ },
163
+
164
+ deleteNotification: function(state, index) {
165
+ state.notifications.splice(index, 1);
166
+ },
167
+
168
+ cloneNotification: function(state, index) {
169
+ var clone = $.extend(true, {}, state.notifications[index]);
170
+
171
+ index = parseInt(index) + 1;
172
+ state.notifications.splice(index, 0, clone);
173
+ },
174
+
175
+ // update by it's property
176
+ updateNotificationProperty: function(state, payload) {
177
+ state.notifications[payload.index][payload.property] = payload.value;
178
+ },
179
+
180
+ updateNotification: function(state, payload) {
181
+ state.notifications[payload.index] = payload.value;
182
+ }
183
+ }
184
+ });
185
+
186
+ /**
187
+ * The main form builder vue instance
188
+ */
189
+ new Vue({
190
+ el: '#wpuf-form-builder',
191
+
192
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.root),
193
+
194
+ store: wpuf_form_builder_store,
195
+
196
+ data: {
197
+ is_form_saving: false,
198
+ is_form_saved: false,
199
+ is_form_switcher: false,
200
+ post_title_editing: false,
201
+ },
202
+
203
+ computed: {
204
+ current_panel: function () {
205
+ return this.$store.state.current_panel;
206
+ },
207
+
208
+ post: function () {
209
+ return this.$store.state.post;
210
+ },
211
+
212
+ form_fields_count: function () {
213
+ return this.$store.state.form_fields.length;
214
+ },
215
+
216
+ form_fields: function () {
217
+ return this.$store.state.form_fields;
218
+ },
219
+
220
+ notifications: function() {
221
+ return this.$store.state.notifications;
222
+ }
223
+ },
224
+
225
+ created: function () {
226
+ this.$store.commit('panel_add_show_prop');
227
+
228
+ /**
229
+ * This is the event hub we'll use in every
230
+ * component to communicate between them
231
+ */
232
+ wpuf_form_builder.event_hub = new Vue();
233
+ },
234
+
235
+ mounted: function () {
236
+ // primary nav tabs and their contents
237
+ this.bind_tab_on_click($('#wpuf-form-builder > fieldset > .nav-tab-wrapper > a'), '#wpuf-form-builder');
238
+
239
+ // secondary settings tabs and their contents
240
+ var settings_tabs = $('#wpuf-form-builder-settings .nav-tab'),
241
+ settings_tab_contents = $('#wpuf-form-builder-settings .tab-contents .group');
242
+
243
+ settings_tabs.first().addClass('nav-tab-active');
244
+ settings_tab_contents.first().addClass('active');
245
+
246
+ this.bind_tab_on_click(settings_tabs, '#wpuf-form-builder-settings');
247
+
248
+ var clipboard = new window.Clipboard('.form-id');
249
+ $(".form-id").tooltip();
250
+
251
+ var self = this;
252
+
253
+ clipboard.on('success', function(e) {
254
+ // Show copied tooltip
255
+ $(e.trigger)
256
+ .attr('data-original-title', 'Copied!')
257
+ .tooltip('show');
258
+
259
+ // Reset the copied tooltip
260
+ setTimeout(function() {
261
+ $(e.trigger).tooltip('hide')
262
+ .attr('data-original-title', self.i18n.copy_shortcode);
263
+ }, 1000);
264
+
265
+ e.clearSelection();
266
+ });
267
+
268
+ window.onbeforeunload = function () {
269
+ if (!self.is_form_saved) {
270
+ return self.i18n.unsaved_changes;
271
+ }
272
+ };
273
+ },
274
+
275
+ methods: {
276
+ // tabs and their contents
277
+ bind_tab_on_click: function (tabs, scope) {
278
+ tabs.on('click', function (e) {
279
+ e.preventDefault();
280
+
281
+ var button = $(this),
282
+ tab_contents = $(scope + ' > fieldset > .tab-contents'),
283
+ group_id = button.attr('href');
284
+
285
+ button.addClass('nav-tab-active').siblings('.nav-tab-active').removeClass('nav-tab-active');
286
+
287
+ tab_contents.children().removeClass('active');
288
+ $(group_id).addClass('active');
289
+ });
290
+ },
291
+
292
+ // switch form
293
+ switch_form: function () {
294
+ this.is_form_switcher = (this.is_form_switcher) ? false : true;
295
+ },
296
+
297
+ // set current sidebar panel
298
+ set_current_panel: function (panel) {
299
+ this.$store.commit('set_current_panel', panel);
300
+ },
301
+
302
+ // save form builder data
303
+ save_form_builder: function () {
304
+ var self = this;
305
+
306
+ if (_.isFunction(this.validate_form_before_submit) && !this.validate_form_before_submit()) {
307
+
308
+ this.warn({
309
+ text: this.validation_error_msg
310
+ });
311
+
312
+ return;
313
+ }
314
+
315
+ self.is_form_saving = true;
316
+ self.set_current_panel('form-fields');
317
+
318
+ wp.ajax.send('wpuf_form_builder_save_form', {
319
+ data: {
320
+ form_data: $('#wpuf-form-builder').serialize(),
321
+ form_fields: JSON.stringify(self.form_fields),
322
+ notifications: JSON.stringify(self.notifications)
323
+ },
324
+
325
+ success: function (response) {
326
+ if (response.form_fields) {
327
+ self.$store.commit('set_form_fields', response.form_fields);
328
+ }
329
+
330
+ self.is_form_saving = false;
331
+ self.is_form_saved = true;
332
+
333
+ toastr.success(self.i18n.saved_form_data);
334
+ },
335
+
336
+ error: function () {
337
+ self.is_form_saving = false;
338
+ }
339
+ });
340
+ }
341
+ }
342
+ });
343
+
344
+ var SettingsTab = {
345
+ init: function() {
346
+ $(function() {
347
+ $('.wpuf-ms-color').wpColorPicker();
348
+ });
349
+
350
+ $('#wpuf-metabox-settings').on('change', 'select[name="wpuf_settings[redirect_to]"]', this.settingsRedirect);
351
+ $('#wpuf-metabox-settings-update').on('change', 'select[name="wpuf_settings[edit_redirect_to]"]', this.settingsRedirect);
352
+ $('select[name="wpuf_settings[redirect_to]"]').change();
353
+ $('select[name="wpuf_settings[edit_redirect_to]"]').change();
354
+
355
+ // Form settings: Guest post
356
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_post]"]', this.settingsGuest);
357
+ $('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger('change');
358
+
359
+ // From settings: User details
360
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_details]"]', this.settingsGuestDetails);
361
+
362
+ this.changeMultistepVisibility($('.wpuf_enable_multistep_section :input[type="checkbox"]'));
363
+ var self = this;
364
+ $('.wpuf_enable_multistep_section :input[type="checkbox"]').click(function() {
365
+ self.changeMultistepVisibility($(this));
366
+ });
367
+ },
368
+
369
+ settingsGuest: function (e) {
370
+ e.preventDefault();
371
+
372
+ var table = $(this).closest('table');
373
+
374
+ if ( $(this).is(':checked') ) {
375
+ table.find('tr.show-if-guest').show();
376
+ table.find('tr.show-if-not-guest').hide();
377
+
378
+ $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
379
+
380
+ } else {
381
+ table.find('tr.show-if-guest').hide();
382
+ table.find('tr.show-if-not-guest').show();
383
+ }
384
+ },
385
+
386
+ settingsGuestDetails: function (e) {
387
+ e.preventDefault();
388
+
389
+ var table = $(this).closest('table');
390
+
391
+ if ( $(this).is(':checked') ) {
392
+ table.find('tr.show-if-details').show();
393
+ } else {
394
+ table.find('tr.show-if-details').hide();
395
+ }
396
+ },
397
+
398
+ settingsRedirect: function(e) {
399
+ e.preventDefault();
400
+
401
+ var $self = $(this),
402
+ $table = $self.closest('table'),
403
+ value = $self.val();
404
+
405
+ switch( value ) {
406
+ case 'post':
407
+ $table.find('tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page').hide();
408
+ break;
409
+
410
+ case 'page':
411
+ $table.find('tr.wpuf-page-id').show();
412
+ $table.find('tr.wpuf-same-page').hide();
413
+ $table.find('tr.wpuf-url').hide();
414
+ break;
415
+
416
+ case 'url':
417
+ $table.find('tr.wpuf-page-id').hide();
418
+ $table.find('tr.wpuf-same-page').hide();
419
+ $table.find('tr.wpuf-url').show();
420
+ break;
421
+
422
+ case 'same':
423
+ $table.find('tr.wpuf-page-id').hide();
424
+ $table.find('tr.wpuf-url').hide();
425
+ $table.find('tr.wpuf-same-page').show();
426
+ break;
427
+ }
428
+ },
429
+
430
+ changeMultistepVisibility: function(target) {
431
+ if (target.is(':checked')) {
432
+ $('.wpuf_multistep_content').show();
433
+ } else {
434
+ $('.wpuf_multistep_content').hide();
435
+ }
436
+ }
437
+ };
438
+
439
+ // on DOM ready
440
+ $(function() {
441
+ resizeBuilderContainer();
442
+
443
+ $("#collapse-menu").click(function () {
444
+ resizeBuilderContainer();
445
+ });
446
+
447
+ function resizeBuilderContainer() {
448
+ if ($(document.body).hasClass('folded')) {
449
+ $("#wpuf-form-builder").css("width", "calc(100% - 80px)");
450
+ } else {
451
+ $("#wpuf-form-builder").css("width", "calc(100% - 200px)");
452
+ }
453
+ }
454
+
455
+ SettingsTab.init();
456
+ });
457
+
458
+ })(jQuery);
admin/form-builder/assets/js/jquery-siaf-end.js ADDED
@@ -0,0 +1 @@
 
1
+ })(jQuery);
admin/form-builder/assets/js/jquery-siaf-start.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ ;(function($) {
2
+ 'use strict';
admin/form-builder/assets/js/mixins/form-field.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Mixin for form fields like
3
+ * form-text_field, form-field_textarea etc
4
+ */
5
+ wpuf_mixins.form_field_mixin = {
6
+ props: {
7
+ field: {
8
+ type: Object,
9
+ default: {}
10
+ }
11
+ },
12
+
13
+ computed: {
14
+ form_id: function () {
15
+ return this.$store.state.post.ID;
16
+ },
17
+
18
+ has_options: function () {
19
+ if (!this.field.hasOwnProperty('options')) {
20
+ return false;
21
+ }
22
+
23
+ return !!Object.keys(this.field.options).length;
24
+ }
25
+ },
26
+
27
+ methods: {
28
+ class_names: function(type_class) {
29
+ return [
30
+ type_class,
31
+ this.required_class(),
32
+ 'wpuf_' + this.field.name + '_' + this.form_id
33
+ ];
34
+ },
35
+
36
+ required_class: function () {
37
+ return ('yes' === this.required) ? 'required' : '';
38
+ },
39
+
40
+ is_selected: function (label) {
41
+ if (_.isArray(this.field.selected)) {
42
+ if (_.indexOf(this.field.selected, label) >= 0) {
43
+ return true;
44
+ }
45
+
46
+ } else if (label === this.field.selected) {
47
+ return true;
48
+ }
49
+
50
+ return false;
51
+ }
52
+ }
53
+ };
admin/form-builder/assets/js/mixins/global.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Global mixin
3
+ */
4
+ Vue.mixin({
5
+ computed: {
6
+ i18n: function () {
7
+ return wpuf_form_builder.i18n;
8
+ }
9
+ },
10
+
11
+ methods: {
12
+ get_random_id: function() {
13
+ var min = 999999,
14
+ max = 9999999999;
15
+
16
+ return Math.floor(Math.random() * (max - min + 1)) + min;
17
+ },
18
+
19
+ warn: function (settings, callback) {
20
+ settings = $.extend(true, {
21
+ title: '',
22
+ text: '',
23
+ type: 'warning',
24
+ showCancelButton: true,
25
+ confirmButtonColor: '#d54e21',
26
+ confirmButtonText: this.i18n.ok,
27
+ cancelButtonText: this.i18n.cancel,
28
+ }, settings);
29
+
30
+ swal(settings, callback);
31
+ },
32
+
33
+ is_failed_to_validate: function (template) {
34
+ var validator = this.field_settings[template] ? this.field_settings[template].validator : false;
35
+
36
+ if (validator && validator.callback && !this[validator.callback]()) {
37
+ return true;
38
+ }
39
+
40
+ return false;
41
+ },
42
+
43
+ containsField: function(field_name) {
44
+ var i = 0;
45
+
46
+ for (i = 0; i < this.$store.state.form_fields.length; i++) {
47
+ if (this.$store.state.form_fields[i].name === field_name) {
48
+ return true;
49
+ }
50
+ }
51
+
52
+ return false;
53
+ },
54
+
55
+ isSingleInstance: function(field_name) {
56
+ var singleInstance = ['post_title', 'post_content', 'post_excerpt', 'featured_image',
57
+ 'user_login', 'first_name', 'last_name', 'nickname', 'user_email', 'user_url',
58
+ 'user_bio', 'password', 'user_avatar'];
59
+
60
+ if ( $.inArray(field_name, singleInstance) >= 0 ) {
61
+ return true;
62
+ }
63
+
64
+ return false;
65
+ }
66
+ }
67
+ });
admin/form-builder/assets/js/mixins/option-field.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Mixin for option fields like
3
+ * field-text, field-text-meta, field-radio etc
4
+ */
5
+ wpuf_mixins.option_field_mixin = {
6
+ props: {
7
+ option_field: {
8
+ type: Object,
9
+ default: {}
10
+ },
11
+
12
+ editing_form_field: {
13
+ type: Object,
14
+ default: {}
15
+ }
16
+ },
17
+
18
+ computed: {
19
+ // show/hide on basis of depenedent settings
20
+ met_dependencies: function () {
21
+ // no 'dependencies' key
22
+ if (!this.option_field.hasOwnProperty('dependencies')) {
23
+ return true;
24
+ }
25
+
26
+ var deps = Object.keys(this.option_field.dependencies),
27
+ i = 0;
28
+
29
+ // has 'dependencies' key, but no property is set
30
+ if (!deps.length) {
31
+ return true;
32
+ }
33
+
34
+ // check if dependencies met
35
+ for (i = 0; i < deps.length; i++) {
36
+ var required_dep_value = this.option_field.dependencies[ deps[i] ],
37
+ editing_field_value = this.editing_form_field[ deps[i] ];
38
+
39
+ if (required_dep_value !== editing_field_value) {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ return true;
45
+ }
46
+ },
47
+
48
+ methods: {
49
+ update_value: function(property, value) {
50
+ this.$store.commit('update_editing_form_field', {
51
+ editing_field_id: this.editing_form_field.id,
52
+ field_name: property,
53
+ value: value
54
+ });
55
+ },
56
+ }
57
+ };
admin/form-builder/assets/less/form-builder.less ADDED
@@ -0,0 +1,947 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Variables
2
+ // --------------------------------------------------
3
+ @import "variables.less";
4
+
5
+ // Mixins
6
+ // --------------------------------------------------
7
+ @import "mixins/hide-text.less";
8
+ @import "mixins/opacity.less";
9
+ @import "mixins/size.less";
10
+ @import "mixins/reset-text.less";
11
+ @import "mixins/text-overflow.less";
12
+ @import "mixins/vendor-prefixes.less";
13
+ @import "mixins/clearfix.less";
14
+ @import "mixins/center-block.less";
15
+ @import "mixins/custom-mixins.less";
16
+
17
+
18
+ // Hide initial vue instance template
19
+ // --------------------------------------------------
20
+ [v-cloak] {
21
+ display: none;
22
+ }
23
+
24
+ // Style pro alerts
25
+ // --------------------------------------------------
26
+ .wpuf-pro-text-alert {
27
+ font-style: italic;
28
+ color: @borderColor;
29
+
30
+ a {
31
+ text-decoration: none;
32
+ color: #aaa;
33
+ }
34
+ }
35
+
36
+ #wpuf-pro-content {
37
+ opacity: 0.7;
38
+ }
39
+
40
+ // Utilities
41
+ // --------------------------------------------------
42
+ .clearfix {
43
+ .clearfix();
44
+ }
45
+
46
+ .pull-left {
47
+ float: left !important;
48
+ }
49
+
50
+ .pull-right {
51
+ float: right !important;
52
+ }
53
+
54
+ .text-center {
55
+ text-align: center;
56
+ }
57
+
58
+ .text-right {
59
+ text-align: right;
60
+ }
61
+
62
+ .margin-0 {
63
+ margin: 0;
64
+ }
65
+
66
+ .margin-bottom-10 {
67
+ margin-bottom: 10px;
68
+ }
69
+
70
+ .list-inline {
71
+ padding-left: 0;
72
+ list-style: none;
73
+ margin-left: -5px;
74
+
75
+ & > li {
76
+ display: inline-block;
77
+ padding-left: 5px;
78
+ padding-right: 5px;
79
+ }
80
+ }
81
+
82
+ .disabled {
83
+ pointer-events: none;
84
+ cursor: not-allowed;
85
+ opacity: 0.7;
86
+ }
87
+
88
+ .label-hr {
89
+ border-bottom: 1px solid #ccc;
90
+ display: block;
91
+ padding-bottom: 8px;
92
+ }
93
+
94
+ // Vue Transition effects
95
+ // --------------------------------------------------
96
+ .slide-fade-enter-active {
97
+ .transition(all .6s);
98
+ overflow: hidden;
99
+ }
100
+
101
+ .slide-fade-leave-active {
102
+ .transition(all .4s);
103
+ overflow: hidden;
104
+ }
105
+
106
+ .slide-fade-enter,
107
+ .slide-fade-leave-active {
108
+ opacity: .3 !important;
109
+ max-height: 0 !important;
110
+ margin: 0 !important;
111
+ }
112
+
113
+ // Sweet Alert
114
+ // --------------------------------------------------
115
+ .sweet-alert {
116
+ border-radius: 0;
117
+
118
+ h2 {
119
+ font-size: 26px;
120
+ line-height: 1.6;
121
+ }
122
+
123
+ p {
124
+ font-size: 15px;
125
+ font-weight: 400;
126
+ color: #656565;
127
+ line-height: 1.7;
128
+
129
+ a {
130
+ text-decoration: none;
131
+ }
132
+ }
133
+
134
+ button {
135
+ border-radius: 3px;
136
+ padding: 10px 20px;
137
+ min-width: 100px;
138
+ }
139
+ }
140
+
141
+ // CSS3 loader animation
142
+ // --------------------------------------------------
143
+ .loader,
144
+ .loader:after {
145
+ border-radius: 50%;
146
+ width: 25px;
147
+ height: 25px;
148
+ }
149
+
150
+ .loader {
151
+ display: inline-block;
152
+ position: relative;
153
+ text-indent: -9999em;
154
+ border-top: 3px solid fade(@wpBlue, 20%);
155
+ border-right: 3px solid fade(@wpBlue, 20%);
156
+ border-bottom: 3px solid fade(@wpBlue, 20%);
157
+ border-left: 3px solid @wpBlue;
158
+ -webkit-transform: translateZ(0);
159
+ -ms-transform: translateZ(0);
160
+ transform: translateZ(0);
161
+ -webkit-animation: wpuf_form_builder_loader 1.1s infinite linear;
162
+ animation: wpuf_form_builder_loader 1.1s infinite linear;
163
+ }
164
+
165
+ .button.button-ajax-working {
166
+
167
+ .loader {
168
+ display: inline-block;
169
+ width: 17px;
170
+ height: 17px;
171
+ top: 4px;
172
+ margin-right: 3px;
173
+ border-top: 1px solid rgb(102, 198, 228);
174
+ border-right: 1px solid rgb(102, 198, 228);
175
+ border-bottom: 1px solid rgb(102, 198, 228);
176
+ border-left: 1px solid rgba(102, 198, 228, 0);
177
+ }
178
+ }
179
+
180
+ @-webkit-keyframes wpuf_form_builder_loader {
181
+ 0% {
182
+ -webkit-transform: rotate(0deg);
183
+ transform: rotate(0deg);
184
+ }
185
+ 100% {
186
+ -webkit-transform: rotate(360deg);
187
+ transform: rotate(360deg);
188
+ }
189
+ }
190
+
191
+ @keyframes wpuf_form_builder_loader {
192
+ 0% {
193
+ -webkit-transform: rotate(0deg);
194
+ transform: rotate(0deg);
195
+ }
196
+ 100% {
197
+ -webkit-transform: rotate(360deg);
198
+ transform: rotate(360deg);
199
+ }
200
+ }
201
+
202
+ // toastr - notification
203
+ // --------------------------------------------------
204
+ #toast-container {
205
+
206
+ &.toast-top-right {
207
+ top: 40px;
208
+ right: 18px;
209
+ }
210
+
211
+ & > div {
212
+ opacity: 1;
213
+ }
214
+
215
+ & > :hover {
216
+ opacity: .9;
217
+ }
218
+ }
219
+
220
+ // Flex button group
221
+ // --------------------------------------------------
222
+ .wp-core-ui .button-group.wpuf-flex-button-group {
223
+ position: relative;
224
+ z-index: 1;
225
+ display: flex;
226
+ flex-flow: row nowrap;
227
+ justify-content: flex-start;
228
+ align-content: center;
229
+ align-items: center;
230
+
231
+ .button {
232
+ flex-grow: 1;
233
+ flex-shrink: 1;
234
+ flex-basis: 0;
235
+ align-self: auto;
236
+ text-align: center;
237
+ }
238
+ }
239
+
240
+ // Selectize
241
+ // --------------------------------------------------
242
+ .selectize-input {
243
+ padding: 6px 5px;
244
+ border: 1px solid #ddd;
245
+ }
246
+
247
+ .selectize-dropdown .active {
248
+ background-color: @wpBlue;
249
+ color: #fff;
250
+ }
251
+
252
+ .selectize-element-group {
253
+ display: none;
254
+
255
+ & + .selectize-control {
256
+ display: none;
257
+ }
258
+
259
+ &.active + .selectize-control {
260
+ display: block;
261
+ margin-top: 10px;
262
+ }
263
+ }
264
+
265
+ .selectize-control {
266
+
267
+ &.multi {
268
+
269
+ .selectize-input {
270
+
271
+ [data-value] {
272
+ text-shadow: 0 1px 0 rgba(0,51,83,0.3);
273
+ -webkit-border-radius: 3px;
274
+ -moz-border-radius: 3px;
275
+ border-radius: 3px;
276
+ .vertical-gradient(fade(@wpBlue, 40%), @wpBlue);
277
+ .box-shadow(~"0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03)");
278
+
279
+ &.active {
280
+ .vertical-gradient(fade(@wpBlue, 40%), @wpBlue);
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+
288
+ // Form Builder
289
+ // --------------------------------------------------
290
+ #wpuf-form-builder {
291
+ width: ~"calc(100% - 200px)";
292
+ padding-top: 10px;
293
+ position: fixed;
294
+ top: 25px;
295
+
296
+ & * {
297
+ box-sizing: border-box;
298
+ }
299
+
300
+ & > fieldset {
301
+ & > .nav-tab-wrapper {
302
+
303
+ .nav-tab:focus {
304
+ outline: 0;
305
+ .box-shadow(none);
306
+ }
307
+
308
+ .button {
309
+ font-weight: 400;
310
+ }
311
+ }
312
+
313
+ & > .tab-contents {
314
+ .border(bottom);
315
+
316
+ & > .group {
317
+ display: none;
318
+
319
+ &.active {
320
+ display: block;
321
+ }
322
+
323
+ &:not(#wpuf-form-builder-container):not(#wpuf-form-builder-settings) {
324
+ height: ~"calc(100vh - 125px)";
325
+ overflow-y: auto;
326
+ padding-top: 15px;
327
+ }
328
+ }
329
+ }
330
+ }
331
+
332
+
333
+ .wpuf-settings-nav-tab-wrapper {
334
+ width: 200px;
335
+ }
336
+
337
+ .wp-picker-holder * {
338
+ box-sizing: content-box;
339
+ }
340
+ }
341
+
342
+ #wpuf-form-builder-settings {
343
+ position: relative;
344
+ margin-top: 15px;
345
+
346
+ .nav-tab-wrapper {
347
+ position: absolute;
348
+ top: 0;
349
+ left: 0;
350
+ width: 170px;
351
+ border-bottom: 0;
352
+
353
+ a {
354
+ width: ~"calc(100% - -1px)";
355
+ margin-left: 0;
356
+ margin-bottom: .5em;
357
+ .border(right);
358
+ .border(bottom);
359
+ font-weight: 400;
360
+ font-size: 13px;
361
+
362
+ &.nav-tab-active {
363
+ border-right-color: @htmlBG;
364
+ }
365
+
366
+ &:focus {
367
+ outline: 0;
368
+ .box-shadow(none);
369
+ }
370
+ }
371
+ }
372
+
373
+ .tab-contents {
374
+ margin-left: 170px;
375
+ .border(left);
376
+ padding-left: 20px;
377
+
378
+ & > .group {
379
+ display: none;
380
+ height: ~"calc(100vh - 140px)";
381
+ overflow-y: auto;
382
+
383
+ &.active {
384
+ display: block;
385
+ }
386
+ }
387
+
388
+ .form-table {
389
+ margin-top: 0;
390
+ }
391
+ }
392
+ }
393
+
394
+ #wpuf-form-builder-container {
395
+ position: relative;
396
+
397
+ header {
398
+ height: 45px;
399
+ .border(right);
400
+
401
+ .form-title {
402
+ cursor: pointer;
403
+ font-size: 1.3em;
404
+ font-weight: 600;
405
+ float: left;
406
+ margin-right: 10px;
407
+ margin-top: 10px;
408
+ line-height: 1.5;
409
+ max-width: 300px;
410
+ white-space: nowrap;
411
+ overflow: hidden;
412
+ text-overflow: ellipsis;
413
+
414
+ &:hover {
415
+ background-color: rgba(85, 85, 85, 0.2);
416
+ }
417
+ }
418
+
419
+ .form-switcher-arrow {
420
+ cursor: pointer;
421
+ font-size: 24px;
422
+ margin-top: 10px;
423
+ line-height: 1;
424
+ width: 20px;
425
+ text-align: center;
426
+
427
+ &:hover {
428
+ background-color: rgba(85, 85, 85, 0.2);
429
+ }
430
+ }
431
+
432
+ .form-id {
433
+ color: #fff;
434
+ background-color: #008ec2;
435
+ line-height: 170%;
436
+ padding: 0 8px;
437
+ border-radius: 2px;
438
+ font-size: 13px;
439
+ display: inline-block;
440
+ margin: 10px 0 0 15px;
441
+ cursor: pointer;
442
+ }
443
+ }
444
+
445
+ section {
446
+ height: ~"calc(100vh - 170px)";
447
+ overflow-y: auto;
448
+ }
449
+
450
+ #builder-form-fields {
451
+ position: absolute;
452
+ top: 0;
453
+ right: 0;
454
+ width: 360px;
455
+
456
+ header {
457
+ ul {
458
+ margin: 0;
459
+
460
+ li {
461
+ width: 50%;
462
+ text-align: center;
463
+ float: left;
464
+ line-height: 1;
465
+ margin: 0;
466
+
467
+ a {
468
+ text-decoration: none;
469
+ line-height: 44px;
470
+ display: block;
471
+ background-color: #e5e5e5;
472
+ color: #777;
473
+ .border(bottom);
474
+ .transition(background-color .4s);
475
+
476
+ &:hover {
477
+ background-color: lighten(#e5e5e5, 5%);
478
+ }
479
+
480
+ &:focus {
481
+ outline: 0;
482
+ .box-shadow(none);
483
+ }
484
+ }
485
+
486
+ &.active a {
487
+ background-color: #fff;
488
+ color: #444;
489
+ .border(bottom, 1px, #fff);
490
+ }
491
+
492
+ &:first-child {
493
+ .border(right);
494
+ }
495
+ }
496
+ }
497
+ }
498
+
499
+ section {
500
+ background-color: #fff;
501
+ .border(right);
502
+
503
+ .wpuf-form-builder-panel {
504
+ padding: 10px;
505
+ }
506
+ }
507
+ }
508
+
509
+ #builder-stage {
510
+ margin-right: 360px;
511
+
512
+ section {
513
+ background-color: #6b6b6b;
514
+ padding: 30px;
515
+
516
+ #form-preview {
517
+ background-color: #fff;
518
+ .box-shadow(0 0 10px rgba(0, 0, 0, 0.3));
519
+ padding: 25px;
520
+ max-width: 800px;
521
+ margin: 0 auto;
522
+ }
523
+ }
524
+ }
525
+ }
526
+
527
+ // Builder Stage
528
+ // --------------------------------------------------
529
+ #form-preview-stage {
530
+
531
+ .field-items {
532
+ position: relative;
533
+ background-color: #fff;
534
+
535
+ .control-buttons {
536
+ position: absolute;
537
+ top: 0;
538
+ left: 0;
539
+ z-index: 10;
540
+ display: none;
541
+ width: 100%;
542
+ height: 100%;
543
+ margin: 0;
544
+ text-align: center;
545
+ background: fade(@wpYellow, 8%);
546
+ border: 1px dashed @wpYellow;
547
+
548
+ p {
549
+ position: absolute;
550
+ top: 50%;
551
+ left: 50%;
552
+ margin: -14px 0 0 -61px;
553
+ line-height: 1;
554
+ color: #eee;
555
+ background-color: @wpBlack;
556
+ }
557
+
558
+ i {
559
+ cursor: pointer;
560
+ padding: 8px;
561
+
562
+ &.move {
563
+ cursor: move;
564
+ }
565
+ }
566
+
567
+ i:hover {
568
+ background-color: @wpBlue;
569
+ }
570
+ }
571
+
572
+ &:hover .control-buttons {
573
+ display: block;
574
+ }
575
+
576
+ &.current-editing {
577
+ background-color: fade(@wpYellow, 15%);
578
+
579
+ &.ui-sortable-helper {
580
+ background-color: #fff;
581
+ }
582
+ }
583
+
584
+ &.ui-sortable-helper {
585
+ .box-shadow(0 0 10px rgba(0, 0, 0, 0.3));
586
+ }
587
+ }
588
+
589
+ .form-preview-stage-dropzone {
590
+ background-color: fade(@wpYellow, 30%) !important;
591
+ border: 1px solid @wpYellow;
592
+ height: 50px;
593
+ }
594
+
595
+ .wpuf-submit + .button + .form-preview-stage-dropzone,
596
+ .field-items.empty-list-item + .form-preview-stage-dropzone {
597
+ display: none;
598
+ }
599
+
600
+ .field-items.empty-list-item {
601
+ padding: 24px;
602
+ margin: 0;
603
+ border: 1px dashed fade(@wpBlack, 50%);
604
+ }
605
+
606
+ .form-preview-stage-dropzone + .field-items.empty-list-item {
607
+ display: none;
608
+ }
609
+
610
+ .hidden-field-list {
611
+ border-top: 1px dashed @borderColor;
612
+
613
+ h4 {
614
+ font-weight: 400;
615
+ font-size: 16px;
616
+ margin: 12px 0;
617
+ }
618
+
619
+ ul {
620
+
621
+ li {
622
+ background-color: @htmlBG;
623
+ }
624
+ }
625
+ }
626
+ }
627
+
628
+ // Panel: Form Fields
629
+ // --------------------------------------------------
630
+ .panel-form-field-group {
631
+ margin-bottom: 15px;
632
+
633
+ h3 {
634
+ margin: 0;
635
+ font-size: 15px;
636
+ border-bottom: 1px solid #eee;
637
+ padding-bottom: 10px;
638
+ cursor: pointer;
639
+
640
+ i {
641
+ float: right;
642
+ }
643
+ }
644
+
645
+ .panel-form-field-buttons {
646
+ opacity: 1;
647
+ max-height: 100vh;
648
+ overflow: hidden;
649
+ margin: 15px 0 0;
650
+ }
651
+
652
+ .button {
653
+ display: block;
654
+ width: 48%;
655
+ margin: 0 0 10px 0;
656
+ float: left;
657
+ text-align: left;
658
+
659
+ &:nth-child(odd) {
660
+ margin-right: 2%;
661
+ }
662
+
663
+ &.button-faded {
664
+ opacity: .5;
665
+ }
666
+ }
667
+ }
668
+
669
+ // the dragging field button
670
+ .button.ui-draggable-dragging {
671
+ margin: 0;
672
+ text-align: left;
673
+ }
674
+
675
+ // Panel: Field Options
676
+ // --------------------------------------------------
677
+ .wpuf-form-builder-field-options {
678
+
679
+ .option-fields-section {
680
+ margin-bottom: 15px;
681
+ }
682
+
683
+ .section-title {
684
+ margin: 0;
685
+ font-size: 15px;
686
+ border-bottom: 1px solid #eee;
687
+ padding-bottom: 10px;
688
+ cursor: pointer;
689
+
690
+ i {
691
+ float: right;
692
+ }
693
+ }
694
+
695
+ .option-field-section-fields {
696
+ margin-top: 15px;
697
+ max-height: 150vh;
698
+ opacity: 1;
699
+ }
700
+
701
+ .panel-field-opt {
702
+ margin-bottom: 15px;
703
+
704
+ .field-helper-text {
705
+ color: fadeout(@wpBlack, 50%);
706
+ margin-left: 6px;
707
+ }
708
+
709
+ &.panel-field-opt-text {
710
+
711
+ input[type="text"],
712
+ input[type="number"] {
713
+ display: block;
714
+ width: 100%;
715
+ margin: 5px 0 0;
716
+ line-height: 1.75;
717
+ }
718
+ }
719
+
720
+ &.panel-field-opt-radio {
721
+
722
+ & > label {
723
+ display: block;
724
+ margin-bottom: 5px;
725
+ }
726
+
727
+ & > ul {
728
+ margin-top: 0;
729
+ margin-bottom: 0;
730
+ }
731
+ }
732
+
733
+ &.panel-field-opt-select {
734
+
735
+ select {
736
+ width: 100%;
737
+ height: 32px;
738
+ margin: 4px 0 0;
739
+ }
740
+
741
+ }
742
+
743
+ .chosen-select + .chosen-container {
744
+ margin-top: 10px;
745
+ }
746
+
747
+ .label-title-block {
748
+ display: block;
749
+ margin-bottom: 3px;
750
+ }
751
+ }
752
+ }
753
+
754
+ .option-field-option-chooser {
755
+ margin: 12px 0 0;
756
+
757
+ &.margin-0 {
758
+ margin: 0;
759
+ }
760
+
761
+ .selector,
762
+ .sort-handler,
763
+ .label,
764
+ .value,
765
+ .action-buttons {
766
+ float: left;
767
+ }
768
+
769
+ .selector {
770
+ width: 25px;
771
+
772
+ input {
773
+ margin-top: 14px;
774
+ }
775
+ }
776
+
777
+ .sort-handler {
778
+ width: 22px;
779
+ cursor: ns-resize;
780
+
781
+ i {
782
+ margin-top: 14px;
783
+ font-size: 15px;
784
+ }
785
+ }
786
+
787
+ .label {
788
+ width: 208px;
789
+ margin-right: 8px;
790
+ }
791
+
792
+ &.show-value {
793
+ .label,
794
+ .value {
795
+ width: 100px;
796
+ margin-right: 8px;
797
+ }
798
+ }
799
+
800
+ .header {
801
+ .label, .value {
802
+ color: #909090;
803
+ }
804
+ }
805
+
806
+ .action-buttons {
807
+ width: 36px;
808
+
809
+ i {
810
+ cursor: pointer;
811
+ font-size: 16px;
812
+ margin-top: 13px;
813
+ }
814
+ }
815
+ }
816
+
817
+ .panel-field-opt-repeater-columns {
818
+
819
+ .repeater-columns {
820
+
821
+ li > div {
822
+ float: left;
823
+ }
824
+
825
+ .sorter {
826
+ width: 30px;
827
+
828
+ i {
829
+ cursor: ns-resize;
830
+ font-size: 16px;
831
+ margin-top: 5px;
832
+ }
833
+ }
834
+
835
+ .input-container {
836
+ width: 195px;
837
+ margin-right: 10px;
838
+
839
+ input {
840
+ width: 100%;
841
+ }
842
+ }
843
+
844
+ .action-buttons {
845
+ width: 50px;
846
+
847
+ i {
848
+ cursor: pointer;
849
+ font-size: 16px;
850
+ padding: 0 3px;
851
+ margin-top: 4px;
852
+ }
853
+ }
854
+ }
855
+ }
856
+
857
+ .panel-field-opt-textarea {
858
+
859
+ textarea {
860
+ display: block;
861
+ width: 100%;
862
+ margin: 5px 0 0;
863
+ line-height: 1.75;
864
+ }
865
+ }
866
+
867
+ .panel-field-html-help-text {
868
+
869
+ pre {
870
+ max-width: 100%;
871
+ overflow-x: auto;
872
+ }
873
+ }
874
+
875
+ .panel-field-opt-select {
876
+
877
+ .opt-select-element {
878
+ display: block;
879
+ max-width: 100%;
880
+ }
881
+ }
882
+
883
+ // Text Editor
884
+ // --------------------------------------------------
885
+ ul.wpuf-form li .wpuf-text-editor .wp-editor-wrap {
886
+ border: 0;
887
+ }
888
+
889
+ .form-switcher-content {
890
+ position: absolute;
891
+ background-color: #f9f9f9;
892
+ min-width: 160px;
893
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
894
+ z-index: 9999;
895
+ margin: 0;
896
+
897
+ li {
898
+ margin: 0;
899
+ }
900
+
901
+ a {
902
+ color: black;
903
+ padding: 12px;
904
+ text-decoration: none;
905
+ display: block;
906
+ text-align: center;
907
+ }
908
+ a:hover {
909
+ color: #fff;
910
+ background-color: #008ec2;
911
+ }
912
+ a.active {
913
+ font-weight: bold;
914
+ color: #fff;
915
+ background-color: #008ec2;
916
+ }
917
+ }
918
+
919
+ .insert-photo-icon {
920
+ vertical-align: text-top;
921
+ color: #82878c;
922
+ font-size: 18px;
923
+ }
924
+
925
+ .password-strength-meter {
926
+ border-style: solid;
927
+ border-width: 1px;
928
+ float: left;
929
+ margin: 0;
930
+ padding: 3px 5px;
931
+ text-align: center;
932
+ width: 200px;
933
+ display: block;
934
+ background-color: #eee;
935
+ border-color: #ddd;
936
+ }
937
+
938
+ ul.wpuf-form li .wpuf-password-field {
939
+ width: 100%;
940
+ margin-bottom: 10px;
941
+ }
942
+
943
+ ul.wpuf-form li .wpuf-password-field:after {
944
+ clear: both;
945
+ content: "";
946
+ display: table;
947
+ }
admin/form-builder/assets/less/mixins/center-block.less ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ // Center-align a block level element
2
+
3
+ .center-block() {
4
+ display: block;
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+ }
admin/form-builder/assets/less/mixins/clearfix.less ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Clearfix
2
+ //
3
+ // For modern browsers
4
+ // 1. The space content is one way to avoid an Opera bug when the
5
+ // contenteditable attribute is included anywhere else in the document.
6
+ // Otherwise it causes space to appear at the top and bottom of elements
7
+ // that are clearfixed.
8
+ // 2. The use of `table` rather than `block` is only necessary if using
9
+ // `:before` to contain the top-margins of child elements.
10
+ //
11
+ // Source: http://nicolasgallagher.com/micro-clearfix-hack/
12
+
13
+ .clearfix() {
14
+ &:before,
15
+ &:after {
16
+ content: " "; // 1
17
+ display: table; // 2
18
+ }
19
+ &:after {
20
+ clear: both;
21
+ }
22
+ }
admin/form-builder/assets/less/mixins/custom-mixins.less ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .border(@prop: '', @width: 1px, @bColor: @borderColor) {
2
+ & when not (@prop = '') {
3
+ border-@{prop}: @width solid @bColor;
4
+ }
5
+ & when (@prop = '') {
6
+ border: @width solid @bColor;
7
+ }
8
+ }
9
+
10
+ .button-colorized(@baseColor) {
11
+ background: @baseColor;
12
+ border-color: darken(@baseColor, 5%) darken(@baseColor, 9%) darken(@baseColor, 9%);
13
+ -webkit-box-shadow: 0 1px 0 darken(@baseColor, 9%);
14
+ box-shadow: 0 1px 0 darken(@baseColor, 9%);
15
+ color: #fff;
16
+ text-decoration: none;
17
+ text-shadow: 0 -1px 1px darken(@baseColor, 9%), 1px 0 1px darken(@baseColor, 9%), 0 1px 1px darken(@baseColor, 9%), -1px 0 1px darken(@baseColor, 9%);
18
+
19
+ &.hover,
20
+ &:hover,
21
+ &.focus,
22
+ &:focus {
23
+ background: lighten(@baseColor, 2%);
24
+ border-color: darken(@baseColor, 9%);
25
+ color: #fff;
26
+ }
27
+
28
+ &.focus,
29
+ &:focus {
30
+ -webkit-box-shadow: 0 1px 0 darken(@baseColor, 5%), 0 0 2px 1px darken(@baseColor, 17%);
31
+ box-shadow: 0 1px 0 darken(@baseColor, 5%), 0 0 2px 1px darken(@baseColor, 17%);
32
+ }
33
+
34
+
35
+ &.active,
36
+ &.active:hover,
37
+ &.active:focus,
38
+ &:active {
39
+ background: darken(@baseColor, 5%);
40
+ border-color: darken(@baseColor, 9%);
41
+ -webkit-box-shadow: inset 0 2px 0 darken(@baseColor, 9%);
42
+ box-shadow: inset 0 2px 0 darken(@baseColor, 9%);
43
+ vertical-align: top;
44
+ }
45
+
46
+ &[disabled],
47
+ &:disabled,
48
+ &-disabled,
49
+ &.disabled {
50
+ color: lighten(@baseColor, 27%) !important;
51
+ background: lighten(@baseColor, 2%) !important;
52
+ border-color: lighten(@baseColor, 3%) !important;
53
+ -webkit-box-shadow: none !important;
54
+ box-shadow: none !important;
55
+ text-shadow: 0 -1px 0 rgba( 0, 0, 0, 0.1 ) !important;
56
+ cursor: default;
57
+ }
58
+ }
59
+
60
+ // copied from selectize
61
+ .vertical-gradient (@color-top, @color-bottom) {
62
+ background-color: mix(@color-top, @color-bottom, 60%);
63
+ background-image: -moz-linear-gradient(top, @color-top, @color-bottom); // FF 3.6+
64
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@color-top), to(@color-bottom)); // Safari 4+, Chrome 2+
65
+ background-image: -webkit-linear-gradient(top, @color-top, @color-bottom); // Safari 5.1+, Chrome 10+
66
+ background-image: -o-linear-gradient(top, @color-top, @color-bottom); // Opera 11.10
67
+ background-image: linear-gradient(to bottom, @color-top, @color-bottom); // Standard, IE10
68
+ background-repeat: repeat-x;
69
+ filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@color-top),argb(@color-bottom))); // IE9 and down
70
+ }
admin/form-builder/assets/less/mixins/hide-text.less ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CSS image replacement
2
+ //
3
+ // Heads up! v3 launched with only `.hide-text()`, but per our pattern for
4
+ // mixins being reused as classes with the same name, this doesn't hold up. As
5
+ // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`.
6
+ //
7
+ // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
8
+
9
+ // Deprecated as of v3.0.1 (has been removed in v4)
10
+ .hide-text() {
11
+ font: ~"0/0" a;
12
+ color: transparent;
13
+ text-shadow: none;
14
+ background-color: transparent;
15
+ border: 0;
16
+ }
17
+
18
+ // New mixin to use as of v3.0.1
19
+ .text-hide() {
20
+ .hide-text();
21
+ }
admin/form-builder/assets/less/mixins/opacity.less ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ // Opacity
2
+
3
+ .opacity(@opacity) {
4
+ opacity: @opacity;
5
+ // IE8 filter
6
+ @opacity-ie: (@opacity * 100);
7
+ filter: ~"alpha(opacity=@{opacity-ie})";
8
+ }
admin/form-builder/assets/less/mixins/reset-text.less ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .reset-text() {
2
+ font-family: @font-family-base;
3
+ // We deliberately do NOT reset font-size.
4
+ font-style: normal;
5
+ font-weight: normal;
6
+ letter-spacing: normal;
7
+ line-break: auto;
8
+ line-height: @line-height-base;
9
+ text-align: left; // Fallback for where `start` is not supported
10
+ text-align: start;
11
+ text-decoration: none;
12
+ text-shadow: none;
13
+ text-transform: none;
14
+ white-space: normal;
15
+ word-break: normal;
16
+ word-spacing: normal;
17
+ word-wrap: normal;
18
+ }
admin/form-builder/assets/less/mixins/size.less ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ // Sizing shortcuts
2
+
3
+ .size(@width; @height) {
4
+ width: @width;
5
+ height: @height;
6
+ }
7
+
8
+ .square(@size) {
9
+ .size(@size; @size);
10
+ }
admin/form-builder/assets/less/mixins/text-overflow.less ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ // Text overflow
2
+ // Requires inline-block or block for proper styling
3
+
4
+ .text-overflow() {
5
+ overflow: hidden;
6
+ text-overflow: ellipsis;
7
+ white-space: nowrap;
8
+ }
admin/form-builder/assets/less/mixins/vendor-prefixes.less ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Vendor Prefixes
2
+ //
3
+ // All vendor mixins are deprecated as of v3.2.0 due to the introduction of
4
+ // Autoprefixer in our Gruntfile. They have been removed in v4.
5
+
6
+ // - Animations
7
+ // - Backface visibility
8
+ // - Box shadow
9
+ // - Box sizing
10
+ // - Content columns
11
+ // - Hyphens
12
+ // - Placeholder text
13
+ // - Transformations
14
+ // - Transitions
15
+ // - User Select
16
+
17
+
18
+ // Animations
19
+ .animation(@animation) {
20
+ -webkit-animation: @animation;
21
+ -o-animation: @animation;
22
+ animation: @animation;
23
+ }
24
+ .animation-name(@name) {
25
+ -webkit-animation-name: @name;
26
+ animation-name: @name;
27
+ }
28
+ .animation-duration(@duration) {
29
+ -webkit-animation-duration: @duration;
30
+ animation-duration: @duration;
31
+ }
32
+ .animation-timing-function(@timing-function) {
33
+ -webkit-animation-timing-function: @timing-function;
34
+ animation-timing-function: @timing-function;
35
+ }
36
+ .animation-delay(@delay) {
37
+ -webkit-animation-delay: @delay;
38
+ animation-delay: @delay;
39
+ }
40
+ .animation-iteration-count(@iteration-count) {
41
+ -webkit-animation-iteration-count: @iteration-count;
42
+ animation-iteration-count: @iteration-count;
43
+ }
44
+ .animation-direction(@direction) {
45
+ -webkit-animation-direction: @direction;
46
+ animation-direction: @direction;
47
+ }
48
+ .animation-fill-mode(@fill-mode) {
49
+ -webkit-animation-fill-mode: @fill-mode;
50
+ animation-fill-mode: @fill-mode;
51
+ }
52
+
53
+ // Backface visibility
54
+ // Prevent browsers from flickering when using CSS 3D transforms.
55
+ // Default value is `visible`, but can be changed to `hidden`
56
+
57
+ .backface-visibility(@visibility) {
58
+ -webkit-backface-visibility: @visibility;
59
+ -moz-backface-visibility: @visibility;
60
+ backface-visibility: @visibility;
61
+ }
62
+
63
+ // Drop shadows
64
+ //
65
+ // Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's
66
+ // supported browsers that have box shadow capabilities now support it.
67
+
68
+ .box-shadow(@shadow) {
69
+ -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
70
+ box-shadow: @shadow;
71
+ }
72
+
73
+ // Box sizing
74
+ .box-sizing(@boxmodel) {
75
+ -webkit-box-sizing: @boxmodel;
76
+ -moz-box-sizing: @boxmodel;
77
+ box-sizing: @boxmodel;
78
+ }
79
+
80
+ // CSS3 Content Columns
81
+ .content-columns(@column-count; @column-gap: @grid-gutter-width) {
82
+ -webkit-column-count: @column-count;
83
+ -moz-column-count: @column-count;
84
+ column-count: @column-count;
85
+ -webkit-column-gap: @column-gap;
86
+ -moz-column-gap: @column-gap;
87
+ column-gap: @column-gap;
88
+ }
89
+
90
+ // Optional hyphenation
91
+ .hyphens(@mode: auto) {
92
+ word-wrap: break-word;
93
+ -webkit-hyphens: @mode;
94
+ -moz-hyphens: @mode;
95
+ -ms-hyphens: @mode; // IE10+
96
+ -o-hyphens: @mode;
97
+ hyphens: @mode;
98
+ }
99
+
100
+ // Placeholder text
101
+ .placeholder(@color: @input-color-placeholder) {
102
+ // Firefox
103
+ &::-moz-placeholder {
104
+ color: @color;
105
+ opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526
106
+ }
107
+ &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+
108
+ &::-webkit-input-placeholder { color: @color; } // Safari and Chrome
109
+ }
110
+
111
+ // Transformations
112
+ .scale(@ratio) {
113
+ -webkit-transform: scale(@ratio);
114
+ -ms-transform: scale(@ratio); // IE9 only
115
+ -o-transform: scale(@ratio);
116
+ transform: scale(@ratio);
117
+ }
118
+ .scale(@ratioX; @ratioY) {
119
+ -webkit-transform: scale(@ratioX, @ratioY);
120
+ -ms-transform: scale(@ratioX, @ratioY); // IE9 only
121
+ -o-transform: scale(@ratioX, @ratioY);
122
+ transform: scale(@ratioX, @ratioY);
123
+ }
124
+ .scaleX(@ratio) {
125
+ -webkit-transform: scaleX(@ratio);
126
+ -ms-transform: scaleX(@ratio); // IE9 only
127
+ -o-transform: scaleX(@ratio);
128
+ transform: scaleX(@ratio);
129
+ }
130
+ .scaleY(@ratio) {
131
+ -webkit-transform: scaleY(@ratio);
132
+ -ms-transform: scaleY(@ratio); // IE9 only
133
+ -o-transform: scaleY(@ratio);
134
+ transform: scaleY(@ratio);
135
+ }
136
+ .skew(@x; @y) {
137
+ -webkit-transform: skewX(@x) skewY(@y);
138
+ -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+
139
+ -o-transform: skewX(@x) skewY(@y);
140
+ transform: skewX(@x) skewY(@y);
141
+ }
142
+ .translate(@x; @y) {
143
+ -webkit-transform: translate(@x, @y);
144
+ -ms-transform: translate(@x, @y); // IE9 only
145
+ -o-transform: translate(@x, @y);
146
+ transform: translate(@x, @y);
147
+ }
148
+ .translate3d(@x; @y; @z) {
149
+ -webkit-transform: translate3d(@x, @y, @z);
150
+ transform: translate3d(@x, @y, @z);
151
+ }
152
+ .rotate(@degrees) {
153
+ -webkit-transform: rotate(@degrees);
154
+ -ms-transform: rotate(@degrees); // IE9 only
155
+ -o-transform: rotate(@degrees);
156
+ transform: rotate(@degrees);
157
+ }
158
+ .rotateX(@degrees) {
159
+ -webkit-transform: rotateX(@degrees);
160
+ -ms-transform: rotateX(@degrees); // IE9 only
161
+ -o-transform: rotateX(@degrees);
162
+ transform: rotateX(@degrees);
163
+ }
164
+ .rotateY(@degrees) {
165
+ -webkit-transform: rotateY(@degrees);
166
+ -ms-transform: rotateY(@degrees); // IE9 only
167
+ -o-transform: rotateY(@degrees);
168
+ transform: rotateY(@degrees);
169
+ }
170
+ .perspective(@perspective) {
171
+ -webkit-perspective: @perspective;
172
+ -moz-perspective: @perspective;
173
+ perspective: @perspective;
174
+ }
175
+ .perspective-origin(@perspective) {
176
+ -webkit-perspective-origin: @perspective;
177
+ -moz-perspective-origin: @perspective;
178
+ perspective-origin: @perspective;
179
+ }
180
+ .transform-origin(@origin) {
181
+ -webkit-transform-origin: @origin;
182
+ -moz-transform-origin: @origin;
183
+ -ms-transform-origin: @origin; // IE9 only
184
+ transform-origin: @origin;
185
+ }
186
+
187
+
188
+ // Transitions
189
+
190
+ .transition(@transition) {
191
+ -webkit-transition: @transition;
192
+ -o-transition: @transition;
193
+ transition: @transition;
194
+ }
195
+ .transition-property(@transition-property) {
196
+ -webkit-transition-property: @transition-property;
197
+ transition-property: @transition-property;
198
+ }
199
+ .transition-delay(@transition-delay) {
200
+ -webkit-transition-delay: @transition-delay;
201
+ transition-delay: @transition-delay;
202
+ }
203
+ .transition-duration(@transition-duration) {
204
+ -webkit-transition-duration: @transition-duration;
205
+ transition-duration: @transition-duration;
206
+ }
207
+ .transition-timing-function(@timing-function) {
208
+ -webkit-transition-timing-function: @timing-function;
209
+ transition-timing-function: @timing-function;
210
+ }
211
+ .transition-transform(@transition) {
212
+ -webkit-transition: -webkit-transform @transition;
213
+ -moz-transition: -moz-transform @transition;
214
+ -o-transition: -o-transform @transition;
215
+ transition: transform @transition;
216
+ }
217
+
218
+
219
+ // User select
220
+ // For selecting text on the page
221
+
222
+ .user-select(@select) {
223
+ -webkit-user-select: @select;
224
+ -moz-user-select: @select;
225
+ -ms-user-select: @select; // IE10+
226
+ user-select: @select;
227
+ }
admin/form-builder/assets/less/variables.less ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ // WP Admin UI colors //
2
+ @borderColor: #cccccc;
3
+ @htmlBG: #f1f1f1;
4
+ @wpBlue: #0073aa;
5
+ @wpRed: #d54e21;
6
+ @wpGreen: #46b450;
7
+ @wpBlack: #23282d;
8
+ @wpYellow: #ffb900;
admin/form-builder/class-wpuf-admin-form-builder-ajax.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ajax handlers
4
+ */
5
+ class WPUF_Admin_Form_Builder_Ajax {
6
+
7
+ /**
8
+ * Class contructor
9
+ *
10
+ * @since 2.5
11
+ *
12
+ * @return void
13
+ */
14
+ public function __construct() {
15
+ add_action( 'wp_ajax_wpuf_form_builder_save_form', array( $this, 'save_form' ) );
16
+ }
17
+
18
+ /**
19
+ * Save form data
20
+ *
21
+ * @since 2.5
22
+ *
23
+ * @return void
24
+ */
25
+ public function save_form() {
26
+ parse_str( $_POST['form_data'], $form_data );
27
+
28
+ if ( ! wp_verify_nonce( $form_data['wpuf_form_builder_nonce'], 'wpuf_form_builder_save_form' ) ) {
29
+ wp_send_json_error( __( 'Unauthorized operation', 'wpuf' ) );
30
+ exit;
31
+ }
32
+
33
+ if ( empty( $form_data['wpuf_form_id'] ) ) {
34
+ wp_send_json_error( __( 'Invalid form id', 'wpuf' ) );
35
+ exit;
36
+ }
37
+
38
+ $form_fields = isset( $_POST['form_fields'] ) ? $_POST['form_fields'] : '';
39
+ $notifications = isset( $_POST['notifications'] ) ? $_POST['notifications'] : '';
40
+
41
+ $form_fields = wp_unslash( $form_fields );
42
+ $notifications = wp_unslash( $notifications );
43
+
44
+ $form_fields = json_decode( $form_fields, true );
45
+ $notifications = json_decode( $notifications, true );
46
+
47
+ $data = array(
48
+ 'form_id' => absint( $form_data['wpuf_form_id'] ),
49
+ 'post_title' => sanitize_text_field( $form_data['post_title'] ),
50
+ 'form_fields' => $form_fields,
51
+ 'form_settings' => isset( $form_data['wpuf_settings'] ) ? $form_data['wpuf_settings'] : array(),
52
+ 'form_settings_key' => isset( $form_data['form_settings_key'] ) ? $form_data['form_settings_key'] : '',
53
+ 'notifications' => $notifications
54
+ );
55
+
56
+ $form_fields = WPUF_Admin_Form_Builder::save_form( $data );
57
+
58
+ wp_send_json_success( array( 'form_fields' => $form_fields ) );
59
+ exit;
60
+ }
61
+
62
+ }
63
+
64
+ new WPUF_Admin_Form_Builder_Ajax();
admin/form-builder/class-wpuf-admin-form-builder.php ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form Builder framework
4
+ */
5
+
6
+ class WPUF_Admin_Form_Builder {
7
+
8
+ /**
9
+ * Form Settings
10
+ *
11
+ * @since 2.5
12
+ *
13
+ * @var string
14
+ */
15
+ private $settings = array();
16
+
17
+ /**
18
+ * Class contructor
19
+ *
20
+ * @since 2.5
21
+ *
22
+ * @return void
23
+ */
24
+ public function __construct( $settings ) {
25
+ global $post;
26
+
27
+ $defaults = array(
28
+ 'form_type' => '', // e.g 'post', 'profile' etc
29
+ 'post_type' => '', // e.g 'wpuf_forms', 'wpuf_profile' etc,
30
+ 'form_settings_key' => '',
31
+ 'post_id' => 0,
32
+ 'shortcodes' => array() // [ [ 'name' => 'wpuf_form', 'type' => 'profile' ], [ 'name' => 'wpuf_form', 'type' => 'registration' ] ]
33
+ );
34
+
35
+ $this->settings = wp_parse_args( $settings, $defaults );
36
+
37
+ // set post data to global $post
38
+ $post = get_post( $this->settings['post_id'] );
39
+
40
+ // if we have an existing post, then let's start
41
+ if ( ! empty( $post->ID ) ) {
42
+ add_action( 'in_admin_header', array( $this, 'remove_admin_notices' ) );
43
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
44
+ add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ) );
45
+ add_action( 'admin_footer', array( $this, 'admin_footer' ) );
46
+ add_action( 'wpuf-admin-form-builder', array( $this, 'include_form_builder' ) );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Remove all kinds of admin notices
52
+ *
53
+ * Since we don't have much space left on top of the page,
54
+ * we have to remove all kinds of admin notices
55
+ *
56
+ * @since 2.5
57
+ *
58
+ * @return void
59
+ */
60
+ public function remove_admin_notices() {
61
+ remove_all_actions( 'network_admin_notices' );
62
+ remove_all_actions( 'user_admin_notices' );
63
+ remove_all_actions( 'admin_notices' );
64
+ }
65
+
66
+ /**
67
+ * Enqueue admin scripts
68
+ *
69
+ * @since 2.5
70
+ *
71
+ * @return void
72
+ */
73
+ public function admin_enqueue_scripts() {
74
+ global $post;
75
+
76
+ /**
77
+ * CSS
78
+ */
79
+ wp_enqueue_style( 'wpuf-css', WPUF_ASSET_URI . '/css/frontend-forms.css' );
80
+ wp_enqueue_style( 'wpuf-font-awesome', WPUF_ASSET_URI . '/vendor/font-awesome/css/font-awesome.min.css', array(), WPUF_VERSION );
81
+ wp_enqueue_style( 'wpuf-sweetalert', WPUF_ASSET_URI . '/vendor/sweetalert/sweetalert.css', array(), WPUF_VERSION );
82
+ wp_enqueue_style( 'wpuf-selectize', WPUF_ASSET_URI . '/vendor/selectize/css/selectize.default.css', array(), WPUF_VERSION );
83
+ wp_enqueue_style( 'wpuf-toastr', WPUF_ASSET_URI . '/vendor/toastr/toastr.min.css', array(), WPUF_VERSION );
84
+ wp_enqueue_style( 'wpuf-tooltip', WPUF_ASSET_URI . '/vendor/tooltip/tooltip.css', array(), WPUF_VERSION );
85
+
86
+ $form_builder_css_deps = apply_filters( 'wpuf-form-builder-css-deps', array(
87
+ 'wpuf-css', 'wpuf-font-awesome', 'wpuf-sweetalert', 'wpuf-selectize', 'wpuf-toastr', 'wpuf-tooltip'
88
+ ) );
89
+
90
+ wp_enqueue_style( 'wpuf-form-builder', WPUF_ASSET_URI . '/css/wpuf-form-builder.css', $form_builder_css_deps, WPUF_VERSION );
91
+
92
+ do_action( 'wpuf-form-builder-enqueue-style' );
93
+
94
+ /**
95
+ * JavaScript
96
+ */
97
+ $prefix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
98
+
99
+ wp_enqueue_script( 'wpuf-vue', WPUF_ASSET_URI . '/vendor/vue/vue' . $prefix . '.js', array(), WPUF_VERSION, true );
100
+ wp_enqueue_script( 'wpuf-vuex', WPUF_ASSET_URI . '/vendor/vuex/vuex' . $prefix . '.js', array( 'wpuf-vue' ), WPUF_VERSION, true );
101
+ wp_enqueue_script( 'wpuf-sweetalert', WPUF_ASSET_URI . '/vendor/sweetalert/sweetalert-dev.js', array(), WPUF_VERSION, true );
102
+ wp_enqueue_script( 'wpuf-jquery-scrollTo', WPUF_ASSET_URI . '/vendor/jquery.scrollTo/jquery.scrollTo' . $prefix . '.js', array( 'jquery' ), WPUF_VERSION, true );
103
+ wp_enqueue_script( 'wpuf-selectize', WPUF_ASSET_URI . '/vendor/selectize/js/standalone/selectize' . $prefix . '.js', array( 'jquery' ), WPUF_VERSION, true );
104
+ wp_enqueue_script( 'wpuf-toastr', WPUF_ASSET_URI . '/vendor/toastr/toastr' . $prefix . '.js', array(), WPUF_VERSION, true );
105
+ wp_enqueue_script( 'wpuf-clipboard', WPUF_ASSET_URI . '/vendor/clipboard/clipboard' . $prefix . '.js', array(), WPUF_VERSION, true );
106
+ wp_enqueue_script( 'wpuf-tooltip', WPUF_ASSET_URI . '/vendor/tooltip/tooltip' . $prefix . '.js', array(), WPUF_VERSION, true );
107
+
108
+ $form_builder_js_deps = apply_filters( 'wpuf-form-builder-js-deps', array(
109
+ 'jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'underscore',
110
+ 'wpuf-vue', 'wpuf-vuex', 'wpuf-sweetalert', 'wpuf-jquery-scrollTo',
111
+ 'wpuf-selectize', 'wpuf-toastr', 'wpuf-clipboard', 'wpuf-tooltip'
112
+ ) );
113
+
114
+ wp_enqueue_script( 'wpuf-form-builder-mixins', WPUF_ASSET_URI . '/js/wpuf-form-builder-mixins.js', $form_builder_js_deps, WPUF_VERSION, true );
115
+
116
+ do_action( 'wpuf-form-builder-enqueue-after-mixins' );
117
+
118
+ wp_enqueue_script( 'wpuf-form-builder-components', WPUF_ASSET_URI . '/js/wpuf-form-builder-components.js', array( 'wpuf-form-builder-mixins' ), WPUF_VERSION, true );
119
+
120
+ do_action( 'wpuf-form-builder-enqueue-after-components' );
121
+
122
+ wp_enqueue_script( 'wpuf-form-builder', WPUF_ASSET_URI . '/js/wpuf-form-builder.js', array( 'wpuf-form-builder-components' ), WPUF_VERSION, true );
123
+
124
+ do_action( 'wpuf-form-builder-enqueue-after-main-instance' );
125
+
126
+ /*
127
+ * Data required for building the form
128
+ */
129
+ require_once WPUF_ROOT . '/admin/form-builder/class-wpuf-form-builder-field-settings.php';
130
+ require_once WPUF_ROOT . '/includes/free/prompt.php';
131
+
132
+ $wpuf_form_builder = apply_filters( 'wpuf-form-builder-localize-script', array(
133
+ 'i18n' => $this->i18n(),
134
+ 'post' => $post,
135
+ 'form_fields' => wpuf_get_form_fields( $post->ID ),
136
+ 'panel_sections' => $this->get_panel_sections(),
137
+ 'field_settings' => WPUF_Form_Builder_Field_Settings::get_field_settings(),
138
+ 'notifications' => wpuf_get_form_notifications( $post->ID ),
139
+ 'pro_link' => WPUF_Pro_Prompt::get_pro_url(),
140
+ 'site_url' => site_url('/')
141
+ ) );
142
+
143
+ wp_localize_script( 'wpuf-form-builder-mixins', 'wpuf_form_builder', $wpuf_form_builder );
144
+
145
+ // mixins
146
+ $wpuf_mixins = array(
147
+ 'root' => apply_filters( 'wpuf-form-builder-js-root-mixins', array() ),
148
+ 'builder_stage' => apply_filters( 'wpuf-form-builder-js-builder-stage-mixins', array() ),
149
+ 'form_fields' => apply_filters( 'wpuf-form-builder-js-form-fields-mixins', array() ),
150
+ 'field_options' => apply_filters( 'wpuf-form-builder-js-field-options-mixins', array() ),
151
+ );
152
+
153
+ wp_localize_script( 'wpuf-form-builder-mixins', 'wpuf_mixins', $wpuf_mixins );
154
+ }
155
+
156
+ /**
157
+ * Print js scripts in admin head
158
+ *
159
+ * @since 2.5
160
+ *
161
+ * @return void
162
+ */
163
+ public function admin_print_scripts() {
164
+ ?>
165
+ <script>
166
+ if (!window.Promise) {
167
+ var promise_polyfill = document.createElement('script');
168
+ promise_polyfill.setAttribute('src','https://cdn.polyfill.io/v2/polyfill.min.js');
169
+ document.head.appendChild(promise_polyfill);
170
+ }
171
+ </script>
172
+
173
+ <script>
174
+ var wpuf_form_builder_mixins = function(mixins, mixin_parent) {
175
+ if (!mixins || !mixins.length) {
176
+ return [];
177
+ }
178
+
179
+ if (!mixin_parent) {
180
+ mixin_parent = window;
181
+ }
182
+
183
+ return mixins.map(function (mixin) {
184
+ return mixin_parent[mixin];
185
+ });
186
+ };
187
+ </script>
188
+ <?php
189
+ }
190
+
191
+ /**
192
+ * Include vue component templates
193
+ *
194
+ * @since 2.5
195
+ *
196
+ * @return void
197
+ */
198
+ public function admin_footer() {
199
+ // get all vue component names
200
+ $path = WPUF_ROOT . '/admin/form-builder/assets/js/components';
201
+
202
+ $components = array();
203
+
204
+ // directory handle
205
+ $dir = dir( $path );
206
+
207
+ while ( $entry = $dir->read() ) {
208
+ if ( $entry !== '.' && $entry !== '..' ) {
209
+ if ( is_dir( $path . '/' . $entry ) ) {
210
+ $components[] = $entry;
211
+ }
212
+ }
213
+ }
214
+
215
+ // html templates of vue components
216
+ foreach ( $components as $component ) {
217
+ self::include_js_template( $component );
218
+ }
219
+
220
+ do_action( 'wpuf-form-builder-add-js-templates' );
221
+ }
222
+
223
+ /**
224
+ * Embed a Vue.js component template
225
+ *
226
+ * @since 2.5
227
+ *
228
+ * @param string $template
229
+ * @param string $file_path
230
+ *
231
+ * @return void
232
+ */
233
+ public static function include_js_template( $template, $file_path = '' ) {
234
+ $file_path = $file_path ? untrailingslashit( $file_path ) : WPUF_ROOT . '/admin/form-builder/assets/js/components';
235
+
236
+ $file_path = $file_path . '/' . $template . '/template.php';
237
+
238
+ if ( file_exists( $file_path ) ) {
239
+ echo '<script type="text/x-template" id="tmpl-wpuf-' . $template . '">' . "\n";
240
+ include apply_filters( 'wpuf-form-builder-js-template-path', $file_path, $template );
241
+ echo "\n" . '</script>' . "\n";
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Include form builder view template
247
+ *
248
+ * @since 2.5
249
+ *
250
+ * @return void
251
+ */
252
+ public function include_form_builder() {
253
+ $form_id = $this->settings['post_id'];
254
+ $form_type = $this->settings['form_type'];
255
+ $post_type = $this->settings['post_type'];
256
+ $form_settings_key = $this->settings['form_settings_key'];
257
+ $shortcodes = $this->settings['shortcodes'];
258
+
259
+ $forms = get_posts( array( 'post_type' => $post_type, 'post_status' => 'any' ) );
260
+
261
+ include WPUF_ROOT . '/admin/form-builder/views/form-builder.php';
262
+ }
263
+
264
+ /**
265
+ * Add Fields panel sections
266
+ *
267
+ * @since 2.5
268
+ *
269
+ * @return array
270
+ */
271
+ private function get_panel_sections() {
272
+ $before_custom_fields = apply_filters( 'wpuf-form-builder-fields-section-before', array() );
273
+
274
+ $sections = array_merge( $before_custom_fields, $this->get_custom_fields() );
275
+ $sections = array_merge( $sections, $this->get_others_fields() );
276
+
277
+ $after_custom_fields = apply_filters( 'wpuf-form-builder-fields-section-after', array() );
278
+
279
+ $sections = array_merge( $sections, $after_custom_fields );
280
+
281
+ return $sections;
282
+ }
283
+
284
+ /**
285
+ * Custom field section
286
+ *
287
+ * @since 2.5
288
+ *
289
+ * @return array
290
+ */
291
+ private function get_custom_fields() {
292
+ $fields = apply_filters( 'wpuf-form-builder-fields-custom-fields', array(
293
+ 'text_field', 'textarea_field', 'dropdown_field', 'multiple_select',
294
+ 'radio_field', 'checkbox_field', 'website_url', 'email_address',
295
+ 'custom_hidden_field', 'image_upload'
296
+ ) );
297
+
298
+ // var_dump( $fields ); exit;
299
+
300
+ return array(
301
+ array(
302
+ 'title' => __( 'Custom Fields', 'wpuf' ),
303
+ 'id' => 'custom-fields',
304
+ 'fields' => $fields
305
+ )
306
+ );
307
+ }
308
+
309
+ /**
310
+ * Others field section
311
+ *
312
+ * @since 2.5
313
+ *
314
+ * @return array
315
+ */
316
+ private function get_others_fields() {
317
+ $fields = apply_filters( 'wpuf-form-builder-fields-others-fields', array(
318
+ 'section_break', 'custom_html'
319
+ ) );
320
+
321
+ return array(
322
+ array(
323
+ 'title' => __( 'Others', 'wpuf' ),
324
+ 'id' => 'others',
325
+ 'fields' => $fields
326
+ )
327
+ );
328
+ }
329
+
330
+ /**
331
+ * i18n translatable strings
332
+ *
333
+ * @since 2.5
334
+ *
335
+ * @return array
336
+ */
337
+ private function i18n() {
338
+ return apply_filters( 'wpuf-form-builder-i18n', array(
339
+ 'advanced_options' => __( 'Advanced Options', 'wpuf' ),
340
+ 'delete_field_warn_msg' => __( 'Are you sure you want to delete this field?', 'wpuf' ),
341
+ 'yes_delete_it' => __( 'Yes, delete it', 'wpuf' ),
342
+ 'no_cancel_it' => __( 'No, cancel it', 'wpuf' ),
343
+ 'ok' => __( 'OK', 'wpuf' ),
344
+ 'cancel' => __( 'Cancel', 'wpuf' ),
345
+ 'close' => __( 'Close', 'wpuf' ),
346
+ 'last_choice_warn_msg' => __( 'This field must contain at least one choice', 'wpuf' ),
347
+ 'option' => __( 'Option', 'wpuf' ),
348
+ 'column' => __( 'Column', 'wpuf' ),
349
+ 'last_column_warn_msg' => __( 'This field must contain at least one column', 'wpuf' ),
350
+ 'is_a_pro_feature' => __( 'is available in Pro version', 'wpuf' ),
351
+ 'pro_feature_msg' => __( 'Please upgrade to the Pro version to unlock all these awesome features', 'wpuf' ),
352
+ 'upgrade_to_pro' => __( 'Get the Pro version', 'wpuf' ),
353
+ 'select' => __( 'Select', 'wpuf' ),
354
+ 'saved_form_data' => __( 'Saved form data', 'wpuf' ),
355
+ 'unsaved_changes' => __( 'You have unsaved changes.', 'wpuf' ),
356
+ 'copy_shortcode' => __( 'Click to copy shortcode', 'wpuf' ),
357
+ ) );
358
+ }
359
+
360
+ /**
361
+ * Save form data
362
+ *
363
+ * @since 2.5
364
+ *
365
+ * @param array $data Contains form_fields, form_settings, form_settings_key data
366
+ *
367
+ * @return boolean
368
+ */
369
+ public static function save_form( $data ) {
370
+ $saved_wpuf_inputs = array();
371
+
372
+ wp_update_post( array( 'ID' => $data['form_id'], 'post_status' => 'publish', 'post_title' => $data['post_title'] ) );
373
+
374
+ $existing_wpuf_input_ids = get_children( array(
375
+ 'post_parent' => $data['form_id'],
376
+ 'post_status' => 'publish',
377
+ 'post_type' => 'wpuf_input',
378
+ 'numberposts' => '-1',
379
+ 'orderby' => 'menu_order',
380
+ 'order' => 'ASC',
381
+ 'fields' => 'ids'
382
+ ) );
383
+
384
+ $new_wpuf_input_ids = array();
385
+
386
+ if ( ! empty( $data['form_fields'] ) ) {
387
+
388
+ foreach ( $data['form_fields'] as $order => $field ) {
389
+ if ( ! empty( $field['is_new'] ) ) {
390
+ unset( $field['is_new'] );
391
+ unset( $field['id'] );
392
+
393
+ $field_id = 0;
394
+
395
+ } else {
396
+ $field_id = $field['id'];
397
+ }
398
+
399
+ $field_id = wpuf_insert_form_field( $data['form_id'], $field, $field_id, $order );
400
+
401
+ $new_wpuf_input_ids[] = $field_id;
402
+
403
+ $field['id'] = $field_id;
404
+
405
+ $saved_wpuf_inputs[] = $field;
406
+ }
407
+
408
+ }
409
+
410
+ $inputs_to_delete = array_diff( $existing_wpuf_input_ids, $new_wpuf_input_ids );
411
+
412
+ if ( ! empty( $inputs_to_delete ) ) {
413
+ foreach ( $inputs_to_delete as $delete_id ) {
414
+ wp_delete_post( $delete_id , true );
415
+ }
416
+ }
417
+
418
+ update_post_meta( $data['form_id'], $data['form_settings_key'], $data['form_settings'] );
419
+ update_post_meta( $data['form_id'], 'notifications', $data['notifications'] );
420
+
421
+ return $saved_wpuf_inputs;
422
+ }
423
+ }
admin/form-builder/class-wpuf-form-builder-field-settings.php ADDED
@@ -0,0 +1,785 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Field settings properties
4
+ */
5
+ class WPUF_Form_Builder_Field_Settings {
6
+
7
+ /**
8
+ * All field settings
9
+ *
10
+ * @since 2.5
11
+ *
12
+ * @return array
13
+ */
14
+ public static function get_field_settings() {
15
+ return apply_filters( 'wpuf-form-builder-field-settings', array(
16
+ 'text_field' => self::text_field(),
17
+ 'textarea_field' => self::textarea_field(),
18
+ 'dropdown_field' => self::dropdown_field(),
19
+ 'multiple_select' => self::multiple_select(),
20
+ 'radio_field' => self::radio_field(),
21
+ 'checkbox_field' => self::checkbox_field(),
22
+ 'website_url' => self::website_url(),
23
+ 'email_address' => self::email_address(),
24
+ 'custom_hidden_field' => self::custom_hidden_field(),
25
+ 'image_upload' => self::image_upload(),
26
+ 'section_break' => self::section_break(),
27
+ 'custom_html' => self::custom_html()
28
+ ) );
29
+ }
30
+
31
+ /**
32
+ * Common properties for all kinds of fields
33
+ *
34
+ * @since 2.5
35
+ *
36
+ * @param boolean $is_meta
37
+ *
38
+ * @return array
39
+ */
40
+ public static function get_common_properties( $is_meta = true ) {
41
+ $common_properties = array(
42
+ array(
43
+ 'name' => 'label',
44
+ 'title' => __( 'Field Label', 'wpuf' ),
45
+ 'type' => 'text',
46
+ 'section' => 'basic',
47
+ 'priority' => 10,
48
+ 'help_text' => __( 'Enter a title of this field', 'wpuf' ),
49
+ ),
50
+
51
+ array(
52
+ 'name' => 'help',
53
+ 'title' => __( 'Help text', 'wpuf' ),
54
+ 'type' => 'text',
55
+ 'section' => 'basic',
56
+ 'priority' => 20,
57
+ 'help_text' => __( 'Give the user some information about this field', 'wpuf' ),
58
+ ),
59
+
60
+ array(
61
+ 'name' => 'required',
62
+ 'title' => __( 'Required', 'wpuf' ),
63
+ 'type' => 'radio',
64
+ 'options' => array(
65
+ 'yes' => __( 'Yes', 'wpuf' ),
66
+ 'no' => __( 'No', 'wpuf' ),
67
+ ),
68
+ 'section' => 'basic',
69
+ 'priority' => 21,
70
+ 'default' => 'no',
71
+ 'inline' => true,
72
+ 'help_text' => __( 'Check this option to mark the field required. A form will not submit unless all required fields are provided.', 'wpuf' ),
73
+ ),
74
+
75
+ array(
76
+ 'name' => 'css',
77
+ 'title' => __( 'CSS Class Name', 'wpuf' ),
78
+ 'type' => 'text',
79
+ 'section' => 'advanced',
80
+ 'priority' => 22,
81
+ 'help_text' => __( 'Provide a container class name for this field.', 'wpuf' ),
82
+ ),
83
+ );
84
+
85
+ if ( $is_meta ) {
86
+ $common_properties[] = array(
87
+ 'name' => 'name',
88
+ 'title' => __( 'Meta Key', 'wpuf' ),
89
+ 'type' => 'text-meta',
90
+ 'section' => 'basic',
91
+ 'priority' => 11,
92
+ 'help_text' => __( 'Name of the meta key this field will save to', 'wpuf' ),
93
+ );
94
+ }
95
+
96
+ return apply_filters( 'wpuf-form-builder-fields-common-properties', $common_properties );
97
+ }
98
+
99
+ /**
100
+ * Common properties of a text input field
101
+ *
102
+ * @since 2.5
103
+ *
104
+ * @return array
105
+ */
106
+ public static function get_common_text_properties( $word_restriction = false ) {
107
+ $properties = array(
108
+ array(
109
+ 'name' => 'placeholder',
110
+ 'title' => __( 'Placeholder text', 'wpuf' ),
111
+ 'type' => 'text',
112
+ 'section' => 'advanced',
113
+ 'priority' => 10,
114
+ 'help_text' => __( 'Text for HTML5 placeholder attribute', 'wpuf' ),
115
+ ),
116
+
117
+ array(
118
+ 'name' => 'default',
119
+ 'title' => __( 'Default value', 'wpuf' ),
120
+ 'type' => 'text',
121
+ 'section' => 'advanced',
122
+ 'priority' => 11,
123
+ 'help_text' => __( 'The default value this field will have', 'wpuf' ),
124
+ ),
125
+
126
+ array(
127
+ 'name' => 'size',
128
+ 'title' => __( 'Size', 'wpuf' ),
129
+ 'type' => 'text',
130
+ 'variation' => 'number',
131
+ 'section' => 'advanced',
132
+ 'priority' => 20,
133
+ 'help_text' => __( 'Size of this input field', 'wpuf' ),
134
+ ),
135
+ );
136
+
137
+ if ( $word_restriction ) {
138
+ $properties[] = array(
139
+ 'name' => 'word_restriction',
140
+ 'title' => __( 'Word Restriction', 'wpuf' ),
141
+ 'type' => 'text',
142
+ 'section' => 'advanced',
143
+ 'priority' => 15,
144
+ 'help_text' => __( 'Numebr of words the author to be restricted in', 'wpuf' ),
145
+ );
146
+ }
147
+
148
+ return apply_filters( 'wpuf-form-builder-common-text-fields-properties', $properties );
149
+ }
150
+
151
+ /**
152
+ * Common properties of a textarea field
153
+ *
154
+ * @since 2.5
155
+ *
156
+ * @return array
157
+ */
158
+ public static function get_common_textarea_properties() {
159
+ return array(
160
+ array(
161
+ 'name' => 'rows',
162
+ 'title' => __( 'Rows', 'wpuf' ),
163
+ 'type' => 'text',
164
+ 'section' => 'advanced',
165
+ 'priority' => 10,
166
+ 'help_text' => __( 'Number of rows in textarea', 'wpuf' ),
167
+ ),
168
+
169
+ array(
170
+ 'name' => 'cols',
171
+ 'title' => __( 'Columns', 'wpuf' ),
172
+ 'type' => 'text',
173
+ 'section' => 'advanced',
174
+ 'priority' => 11,
175
+ 'help_text' => __( 'Number of columns in textarea', 'wpuf' ),
176
+ ),
177
+
178
+ array(
179
+ 'name' => 'placeholder',
180
+ 'title' => __( 'Placeholder text', 'wpuf' ),
181
+ 'type' => 'text',
182
+ 'section' => 'advanced',
183
+ 'priority' => 12,
184
+ 'help_text' => __( 'Text for HTML5 placeholder attribute', 'wpuf' ),
185
+ 'dependencies' => array(
186
+ 'rich' => 'no'
187
+ )
188
+ ),
189
+
190
+ array(
191
+ 'name' => 'default',
192
+ 'title' => __( 'Default value', 'wpuf' ),
193
+ 'type' => 'text',
194
+ 'section' => 'advanced',
195
+ 'priority' => 13,
196
+ 'help_text' => __( 'The default value this field will have', 'wpuf' ),
197
+ ),
198
+
199
+ array(
200
+ 'name' => 'rich',
201
+ 'title' => __( 'Textarea', 'wpuf' ),
202
+ 'type' => 'radio',
203
+ 'options' => array(
204
+ 'no' => __( 'Normal', 'wpuf' ),
205
+ 'yes' => __( 'Rich textarea', 'wpuf' ),
206
+ 'teeny' => __( 'Teeny Rich textarea', 'wpuf' ),
207
+ ),
208
+ 'section' => 'advanced',
209
+ 'priority' => 14,
210
+ 'default' => 'no',
211
+ ),
212
+
213
+ array(
214
+ 'name' => 'word_restriction',
215
+ 'title' => __( 'Word Restriction', 'wpuf' ),
216
+ 'type' => 'text',
217
+ 'section' => 'advanced',
218
+ 'priority' => 15,
219
+ 'help_text' => __( 'Numebr of words the author to be restricted in', 'wpuf' ),
220
+ ),
221
+ );
222
+ }
223
+
224
+ /**
225
+ * wpuf_cond property for all fields
226
+ *
227
+ * @since 2.5
228
+ *
229
+ * @return array
230
+ */
231
+ public static function get_wpuf_cond_prop() {
232
+ return array(
233
+ 'condition_status' => 'no',
234
+ 'cond_field' => array(),
235
+ 'cond_operator' => array( '=' ),
236
+ 'cond_option' => array( __( '- select -', 'wpuf' ) ),
237
+ 'cond_logic' => 'all'
238
+ );
239
+ }
240
+
241
+ /**
242
+ * Text field settings
243
+ *
244
+ * @since 2.5
245
+ *
246
+ * @return array
247
+ */
248
+ public static function text_field() {
249
+ $settings = self::get_common_properties();
250
+ $settings = array_merge( $settings, self::get_common_text_properties( true ) );
251
+
252
+ return array(
253
+ 'template' => 'text_field',
254
+ 'title' => __( 'Text', 'wpuf' ),
255
+ 'icon' => 'text-width',
256
+ 'settings' => $settings,
257
+ 'field_props' => array(
258
+ 'input_type' => 'text',
259
+ 'template' => 'text_field',
260
+ 'required' => 'no',
261
+ 'label' => __( 'Text', 'wpuf' ),
262
+ 'name' => '',
263
+ 'is_meta' => 'yes',
264
+ 'help' => '',
265
+ 'css' => '',
266
+ 'placeholder' => '',
267
+ 'default' => '',
268
+ 'size' => 40,
269
+ 'word_restriction' => '',
270
+ 'id' => 0,
271
+ 'is_new' => true,
272
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
273
+ )
274
+ );
275
+ }
276
+
277
+ /**
278
+ * Textarea field settings
279
+ *
280
+ * @since 2.5
281
+ *
282
+ * @return array
283
+ */
284
+ public static function textarea_field() {
285
+ $settings = self::get_common_properties();
286
+ $settings = array_merge( $settings, self::get_common_textarea_properties() );
287
+
288
+ return array(
289
+ 'template' => 'textarea_field',
290
+ 'title' => __( 'Textarea', 'wpuf' ),
291
+ 'icon' => 'paragraph',
292
+ 'settings' => $settings,
293
+ 'field_props' => array(
294
+ 'input_type' => 'textarea',
295
+ 'template' => 'textarea_field',
296
+ 'required' => 'no',
297
+ 'label' => __( 'Textarea', 'wpuf' ),
298
+ 'name' => '',
299
+ 'is_meta' => 'yes',
300
+ 'help' => '',
301
+ 'css' => '',
302
+ 'rows' => 5,
303
+ 'cols' => 25,
304
+ 'placeholder' => '',
305
+ 'default' => '',
306
+ 'rich' => 'no',
307
+ 'word_restriction' => '',
308
+ 'id' => 0,
309
+ 'is_new' => true,
310
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
311
+ )
312
+ );
313
+ }
314
+
315
+ /**
316
+ * Option data for option based fields
317
+ *
318
+ * @since 2.5
319
+ *
320
+ * @param boolean $is_multiple
321
+ *
322
+ * @return array
323
+ */
324
+ public static function get_option_data_setting( $is_multiple = false ) {
325
+ return array(
326
+ 'name' => 'options',
327
+ 'title' => __( 'Options', 'wpuf' ),
328
+ 'type' => 'option-data',
329
+ 'is_multiple' => $is_multiple,
330
+ 'section' => 'basic',
331
+ 'priority' => 12,
332
+ 'help_text' => __( 'Add options for the form field', 'wpuf' ),
333
+ );
334
+ }
335
+
336
+ /**
337
+ * Dropdown/Select field settings
338
+ *
339
+ * @since 2.5
340
+ *
341
+ * @return array
342
+ */
343
+ public static function dropdown_field() {
344
+ $settings = self::get_common_properties();
345
+
346
+ $dropdown_settings = array(
347
+ self::get_option_data_setting(),
348
+
349
+ array(
350
+ 'name' => 'first',
351
+ 'title' => __( 'Select Text', 'wpuf' ),
352
+ 'type' => 'text',
353
+ 'section' => 'basic',
354
+ 'priority' => 13,
355
+ 'help_text' => __( "First element of the select dropdown. Leave this empty if you don't want to show this field", 'wpuf' ),
356
+ ),
357
+ );
358
+
359
+ $settings = array_merge( $settings, $dropdown_settings );
360
+
361
+ return array(
362
+ 'template' => 'dropdown_field',
363
+ 'title' => __( 'Dropdown', 'wpuf' ),
364
+ 'icon' => 'caret-square-o-down',
365
+ 'settings' => $settings,
366
+ 'field_props' => array(
367
+ 'input_type' => 'select',
368
+ 'template' => 'dropdown_field',
369
+ 'required' => 'no',
370
+ 'label' => __( 'Dropdown', 'wpuf' ),
371
+ 'name' => '',
372
+ 'is_meta' => 'yes',
373
+ 'help' => '',
374
+ 'css' => '',
375
+ 'selected' => '',
376
+ 'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
377
+ 'first' => __( '- select -', 'wpuf' ),
378
+ 'id' => 0,
379
+ 'is_new' => true,
380
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
381
+ )
382
+ );
383
+ }
384
+
385
+ /**
386
+ * Multiselect field settings
387
+ *
388
+ * @since 2.5
389
+ *
390
+ * @return array
391
+ */
392
+ public static function multiple_select() {
393
+ $settings = self::get_common_properties();
394
+
395
+ $dropdown_settings = array(
396
+ self::get_option_data_setting( true )
397
+ );
398
+
399
+ $settings = array_merge( $settings, $dropdown_settings );
400
+
401
+ return array(
402
+ 'template' => 'multiple_select',
403
+ 'title' => __( 'Multi Select', 'wpuf' ),
404
+ 'icon' => 'list-ul',
405
+ 'settings' => $settings,
406
+ 'field_props' => array(
407
+ 'input_type' => 'multiselect',
408
+ 'template' => 'multiple_select',
409
+ 'required' => 'no',
410
+ 'label' => __( 'Multi Select', 'wpuf' ),
411
+ 'name' => '',
412
+ 'is_meta' => 'yes',
413
+ 'help' => '',
414
+ 'css' => '',
415
+ 'selected' => array(),
416
+ 'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
417
+ 'first' => __( '- select -', 'wpuf' ),
418
+ 'id' => 0,
419
+ 'is_new' => true,
420
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
421
+ )
422
+ );
423
+ }
424
+
425
+ /**
426
+ * Radio field settings
427
+ *
428
+ * @since 2.5
429
+ *
430
+ * @return array
431
+ */
432
+ public static function radio_field() {
433
+ $settings = self::get_common_properties();
434
+
435
+ $dropdown_settings = array(
436
+ self::get_option_data_setting(),
437
+
438
+ array(
439
+ 'name' => 'inline',
440
+ 'title' => __( 'Show in inline list', 'wpuf' ),
441
+ 'type' => 'radio',
442
+ 'options' => array(
443
+ 'yes' => __( 'Yes', 'wpuf' ),
444
+ 'no' => __( 'No', 'wpuf' ),
445
+ ),
446
+ 'default' => 'no',
447
+ 'inline' => true,
448
+ 'section' => 'advanced',
449
+ 'priority' => 23,
450
+ 'help_text' => __( 'Show this option in an inline list', 'wpuf' ),
451
+ )
452
+ );
453
+
454
+ $settings = array_merge( $settings, $dropdown_settings );
455
+
456
+ return array(
457
+ 'template' => 'radio_field',
458
+ 'title' => __( 'Radio', 'wpuf' ),
459
+ 'icon' => 'dot-circle-o',
460
+ 'settings' => $settings,
461
+ 'field_props' => array(
462
+ 'input_type' => 'radio',
463
+ 'template' => 'radio_field',
464
+ 'required' => 'no',
465
+ 'label' => __( 'Radio Field', 'wpuf' ),
466
+ 'name' => '',
467
+ 'is_meta' => 'yes',
468
+ 'help' => '',
469
+ 'css' => '',
470
+ 'selected' => '',
471
+ 'inline' => 'no',
472
+ 'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
473
+ 'id' => 0,
474
+ 'is_new' => true,
475
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
476
+ )
477
+ );
478
+ }
479
+
480
+ /**
481
+ * Checkbox field settings
482
+ *
483
+ * @since 2.5
484
+ *
485
+ * @return array
486
+ */
487
+ public static function checkbox_field() {
488
+ $settings = self::get_common_properties();
489
+
490
+ $dropdown_settings = array(
491
+ self::get_option_data_setting( true ),
492
+
493
+ array(
494
+ 'name' => 'inline',
495
+ 'title' => __( 'Show in inline list', 'wpuf' ),
496
+ 'type' => 'radio',
497
+ 'options' => array(
498
+ 'yes' => __( 'Yes', 'wpuf' ),
499
+ 'no' => __( 'No', 'wpuf' ),
500
+ ),
501
+ 'default' => 'no',
502
+ 'inline' => true,
503
+ 'section' => 'advanced',
504
+ 'priority' => 23,
505
+ 'help_text' => __( 'Show this option in an inline list', 'wpuf' ),
506
+ )
507
+ );
508
+
509
+ $settings = array_merge( $settings, $dropdown_settings );
510
+
511
+ return array(
512
+ 'template' => 'checkbox_field',
513
+ 'title' => __( 'Checkbox', 'wpuf' ),
514
+ 'icon' => 'check-square-o',
515
+ 'settings' => $settings,
516
+ 'field_props' => array(
517
+ 'input_type' => 'checkbox',
518
+ 'template' => 'checkbox_field',
519
+ 'required' => 'no',
520
+ 'label' => __( 'Checkbox Field', 'wpuf' ),
521
+ 'name' => '',
522
+ 'is_meta' => 'yes',
523
+ 'help' => '',
524
+ 'css' => '',
525
+ 'selected' => array(),
526
+ 'inline' => 'no',
527
+ 'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
528
+ 'id' => 0,
529
+ 'is_new' => true,
530
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
531
+ )
532
+ );
533
+ }
534
+
535
+ /**
536
+ * Website URL field settings
537
+ *
538
+ * @since 2.5
539
+ *
540
+ * @return array
541
+ */
542
+ public static function website_url() {
543
+ $settings = self::get_common_properties();
544
+ $settings = array_merge( $settings, self::get_common_text_properties() );
545
+
546
+ return array(
547
+ 'template' => 'website_url',
548
+ 'title' => __( 'URL', 'wpuf' ),
549
+ 'icon' => 'link',
550
+ 'settings' => $settings,
551
+ 'field_props' => array(
552
+ 'input_type' => 'text',
553
+ 'template' => 'website_url',
554
+ 'required' => 'no',
555
+ 'label' => __( 'URL', 'wpuf' ),
556
+ 'name' => '',
557
+ 'is_meta' => 'yes',
558
+ 'help' => '',
559
+ 'css' => '',
560
+ 'placeholder' => '',
561
+ 'default' => '',
562
+ 'size' => 40,
563
+ 'id' => 0,
564
+ 'is_new' => true,
565
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
566
+ )
567
+ );
568
+ }
569
+
570
+ /**
571
+ * Email field settings
572
+ *
573
+ * @since 2.5
574
+ *
575
+ * @return array
576
+ */
577
+ public static function email_address() {
578
+ $settings = self::get_common_properties();
579
+ $settings = array_merge( $settings, self::get_common_text_properties() );
580
+
581
+ return array(
582
+ 'template' => 'email_address',
583
+ 'title' => __( 'Email Address', 'wpuf' ),
584
+ 'icon' => 'envelope-o',
585
+ 'settings' => $settings,
586
+ 'field_props' => array(
587
+ 'input_type' => 'text',
588
+ 'template' => 'email_address',
589
+ 'required' => 'no',
590
+ 'label' => __( 'Email', 'wpuf' ),
591
+ 'name' => '',
592
+ 'is_meta' => 'yes',
593
+ 'help' => '',
594
+ 'css' => '',
595
+ 'placeholder' => '',
596
+ 'default' => '',
597
+ 'size' => 40,
598
+ 'id' => 0,
599
+ 'is_new' => true,
600
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
601
+ )
602
+ );
603
+ }
604
+
605
+ /**
606
+ * Hidden field settings
607
+ *
608
+ * @since 2.5
609
+ *
610
+ * @return array
611
+ */
612
+ public static function custom_hidden_field() {
613
+ $settings = array(
614
+ array(
615
+ 'name' => 'name',
616
+ 'title' => __( 'Meta Key', 'wpuf' ),
617
+ 'type' => 'text',
618
+ 'section' => 'basic',
619
+ 'priority' => 10,
620
+ 'help_text' => __( 'Name of the meta key this field will save to', 'wpuf' ),
621
+ ),
622
+
623
+ array(
624
+ 'name' => 'meta_value',
625
+ 'title' => __( 'Meta Value', 'wpuf' ),
626
+ 'type' => 'text',
627
+ 'section' => 'basic',
628
+ 'priority' => 11,
629
+ 'help_text' => __( 'Enter the meta value', 'wpuf' ),
630
+ ),
631
+ );
632
+
633
+ return array(
634
+ 'template' => 'custom_hidden_field',
635
+ 'title' => __( 'Hidden Field', 'wpuf' ),
636
+ 'icon' => 'eye-slash',
637
+ 'settings' => $settings,
638
+ 'field_props' => array(
639
+ 'input_type' => 'hidden',
640
+ 'template' => 'custom_hidden_field',
641
+ 'label' => '',
642
+ 'name' => '',
643
+ 'meta_value' => '',
644
+ 'is_meta' => 'yes',
645
+ 'id' => 0,
646
+ 'is_new' => true,
647
+ 'wpuf_cond' => null
648
+ )
649
+ );
650
+ }
651
+
652
+ /**
653
+ * Image field settings
654
+ *
655
+ * @since 2.5
656
+ *
657
+ * @return array
658
+ */
659
+ public static function image_upload() {
660
+ $settings = self::get_common_properties();
661
+
662
+ $settings = array_merge( $settings, array(
663
+ array(
664
+ 'name' => 'max_size',
665
+ 'title' => __( 'Max. file size', 'wpuf' ),
666
+ 'type' => 'text',
667
+ 'section' => 'advanced',
668
+ 'priority' => 20,
669
+ 'help_text' => __( 'Enter maximum upload size limit in KB', 'wpuf' ),
670
+ ),
671
+
672
+ array(
673
+ 'name' => 'count',
674
+ 'title' => __( 'Max. files', 'wpuf' ),
675
+ 'type' => 'text',
676
+ 'section' => 'advanced',
677
+ 'priority' => 21,
678
+ 'help_text' => __( 'Number of images can be uploaded', 'wpuf' ),
679
+ ),
680
+ ) );
681
+
682
+ return array(
683
+ 'template' => 'image_upload',
684
+ 'title' => __( 'Image Upload', 'wpuf' ),
685
+ 'icon' => 'file-image-o',
686
+ 'settings' => $settings,
687
+ 'field_props' => array(
688
+ 'input_type' => 'image_upload',
689
+ 'template' => 'image_upload',
690
+ 'required' => 'no',
691
+ 'label' => __( 'Image Upload', 'wpuf' ),
692
+ 'name' => '',
693
+ 'is_meta' => 'yes',
694
+ 'help' => '',
695
+ 'css' => '',
696
+ 'max_size' => '1024',
697
+ 'count' => '1',
698
+ 'id' => 0,
699
+ 'is_new' => true,
700
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
701
+ )
702
+ );
703
+ }
704
+
705
+ /**
706
+ * Section break field settings
707
+ *
708
+ * @since 2.5
709
+ *
710
+ * @return array
711
+ */
712
+ public static function section_break() {
713
+ $settings = array(
714
+ array(
715
+ 'name' => 'label',
716
+ 'title' => __( 'Title', 'wpuf' ),
717
+ 'type' => 'text',
718
+ 'section' => 'basic',
719
+ 'priority' => 10,
720
+ 'help_text' => __( 'Title of the section', 'wpuf' ),
721
+ ),
722
+
723
+ array(
724
+ 'name' => 'description',
725
+ 'title' => __( 'Description', 'wpuf' ),
726
+ 'type' => 'textarea',
727
+ 'section' => 'basic',
728
+ 'priority' => 11,
729
+ 'help_text' => __( 'Some details text about the section', 'wpuf' ),
730
+ ),
731
+ );
732
+
733
+ return array(
734
+ 'template' => 'section_break',
735
+ 'title' => __( 'Section Break', 'wpuf' ),
736
+ 'is_full_width' => true,
737
+ 'settings' => $settings,
738
+ 'field_props' => array(
739
+ 'input_type' => 'section_break',
740
+ 'template' => 'section_break',
741
+ 'label' => __( 'Section Break', 'wpuf' ),
742
+ 'description' => __( 'Some description about this section', 'wpuf' ),
743
+ 'id' => 0,
744
+ 'is_new' => true,
745
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
746
+ )
747
+ );
748
+ }
749
+
750
+ /**
751
+ * HTML field settings
752
+ *
753
+ * @since 2.5
754
+ *
755
+ * @return array
756
+ */
757
+ public static function custom_html() {
758
+ $settings = array(
759
+ array(
760
+ 'name' => 'html',
761
+ 'title' => __( 'HTML Codes', 'wpuf' ),
762
+ 'type' => 'textarea',
763
+ 'section' => 'basic',
764
+ 'priority' => 11,
765
+ 'help_text' => __( 'Paste your HTML codes, WordPress shortcodes will also work here', 'wpuf' ),
766
+ ),
767
+ );
768
+
769
+ return array(
770
+ 'template' => 'custom_html',
771
+ 'title' => __( 'Custom HTML', 'wpuf' ),
772
+ 'is_full_width' => true,
773
+ 'settings' => $settings,
774
+ 'field_props' => array(
775
+ 'input_type' => 'html',
776
+ 'template' => 'custom_html',
777
+ 'label' => __( 'Custom HTML', 'wpuf' ),
778
+ 'html' => sprintf( '<p>%s</p>', __( 'Some description about this section', 'wpuf' ) ),
779
+ 'id' => 0,
780
+ 'is_new' => true,
781
+ 'wpuf_cond' => self::get_wpuf_cond_prop()
782
+ )
783
+ );
784
+ }
785
+ }
admin/form-builder/views/form-builder.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="wpuf-form-builder" class="wpuf-form-builder-<?php echo $form_type; ?>" method="post" action="" @submit.prevent="save_form_builder" v-cloak>
2
+ <fieldset :class="[is_form_saving ? 'disabled' : '']" :disabled="is_form_saving">
3
+ <h2 class="nav-tab-wrapper">
4
+ <a href="#wpuf-form-builder-container" class="nav-tab nav-tab-active">
5
+ <?php _e( 'Form Editor', 'wpuf' ); ?>
6
+ </a>
7
+
8
+ <a href="#wpuf-form-builder-settings" class="nav-tab">
9
+ <?php _e( 'Settings', 'wpuf' ); ?>
10
+ </a>
11
+
12
+ <?php do_action( "wpuf-form-builder-tabs-{$form_type}" ); ?>
13
+
14
+ <span class="pull-right">
15
+ <button v-if="!is_form_saving" type="button" class="button button-primary" @click="save_form_builder">
16
+ <?php _e( 'Save Form', 'wpuf' ); ?>
17
+ </button>
18
+
19
+ <button v-else type="button" class="button button-primary button-ajax-working" disabled>
20
+ <span class="loader"></span> <?php _e( 'Saving Form Data', 'wpuf' ); ?>
21
+ </button>
22
+ </span>
23
+ </h2>
24
+
25
+ <div class="tab-contents">
26
+ <div id="wpuf-form-builder-container" class="group active">
27
+ <div id="builder-stage">
28
+ <header class="clearfix">
29
+ <span v-if="!post_title_editing" class="form-title" @click.prevent="post_title_editing = true">{{ post.post_title }}</span>
30
+
31
+ <span v-show="post_title_editing">
32
+ <input type="text" v-model="post.post_title" name="post_title" />
33
+ <button type="button" class="button button-small" style="margin-top: 13px;" @click.prevent="post_title_editing = false"><i class="fa fa-check"></i></button>
34
+ </span>
35
+
36
+ <i :class="(is_form_switcher ? 'fa fa-angle-up' : 'fa fa-angle-down') + ' form-switcher-arrow'" @click.prevent="switch_form"></i>
37
+ <?php
38
+ $form_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
39
+
40
+ if ( count( $shortcodes ) > 1 && isset( $shortcodes[0]['type'] ) ) {
41
+ foreach ( $shortcodes as $shortcode ) {
42
+ printf( "<span class=\"form-id\" title=\"%s\" data-clipboard-text='%s'><i class=\"fa fa-clipboard\" aria-hidden=\"true\"></i> %s: #{{ post.ID }}</span>", sprintf( __( 'Click to copy %s shortcode', 'wpuf' ), $shortcode['type'] ), sprintf( '[%s type="%s" id="%s"]', $shortcode['name'], $shortcode['type'], $form_id ), ucwords( $shortcode['type'] ), $shortcode['type'] );
43
+ }
44
+ } else {
45
+ printf( "<span class=\"form-id\" title=\"%s\" data-clipboard-text='%s'><i class=\"fa fa-clipboard\" aria-hidden=\"true\"></i> #{{ post.ID }}</span>", __( 'Click to copy shortcode', 'wpuf' ), '[' . $shortcodes[0]['name'] . ' id="' . $form_id . '"]' );
46
+ }
47
+ ?>
48
+ </header>
49
+
50
+ <ul v-if="is_form_switcher" class="form-switcher-content">
51
+ <?php
52
+ foreach ( $forms as $form ) {
53
+ ?>
54
+ <li><a class="<?php echo ( $form->ID == $_GET['id'] ) ? 'active' : ''; ?>" href="<?php echo admin_url( 'admin.php?page=wpuf-' . $form_type . '-forms&action=edit&id=' . $form->ID ); ?>"><?php echo $form->post_title; ?></a></li>
55
+ <?php
56
+ }
57
+ ?>
58
+ </ul>
59
+
60
+ <section>
61
+ <div id="form-preview">
62
+ <builder-stage></builder-stage>
63
+ </div>
64
+ </section>
65
+ </div><!-- #builder-stage -->
66
+
67
+ <div id="builder-form-fields">
68
+ <header>
69
+ <ul class="clearfix">
70
+ <li :class="['form-fields' === current_panel ? 'active' : '']">
71
+ <a href="#add-fields" @click.prevent="set_current_panel('form-fields')">
72
+ <?php _e( 'Add Fields', 'wpuf' ); ?>
73
+ </a>
74
+ </li>
75
+
76
+ <li :class="['field-options' === current_panel ? 'active' : '', !form_fields_count ? 'disabled' : '']">
77
+ <a href="#field-options" @click.prevent="set_current_panel('field-options')">
78
+ <?php _e( 'Field Options', 'wpuf' ); ?>
79
+ </a>
80
+ </li>
81
+ </ul>
82
+ </header>
83
+
84
+ <section>
85
+ <div class="wpuf-form-builder-panel">
86
+ <component :is="current_panel"></component>
87
+ </div>
88
+ </section>
89
+ </div><!-- #builder-form-fields -->
90
+ </div><!-- #wpuf-form-builder-container -->
91
+
92
+ <div id="wpuf-form-builder-settings" class="group clearfix">
93
+ <fieldset>
94
+ <h2 id="wpuf-form-builder-settings-tabs" class="nav-tab-wrapper">
95
+ <?php do_action( "wpuf-form-builder-settings-tabs-{$form_type}" ); ?>
96
+ </h2><!-- #wpuf-form-builder-settings-tabs -->
97
+
98
+ <div id="wpuf-form-builder-settings-contents" class="tab-contents">
99
+ <?php do_action( "wpuf-form-builder-settings-tab-contents-{$form_type}" ); ?>
100
+ </div><!-- #wpuf-form-builder-settings-contents -->
101
+ </fieldset>
102
+ </div><!-- #wpuf-form-builder-settings -->
103
+
104
+ <?php do_action( "wpuf-form-builder-tab-contents-{$form_type}" ); ?>
105
+ </div>
106
+
107
+ <?php if ( ! empty( $form_settings_key ) ): ?>
108
+ <input type="hidden" name="form_settings_key" value="<?php echo $form_settings_key; ?>">
109
+ <?php endif; ?>
110
+
111
+ <?php wp_nonce_field( 'wpuf_form_builder_save_form', 'wpuf_form_builder_nonce' ); ?>
112
+
113
+ <input type="hidden" name="wpuf_form_id" value="<?php echo $form_id; ?>">
114
+ </fieldset>
115
+ </form><!-- #wpuf-form-builder -->
admin/form-handler.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPUF_Admin_Form_Handler {
3
+
4
+ public function __construct() {
5
+ $user_frontend = sanitize_title( __( 'User Frontend', 'wpuf' ) );
6
+
7
+ // post forms list table
8
+ add_action( "load-{$user_frontend}_page_wpuf-post-forms", array( $this, 'post_forms_actions' ) );
9
+ add_action( "load-{$user_frontend}_page_wpuf-profile-forms", array( $this, 'profile_forms_actions' ) );
10
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
11
+ add_action( 'removable_query_args', array( $this, 'removable_query_args' ) );
12
+ }
13
+
14
+ /**
15
+ * Check current page actions
16
+ *
17
+ * @since 2.5
18
+ *
19
+ * @param integer $page_id
20
+ * @param integer $bulk_action
21
+ *
22
+ * @return boolean
23
+ */
24
+ public function verify_current_page_screen( $page_id, $bulk_action ) {
25
+
26
+ if ( ! isset( $_GET['_wpnonce'] ) || ! isset( $_GET['page'] ) ) {
27
+ return false;
28
+ }
29
+
30
+ if ( $_GET['page'] != $page_id ) {
31
+ return false;
32
+ }
33
+
34
+ if ( ! wp_verify_nonce( $_GET['_wpnonce'], $bulk_action ) ) {
35
+ return false;
36
+ }
37
+
38
+ return true;
39
+ }
40
+
41
+ /**
42
+ * Handle Post Forms list table action
43
+ *
44
+ * @since 2.5
45
+ *
46
+ * @return void
47
+ */
48
+ public function post_forms_actions() {
49
+ // Nonce validation
50
+ if ( ! $this->verify_current_page_screen( 'wpuf-post-forms', 'bulk-post-forms' ) ) {
51
+ return;
52
+ }
53
+
54
+ // Check permission if not wpuf admin then go out from here
55
+ if ( ! current_user_can( wpuf_admin_role() ) ) {
56
+ wp_die( __( 'You do not have sufficient permissions to do this action', 'wpuf' ) );
57
+ }
58
+
59
+
60
+ $post_forms = new WPUF_Admin_Post_Forms_List_Table();
61
+ $action = $post_forms->current_action();
62
+
63
+ if ( $action ) {
64
+
65
+ $remove_query_args = array(
66
+ '_wp_http_referer', '_wpnonce', 'action', 'id', 'post', 'action2',
67
+ );
68
+
69
+ $add_query_args = array();
70
+
71
+ switch ( $action ) {
72
+ case 'post_form_search':
73
+ $redirect = remove_query_arg( array( 'post_form_search' ), $redirect );
74
+
75
+ break;
76
+
77
+ case 'trash' :
78
+
79
+ if ( ! empty( $_GET['id'] ) ) {
80
+ delete_post_meta( $_GET['id'], '_wp_trash_meta_status' );
81
+ delete_post_meta( $_GET['id'], '_wp_trash_meta_time' );
82
+ delete_post_meta( $_GET['id'], '_wp_desired_post_slug' );
83
+
84
+ wp_trash_post( $_GET['id'] );
85
+
86
+ $add_query_args['trashed'] = 1;
87
+
88
+ } else if ( ! empty( $_GET['post'] ) ) {
89
+ foreach ( $_GET['post'] as $post_id ) {
90
+ delete_post_meta( $post_id, '_wp_trash_meta_status' );
91
+ delete_post_meta( $post_id, '_wp_trash_meta_time' );
92
+ delete_post_meta( $post_id, '_wp_desired_post_slug' );
93
+
94
+ wp_trash_post( $post_id );
95
+ }
96
+
97
+ $add_query_args['trashed'] = count( $_GET['post'] );
98
+ }
99
+
100
+ break;
101
+
102
+ case 'restore' :
103
+ if ( !empty( $_GET['id'] ) ) {
104
+ $trash_meta_status = get_post_meta( $_GET['id'], '_wp_trash_meta_status', true );
105
+
106
+ $args = array(
107
+ 'ID' => $_GET['id'],
108
+ 'post_status' => $trash_meta_status,
109
+ );
110
+
111
+ wp_update_post( $args );
112
+
113
+ $add_query_args['untrashed'] = 1;
114
+
115
+ } else if ( ! empty( $_GET['post'] ) ) {
116
+ foreach ( $_GET['post'] as $post_id ) {
117
+ $trash_meta_status = get_post_meta( $post_id, '_wp_trash_meta_status', true );
118
+
119
+ $args = array(
120
+ 'ID' => $post_id,
121
+ 'post_status' => $trash_meta_status,
122
+ );
123
+
124
+ wp_update_post( $args );
125
+
126
+ $add_query_args['untrashed'] = count( $_GET['post'] );
127
+ }
128
+ }
129
+
130
+ break;
131
+
132
+ case 'delete' :
133
+
134
+ if ( ! empty( $_GET['id'] ) ) {
135
+ wp_delete_post( $_GET['id'] );
136
+
137
+ $add_query_args['deleted'] = 1;
138
+
139
+ } else if ( ! empty( $_GET['post'] ) ) {
140
+ foreach ( $_GET['post'] as $post_id ) {
141
+ wp_delete_post( $post_id );
142
+ }
143
+
144
+ $add_query_args['deleted'] = count( $_GET['post'] );
145
+ }
146
+
147
+ $add_query_args['post_status'] = 'trash';
148
+
149
+ break;
150
+
151
+ case 'duplicate':
152
+ if ( ! empty( $_GET['id'] ) ) {
153
+ $add_query_args['duplicated'] = wpuf_duplicate_form( $_GET['id'] );
154
+ }
155
+
156
+ break;
157
+ }
158
+
159
+ $redirect = remove_query_arg( $remove_query_args, wp_unslash( $_SERVER['REQUEST_URI'] ) );
160
+
161
+ $redirect = add_query_arg( $add_query_args, $redirect );
162
+
163
+ wp_redirect( $redirect );
164
+ exit();
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Handle Profile Forms list table action
170
+ *
171
+ * @since 2.5
172
+ *
173
+ * @return void
174
+ */
175
+ public function profile_forms_actions() {
176
+ // Nonce validation
177
+ if ( ! $this->verify_current_page_screen( 'wpuf-profile-forms', 'bulk-profile-forms' ) ) {
178
+ return;
179
+ }
180
+
181
+ // Check permission if not wpuf admin then go out from here
182
+ if ( ! current_user_can( wpuf_admin_role() ) ) {
183
+ wp_die( __( 'You do not have sufficient permissions to do this action', 'wpuf' ) );
184
+ }
185
+
186
+
187
+ $profile_forms = new WPUF_Admin_Profile_Forms_List_Table();
188
+ $action = $profile_forms->current_action();
189
+
190
+ if ( $action ) {
191
+
192
+ $remove_query_args = array(
193
+ '_wp_http_referer', '_wpnonce', 'action', 'id', 'post', 'action2',
194
+ );
195
+
196
+ $add_query_args = array();
197
+
198
+ switch ( $action ) {
199
+ case 'profile_form_search':
200
+ $redirect = remove_query_arg( array( 'profile_form_search' ), $redirect );
201
+
202
+ break;
203
+
204
+ case 'trash' :
205
+
206
+ if ( ! empty( $_GET['id'] ) ) {
207
+ delete_post_meta( $_GET['id'], '_wp_trash_meta_status' );
208
+ delete_post_meta( $_GET['id'], '_wp_trash_meta_time' );
209
+ delete_post_meta( $_GET['id'], '_wp_desired_post_slug' );
210
+
211
+ wp_trash_post( $_GET['id'] );
212
+
213
+ $add_query_args['trashed'] = 1;
214
+
215
+ } else if ( ! empty( $_GET['post'] ) ) {
216
+ foreach ( $_GET['post'] as $post_id ) {
217
+ delete_post_meta( $post_id, '_wp_trash_meta_status' );
218
+ delete_post_meta( $post_id, '_wp_trash_meta_time' );
219
+ delete_post_meta( $post_id, '_wp_desired_post_slug' );
220
+
221
+ wp_trash_post( $post_id );
222
+ }
223
+
224
+ $add_query_args['trashed'] = count( $_GET['post'] );
225
+ }
226
+
227
+ break;
228
+
229
+ case 'restore' :
230
+ if ( !empty( $_GET['id'] ) ) {
231
+ $trash_meta_status = get_post_meta( $_GET['id'], '_wp_trash_meta_status', true );
232
+
233
+ $args = array(
234
+ 'ID' => $_GET['id'],
235
+ 'post_status' => $trash_meta_status,
236
+ );
237
+
238
+ wp_update_post( $args );
239
+
240
+ $add_query_args['untrashed'] = 1;
241
+
242
+ } else if ( ! empty( $_GET['post'] ) ) {
243
+ foreach ( $_GET['post'] as $post_id ) {
244
+ $trash_meta_status = get_post_meta( $post_id, '_wp_trash_meta_status', true );
245
+
246
+ $args = array(
247
+ 'ID' => $post_id,
248
+ 'post_status' => $trash_meta_status,
249
+ );
250
+
251
+ wp_update_post( $args );
252
+
253
+ $add_query_args['untrashed'] = count( $_GET['post'] );
254
+ }
255
+ }
256
+
257
+ break;
258
+
259
+ case 'delete' :
260
+
261
+ if ( ! empty( $_GET['id'] ) ) {
262
+ wp_delete_post( $_GET['id'] );
263
+
264
+ $add_query_args['deleted'] = 1;
265
+
266
+ } else if ( ! empty( $_GET['post'] ) ) {
267
+ foreach ( $_GET['post'] as $post_id ) {
268
+ wp_delete_post( $post_id );
269
+ }
270
+
271
+ $add_query_args['deleted'] = count( $_GET['post'] );
272
+ }
273
+
274
+ $add_query_args['post_status'] = 'trash';
275
+
276
+ break;
277
+
278
+ case 'duplicate':
279
+ if ( ! empty( $_GET['id'] ) ) {
280
+ $add_query_args['duplicated'] = wpuf_duplicate_form( $_GET['id'] );
281
+ }
282
+
283
+ break;
284
+ }
285
+
286
+ $redirect = remove_query_arg( $remove_query_args, wp_unslash( $_SERVER['REQUEST_URI'] ) );
287
+
288
+ $redirect = add_query_arg( $add_query_args, $redirect );
289
+
290
+ wp_redirect( $redirect );
291
+ exit();
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Print notices for WordPress
297
+ *
298
+ * @since 2.5
299
+ *
300
+ * @param string $text
301
+ * @param string $type
302
+ *
303
+ * @return void
304
+ */
305
+ public function display_notice( $text, $type = 'updated' ) {
306
+ printf( '<div class="%s"><p>%s</p></div>', esc_attr( $type ), $text );
307
+ }
308
+
309
+ /**
310
+ * Admin notices
311
+ *
312
+ * @since 2.5
313
+ *
314
+ * @return void
315
+ */
316
+ public function admin_notices() {
317
+ if ( !empty( $_GET['page'] ) && 'wpuf-post-forms' === $_GET['page'] ) {
318
+ if ( !empty( $_GET['trashed'] ) ) {
319
+ $notice = sprintf( _n( '%d form moved to the trash.', '%d forms moved to the trash.', $_GET['trashed'], 'wpuf' ), $_GET['trashed'] );
320
+ $this->display_notice( $notice );
321
+
322
+ } else if ( !empty( $_GET['untrashed'] ) ) {
323
+ $notice = sprintf( _n( '%d form restored from the trash.', '%d forms restored from the trash.', $_GET['untrashed'], 'wpuf' ), $_GET['untrashed'] );
324
+ $this->display_notice( $notice );
325
+
326
+ } else if ( !empty( $_GET['deleted'] ) ) {
327
+ $notice = sprintf( _n( '%d form permanently deleted.', '%d forms permanently deleted.', $_GET['deleted'], 'wpuf' ), $_GET['deleted'] );
328
+ $this->display_notice( $notice );
329
+
330
+ } else if ( !empty( $_GET['duplicated'] ) ) {
331
+ $form_url = admin_url( 'admin.php?page=wpuf-post-forms&action=edit&id=' . $_GET['duplicated'] );
332
+ $notice = sprintf( __( 'Form duplicated successfully. <a href="%s">View form.</a>', 'wpuf' ), $form_url );
333
+ $this->display_notice( $notice );
334
+ }
335
+ }
336
+
337
+ if ( !empty( $_GET['page'] ) && 'wpuf-profile-forms' === $_GET['page'] ) {
338
+ if ( !empty( $_GET['trashed'] ) ) {
339
+ $notice = sprintf( _n( '%d form moved to the trash.', '%d forms moved to the trash.', $_GET['trashed'], 'wpuf' ), $_GET['trashed'] );
340
+ $this->display_notice( $notice );
341
+
342
+ } else if ( !empty( $_GET['untrashed'] ) ) {
343
+ $notice = sprintf( _n( '%d form restored from the trash.', '%d forms restored from the trash.', $_GET['untrashed'], 'wpuf' ), $_GET['untrashed'] );
344
+ $this->display_notice( $notice );
345
+
346
+ } else if ( !empty( $_GET['deleted'] ) ) {
347
+ $notice = sprintf( _n( '%d form permanently deleted.', '%d forms permanently deleted.', $_GET['deleted'], 'wpuf' ), $_GET['deleted'] );
348
+ $this->display_notice( $notice );
349
+
350
+ } else if ( !empty( $_GET['duplicated'] ) ) {
351
+ $form_url = admin_url( 'admin.php?page=wpuf-profile-forms&action=edit&id=' . $_GET['duplicated'] );
352
+ $notice = sprintf( __( 'Form duplicated successfully. <a href="%s">View form.</a>', 'wpuf' ), $form_url );
353
+ $this->display_notice( $notice );
354
+ }
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Add custom query args to the wp removable query args
360
+ *
361
+ * @since 2.5
362
+ *
363
+ * @param array $args
364
+ *
365
+ * @return array
366
+ */
367
+ public function removable_query_args() {
368
+ $args[] = 'duplicated';
369
+
370
+ return $args;
371
+ }
372
+ }
admin/form-template.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin form template handler
5
+ *
6
+ * Create forms based on form templates
7
+ *
8
+ * @since 2.4
9
+ */
10
+ class WPUF_Admin_Form_Template {
11
+
12
+ public function __construct() {
13
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
14
+
15
+ // post form templates
16
+ add_action( 'admin_footer', array( $this, 'render_post_form_templates' ) );
17
+ add_filter( 'admin_action_wpuf_post_form_template', array( $this, 'create_post_form_from_template' ) );
18
+
19
+ // form settings
20
+ add_action( 'wpuf_form_setting', array( $this, 'post_form_settings' ), 8, 2 );
21
+
22
+ // frontend insert/update
23
+ add_action( 'wpuf_add_post_after_insert', array( $this, 'post_form_submission' ), 10, 3 );
24
+ add_action( 'wpuf_edit_post_after_update', array( $this, 'post_form_submission' ), 10, 3 );
25
+ }
26
+
27
+ /**
28
+ * Should a form displayed or sciprt enqueued?
29
+ *
30
+ * @return boolean
31
+ */
32
+ public function should_display() {
33
+ $current_screen = get_current_screen();
34
+
35
+ if ( in_array( $current_screen->id, array( 'user-frontend_page_wpuf-post-forms' ) ) ) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
41
+
42
+ public function enqueue_scripts() {
43
+ if ( ! $this->should_display() ) {
44
+ return;
45
+ }
46
+
47
+ wp_enqueue_style( 'wpuf-formbuilder', WPUF_ASSET_URI . '/css/formbuilder.css' );
48
+ }
49
+
50
+ /**
51
+ * Render the forms in the modal
52
+ *
53
+ * @return void
54
+ */
55
+ public function render_post_form_templates() {
56
+ if ( ! $this->should_display() ) {
57
+ return;
58
+ }
59
+
60
+ $registry = wpuf_get_post_form_templates();
61
+ $blank_form_url = admin_url( 'admin.php?page=wpuf-post-forms&action=add-new' );
62
+ $action_name = 'wpuf_post_form_template';
63
+ $footer_help = sprintf( __( 'List of available templates can be found <a href="%s" target="_blank">here</a>.', 'wpuf' ), 'http://docs.wedevs.com/?p=4390' );
64
+ $footer_help .= sprintf( __( 'Want a new integration? <a href="%s" target="_blank">Let us know</a>.', 'wpuf'), 'mailto:support@wedevs.com?subject=WPUF Custom Post Template Integration Request' );
65
+
66
+ if ( ! $registry ) {
67
+ return;
68
+ }
69
+
70
+ include dirname( __FILE__ ) . '/html/modal.php';
71
+ }
72
+
73
+ /**
74
+ * Get a template object by name from the registry
75
+ *
76
+ * @param string $template
77
+ *
78
+ * @return boolean|WPUF_Post_Form_Template
79
+ */
80
+ public function get_template_object( $template ) {
81
+ $registry = wpuf_get_post_form_templates();
82
+
83
+ if ( ! array_key_exists( $template, $registry ) ) {
84
+ return false;
85
+ }
86
+
87
+ $template_object = $registry[ $template ];
88
+
89
+ if ( ! is_a( $template_object, 'WPUF_Post_Form_Template') ) {
90
+ return false;
91
+ }
92
+
93
+ return $template_object;
94
+ }
95
+
96
+ /**
97
+ * Create a posting form from a post template
98
+ *
99
+ * @since 2.4
100
+ *
101
+ * @return void
102
+ */
103
+ public function create_post_form_from_template() {
104
+ check_admin_referer( 'wpuf_create_from_template' );
105
+
106
+ $template_name = isset( $_GET['template'] ) ? sanitize_text_field( $_GET['template'] ) : '';
107
+
108
+ if ( ! $template_name ) {
109
+ return;
110
+ }
111
+
112
+ $template_object = $this->get_template_object( $template_name );
113
+
114
+ if ( false === $template_object ) {
115
+ return;
116
+ }
117
+
118
+ // var_dump( $template_object ); die();
119
+ $current_user = get_current_user_id();
120
+
121
+ $form_post_data = array(
122
+ 'post_title' => $template_object->get_title(),
123
+ 'post_type' => 'wpuf_forms',
124
+ 'post_status' => 'publish',
125
+ 'post_author' => $current_user
126
+ );
127
+
128
+ $form_id = wp_insert_post( $form_post_data );
129
+
130
+ if ( is_wp_error( $form_id ) ) {
131
+ return;
132
+ }
133
+
134
+ // form has been created, lets setup
135
+ update_post_meta( $form_id, 'wpuf_form_settings', $template_object->get_form_settings() );
136
+
137
+ $form_fields = $template_object->get_form_fields();
138
+
139
+ if ( ! $form_fields ) {
140
+ return;
141
+ }
142
+
143
+ foreach ($form_fields as $menu_order => $field) {
144
+ wp_insert_post( array(
145
+ 'post_type' => 'wpuf_input',
146
+ 'post_status' => 'publish',
147
+ 'post_content' => maybe_serialize( $field ),
148
+ 'post_parent' => $form_id,
149
+ 'menu_order' => $menu_order
150
+ ) );
151
+ }
152
+
153
+ wp_redirect( admin_url( 'admin.php?page=wpuf-post-forms&action=edit&id=' . $form_id ) );
154
+ exit;
155
+ }
156
+
157
+ /**
158
+ * Add settings field to override a form template
159
+ *
160
+ * @param array $form_settings
161
+ * @param object $post
162
+ *
163
+ * @return void
164
+ */
165
+ public function post_form_settings( $form_settings, $post ) {
166
+ $registry = wpuf_get_post_form_templates();
167
+ $selected = isset( $form_settings['form_template'] ) ? $form_settings['form_template'] : '';
168
+ ?>
169
+ <tr>
170
+ <th><?php _e( 'Form Template', 'wpuf' ); ?></th>
171
+ <td>
172
+ <select name="wpuf_settings[form_template]">
173
+ <option value=""><?php echo __( '&mdash; No Template &mdash;', 'wpuf' ); ?></option>
174
+ <?php
175
+ if ( $registry ) {
176
+ foreach ($registry as $key => $template) {
177
+ printf( '<option value="%s"%s>%s</option>' . "\n", $key, selected( $selected, $key, false ), $template->get_title() );
178
+ }
179
+ }
180
+ ?>
181
+ </select>
182
+ <p class="description"><?php _e( 'If selected a form template, it will try to execute that integration options when new post created and updated.', 'wpuf' ); ?></p>
183
+ </td>
184
+ </tr>
185
+ <?php
186
+ }
187
+
188
+ /**
189
+ * Call the integration functions on form submission/update
190
+ *
191
+ * @param int $post_id
192
+ * @param int $form_id
193
+ * @param array $form_settings
194
+ *
195
+ * @return void
196
+ */
197
+ public function post_form_submission( $post_id, $form_id, $form_settings ) {
198
+ $template = isset( $form_settings['form_template'] ) ? $form_settings['form_template'] : '';
199
+
200
+ if ( !$template ) {
201
+ return;
202
+ }
203
+
204
+ $template_object = $this->get_template_object( $template );
205
+
206
+ if ( false === $template_object ) {
207
+ return;
208
+ }
209
+
210
+ $current_action = current_action();
211
+
212
+ if ( $current_action == 'wpuf_add_post_after_insert' ) {
213
+ $template_object->after_insert( $post_id, $form_id, $form_settings );
214
+ } elseif ( $current_action == 'wpuf_edit_post_after_update' ) {
215
+ $template_object->after_update( $post_id, $form_id, $form_settings );
216
+ }
217
+ }
218
+ }
admin/form.php ADDED
@@ -0,0 +1,875 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post Forms or wpuf_forms form builder class
4
+ *
5
+ * @package WP User Frontend
6
+ */
7
+
8
+ class WPUF_Admin_Form {
9
+ /**
10
+ * Form type of which we're working on
11
+ *
12
+ * @var string
13
+ */
14
+ private $form_type = 'post';
15
+
16
+ /**
17
+ * Form settings key
18
+ *
19
+ * @var string
20
+ */
21
+ private $form_settings_key = 'wpuf_form_settings';
22
+
23
+ /**
24
+ * WP post types
25
+ *
26
+ * @var string
27
+ */
28
+ private $wp_post_types = array();
29
+
30
+ /**
31
+ * Add neccessary actions and filters
32
+ *
33
+ * @return void
34
+ */
35
+ public function __construct() {
36
+ add_action( 'init', array($this, 'register_post_type') );
37
+
38
+ $user_frontend = sanitize_title( __( 'User Frontend', 'wpuf' ) );
39
+ add_action( "load-{$user_frontend}_page_wpuf-post-forms", array( $this, 'post_forms_builder_init' ) );
40
+ }
41
+
42
+ /**
43
+ * Register form post types
44
+ *
45
+ * @return void
46
+ */
47
+ public function register_post_type() {
48
+ $capability = wpuf_admin_role();
49
+
50
+ register_post_type( 'wpuf_forms', array(
51
+ 'label' => __( 'Forms', 'wpuf' ),
52
+ 'public' => false,
53
+ 'show_ui' => false,
54
+ 'show_in_menu' => false, //false,
55
+ 'capability_type' => 'post',
56
+ 'hierarchical' => false,
57
+ 'query_var' => false,
58
+ 'supports' => array('title'),
59
+ 'capabilities' => array(
60
+ 'publish_posts' => $capability,
61
+ 'edit_posts' => $capability,
62
+ 'edit_others_posts' => $capability,
63
+ 'delete_posts' => $capability,
64
+ 'delete_others_posts' => $capability,
65
+ 'read_private_posts' => $capability,
66
+ 'edit_post' => $capability,
67
+ 'delete_post' => $capability,
68
+ 'read_post' => $capability,
69
+ ),
70
+ 'labels' => array(
71
+ 'name' => __( 'Forms', 'wpuf' ),
72
+ 'singular_name' => __( 'Form', 'wpuf' ),
73
+ 'menu_name' => __( 'Forms', 'wpuf' ),
74
+ 'add_new' => __( 'Add Form', 'wpuf' ),
75
+ 'add_new_item' => __( 'Add New Form', 'wpuf' ),
76
+ 'edit' => __( 'Edit', 'wpuf' ),
77
+ 'edit_item' => __( 'Edit Form', 'wpuf' ),
78
+ 'new_item' => __( 'New Form', 'wpuf' ),
79
+ 'view' => __( 'View Form', 'wpuf' ),
80
+ 'view_item' => __( 'View Form', 'wpuf' ),
81
+ 'search_items' => __( 'Search Form', 'wpuf' ),
82
+ 'not_found' => __( 'No Form Found', 'wpuf' ),
83
+ 'not_found_in_trash' => __( 'No Form Found in Trash', 'wpuf' ),
84
+ 'parent' => __( 'Parent Form', 'wpuf' ),
85
+ ),
86
+ ) );
87
+
88
+ register_post_type( 'wpuf_profile', array(
89
+ 'label' => __( 'Registraton Forms', 'wpuf' ),
90
+ 'public' => false,
91
+ 'show_ui' => false,
92
+ 'show_in_menu' => false,
93
+ 'capability_type' => 'post',
94
+ 'hierarchical' => false,
95
+ 'query_var' => false,
96
+ 'supports' => array('title'),
97
+ 'capabilities' => array(
98
+ 'publish_posts' => $capability,
99
+ 'edit_posts' => $capability,
100
+ 'edit_others_posts' => $capability,
101
+ 'delete_posts' => $capability,
102
+ 'delete_others_posts' => $capability,
103
+ 'read_private_posts' => $capability,
104
+ 'edit_post' => $capability,
105
+ 'delete_post' => $capability,
106
+ 'read_post' => $capability,
107
+ ),
108
+ 'labels' => array(
109
+ 'name' => __( 'Forms', 'wpuf' ),
110
+ 'singular_name' => __( 'Form', 'wpuf' ),
111
+ 'menu_name' => __( 'Registration Forms', 'wpuf' ),
112
+ 'add_new' => __( 'Add Form', 'wpuf' ),
113
+ 'add_new_item' => __( 'Add New Form', 'wpuf' ),
114
+ 'edit' => __( 'Edit', 'wpuf' ),
115
+ 'edit_item' => __( 'Edit Form', 'wpuf' ),
116
+ 'new_item' => __( 'New Form', 'wpuf' ),
117
+ 'view' => __( 'View Form', 'wpuf' ),
118
+ 'view_item' => __( 'View Form', 'wpuf' ),
119
+ 'search_items' => __( 'Search Form', 'wpuf' ),
120
+ 'not_found' => __( 'No Form Found', 'wpuf' ),
121
+ 'not_found_in_trash' => __( 'No Form Found in Trash', 'wpuf' ),
122
+ 'parent' => __( 'Parent Form', 'wpuf' ),
123
+ ),
124
+ ) );
125
+
126
+ register_post_type( 'wpuf_input', array(
127
+ 'public' => false,
128
+ 'show_ui' => false,
129
+ 'show_in_menu' => false,
130
+ ) );
131
+ }
132
+
133
+ /**
134
+ * Initiate form builder for wpuf_forms post type
135
+ *
136
+ * @since 2.5
137
+ *
138
+ * @return void
139
+ */
140
+ public function post_forms_builder_init() {
141
+
142
+ if ( ! isset( $_GET['action'] ) ) {
143
+ return;
144
+ }
145
+
146
+ if ( 'add-new' === $_GET['action'] && empty( $_GET['id'] ) ) {
147
+ $form_id = wpuf_create_sample_form( 'Sample Form', 'wpuf_forms', true );
148
+ $add_new_page_url = add_query_arg( array( 'id' => $form_id ), admin_url( 'admin.php?page=wpuf-post-forms&action=edit' ) );
149
+ wp_redirect( $add_new_page_url );
150
+ }
151
+
152
+ if ( ( 'edit' === $_GET['action'] ) && ! empty( $_GET['id'] ) ) {
153
+
154
+ add_action( 'wpuf-form-builder-tabs-post', array( $this, 'add_primary_tabs' ) );
155
+ add_action( 'wpuf-form-builder-tab-contents-post', array( $this, 'add_primary_tab_contents' ) );
156
+ add_action( 'wpuf-form-builder-settings-tabs-post', array( $this, 'add_settings_tabs' ) );
157
+ add_action( 'wpuf-form-builder-settings-tab-contents-post', array( $this, 'add_settings_tab_contents' ) );
158
+ add_filter( 'wpuf-form-builder-fields-section-before', array( $this, 'add_post_field_section' ) );
159
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
160
+ add_action( 'wpuf-form-builder-js-deps', array( $this, 'js_dependencies' ) );
161
+ add_filter( 'wpuf-form-builder-js-root-mixins', array( $this, 'js_root_mixins' ) );
162
+ add_filter( 'wpuf-form-builder-js-builder-stage-mixins', array( $this, 'js_builder_stage_mixins' ) );
163
+ add_filter( 'wpuf-form-builder-js-field-options-mixins', array( $this, 'js_field_options_mixins' ) );
164
+ add_action( 'wpuf-form-builder-template-builder-stage-submit-area', array( $this, 'add_form_submit_area' ) );
165
+ add_action( 'wpuf-form-builder-localize-script', array( $this, 'add_to_localize_script' ) );
166
+ add_filter( 'wpuf-form-builder-field-settings', array( $this, 'add_field_settings' ) );
167
+ add_filter( 'wpuf-form-builder-i18n', array( $this, 'i18n' ) );
168
+
169
+ do_action( 'wpuf-form-builder-init-type-wpuf_forms' );
170
+
171
+ $this->set_wp_post_types();
172
+
173
+ $settings = array(
174
+ 'form_type' => 'post',
175
+ 'post_type' => 'wpuf_forms',
176
+ 'post_id' => $_GET['id'],
177
+ 'form_settings_key' => $this->form_settings_key,
178
+ 'shortcodes' => array( array( 'name' => 'wpuf_form' ) )
179
+ );
180
+
181
+ new WPUF_Admin_Form_Builder( $settings );
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Additional primary tabs
187
+ *
188
+ * @since 2.5
189
+ *
190
+ * @return void
191
+ */
192
+ public function add_primary_tabs() {
193
+ ?>
194
+
195
+ <a href="#wpuf-form-builder-notification" class="nav-tab">
196
+ <?php _e( 'Notification', 'wpuf' ); ?>
197
+ </a>
198
+
199
+ <?php
200
+ }
201
+
202
+ /**
203
+ * Add primary tab contents
204
+ *
205
+ * @since 2.5
206
+ *
207
+ * @return void
208
+ */
209
+ public function add_primary_tab_contents() {
210
+ ?>
211
+
212
+ <div id="wpuf-form-builder-notification" class="group">
213
+ <?php do_action('wpuf_form_settings_post_notification'); ?>
214
+ </div><!-- #wpuf-form-builder-notification -->
215
+
216
+ <?php
217
+ }
218
+
219
+ /**
220
+ * Add settings tabs
221
+ *
222
+ * @since 2.5
223
+ *
224
+ * @return void
225
+ */
226
+ public function add_settings_tabs() {
227
+ ?>
228
+
229
+ <a href="#wpuf-metabox-settings" class="nav-tab"><?php _e( 'Post Settings', 'wpuf' ); ?></a>
230
+ <a href="#wpuf-metabox-settings-update" class="nav-tab"><?php _e( 'Edit Settings', 'wpuf' ); ?></a>
231
+ <a href="#wpuf-metabox-post_expiration" class="nav-tab"><?php _e( 'Post Expiration', 'wpuf' ); ?></a>
232
+
233
+ <?php
234
+ }
235
+
236
+ /**
237
+ * Add settings tabs
238
+ *
239
+ * @since 2.5
240
+ *
241
+ * @return void
242
+ */
243
+ public function add_settings_tab_contents() {
244
+ ?>
245
+
246
+ <div id="wpuf-metabox-settings" class="group">
247
+ <?php include_once dirname( __FILE__ ) . '/html/form-settings-post.php'; ?>
248
+ </div>
249
+
250
+ <div id="wpuf-metabox-settings-update" class="group">
251
+ <?php include_once dirname( __FILE__ ) . '/html/form-settings-post-edit.php'; ?>
252
+ </div>
253
+
254
+ <div id="wpuf-metabox-post_expiration" class="group wpuf-metabox-post_expiration">
255
+ <?php $this->form_post_expiration(); ?>
256
+ </div>
257
+
258
+ <?php do_action( 'wpuf_post_form_tab_content' ); ?>
259
+
260
+ <?php
261
+ }
262
+
263
+ /**
264
+ * Subscription dropdown
265
+ *
266
+ * @since 2.5
267
+ *
268
+ * @param string $selected
269
+ *
270
+ * @return void
271
+ */
272
+ public function subscription_dropdown( $selected = null ) {
273
+ $subscriptions = WPUF_Subscription::init()->get_subscriptions();
274
+
275
+ if ( ! $subscriptions ) {
276
+ printf( '<option>%s</option>', __( '- Select -' ), 'wpuf' );
277
+ return;
278
+ }
279
+
280
+ printf( '<option>%s</option>', __( '- Select -', 'wpuf' ) );
281
+
282
+ foreach ( $subscriptions as $key => $subscription ) {
283
+ ?>
284
+ <option value="<?php echo esc_attr( $subscription->ID ); ?>" <?php selected( $selected, $subscription->ID ); ?> ><?php echo $subscription->post_title; ?></option>
285
+ <?php
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Settings for post expiration
291
+ *
292
+ * @since 2.2.7
293
+ *
294
+ * @global $post
295
+ */
296
+ public function form_post_expiration(){
297
+ do_action('wpuf_form_post_expiration');
298
+ }
299
+
300
+ /**
301
+ * Add post fields in form builder
302
+ *
303
+ * @since 2.5
304
+ *
305
+ * @return array
306
+ */
307
+ public function add_post_field_section() {
308
+ $post_fields = apply_filters( 'wpuf-form-builder-wp_forms-fields-section-post-fields', array(
309
+ 'post_title', 'post_content', 'post_excerpt', 'featured_image'
310
+ ) );
311
+
312
+ return array(
313
+ array(
314
+ 'title' => __( 'Post Fields', 'wpuf' ),
315
+ 'id' => 'post-fields',
316
+ 'fields' => $post_fields
317
+ ),
318
+
319
+ array(
320
+ 'title' => __( 'Taxonomies', 'wpuf' ),
321
+ 'id' => 'taxonomies',
322
+ 'fields' => array()
323
+ )
324
+ );
325
+ }
326
+
327
+ /**
328
+ * Admin script form wpuf_forms form builder
329
+ *
330
+ * @since 2.5
331
+ *
332
+ * @return void
333
+ */
334
+ public function admin_enqueue_scripts() {
335
+ wp_register_script(
336
+ 'wpuf-form-builder-wpuf-forms',
337
+ WPUF_ASSET_URI . '/js/wpuf-form-builder-wpuf-forms.js',
338
+ array( 'jquery', 'underscore', 'wpuf-vue', 'wpuf-vuex' ),
339
+ WPUF_VERSION,
340
+ true
341
+ );
342
+ }
343
+
344
+ /**
345
+ * Add dependencies to form builder script
346
+ *
347
+ * @since 2.5
348
+ *
349
+ * @param array $deps
350
+ *
351
+ * @return array
352
+ */
353
+ public function js_dependencies( $deps ) {
354
+ array_push( $deps, 'wpuf-form-builder-wpuf-forms' );
355
+
356
+ return $deps;
357
+ }
358
+
359
+ /**
360
+ * Add mixins to root instance
361
+ *
362
+ * @since 2.5
363
+ *
364
+ * @param array $mixins
365
+ *
366
+ * @return array
367
+ */
368
+ public function js_root_mixins( $mixins ) {
369
+ array_push( $mixins , 'wpuf_forms_mixin_root' );
370
+
371
+ return $mixins;
372
+ }
373
+
374
+ /**
375
+ * Add mixins to form builder builder stage component
376
+ *
377
+ * @since 2.5
378
+ *
379
+ * @param array $mixins
380
+ *
381
+ * @return array
382
+ */
383
+ public function js_builder_stage_mixins( $mixins ) {
384
+ array_push( $mixins , 'wpuf_forms_mixin_builder_stage' );
385
+
386
+ return $mixins;
387
+ }
388
+
389
+ /**
390
+ * Add mixins to form builder field options component
391
+ *
392
+ * @since 2.5
393
+ *
394
+ * @param array $mixins
395
+ *
396
+ * @return array
397
+ */
398
+ public function js_field_options_mixins( $mixins ) {
399
+ array_push( $mixins , 'wpuf_forms_mixin_field_options' );
400
+
401
+ return $mixins;
402
+ }
403
+
404
+ /**
405
+ * Add buttons in form submit area
406
+ *
407
+ * @since 2.5
408
+ *
409
+ * @return void
410
+ */
411
+ public function add_form_submit_area() {
412
+ ?>
413
+ <input @click.prevent="" type="submit" name="submit" :value="post_form_settings.submit_text">
414
+
415
+ <a
416
+ v-if="post_form_settings.draft_post"
417
+ @click.prevent=""
418
+ href="#"
419
+ class="btn"
420
+ id="wpuf-post-draft"
421
+ >
422
+ <?php _e( 'Save Draft', 'wpuf' ); ?>
423
+ </a>
424
+ <?php
425
+ }
426
+
427
+ /**
428
+ * Populate available wp post types
429
+ *
430
+ * @since 2.5
431
+ *
432
+ * @return void
433
+ */
434
+ public function set_wp_post_types() {
435
+ $args = array( '_builtin' => true );
436
+
437
+ $wpuf_post_types = wpuf_get_post_types( $args );
438
+
439
+ $ignore_taxonomies = apply_filters( 'wpuf-ignore-taxonomies', array(
440
+ 'post_format'
441
+ ) );
442
+
443
+ foreach ( $wpuf_post_types as $post_type ) {
444
+ $this->wp_post_types[ $post_type ] = array();
445
+
446
+ $taxonomies = get_object_taxonomies( $post_type, 'object' );
447
+
448
+ foreach ( $taxonomies as $tax_name => $taxonomy ) {
449
+ if ( ! in_array( $tax_name, $ignore_taxonomies ) ) {
450
+ $this->wp_post_types[ $post_type ][ $tax_name ] = array(
451
+ 'title' => $taxonomy->label,
452
+ 'hierarchical' => $taxonomy->hierarchical
453
+ );
454
+
455
+ $this->wp_post_types[ $post_type ][ $tax_name ]['terms'] = get_terms( array(
456
+ 'taxonomy' => $tax_name,
457
+ 'hide_empty' => false
458
+ ) );
459
+ }
460
+ }
461
+ }
462
+ }
463
+
464
+ /**
465
+ * Add data to localize_script
466
+ *
467
+ * @since 2.5
468
+ *
469
+ * @param array $data
470
+ *
471
+ * @return array
472
+ */
473
+ public function add_to_localize_script( $data ) {
474
+ return array_merge( $data, array(
475
+ 'wp_post_types' => $this->wp_post_types
476
+ ) );
477
+ }
478
+
479
+ /**
480
+ * Add field settings
481
+ *
482
+ * @since 2.5
483
+ *
484
+ * @param array $field_settings
485
+ *
486
+ * @return array
487
+ */
488
+ public function add_field_settings( $field_settings ) {
489
+ $field_settings = array_merge( $field_settings, array(
490
+ 'post_title' => self::post_title(),
491
+ 'post_content' => self::post_content(),
492
+ 'post_excerpt' => self::post_excerpt(),
493
+ 'featured_image' => self::featured_image()
494
+ ) );
495
+
496
+ $taxonomy_templates = array();
497
+
498
+ foreach ( $this->wp_post_types as $post_type => $taxonomies ) {
499
+
500
+ if ( ! empty( $taxonomies ) ) {
501
+
502
+ foreach ( $taxonomies as $tax_name => $taxonomy ) {
503
+ if ( 'post_tag' === $tax_name ) {
504
+ $taxonomy_templates['post_tag'] = self::post_tags();
505
+ } else {
506
+ $taxonomy_templates[ $tax_name ] = self::taxonomy_template( $tax_name, $taxonomy );
507
+ }
508
+ }
509
+
510
+ }
511
+
512
+ }
513
+
514
+ $field_settings = array_merge( $field_settings, $taxonomy_templates );
515
+
516
+ return $field_settings;
517
+ }
518
+
519
+ /**
520
+ * Post Title field settings
521
+ *
522
+ * @since 2.5
523
+ *
524
+ * @return array
525
+ */
526
+ public static function post_title() {
527
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
528
+ $settings = array_merge( $settings, WPUF_Form_Builder_Field_Settings::get_common_text_properties( true ) );
529
+
530
+ return array(
531
+ 'template' => 'post_title',
532
+ 'title' => __( 'Post Title', 'wpuf' ),
533
+ 'icon' => 'header',
534
+ 'settings' => $settings,
535
+ 'field_props' => array(
536
+ 'input_type' => 'text',
537
+ 'template' => 'post_title',
538
+ 'required' => 'no',
539
+ 'label' => __( 'Post Title', 'wpuf' ),
540
+ 'name' => 'post_title',
541
+ 'is_meta' => 'no',
542
+ 'help' => '',
543
+ 'css' => '',
544
+ 'placeholder' => '',
545
+ 'default' => '',
546
+ 'size' => 40,
547
+ 'word_restriction' => '',
548
+ 'id' => 0,
549
+ 'is_new' => true,
550
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
551
+ )
552
+ );
553
+ }
554
+
555
+ /**
556
+ * Post Content field settings
557
+ *
558
+ * @since 2.5
559
+ *
560
+ * @return array
561
+ */
562
+ public static function post_content() {
563
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
564
+ $settings = array_merge( $settings, WPUF_Form_Builder_Field_Settings::get_common_textarea_properties() );
565
+
566
+ $settings = array_merge( $settings, array(
567
+ array(
568
+ 'name' => 'insert_image',
569
+ 'title' => __( 'Enable Image Insertion', 'wpuf-pro' ),
570
+ 'type' => 'checkbox',
571
+ 'options' => array( 'yes' => __( 'Enable image upload in post area', 'wpuf-pro' ) ),
572
+ 'is_single_opt' => true,
573
+ 'section' => 'advanced',
574
+ 'priority' => 14,
575
+ ),
576
+ ) );
577
+
578
+ return array(
579
+ 'template' => 'post_content',
580
+ 'title' => __( 'Post Body', 'wpuf' ),
581
+ 'icon' => 'file-text',
582
+ 'settings' => $settings,
583
+ 'field_props' => array(
584
+ 'input_type' => 'textarea',
585
+ 'template' => 'post_content',
586
+ 'required' => 'no',
587
+ 'label' => __( 'Post Body', 'wpuf' ),
588
+ 'name' => 'post_content',
589
+ 'is_meta' => 'no',
590
+ 'help' => '',
591
+ 'css' => '',
592
+ 'rows' => 5,
593
+ 'cols' => 25,
594
+ 'placeholder' => '',
595
+ 'default' => '',
596
+ 'rich' => 'yes',
597
+ 'word_restriction' => '',
598
+ 'id' => 0,
599
+ 'is_new' => true,
600
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
601
+ )
602
+ );
603
+ }
604
+
605
+ /**
606
+ * Post Excerpt field settings
607
+ *
608
+ * @since 2.5
609
+ *
610
+ * @return array
611
+ */
612
+ public static function post_excerpt() {
613
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
614
+ $settings = array_merge( $settings, WPUF_Form_Builder_Field_Settings::get_common_textarea_properties() );
615
+
616
+ $index = array_search( 'rich', array_column( $settings, 'name' ) );
617
+ if ( ! empty( $index ) ) {
618
+ unset( $settings[ $index ] );
619
+ }
620
+
621
+
622
+ return array(
623
+ 'template' => 'post_excerpt',
624
+ 'title' => __( 'Excerpt', 'wpuf' ),
625
+ 'icon' => 'compress',
626
+ 'settings' => $settings,
627
+ 'field_props' => array(
628
+ 'input_type' => 'textarea',
629
+ 'template' => 'post_excerpt',
630
+ 'required' => 'no',
631
+ 'label' => __( 'Excerpt', 'wpuf' ),
632
+ 'name' => 'post_excerpt',
633
+ 'is_meta' => 'no',
634
+ 'help' => '',
635
+ 'css' => '',
636
+ 'rows' => 5,
637
+ 'cols' => 25,
638
+ 'placeholder' => '',
639
+ 'default' => '',
640
+ 'rich' => 'no',
641
+ 'word_restriction' => '',
642
+ 'id' => 0,
643
+ 'is_new' => true,
644
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
645
+ )
646
+ );
647
+ }
648
+
649
+ /**
650
+ * Featured Image
651
+ *
652
+ * @since 2.5
653
+ *
654
+ * @return array
655
+ */
656
+ public static function featured_image() {
657
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
658
+
659
+ $settings = array_merge( $settings, array(
660
+ array(
661
+ 'name' => 'max_size',
662
+ 'title' => __( 'Max. file size', 'wpuf' ),
663
+ 'type' => 'text',
664
+ 'section' => 'advanced',
665
+ 'priority' => 20,
666
+ 'help_text' => __( 'Enter maximum upload size limit in KB', 'wpuf' ),
667
+ )
668
+ ) );
669
+
670
+ return array(
671
+ 'template' => 'featured_image',
672
+ 'title' => __( 'Featured Image', 'wpuf' ),
673
+ 'icon' => 'picture-o',
674
+ 'settings' => $settings,
675
+ 'field_props' => array(
676
+ 'input_type' => 'image_upload',
677
+ 'template' => 'featured_image',
678
+ 'required' => 'no',
679
+ 'label' => __( 'Featured Image', 'wpuf' ),
680
+ 'name' => 'featured_image',
681
+ 'is_meta' => 'no',
682
+ 'help' => '',
683
+ 'css' => '',
684
+ 'max_size' => '1024',
685
+ 'count' => '1',
686
+ 'id' => 0,
687
+ 'is_new' => true,
688
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
689
+ )
690
+ );
691
+ }
692
+
693
+ /**
694
+ * Post Tag
695
+ *
696
+ * @since 2.5
697
+ *
698
+ * @return array
699
+ */
700
+ public static function post_tags() {
701
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
702
+ $settings = array_merge( $settings, WPUF_Form_Builder_Field_Settings::get_common_text_properties() );
703
+
704
+ return array(
705
+ 'template' => 'post_tags',
706
+ 'title' => __( 'Tags', 'wpuf' ),
707
+ 'settings' => $settings,
708
+ 'field_props' => array(
709
+ 'input_type' => 'text',
710
+ 'template' => 'post_tags',
711
+ 'required' => 'no',
712
+ 'label' => __( 'Tags', 'wpuf' ),
713
+ 'name' => 'tags',
714
+ 'is_meta' => 'no',
715
+ 'help' => '',
716
+ 'css' => '',
717
+ 'placeholder' => '',
718
+ 'default' => '',
719
+ 'size' => 40,
720
+ 'id' => 0,
721
+ 'is_new' => true,
722
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
723
+ )
724
+ );
725
+ }
726
+
727
+ /**
728
+ * Common settings for taxonomy fields
729
+ *
730
+ * @since 2.5
731
+ *
732
+ * @return array
733
+ */
734
+ public static function taxonomy_template( $tax_name, $taxonomy ) {
735
+ $settings = WPUF_Form_Builder_Field_Settings::get_common_properties( false );
736
+
737
+ $settings = array_merge( $settings, array(
738
+ array(
739
+ 'name' => 'type',
740
+ 'title' => __( 'Type', 'wpuf' ),
741
+ 'type' => 'select',
742
+ 'options' => array(
743
+ 'select' => __( 'Select', 'wpuf' ),
744
+ 'multiselect' => __( 'Multi Select', 'wpuf' ),
745
+ 'checkbox' => __( 'Checkbox', 'wpuf' ),
746
+ 'text' => __( 'Text Input', 'wpuf' ),
747
+ 'ajax' => __( 'Ajax', 'wpuf' ),
748
+ ),
749
+ 'section' => 'advanced',
750
+ 'priority' => 23,
751
+ 'default' => 'select',
752
+ ),
753
+
754
+ array(
755
+ 'name' => 'orderby',
756
+ 'title' => __( 'Order By', 'wpuf' ),
757
+ 'type' => 'select',
758
+ 'options' => array(
759
+ 'name' => __( 'Name', 'wpuf' ),
760
+ 'term_id' => __( 'Term ID', 'wpuf' ), // NOTE: before 2.5 the key was 'id' not 'term_id'
761
+ 'slug' => __( 'Slug', 'wpuf' ),
762
+ 'count' => __( 'Count', 'wpuf' ),
763
+ 'term_group' => __( 'Term Group', 'wpuf' ),
764
+ ),
765
+ 'section' => 'advanced',
766
+ 'priority' => 24,
767
+ 'default' => 'name',
768
+ ),
769
+
770
+ array(
771
+ 'name' => 'order',
772
+ 'title' => __( 'Order', 'wpuf' ),
773
+ 'type' => 'radio',
774
+ 'inline' => true,
775
+ 'options' => array(
776
+ 'ASC' => __( 'ASC', 'wpuf' ),
777
+ 'DESC' => __( 'DESC', 'wpuf' ),
778
+ ),
779
+ 'section' => 'advanced',
780
+ 'priority' => 25,
781
+ 'default' => 'ASC',
782
+ ),
783
+
784
+ array(
785
+ 'name' => 'exclude_type',
786
+ 'title' => __( 'Selection Type', 'wpuf' ),
787
+ 'type' => 'select',
788
+ 'options' => array(
789
+ 'exclude' => __( 'Exclude', 'wpuf' ),
790
+ 'include' => __( 'Include', 'wpuf' ),
791
+ 'child_of' => __( 'Child of', 'wpuf' ),
792
+ ),
793
+ 'section' => 'advanced',
794
+ 'priority' => 26,
795
+ 'default' => '',
796
+ ),
797
+
798
+ array(
799
+ 'name' => 'exclude',
800
+ 'title' => __( 'Selection Terms', 'wpuf' ),
801
+ 'type' => 'text',
802
+ 'section' => 'advanced',
803
+ 'priority' => 27,
804
+ 'help_text' => __( 'Enter the term IDs as comma separated (without space) to exclude/include in the form.', 'wpuf' ),
805
+ ),
806
+
807
+ array(
808
+ 'name' => 'woo_attr',
809
+ 'type' => 'checkbox',
810
+ 'is_single_opt' => true,
811
+ 'options' => array(
812
+ 'yes' => __( 'This taxonomy is a WooCommerce attribute', 'wpuf' )
813
+ ),
814
+ 'section' => 'advanced',
815
+ 'priority' => 28,
816
+ ),
817
+
818
+ array(
819
+ 'name' => 'woo_attr_vis',
820
+ 'type' => 'checkbox',
821
+ 'is_single_opt' => true,
822
+ 'options' => array(
823
+ 'yes' => __( 'Visible on product page', 'wpuf' )
824
+ ),
825
+ 'section' => 'advanced',
826
+ 'priority' => 29,
827
+ 'dependencies' => array(
828
+ 'woo_attr' => 'yes'
829
+ )
830
+ ),
831
+ ) );
832
+
833
+ return array(
834
+ 'template' => 'taxonomy',
835
+ 'title' => $taxonomy['title'],
836
+ 'settings' => $settings,
837
+ 'field_props' => array(
838
+ 'input_type' => 'taxonomy',
839
+ 'template' => 'taxonomy',
840
+ 'required' => 'no',
841
+ 'label' => $taxonomy['title'],
842
+ 'name' => $tax_name,
843
+ 'is_meta' => 'no',
844
+ 'help' => '',
845
+ 'css' => '',
846
+ 'type' => 'select',
847
+ 'orderby' => 'name',
848
+ 'order' => 'ASC',
849
+ 'exclude_type' => '',
850
+ 'exclude' => '',
851
+ 'woo_attr' => '',
852
+ 'woo_attr_vis' => '',
853
+ 'id' => 0,
854
+ 'is_new' => true,
855
+ 'wpuf_cond' => WPUF_Form_Builder_Field_Settings::get_wpuf_cond_prop()
856
+ )
857
+ );
858
+ }
859
+
860
+ /**
861
+ * i18n strings specially for Post Forms
862
+ *
863
+ * @since 2.5
864
+ *
865
+ * @param array $i18n
866
+ *
867
+ * @return array
868
+ */
869
+ public function i18n( $i18n ) {
870
+ return array_merge( $i18n, array(
871
+ 'any_of_three_needed' => __( 'Post Forms must have either Post Title, Post Body or Excerpt field', 'wpuf' )
872
+ ) );
873
+ }
874
+
875
+ }
admin/html/form-settings-post-edit.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $post;
3
+
4
+ $form_settings = wpuf_get_form_settings( $post->ID );
5
+
6
+ $post_status_selected = isset( $form_settings['edit_post_status'] ) ? $form_settings['edit_post_status'] : 'publish';
7
+ $redirect_to = isset( $form_settings['edit_redirect_to'] ) ? $form_settings['edit_redirect_to'] : 'same';
8
+ $update_message = isset( $form_settings['update_message'] ) ? $form_settings['update_message'] : __( 'Post updated successfully', 'wpuf' );
9
+ $page_id = isset( $form_settings['edit_page_id'] ) ? $form_settings['edit_page_id'] : 0;
10
+ $url = isset( $form_settings['edit_url'] ) ? $form_settings['edit_url'] : '';
11
+ $update_text = isset( $form_settings['update_text'] ) ? $form_settings['update_text'] : __( 'Update', 'wpuf' );
12
+ $subscription = isset( $form_settings['subscription'] ) ? $form_settings['subscription'] : null;
13
+ ?>
14
+ <table class="form-table">
15
+
16
+ <tr class="wpuf-post-status">
17
+ <th><?php _e( 'Set Post Status to', 'wpuf' ); ?></th>
18
+ <td>
19
+ <select name="wpuf_settings[edit_post_status]">
20
+ <?php
21
+ $statuses = get_post_statuses();
22
+
23
+ foreach ($statuses as $status => $label) {
24
+ printf('<option value="%s"%s>%s</option>', $status, selected( $post_status_selected, $status, false ), $label );
25
+ }
26
+
27
+ printf( '<option value="_nochange"%s>%s</option>', selected( $post_status_selected, '_nochange', false ), __( 'No Change', 'wpuf' ) );
28
+ ?>
29
+ </select>
30
+ </td>
31
+ </tr>
32
+
33
+ <tr class="wpuf-redirect-to">
34
+ <th><?php _e( 'Redirect To', 'wpuf' ); ?></th>
35
+ <td>
36
+ <select name="wpuf_settings[edit_redirect_to]">
37
+ <?php
38
+ $redirect_options = array(
39
+ 'post' => __( 'Newly created post', 'wpuf' ),
40
+ 'same' => __( 'Same Page', 'wpuf' ),
41
+ 'page' => __( 'To a page', 'wpuf' ),
42
+ 'url' => __( 'To a custom URL', 'wpuf' )
43
+ );
44
+
45
+ foreach ($redirect_options as $to => $label) {
46
+ printf('<option value="%s"%s>%s</option>', $to, selected( $redirect_to, $to, false ), $label );
47
+ }
48
+ ?>
49
+ </select>
50
+ <p class="description">
51
+ <?php _e( 'After successfull submit, where the page will redirect to', $domain = 'default' ) ?>
52
+ </p>
53
+ </td>
54
+ </tr>
55
+
56
+ <tr class="wpuf-same-page">
57
+ <th><?php _e( 'Post Update Message', 'wpuf' ); ?></th>
58
+ <td>
59
+ <textarea rows="3" cols="40" name="wpuf_settings[update_message]"><?php echo esc_textarea( $update_message ); ?></textarea>
60
+ </td>
61
+ </tr>
62
+
63
+ <tr class="wpuf-page-id">
64
+ <th><?php _e( 'Page', 'wpuf' ); ?></th>
65
+ <td>
66
+ <select name="wpuf_settings[edit_page_id]">
67
+ <?php
68
+ $pages = get_posts( array( 'numberposts' => -1, 'post_type' => 'page') );
69
+
70
+ foreach ($pages as $page) {
71
+ printf('<option value="%s"%s>%s</option>', $page->ID, selected( $page_id, $page->ID, false ), esc_attr( $page->post_title ) );
72
+ }
73
+ ?>
74
+ </select>
75
+ </td>
76
+ </tr>
77
+
78
+ <tr class="wpuf-url">
79
+ <th><?php _e( 'Custom URL', 'wpuf' ); ?></th>
80
+ <td>
81
+ <input type="url" name="wpuf_settings[edit_url]" value="<?php echo esc_attr( $url ); ?>">
82
+ </td>
83
+ </tr>
84
+
85
+ <tr class="wpuf-subscription-pack" style="display: none;">
86
+ <th><?php _e( 'Subscription Title'); ?></th>
87
+ <td>
88
+ <select id="wpuf-subscription-list" name="wpuf_settings[subscription]">
89
+ <?php $this->subscription_dropdown( $subscription ); ?>
90
+ </select>
91
+ </td>
92
+ </tr>
93
+
94
+ <tr class="wpuf-update-text">
95
+ <th><?php _e( 'Update Post Button text', 'wpuf' ); ?></th>
96
+ <td>
97
+ <input type="text" name="wpuf_settings[update_text]" value="<?php echo esc_attr( $update_text ); ?>">
98
+ </td>
99
+ </tr>
100
+ </table>
admin/html/form-settings-post.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $post;
3
+
4
+ $form_settings = wpuf_get_form_settings( $post->ID );
5
+
6
+ $post_status_selected = isset( $form_settings['post_status'] ) ? $form_settings['post_status'] : 'publish';
7
+ $restrict_message = __( "This page is restricted. Please Log in / Register to view this page.", 'wpuf' );
8
+
9
+ $post_type_selected = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
10
+
11
+ $post_format_selected = isset( $form_settings['post_format'] ) ? $form_settings['post_format'] : 0;
12
+ $default_cat = isset( $form_settings['default_cat'] ) ? $form_settings['default_cat'] : -1;
13
+
14
+ $guest_post = isset( $form_settings['guest_post'] ) ? $form_settings['guest_post'] : 'false';
15
+ $guest_details = isset( $form_settings['guest_details'] ) ? $form_settings['guest_details'] : 'true';
16
+ $name_label = isset( $form_settings['name_label'] ) ? $form_settings['name_label'] : __( 'Name' );
17
+ $email_label = isset( $form_settings['email_label'] ) ? $form_settings['email_label'] : __( 'Email' );
18
+ $message_restrict = isset( $form_settings['message_restrict'] ) ? $form_settings['message_restrict'] : $restrict_message;
19
+
20
+ $redirect_to = isset( $form_settings['redirect_to'] ) ? $form_settings['redirect_to'] : 'post';
21
+ $message = isset( $form_settings['message'] ) ? $form_settings['message'] : __( 'Post saved', 'wpuf' );
22
+ $update_message = isset( $form_settings['update_message'] ) ? $form_settings['update_message'] : __( 'Post updated successfully', 'wpuf' );
23
+ $page_id = isset( $form_settings['page_id'] ) ? $form_settings['page_id'] : 0;
24
+ $url = isset( $form_settings['url'] ) ? $form_settings['url'] : '';
25
+ $comment_status = isset( $form_settings['comment_status'] ) ? $form_settings['comment_status'] : 'open';
26
+
27
+ $submit_text = isset( $form_settings['submit_text'] ) ? $form_settings['submit_text'] : __( 'Submit', 'wpuf' );
28
+ $draft_text = isset( $form_settings['draft_text'] ) ? $form_settings['draft_text'] : __( 'Save Draft', 'wpuf' );
29
+ $preview_text = isset( $form_settings['preview_text'] ) ? $form_settings['preview_text'] : __( 'Preview', 'wpuf' );
30
+ $draft_post = isset( $form_settings['draft_post'] ) ? $form_settings['draft_post'] : 'false';
31
+ $subscription_disabled = isset( $form_settings['subscription_disabled'] ) ? $form_settings['subscription_disabled'] : '';
32
+
33
+ ?>
34
+ <table class="form-table">
35
+
36
+ <tr class="">
37
+ <th><?php _e( 'Disable Subscription', 'wpuf' ); ?></th>
38
+ <td>
39
+ <label>
40
+ <input type="checkbox" name="wpuf_settings[subscription_disabled]" value="yes" <?php checked( $subscription_disabled, 'yes' ); ?> />
41
+ <?php _e( 'Disable Subscription', 'wpuf' ); ?>
42
+ </label>
43
+
44
+ <p class="description"><?php echo __( 'If checked, any subscription and pay-per-post will be disabled on the form and will take no effect.', 'wpuf' ); ?></p>
45
+ </td>
46
+ </tr>
47
+
48
+ <tr class="wpuf-post-type">
49
+ <th><?php _e( 'Post Type', 'wpuf' ); ?></th>
50
+ <td>
51
+ <select name="wpuf_settings[post_type]">
52
+ <?php
53
+ $post_types = get_post_types();
54
+ unset($post_types['attachment']);
55
+ unset($post_types['revision']);
56
+ unset($post_types['nav_menu_item']);
57
+ unset($post_types['wpuf_forms']);
58
+ unset($post_types['wpuf_profile']);
59
+
60
+ foreach ($post_types as $post_type) {
61
+ printf('<option value="%s"%s>%s</option>', $post_type, selected( $post_type_selected, $post_type, false ), $post_type );
62
+ }
63
+ ?>
64
+ </select>
65
+ </td>
66
+ </tr>
67
+
68
+ <tr class="wpuf-post-status">
69
+ <th><?php _e( 'Post Status', 'wpuf' ); ?></th>
70
+ <td>
71
+ <select name="wpuf_settings[post_status]">
72
+ <?php
73
+ $statuses = get_post_statuses();
74
+ foreach ($statuses as $status => $label) {
75
+ printf('<option value="%s"%s>%s</option>', $status, selected( $post_status_selected, $status, false ), $label );
76
+ }
77
+ ?>
78
+ </select>
79
+ </td>
80
+ </tr>
81
+
82
+ <tr class="wpuf-post-fromat">
83
+ <th><?php _e( 'Post Format', 'wpuf' ); ?></th>
84
+ <td>
85
+ <select name="wpuf_settings[post_format]">
86
+ <option value="0"><?php _e( '- None -', 'wpuf' ); ?></option>
87
+ <?php
88
+ $post_formats = get_theme_support( 'post-formats' );
89
+
90
+ if ( isset($post_formats[0]) && is_array( $post_formats[0] ) ) {
91
+ foreach ($post_formats[0] as $format) {
92
+ printf('<option value="%s"%s>%s</option>', $format, selected( $post_format_selected, $format, false ), $format );
93
+ }
94
+ }
95
+ ?>
96
+ </select>
97
+ </td>
98
+ </tr>
99
+
100
+ <tr class="wpuf-default-cat">
101
+ <th><?php _e( 'Default Post Category', 'wpuf' ); ?></th>
102
+ <td>
103
+ <?php
104
+ wp_dropdown_categories( array(
105
+ 'hide_empty' => false,
106
+ 'hierarchical' => true,
107
+ 'selected' => $default_cat,
108
+ 'name' => 'wpuf_settings[default_cat]',
109
+ 'show_option_none' => __( '- None -', 'wpuf' ),
110
+ 'taxonomy' => ( $post_type_selected == 'product' ) ? 'product_cat' : 'category'
111
+ ) );
112
+ ?>
113
+ <p class="description"><?php echo __( 'If users are not allowed to choose any category, this category will be used instead (if post type supports)', 'wpuf' ); ?></p>
114
+ </td>
115
+ </tr>
116
+
117
+ <tr>
118
+ <th><?php _e( 'Guest Post', 'wpuf' ); ?></th>
119
+ <td>
120
+ <label>
121
+ <input type="hidden" name="wpuf_settings[guest_post]" value="false">
122
+ <input type="checkbox" name="wpuf_settings[guest_post]" value="true"<?php checked( $guest_post, 'true' ); ?> />
123
+ <?php _e( 'Enable Guest Post', 'wpuf' ) ?>
124
+ </label>
125
+ <p class="description"><?php _e( 'Unregistered users will be able to submit posts', 'wpuf' ); ?></p>
126
+ </td>
127
+ </tr>
128
+
129
+ <tr class="show-if-guest">
130
+ <th><?php _e( 'User Details', 'wpuf' ); ?></th>
131
+ <td>
132
+ <label>
133
+ <input type="hidden" name="wpuf_settings[guest_details]" value="false">
134
+ <input type="checkbox" name="wpuf_settings[guest_details]" value="true"<?php checked( $guest_details, 'true' ); ?> />
135
+ <?php _e( 'Require Name and Email address', 'wpuf' ) ?>
136
+ </label>
137
+ <p class="description"><?php _e( 'If requires, users will be automatically registered to the site using the name and email address', 'wpuf' ); ?></p>
138
+ </td>
139
+ </tr>
140
+
141
+ <tr class="show-if-guest show-if-details">
142
+ <th><?php _e( 'Name Label', 'wpuf' ); ?></th>
143
+ <td>
144
+ <label>
145
+ <input type="text" name="wpuf_settings[name_label]" value="<?php echo esc_attr( $name_label ); ?>" />
146
+ </label>
147
+ <p class="description"><?php _e( 'Label text for name field', 'wpuf' ); ?></p>
148
+ </td>
149
+ </tr>
150
+
151
+ <tr class="show-if-guest show-if-details">
152
+ <th><?php _e( 'E-Mail Label', 'wpuf' ); ?></th>
153
+ <td>
154
+ <label>
155
+ <input type="text" name="wpuf_settings[email_label]" value="<?php echo esc_attr( $email_label ); ?>" />
156
+ </label>
157
+ <p class="description"><?php _e( 'Label text for email field', 'wpuf' ); ?></p>
158
+ </td>
159
+ </tr>
160
+
161
+ <tr class="show-if-not-guest">
162
+ <th><?php _e( 'Unauthorized Message', 'wpuf' ); ?></th>
163
+ <td>
164
+ <textarea rows="3" cols="40" name="wpuf_settings[message_restrict]"><?php echo esc_textarea( $message_restrict ); ?></textarea>
165
+ <p class="description"><?php _e( 'Not logged in users will see this message', 'wpuf' ); ?></p>
166
+ </td>
167
+ </tr>
168
+
169
+ <tr class="wpuf-redirect-to">
170
+ <th><?php _e( 'Redirect To', 'wpuf' ); ?></th>
171
+ <td>
172
+ <select name="wpuf_settings[redirect_to]">
173
+ <?php
174
+ $redirect_options = array(
175
+ 'post' => __( 'Newly created post', 'wpuf' ),
176
+ 'same' => __( 'Same Page', 'wpuf' ),
177
+ 'page' => __( 'To a page', 'wpuf' ),
178
+ 'url' => __( 'To a custom URL', 'wpuf' )
179
+ );
180
+
181
+ foreach ($redirect_options as $to => $label) {
182
+ printf('<option value="%s"%s>%s</option>', $to, selected( $redirect_to, $to, false ), $label );
183
+ }
184
+ ?>
185
+ </select>
186
+ <p class="description">
187
+ <?php _e( 'After successfull submit, where the page will redirect to', $domain = 'default' ) ?>
188
+ </p>
189
+ </td>
190
+ </tr>
191
+
192
+ <tr class="wpuf-same-page">
193
+ <th><?php _e( 'Message to show', 'wpuf' ); ?></th>
194
+ <td>
195
+ <textarea rows="3" cols="40" name="wpuf_settings[message]"><?php echo esc_textarea( $message ); ?></textarea>
196
+ </td>
197
+ </tr>
198
+
199
+ <tr class="wpuf-page-id">
200
+ <th><?php _e( 'Page', 'wpuf' ); ?></th>
201
+ <td>
202
+ <select name="wpuf_settings[page_id]">
203
+ <?php
204
+ $pages = get_posts( array( 'numberposts' => -1, 'post_type' => 'page') );
205
+
206
+ foreach ($pages as $page) {
207
+ printf('<option value="%s"%s>%s</option>', $page->ID, selected( $page_id, $page->ID, false ), esc_attr( $page->post_title ) );
208
+ }
209
+ ?>
210
+ </select>
211
+ </td>
212
+ </tr>
213
+
214
+ <tr class="wpuf-url">
215
+ <th><?php _e( 'Custom URL', 'wpuf' ); ?></th>
216
+ <td>
217
+ <input type="url" name="wpuf_settings[url]" value="<?php echo esc_attr( $url ); ?>">
218
+ </td>
219
+ </tr>
220
+
221
+ <tr class="wpuf-comment">
222
+ <th><?php _e( 'Comment Status', 'wpuf' ); ?></th>
223
+ <td>
224
+ <select name="wpuf_settings[comment_status]">
225
+ <option value="open" <?php selected( $comment_status, 'open'); ?>><?php _e('Open'); ?></option>
226
+ <option value="closed" <?php selected( $comment_status, 'closed'); ?>><?php _e('Closed'); ?></option>
227
+ </select>
228
+ </td>
229
+ </tr>
230
+
231
+ <tr class="wpuf-submit-text">
232
+ <th><?php _e( 'Submit Post Button text', 'wpuf' ); ?></th>
233
+ <td>
234
+ <input type="text" name="wpuf_settings[submit_text]" value="<?php echo esc_attr( $submit_text ); ?>">
235
+ </td>
236
+ </tr>
237
+
238
+ <tr>
239
+ <th><?php _e( 'Post Draft', 'wpuf' ); ?></th>
240
+ <td>
241
+ <label>
242
+ <input type="hidden" name="wpuf_settings[draft_post]" value="false">
243
+ <input type="checkbox" name="wpuf_settings[draft_post]" value="true"<?php checked( $draft_post, 'true' ); ?> />
244
+ <?php _e( 'Enable Saving as draft', 'wpuf' ) ?>
245
+ </label>
246
+ <p class="description"><?php _e( 'It will show a button to save as draft', 'wpuf' ); ?></p>
247
+ </td>
248
+ </tr>
249
+
250
+ <?php do_action( 'wpuf_form_setting', $form_settings, $post ); ?>
251
+ </table>
admin/html/modal.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="wpuf-form-template-modal">
2
+ <div class="wpuf-form-template-modal">
3
+
4
+ <span id="modal-label" class="screen-reader-text"><?php _e( 'Modal window. Press escape to close.', 'wpuf' ); ?></span>
5
+ <a href="#" class="close">× <span class="screen-reader-text"><?php _e( 'Close modal window', 'wpuf' ); ?></span></a>
6
+
7
+ <header class="modal-header">
8
+ <h2>
9
+ <?php _e( 'Select a Template', 'wpuf' ); ?>
10
+ <small><?php
11
+ printf(
12
+ __( 'Select from a pre-defined template or from a <a href="%s">blank form</a>', 'wpuf' ),
13
+ $blank_form_url
14
+ ); ?></small>
15
+ </h2>
16
+ </header>
17
+
18
+ <div class="content-container modal-footer">
19
+ <div class="content">
20
+
21
+ <ul>
22
+ <li class="blank-form">
23
+ <a href="<?php echo $blank_form_url; ?>">
24
+ <span class="dashicons dashicons-plus"></span>
25
+ <div class="title"><?php _e( 'Blank Form', 'wpuf' ); ?></div>
26
+ </a>
27
+ </li>
28
+
29
+ <?php
30
+ foreach ($registry as $key => $template ) {
31
+ $class = 'template-active';
32
+ $title = '';
33
+ $url = esc_url( add_query_arg( array(
34
+ 'action' => $action_name,
35
+ 'template' => $key,
36
+ '_wpnonce' => wp_create_nonce( 'wpuf_create_from_template' )
37
+ ), admin_url( 'admin.php' ) ) );
38
+
39
+ if ( ! $template->is_enabled() ) {
40
+ $url = '#';
41
+ $class = 'template-inactive';
42
+ $title = __( 'This integration is not installed.', 'wpuf' );
43
+ }
44
+ ?>
45
+
46
+ <li class="<?php echo $class; ?>">
47
+ <a href="<?php echo $url; ?>" title="<?php echo esc_attr( $title ); ?>">
48
+ <div class="title"><?php echo $template->get_title(); ?></div>
49
+ <div class="description"><?php echo $template->get_description(); ?></div>
50
+ </a>
51
+ </li>
52
+
53
+ <?php } ?>
54
+ </ul>
55
+ </div>
56
+ </div>
57
+
58
+ <?php if ( $footer_help ) : ?>
59
+ <footer>
60
+ <?php echo $footer_help; ?>
61
+ </footer>
62
+ <?php endif; ?>
63
+ </div>
64
+ <div class="wpuf-form-template-modal-backdrop"></div>
65
+ </div>
66
+
67
+
68
+ <script type="text/javascript">
69
+ (function($) {
70
+ var popup = {
71
+ init: function() {
72
+ $('.wrap').on('click', 'a.page-title-action.add-form', this.openModal);
73
+ $('.wpuf-form-template-modal-backdrop, .wpuf-form-template-modal .close').on('click', $.proxy(this.closeModal, this) );
74
+
75
+ $('body').on( 'keydown', $.proxy(this.onEscapeKey, this) );
76
+ },
77
+
78
+ openModal: function(e) {
79
+ e.preventDefault();
80
+
81
+ $('.wpuf-form-template-modal').show();
82
+ $('.wpuf-form-template-modal-backdrop').show();
83
+ },
84
+
85
+ onEscapeKey: function(e) {
86
+ if ( 27 === e.keyCode ) {
87
+ this.closeModal(e);
88
+ }
89
+ },
90
+
91
+ closeModal: function(e) {
92
+ if ( typeof e !== 'undefined' ) {
93
+ e.preventDefault();
94
+ }
95
+
96
+ $('.wpuf-form-template-modal').hide();
97
+ $('.wpuf-form-template-modal-backdrop').hide();
98
+ }
99
+ };
100
+
101
+ $(function() {
102
+ popup.init();
103
+ });
104
+
105
+ })(jQuery);
106
+ </script>
admin/installer.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Page installer
5
+ *
6
+ * @since 2.3
7
+ */
8
+ class WPUF_Admin_Installer {
9
+
10
+ function __construct() {
11
+ add_action( 'admin_notices', array($this, 'admin_notice') );
12
+ add_action( 'admin_init', array($this, 'handle_request') );
13
+ }
14
+
15
+ /**
16
+ * Print admin notices
17
+ *
18
+ * @return void
19
+ */
20
+ function admin_notice() {
21
+ $page_created = get_option( '_wpuf_page_created' );
22
+
23
+ if ( $page_created != '1' ) {
24
+ ?>
25
+ <div class="updated error">
26
+ <p>
27
+ <?php _e( 'If you have not created <strong>WP User Frontend</strong> pages yet, you can do this by one click.', 'wpuf' ); ?>
28
+ </p>
29
+ <p class="submit">
30
+ <a class="button button-primary" href="<?php echo add_query_arg( array( 'install_wpuf_pages' => true ), admin_url( 'admin.php?page=wpuf-settings' ) ); ?>"><?php _e( 'Install WPUF Pages', 'wpuf' ); ?></a>
31
+ or
32
+ <a class="button" href="<?php echo add_query_arg( array( 'wpuf_hide_page_nag' => true ) ); ?>"><?php _e( 'Skip Setup', 'wpuf' ); ?></a>
33
+ </p>
34
+ </div>
35
+ <?php
36
+ }
37
+
38
+ if ( isset( $_GET['wpuf_page_installed'] ) && $_GET['wpuf_page_installed'] == '1' ) {
39
+ ?>
40
+ <div class="updated">
41
+ <p>
42
+ <strong><?php _e( 'Congratulations!', 'wpuf' ); ?></strong> <?php _e( 'Pages for <strong>WP User Frontend</strong> has been successfully installed and saved!', 'wpuf' ); ?>
43
+ </p>
44
+ </div>
45
+ <?php
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Handle the page creation button requests
51
+ *
52
+ * @return void
53
+ */
54
+ function handle_request() {
55
+ if ( isset( $_GET['install_wpuf_pages'] ) && $_GET['install_wpuf_pages'] == '1' ) {
56
+ $this->init_pages();
57
+ }
58
+
59
+ if ( isset( $_GET['wpuf_hide_page_nag'] ) && $_GET['wpuf_hide_page_nag'] == '1' ) {
60
+ update_option( '_wpuf_page_created', '1' );
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Initialize the plugin with some default page/settings
66
+ *
67
+ * @since 2.2
68
+ * @return void
69
+ */
70
+ function init_pages() {
71
+
72
+ // create a dashboard page
73
+ $dashboard_page = $this->create_page( __( 'Dashboard', 'wpuf' ), '[wpuf_dashboard]' );
74
+ $account_page = $this->create_page( __( 'Account', 'wpuf' ), '[wpuf_account]' );
75
+ $edit_page = $this->create_page( __( 'Edit', 'wpuf' ), '[wpuf_edit]' );
76
+
77
+ // login page
78
+ $login_page = $this->create_page( __( 'Login', 'wpuf' ), '[wpuf-login]' );
79
+
80
+ $post_form = $this->create_form();
81
+
82
+ // payment page
83
+ $subscr_page = $this->create_page( __( 'Subscription', 'wpuf' ), __( '[wpuf_sub_pack]') );
84
+ $payment_page = $this->create_page( __( 'Payment', 'wpuf' ), __( 'Please select a gateway for payment') );
85
+ $thank_page = $this->create_page( __( 'Thank You', 'wpuf' ), __( '<h1>Payment is complete</h1><p>Congratulations, your payment has been completed!</p>') );
86
+ $bank_page = $this->create_page( __( 'Order Received', 'wpuf' ), __( 'Hi, we have received your order. We will validate the order and will take necessary steps to move forward.') );
87
+
88
+ // save the settings
89
+ if ( $edit_page ) {
90
+ update_option( 'wpuf_general', array(
91
+ 'edit_page_id' => $edit_page,
92
+ 'default_post_form' => $post_form
93
+ ) );
94
+ }
95
+
96
+ // profile pages
97
+ $profile_options = array();
98
+ $reg_page = false;
99
+
100
+ if ( $login_page ) {
101
+ $profile_options['login_page'] = $login_page;
102
+ }
103
+
104
+ $data = apply_filters( 'wpuf_pro_page_install', $profile_options );
105
+
106
+ if ( is_array( $data ) ) {
107
+
108
+ if ( isset ( $data['profile_options'] ) ) {
109
+ $profile_options = $data['profile_options'];
110
+ }
111
+ if ( isset ( $data['reg_page'] ) ) {
112
+ $reg_page = $data['reg_page'];
113
+ }
114
+ }
115
+
116
+ if ( $login_page && $reg_page ) {
117
+ $profile_options['register_link_override'] = 'on';
118
+ }
119
+
120
+ update_option( 'wpuf_profile', $profile_options );
121
+
122
+ // payment pages
123
+ update_option( 'wpuf_payment', array(
124
+ 'subscription_page' => $subscr_page,
125
+ 'payment_page' => $payment_page,
126
+ 'payment_success' => $thank_page,
127
+ 'bank_success' => $bank_page
128
+ ) );
129
+
130
+ update_option( '_wpuf_page_created', '1' );
131
+
132
+ wp_redirect( admin_url( 'admin.php?page=wpuf-settings&wpuf_page_installed=1' ) );
133
+ exit;
134
+ }
135
+
136
+ /**
137
+ * Create a page with title and content
138
+ *
139
+ * @param string $page_title
140
+ * @param string $post_content
141
+ * @return false|int
142
+ */
143
+ function create_page( $page_title, $post_content = '', $post_type = 'page' ) {
144
+ $page_id = wp_insert_post( array(
145
+ 'post_title' => $page_title,
146
+ 'post_type' => $post_type,
147
+ 'post_status' => 'publish',
148
+ 'comment_status' => 'closed',
149
+ 'post_content' => $post_content
150
+ ) );
151
+
152
+ if ( $page_id && ! is_wp_error( $page_id ) ) {
153
+ return $page_id;
154
+ }
155
+
156
+ return false;
157
+ }
158
+
159
+ /**
160
+ * Create a basic registration form by default
161
+ *
162
+ * @return int|boolean
163
+ */
164
+ function create_reg_form() {
165
+ return wpuf_create_sample_form( __( 'Registration', 'wpuf' ), 'wpuf_profile' );
166
+ }
167
+
168
+ /**
169
+ * Create a post form
170
+ *
171
+ * @return void
172
+ */
173
+ function create_form() {
174
+ return wpuf_create_sample_form( __( 'Sample Form', 'wpuf' ), 'wpuf_forms' );
175
+ }
176
+
177
+ }
admin/post-forms-list-table-view.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2>
3
+ <?php
4
+ _e( 'Post Forms', 'wpuf' );
5
+
6
+ if ( current_user_can( wpuf_admin_role() ) ):
7
+ ?>
8
+ <a href="<?php echo $add_new_page_url; ?>" id="new-wpuf-post-form" class="page-title-action add-form"><?php _e( 'Add Form', 'wpuf' ); ?></a>
9
+ <?php
10
+ endif;
11
+ ?>
12
+ </h2>
13
+
14
+
15
+ <div class="list-table-wrap wpuf-post-form-wrap">
16
+ <div class="list-table-inner wpuf-post-form-wrap-inner">
17
+
18
+ <form method="get">
19
+ <input type="hidden" name="page" value="wpuf-post-forms">
20
+ <?php
21
+ $wpuf_post_form = new WPUF_Admin_Post_Forms_List_Table();
22
+ $wpuf_post_form->prepare_items();
23
+ $wpuf_post_form->search_box( __( 'Search Forms', 'wpuf' ), 'wpuf-post-form-search' );
24
+
25
+ if ( current_user_can( wpuf_admin_role() ) ) {
26
+ $wpuf_post_form->views();
27
+ }
28
+
29
+ $wpuf_post_form->display();
30
+ ?>
31
+ </form>
32
+
33
+ </div><!-- .list-table-inner -->
34
+ </div><!-- .list-table-wrap -->
35
+
36
+ </div>
admin/post-forms-list-table.php ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post Forms list table class
4
+ *
5
+ * @since 2.5
6
+ */
7
+ class WPUF_Admin_Post_Forms_List_Table extends WP_List_Table {
8
+
9
+ /**
10
+ * Class constructor
11
+ *
12
+ * @since 2.5
13
+ *
14
+ * @return void
15
+ */
16
+ public function __construct() {
17
+ global $status, $page, $page_status;
18
+
19
+ parent::__construct( array(
20
+ 'singular' => 'post-form',
21
+ 'plural' => 'post-forms',
22
+ 'ajax' => false
23
+ ) );
24
+ }
25
+
26
+ /**
27
+ * Top filters like All, Published, Trash etc
28
+ *
29
+ * @since 2.5
30
+ *
31
+ * @return array
32
+ */
33
+ public function get_views() {
34
+ $status_links = array();
35
+ $base_link = admin_url( 'admin.php?page=wpuf-post-forms' );
36
+
37
+ $post_statuses = apply_filters( 'wpuf_post_forms_list_table_post_statuses', array(
38
+ 'all' => __( 'All', 'wpuf' ),
39
+ 'publish' => __( 'Published', 'wpuf' ),
40
+ 'trash' => __( 'Trash', 'wpuf' )
41
+ ) );
42
+
43
+ $current_status = isset( $_GET['post_status'] ) ? $_GET['post_status'] : 'all';
44
+
45
+ $post_counts = (array) wp_count_posts( 'wpuf_forms' );
46
+
47
+ if ( isset( $post_counts['auto-draft'] ) ) {
48
+ unset( $post_counts['auto-draft'] );
49
+ }
50
+
51
+ foreach ( $post_statuses as $status => $status_title ) {
52
+ $link = ( 'all' === $status ) ? $base_link : admin_url( 'admin.php?page=wpuf-post-forms&post_status=' . $status );
53
+
54
+ if ( $status === $current_status ) {
55
+ $class = 'current';
56
+ } else {
57
+ $class = '';
58
+ }
59
+
60
+ switch ( $status ) {
61
+ case 'all':
62
+ $without_trash = $post_counts;
63
+ unset( $without_trash['trash'] );
64
+
65
+ $count = array_sum( $without_trash );
66
+ break;
67
+
68
+ default:
69
+ $count = $post_counts[ $status ];
70
+ break;
71
+ }
72
+
73
+ $status_links[ $status ] = sprintf(
74
+ '<a class="%s" href="%s">%s <span class="count">(%s)</span></a>',
75
+ $class, $link, $status_title, $count
76
+ );
77
+ }
78
+
79
+ return apply_filters( 'wpuf_post_forms_list_table_get_views', $status_links, $post_statuses, $current_status );
80
+ }
81
+
82
+ /**
83
+ * Message to show if no item found
84
+ *
85
+ * @since 2.5
86
+ *
87
+ * @return void
88
+ */
89
+ public function no_items() {
90
+ _e( 'No form found.', 'wpuf' );
91
+ }
92
+
93
+ /**
94
+ * Bulk actions dropdown
95
+ *
96
+ * @since 2.5
97
+ *
98
+ * @return array
99
+ */
100
+ public function get_bulk_actions() {
101
+ $actions = array();
102
+
103
+ if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
104
+ $actions['trash'] = __( 'Move to Trash', 'wpuf' );
105
+ }
106
+
107
+ if ( isset( $_GET['post_status'] ) && 'trash' === $_GET['post_status'] ) {
108
+ $actions['restore'] = __( 'Restore', 'wpuf' );
109
+ $actions['delete'] = __( 'Delete Permanently', 'wpuf' );
110
+ }
111
+
112
+ return apply_filters( 'wpuf_post_forms_list_table_get_bulk_actions', $actions );
113
+ }
114
+
115
+ /**
116
+ * List table search box
117
+ *
118
+ * @since 2.5
119
+ *
120
+ * @param string $text
121
+ * @param string $input_id
122
+ *
123
+ * @return void
124
+ */
125
+ public function search_box( $text, $input_id ) {
126
+ if ( empty( $_GET['s'] ) && ! $this->has_items() ) {
127
+ return;
128
+ }
129
+
130
+ if ( ! empty( $_GET['orderby'] ) ) {
131
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_GET['orderby'] ) . '" />';
132
+ }
133
+
134
+ if ( ! empty( $_GET['order'] ) ) {
135
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_GET['order'] ) . '" />';
136
+ }
137
+
138
+ if ( ! empty( $_GET['post_status'] ) ) {
139
+ echo '<input type="hidden" name="post_status" value="' . esc_attr( $_GET['post_status'] ) . '" />';
140
+ }
141
+
142
+ do_action( 'wpuf_post_forms_list_table_search_box', $text, $input_id );
143
+
144
+ $input_id = $input_id . '-search-input';
145
+
146
+ ?>
147
+ <p class="search-box">
148
+ <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
149
+ <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
150
+ <?php submit_button( $text, 'button', 'post_form_search', false, array( 'id' => 'search-submit' ) ); ?>
151
+ </p>
152
+ <?php
153
+ }
154
+
155
+ /**
156
+ * Decide which action is currently performing
157
+ *
158
+ * @since 2.5
159
+ *
160
+ * @return string
161
+ */
162
+ public function current_action() {
163
+
164
+ if ( isset( $_GET['post_form_search'] ) ) {
165
+ return 'post_form_search';
166
+ }
167
+
168
+ return parent::current_action();
169
+ }
170
+
171
+ /**
172
+ * Prepare table data
173
+ *
174
+ * @since 2.5
175
+ *
176
+ * @return void
177
+ */
178
+ public function prepare_items() {
179
+ $columns = $this->get_columns();
180
+ $hidden = array();
181
+ $sortable = $this->get_sortable_columns();
182
+ $this->_column_headers = array( $columns, $hidden, $sortable );
183
+
184
+ $per_page = get_option( 'posts_per_page', 20 );
185
+ $current_page = $this->get_pagenum();
186
+ $offset = ( $current_page - 1 ) * $per_page;
187
+
188
+ $args = array(
189
+ 'offset' => $offset,
190
+ 'posts_per_page' => $per_page,
191
+ );
192
+
193
+ if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
194
+ $args['s'] = $_GET['s'];
195
+ }
196
+
197
+ if ( isset( $_GET['post_status'] ) && !empty( $_GET['post_status'] ) ) {
198
+ $args['post_status'] = $_GET['post_status'];
199
+ }
200
+
201
+ if ( isset( $_GET['orderby'] ) && !empty( $_GET['orderby'] ) ) {
202
+ $args['orderby'] = $_GET['orderby'];
203
+ }
204
+
205
+ if ( isset( $_GET['order'] ) && !empty( $_GET['order'] ) ) {
206
+ $args['order'] = $_GET['order'];
207
+ }
208
+
209
+
210
+ $items = $this->item_query( $args );
211
+
212
+ $this->counts = count( $items['count'] );
213
+ $this->items = $items['forms'];
214
+
215
+ $this->set_pagination_args( array(
216
+ 'total_items' => $items['count'],
217
+ 'per_page' => $per_page
218
+ ) );
219
+ }
220
+
221
+ /**
222
+ * WP_Query for post forms
223
+ *
224
+ * @since 2.5
225
+ *
226
+ * @param array $args
227
+ *
228
+ * @return array
229
+ */
230
+ public function item_query( $args ) {
231
+ $defauls = array(
232
+ 'post_status' => 'any',
233
+ 'orderby' => 'DESC',
234
+ 'order' => 'ID',
235
+ );
236
+
237
+ $args = wp_parse_args( $args, $defauls );
238
+
239
+ $args['post_type'] = 'wpuf_forms';
240
+
241
+ $query = new WP_Query( $args );
242
+
243
+ $forms = array();
244
+
245
+ if ( $query->have_posts() ) {
246
+
247
+ $i = 0;
248
+
249
+ while ( $query->have_posts() ) {
250
+ $query->the_post();
251
+
252
+ $form = $query->posts[ $i ];
253
+
254
+ $settings = get_post_meta( get_the_ID(), 'wpuf_form_settings', true );
255
+
256
+ $forms[ $i ] = array(
257
+ 'ID' => $form->ID,
258
+ 'post_title' => $form->post_title,
259
+ 'post_status' => $form->post_status,
260
+ 'settings_post_type' => $settings['post_type'],
261
+ 'settings_post_status' => $settings['post_status'],
262
+ 'settings_guest_post' => $settings['guest_post']
263
+ );
264
+
265
+
266
+ $i++;
267
+ }
268
+ }
269
+
270
+ $forms = apply_filters( 'wpuf_post_forms_list_table_query_results', $forms, $query, $args );
271
+ $count = $query->found_posts;
272
+
273
+ wp_reset_postdata();
274
+
275
+ return array(
276
+ 'forms' => $forms,
277
+ 'count' => $count
278
+ );
279
+ }
280
+
281
+ /**
282
+ * Get the column names
283
+ *
284
+ * @since 2.5
285
+ *
286
+ * @return array
287
+ */
288
+ public function get_columns() {
289
+ $columns = array(
290
+ 'cb' => '<input type="checkbox" />',
291
+ 'form_name' => __( 'Form Name', 'wpuf' ),
292
+ 'post_type' => __( 'Post Type', 'wpuf' ),
293
+ 'post_status' => __( 'Post Status', 'wpuf' ),
294
+ 'guest_post' => __( 'Guest Post', 'wpuf' ),
295
+ 'shortcode' => __( 'Shortcode', 'wpuf' ),
296
+ );
297
+
298
+ return apply_filters( 'wpuf_post_forms_list_table_cols', $columns );
299
+ }
300
+
301
+ /**
302
+ * Get sortable columns
303
+ *
304
+ * @since 2.5
305
+ *
306
+ * @return array
307
+ */
308
+ public function get_sortable_columns() {
309
+ $sortable_columns = array(
310
+ 'form_name' => array( 'form_name', false ),
311
+ );
312
+
313
+ return apply_filters( 'wpuf_post_forms_list_table_sortable_columns', $sortable_columns );
314
+ }
315
+
316
+ /**
317
+ * Column values
318
+ *
319
+ * @since 2.5
320
+ *
321
+ * @param array $item
322
+ * @param string $column_name
323
+ *
324
+ * @return string
325
+ */
326
+ public function column_default( $item, $column_name ) {
327
+ switch ( $column_name ) {
328
+ case 'post_type':
329
+ return $item['settings_post_type'];
330
+
331
+ case 'post_status':
332
+ return wpuf_admin_post_status( $item['settings_post_status'] );
333
+
334
+ case 'guest_post':
335
+ $is_guest_post = $item['settings_guest_post'];
336
+ $url = WPUF_ASSET_URI . '/images/';
337
+ $image = '<img src="%s" alt="%s">';
338
+
339
+ return filter_var( $is_guest_post, FILTER_VALIDATE_BOOLEAN ) ?
340
+ sprintf( $image, $url . 'tick.png', __( 'Yes', 'wpuf' ) ) :
341
+ sprintf( $image, $url . 'cross.png', __( 'No', 'wpuf' ) );
342
+
343
+ case 'shortcode':
344
+ return '<code>[wpuf_form id="' . $item['ID'] . '"]</code>';
345
+
346
+ default:
347
+ return apply_filter( 'wpuf_post_forms_list_table_column_default', $item, $column_name );
348
+ }
349
+ }
350
+
351
+ /**
352
+ * Checkbox column value
353
+ *
354
+ * @since 2.5
355
+ *
356
+ * @param array $item
357
+ *
358
+ * @return string
359
+ */
360
+ public function column_cb( $item ) {
361
+ return sprintf( '<input type="checkbox" name="post[]" value="%d" />', $item['ID'] );
362
+ }
363
+
364
+ /**
365
+ * Form name column value
366
+ *
367
+ * @since 2.5
368
+ *
369
+ * @param array $item
370
+ *
371
+ * @return string
372
+ */
373
+ public function column_form_name( $item ) {
374
+ $actions = array();
375
+
376
+ $edit_url = admin_url( 'admin.php?page=wpuf-post-forms&action=edit&id=' . $item['ID'] );
377
+
378
+ $wpnonce = wp_create_nonce( 'bulk-post-forms' );
379
+ $admin_url = admin_url( 'admin.php?page=wpuf-post-forms&id=' . $item['ID'] . '&_wpnonce=' . $wpnonce );
380
+
381
+ $duplicate_url = $admin_url . '&action=duplicate';
382
+ $trash_url = $admin_url . '&action=trash';
383
+ $restore_url = $admin_url . '&action=restore';
384
+ $delete_url = $admin_url . '&action=delete';
385
+
386
+ if ( ( !isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) && current_user_can( wpuf_admin_role() ) ) {
387
+ $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'wpuf' ) );
388
+ $actions['trash'] = sprintf( '<a href="%s" class="submitdelete">%s</a>', $trash_url, __( 'Trash', 'wpuf' ) );
389
+ $actions['duplicate'] = sprintf( '<a href="%s">%s</a>', $duplicate_url, __( 'Duplicate', 'wpuf' ) );
390
+
391
+ $title = sprintf(
392
+ '<a class="row-title" href="%1s" aria-label="%2s">%3s</a>',
393
+ $edit_url,
394
+ '"' . $item['post_title'] . '" (Edit)',
395
+ $item['post_title']
396
+ );
397
+ }
398
+
399
+ if ( ( isset( $_GET['post_status'] ) && 'trash' === $_GET['post_status'] ) && current_user_can( wpuf_admin_role() ) ) {
400
+ $actions['restore'] = sprintf( '<a href="%s">%s</a>', $restore_url, __( 'Restore', 'wpuf' ) );
401
+ $actions['delete'] = sprintf( '<a href="%s" class="submitdelete">%s</a>', $delete_url, __( 'Delete Permanently', 'wpuf' ) );
402
+
403
+ $title = sprintf(
404
+ '<strong>%1s</strong>',
405
+ $item['post_title']
406
+ );
407
+ }
408
+
409
+ $draft_marker = ( 'draft' === $item['post_status'] ) ?
410
+ '<strong> — <span class="post-state">' . __( 'Draft', 'wpuf' ) . '</span></strong>' :
411
+ '';
412
+
413
+ $form_name = sprintf( '%1s %2s %3s', $title, $draft_marker, $this->row_actions( $actions ) );
414
+
415
+ return apply_filters( 'wpuf_post_forms_list_table_column_form_name', $form_name, $item );
416
+ }
417
+
418
+ }
admin/posting.php ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin side posting handler
5
+ *
6
+ * Builds custom fields UI for post add/edit screen
7
+ * and handles value saving.
8
+ *
9
+ * @package WP User Frontend
10
+ */
11
+ class WPUF_Admin_Posting extends WPUF_Render_Form {
12
+
13
+ function __construct() {
14
+ // meta boxes
15
+ add_action( 'add_meta_boxes', array($this, 'add_meta_boxes') );
16
+ add_action( 'add_meta_boxes', array($this, 'add_meta_box_form_select') );
17
+
18
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_script') );
19
+
20
+ add_action( 'save_post', array($this, 'save_meta'), 1, 2 ); // save the custom fields
21
+ add_action( 'save_post', array( $this, 'form_selection_metabox_save' ), 1, 2 ); // save edit form id
22
+ }
23
+
24
+ function enqueue_script() {
25
+ global $pagenow;
26
+
27
+ if ( !in_array( $pagenow, array('profile.php', 'post-new.php', 'post.php', 'user-edit.php') ) ) {
28
+ return;
29
+ }
30
+
31
+ $scheme = is_ssl() ? 'https' : 'http';
32
+ $api_key = wpuf_get_option( 'gmap_api_key', 'wpuf_general' );
33
+
34
+ wp_enqueue_style( 'jquery-ui', WPUF_ASSET_URI . '/css/jquery-ui-1.9.1.custom.css' );
35
+
36
+ wp_enqueue_script( 'jquery-ui-datepicker' );
37
+ wp_enqueue_script( 'jquery-ui-slider' );
38
+ wp_enqueue_script( 'jquery-ui-timepicker', WPUF_ASSET_URI . '/js/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker') );
39
+
40
+ if ( !empty( $api_key ) ) {
41
+ wp_enqueue_script( 'google-maps', $scheme . '://maps.google.com/maps/api/js?libraries=places&key='.$api_key, array(), null );
42
+ } else {
43
+ add_action('admin_head', 'wpuf_hide_google_map_button');
44
+
45
+ function wpuf_hide_google_map_button() {
46
+ echo "<style>
47
+ button.button[data-name='custom_map'] {
48
+ display: none;
49
+ }
50
+ </style>";
51
+ }
52
+ }
53
+
54
+ wp_enqueue_script( 'wpuf-upload', WPUF_ASSET_URI . '/js/upload.js', array('jquery', 'plupload-handlers') );
55
+ wp_localize_script( 'wpuf-upload', 'wpuf_frontend_upload', array(
56
+ 'confirmMsg' => __( 'Are you sure?', 'wpuf' ),
57
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
58
+ 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
59
+ 'plupload' => array(
60
+ 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf-upload-nonce' ),
61
+ 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
62
+ 'filters' => array(array('title' => __( 'Allowed Files', 'wpuf' ), 'extensions' => '*')),
63
+ 'multipart' => true,
64
+ 'urlstream_upload' => true,
65
+ 'warning' => __( 'Maximum number of files reached!', 'wpuf' ),
66
+ 'size_error' => __( 'The file you have uploaded exceeds the file size limit. Please try again.', 'wpuf' ),
67
+ 'type_error' => __( 'You have uploaded an incorrect file type. Please try again.', 'wpuf' )
68
+ )
69
+ ) );
70
+ }
71
+
72
+ /**
73
+ * Meta box for all Post form selection
74
+ *
75
+ * Registers a meta box in public post types to select the desired WPUF
76
+ * form select box to assign a form id.
77
+ *
78
+ * @since 2.5.2
79
+ *
80
+ * @return void
81
+ */
82
+ function add_meta_box_form_select() {
83
+
84
+ $post_types = get_post_types( array('public' => true) );
85
+ foreach ($post_types as $post_type) {
86
+ add_meta_box( 'wpuf-select-form', __('WPUF Form', 'wpuf'), array($this, 'form_selection_metabox'), $post_type, 'side', 'high' );
87
+ }
88
+ }
89
+
90
+
91
+ /**
92
+ * Form selection meta box in post types
93
+ *
94
+ * Registered via $this->add_meta_box_form_select()
95
+ *
96
+ * @since 2.5.2
97
+ *
98
+ * @global object $post
99
+ */
100
+ function form_selection_metabox() {
101
+ global $post;
102
+
103
+ $forms = get_posts( array('post_type' => 'wpuf_forms', 'numberposts' => '-1') );
104
+ $selected = get_post_meta( $post->ID, '_wpuf_form_id', true );
105
+ ?>
106
+
107
+ <input type="hidden" name="wpuf_form_select_nonce" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
108
+
109
+ <select name="wpuf_form_select">
110
+ <option value="">--</option>
111
+ <?php foreach ($forms as $form) { ?>
112
+ <option value="<?php echo $form->ID; ?>"<?php selected($selected, $form->ID); ?>><?php echo $form->post_title; ?></option>
113
+ <?php } ?>
114
+ </select>
115
+ <?php
116
+ }
117
+
118
+ /**
119
+ * Saves the form ID from form selection meta box
120
+ *
121
+ * @since 2.5.2
122
+ *
123
+ * @param int $post_id
124
+ * @param object $post
125
+ * @return int|void
126
+ */
127
+ function form_selection_metabox_save( $post_id, $post ) {
128
+ if ( !isset($_POST['wpuf_form_select'])) {
129
+ return $post->ID;
130
+ }
131
+
132
+ if ( !wp_verify_nonce( $_POST['wpuf_form_select_nonce'], plugin_basename( __FILE__ ) ) ) {
133
+ return $post->ID;
134
+ }
135
+
136
+ // Is the user allowed to edit the post or page?
137
+ if ( !current_user_can( 'edit_post', $post->ID ) ) {
138
+ return $post->ID;
139
+ }
140
+
141
+ update_post_meta( $post->ID, '_wpuf_form_id', $_POST['wpuf_form_select'] );
142
+ }
143
+
144
+ /**
145
+ * Meta box to show WPUF Custom Fields
146
+ *
147
+ * Registers a meta box in public post types to show WPUF Custom Fields
148
+ *
149
+ * @since 2.5
150
+ *
151
+ * @return void
152
+ */
153
+ function add_meta_boxes() {
154
+ $post_types = get_post_types( array('public' => true) );
155
+
156
+ foreach ($post_types as $post_type) {
157
+ add_meta_box( 'wpuf-custom-fields', __( 'WPUF Custom Fields', 'wpuf' ), array($this, 'render_form'), $post_type, 'normal', 'high' );
158
+ }
159
+ }
160
+
161
+ /**
162
+ * function to hide form custom field
163
+ *
164
+ * @since 2.5
165
+ *
166
+ * @return void
167
+ */
168
+ function hide_form() {
169
+ ?>
170
+ <style type="text/css">
171
+ #wpuf-custom-fields { display: none; }
172
+ </style>
173
+ <?php
174
+ }
175
+
176
+ /**
177
+ * generate frontend form field
178
+ *
179
+ * @since 2.5
180
+ *
181
+ * @param int $form_id
182
+ * @param int $post_id
183
+ *
184
+ * @return void
185
+ */
186
+ function render_form( $form_id, $post_id = null ) {
187
+ global $post;
188
+
189
+ $form_id = get_post_meta( $post->ID, '_wpuf_form_id', true );
190
+ $form_settings = wpuf_get_form_settings( $form_id );
191
+
192
+
193
+ // hide the metabox itself if no form ID is set
194
+ if ( !$form_id ) {
195
+ $this->hide_form();
196
+ return;
197
+ }
198
+
199
+ list($post_fields, $taxonomy_fields, $custom_fields) = $this->get_input_fields( $form_id );
200
+
201
+ if ( empty( $custom_fields ) ) {
202
+ _e( 'No custom fields found.', 'wpuf' );
203
+ return;
204
+ }
205
+ ?>
206
+
207
+ <input type="hidden" name="wpuf_cf_update" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
208
+ <input type="hidden" name="wpuf_cf_form_id" value="<?php echo $form_id; ?>" />
209
+
210
+ <table class="form-table wpuf-cf-table">
211
+ <tbody>
212
+ <?php
213
+ $this->render_items( $custom_fields, $post->ID, 'post', $form_id, $form_settings );
214
+ ?>
215
+ </tbody>
216
+ </table>
217
+ <?php
218
+ $this->scripts_styles();
219
+ }
220
+
221
+ /**
222
+ * Prints form input label
223
+ *
224
+ * @param string $attr
225
+ */
226
+ function label( $attr, $post_id = 0 ) {
227
+ ?>
228
+ <?php echo $attr['label'] . $this->required_mark( $attr ); ?>
229
+ <?php
230
+ }
231
+
232
+ /**
233
+ * generate table header of frontend form field
234
+ *
235
+ * @since 2.5
236
+ *
237
+ * @param array $form_field
238
+ * @param int $post_id
239
+ *
240
+ * @return void
241
+ */
242
+ function render_item_before( $form_field, $post_id = 0 ) {
243
+ echo '<tr>';
244
+ echo '<th><strong>';
245
+ $this->label( $form_field );
246
+ echo '</strong></th>';
247
+ echo '<td>';
248
+ }
249
+
250
+ /**
251
+ * generate table bottom of frontend form field
252
+ *
253
+ * @since 2.5
254
+ *
255
+ * @param array $form_field
256
+ *
257
+ * @return void
258
+ */
259
+ function render_item_after( $form_field ) {
260
+ echo '</td>';
261
+ echo '</tr>';
262
+ }
263
+
264
+ function scripts_styles() {
265
+ ?>
266
+ <script type="text/javascript">
267
+ jQuery(function($){
268
+ var wpuf = {
269
+ init: function() {
270
+ $('.wpuf-cf-table').on('click', 'img.wpuf-clone-field', this.cloneField);
271
+ $('.wpuf-cf-table').on('click', 'img.wpuf-remove-field', this.removeField);
272
+ $('.wpuf-cf-table').on('click', 'a.wpuf-delete-avatar', this.deleteAvatar);
273
+ },
274
+ cloneField: function(e) {
275
+ e.preventDefault();
276
+
277
+ var $div = $(this).closest('tr');
278
+ var $clone = $div.clone();
279
+ // console.log($clone);
280
+
281
+ //clear the inputs
282
+ $clone.find('input').val('');
283
+ $clone.find(':checked').attr('checked', '');
284
+ $div.after($clone);
285
+ },
286
+
287
+ removeField: function() {
288
+ //check if it's the only item
289
+ var $parent = $(this).closest('tr');
290
+ var items = $parent.siblings().andSelf().length;
291
+
292
+ if( items > 1 ) {
293
+ $parent.remove();
294
+ }
295
+ },
296
+
297
+ deleteAvatar: function(e) {
298
+ e.preventDefault();
299
+
300
+ var data = {
301
+ action: 'wpuf_delete_avatar',
302
+ user_id : $('#profile-page').find('#user_id').val(),
303
+ _wpnonce: '<?php echo wp_create_nonce( 'wpuf_nonce' ); ?>'
304
+ };
305
+
306
+ if ( confirm( $(this).data('confirm') ) ) {
307
+ $.post(ajaxurl, data, function() {
308
+ window.location.reload();
309
+ });
310
+ }
311
+ }
312
+ };
313
+
314
+ wpuf.init();
315
+ });
316
+
317
+ </script>
318
+ <style type="text/css">
319
+ ul.wpuf-attachment-list li {
320
+ display: inline-block;
321
+ border: 1px solid #dfdfdf;
322
+ padding: 5px;
323
+ -webkit-border-radius: 5px;
324
+ -moz-border-radius: 5px;
325
+ border-radius: 5px;
326
+ margin-right: 5px;
327
+ }
328
+ ul.wpuf-attachment-list li a.attachment-delete {
329
+ text-decoration: none;
330
+ padding: 3px 12px;
331
+ border: 1px solid #C47272;
332
+ color: #ffffff;
333
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
334
+ -webkit-border-radius: 3px;
335
+ -moz-border-radius: 3px;
336
+ border-radius: 3px;
337
+ background-color: #da4f49;
338
+ background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
339
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
340
+ background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
341
+ background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
342
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
343
+ background-repeat: repeat-x;
344
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
345
+ border-color: #bd362f #bd362f #802420;
346
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
347
+ *background-color: #bd362f;
348
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
349
+ }
350
+ ul.wpuf-attachment-list li a.attachment-delete:hover,
351
+ ul.wpuf-attachment-list li a.attachment-delete:active {
352
+ color: #ffffff;
353
+ background-color: #bd362f;
354
+ *background-color: #a9302a;
355
+ }
356
+
357
+ .wpuf-cf-table table th,
358
+ .wpuf-cf-table table td{
359
+ padding-left: 0 !important;
360
+ }
361
+
362
+ .wpuf-cf-table .required { color: red;}
363
+ .wpuf-cf-table textarea { width: 400px; }
364
+
365
+ .wpuf-field-google-map {
366
+ height: 300px;
367
+ width: 100%;
368
+ }
369
+ .wpuf-form-google-map {
370
+ height: 300px;
371
+ width: 100%;
372
+ }
373
+ input[type="text"].wpuf-google-map-search {
374
+ margin-top: 10px !important;
375
+ border: 1px solid transparent !important;
376
+ border-radius: 2px 0 0 2px !important;
377
+ box-sizing: border-box !important;
378
+ -moz-box-sizing: border-box !important;
379
+ height: 32px !important;
380
+ outline: none !important;
381
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
382
+ background-color: #fff !important;
383
+ text-overflow: ellipsis !important;
384
+ width: 170px !important;
385
+ font-family: Roboto !important;
386
+ font-size: 15px !important;
387
+ font-weight: 300 !important;
388
+ padding: 0 11px 0 13px !important;
389
+ display: none;
390
+ }
391
+ .gm-style input[type="text"].wpuf-google-map-search {
392
+ display: block;
393
+ }
394
+ .wpuf-form-google-map-container input[type="text"].wpuf-google-map-search {
395
+ width: 230px !important;
396
+ }
397
+ .wpuf-form-google-map-container.hide-search-box .gm-style input[type="text"].wpuf-google-map-search {
398
+ display: none;
399
+ }
400
+
401
+ </style>
402
+ <?php
403
+ }
404
+
405
+ /**
406
+ * save post meta
407
+ *
408
+ * @since 2.5
409
+ *
410
+ * @param int $post_id
411
+ * @param object $post
412
+ *
413
+ * @return void
414
+ */
415
+ // Save the Metabox Data
416
+ function save_meta( $post_id, $post ) {
417
+ if ( !isset( $_POST['wpuf_cf_update'] ) ) {
418
+ return $post->ID;
419
+ }
420
+
421
+ if ( !wp_verify_nonce( $_POST['wpuf_cf_update'], plugin_basename( __FILE__ ) ) ) {
422
+ return $post->ID;
423
+ }
424
+
425
+ // Is the user allowed to edit the post or page?
426
+ if ( !current_user_can( 'edit_post', $post->ID ) )
427
+ return $post->ID;
428
+
429
+ list( $post_vars, $tax_vars, $meta_vars ) = self::get_input_fields( $_POST['wpuf_cf_form_id'] );
430
+
431
+ WPUF_Frontend_Form_Post::update_post_meta( $meta_vars, $post->ID );
432
+ }
433
+
434
+ }
admin/promotion.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Promotional offer class
5
+ */
6
+ class WPUF_Admin_Promotion {
7
+
8
+ public function __construct() {
9
+ add_action( 'admin_notices', array( $this, 'promotional_offer' ) );
10
+ add_action( 'wp_ajax_wpuf-dismiss-promotional-offer-notice', array( $this, 'dismiss_promotional_offer' ) );
11
+ }
12
+
13
+ /**
14
+ * Promotional offer notice
15
+ *
16
+ * @since 1.1.15
17
+ *
18
+ * @return void
19
+ */
20
+ public function promotional_offer() {
21
+ // Show only to Admins
22
+ if ( ! current_user_can( 'manage_options' ) ) {
23
+ return;
24
+ }
25
+
26
+ // 2017-03-22 23:59:00
27
+ if ( time() > 1490227140 ) {
28
+ return;
29
+ }
30
+
31
+ // check if it has already been dismissed
32
+ $hide_notice = get_option( 'wpuf_promotional_offer_notice', 'no' );
33
+
34
+ if ( 'hide' == $hide_notice ) {
35
+ return;
36
+ }
37
+
38
+ $product_text = ( ! wpuf()->is_pro() ) ? __( 'Pro upgrade and all extensions, ', 'wpuf' ) : __( 'all extensions, ', 'wpuf' );
39
+
40
+ $offer_msg = __( '<h2><span class="dashicons dashicons-awards"></span> weDevs 4th Year Anniversary Offer</h2>', 'erp' );
41
+ $offer_msg .= sprintf( __( '<p>Get <strong class="highlight-text">44&#37; discount</strong> on %2$s also <a target="_blank" href="%1$s"><strong>WIN any product</strong></a> from our 4th year anniversary giveaway. Offer ending soon!</p>', 'wpuf' ), 'https://wedevs.com/in/4years/?utm_source=freeplugin&utm_medium=prompt&utm_term=wpuf_plugin&utm_content=textlink&utm_campaign=wedevs_4_years', $product_text );
42
+ ?>
43
+ <div class="notice is-dismissible" id="wpuf-promotional-offer-notice">
44
+ <table>
45
+ <tbody>
46
+ <tr>
47
+ <td class="image-container">
48
+ <img src="https://ps.w.org/wp-user-frontend/assets/icon-256x256.png" alt="">
49
+ </td>
50
+ <td class="message-container">
51
+ <?php echo $offer_msg; ?>
52
+ </td>
53
+ </tr>
54
+ </tbody>
55
+ </table>
56
+
57
+ <span class="dashicons dashicons-megaphone"></span>
58
+ </div><!-- #wpuf-promotional-offer-notice -->
59
+
60
+ <style>
61
+ #wpuf-promotional-offer-notice {
62
+ background-color: #4caf50;
63
+ border: 0px;
64
+ padding: 0;
65
+ opacity: 0;
66
+ }
67
+
68
+ .wrap > #wpuf-promotional-offer-notice {
69
+ opacity: 1;
70
+ }
71
+
72
+ #wpuf-promotional-offer-notice table {
73
+ border-collapse: collapse;
74
+ width: 100%;
75
+ }
76
+
77
+ #wpuf-promotional-offer-notice table td {
78
+ padding: 0;
79
+ }
80
+
81
+ #wpuf-promotional-offer-notice table td.image-container {
82
+ background-color: #fff;
83
+ vertical-align: middle;
84
+ width: 95px;
85
+ }
86
+
87
+
88
+ #wpuf-promotional-offer-notice img {
89
+ max-width: 100%;
90
+ max-height: 100px;
91
+ vertical-align: middle;
92
+ }
93
+
94
+ #wpuf-promotional-offer-notice table td.message-container {
95
+ padding: 0 10px;
96
+ }
97
+
98
+ #wpuf-promotional-offer-notice h2{
99
+ color: rgba(250, 250, 250, 0.77);
100
+ margin-bottom: 10px;
101
+ font-weight: normal;
102
+ margin: 16px 0 14px;
103
+ -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
104
+ -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
105
+ -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
106
+ text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
107
+ }
108
+
109
+
110
+ #wpuf-promotional-offer-notice h2 span {
111
+ position: relative;
112
+ top: 0;
113
+ }
114
+
115
+ #wpuf-promotional-offer-notice p{
116
+ color: rgba(250, 250, 250, 0.77);
117
+ font-size: 14px;
118
+ margin-bottom: 10px;
119
+ -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
120
+ -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
121
+ -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
122
+ text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
123
+ }
124
+
125
+ #wpuf-promotional-offer-notice p strong.highlight-text{
126
+ color: #fff;
127
+ }
128
+
129
+ #wpuf-promotional-offer-notice p a {
130
+ color: #fafafa;
131
+ }
132
+
133
+ #wpuf-promotional-offer-notice .notice-dismiss:before {
134
+ color: #fff;
135
+ }
136
+
137
+ #wpuf-promotional-offer-notice span.dashicons-megaphone {
138
+ position: absolute;
139
+ bottom: 46px;
140
+ right: 119px;
141
+ color: rgba(253, 253, 253, 0.29);
142
+ font-size: 96px;
143
+ transform: rotate(-21deg);
144
+ }
145
+
146
+ </style>
147
+
148
+ <script type='text/javascript'>
149
+ jQuery('body').on('click', '#wpuf-promotional-offer-notice .notice-dismiss', function(e) {
150
+ e.preventDefault();
151
+
152
+ wp.ajax.post('wpuf-dismiss-promotional-offer-notice', {
153
+ dismissed: true
154
+ });
155
+ });
156
+ </script>
157
+ <?php
158
+ }
159
+
160
+
161
+ /**
162
+ * Dismiss promotion notice
163
+ *
164
+ * @since 2.5
165
+ *
166
+ * @return void
167
+ */
168
+ public function dismiss_promotional_offer() {
169
+ if ( ! empty( $_POST['dismissed'] ) ) {
170
+ $offer_key = 'wpuf_promotional_offer_notice';
171
+ update_option( $offer_key, 'hide' );
172
+ }
173
+ }
174
+ }
admin/settings-options.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Settings Sections
5
+ *
6
+ * @since 1.0
7
+ * @return array
8
+ */
9
+ function wpuf_settings_sections() {
10
+ $sections = array(
11
+ array(
12
+ 'id' => 'wpuf_general',
13
+ 'title' => __( 'General Options', 'wpuf' )
14
+ ),
15
+ array(
16
+ 'id' => 'wpuf_dashboard',
17
+ 'title' => __( 'Dashboard', 'wpuf' )
18
+ ),
19
+ array(
20
+ 'id' => 'wpuf_profile',
21
+ 'title' => __( 'Login / Registration', 'wpuf' )
22
+ ),
23
+ array(
24
+ 'id' => 'wpuf_payment',
25
+ 'title' => __( 'Payments', 'wpuf' )
26
+ ),
27
+ array(
28
+ 'id' => 'wpuf_support',
29
+ 'title' => __( 'Support', 'wpuf' )
30
+ ),
31
+ );
32
+
33
+ return apply_filters( 'wpuf_settings_sections', $sections );
34
+ }
35
+
36
+ function wpuf_settings_fields() {
37
+ $pages = wpuf_get_pages();
38
+ $users = wpuf_list_users();
39
+
40
+ $all_currencies = wpuf_get_currencies();
41
+
42
+ $currencies = array();
43
+ foreach ( $all_currencies as $currency ) {
44
+ $currencies[ $currency['currency'] ] = $currency['label'] . ' (' . $currency['symbol'] . ')';
45
+ }
46
+
47
+ $default_currency_symbol = wpuf_get_currency( 'symbol' );
48
+
49
+ $settings_fields = array(
50
+ 'wpuf_general' => apply_filters( 'wpuf_options_others', array(
51
+ array(
52
+ 'name' => 'fixed_form_element',
53
+ 'label' => __( 'Fixed Form Elements ', 'wpuf' ),
54
+ 'desc' => __( 'Show fixed form elements sidebar in form editor', 'wpuf' ),
55
+ 'type' => 'checkbox',
56
+ 'default' => 'on'
57
+ ),
58
+ array(
59
+ 'name' => 'edit_page_id',
60
+ 'label' => __( 'Edit Page', 'wpuf' ),
61
+ 'desc' => __( 'Select the page where [wpuf_edit] is located', 'wpuf' ),
62
+ 'type' => 'select',
63
+ 'options' => $pages
64
+ ),
65
+ array(
66
+ 'name' => 'default_post_owner',
67
+ 'label' => __( 'Default Post Owner', 'wpuf' ),
68
+ 'desc' => __( 'If guest post is enabled and user details are OFF, the posts are assigned to this user', 'wpuf' ),
69
+ 'type' => 'select',
70
+ 'options' => $users,
71
+ 'default' => '1'
72
+ ),
73
+ array(
74
+ 'name' => 'admin_access',
75
+ 'label' => __( 'Admin area access', 'wpuf' ),
76
+ 'desc' => __( 'Allow you to block specific user role to WordPress admin area.', 'wpuf' ),
77
+ 'type' => 'select',
78
+ 'default' => 'read',
79
+ 'options' => array(
80
+ 'manage_options' => __( 'Admin Only', 'wpuf' ),
81
+ 'edit_others_posts' => __( 'Admins, Editors', 'wpuf' ),
82
+ 'publish_posts' => __( 'Admins, Editors, Authors', 'wpuf' ),
83
+ 'edit_posts' => __( 'Admins, Editors, Authors, Contributors', 'wpuf' ),
84
+ 'read' => __( 'Default', 'wpuf' )
85
+ )
86
+ ),
87
+ array(
88
+ 'name' => 'override_editlink',
89
+ 'label' => __( 'Override the post edit link', 'wpuf' ),
90
+ 'desc' => __( 'Users see the edit link in post if s/he is capable to edit the post/page. Selecting <strong>Yes</strong> will override the default WordPress edit post link in frontend', 'wpuf' ),
91
+ 'type' => 'select',
92
+ 'default' => 'yes',
93
+ 'options' => array(
94
+ 'yes' => __( 'Yes', 'wpuf' ),
95
+ 'no' => __( 'No', 'wpuf' )
96
+ )
97
+ ),
98
+ array(
99
+ 'name' => 'cf_show_front',
100
+ 'label' => __( 'Custom Fields in post', 'wpuf' ),
101
+ 'desc' => __( 'Show custom fields on post content area', 'wpuf' ),
102
+ 'type' => 'checkbox',
103
+ 'default' => 'off'
104
+ ),
105
+ array(
106
+ 'name' => 'load_script',
107
+ 'label' => __( 'Load Scripts', 'wpuf' ),
108
+ 'desc' => __( 'Load scripts/styles in all pages', 'wpuf' ),
109
+ 'type' => 'checkbox',
110
+ 'default' => 'on'
111
+ ),
112
+ array(
113
+ 'name' => 'insert_photo_size',
114
+ 'label' => __( 'Insert Photo image size', 'wpuf' ),
115
+ 'desc' => __( 'Default image size of "<strong>Insert Photo</strong>" button in post content area', 'wpuf' ),
116
+ 'type' => 'select',
117
+ 'options' => wpuf_get_image_sizes(),
118
+ 'default' => 'thumbnail'
119
+ ),
120
+ array(
121
+ 'name' => 'insert_photo_type',
122
+ 'label' => __( 'Insert Photo image type', 'wpuf' ),
123
+ 'desc' => __( 'Default image type of "<strong>Insert Photo</strong>" button in post content area', 'wpuf' ),
124
+ 'type' => 'select',
125
+ 'options' => array(
126
+ 'image' => __( 'Image only', 'wpuf' ),
127
+ 'link' => __( 'Image with link', 'wpuf' )
128
+ ),
129
+ 'default' => 'link'
130
+ ),
131
+ array(
132
+ 'name' => 'image_caption',
133
+ 'label' => __( 'Enable Image Caption', 'wpuf' ),
134
+ 'desc' => __( 'Allow users to update image/video title, caption and description', 'wpuf' ),
135
+ 'type' => 'checkbox',
136
+ 'default' => 'off'
137
+ ),
138
+ array(
139
+ 'name' => 'default_post_form',
140
+ 'label' => __( 'Default Post Form', 'wpuf' ),
141
+ 'desc' => __( 'Fallback form for post editing if no associated form found', 'wpuf' ),
142
+ 'type' => 'select',
143
+ 'options' => wpuf_get_pages( 'wpuf_forms' )
144
+ ),
145
+ array(
146
+ 'name' => 'recaptcha_public',
147
+ 'label' => __( 'reCAPTCHA Site Key', 'wpuf' ),
148
+ ),
149
+ array(
150
+ 'name' => 'recaptcha_private',
151
+ 'label' => __( 'reCAPTCHA Secret Key', 'wpuf' ),
152
+ 'desc' => __( '<a target="_blank" href="https://www.google.com/recaptcha/">Register here</a> to get reCaptcha Site and Secret keys.', 'wpuf' ),
153
+ ),
154
+ array(
155
+ 'name' => 'gmap_api_key',
156
+ 'label' => __( 'Google Map API', 'wpuf' ),
157
+ 'desc' => __( '<a target="_blank" href="https://developers.google.com/maps/documentation/javascript">API</a> key is needed to render Google Maps', 'wpuf' ),
158
+ ),
159
+ array(
160
+ 'name' => 'custom_css',
161
+ 'label' => __( 'Custom CSS codes', 'wpuf' ),
162
+ 'desc' => __( 'If you want to add your custom CSS code, it will be added on page header wrapped with style tag', 'wpuf' ),
163
+ 'type' => 'textarea'
164
+ ),
165
+ ) ),
166
+ 'wpuf_dashboard' => apply_filters( 'wpuf_options_dashboard', array(
167
+ array(
168
+ 'name' => 'enable_post_edit',
169
+ 'label' => __( 'Users can edit post?', 'wpuf' ),
170
+ 'desc' => __( 'Users will be able to edit their own posts', 'wpuf' ),
171
+ 'type' => 'select',
172
+ 'default' => 'yes',
173
+ 'options' => array(
174
+ 'yes' => __( 'Yes', 'wpuf' ),
175
+ 'no' => __( 'No', 'wpuf' )
176
+ )
177
+ ),
178
+ array(
179
+ 'name' => 'enable_post_del',
180
+ 'label' => __( 'User can delete post?', 'wpuf' ),
181
+ 'desc' => __( 'Users will be able to delete their own posts', 'wpuf' ),
182
+ 'type' => 'select',
183
+ 'default' => 'yes',
184
+ 'options' => array(
185
+ 'yes' => __( 'Yes', 'wpuf' ),
186
+ 'no' => __( 'No', 'wpuf' )
187
+ )
188
+ ),
189
+ array(
190
+ 'name' => 'disable_pending_edit',
191
+ 'label' => __( 'Pending Post Edit', 'wpuf' ),
192
+ 'desc' => __( 'Disable post editing while post in "pending" status', 'wpuf' ),
193
+ 'type' => 'checkbox',
194
+ 'default' => 'on'
195
+ ),
196
+ array(
197
+ 'name' => 'per_page',
198
+ 'label' => __( 'Posts per page', 'wpuf' ),
199
+ 'desc' => __( 'How many posts will be listed in a page', 'wpuf' ),
200
+ 'type' => 'text',
201
+ 'default' => '10'
202
+ ),
203
+ array(
204
+ 'name' => 'show_user_bio',
205
+ 'label' => __( 'Show user bio', 'wpuf' ),
206
+ 'desc' => __( 'Users biographical info will be shown', 'wpuf' ),
207
+ 'type' => 'checkbox',
208
+ 'default' => 'on'
209
+ ),
210
+ array(
211
+ 'name' => 'show_post_count',
212
+ 'label' => __( 'Show post count', 'wpuf' ),
213
+ 'desc' => __( 'Show how many posts are created by the user', 'wpuf' ),
214
+ 'type' => 'checkbox',
215
+ 'default' => 'on'
216
+ ),
217
+ array(
218
+ 'name' => 'show_ft_image',
219
+ 'label' => __( 'Show Featured Image', 'wpuf' ),
220
+ 'desc' => __( 'Show featured image of the post', 'wpuf' ),
221
+ 'type' => 'checkbox'
222
+ ),
223
+ array(
224
+ 'name' => 'ft_img_size',
225
+ 'label' => __( 'Featured Image size', 'wpuf' ),
226
+ 'type' => 'select',
227
+ 'options' => wpuf_get_image_sizes()
228
+ ),
229
+ array(
230
+ 'name' => 'un_auth_msg',
231
+ 'label' => __( 'Unauthorized Message', 'wpuf' ),
232
+ 'desc' => __( 'Not logged in users will see this message', 'wpuf' ),
233
+ 'type' => 'textarea'
234
+ ),
235
+ ) ),
236
+ 'wpuf_profile' => array(
237
+ array(
238
+ 'name' => 'autologin_after_registration',
239
+ 'label' => __( 'Auto Login After Registration', 'wpuf' ),
240
+ 'desc' => __( 'If enabled, users after registration will be logged in to the system', 'wpuf' ),
241
+ 'type' => 'checkbox',
242
+ 'default' => 'off'
243
+ ),
244
+ array(
245
+ 'name' => 'register_link_override',
246
+ 'label' => __( 'Login/Registration override', 'wpuf' ),
247
+ 'desc' => __( 'If enabled, default login and registration forms will be overridden by WPUF with pages below', 'wpuf' ),
248
+ 'type' => 'checkbox',
249
+ 'default' => 'off'
250
+ ),
251
+ array(
252
+ 'name' => 'reg_override_page',
253
+ 'label' => __( 'Registration Page', 'wpuf' ),
254
+ 'desc' => __( 'Select the page you want to use as registration page override <em>(should have shortcode)</em>', 'wpuf' ),
255
+ 'type' => 'select',
256
+ 'options' => $pages
257
+ ),
258
+ array(
259
+ 'name' => 'login_page',
260
+ 'label' => __( 'Login Page', 'wpuf' ),
261
+ 'desc' => __( 'Select the page which contains <code>[wpuf-login]</code> shortcode', 'wpuf' ),
262
+ 'type' => 'select',
263
+ 'options' => $pages
264
+ ),
265
+ ),
266
+ 'wpuf_payment' => apply_filters( 'wpuf_options_payment', array(
267
+ array(
268
+ 'name' => 'charge_posting',
269
+ 'label' => __( 'Charge for posting', 'wpuf' ),
270
+ 'desc' => __( 'Charge user for submitting a post', 'wpuf' ),
271
+ 'type' => 'select',
272
+ 'default' => 'no',
273
+ 'options' => array(
274
+ 'yes' => __( 'Yes', 'wpuf' ),
275
+ 'no' => __( 'No', 'wpuf' )
276
+ )
277
+ ),
278
+ array(
279
+ 'name' => 'force_pack',
280
+ 'label' => __( 'Force pack purchase', 'wpuf' ),
281
+ 'desc' => __( 'When active, users must have to buy a pack for posting', 'wpuf' ),
282
+ 'type' => 'select',
283
+ 'default' => 'no',
284
+ 'options' => array(
285
+ 'no' => __( 'Disable', 'wpuf' ),
286
+ 'yes' => __( 'Enable', 'wpuf' )
287
+ )
288
+ ),
289
+ array(
290
+ 'name' => 'subscription_page',
291
+ 'label' => __( 'Subscription Pack Page', 'wpuf' ),
292
+ 'desc' => __( 'Select the page where <code>[wpuf_sub_pack]</code> located.', 'wpuf' ),
293
+ 'type' => 'select',
294
+ 'options' => $pages
295
+ ),
296
+ array(
297
+ 'name' => 'register_subscription',
298
+ 'label' => __( 'Subscription at registration', 'wpuf' ),
299
+ 'desc' => __( 'Registration time redirect to subscription page', 'wpuf' ),
300
+ 'type' => 'checkbox',
301
+ ),
302
+ array(
303
+ 'name' => 'currency',
304
+ 'label' => __( 'Currency', 'wpuf' ),
305
+ 'type' => 'select',
306
+ 'default' => 'USD',
307
+ 'options' => $currencies
308
+ ),
309
+ array(
310
+ 'name' => 'currency_position',
311
+ 'label' => __( 'Currency Position', 'wpuf' ),
312
+ 'type' => 'select',
313
+ 'default' => 'left',
314
+ 'options' => array(
315
+ 'left' => sprintf( '%1$s (%2$s99.99)', __( 'Left', 'wpuf' ), $default_currency_symbol ),
316
+ 'right' => sprintf( '%1$s (99.99%2$s)', __( 'Right', 'wpuf' ), $default_currency_symbol ),
317
+ 'left_space' => sprintf( '%1$s (%2$s 99.99)', __( 'Left with space', 'wpuf' ), $default_currency_symbol ),
318
+ 'right_space' => sprintf( '%1$s (99.99 %2$s)', __( 'Right with space', 'wpuf' ), $default_currency_symbol ),
319
+ )
320
+ ),
321
+ array(
322
+ 'name' => 'wpuf_price_thousand_sep',
323
+ 'label' => __( 'Thousand Separator', 'wpuf' ),
324
+ 'desc' => __( 'This sets the thousand separator of displayed prices.', 'wpuf' ),
325
+ 'css' => 'width:50px;',
326
+ 'default' => ',',
327
+ 'type' => 'text',
328
+ 'desc_tip' => true,
329
+ ),
330
+ array(
331
+ 'name' => 'wpuf_price_decimal_sep',
332
+ 'label' => __( 'Decimal Separator', 'wpuf' ),
333
+ 'desc' => __( 'This sets the decimal separator of displayed prices.', 'wpuf' ),
334
+ 'default' => '.',
335
+ 'type' => 'text',
336
+ ),
337
+
338
+ array(
339
+ 'name' => 'wpuf_price_num_decimals',
340
+ 'label' => __( 'Number of Decimals', 'wpuf' ),
341
+ 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'wpuf' ),
342
+ 'default' => '2',
343
+ 'type' => 'number',
344
+ 'custom_attributes' => array(
345
+ 'min' => 0,
346
+ 'step' => 1
347
+ )
348
+ ),
349
+ array(
350
+ 'name' => 'cost_per_post',
351
+ 'label' => __( 'Cost', 'wpuf' ),
352
+ 'desc' => __( 'Cost per post in - <span>' . wpuf_get_currency( 'code' ) . ' ( ' . wpuf_get_currency( 'symbol' ) . '</span> )', 'wpuf' ),
353
+ 'type' => 'text',
354
+ 'default' => '2'
355
+ ),
356
+ array(
357
+ 'name' => 'sandbox_mode',
358
+ 'label' => __( 'Enable demo/sandbox mode', 'wpuf' ),
359
+ 'desc' => __( 'When sandbox mode is active, all payment gateway will be used in demo mode', 'wpuf' ),
360
+ 'type' => 'checkbox',
361
+ 'default' => 'on'
362
+ ),
363
+ array(
364
+ 'name' => 'payment_page',
365
+ 'label' => __( 'Payment Page', 'wpuf' ),
366
+ 'desc' => __( 'This page will be used to process payment options', 'wpuf' ),
367
+ 'type' => 'select',
368
+ 'options' => $pages
369
+ ),
370
+ array(
371
+ 'name' => 'payment_success',
372
+ 'label' => __( 'Payment Success Page', 'wpuf' ),
373
+ 'desc' => __( 'After payment users will be redirected here', 'wpuf' ),
374
+ 'type' => 'select',
375
+ 'options' => $pages
376
+ ),
377
+ array(
378
+ 'name' => 'active_gateways',
379
+ 'label' => __( 'Payment Gateways', 'wpuf' ),
380
+ 'desc' => __( 'Active payment gateways', 'wpuf' ),
381
+ 'type' => 'multicheck',
382
+ 'options' => wpuf_get_gateways()
383
+ )
384
+ ) ),
385
+ 'wpuf_support' => apply_filters( 'wpuf_options_support', array(
386
+ array(
387
+ 'name' => 'support',
388
+ 'label' => __( 'Need Help?', 'wpuf' ),
389
+ 'type' => 'html',
390
+ 'desc' => '
391
+ <ul>
392
+ <li>
393
+ <strong>Step 1: <a target="_blank" href="http://docs.wedevs.com/">Read Documentation and FAQ</a></strong>
394
+ <p>We have created detailed step by step documentation for all the features (including docs for developers). We have also answered all possible FAQ queries based on user request. We hope you will find what you are looking for. If not, please continue to Step 2.</p>
395
+ </li>
396
+ <br/>
397
+ <li>
398
+ <strong>Step 2: <a href="https://wedevs.com/account/tickets" target="_blank">Create a Support Ticket</a></strong>
399
+ <p>We reply from <code>10am to 6pm (GMT+6)</code> except <code><strong>Friday</strong></code>. Our responses are usually under 12 hours to as quick as 1 hour depending on channel pressure.</p>
400
+ <p>When you are creating a ticket, please care to include a screenshot of the issue if possible and write the problem as specificly as you can. This will help us track and solve your trouble quickly.
401
+ </p>
402
+ </li>
403
+ </ul>'
404
+ )
405
+ ) ),
406
+ );
407
+
408
+ return apply_filters( 'wpuf_settings_fields', $settings_fields );
409
+ }
410
+
411
+ function wpuf_settings_field_profile( $form ) {
412
+ $user_roles = wpuf_get_user_roles();
413
+ $forms = get_posts( array(
414
+ 'numberposts' => -1,
415
+ 'post_type' => 'wpuf_profile'
416
+ ) );
417
+
418
+ $val = get_option( 'wpuf_profile', array() );
419
+ ?>
420
+
421
+ <p style="padding-left: 10px; font-style: italic; font-size: 13px;">
422
+ <strong><?php _e( 'Select profile/registration forms for user roles. These forms will be used to populate extra edit profile fields in backend.', 'wpuf' ); ?></strong>
423
+ </p>
424
+ <table class="form-table">
425
+ <?php
426
+ foreach ($user_roles as $role => $name) {
427
+ $current = isset( $val['roles'][$role] ) ? $val['roles'][$role] : '';
428
+ ?>
429
+ <tr valign="top">
430
+ <th scrope="row"><?php echo $name; ?></th>
431
+ <td>
432
+ <select name="wpuf_profile[roles][<?php echo $role; ?>]">
433
+ <option value=""><?php _e( ' - select - ', 'wpuf' ); ?></option>
434
+ <?php foreach ($forms as $form) { ?>
435
+ <option value="<?php echo $form->ID; ?>"<?php selected( $current, $form->ID ); ?>><?php echo $form->post_title; ?></option>
436
+ <?php } ?>
437
+ </select>
438
+ </td>
439
+ </tr>
440
+ <?php } ?>
441
+ </table>
442
+ <?php
443
+ }
444
+
445
+ add_action( 'wsa_form_bottom_wpuf_profile', 'wpuf_settings_field_profile' );
admin/settings.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WordPress settings API demo class
5
+ *
6
+ * @author Tareq Hasan
7
+ */
8
+ class WPUF_Admin_Settings {
9
+
10
+ private $settings_api;
11
+ private static $_instance;
12
+
13
+ function __construct() {
14
+
15
+ if ( ! class_exists( 'WeDevs_Settings_API' ) ) {
16
+ require_once dirname( dirname( __FILE__ ) ) . '/lib/class.settings-api.php';
17
+ }
18
+
19
+ $this->settings_api = new WeDevs_Settings_API();
20
+
21
+ add_action( 'admin_init', array($this, 'admin_init') );
22
+ add_action( 'admin_menu', array($this, 'admin_menu') );
23
+
24
+ add_filter( 'parent_file', array($this, 'fix_parent_menu' ) );
25
+
26
+ add_action( 'admin_init', array($this, 'handle_tools_action') );
27
+ }
28
+
29
+ public static function init() {
30
+ if ( !self::$_instance ) {
31
+ self::$_instance = new self();
32
+ }
33
+
34
+ return self::$_instance;
35
+ }
36
+
37
+ function admin_init() {
38
+
39
+ //set the settings
40
+ $this->settings_api->set_sections( $this->get_settings_sections() );
41
+ $this->settings_api->set_fields( $this->get_settings_fields() );
42
+
43
+ //initialize settings
44
+ $this->settings_api->admin_init();
45
+ }
46
+
47
+ /**
48
+ * Register the admin menu
49
+ *
50
+ * @since 1.0
51
+ */
52
+ function admin_menu() {
53
+ $capability = wpuf_admin_role();
54
+
55
+ add_menu_page( __( 'WP User Frontend', 'wpuf' ), __( 'User Frontend', 'wpuf' ), $capability, 'wp-user-frontend', array($this, 'wpuf_post_forms_page'), 'dashicons-exerpt-view', 55 );
56
+
57
+ add_submenu_page( 'wp-user-frontend', __( 'Post Forms', 'wpuf' ), __( 'Post Forms' ), $capability, 'wpuf-post-forms', array( $this, 'wpuf_post_forms_page' ) );
58
+ remove_submenu_page( 'wp-user-frontend', 'wp-user-frontend' );
59
+
60
+ /**
61
+ * @since 2.3
62
+ */
63
+ do_action( 'wpuf_admin_menu_top' );
64
+
65
+ add_submenu_page( 'wp-user-frontend', __( 'Subscriptions', 'wpuf' ), __( 'Subscriptions', 'wpuf' ), $capability, 'edit.php?post_type=wpuf_subscription' );
66
+
67
+ do_action( 'wpuf_admin_menu' );
68
+
69
+ $transactions_page = add_submenu_page( 'wp-user-frontend', __( 'Transactions', 'wpuf' ), __( 'Transactions', 'wpuf' ), $capability, 'wpuf_transaction', array($this, 'transactions_page') );
70
+ add_submenu_page( 'wp-user-frontend', __( 'Add-ons', 'wpuf' ), __( 'Add-ons', 'wpuf' ), $capability, 'wpuf_addons', array($this, 'addons_page') );
71
+ add_submenu_page( 'wp-user-frontend', __( 'Tools', 'wpuf' ), __( 'Tools', 'wpuf' ), $capability, 'wpuf_tools', array($this, 'tools_page') );
72
+ add_submenu_page( 'wp-user-frontend', __( 'Settings', 'wpuf' ), __( 'Settings', 'wpuf' ), $capability, 'wpuf-settings', array($this, 'plugin_page') );
73
+
74
+ add_action( "load-$transactions_page", array( $this, 'transactions_screen_option' ) );
75
+ add_action( "load-$transactions_page", array( $this, 'enqueue_styles' ) );
76
+ }
77
+
78
+ /**
79
+ * WPUF Settings sections
80
+ *
81
+ * @since 1.0
82
+ * @return array
83
+ */
84
+ function get_settings_sections() {
85
+ return wpuf_settings_sections();
86
+ }
87
+
88
+ /**
89
+ * Returns all the settings fields
90
+ *
91
+ * @return array settings fields
92
+ */
93
+ function get_settings_fields() {
94
+ return wpuf_settings_fields();
95
+ }
96
+
97
+ function plugin_page() {
98
+ ?>
99
+ <div class="wrap">
100
+
101
+ <?php screen_icon( 'options-general' ); ?>
102
+
103
+ <?php
104
+ settings_errors();
105
+
106
+ $this->settings_api->show_navigation();
107
+ $this->settings_api->show_forms();
108
+ ?>
109
+
110
+ </div>
111
+ <?php
112
+ }
113
+
114
+ function transactions_page() {
115
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/transactions.php';
116
+ }
117
+
118
+ /**
119
+ * Callback method for Post Forms submenu
120
+ *
121
+ * @since 2.5
122
+ *
123
+ * @return void
124
+ */
125
+ function wpuf_post_forms_page() {
126
+ $action = isset( $_GET['action'] ) ? $_GET['action'] : null;
127
+ $add_new_page_url = admin_url( 'admin.php?page=wpuf-post-forms&action=add-new' );
128
+
129
+ switch ( $action ) {
130
+ case 'edit':
131
+ require_once WPUF_ROOT . '/views/post-form.php';
132
+ break;
133
+
134
+ case 'add-new':
135
+ require_once WPUF_ROOT . '/views/post-form.php';
136
+ break;
137
+
138
+ default:
139
+ require_once WPUF_ROOT . '/admin/post-forms-list-table-view.php';
140
+ break;
141
+ }
142
+ }
143
+
144
+ function subscription_page() {
145
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/subscription.php';
146
+ }
147
+
148
+ function addons_page() {
149
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/add-ons.php';
150
+ }
151
+
152
+ function tools_page() {
153
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/tools.php';
154
+ }
155
+
156
+ /**
157
+ * highlight the proper top level menu
158
+ *
159
+ * @link http://wordpress.org/support/topic/moving-taxonomy-ui-to-another-main-menu?replies=5#post-2432769
160
+ * @global obj $current_screen
161
+ * @param string $parent_file
162
+ * @return string
163
+ */
164
+ function fix_parent_menu( $parent_file ) {
165
+ global $current_screen;
166
+
167
+ $post_types = array( 'wpuf_forms', 'wpuf_profile', 'wpuf_subscription', 'wpuf_coupon');
168
+
169
+ if ( in_array( $current_screen->post_type, $post_types ) ) {
170
+ $parent_file = 'wp-user-frontend';
171
+ }
172
+
173
+ return $parent_file;
174
+ }
175
+
176
+ /**
177
+ * Hanlde tools page action
178
+ *
179
+ * @return void
180
+ */
181
+ function handle_tools_action() {
182
+ if ( ! isset( $_GET['wpuf_action'] ) ) {
183
+ return;
184
+ }
185
+
186
+ check_admin_referer( 'wpuf-tools-action' );
187
+
188
+ if ( ! current_user_can( 'manage_options' ) ) {
189
+ return;
190
+ }
191
+
192
+ global $wpdb;
193
+
194
+ $action = $_GET['wpuf_action'];
195
+ $message = 'del_forms';
196
+
197
+ switch ($action) {
198
+ case 'clear_settings':
199
+ delete_option( 'wpuf_general' );
200
+ delete_option( 'wpuf_dashboard' );
201
+ delete_option( 'wpuf_profile' );
202
+ delete_option( 'wpuf_payment' );
203
+ delete_option( '_wpuf_page_created' );
204
+
205
+ $message = 'settings_cleared';
206
+ break;
207
+
208
+ case 'del_post_forms':
209
+ $this->delete_post_type( 'wpuf_forms' );
210
+ break;
211
+
212
+ case 'del_pro_forms':
213
+ $this->delete_post_type( 'wpuf_profile' );
214
+ break;
215
+
216
+ case 'del_subs':
217
+ $this->delete_post_type( 'wpuf_subscription' );
218
+ break;
219
+
220
+ case 'del_coupon':
221
+ $this->delete_post_type( 'wpuf_coupon' );
222
+ break;
223
+
224
+ case 'clear_transaction':
225
+ $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}wpuf_transaction");
226
+
227
+ $message = 'del_trans';
228
+ break;
229
+
230
+ default:
231
+ # code...
232
+ break;
233
+ }
234
+
235
+ wp_redirect( add_query_arg( array( 'msg' => $message ), admin_url( 'admin.php?page=wpuf_tools&action=tools' ) ) );
236
+ exit;
237
+ }
238
+
239
+ /**
240
+ * Delete all posts by a post type
241
+ *
242
+ * @param string $post_type
243
+ * @return void
244
+ */
245
+ function delete_post_type( $post_type ) {
246
+ $query = new WP_Query( array(
247
+ 'post_type' => $post_type,
248
+ 'posts_per_page' => -1,
249
+ 'post_status' => array( 'publish', 'draft', 'pending', 'trash' )
250
+ ) );
251
+
252
+ $posts = $query->get_posts();
253
+
254
+ if ( $posts ) {
255
+ foreach ($posts as $item) {
256
+ wp_delete_post( $item->ID, true );
257
+ }
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Screen options.
263
+ *
264
+ * @return void
265
+ */
266
+ public function transactions_screen_option() {
267
+ $option = 'per_page';
268
+ $args = array(
269
+ 'label' => __( 'Number of items per page:', 'wpuf' ),
270
+ 'default' => 20,
271
+ 'option' => 'transactions_per_page'
272
+ );
273
+
274
+ add_screen_option( $option, $args );
275
+
276
+ $this->transactions_list_table_obj = new WPUF_Transactions_List_Table();
277
+ }
278
+
279
+ /**
280
+ * Enqueue styles
281
+ *
282
+ * @return void
283
+ */
284
+ public function enqueue_styles() {
285
+ wp_enqueue_style( 'wpuf-admin', WPUF_ASSET_URI . '/css/admin.css' );
286
+ }
287
+ }
admin/subscription.php ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage Subscription packs
5
+ *
6
+ * @package WP User Frontend
7
+ */
8
+ class WPUF_Admin_Subscription {
9
+
10
+ private $table;
11
+ private $db;
12
+ public $baseurl;
13
+ private static $_instance;
14
+
15
+ public static function getInstance() {
16
+ if ( !self::$_instance ) {
17
+ self::$_instance = new WPUF_Admin_Subscription();
18
+ }
19
+
20
+ return self::$_instance;
21
+ }
22
+
23
+ function __construct() {
24
+ global $wpdb;
25
+
26
+ $this->db = $wpdb;
27
+ $this->table = $this->db->prefix . 'wpuf_subscription';
28
+ $this->baseurl = admin_url( 'admin.php?page=wpuf_subscription' );
29
+
30
+ add_filter( 'post_updated_messages', array($this, 'form_updated_message') );
31
+
32
+ add_action( 'show_user_profile', array($this, 'profile_subscription_details'), 30 );
33
+ add_action( 'edit_user_profile', array($this, 'profile_subscription_details'), 30 );
34
+ add_action( 'personal_options_update', array($this, 'profile_subscription_update') );
35
+ add_action( 'edit_user_profile_update', array($this, 'profile_subscription_update') );
36
+ add_action( 'wp_ajax_wpuf_delete_user_package', array($this, 'delete_user_package') );
37
+
38
+ add_filter('manage_wpuf_subscription_posts_columns', array( $this, 'subscription_columns_head') );
39
+
40
+ add_action('manage_wpuf_subscription_posts_custom_column', array( $this, 'subscription_columns_content' ),10, 2 );
41
+ }
42
+
43
+ /**
44
+ * Custom post update message
45
+ *
46
+ * @param array $messages
47
+ * @return array
48
+ */
49
+ function form_updated_message( $messages ) {
50
+ $message = array(
51
+ 0 => '',
52
+ 1 => __( 'Subscription pack updated.', 'wpuf' ),
53
+ 2 => __( 'Custom field updated.', 'wpuf' ),
54
+ 3 => __( 'Custom field deleted.', 'wpuf' ),
55
+ 4 => __( 'Subscription pack updated.', 'wpuf' ),
56
+ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Subscription pack restored to revision from %s', 'wpuf' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
57
+ 6 => __( 'Subscription pack published.', 'wpuf' ),
58
+ 7 => __( 'Subscription pack saved.', 'wpuf' ),
59
+ 8 => __( 'Subscription pack submitted.', 'wpuf' ),
60
+ 9 => '',
61
+ 10 => __( 'Subscription pack draft updated.', 'wpuf' ),
62
+ );
63
+
64
+ $messages['wpuf_subscription'] = $message;
65
+
66
+ return $messages;
67
+ }
68
+
69
+ /**
70
+ * Update user profile lock
71
+ *
72
+ * @param int $user_id
73
+ */
74
+ function profile_subscription_update( $user_id ) {
75
+ if ( !is_admin() && !current_user_can( 'edit_users' ) ) {
76
+ return;
77
+ }
78
+
79
+ if ( !isset( $_POST['pack_id'] ) ) {
80
+ return;
81
+ }
82
+
83
+ $pack_id = $_POST['pack_id'];
84
+ $user_pack = WPUF_Subscription::get_user_pack( $_POST['user_id'] );
85
+ if ( isset ( $user_pack['pack_id'] ) && $pack_id == $user_pack['pack_id'] ) {
86
+ //updating number of posts
87
+
88
+ if( isset( $user_pack['posts'] ) ) {
89
+
90
+ foreach( $user_pack['posts'] as $post_type => $post_num ) {
91
+ $user_pack['posts'][$post_type] = $_POST[$post_type];
92
+ }
93
+
94
+ }
95
+
96
+ //post expiration enable or disable
97
+
98
+ if( isset( $_POST['is_post_expiration_enabled'] ) ) {
99
+ $user_pack['_enable_post_expiration'] = $_POST['is_post_expiration_enabled'];
100
+ } else {
101
+ unset($user_pack['_enable_post_expiration']);
102
+ }
103
+
104
+ //updating post time
105
+
106
+ if( isset( $_POST['post_expiration_settings'] ) ) {
107
+ echo $user_pack['_post_expiration_time'] = $_POST['post_expiration_settings']['expiration_time_value'].' '.$_POST['post_expiration_settings']['expiration_time_type'];
108
+ }
109
+ if ( isset( $user_pack['recurring'] ) && $user_pack['recurring'] == 'yes' ) {
110
+ foreach ( $user_pack['posts'] as $type => $value ) {
111
+ $user_pack['posts'][$type] = isset( $_POST[$type] ) ? $_POST[$type] : 0;
112
+ }
113
+ } else {
114
+ foreach ( $user_pack['posts'] as $type => $value ) {
115
+ $user_pack['posts'][$type] = isset( $_POST[$type] ) ? $_POST[$type] : 0;
116
+ }
117
+ $user_pack['expire'] = isset( $_POST['expire'] ) ? wpuf_date2mysql( $_POST['expire'] ) : $user_pack['expire'];
118
+ }
119
+ WPUF_Subscription::update_user_subscription_meta( $user_id, $user_pack );
120
+ } else {
121
+ if ( $pack_id == '-1' ) {
122
+ return;
123
+ }
124
+ WPUF_Subscription::init()->new_subscription( $user_id, $pack_id, null, false, $status = null );
125
+ }
126
+ }
127
+
128
+ function subscription_columns_content( $column_name, $post_ID ) {
129
+ switch ( $column_name ) {
130
+ case 'amount':
131
+
132
+ $amount = get_post_meta( $post_ID, '_billing_amount', true );
133
+ if ( intval($amount) == 0 ) {
134
+ $amount = __( 'Free', 'wpuf' );
135
+ } else {
136
+ $amount = wpuf_format_price( $amount );
137
+ }
138
+ echo $amount;
139
+ break;
140
+
141
+ case 'recurring':
142
+
143
+ $recurring = get_post_meta( $post_ID, '_recurring_pay', true );
144
+ if ( $recurring == 'yes' ) {
145
+ _e( 'Yes', 'wpuf' );
146
+ } else {
147
+ _e( 'No', 'wpuf' );
148
+ }
149
+ break;
150
+
151
+ case 'duration':
152
+
153
+ $recurring_pay = get_post_meta( $post_ID, '_recurring_pay', true );
154
+ $billing_cycle_number = get_post_meta( $post_ID, '_billing_cycle_number', true );
155
+ $cycle_period = get_post_meta( $post_ID, '_cycle_period', true );
156
+ if ( $recurring_pay == 'yes' ) {
157
+ echo $billing_cycle_number .' '. $cycle_period . '\'s (cycle)';
158
+ } else {
159
+ $expiration_number = get_post_meta( $post_ID, '_expiration_number', true );
160
+ $expiration_period = get_post_meta( $post_ID, '_expiration_period', true );
161
+ echo $expiration_number .' '. $expiration_period . '\'s';
162
+ }
163
+ break;
164
+ }
165
+
166
+ }
167
+
168
+ function subscription_columns_head( $head ) {
169
+ unset($head['date']);
170
+ $head['title'] = __('Pack Name', 'wpuf' );
171
+ $head['amount'] = __( 'Amount', 'wpuf' );
172
+ $head['recurring'] = __( 'Recurring', 'wpuf' );
173
+ $head['duration'] = __( 'Duration', 'wpuf' );
174
+
175
+ return $head;
176
+ }
177
+
178
+ function get_packs() {
179
+ return $this->db->get_results( "SELECT * FROM {$this->table} ORDER BY created DESC" );
180
+ }
181
+
182
+ function get_pack( $pack_id ) {
183
+ return $this->db->get_row( $this->db->prepare( "SELECT * FROM {$this->table} WHERE id = %d", $pack_id ) );
184
+ }
185
+
186
+ function delete_pack( $pack_id ) {
187
+ $this->db->query( $this->db->prepare( "DELETE FROM {$this->table} WHERE id= %d", $pack_id ) );
188
+ }
189
+
190
+ function list_packs() {
191
+
192
+ //delete packs
193
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == "del" ) {
194
+ check_admin_referer( 'wpuf_pack_del' );
195
+ $this->delete_pack( $_GET['id'] );
196
+ echo '<div class="updated fade" id="message"><p><strong>' . __( 'Pack Deleted', 'wpuf' ) . '</strong></p></div>';
197
+
198
+ echo '<script type="text/javascript">window.location.href = "' . $this->baseurl . '";</script>';
199
+ }
200
+ ?>
201
+
202
+ <table class="widefat meta" style="margin-top: 20px;">
203
+ <thead>
204
+ <tr>
205
+ <th scope="col"><?php _e( 'Name', 'wpuf' ); ?></th>
206
+ <th scope="col"><?php _e( 'Description', 'wpuf' ); ?></th>
207
+ <th scope="col"><?php _e( 'Cost', 'wpuf' ); ?></th>
208
+ <th scope="col"><?php _e( 'Validity', 'wpuf' ); ?></th>
209
+ <th scope="col"><?php _e( 'Post Count', 'wpuf' ); ?></th>
210
+ <th scope="col"><?php _e( 'Action', 'wpuf' ); ?></th>
211
+ </tr>
212
+ </thead>
213
+ <?php
214
+ $packs = $this->get_packs();
215
+ if ( $packs ) {
216
+ $count = 0;
217
+ foreach ($packs as $row) {
218
+ ?>
219
+ <tr valign="top" <?php echo ( ($count % 2) == 0) ? 'class="alternate"' : ''; ?>>
220
+ <td><?php echo stripslashes( htmlspecialchars( $row->name ) ); ?></td>
221
+ <td><?php echo stripslashes( htmlspecialchars( $row->description ) ); ?></td>
222
+ <td><?php echo wpuf_format_price( $row->cost ); ?></td>
223
+ <td><?php echo ( $row->pack_length == 0 ) ? 'Unlimited' : $row->pack_length . ' days'; ?></td>
224
+ <td><?php echo ( $row->count == 0 ) ? 'Unlimited' : $row->count; ?></td>
225
+ <td>
226
+ <a href="<?php echo wp_nonce_url( add_query_arg( array('action' => 'edit', 'pack_id' => $row->id), $this->baseurl, 'wpuf_pack_edit' ) ); ?>">
227
+ <?php _e( 'Edit', 'wpuf' ); ?>
228
+ </a>
229
+ <span class="sep">|</span>
230
+ <a href="<?php echo wp_nonce_url( add_query_arg( array('action' => 'del', 'id' => $row->id), $this->baseurl ), 'wpuf_pack_del' ); ?>" onclick="return confirm('<?php _e( 'Are you sure to delete this pack?', 'wpuf' ); ?>');">
231
+ <?php _e( 'Delete', 'wpuf' ); ?>
232
+ </a>
233
+ </td>
234
+
235
+ </tr>
236
+ <?php
237
+ $count++;
238
+ }
239
+ ?>
240
+ <?php } else { ?>
241
+ <tr>
242
+ <td colspan="6"><?php _e( 'No subscription pack found', 'wpuf' ); ?></td>
243
+ </tr>
244
+ <?php } ?>
245
+
246
+ </table>
247
+ <?php
248
+ }
249
+
250
+ function get_post_types( $post_types = null ) {
251
+
252
+ if ( ! $post_types ) {
253
+ $post_types = WPUF_Subscription::init()->get_all_post_type();
254
+ }
255
+
256
+ ob_start();
257
+
258
+ foreach ( $post_types as $key => $name ) {
259
+ $name = ( $post_types !== null ) ? $name : '';
260
+ ?>
261
+ <tr>
262
+ <th><label for="wpuf-<?php echo esc_attr( $key ); ?>"><?php printf( 'Number of %ss', $key ); ?></label></th>
263
+ <td>
264
+ <input type="text" size="20" style="" id="wpuf-<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( (int)$name ); ?>" name="post_type_name[<?php echo esc_attr( $key ); ?>]" />
265
+ <div><span class="description"><span><?php printf( 'How many %s the user can list with this pack? Enter <strong>-1</strong> for unlimited.', $key ); ?></span></span></div>
266
+ </td>
267
+ </tr>
268
+ <?php
269
+ }
270
+
271
+ return ob_get_clean();
272
+ }
273
+
274
+ function form( $pack_id = null ) {
275
+ global $post;
276
+
277
+ $sub_meta = WPUF_Subscription::init()->get_subscription_meta( $post->ID, $post );
278
+
279
+ $hidden_recurring_class = ( $sub_meta['recurring_pay'] != 'yes' ) ? 'none' : '';
280
+ $hidden_trial_class = ( $sub_meta['trial_status'] != 'yes' ) ? 'none' : '';
281
+ $hidden_expire = ( $sub_meta['recurring_pay'] == 'yes' ) ? 'none' : '';
282
+
283
+ ?>
284
+
285
+ <table class="form-table" style="width: 100%">
286
+ <tbody>
287
+ <input type="hidden" name="wpuf_subscription" id="wpuf_subscription_editor" value="<?php echo wp_create_nonce( 'wpuf_subscription_editor' ); ?>" />
288
+ <tr>
289
+ <th><label><?php _e( 'Pack Description', 'wpuf' ); ?></label></th>
290
+ <td>
291
+ <?php wp_editor( $sub_meta['post_content'], 'post_content', array('editor_height' => 100, 'quicktags' => false, 'media_buttons' => false) ); ?>
292
+ </td>
293
+ </tr>
294
+ <tr>
295
+ <th><label for="wpuf-billing-amount">
296
+ <span class="wpuf-biling-amount wpuf-subcription-expire" style="display: <?php echo $hidden_expire; ?>;"><?php _e( 'Billing amount:', 'wpuf' ); ?></span>
297
+ <span class="wpuf-billing-cycle wpuf-recurring-child" style="display: <?php echo $hidden_recurring_class; ?>;"><?php _e( 'Billing amount each cycle:', 'wpuf' ); ?></span></label></th>
298
+ <td>
299
+ <?php echo wpuf_get_currency( 'symbol' ); ?>
300
+ <input type="text" size="20" style="" id="wpuf-billing-amount" value="<?php echo esc_attr( $sub_meta['billing_amount'] ); ?>" name="billing_amount" />
301
+ <div><span class="description"></span></div>
302
+ </td>
303
+ </tr>
304
+
305
+ <tr class="wpuf-subcription-expire" style="display: <?php echo $hidden_expire; ?>;">
306
+ <th><label for="wpuf-expiration-number"><?php _e( 'Expires In:', 'wpuf' ); ?></label></th>
307
+ <td>
308
+ <input type="text" size="20" style="" id="wpuf-expiration-number" value="<?php echo esc_attr( $sub_meta['expiration_number'] ); ?>" name="expiration_number" />
309
+
310
+ <select id="expiration-period" name="expiration_period">
311
+ <?php echo $this->option_field( $sub_meta['expiration_period'] ); ?>
312
+ </select>
313
+ <div><span class="description"></span></div>
314
+ </td>
315
+ </tr>
316
+
317
+ <?php
318
+ $is_post_exp_selected = isset($sub_meta['_enable_post_expiration']) && $sub_meta['_enable_post_expiration'] == 'on'?'checked':'';
319
+ $_post_expiration_time = explode(' ',isset($sub_meta['_post_expiration_time'])?$sub_meta['_post_expiration_time']:' ');
320
+ $time_value = isset($_post_expiration_time[0])?$_post_expiration_time[0]:1;
321
+ $time_type = isset($_post_expiration_time[1])?$_post_expiration_time[1]:'day';
322
+
323
+ $expired_post_status = isset($sub_meta['_expired_post_status'])?$sub_meta['_expired_post_status']:'';
324
+ $is_enable_mail_after_expired = isset($sub_meta['_enable_mail_after_expired']) && $sub_meta['_enable_mail_after_expired'] == 'on'?'checked':'';
325
+ $post_expiration_message = isset($sub_meta['_post_expiration_message'])?$sub_meta['_post_expiration_message']:'';;
326
+ ?>
327
+ <tr class="wpuf-metabox-post_expiration">
328
+ <th><?php _e( 'Enable Post Expiration', 'wpuf' ); ?></th>
329
+ <td>
330
+ <input type="checkbox" id="wpuf-enable_post_expiration" name="post_expiration_settings[enable_post_expiration]" value="on" <?php echo $is_post_exp_selected;?> />
331
+ </td>
332
+ </tr>
333
+ <tr class="wpuf-metabox-post_expiration wpuf_expiration_field">
334
+ <?php
335
+ $timeType_array = array(
336
+ 'year' => 100,
337
+ 'month' => 12,
338
+ 'day' => 30
339
+ );
340
+ ?>
341
+ <th><?php _e( 'Post Expiration Time', 'wpuf' ); ?></th>
342
+ <td>
343
+ <select name="post_expiration_settings[expiration_time_value]" id="wpuf-expiration_time_value">
344
+ <?php
345
+ for($i = 1;$i <= $timeType_array[$time_type];$i++){
346
+ ?>
347
+ <option value="<?php echo $i; ?>" <?php echo $i == $time_value?'selected':''; ?>><?php echo $i;?></option>
348
+ <?php
349
+ }
350
+ ?>
351
+ </select>
352
+ <select name="post_expiration_settings[expiration_time_type]" id="wpuf-expiration_time_type">
353
+ <?php
354
+ foreach($timeType_array as $each_time_type=>$each_time_type_val){
355
+ ?>
356
+ <option value="<?php echo $each_time_type;?>" <?php echo $each_time_type==$time_type?'selected':''; ?>><?php echo ucfirst($each_time_type);?></option>
357
+ <?php
358
+ }
359
+ ?>
360
+ </select>
361
+ </td>
362
+
363
+ </tr>
364
+ <tr class="wpuf_expiration_field">
365
+ <th>
366
+ Post Status :
367
+ </th>
368
+ <td>
369
+ <?php $post_statuses = get_post_statuses();
370
+ ?>
371
+ <select name="post_expiration_settings[expired_post_status]" id="wpuf-expired_post_status">
372
+ <?php
373
+ foreach($post_statuses as $post_status => $text){
374
+ ?>
375
+ <option value="<?php echo $post_status ?>" <?php echo ( $expired_post_status == $post_status )?'selected':''; ?>><?php echo $text;?></option>
376
+ <?php
377
+ }
378
+ ?>
379
+ </select>
380
+ <p class="description"><?php echo _('Status of post after post expiration time is over ');?></p>
381
+ </td>
382
+ </tr>
383
+ <tr class="wpuf_expiration_field">
384
+ <th>
385
+ Send Mail :
386
+ </th>
387
+ <td>
388
+ <input type="checkbox" name="post_expiration_settings[enable_mail_after_expired]" value="on" <?php echo $is_enable_mail_after_expired;?> />
389
+ Send Mail to Author After Exceeding Post Expiration Time
390
+ </td>
391
+ </tr>
392
+ <tr class="wpuf_expiration_field">
393
+ <th>Post Expiration Message</th>
394
+ <td>
395
+ <textarea name="post_expiration_settings[post_expiration_message]" id="wpuf-post_expiration_message" cols="50" rows="5"><?php echo $post_expiration_message;?></textarea>
396
+ </td>
397
+ </tr>
398
+ <?php echo $this->get_post_types( $sub_meta['post_type_name'] ); ?>
399
+ <?php
400
+ do_action( 'wpuf_admin_subscription_detail', $sub_meta, $hidden_recurring_class, $hidden_trial_class, $this );
401
+ ?>
402
+ </tbody>
403
+ </table>
404
+
405
+ <?php
406
+
407
+ }
408
+
409
+ function option_field( $selected ) {
410
+ ?>
411
+ <option value="day" <?php selected( $selected, 'day' ); ?> ><?php _e( 'Day(s)', 'wpuf' ); ?></option>
412
+ <option value="week" <?php selected( $selected, 'week' ); ?> ><?php _e( 'Week(s)', 'wpuf' ); ?></option>
413
+ <option value="month" <?php selected( $selected, 'month' ); ?> ><?php _e( 'Month(s)', 'wpur'); ?></option>
414
+ <option value="year" <?php selected( $selected, 'year' ); ?> ><?php _e( 'Year(s)', 'wpuf' ); ?></option>
415
+ <?php
416
+ }
417
+
418
+ function packdropdown_without_recurring( $packs, $selected = '' ) {
419
+ $packs = isset( $packs ) ? $packs : array();
420
+ foreach( $packs as $key => $pack ) {
421
+ $recurring = isset( $pack->meta_value['recurring_pay'] ) ? $pack->meta_value['recurring_pay'] : '';
422
+ if( $recurring == 'yes' ) {
423
+ continue;
424
+ }
425
+ ?>
426
+ <option value="<?php echo $pack->ID; ?>" <?php selected( $selected, $pack->ID ); ?>><?php echo $pack->post_title; ?></option>
427
+ <?php
428
+ }
429
+ }
430
+
431
+ /**
432
+ * Adds the postlock form in users profile
433
+ *
434
+ * @param object $profileuser
435
+ */
436
+ function profile_subscription_details( $profileuser ) {
437
+
438
+ if ( ! current_user_can( 'edit_users' ) ) {
439
+ return;
440
+ }
441
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) != 'yes' ) {
442
+ return;
443
+ }
444
+ $userdata = get_userdata( $profileuser->ID ); //wp 3.3 fix
445
+
446
+ $packs = WPUF_Subscription::init()->get_subscriptions();
447
+ $user_sub = WPUF_Subscription::get_user_pack( $userdata->ID );
448
+ $pack_id = isset( $user_sub['pack_id'] ) ? $user_sub['pack_id'] : '';
449
+ ?>
450
+ <div class="wpuf-user-subscription">
451
+ <h3><?php _e( 'WPUF Subscription', 'wpuf' ); ?></h3>
452
+ <?php
453
+
454
+ if ( isset( $user_sub['pack_id'] ) ) :
455
+
456
+ $pack = WPUF_Subscription::get_subscription( $user_sub['pack_id'] );
457
+ $details_meta = WPUF_Subscription::init()->get_details_meta_value();
458
+
459
+ $billing_amount = ( isset( $pack->meta_value['billing_amount'] ) && intval( $pack->meta_value['billing_amount'] ) > 0 ) ? $details_meta['symbol'] . $pack->meta_value['billing_amount'] : __( 'Free', 'wpuf' );
460
+ $recurring_pay = ( isset( $pack->meta_value['recurring_pay'] ) && $pack->meta_value['recurring_pay'] == 'yes' ) ? true : false;
461
+ if ( $billing_amount && $recurring_pay ) {
462
+ $recurring_des = sprintf( 'For each %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type'] );
463
+ $recurring_des .= !empty( $pack->meta_value['billing_limit'] ) ? sprintf( ', for %s installments', $pack->meta_value['billing_limit'] ) : '';
464
+ $recurring_des = $recurring_des;
465
+ } else {
466
+ $recurring_des = '';
467
+ }
468
+
469
+ ?>
470
+ <div class="wpuf-user-sub-info">
471
+ <h3><?php _e( 'Subscription Details', 'wpuf' ); ?></h3>
472
+ <?php if(isset($user_sub['recurring']) && $user_sub['recurring'] == 'yes' ){
473
+ ?>
474
+ <div class="updated">
475
+ <p><?php _e( 'This user is using recurring subscription pack', 'wpuf' ); ?></p>
476
+ </div>
477
+ <?php
478
+ } ?>
479
+ <div class="wpuf-text">
480
+ <div><strong><?php _e( 'Subcription Name: ','wpuf' ); ?></strong><?php echo isset( $pack->post_title ) ? $pack->post_title : ''; ?></div>
481
+ <div>
482
+ <strong><?php _e( 'Package billing details: ', 'wpuf'); ?></strong>
483
+ <div class="wpuf-pricing-wrap">
484
+ <div class="wpuf-sub-amount">
485
+ <?php echo $billing_amount; ?>
486
+ <?php echo $recurring_des; ?>
487
+ </div
488
+ </div>
489
+ </div>
490
+
491
+ <strong><?php _e( 'Remaining post: ','wpuf'); ?></strong>
492
+ <table class="form-table">
493
+
494
+ <?php
495
+
496
+ foreach ($user_sub['posts'] as $key => $value) {
497
+ ?>
498
+ <tr>
499
+ <th><label><?php echo $key; ?></label></th>
500
+ <td><input type="text" value="<?php echo $value; ?>" name="<?php echo $key; ?>" ></td>
501
+ </tr>
502
+ <?php
503
+ }
504
+ ?>
505
+ <?php
506
+ if ( $user_sub['recurring'] != 'yes' ) {
507
+ if ( !empty( $user_sub['expire'] ) ) {
508
+
509
+ $expire = ( $user_sub['expire'] == 'unlimited' ) ? ucfirst( 'unlimited' ) : wpuf_date2mysql( $user_sub['expire'] );
510
+
511
+ ?>
512
+ <tr>
513
+ <th><label><?php echo _e('Expire date:' , 'wpuf'); ?></label></th>
514
+ <td><input type="text" class="wpuf-date-picker" name="expire" value="<?php echo wpuf_get_date( $expire ); ?>"></td>
515
+ </tr>
516
+ <?php
517
+ }
518
+
519
+ } ?>
520
+ <?php
521
+ $is_post_exp_selected = isset($user_sub['_enable_post_expiration'])?'checked':'';
522
+ $_post_expiration_time = explode(' ',isset($user_sub['_post_expiration_time'])?$user_sub['_post_expiration_time']:' ');
523
+ $time_value = isset($_post_expiration_time[0]) && !empty($_post_expiration_time[0])?$_post_expiration_time[0]:'1';
524
+ $time_type = isset($_post_expiration_time[1]) && !empty($_post_expiration_time[1])?$_post_expiration_time[1]:'day';
525
+ ?>
526
+ <tr>
527
+ <th><label><?php echo _e('Post Expiration Enabled', 'wpuf'); ?></label></th>
528
+ <td><input type="checkbox" name="is_post_expiration_enabled" value="on" <?php echo $is_post_exp_selected;?>></td>
529
+ </tr>
530
+ <tr>
531
+ <?php
532
+ $timeType_array = array(
533
+ 'year' => 100,
534
+ 'month' => 12,
535
+ 'day' => 30
536
+ );
537
+ ?>
538
+ <th><?php _e( 'Post Expiration Time', 'wpuf' ); ?></th>
539
+ <td>
540
+ <select name="post_expiration_settings[expiration_time_value]" id="wpuf-expiration_time_value">
541
+ <?php
542
+ for($i = 1;$i <= $timeType_array[$time_type];$i++){
543
+ ?>
544
+ <option value="<?php echo $i; ?>" <?php echo $i == $time_value?'selected':''; ?>><?php echo $i;?></option>
545
+ <?php
546
+ }
547
+ ?>
548
+ </select>
549
+ <select name="post_expiration_settings[expiration_time_type]" id="wpuf-expiration_time_type">
550
+ <?php
551
+ foreach($timeType_array as $each_time_type=>$each_time_type_val){
552
+ ?>
553
+ <option value="<?php echo $each_time_type;?>" <?php echo $each_time_type==$time_type?'selected':''; ?>><?php echo ucfirst($each_time_type);?></option>
554
+ <?php
555
+ }
556
+ ?>
557
+ </select>
558
+ </td>
559
+ </tr>
560
+ </table>
561
+ </div>
562
+ </div>
563
+ <?php endif;?>
564
+ <?php if(!isset($user_sub['recurring']) || $user_sub['recurring'] != 'yes' ): ?>
565
+ <a class="btn button-primary wpuf-assing-pack-btn wpuf-add-pack" href="#"><?php _e( 'Assign Package', 'wpuf' ); ?></a>
566
+ <a class="btn button-primary wpuf-assing-pack-btn wpuf-cancel-pack" style="display:none;" href="#"><?php _e( 'Show Package', 'wpuf' ); ?></a>
567
+ <table class="form-table wpuf-pack-dropdown" disabled="disabled" style="display: none;">
568
+ <tr>
569
+ <th><label for="wpuf_sub_pack"><?php _e( 'Pack:', 'wpuf' ); ?> </label></th>
570
+ <td>
571
+ <select name="pack_id" id="wpuf_sub_pack">
572
+ <option value="-1"><?php _e( '--Select--', 'wpuf' ); ?></option>
573
+ <?php $this->packdropdown_without_recurring( $packs, $pack_id );//WPUF_Subscription::init()->packdropdown( $packs, $selected = '' ); ?>
574
+ </select>
575
+ </td>
576
+ </tr>
577
+ </table>
578
+ <?php endif;?>
579
+ <?php if( !empty($user_sub) ):?>
580
+ <a class="btn button-primary wpuf-delete-pack-btn" href="javascript:" data-userid = "<?php echo $userdata->ID; ?>"><?php _e( 'Delete Package', 'wpuf' ); ?></a>
581
+ <?php endif; ?>
582
+ </div>
583
+ <?php
584
+
585
+ }
586
+
587
+ function lenght_type_option( $selected ) {
588
+
589
+ for ($i = 1; $i <= 30; $i++) {
590
+ ?>
591
+ <option value="<?php echo $i; ?>" <?php selected( $i, $selected ); ?>><?php echo $i; ?></option>
592
+ <?php
593
+ }
594
+
595
+ }
596
+
597
+ /**
598
+ * Ajax function. Delete user package
599
+ * @since 2.2.7
600
+ */
601
+ function delete_user_package(){
602
+ echo delete_user_meta($_POST['userid'],'_wpuf_subscription_pack');
603
+ $wpuf_paypal = new WPUF_Paypal();
604
+ $wpuf_paypal->recurring_change_status( $_POST['userid'], 'Cancel' );
605
+ exit;
606
+ }
607
+ }
608
+
609
+ //$subscription = new WPUF_Admin_Subscription();
admin/template-post.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post related form templates
4
+ *
5
+ * @package WP User Frontend
6
+ */
7
+ class WPUF_Admin_Template_Post extends WPUF_Admin_Template {
8
+
9
+ public static function post_title( $field_id, $label, $values = array() ) {
10
+
11
+ ?>
12
+ <li class="post_title">
13
+ <?php self::legend( $label, $values, $field_id ); ?>
14
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
15
+ <?php self::hidden_field( "[$field_id][template]", 'post_title' ); ?>
16
+
17
+ <div class="wpuf-form-holder">
18
+ <?php self::common( $field_id, 'post_title', false, $values ); ?>
19
+ <?php self::common_text( $field_id, $values ); ?>
20
+ <?php self::conditional_field( $field_id, $values ); ?>
21
+ </div> <!-- .wpuf-form-holder -->
22
+ </li>
23
+ <?php
24
+ }
25
+
26
+ public static function post_content( $field_id, $label, $values = array() ) {
27
+
28
+ $image_insert_name = sprintf( '%s[%d][insert_image]', self::$input_name, $field_id );
29
+ $image_insert_value = isset( $values['insert_image'] ) ? $values['insert_image'] : 'yes';
30
+ ?>
31
+ <li class="post_content">
32
+ <?php self::legend( $label, $values, $field_id ); ?>
33
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
34
+ <?php self::hidden_field( "[$field_id][template]", 'post_content' ); ?>
35
+
36
+ <div class="wpuf-form-holder">
37
+ <?php self::common( $field_id, 'post_content', false, $values ); ?>
38
+ <?php self::common_textarea( $field_id, $values ); ?>
39
+
40
+ <div class="wpuf-form-rows">
41
+ <label><?php _e( 'Enable Image Insertion', 'wpuf' ); ?></label>
42
+
43
+ <div class="wpuf-form-sub-fields">
44
+ <label>
45
+ <?php self::hidden_field( "[$field_id][insert_image]", 'no' ); ?>
46
+ <input type="checkbox" name="<?php echo $image_insert_name ?>" value="yes"<?php checked( $image_insert_value, 'yes' ); ?> />
47
+ <?php _e( 'Enable image upload in post area', 'wpuf' ); ?>
48
+ </label>
49
+ </div>
50
+ </div> <!-- .wpuf-form-rows -->
51
+
52
+ <?php self::conditional_field( $field_id, $values ); ?>
53
+ </div> <!-- .wpuf-form-holder -->
54
+ </li>
55
+ <?php
56
+ }
57
+
58
+ public static function post_excerpt( $field_id, $label, $values = array() ) {
59
+ ?>
60
+ <li class="post_excerpt">
61
+ <?php self::legend( $label, $values, $field_id ); ?>
62
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
63
+ <?php self::hidden_field( "[$field_id][template]", 'post_excerpt' ); ?>
64
+
65
+ <div class="wpuf-form-holder">
66
+ <?php self::common( $field_id, 'post_excerpt', false, $values ); ?>
67
+ <?php self::common_textarea( $field_id, $values ); ?>
68
+ <?php self::conditional_field( $field_id, $values ); ?>
69
+ </div> <!-- .wpuf-form-holder -->
70
+ </li>
71
+ <?php
72
+ }
73
+
74
+ public static function post_tags( $field_id, $label, $values = array() ) {
75
+ ?>
76
+ <li class="post_tags">
77
+ <?php self::legend( $label, $values, $field_id ); ?>
78
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
79
+ <?php self::hidden_field( "[$field_id][template]", 'post_tags' ); ?>
80
+
81
+ <div class="wpuf-form-holder">
82
+ <?php self::common( $field_id, 'tags', false, $values ); ?>
83
+ <?php self::common_text( $field_id, $values ); ?>
84
+ <?php self::conditional_field( $field_id, $values ); ?>
85
+ </div> <!-- .wpuf-form-holder -->
86
+ </li>
87
+ <?php
88
+ }
89
+
90
+ public static function featured_image( $field_id, $label, $values = array() ) {
91
+ $max_file_name = sprintf( '%s[%d][max_size]', self::$input_name, $field_id );
92
+ $max_file_value = $values ? $values['max_size'] : '1024';
93
+ $help = esc_attr( __( 'Enter maximum upload size limit in KB', 'wpuf' ) );
94
+ ?>
95
+ <li class="featured_image">
96
+ <?php self::legend( $label, $values, $field_id ); ?>
97
+ <?php self::hidden_field( "[$field_id][input_type]", 'image_upload' ); ?>
98
+ <?php self::hidden_field( "[$field_id][template]", 'featured_image' ); ?>
99
+ <?php self::hidden_field( "[$field_id][count]", '1' ); ?>
100
+
101
+ <div class="wpuf-form-holder">
102
+ <?php self::common( $field_id, 'featured_image', false, $values ); ?>
103
+
104
+ <div class="wpuf-form-rows">
105
+ <label><?php _e( 'Max. file size', 'wpuf' ); ?></label>
106
+ <input type="text" class="smallipopInput" name="<?php echo $max_file_name; ?>" value="<?php echo $max_file_value; ?>" title="<?php echo $help; ?>">
107
+ </div> <!-- .wpuf-form-rows -->
108
+ <?php self::conditional_field( $field_id, $values ); ?>
109
+ </div> <!-- .wpuf-form-holder -->
110
+ </li>
111
+ <?php
112
+ }
113
+
114
+ public static function post_category( $field_id, $label, $values = array() ) {
115
+ ?>
116
+ <li class="post_category">
117
+ <?php self::legend( $label, $values, $field_id ); ?>
118
+ <?php self::hidden_field( "[$field_id][template]", 'post_category' ); ?>
119
+
120
+ <div class="wpuf-form-holder">
121
+ <?php self::common( $field_id, 'category', false, $values ); ?>
122
+ <?php self::conditional_field( $field_id, $values ); ?>
123
+ </div> <!-- .wpuf-form-holder -->
124
+ </li>
125
+ <?php
126
+ }
127
+
128
+ public static function taxonomy( $field_id, $label, $taxonomy = '', $values = array() ) {
129
+ $type_name = sprintf( '%s[%d][type]', self::$input_name, $field_id );
130
+ $order_name = sprintf( '%s[%d][order]', self::$input_name, $field_id );
131
+ $orderby_name = sprintf( '%s[%d][orderby]', self::$input_name, $field_id );
132
+ $exclude_type_name = sprintf( '%s[%d][exclude_type]', self::$input_name, $field_id );
133
+ $exclude_name = sprintf( '%s[%d][exclude]', self::$input_name, $field_id );
134
+ $woo_attr_name = sprintf( '%s[%d][woo_attr]', self::$input_name, $field_id );
135
+ $woo_attr_vis_name = sprintf( '%s[%d][woo_attr_vis]', self::$input_name, $field_id );
136
+
137
+ $type_value = $values ? esc_attr( $values['type'] ) : 'select';
138
+ $order_value = $values ? esc_attr( $values['order'] ) : 'ASC';
139
+ $orderby_value = $values ? esc_attr( $values['orderby'] ) : 'name';
140
+ $exclude_type_value = $values ? esc_attr( $values['exclude_type'] ) : 'exclude';
141
+ $exclude_value = $values ? esc_attr( $values['exclude'] ) : '';
142
+ $woo_attr_value = $values ? esc_attr( $values['woo_attr'] ) : 'no';
143
+ $woo_attr_vis_value = $values ? esc_attr( $values['woo_attr_vis'] ) : 'no';
144
+ ?>
145
+ <li class="taxonomy <?php echo $taxonomy; ?> wpuf-conditional">
146
+ <?php self::legend( $label, $values, $field_id ); ?>
147
+ <?php self::hidden_field( "[$field_id][input_type]", 'taxonomy' ); ?>
148
+ <?php self::hidden_field( "[$field_id][template]", 'taxonomy' ); ?>
149
+
150
+ <div class="wpuf-form-holder">
151
+ <?php self::common( $field_id, $taxonomy, false, $values ); ?>
152
+
153
+ <div class="wpuf-form-rows">
154
+ <label><?php _e( 'Type', 'wpuf' ); ?></label>
155
+ <select name="<?php echo $type_name ?>">
156
+ <option value="select"<?php selected( $type_value, 'select' ); ?>><?php _e( 'Dropdown', 'wpuf' ); ?></option>
157
+ <option value="multiselect"<?php selected( $type_value, 'multiselect' ); ?>><?php _e( 'Multi Select', 'wpuf' ); ?></option>
158
+ <option value="checkbox"<?php selected( $type_value, 'checkbox' ); ?>><?php _e( 'Checkbox', 'wpuf' ); ?></option>
159
+ <option value="text"<?php selected( $type_value, 'text' ); ?>><?php _e( 'Text Input', 'wpuf' ); ?></option>
160
+ <option value="ajax"<?php selected( $type_value, 'ajax' ); ?>><?php _e( 'Ajax', 'wpuf' ); ?></option>
161
+ </select>
162
+ </div> <!-- .wpuf-form-rows -->
163
+
164
+ <div class="wpuf-form-rows">
165
+ <label><?php _e( 'Order By', 'wpuf' ); ?></label>
166
+ <select name="<?php echo $orderby_name ?>">
167
+ <option value="name"<?php selected( $orderby_value, 'name' ); ?>><?php _e( 'Name', 'wpuf' ); ?></option>
168
+ <option value="id"<?php selected( $orderby_value, 'id' ); ?>><?php _e( 'Term ID', 'wpuf' ); ?></option>
169
+ <option value="slug"<?php selected( $orderby_value, 'slug' ); ?>><?php _e( 'Slug', 'wpuf' ); ?></option>
170
+ <option value="count"<?php selected( $orderby_value, 'count' ); ?>><?php _e( 'Count', 'wpuf' ); ?></option>
171
+ <option value="term_group"<?php selected( $orderby_value, 'term_group' ); ?>><?php _e( 'Term Group', 'wpuf' ); ?></option>
172
+ </select>
173
+ </div> <!-- .wpuf-form-rows -->
174
+
175
+ <div class="wpuf-form-rows">
176
+ <label><?php _e( 'Order', 'wpuf' ); ?></label>
177
+ <select name="<?php echo $order_name ?>">
178
+ <option value="ASC"<?php selected( $order_value, 'ASC' ); ?>><?php _e( 'ASC', 'wpuf' ); ?></option>
179
+ <option value="DESC"<?php selected( $order_value, 'DESC' ); ?>><?php _e( 'DESC', 'wpuf' ); ?></option>
180
+ </select>
181
+ </div> <!-- .wpuf-form-rows -->
182
+
183
+ <div class="wpuf-form-rows">
184
+ <label><?php _e( 'Selection Type', 'wpuf' ); ?></label>
185
+ <select name="<?php echo $exclude_type_name ?>">
186
+ <option value="exclude"<?php selected( $exclude_type_value, 'exclude' ); ?>><?php _e( 'Exclude', 'wpuf' ); ?></option>
187
+ <option value="include"<?php selected( $exclude_type_value, 'include' ); ?>><?php _e( 'Include', 'wpuf' ); ?></option>
188
+ <option value="child_of"<?php selected( $exclude_type_value, 'child_of' ); ?>><?php _e( 'Child of', 'wpuf' ); ?></option>
189
+ </select>
190
+ </div> <!-- .wpuf-form-rows -->
191
+
192
+ <div class="wpuf-form-rows">
193
+ <label><?php _e( 'Selection terms', 'wpuf' ); ?></label>
194
+ <input type="text" class="smallipopInput" name="<?php echo $exclude_name; ?>" title="<?php _e( 'Enter the term IDs as comma separated (without space) to exclude/include in the form.', 'wpuf' ); ?>" value="<?php echo $exclude_value; ?>" />
195
+ </div> <!-- .wpuf-form-rows -->
196
+
197
+ <div class="wpuf-form-rows">
198
+ <label><?php _e( 'WooCommerce Attribute', 'wpuf' ); ?></label>
199
+
200
+ <div class="wpuf-form-sub-fields">
201
+ <label>
202
+ <?php self::hidden_field( "[$field_id][woo_attr]", 'no' ); ?>
203
+ <input type="checkbox" class="woo_attr" name="<?php echo $woo_attr_name ?>" value="yes"<?php checked( $woo_attr_value, 'yes' ); ?> />
204
+ <?php _e( 'This taxonomy is a WooCommerce attribute', 'wpuf' ); ?>
205
+ </label>
206
+ </div>
207
+ </div> <!-- .wpuf-form-rows -->
208
+
209
+ <div class="wpuf-form-rows<?php echo $woo_attr_value == 'no' ? ' wpuf-hide' : ''; ?>">
210
+ <label><?php _e( 'Visibility', 'wpuf' ); ?></label>
211
+
212
+ <div class="wpuf-form-sub-fields">
213
+ <label>
214
+ <?php self::hidden_field( "[$field_id][woo_attr_vis]", 'no' ); ?>
215
+ <input type="checkbox" name="<?php echo $woo_attr_vis_name ?>" value="yes"<?php checked( $woo_attr_vis_value, 'yes' ); ?> />
216
+ <?php _e( 'Visible on product page', 'wpuf' ); ?>
217
+ </label>
218
+ </div>
219
+ </div> <!-- .wpuf-form-rows -->
220
+
221
+ <?php self::conditional_field( $field_id, $values ); ?>
222
+ <div class="wpuf-options">
223
+ <?php
224
+
225
+ $tax = get_terms( $taxonomy, array(
226
+ 'orderby' => 'count',
227
+ 'hide_empty' => 0
228
+ ) );
229
+
230
+ $tax = is_array( $tax ) ? $tax : array();
231
+
232
+ foreach($tax as $tax_obj) {
233
+ ?>
234
+ <div>
235
+ <input type="hidden" value="<?php echo $tax_obj->name;?>" data-taxonomy="yes" data-term-id="<?php echo $tax_obj->term_id;?>" data-type="option">
236
+ <input type="hidden" value="<?php echo $tax_obj->term_id;?>" data-taxonomy="yes" data-term-id="<?php echo $tax_obj->term_id;?>" data-type="option_value">
237
+ </div>
238
+ <?php
239
+ }
240
+ ?>
241
+ </div>
242
+ </div> <!-- .wpuf-form-holder -->
243
+ </li>
244
+ <?php
245
+ }
246
+
247
+
248
+ /**
249
+ * Drop Down portion
250
+ * @param array $param
251
+ */
252
+ public static function render_drop_down_portion( $param = array( 'names_to_hide' => array( 'name' => '', 'value' => '' ),'names_to_show' => array( 'name' => '', 'value' => '' ),'option_to_chose' => array('name' => '', 'value' => '' ) ) ) {
253
+ empty( $param['option_to_chose']['value'] ) ? ( $param['option_to_chose']['value'] = 'all' ) : '';
254
+
255
+ ?>
256
+ <div class="wpuf-form-rows">
257
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('all','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'all' )?'checked':'' ); ?> /><?php _e( 'Show All', 'wpuf' ); ?></label>
258
+ </div>
259
+ <div class="wpuf-form-rows">
260
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('hide','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'hide' )?'checked':'' ); ?> /><?php _e( 'Hide These Countries', 'wpuf' ); ?></label>
261
+ <select name="<?php echo $param['names_to_hide']['name'];?>" class="wpuf-country_to_hide" multiple data-placeholder="<?php esc_attr_e( 'Chose Country to hide from List', 'wpuf' ); ?>"></select>
262
+ </div>
263
+
264
+ <div class="wpuf-form-rows">
265
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('show','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'show' )?'checked':'' ); ?> /><?php _e( 'Show These Countries', 'wpuf' ); ?></label>
266
+ <select name="<?php echo $param['names_to_show']['name'];?>" class="wpuf-country_to_hide" multiple data-placeholder="<?php esc_attr_e( 'Add Country to List', 'wpuf' ); ?>"></select>
267
+ </div>
268
+
269
+ <script>
270
+ (function($){
271
+ $(document).ready(function(){
272
+ var hide_field_name = '<?php echo $param['names_to_hide']['name'];?>';
273
+ var hide_field_value = JSON.parse('<?php echo json_encode($param['names_to_hide']['value']);?>');
274
+ var show_field_name = '<?php echo $param['names_to_show']['name'];?>';
275
+ var show_field_value = JSON.parse('<?php echo json_encode($param['names_to_show']['value']);?>');
276
+ var countries = <?php echo wpuf_get_countries( 'json' ); ?>;
277
+ var hide_field_option_string = '';
278
+ var show_field_option_string = '';
279
+
280
+ for(country in countries){
281
+ hide_field_option_string = hide_field_option_string + '<option value="'+ countries[country].code +'" '+ (( $.inArray(countries[country].code,hide_field_value) != -1 )?'selected':'') +'>'+ countries[country].name +'</option>';
282
+ show_field_option_string = show_field_option_string + '<option value="'+ countries[country].code +'" '+ (( $.inArray(countries[country].code,show_field_value) != -1 )?'selected':'') +'>'+ countries[country].name +'</option>';
283
+ }
284
+
285
+ jQuery('select[name="'+ hide_field_name +'"]').html(hide_field_option_string);
286
+ jQuery('select[name="'+ show_field_name +'"]').html(show_field_option_string);
287
+ jQuery('select[name="'+ hide_field_name +'"],select[name="'+ show_field_name +'"]').chosen({allow_single_deselect:true});
288
+ })
289
+
290
+ }(jQuery))
291
+
292
+ </script>
293
+ <?php
294
+ }
295
+
296
+ }
admin/template.php ADDED
@@ -0,0 +1,664 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WPUF Form builder template
5
+ *
6
+ * @package WP User Frontend
7
+ * @author Tareq Hasan <tareq@wedevs.com>
8
+ */
9
+ class WPUF_Admin_Template {
10
+
11
+ static $input_name = 'wpuf_input';
12
+ static $cond_name = 'wpuf_cond';
13
+
14
+ /**
15
+ * Legend of a form item
16
+ *
17
+ * @param string $title
18
+ * @param array $values
19
+ */
20
+ public static function legend( $title = 'Field Name', $values = array(), $field_id = 0 ) {
21
+
22
+ $field_label = $values ? ': <strong>' . $values['label'] . '</strong>' : '';
23
+ $id = isset( $values['id'] ) ? $values['id'] : '';
24
+ ?>
25
+ <div class="wpuf-legend" title="<?php _e( 'Click and Drag to rearrange', 'wpuf' ); ?>">
26
+ <input type="hidden" value="<?php echo $id; ?>" name="wpuf_input[<?php echo $field_id; ?>][id]">
27
+ <div class="wpuf-label"><?php echo $title . $field_label; ?></div>
28
+ <div class="wpuf-actions">
29
+ <a href="#" class="wpuf-remove"><?php _e( 'Remove', 'wpuf' ); ?></a>
30
+ <a href="#" class="wpuf-toggle"><?php _e( 'Toggle', 'wpuf' ); ?></a>
31
+ </div>
32
+ </div> <!-- .wpuf-legend -->
33
+ <?php
34
+ }
35
+
36
+ /**
37
+ * Common Fields for a input field
38
+ *
39
+ * Contains required, label, meta_key, help text, css class name
40
+ *
41
+ * @param int $id field order
42
+ * @param mixed $field_name_value
43
+ * @param bool $custom_field if it a custom field or not
44
+ * @param array $values saved value
45
+ */
46
+ public static function common( $id, $field_name_value = '', $custom_field = true, $values = array() ) {
47
+
48
+ $tpl = '%s[%d][%s]';
49
+ $required_name = sprintf( $tpl, self::$input_name, $id, 'required' );
50
+ $field_name = sprintf( $tpl, self::$input_name, $id, 'name' );
51
+ $label_name = sprintf( $tpl, self::$input_name, $id, 'label' );
52
+ $is_meta_name = sprintf( $tpl, self::$input_name, $id, 'is_meta' );
53
+ $help_name = sprintf( $tpl, self::$input_name, $id, 'help' );
54
+ $css_name = sprintf( $tpl, self::$input_name, $id, 'css' );
55
+
56
+ // $field_name_value = $field_name_value ?
57
+ $required = $values ? esc_attr( $values['required'] ) : 'yes';
58
+ $label_value = $values ? esc_attr( $values['label'] ) : '';
59
+ $help_value = $values ? stripslashes( $values['help'] ) : '';
60
+ $css_value = $values ? esc_attr( $values['css'] ) : '';
61
+
62
+ if ( $custom_field && $values ) {
63
+ $field_name_value = $values['name'];
64
+ }
65
+
66
+ // var_dump($values);
67
+ // var_dump($required, $label_value, $help_value);
68
+ ?>
69
+ <div class="wpuf-form-rows required-field">
70
+ <label><?php _e( 'Required', 'wpuf' ); ?></label>
71
+
72
+ <div class="wpuf-form-sub-fields">
73
+ <label><input type="radio" name="<?php echo $required_name; ?>" value="yes"<?php checked( $required, 'yes' ); ?>> <?php _e( 'Yes', 'wpuf' ); ?> </label>
74
+ <label><input type="radio" name="<?php echo $required_name; ?>" value="no"<?php checked( $required, 'no' ); ?>> <?php _e( 'No', 'wpuf' ); ?> </label>
75
+ </div>
76
+ </div> <!-- .wpuf-form-rows -->
77
+
78
+ <div class="wpuf-form-rows">
79
+ <label><?php _e( 'Field Label', 'wpuf' ); ?></label>
80
+ <input type="text" data-type="label" name="<?php echo $label_name; ?>" value="<?php echo $label_value; ?>" class="smallipopInput" title="<?php _e( 'Enter a title of this field', 'wpuf' ); ?>">
81
+ </div> <!-- .wpuf-form-rows -->
82
+
83
+ <?php if ( $custom_field ) { ?>
84
+ <div class="wpuf-form-rows">
85
+ <label><?php _e( 'Meta Key', 'wpuf' ); ?></label>
86
+ <input type="text" data-type="name" name="<?php echo $field_name; ?>" value="<?php echo $field_name_value; ?>" class="smallipopInput" title="<?php _e( 'Name of the meta key this field will save to', 'wpuf' ); ?>">
87
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="yes">
88
+ </div> <!-- .wpuf-form-rows -->
89
+ <?php } else { ?>
90
+
91
+ <input type="hidden" data-type="name" name="<?php echo $field_name; ?>" value="<?php echo $field_name_value; ?>">
92
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="no">
93
+
94
+ <?php } ?>
95
+
96
+ <div class="wpuf-form-rows">
97
+ <label><?php _e( 'Help text', 'wpuf' ); ?></label>
98
+ <textarea name="<?php echo $help_name; ?>" class="smallipopInput" title="<?php _e( 'Give the user some information about this field', 'wpuf' ); ?>"><?php echo $help_value; ?></textarea>
99
+ </div> <!-- .wpuf-form-rows -->
100
+
101
+ <div class="wpuf-form-rows">
102
+ <label><?php _e( 'CSS Class Name', 'wpuf' ); ?></label>
103
+ <input type="text" name="<?php echo $css_name; ?>" value="<?php echo $css_value; ?>" class="smallipopInput" title="<?php _e( 'Add a CSS class name for this field', 'wpuf' ); ?>">
104
+ </div> <!-- .wpuf-form-rows -->
105
+
106
+ <?php
107
+ }
108
+
109
+ /**
110
+ * Common fields for a text area
111
+ *
112
+ * @param int $id
113
+ * @param array $values
114
+ */
115
+ public static function common_text( $id, $values = array() ) {
116
+ $tpl = '%s[%d][%s]';
117
+ $placeholder_name = sprintf( $tpl, self::$input_name, $id, 'placeholder' );
118
+ $default_name = sprintf( $tpl, self::$input_name, $id, 'default' );
119
+ $size_name = sprintf( $tpl, self::$input_name, $id, 'size' );
120
+ $word_restriction_name = sprintf( $tpl, self::$input_name, $id, 'word_restriction' );
121
+
122
+ $placeholder_value = $values ? esc_attr( $values['placeholder'] ) : '';
123
+ $default_value = $values ? esc_attr( $values['default'] ) : '';
124
+ $size_value = $values ? esc_attr( $values['size'] ) : '40';
125
+ $word_restriction_value = $values ? esc_attr( $values['word_restriction'] ) : '';
126
+
127
+ ?>
128
+ <div class="wpuf-form-rows">
129
+ <label><?php _e( 'Placeholder text', 'wpuf' ); ?></label>
130
+ <input type="text" class="smallipopInput" name="<?php echo $placeholder_name; ?>" title="<?php esc_attr_e( 'Text for HTML5 placeholder attribute', 'wpuf' ); ?>" value="<?php echo $placeholder_value; ?>" />
131
+ </div> <!-- .wpuf-form-rows -->
132
+
133
+ <div class="wpuf-form-rows">
134
+ <label><?php _e( 'Default value', 'wpuf' ); ?></label>
135
+ <input type="text" class="smallipopInput" name="<?php echo $default_name; ?>" title="<?php esc_attr_e( 'The default value this field will have', 'wpuf' ); ?>" value="<?php echo $default_value; ?>" />
136
+ </div> <!-- .wpuf-form-rows -->
137
+
138
+ <div class="wpuf-form-rows">
139
+ <label><?php _e( 'Size', 'wpuf' ); ?></label>
140
+ <input type="text" class="smallipopInput" name="<?php echo $size_name; ?>" title="<?php esc_attr_e( 'Size of this input field', 'wpuf' ); ?>" value="<?php echo $size_value; ?>" />
141
+ </div> <!-- .wpuf-form-rows -->
142
+
143
+ <div class="wpuf-form-rows">
144
+ <label><?php _e( 'Word Restriction', 'wpuf' ); ?></label>
145
+
146
+ <div class="wpuf-form-sub-fields">
147
+ <label>
148
+ <input type="text" class="smallipopInput" name="<?php echo $word_restriction_name ?>" value="<?php echo $word_restriction_value; ?>" title="<?php esc_attr_e( 'Numebr of words the author to be restricted in', 'wpuf' ); ?>" />
149
+ </label>
150
+ </div>
151
+ </div> <!-- .wpuf-form-rows -->
152
+ <?php
153
+ }
154
+
155
+ /**
156
+ * Common fields for a textarea
157
+ *
158
+ * @param int $id
159
+ * @param array $values
160
+ */
161
+ public static function common_textarea( $id, $values = array() ) {
162
+ $tpl = '%s[%d][%s]';
163
+ $rows_name = sprintf( $tpl, self::$input_name, $id, 'rows' );
164
+ $cols_name = sprintf( $tpl, self::$input_name, $id, 'cols' );
165
+ $rich_name = sprintf( $tpl, self::$input_name, $id, 'rich' );
166
+ $placeholder_name = sprintf( $tpl, self::$input_name, $id, 'placeholder' );
167
+ $default_name = sprintf( $tpl, self::$input_name, $id, 'default' );
168
+ $word_restriction_name = sprintf( $tpl, self::$input_name, $id, 'word_restriction' );
169
+
170
+ $rows_value = $values ? esc_attr( $values['rows'] ) : '5';
171
+ $cols_value = $values ? esc_attr( $values['cols'] ) : '25';
172
+ $rich_value = $values ? esc_attr( $values['rich'] ) : 'no';
173
+ $placeholder_value = $values ? esc_attr( $values['placeholder'] ) : '';
174
+ $default_value = $values ? esc_attr( $values['default'] ) : '';
175
+ $word_restriction_value = $values ? esc_attr( $values['word_restriction'] ) : '';
176
+
177
+ ?>
178
+ <div class="wpuf-form-rows">
179
+ <label><?php _e( 'Rows', 'wpuf' ); ?></label>
180
+ <input type="text" class="smallipopInput" name="<?php echo $rows_name; ?>" title="Number of rows in textarea" value="<?php echo $rows_value; ?>" />
181
+ </div> <!-- .wpuf-form-rows -->
182
+
183
+ <div class="wpuf-form-rows">
184
+ <label><?php _e( 'Columns', 'wpuf' ); ?></label>
185
+ <input type="text" class="smallipopInput" name="<?php echo $cols_name; ?>" title="Number of columns in textarea" value="<?php echo $cols_value; ?>" />
186
+ </div> <!-- .wpuf-form-rows -->
187
+
188
+ <div class="wpuf-form-rows">
189
+ <label><?php _e( 'Placeholder text', 'wpuf' ); ?></label>
190
+ <input type="text" class="smallipopInput" name="<?php echo $placeholder_name; ?>" title="text for HTML5 placeholder attribute" value="<?php echo $placeholder_value; ?>" />
191
+ </div> <!-- .wpuf-form-rows -->
192
+
193
+ <div class="wpuf-form-rows">
194
+ <label><?php _e( 'Default value', 'wpuf' ); ?></label>
195
+ <input type="text" class="smallipopInput" name="<?php echo $default_name; ?>" title="the default value this field will have" value="<?php echo $default_value; ?>" />
196
+ </div> <!-- .wpuf-form-rows -->
197
+
198
+ <div class="wpuf-form-rows">
199
+ <label><?php _e( 'Textarea', 'wpuf' ); ?></label>
200
+
201
+ <div class="wpuf-form-sub-fields">
202
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="no"<?php checked( $rich_value, 'no' ); ?>> <?php _e( 'Normal', 'wpuf' ); ?></label>
203
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="yes"<?php checked( $rich_value, 'yes' ); ?>> <?php _e( 'Rich textarea', 'wpuf' ); ?></label>
204
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="teeny"<?php checked( $rich_value, 'teeny' ); ?>> <?php _e( 'Teeny Rich textarea', 'wpuf' ); ?></label>
205
+ </div>
206
+ </div> <!-- .wpuf-form-rows -->
207
+
208
+ <div class="wpuf-form-rows">
209
+ <label><?php _e( 'Word Restriction', 'wpuf' ); ?></label>
210
+
211
+ <div class="wpuf-form-sub-fields">
212
+ <label>
213
+ <input type="text" class="smallipopInput" name="<?php echo $word_restriction_name ?>" value="<?php echo $word_restriction_value; ?>" title="<?php esc_attr_e( 'Numebr of words the author to be restricted in', 'wpuf' ); ?>" />
214
+ </label>
215
+ </div>
216
+ </div> <!-- .wpuf-form-rows -->
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Hidden field helper function
222
+ *
223
+ * @param string $name
224
+ * @param string $value
225
+ */
226
+ public static function hidden_field( $name, $value = '' ) {
227
+ printf( '<input type="hidden" name="%s" value="%s" />', self::$input_name . $name, $value );
228
+ }
229
+
230
+ /**
231
+ * Displays a radio custom field
232
+ *
233
+ * @param int $field_id
234
+ * @param string $name
235
+ * @param array $values
236
+ */
237
+ public static function radio_fields( $field_id, $name, $values = array() ) {
238
+
239
+ $selected_name = sprintf( '%s[%d][selected]', self::$input_name, $field_id );
240
+ $input_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name );
241
+ $input_value_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name.'_values' );
242
+
243
+ $selected_value = ( $values && isset( $values['selected'] ) ) ? $values['selected'] : '';
244
+ ?>
245
+
246
+ <label for="wpuf-<?php echo $name.'_'.$field_id; ?>" class="wpuf-show-field-value">
247
+ <input type="checkbox" class="wpuf-value-handelar" id="wpuf-<?php echo $name . '_' . $field_id; ?>"><?php _e( 'Show values', 'wpuf' ); ?>
248
+ </label>
249
+
250
+ <div class="wpuf-option-label-value"><span><?php _e( 'Label', 'wpuf' ); ?></span><span class="wpuf-option-value" style="display: none;"><?php _e( 'Value', 'wpuf' ); ?></span></div>
251
+ <?php
252
+ if ( $values && $values['options'] > 0 ) {
253
+ foreach ($values['options'] as $key => $value) {
254
+ ?>
255
+ <div class="wpuf-clone-field">
256
+ <input type="radio" name="<?php echo $selected_name ?>" value="<?php echo $value; ?>" <?php checked( $selected_value, $value ); ?>>
257
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="<?php echo $value; ?>">
258
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="<?php echo $key; ?>" style="display:none;">
259
+
260
+ <?php self::remove_button(); ?>
261
+ </div>
262
+ <?php
263
+ }
264
+
265
+ } else {
266
+ ?>
267
+ <div class="wpuf-clone-field">
268
+ <input type="radio" name="<?php echo $selected_name ?>">
269
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="">
270
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="" style="display:none;">
271
+
272
+ <?php self::remove_button(); ?>
273
+ </div>
274
+ <?php
275
+ }
276
+ }
277
+
278
+ public static function conditional_field( $field_id, $con_fields = array() ) {
279
+
280
+ do_action( 'wpuf_conditional_field_render_hook',$field_id, $con_fields, 'WPUF_Admin_Template' );
281
+
282
+ }
283
+
284
+ /**
285
+ * Displays a checkbox custom field
286
+ *
287
+ * @param int $field_id
288
+ * @param string $name
289
+ * @param array $values
290
+ */
291
+ public static function common_checkbox( $field_id, $name, $values = array() ) {
292
+
293
+ $selected_name = sprintf( '%s[%d][selected]', self::$input_name, $field_id );
294
+ $input_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name );
295
+ $input_value_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name.'_values' );
296
+
297
+ $selected_value = ( $values && isset( $values['selected'] ) ) ? $values['selected'] : array();
298
+
299
+ ?>
300
+ <style>
301
+ .wpuf-option-label-value span {
302
+ font-weight: bold;
303
+ margin-left: 5%;
304
+ margin-right: 27%;
305
+ }
306
+ </style>
307
+ <input type="checkbox" class="wpuf-value-handelar" id="<?php echo $name.'_'.$field_id; ?>"><label for="<?php echo $name.'_'.$field_id; ?>"><?php _e('show values', 'wpuf'); ?></label>
308
+ <div class="wpuf-option-label-value"><span><?php _e( 'Label', 'wpuf' ); ?></span><span class="wpuf-option-value" style="display: none;"><?php _e( 'Value', 'wpuf' ); ?></span></div>
309
+ <?php
310
+ if ( $values && $values['options'] > 0 ) {
311
+ foreach ($values['options'] as $key => $value) {
312
+ ?>
313
+ <div class="wpuf-clone-field">
314
+
315
+ <input type="checkbox" name="<?php echo $selected_name ?>[]" value="<?php echo $value; ?>"<?php echo in_array( $value, $selected_value ) ? ' checked="checked"' : ''; ?> />
316
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="<?php echo $value; ?>">
317
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="<?php echo $key; ?>" style="display:none;">
318
+ <?php self::remove_button(); ?>
319
+ </div>
320
+ <?php
321
+ }
322
+ } else {
323
+ ?>
324
+ <div class="wpuf-clone-field">
325
+ <input type="checkbox" name="<?php echo $selected_name ?>[]">
326
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="">
327
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="" style="display:none;">
328
+
329
+ <?php self::remove_button(); ?>
330
+ </div>
331
+ <?php
332
+ }
333
+ }
334
+
335
+ /**
336
+ * Add/remove buttons for repeatable fields
337
+ *
338
+ * @return void
339
+ */
340
+ public static function remove_button() {
341
+ $add = plugins_url( 'assets/images/add.png', dirname( __FILE__ ) );
342
+ $remove = plugins_url( 'assets/images/remove.png', dirname( __FILE__ ) );
343
+ ?>
344
+ <img style="cursor:pointer; margin:0 3px;" alt="add another choice" title="add another choice" class="wpuf-clone-field" src="<?php echo $add; ?>">
345
+ <img style="cursor:pointer;" class="wpuf-remove-field" alt="remove this choice" title="remove this choice" src="<?php echo $remove; ?>">
346
+ <?php
347
+ }
348
+
349
+ public static function get_buffered( $func, $field_id, $label ) {
350
+ ob_start();
351
+
352
+ self::$func( $field_id, $label );
353
+
354
+ return ob_get_clean();
355
+ }
356
+
357
+ public static function text_field( $field_id, $label, $values = array() ) {
358
+
359
+ ?>
360
+ <li class="custom-field text_field">
361
+ <?php self::legend( $label, $values, $field_id ); ?>
362
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
363
+ <?php self::hidden_field( "[$field_id][template]", 'text_field' ); ?>
364
+
365
+ <div class="wpuf-form-holder">
366
+ <?php self::common( $field_id, '', true, $values ); ?>
367
+ <?php self::common_text( $field_id, $values ); ?>
368
+ <?php self::conditional_field( $field_id, $values ); ?>
369
+ </div> <!-- .wpuf-form-holder -->
370
+ </li>
371
+ <?php
372
+ }
373
+
374
+ public static function textarea_field( $field_id, $label, $values = array() ) {
375
+ ?>
376
+ <li class="custom-field textarea_field">
377
+ <?php self::legend( $label, $values, $field_id ); ?>
378
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
379
+ <?php self::hidden_field( "[$field_id][template]", 'textarea_field' ); ?>
380
+
381
+ <div class="wpuf-form-holder">
382
+ <?php self::common( $field_id, '', true, $values ); ?>
383
+ <?php self::common_textarea( $field_id, $values ); ?>
384
+ <?php self::conditional_field( $field_id, $values ); ?>
385
+ </div> <!-- .wpuf-form-holder -->
386
+ </li>
387
+ <?php
388
+ }
389
+
390
+ public static function radio_field( $field_id, $label, $values = array() ) {
391
+ ?>
392
+ <li class="custom-field radio_field wpuf-conditional">
393
+ <?php self::legend( $label, $values, $field_id ); ?>
394
+ <?php self::hidden_field( "[$field_id][input_type]", 'radio' ); ?>
395
+ <?php self::hidden_field( "[$field_id][template]", 'radio_field' ); ?>
396
+
397
+ <div class="wpuf-form-holder">
398
+ <?php self::common( $field_id, '', true, $values ); ?>
399
+
400
+ <div class="wpuf-form-rows">
401
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
402
+
403
+ <div class="wpuf-form-sub-fields wpuf-options">
404
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
405
+
406
+ </div> <!-- .wpuf-form-sub-fields -->
407
+ <?php self::conditional_field( $field_id, $values ); ?>
408
+ </div> <!-- .wpuf-form-rows -->
409
+ </div> <!-- .wpuf-form-holder -->
410
+ </li>
411
+ <?php
412
+ }
413
+
414
+ public static function checkbox_field( $field_id, $label, $values = array() ) {
415
+ ?>
416
+ <li class="custom-field checkbox_field wpuf-conditional">
417
+ <?php self::legend( $label, $values, $field_id ); ?>
418
+ <?php self::hidden_field( "[$field_id][input_type]", 'checkbox' ); ?>
419
+ <?php self::hidden_field( "[$field_id][template]", 'checkbox_field' ); ?>
420
+
421
+ <div class="wpuf-form-holder">
422
+ <?php self::common( $field_id, '', true, $values ); ?>
423
+
424
+ <div class="wpuf-form-rows">
425
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
426
+
427
+ <div class="wpuf-form-sub-fields wpuf-options">
428
+ <?php self::common_checkbox( $field_id, 'options', $values ); ?>
429
+
430
+ </div> <!-- .wpuf-form-sub-fields -->
431
+ <?php self::conditional_field( $field_id, $values ); ?>
432
+ </div> <!-- .wpuf-form-rows -->
433
+ </div> <!-- .wpuf-form-holder -->
434
+ </li>
435
+ <?php
436
+ }
437
+
438
+ public static function dropdown_field( $field_id, $label, $values = array() ) {
439
+ $first_name = sprintf( '%s[%d][first]', self::$input_name, $field_id );
440
+ $first_value = $values ? $values['first'] : ' - select -';
441
+ $help = esc_attr( __( 'First element of the select dropdown. Leave this empty if you don\'t want to show this field', 'wpuf' ) );
442
+ ?>
443
+ <li class="custom-field dropdown_field wpuf-conditional">
444
+ <?php self::legend( $label, $values, $field_id ); ?>
445
+ <?php self::hidden_field( "[$field_id][input_type]", 'select' ); ?>
446
+ <?php self::hidden_field( "[$field_id][template]", 'dropdown_field' ); ?>
447
+
448
+ <div class="wpuf-form-holder">
449
+ <?php self::common( $field_id, '', true, $values ); ?>
450
+
451
+ <div class="wpuf-form-rows">
452
+ <label><?php _e( 'Select Text', 'wpuf' ); ?></label>
453
+ <input type="text" class="smallipopInput" name="<?php echo $first_name; ?>" value="<?php echo $first_value; ?>" title="<?php echo $help; ?>">
454
+ </div> <!-- .wpuf-form-rows -->
455
+
456
+ <div class="wpuf-form-rows">
457
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
458
+
459
+ <div class="wpuf-form-sub-fields wpuf-options">
460
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
461
+ </div> <!-- .wpuf-form-sub-fields -->
462
+
463
+ <?php self::conditional_field( $field_id, $values ); ?>
464
+ </div> <!-- .wpuf-form-rows -->
465
+ </div> <!-- .wpuf-form-holder -->
466
+ </li>
467
+ <?php
468
+ }
469
+
470
+ public static function multiple_select( $field_id, $label, $values = array() ) {
471
+ $first_name = sprintf( '%s[%d][first]', self::$input_name, $field_id );
472
+ $first_value = $values ? $values['first'] : ' - select -';
473
+ $help = esc_attr( __( 'First element of the select dropdown. Leave this empty if you don\'t want to show this field', 'wpuf' ) );
474
+ ?>
475
+ <li class="custom-field multiple_select">
476
+ <?php self::legend( $label, $values, $field_id ); ?>
477
+ <?php self::hidden_field( "[$field_id][input_type]", 'multiselect' ); ?>
478
+ <?php self::hidden_field( "[$field_id][template]", 'multiple_select' ); ?>
479
+
480
+ <div class="wpuf-form-holder">
481
+ <?php self::common( $field_id, '', true, $values ); ?>
482
+
483
+ <div class="wpuf-form-rows">
484
+ <label><?php _e( 'Select Text', 'wpuf' ); ?></label>
485
+ <input type="text" class="smallipopInput" name="<?php echo $first_name; ?>" value="<?php echo $first_value; ?>" title="<?php echo $help; ?>">
486
+ </div> <!-- .wpuf-form-rows -->
487
+
488
+ <div class="wpuf-form-rows">
489
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
490
+
491
+ <div class="wpuf-form-sub-fields wpuf-options">
492
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
493
+ </div> <!-- .wpuf-form-sub-fields -->
494
+
495
+ <?php self::conditional_field( $field_id, $values ); ?>
496
+ </div> <!-- .wpuf-form-rows -->
497
+ </div> <!-- .wpuf-form-holder -->
498
+ </li>
499
+ <?php
500
+ }
501
+
502
+ public static function website_url( $field_id, $label, $values = array() ) {
503
+ ?>
504
+ <li class="custom-field website_url">
505
+ <?php self::legend( $label, $values, $field_id ); ?>
506
+ <?php self::hidden_field( "[$field_id][input_type]", 'url' ); ?>
507
+ <?php self::hidden_field( "[$field_id][template]", 'website_url' ); ?>
508
+
509
+ <div class="wpuf-form-holder">
510
+ <?php self::common( $field_id, '', true, $values ); ?>
511
+ <?php self::common_text( $field_id, $values ); ?>
512
+ <?php self::conditional_field( $field_id, $values ); ?>
513
+ </div> <!-- .wpuf-form-holder -->
514
+ </li>
515
+ <?php
516
+ }
517
+
518
+ public static function email_address( $field_id, $label, $values = array() ) {
519
+ ?>
520
+ <li class="custom-field eamil_address">
521
+ <?php self::legend( $label, $values, $field_id ); ?>
522
+ <?php self::hidden_field( "[$field_id][input_type]", 'email' ); ?>
523
+ <?php self::hidden_field( "[$field_id][template]", 'email_address' ); ?>
524
+
525
+ <div class="wpuf-form-holder">
526
+ <?php self::common( $field_id, '', true, $values ); ?>
527
+ <?php self::common_text( $field_id, $values ); ?>
528
+ <?php self::conditional_field( $field_id, $values ); ?>
529
+ </div> <!-- .wpuf-form-holder -->
530
+ </li>
531
+ <?php
532
+ }
533
+
534
+ public static function custom_html( $field_id, $label, $values = array() ) {
535
+ $title_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
536
+ $html_name = sprintf( '%s[%d][html]', self::$input_name, $field_id );
537
+ $title_value = $values ? esc_attr( $values['label'] ) : '';
538
+ $html_value = $values ? esc_attr( $values['html'] ) : '';
539
+ ?>
540
+ <li class="custom-field custom_html">
541
+ <?php self::legend( $label, $values, $field_id ); ?>
542
+ <?php self::hidden_field( "[$field_id][input_type]", 'html' ); ?>
543
+ <?php self::hidden_field( "[$field_id][template]", 'custom_html' ); ?>
544
+
545
+ <div class="wpuf-form-holder">
546
+ <div class="wpuf-form-rows">
547
+ <label><?php _e( 'Title', 'wpuf' ); ?></label>
548
+ <input type="text" class="smallipopInput" title="Title of the section" name="<?php echo $title_name; ?>" value="<?php echo esc_attr( $title_value ); ?>" />
549
+ </div> <!-- .wpuf-form-rows -->
550
+
551
+ <div class="wpuf-form-rows">
552
+ <label><?php _e( 'HTML Codes', 'wpuf' ); ?></label>
553
+ <textarea class="smallipopInput" title="Paste your HTML codes, WordPress shortcodes will also work here" name="<?php echo $html_name; ?>" rows="10"><?php echo esc_html( $html_value ); ?></textarea>
554
+ </div>
555
+
556
+ <?php self::conditional_field( $field_id, $values ); ?>
557
+ </div> <!-- .wpuf-form-holder -->
558
+ </li>
559
+ <?php
560
+ }
561
+
562
+ public static function custom_hidden_field( $field_id, $label, $values = array() ) {
563
+ $meta_name = sprintf( '%s[%d][name]', self::$input_name, $field_id );
564
+ $value_name = sprintf( '%s[%d][meta_value]', self::$input_name, $field_id );
565
+ $is_meta_name = sprintf( '%s[%d][is_meta]', self::$input_name, $field_id );
566
+ $label_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
567
+
568
+ $meta_value = $values ? esc_attr( $values['name'] ) : '';
569
+ $value_value = $values ? esc_attr( $values['meta_value'] ) : '';
570
+ ?>
571
+ <li class="custom-field custom_hidden_field">
572
+ <?php self::legend( $label, $values, $field_id ); ?>
573
+ <?php self::hidden_field( "[$field_id][input_type]", 'hidden' ); ?>
574
+ <?php self::hidden_field( "[$field_id][template]", 'custom_hidden_field' ); ?>
575
+
576
+ <div class="wpuf-form-holder">
577
+ <div class="wpuf-form-rows">
578
+ <label><?php _e( 'Meta Key', 'wpuf' ); ?></label>
579
+ <input type="text" name="<?php echo $meta_name; ?>" value="<?php echo $meta_value; ?>" class="smallipopInput" title="<?php _e( 'Name of the meta key this field will save to', 'wpuf' ); ?>">
580
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="yes">
581
+ <input type="hidden" name="<?php echo $label_name; ?>" value="">
582
+ </div> <!-- .wpuf-form-rows -->
583
+
584
+ <div class="wpuf-form-rows">
585
+ <label><?php _e( 'Meta Value', 'wpuf' ); ?></label>
586
+ <input type="text" class="smallipopInput" title="<?php esc_attr_e( 'Enter the meta value', 'wpuf' ); ?>" name="<?php echo $value_name; ?>" value="<?php echo $value_value; ?>">
587
+ </div>
588
+ </div> <!-- .wpuf-form-holder -->
589
+ </li>
590
+ <?php
591
+ }
592
+
593
+ public static function section_break( $field_id, $label, $values = array() ) {
594
+ $title_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
595
+ $description_name = sprintf( '%s[%d][description]', self::$input_name, $field_id );
596
+
597
+ $title_value = $values ? esc_attr( $values['label'] ) : '';
598
+ $description_value = $values ? esc_attr( $values['description'] ) : '';
599
+ ?>
600
+ <li class="custom-field custom_html">
601
+ <?php self::legend( $label, $values, $field_id ); ?>
602
+ <?php self::hidden_field( "[$field_id][input_type]", 'section_break' ); ?>
603
+ <?php self::hidden_field( "[$field_id][template]", 'section_break' ); ?>
604
+
605
+ <div class="wpuf-form-holder">
606
+ <div class="wpuf-form-rows">
607
+ <label><?php _e( 'Title', 'wpuf' ); ?></label>
608
+ <input type="text" class="smallipopInput" title="Title of the section" name="<?php echo $title_name; ?>" value="<?php echo esc_attr( $title_value ); ?>" />
609
+ </div> <!-- .wpuf-form-rows -->
610
+
611
+ <div class="wpuf-form-rows">
612
+ <label><?php _e( 'Description', 'wpuf' ); ?></label>
613
+ <textarea class="smallipopInput" title="Some details text about the section" name="<?php echo $description_name; ?>" rows="3"><?php echo esc_html( $description_value ); ?></textarea>
614
+ </div> <!-- .wpuf-form-rows -->
615
+
616
+ <?php self::conditional_field( $field_id, $values ); ?>
617
+ </div> <!-- .wpuf-form-holder -->
618
+ </li>
619
+ <?php
620
+ }
621
+
622
+ /**
623
+ * Render image upload
624
+ *
625
+ * @param $field_id
626
+ * @param $label
627
+ * @param self
628
+ * @param array $values
629
+ */
630
+ public static function image_upload( $field_id, $label, $values = array() ) {
631
+ $max_size_name = sprintf( '%s[%d][max_size]', self::$input_name, $field_id );
632
+ $max_files_name = sprintf( '%s[%d][count]', self::$input_name, $field_id );
633
+
634
+ $max_size_value = $values ? $values['max_size'] : '1024';
635
+ $max_files_value = $values ? $values['count'] : '1';
636
+
637
+ $help = esc_attr( __( 'Enter maximum upload size limit in KB', 'wpuf' ) );
638
+ $count = esc_attr( __( 'Number of images can be uploaded', 'wpuf' ) );
639
+ ?>
640
+ <li class="custom-field image_upload">
641
+ <?php self::legend( $label, $values, $field_id ); ?>
642
+ <?php self::hidden_field( "[$field_id][input_type]", 'image_upload' ); ?>
643
+ <?php self::hidden_field( "[$field_id][template]", 'image_upload' ); ?>
644
+
645
+ <div class="wpuf-form-holder">
646
+ <?php self::common( $field_id, '', true, $values ); ?>
647
+
648
+ <div class="wpuf-form-rows">
649
+ <label><?php _e( 'Max. file size', 'wpuf' ); ?></label>
650
+ <input type="text" class="smallipopInput" name="<?php echo $max_size_name; ?>" value="<?php echo $max_size_value; ?>" title="<?php echo $help; ?>">
651
+ </div> <!-- .wpuf-form-rows -->
652
+
653
+ <div class="wpuf-form-rows">
654
+ <label><?php _e( 'Max. files', 'wpuf' ); ?></label>
655
+ <input type="text" class="smallipopInput" name="<?php echo $max_files_name; ?>" value="<?php echo $max_files_value; ?>" title="<?php echo $count; ?>">
656
+ </div> <!-- .wpuf-form-rows -->
657
+
658
+ <?php self::conditional_field( $field_id, $values ); ?>
659
+ </div> <!-- .wpuf-form-holder -->
660
+ </li>
661
+ <?php
662
+ }
663
+
664
+ }
admin/tools.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage Import Export
5
+ *
6
+ * @since 2.2
7
+ * @package WP User Frontend
8
+ */
9
+ class WPUF_Admin_Tools {
10
+
11
+ /**
12
+ * List of All the post forms
13
+ *
14
+ * @return void
15
+ */
16
+ function list_forms() {
17
+
18
+ if ( isset( $_POST['export'] ) ) {
19
+ $this->export_data( $_POST['export_content'], $_POST['formlist'] );
20
+ }
21
+
22
+ $args = array(
23
+ 'post_type' => 'wpuf_forms',
24
+ 'posts_per_page' => -1,
25
+ 'post_status' => 'publish'
26
+ );
27
+ $forms = get_posts( $args );
28
+
29
+ if ( $forms ) {
30
+ ?>
31
+ <div class="postbox" style="margin-top: 15px;">
32
+ <h3 style="padding:10px 15px"><?php _e( 'Form Export', 'wpuf' ); ?></h3>
33
+ <div class="inside">
34
+ <div class="main">
35
+ <form action="" method="post" style="margin-top: 20px;">
36
+ <p>
37
+ <input class="export_type" type="radio" name="export_content" value="all" id="wpuf-all_export" checked>
38
+ <label for="wpuf-all_export"><?php _e( 'All', 'wpuf' ); ?></label>
39
+ </p>
40
+
41
+ <p>
42
+ <input class="export_type" type="radio" name="export_content" value="selected" id="wpuf-selected_export">
43
+ <label for="wpuf-selected_export"><?php _e( 'Select individual', 'wpuf' ); ?></label></p>
44
+ <p>
45
+ <select class="formlist" name="formlist[]" multiple="multiple">
46
+ <?php foreach ( $forms as $form ) { ?>
47
+ <option value="<?php echo esc_attr( $form->ID ) ?>"><?php echo esc_attr( $form->post_title ); ?></option>
48
+ <?php } ?>
49
+ </select>
50
+ </p>
51
+
52
+ <?php wp_nonce_field( 'wpuf-export-form' ); ?>
53
+ <input type="submit" class="button button-primary" name="export" value="<?php _e( 'Export', 'wpuf' ) ?>">
54
+ </form>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <?php
60
+ } else {
61
+ sprintf( '<p>%s</p>', __( 'Sorry you have no form to export', 'wpuf' ) );
62
+ }
63
+ }
64
+
65
+ /**
66
+ * List of All Registration forms
67
+ *
68
+ * @return void
69
+ */
70
+ function list_regis_forms() {
71
+
72
+ if ( isset( $_POST['export_regis_form'] ) ) {
73
+ $this->export_regis_data( $_POST['export_regis_content'], $_POST['formlist'] );
74
+ }
75
+
76
+ $args = array(
77
+ 'post_type' => 'wpuf_profile',
78
+ 'posts_per_page' => -1,
79
+ 'post_status' => 'publish'
80
+ );
81
+
82
+ $forms = get_posts( $args );
83
+ if ( $forms ) {
84
+ ?>
85
+ <div class="postbox">
86
+ <h3 style="padding:10px 15px"><?php _e( 'Registration Form Export', 'wpuf' ); ?></h3>
87
+ <div class="inside">
88
+ <div class="main">
89
+
90
+ <form action="" method="post" style="margin-top: 20px;">
91
+
92
+ <p>
93
+ <input class="export_type" type="radio" name="export_regis_content" value="all" id="wpuf-all_regis_export" checked>
94
+ <label for="wpuf-all_regis_export"><?php _e( 'All', 'wpuf' ); ?></label>
95
+ </p>
96
+
97
+ <p>
98
+ <input class="export_type" type="radio" name="export_regis_content" value="selected" id="wpuf-selected_regis_export">
99
+ <label for="wpuf-selected_regis_export"><?php _e( 'Select individual', 'wpuf' ); ?></label>
100
+ </p>
101
+
102
+ <p>
103
+ <select class="formlist" name="formlist[]" multiple="multiple">
104
+ <?php foreach ( $forms as $form ) { ?>
105
+ <option value="<?php echo esc_attr( $form->ID ); ?>"><?php echo esc_attr( $form->post_title ); ?></option>";
106
+ <?php } ?>
107
+ </select>
108
+ </p>
109
+
110
+ <?php wp_nonce_field( 'wpuf-export-regs-form' ); ?>
111
+
112
+ <input type="submit" class="button button-primary" name="export_regis_form" value="<?php _e( 'Export', 'wpuf' ) ?>">
113
+ </form>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ <?php
118
+ } else {
119
+ sprintf( '<p>%s</p>', __( 'Sorry you have no form to export', 'wpuf' ) );
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Import functionality
125
+ */
126
+ function import_data() {
127
+
128
+ if ( isset( $_FILES['import'] ) && check_admin_referer( 'wpuf-import' ) ) {
129
+
130
+ if ( $_FILES['import']['error'] > 0 ) {
131
+
132
+ printf( '<div class="error"><p>%s</p></div>', __( 'Somthing went wrong. Please choose a file again', 'wpuf' ) );
133
+ } else {
134
+
135
+ $file_name = $_FILES['import']['name'];
136
+ $file_ext = pathinfo( $file_name, PATHINFO_EXTENSION );
137
+ $file_size = $_FILES['import']['size'];
138
+
139
+ if ( ($file_ext == "json") && ($file_size < 500000) ) {
140
+
141
+ $data = $this->import_json_file( $_FILES['import']['tmp_name'] );
142
+
143
+ if ( $data ) {
144
+ printf( '<div class="updated"><p>%s</p></div>', __( 'Import successful. Have fun!', 'wpuf' ) );
145
+ }
146
+ } else {
147
+ printf( '<div class="error"><p>%s</p></div>', __( 'Invalid file or file size too big.', 'wpuf' ) );
148
+ }
149
+ }
150
+ }
151
+ ?>
152
+
153
+ <h3><?php _e( 'Import forms', 'wpuf' ); ?></h3>
154
+
155
+ <p><?php _e( 'Click Browse button and choose a json file that you backup before.', 'wpuf' ); ?></p>
156
+ <p><?php _e( 'Press Restore button, WordPress does the rest for you.', 'wpuf' ); ?></p>
157
+
158
+ <form action="" method="post" enctype='multipart/form-data' style="margin-top: 20px;">
159
+ <?php wp_nonce_field( 'wpuf-import' ); ?>
160
+ <input type='file' name='import' />
161
+ <input type="submit" class="button button-primary" name="import_data" value="<?php _e( 'Import', 'wpuf' ); ?>">
162
+ </form>
163
+ <?php
164
+ }
165
+
166
+ /**
167
+ * Import json file into database
168
+ * @param array $file
169
+ * @return boolean
170
+ */
171
+ function import_json_file( $file ) {
172
+
173
+ $encode_data = file_get_contents( $file );
174
+ $options = json_decode( $encode_data, true );
175
+
176
+ foreach ( $options as $key => $value ) {
177
+
178
+ $generate_post = array(
179
+ 'post_title' => $value['post_data']['post_title'],
180
+ 'post_status' => $value['post_data']['post_status'],
181
+ 'post_type' => $value['post_data']['post_type'],
182
+ 'ping_status' => $value['post_data']['ping_status'],
183
+ 'comment_status' => $value['post_data']['comment_status']
184
+ );
185
+
186
+ $post_id = wp_insert_post( $generate_post, true );
187
+
188
+ if ( $post_id && !is_wp_error( $post_id ) ) {
189
+
190
+ foreach ( $value['meta_data']['fields'] as $order => $field ) {
191
+ wpuf_insert_form_field( $post_id, $field, false, $order );
192
+ }
193
+
194
+ update_post_meta( $post_id, 'wpuf_form_settings', $value['meta_data']['settings'] );
195
+ }
196
+ }
197
+
198
+ return true;
199
+ }
200
+
201
+ /**
202
+ * Export Registration form
203
+ * @param string $export_type
204
+ * @param integer $post_ids
205
+ */
206
+ function export_regis_data( $export_type, $post_ids ) {
207
+
208
+ if ( $export_type == 'all' && check_admin_referer( 'wpuf-export-regs-form' ) ) {
209
+
210
+ $this->export_to_json( 'wpuf_profile' );
211
+
212
+ } elseif ( $export_type == 'selected' && check_admin_referer( 'wpuf-export-regs-form' ) ) {
213
+
214
+ if ( $_POST['formlist'] == NULL ) {
215
+ printf( '<div class="error"><p>%s</p></div>', __( 'Please select some form for exporting', 'wpuf' ) );
216
+ } else {
217
+ $this->export_to_json( 'wpuf_profile', $post_ids );
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Export normal form data
224
+ * @param string $export_type
225
+ * @param integer $post_ids
226
+ */
227
+ function export_data( $export_type, $post_ids ) {
228
+ if ( $export_type == 'all' && check_admin_referer( 'wpuf-export-form' ) ) {
229
+
230
+ $this->export_to_json( 'wpuf_forms' );
231
+
232
+ } elseif ( $export_type == 'selected' && check_admin_referer( 'wpuf-export-form' ) ) {
233
+
234
+ if ( $_POST['formlist'] == NULL ) {
235
+ printf( '<div class="error"><p>%s</p></div>', __( 'Please select some form for exporting', 'wpuf' ) );
236
+ } else {
237
+ $this->export_to_json( 'wpuf_forms', $post_ids );
238
+ }
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Export into json file
244
+ *
245
+ * @param string $post_type
246
+ * @param array $post_ids
247
+ */
248
+ function export_to_json( $post_type, $post_ids = array( ) ) {
249
+
250
+ $formatted_data = array( );
251
+ $ids = array( );
252
+ $blogname = str_replace( " ", "", get_option( 'blogname' ) );
253
+ $date = date( "Y-m-d" );
254
+ $json_name = $blogname . "-wpuf-" . $date; // Namming the filename will be generated.
255
+
256
+ if ( ! empty( $post_ids ) ) {
257
+ foreach ( $post_ids as $key => $value ) {
258
+ array_push( $ids, $value );
259
+ }
260
+ }
261
+
262
+ $args = array(
263
+ 'post_status' => 'publish',
264
+ 'post_type' => $post_type,
265
+ 'post__in' => (!empty( $ids ) ) ? $ids : ''
266
+ );
267
+
268
+ $query = new WP_Query( $args );
269
+
270
+ foreach ( $query->posts as $post ) {
271
+ $postdata = get_object_vars( $post );
272
+ unset( $postdata['ID'] );
273
+
274
+ $data = array(
275
+ 'post_data' => $postdata,
276
+ 'meta_data' => array(
277
+ 'fields' => wpuf_get_form_fields( $post->ID ),
278
+ 'settings' => get_post_meta( $post->ID, 'wpuf_form_settings', true )
279
+ )
280
+ );
281
+
282
+ array_push( $formatted_data, $data );
283
+ }
284
+
285
+ $json_file = json_encode( $formatted_data ); // Encode data into json data
286
+
287
+ ob_clean();
288
+
289
+ echo $json_file;
290
+
291
+ header( "Content-Type: text/json; charset=" . get_option( 'blog_charset' ) );
292
+ header( "Content-Disposition: attachment; filename=$json_name.json" );
293
+
294
+ exit();
295
+ }
296
+
297
+ /**
298
+ * Formetted meta key value
299
+ *
300
+ * @param array $array
301
+ * @return array
302
+ */
303
+ function formetted_meta_key_value( $array ) {
304
+ $result = array( );
305
+
306
+ foreach ( $array as $key => $val ) {
307
+ $result[$key] = $val[0];
308
+ }
309
+
310
+ return $result;
311
+ }
312
+
313
+ function tool_page() {
314
+ $msg = isset( $_GET['msg'] ) ? $_GET['msg'] : '';
315
+ $text = '';
316
+
317
+ switch ($msg) {
318
+ case 'del_forms':
319
+ $text = __( 'All forms has been deleted', 'wpuf' );
320
+ break;
321
+
322
+ case 'settings_cleared':
323
+ $text = __( 'Settings has been cleared!', 'wpuf' );
324
+ break;
325
+
326
+ case 'del_trans':
327
+ $text = __( 'All transactions has been deleted!', 'wpuf' );
328
+ break;
329
+ }
330
+
331
+ if ( $text ) {
332
+ ?>
333
+ <div class="updated">
334
+ <p>
335
+ <?php echo $text; ?>
336
+ </p>
337
+ </div>
338
+
339
+ <?php } ?>
340
+
341
+
342
+ <div class="metabox-holder">
343
+ <div class="postbox">
344
+ <h3><?php _e( 'Page Installation', 'wpuf' ); ?></h3>
345
+
346
+ <div class="inside">
347
+ <p><?php _e( 'Clicking this button will create required pages for the plugin. Note: It\'ll not delete/replace existing pages.', 'wpuf' ); ?></p>
348
+ <a class="button button-primary" href="<?php echo add_query_arg( array( 'install_wpuf_pages' => true ) ); ?>"><?php _e( 'Install WPUF Pages', 'wpuf' ); ?></a>
349
+ </div>
350
+ </div>
351
+
352
+ <div class="postbox">
353
+ <h3><?php _e( 'Reset Settings', 'wpuf' ); ?></h3>
354
+
355
+ <div class="inside">
356
+ <p><?php _e( '<strong>Caution:</strong> This tool will delete all the plugin settings of WP User Frontend Pro', 'wpuf' ); ?></p>
357
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'clear_settings' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Reset Settings', 'wpuf' ); ?></a>
358
+ </div>
359
+ </div>
360
+
361
+ <div class="postbox">
362
+ <h3><?php _e( 'Delete Forms', 'wpuf' ); ?></h3>
363
+
364
+ <div class="inside">
365
+ <p><?php _e( '<strong>Caution:</strong> This tool will delete all the post and registration/profile forms.', 'wpuf' ); ?></p>
366
+
367
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_post_forms' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Post Forms', 'wpuf' ); ?></a>
368
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_pro_forms' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Registration Forms', 'wpuf' ); ?></a>
369
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_subs' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Subscriptions', 'wpuf' ); ?></a>
370
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_coupon' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Coupons', 'wpuf' ); ?></a>
371
+ </div>
372
+ </div>
373
+
374
+ <div class="postbox">
375
+ <h3><?php _e( 'Transactions', 'wpuf' ); ?></h3>
376
+
377
+ <div class="inside">
378
+ <p><?php _e( 'This tool will delete all the transactions from the transaction table.', 'wpuf' ); ?></p>
379
+
380
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'clear_transaction' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Transactions', 'wpuf' ); ?></a>
381
+ </div>
382
+ </div>
383
+ </div>
384
+ <?php
385
+ }
386
+
387
+ }
388
+
389
+ $tools = new WPUF_Admin_Tools();
390
+ ?>
391
+
392
+ <div class="wrap">
393
+ <div id="icon-options-general" class="icon32"><br></div>
394
+
395
+ <h2 class="nav-tab-wrapper">
396
+ <a class="nav-tab <?php echo (!isset( $_GET['action'] ) ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Import', 'wpuf' ); ?></a>
397
+ <a class="nav-tab <?php echo ( isset( $_GET['action'] ) && $_GET['action'] == 'export' ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools', 'action' => 'export' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Export', 'wpuf' ); ?></a>
398
+ <a class="nav-tab <?php echo ( isset( $_GET['action'] ) && $_GET['action'] == 'tools' ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools', 'action' => 'tools' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Tools', 'wpuf' ); ?></a>
399
+ </h2>
400
+
401
+ <?php
402
+ $action = isset( $_GET['action'] ) ? $_GET['action'] : '';
403
+
404
+ switch ( $action ) {
405
+ case 'export':
406
+ $tools->list_forms();
407
+ $tools->list_regis_forms();
408
+ break;
409
+
410
+ case 'tools':
411
+ $tools->tool_page();
412
+ break;
413
+
414
+ default:
415
+ $tools->import_data();
416
+ break;
417
+ }
418
+ ?>
419
+ </div>
420
+
421
+ <style>
422
+ select.formlist{
423
+ display: block;
424
+ width: 300px;
425
+ }
426
+
427
+ </style>
428
+
429
+ <script>
430
+ (function($){
431
+
432
+ $('.formlist').hide();
433
+ $('input.export_type').on('change',function(){
434
+ $(this).closest('form').find('.formlist').slideUp(200);
435
+
436
+ if( $(this).attr('value') == 'selected' ) {
437
+ $(this).closest('form').find('.formlist').slideDown(200);
438
+ }
439
+ });
440
+
441
+
442
+ })(jQuery);
443
+
444
+ </script>
445
+
admin/transactions.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e( 'Transactions', 'wpuf' ); ?></h2>
3
+
4
+ <?php
5
+ global $wpdb;
6
+ $total_income = $wpdb->get_var( "SELECT SUM(cost) FROM {$wpdb->prefix}wpuf_transaction WHERE status = 'completed'" );
7
+ $month_income = $wpdb->get_var( "SELECT SUM(cost) FROM {$wpdb->prefix}wpuf_transaction WHERE YEAR(`created`) = YEAR(NOW()) AND MONTH(`created`) = MONTH(NOW()) AND status = 'completed'" );
8
+ ?>
9
+
10
+ <ul>
11
+ <li>
12
+ <strong><?php _e( 'Total Income:', 'wpuf' ); ?></strong> <?php echo wpuf_format_price( $total_income ); ?><br />
13
+ </li>
14
+ <li>
15
+ <strong><?php _e( 'This Month:', 'wpuf' ); ?></strong> <?php echo wpuf_format_price( $month_income ); ?>
16
+ </li>
17
+ </ul>
18
+
19
+ <form method="post">
20
+ <input type="hidden" name="page" value="transactions">
21
+ <?php
22
+ $this->transactions_list_table_obj->prepare_items();
23
+ $this->transactions_list_table_obj->views();
24
+ $this->transactions_list_table_obj->display();
25
+ ?>
26
+ </form>
27
+ </div>
assets/css/admin.css ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-admin fieldset{
2
+ border: 1px solid #E3E3E3;
3
+ margin: 20px 0 0px 0;
4
+ padding-bottom: 20px;
5
+ -moz-border-radius: 5px;
6
+ -webkit-border-radius: 5px;
7
+ background: #fff;
8
+ -moz-box-shadow:inset 0 0 5px #ccc;
9
+ -webkit-box-shadow:inset 0 0 5px #ccc;
10
+ box-shadow:inset 0 0 5px #ccc;
11
+ }
12
+
13
+ .wpuf-admin legend{
14
+ -moz-border-radius: 5px 5px 5px 5px;
15
+ -webkit-border-radius: 5px;
16
+ background: #FFFFFF;
17
+ border: 1px solid #E3E3E3;
18
+ color: #2481C6;
19
+ font-size: 15px;
20
+ font-weight: bold;
21
+ margin-left: 20px;
22
+ padding: 5px 10px;
23
+ text-transform: capitalize;
24
+ -moz-box-shadow:inset 0 0 5px #ccc;
25
+ -webkit-box-shadow:inset 0 0 5px #ccc;
26
+ box-shadow:inset 0 0 5px #ccc;
27
+ }
28
+
29
+ .wpuf-admin .widefat td{
30
+ padding: 7px 12px;
31
+ vertical-align: top;
32
+ }
33
+
34
+ .wpuf-admin .meta td.label{
35
+ width: 140px;
36
+ font-size: 12px;
37
+ }
38
+
39
+ .wpuf-admin td.label{
40
+ font-size: 12px;
41
+ }
42
+
43
+ .wpuf-admin .options td:nth-child(odd){
44
+ background-color: F9F9F9;
45
+ }
46
+
47
+ .wpuf-admin .meta .description {
48
+ font-size: 11px;
49
+ }
50
+
51
+ .wpuf_admin ul {
52
+ margin: 10px;
53
+ }
54
+
55
+ .wpuf_admin li {
56
+ padding: 0 0 10px;
57
+ margin: 0 0 10px;
58
+ border-bottom: 1px solid #E7E7E7;
59
+ line-height: 20px;
60
+ }
61
+
62
+ .wpuf_admin li:last-child {
63
+ border-bottom: none;
64
+ }
65
+
66
+ .wpuf_admin span.label {
67
+ float: left;
68
+ height: 20px;
69
+ line-height: 20px;
70
+ width: 200px;
71
+ }
72
+
73
+ .wpuf-admin .nav-tab {
74
+ font-size: 15px;
75
+ margin: 0 0px -1px 0;
76
+ }
77
+
78
+ .tooltip {
79
+ position:absolute;
80
+ z-index:9999;
81
+ color: #fff;
82
+ font-size:11px;
83
+ width: 250px;
84
+ background: #333;
85
+ -moz-border-radius: 5px;
86
+ -webkit-border-radius: 5px;
87
+ margin: 20px;
88
+ opacity: .8;
89
+ }
90
+
91
+ .tooltip:after {
92
+ border-color: transparent transparent #333;
93
+ border-style: solid;
94
+ border-width: 8px;
95
+ content: "";
96
+ display: block;
97
+ height: 0;
98
+ left: 20px;
99
+ position: absolute;
100
+ top: -16px;
101
+ width: 0;
102
+ }
103
+
104
+
105
+ .tooltip .tipBody {
106
+ padding: 5px 10px;
107
+ text-indent: 0;
108
+ color: #fff;
109
+ text-shadow: 1px 1px 1px #333;
110
+ font-size: 12px;
111
+ }
112
+
113
+ .tooltip .buble {
114
+ border-right: 60px solid white;
115
+ border-top: 50px solid #CCCCCC;
116
+ height: 0;
117
+ line-height: 0;
118
+ position: absolute;
119
+ right: -60px;
120
+ top: 30px;
121
+ width: 0;
122
+ }
123
+
124
+ span.wpuf_help{
125
+ height: 16px;
126
+ width: 16px;
127
+ background: url('../images/help.png') no-repeat;
128
+ cursor: pointer;
129
+ float: right;
130
+ display: none;
131
+ }
132
+
133
+ #option-saved{
134
+ -moz-border-radius: 5px 5px 5px 5px;
135
+ background: none repeat scroll 0 0 orange;
136
+ border: 1px solid #CCCCCC;
137
+ color: #FFFFFF;
138
+ display: none;
139
+ font-size: 30px;
140
+ padding: 50px;
141
+ position: absolute;
142
+ left: 50%;
143
+ z-index: 99;
144
+ -moz-box-shadow:0 0 8px rgba(82,168,236,.5);
145
+ -webkit-box-shadow:0 0 8px rgba(82,168,236,.5);
146
+ }
147
+
148
+ .wpuf_loading {
149
+ height: 16px;
150
+ width: 16px;
151
+ background: url('../images/wpspin_light.gif') no-repeat;
152
+ padding: 0 0 0 20px;
153
+ margin-bottom: 10px;
154
+ }
155
+ .wpuf-status-completed {
156
+ background: url(../images/completed.png);
157
+ background-size: cover;
158
+ width: 18px;
159
+ height: 18px;
160
+ display: block;
161
+ }
162
+ .wpuf-status-processing {
163
+ background: url(../images/processing.png);
164
+ background-size: cover;
165
+ width: 18px;
166
+ height: 18px;
167
+ display: block;
168
+ }
assets/css/chosen/chosen-sprite.png ADDED
Binary file
assets/css/chosen/chosen-sprite@2x.png ADDED
Binary file
assets/css/chosen/chosen.css ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.1.0
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ /* @group Base */
14
+ .chosen-container {
15
+ position: relative;
16
+ display: inline-block;
17
+ vertical-align: middle;
18
+ font-size: 13px;
19
+ zoom: 1;
20
+ *display: inline;
21
+ -webkit-user-select: none;
22
+ -moz-user-select: none;
23
+ user-select: none;
24
+ min-width: 200px;
25
+ }
26
+ .chosen-container .chosen-drop {
27
+ position: absolute;
28
+ top: 100%;
29
+ left: -9999px;
30
+ z-index: 1010;
31
+ -webkit-box-sizing: border-box;
32
+ -moz-box-sizing: border-box;
33
+ box-sizing: border-box;
34
+ width: 100%;
35
+ border: 1px solid #ddd;
36
+ border-top: 0;
37
+ background: #fff;
38
+ box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
39
+ }
40
+ .chosen-container.chosen-with-drop .chosen-drop {
41
+ left: 0;
42
+ }
43
+ .chosen-container a {
44
+ cursor: pointer;
45
+ }
46
+
47
+ /* @end */
48
+ /* @group Single Chosen */
49
+ .chosen-container-single .chosen-single {
50
+ position: relative;
51
+ display: block;
52
+ overflow: hidden;
53
+ padding: 0 0 0 8px;
54
+ height: 23px;
55
+ border: 1px solid #aaa;
56
+ border-radius: 5px;
57
+ background-color: #fff;
58
+ background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
59
+ background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
60
+ background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
61
+ background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
62
+ background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
63
+ background-clip: padding-box;
64
+ box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
65
+ color: #444;
66
+ text-decoration: none;
67
+ white-space: nowrap;
68
+ line-height: 24px;
69
+ }
70
+ .chosen-container-single .chosen-default {
71
+ color: #999;
72
+ }
73
+ .chosen-container-single .chosen-single span {
74
+ display: block;
75
+ overflow: hidden;
76
+ margin-right: 26px;
77
+ text-overflow: ellipsis;
78
+ white-space: nowrap;
79
+ }
80
+ .chosen-container-single .chosen-single-with-deselect span {
81
+ margin-right: 38px;
82
+ }
83
+ .chosen-container-single .chosen-single abbr {
84
+ position: absolute;
85
+ top: 6px;
86
+ right: 26px;
87
+ display: block;
88
+ width: 12px;
89
+ height: 12px;
90
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
91
+ font-size: 1px;
92
+ }
93
+ .chosen-container-single .chosen-single abbr:hover {
94
+ background-position: -42px -10px;
95
+ }
96
+ .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
97
+ background-position: -42px -10px;
98
+ }
99
+ .chosen-container-single .chosen-single div {
100
+ position: absolute;
101
+ top: 0;
102
+ right: 0;
103
+ display: block;
104
+ width: 18px;
105
+ height: 100%;
106
+ }
107
+ .chosen-container-single .chosen-single div b {
108
+ display: block;
109
+ width: 100%;
110
+ height: 100%;
111
+ background: url('chosen-sprite.png') no-repeat 0px 2px;
112
+ }
113
+ .chosen-container-single .chosen-search {
114
+ position: relative;
115
+ z-index: 1010;
116
+ margin: 0;
117
+ padding: 3px 4px;
118
+ white-space: nowrap;
119
+ }
120
+ .chosen-container-single .chosen-search input[type="text"] {
121
+ -webkit-box-sizing: border-box;
122
+ -moz-box-sizing: border-box;
123
+ box-sizing: border-box;
124
+ margin: 1px 0;
125
+ padding: 4px 20px 4px 5px;
126
+ width: 100%;
127
+ height: auto;
128
+ outline: 0;
129
+ border: 1px solid #aaa;
130
+ background: white url('chosen-sprite.png') no-repeat 100% -20px;
131
+ background: url('chosen-sprite.png') no-repeat 100% -20px;
132
+ font-size: 1em;
133
+ font-family: sans-serif;
134
+ line-height: normal;
135
+ border-radius: 0;
136
+ }
137
+ .chosen-container-single .chosen-drop {
138
+ margin-top: -1px;
139
+ border-radius: 0 0 4px 4px;
140
+ background-clip: padding-box;
141
+ }
142
+ .chosen-container-single.chosen-container-single-nosearch .chosen-search {
143
+ position: absolute;
144
+ left: -9999px;
145
+ }
146
+
147
+ /* @end */
148
+ /* @group Results */
149
+ .chosen-container .chosen-results {
150
+ position: relative;
151
+ overflow-x: hidden;
152
+ overflow-y: auto;
153
+ margin: 0 4px 4px 0;
154
+ padding: 0 0 0 4px;
155
+ max-height: 240px;
156
+ -webkit-overflow-scrolling: touch;
157
+ }
158
+ .chosen-container .chosen-results li {
159
+ display: none;
160
+ margin: 0;
161
+ padding: 5px 6px;
162
+ list-style: none;
163
+ line-height: 15px;
164
+ -webkit-touch-callout: none;
165
+ }
166
+ .chosen-container .chosen-results li.active-result {
167
+ display: list-item;
168
+ cursor: pointer;
169
+ }
170
+ .chosen-container .chosen-results li.disabled-result {
171
+ display: list-item;
172
+ color: #ccc;
173
+ cursor: default;
174
+ }
175
+ .chosen-container .chosen-results li.highlighted {
176
+ background-color: #3875d7;
177
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
178
+ background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
179
+ background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
180
+ background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
181
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
182
+ color: #fff;
183
+ }
184
+ .chosen-container .chosen-results li.no-results {
185
+ display: list-item;
186
+ background: #f4f4f4;
187
+ }
188
+ .chosen-container .chosen-results li.group-result {
189
+ display: list-item;
190
+ font-weight: bold;
191
+ cursor: default;
192
+ }
193
+ .chosen-container .chosen-results li.group-option {
194
+ padding-left: 15px;
195
+ }
196
+ .chosen-container .chosen-results li em {
197
+ font-style: normal;
198
+ text-decoration: underline;
199
+ }
200
+
201
+ /* @end */
202
+ /* @group Multi Chosen */
203
+ .chosen-container-multi .chosen-choices {
204
+ position: relative;
205
+ overflow: hidden;
206
+ -webkit-box-sizing: border-box;
207
+ -moz-box-sizing: border-box;
208
+ box-sizing: border-box;
209
+ margin: 0;
210
+ padding: 0;
211
+ width: 100%;
212
+ height: auto !important;
213
+ height: 1%;
214
+ border: 1px solid #aaa;
215
+ background-color: #fff;
216
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
217
+ background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
218
+ background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
219
+ background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
220
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
221
+ cursor: text;
222
+ }
223
+ .chosen-container-multi .chosen-choices li {
224
+ float: left;
225
+ list-style: none;
226
+ }
227
+ .chosen-container-multi .chosen-choices li.search-field {
228
+ margin: 0;
229
+ padding: 0;
230
+ white-space: nowrap;
231
+ }
232
+ .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
233
+ margin: 1px 0;
234
+ padding: 5px;
235
+ height: 15px;
236
+ outline: 0;
237
+ border: 0 !important;
238
+ background: transparent !important;
239
+ box-shadow: none;
240
+ color: #666;
241
+ font-size: 100%;
242
+ font-family: sans-serif;
243
+ line-height: normal;
244
+ border-radius: 0;
245
+ }
246
+ .chosen-container-multi .chosen-choices li.search-field .default {
247
+ color: #999;
248
+ }
249
+ .chosen-container-multi .chosen-choices li.search-choice {
250
+ position: relative;
251
+ margin: 3px 0 3px 5px;
252
+ padding: 3px 20px 3px 5px;
253
+ border: 1px solid #aaa;
254
+ border-radius: 3px;
255
+ background-color: #e4e4e4;
256
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
257
+ background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
258
+ background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
259
+ background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
260
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
261
+ background-clip: padding-box;
262
+ box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
263
+ color: #333;
264
+ line-height: 13px;
265
+ cursor: default;
266
+ }
267
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
268
+ position: absolute;
269
+ top: 4px;
270
+ right: 3px;
271
+ display: block;
272
+ width: 12px;
273
+ height: 12px;
274
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
275
+ font-size: 1px;
276
+ }
277
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
278
+ background-position: -42px -10px;
279
+ }
280
+ .chosen-container-multi .chosen-choices li.search-choice-disabled {
281
+ padding-right: 5px;
282
+ border: 1px solid #ccc;
283
+ background-color: #e4e4e4;
284
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
285
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
286
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
287
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
288
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
289
+ color: #666;
290
+ }
291
+ .chosen-container-multi .chosen-choices li.search-choice-focus {
292
+ background: #d4d4d4;
293
+ }
294
+ .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
295
+ background-position: -42px -10px;
296
+ }
297
+ .chosen-container-multi .chosen-results {
298
+ margin: 0;
299
+ padding: 0;
300
+ }
301
+ .chosen-container-multi .chosen-drop .result-selected {
302
+ display: list-item;
303
+ color: #ccc;
304
+ cursor: default;
305
+ }
306
+
307
+ /* @end */
308
+ /* @group Active */
309
+ .chosen-container-active .chosen-single {
310
+ border: 1px solid #5897fb;
311
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
312
+ }
313
+ .chosen-container-active.chosen-with-drop .chosen-single {
314
+ border: 1px solid #aaa;
315
+ -moz-border-radius-bottomright: 0;
316
+ border-bottom-right-radius: 0;
317
+ -moz-border-radius-bottomleft: 0;
318
+ border-bottom-left-radius: 0;
319
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
320
+ background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
321
+ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
322
+ background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
323
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
324
+ box-shadow: 0 1px 0 #fff inset;
325
+ }
326
+ .chosen-container-active.chosen-with-drop .chosen-single div {
327
+ border-left: none;
328
+ background: transparent;
329
+ }
330
+ .chosen-container-active.chosen-with-drop .chosen-single div b {
331
+ background-position: -18px 2px;
332
+ }
333
+ .chosen-container-active .chosen-choices {
334
+ border: 1px solid #5897fb;
335
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
336
+ }
337
+ .chosen-container-active .chosen-choices li.search-field input[type="text"] {
338
+ color: #111 !important;
339
+ }
340
+
341
+ /* @end */
342
+ /* @group Disabled Support */
343
+ .chosen-disabled {
344
+ opacity: 0.5 !important;
345
+ cursor: default;
346
+ }
347
+ .chosen-disabled .chosen-single {
348
+ cursor: default;
349
+ }
350
+ .chosen-disabled .chosen-choices .search-choice .search-choice-close {
351
+ cursor: default;
352
+ }
353
+
354
+ /* @end */
355
+ /* @group Right to Left */
356
+ .chosen-rtl {
357
+ text-align: right;
358
+ }
359
+ .chosen-rtl .chosen-single {
360
+ overflow: visible;
361
+ padding: 0 8px 0 0;
362
+ }
363
+ .chosen-rtl .chosen-single span {
364
+ margin-right: 0;
365
+ margin-left: 26px;
366
+ direction: rtl;
367
+ }
368
+ .chosen-rtl .chosen-single-with-deselect span {
369
+ margin-left: 38px;
370
+ }
371
+ .chosen-rtl .chosen-single div {
372
+ right: auto;
373
+ left: 3px;
374
+ }
375
+ .chosen-rtl .chosen-single abbr {
376
+ right: auto;
377
+ left: 26px;
378
+ }
379
+ .chosen-rtl .chosen-choices li {
380
+ float: right;
381
+ }
382
+ .chosen-rtl .chosen-choices li.search-field input[type="text"] {
383
+ direction: rtl;
384
+ }
385
+ .chosen-rtl .chosen-choices li.search-choice {
386
+ margin: 3px 5px 3px 0;
387
+ padding: 3px 5px 3px 19px;
388
+ }
389
+ .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
390
+ right: auto;
391
+ left: 4px;
392
+ }
393
+ .chosen-rtl.chosen-container-single-nosearch .chosen-search,
394
+ .chosen-rtl .chosen-drop {
395
+ left: 9999px;
396
+ }
397
+ .chosen-rtl.chosen-container-single .chosen-results {
398
+ margin: 0 0 4px 4px;
399
+ padding: 0 4px 0 0;
400
+ }
401
+ .chosen-rtl .chosen-results li.group-option {
402
+ padding-right: 15px;
403
+ padding-left: 0;
404
+ }
405
+ .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
406
+ border-right: none;
407
+ }
408
+ .chosen-rtl .chosen-search input[type="text"] {
409
+ padding: 4px 5px 4px 20px;
410
+ background: white url('chosen-sprite.png') no-repeat -30px -20px;
411
+ background: url('chosen-sprite.png') no-repeat -30px -20px;
412
+ direction: rtl;
413
+ }
414
+ .chosen-rtl.chosen-container-single .chosen-single div b {
415
+ background-position: 6px 2px;
416
+ }
417
+ .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
418
+ background-position: -12px 2px;
419
+ }
420
+
421
+ /* @end */
422
+ /* @group Retina compatibility */
423
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
424
+ .chosen-rtl .chosen-search input[type="text"],
425
+ .chosen-container-single .chosen-single abbr,
426
+ .chosen-container-single .chosen-single div b,
427
+ .chosen-container-single .chosen-search input[type="text"],
428
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
429
+ .chosen-container .chosen-results-scroll-down span,
430
+ .chosen-container .chosen-results-scroll-up span {
431
+ background-image: url('chosen-sprite@2x.png') !important;
432
+ background-size: 52px 37px !important;
433
+ background-repeat: no-repeat !important;
434
+ }
435
+ }
436
+ /* @end */
assets/css/formbuilder.css ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-hide {
2
+ display: none;
3
+ }
4
+ .wpuf-pro-text-alert {
5
+ font-style: italic;
6
+ color: #ccc;
7
+ }
8
+ .wpuf-pro-text-alert a {
9
+ text-decoration: none;
10
+ color: #aaa;
11
+ }
12
+ #wpuf-pro-content {
13
+ opacity: 0.7;
14
+ }
15
+ .wpuf-pro-content {
16
+ opacity: 0.7;
17
+ }
18
+ #wpuf-metabox-editor {
19
+ background: transparent;
20
+ border: none;
21
+ box-shadow: none;
22
+ }
23
+ #wpuf-metabox-editor .handlediv {
24
+ display: none;
25
+ }
26
+ #wpuf-metabox-editor .hndle {
27
+ display: none;
28
+ }
29
+ #wpuf-metabox-editor .wpuf-updated {
30
+ background-color: #ffffe0;
31
+ border: 1px solid #e6db55;
32
+ border-radius: 5px;
33
+ padding: 0 10px;
34
+ margin: 5px 0 15px;
35
+ font-weight: bold;
36
+ }
37
+ #wpuf-metabox-editor h2.nav-tab-wrapper {
38
+ padding: 0;
39
+ }
40
+ #wpuf-metabox-editor h2.nav-tab-wrapper a:first-child {
41
+ margin-left: 10px;
42
+ }
43
+ #wpuf-metabox-editor .inside {
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+ #wpuf-metabox-editor .inside h3 {
48
+ border-bottom: 1px solid #E6E6E6;
49
+ cursor: pointer;
50
+ padding-left: 0;
51
+ padding-bottom: 10px;
52
+ }
53
+ #wpuf-metabox-fields h2 {
54
+ margin: 0;
55
+ }
56
+ #wpuf-metabox-fields .wpuf-form-buttons {
57
+ margin-bottom: 10px;
58
+ }
59
+ #wpuf-metabox-fields button {
60
+ margin-bottom: 5px;
61
+ }
62
+ #wpuf-metabox-fields .wpuf-loading {
63
+ width: 16px;
64
+ height: 16px;
65
+ background: url('../images/wpspin_light.gif') no-repeat;
66
+ }
67
+ #wpuf-metabox-fields .wpuf-loading.hide {
68
+ display: none;
69
+ }
70
+ .wpuf-form-editor {
71
+ font-size: 12px;
72
+ margin: 0;
73
+ }
74
+ .wpuf-form-editor li {
75
+ background: #FFF;
76
+ margin-bottom: 10px;
77
+ border: 1px solid #dfdfdf;
78
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
79
+ }
80
+ .wpuf-form-editor li.ui-state-highlight {
81
+ border: 1px dashed #DDD;
82
+ min-height: 50px;
83
+ background: #eee;
84
+ }
85
+ .wpuf-form-editor li.password .required-field,
86
+ .wpuf-form-editor li.user_email .required-field {
87
+ display: none;
88
+ }
89
+ .wpuf-form-editor li .wpuf-legend {
90
+ background: #fff;
91
+ color: #464646;
92
+ border-bottom: 1px solid #eee;
93
+ padding-bottom: 5px;
94
+ padding: 7px 10px;
95
+ }
96
+ .wpuf-form-editor li .wpuf-legend:after {
97
+ clear: both;
98
+ content: "";
99
+ display: table;
100
+ }
101
+ .wpuf-form-editor li .wpuf-legend:hover {
102
+ cursor: move;
103
+ }
104
+ .wpuf-form-editor li .wpuf-legend .wpuf-label {
105
+ float: left;
106
+ width: 70%;
107
+ }
108
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions {
109
+ float: right;
110
+ }
111
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a {
112
+ font-size: 11px;
113
+ padding: 2px 5px;
114
+ }
115
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a.wpuf-remove {
116
+ background: transparent url(../images/delete.png) no-repeat 70% 50%;
117
+ color: #f00;
118
+ width: 16px;
119
+ text-indent: -9999px;
120
+ display: inline-block;
121
+ }
122
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a.wpuf-toggle {
123
+ background: transparent url(../images/arrows.png) no-repeat 0 2px;
124
+ width: 10px;
125
+ text-indent: -9999px;
126
+ display: inline-block;
127
+ }
128
+ .wpuf-form-editor li .wpuf-form-holder {
129
+ padding: 10px;
130
+ }
131
+ .wpuf-form-editor li .wpuf-form-rows {
132
+ padding-bottom: 3px;
133
+ }
134
+ .wpuf-form-editor li .wpuf-form-rows:after {
135
+ clear: both;
136
+ content: "";
137
+ display: table;
138
+ }
139
+ .wpuf-form-editor li .wpuf-form-rows label {
140
+ float: left;
141
+ width: 20%;
142
+ font-size: 12px;
143
+ }
144
+ .wpuf-form-editor li .wpuf-form-rows textarea {
145
+ width: 60%;
146
+ }
147
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields {
148
+ width: 77%;
149
+ float: left;
150
+ }
151
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields label {
152
+ float: none;
153
+ display: inline-block;
154
+ width: auto;
155
+ }
156
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-show-field-value {
157
+ margin: 7px 0 7px 0;
158
+ }
159
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-option-label-value {
160
+ margin: 0;
161
+ }
162
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-option-label-value span {
163
+ font-weight: bold;
164
+ margin-left: 5%;
165
+ margin-right: 27%;
166
+ }
167
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields.wpuf-options {
168
+ margin-bottom: 10px;
169
+ }
170
+ .wpuf-form-editor li .wpuf-form-rows table.address-table {
171
+ width: 100%;
172
+ margin-bottom: 15px;
173
+ }
174
+ .wpuf-form-editor li .wpuf-form-rows table.address-table label {
175
+ float: none;
176
+ width: 100%;
177
+ }
178
+ .ui-state-highlight {
179
+ height: 1.5em;
180
+ line-height: 1.2em;
181
+ }
182
+ .wpuf-form-template-modal {
183
+ background: #fff;
184
+ position: fixed;
185
+ top: 5%;
186
+ bottom: 5%;
187
+ right: 10%;
188
+ left: 10%;
189
+ display: none;
190
+ box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
191
+ z-index: 160000;
192
+ }
193
+ .wpuf-form-template-modal * {
194
+ box-sizing: border-box;
195
+ }
196
+ .wpuf-form-template-modal a.close {
197
+ position: absolute;
198
+ top: 0;
199
+ right: 0;
200
+ font: 300 1.71429em "dashicons" !important;
201
+ color: #777;
202
+ content: '\f335';
203
+ display: inline-block;
204
+ padding: 10px 20px;
205
+ z-index: 5;
206
+ text-decoration: none;
207
+ height: 50px;
208
+ cursor: pointer;
209
+ border-left: 1px solid #ddd;
210
+ }
211
+ .wpuf-form-template-modal a.close:hover {
212
+ background: #eee;
213
+ opacity: 0.8;
214
+ text-decoration: none;
215
+ }
216
+ .wpuf-form-template-modal a.close:active {
217
+ background: #eee;
218
+ opacity: 0.4;
219
+ }
220
+ .wpuf-form-template-modal .modal-header {
221
+ position: absolute;
222
+ top: 0;
223
+ left: 0;
224
+ right: 0;
225
+ height: 50px;
226
+ z-index: 4;
227
+ border-bottom: 1px solid #ddd;
228
+ padding-left: 15px;
229
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
230
+ }
231
+ .wpuf-form-template-modal .modal-header h2 {
232
+ line-height: 50px;
233
+ text-align: left;
234
+ margin-top: 0;
235
+ color: #5d6d74;
236
+ font-size: 20px;
237
+ text-shadow: 0 1px 1px #fff;
238
+ }
239
+ .wpuf-form-template-modal .modal-header h2 small {
240
+ font-weight: normal;
241
+ font-size: 13px;
242
+ margin-left: 15px;
243
+ }
244
+ .wpuf-form-template-modal .content-container {
245
+ position: absolute;
246
+ top: 75px;
247
+ right: 0;
248
+ bottom: 50px;
249
+ left: 0;
250
+ overflow: auto;
251
+ padding: 2em 2em;
252
+ }
253
+ .wpuf-form-template-modal .content {
254
+ margin: 0 auto;
255
+ max-width: 900px;
256
+ text-align: left;
257
+ }
258
+ .wpuf-form-template-modal .content ul {
259
+ width: 100%;
260
+ margin: 0;
261
+ padding: 0;
262
+ }
263
+ .wpuf-form-template-modal .content ul li {
264
+ float: left;
265
+ width: 31.292517006803%;
266
+ border: 1px solid #e4e4e4;
267
+ padding: 0;
268
+ margin-left: 3.0612244897959%;
269
+ margin-bottom: 30px;
270
+ position: relative;
271
+ min-height: 120px;
272
+ }
273
+ .wpuf-form-template-modal .content ul li:hover {
274
+ background: #F5F5F5;
275
+ }
276
+ .wpuf-form-template-modal .content ul li a {
277
+ text-decoration: none;
278
+ color: #555;
279
+ padding: 20px;
280
+ display: block;
281
+ min-height: 118px;
282
+ }
283
+ .wpuf-form-template-modal .content ul li .title {
284
+ font-size: 17px;
285
+ margin: 0 0 10px 0;
286
+ line-height: 23px;
287
+ }
288
+ .wpuf-form-template-modal .content ul li .description {
289
+ color: #888;
290
+ }
291
+ .wpuf-form-template-modal .content ul li:nth-child(3n+1) {
292
+ margin-left: 0;
293
+ clear: both;
294
+ }
295
+ .wpuf-form-template-modal .content ul li.template-inactive .title,
296
+ .wpuf-form-template-modal .content ul li.template-inactive .description {
297
+ color: #ddd;
298
+ }
299
+ .wpuf-form-template-modal .content ul li.blank-form {
300
+ text-align: center;
301
+ }
302
+ .wpuf-form-template-modal .content ul li.blank-form span {
303
+ display: block;
304
+ }
305
+ .wpuf-form-template-modal .content ul li.blank-form span.dashicons {
306
+ font-size: 45px;
307
+ color: #ddd;
308
+ margin: 0 auto;
309
+ width: auto;
310
+ height: auto;
311
+ }
312
+ .wpuf-form-template-modal footer {
313
+ position: absolute;
314
+ left: 0;
315
+ bottom: 0;
316
+ width: 100%;
317
+ padding: 12px 20px;
318
+ border-top: 1px solid #ddd;
319
+ background: #fff;
320
+ text-align: left;
321
+ }
322
+ .wpuf-form-template-modal-backdrop {
323
+ position: fixed;
324
+ z-index: 159999;
325
+ top: 0;
326
+ left: 0;
327
+ right: 0;
328
+ bottom: 0;
329
+ min-height: 360px;
330
+ background: #000;
331
+ opacity: .7;
332
+ display: none;
333
+ }
334
+ /* Smartphones (portrait and landscape) ----------- */
335
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
336
+ .wpuf-form-template-modal .modal-header h2 small {
337
+ display: none;
338
+ }
339
+ .wpuf-form-template-modal .content ul li {
340
+ float: none;
341
+ width: 100%;
342
+ margin-left: 0;
343
+ }
344
+ }
assets/css/formbuilder.less ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .clearfix() {
2
+ &:after {
3
+ clear: both;
4
+ content: "";
5
+ display: table;
6
+ }
7
+ }
8
+
9
+ //variables
10
+ @fontSize: 12px;
11
+
12
+ .wpuf-hide {
13
+ display: none;
14
+ }
15
+
16
+ .wpuf-pro-text-alert {
17
+ font-style: italic;
18
+ color: #ccc;
19
+
20
+ a {
21
+ text-decoration: none;
22
+ color: #aaa;
23
+ }
24
+ }
25
+ #wpuf-pro-content{
26
+ opacity: 0.7;
27
+ }
28
+ .wpuf-pro-content{
29
+ opacity: 0.7;
30
+ }
31
+ #wpuf-metabox-editor {
32
+ background: transparent;
33
+ border: none;
34
+ box-shadow: none;
35
+
36
+ .handlediv { display: none; }
37
+ .hndle { display: none; }
38
+
39
+ .wpuf-updated {
40
+ background-color: #ffffe0;
41
+ border: 1px solid #e6db55;
42
+ border-radius: 5px;
43
+ padding: 0 10px;
44
+ margin: 5px 0 15px;
45
+ font-weight: bold;
46
+ }
47
+
48
+ h2.nav-tab-wrapper {
49
+ padding: 0;
50
+
51
+ a:first-child {
52
+ margin-left: 10px;
53
+ }
54
+ }
55
+
56
+ .inside {
57
+ margin: 0;
58
+ padding: 0;
59
+
60
+ h3 {
61
+ border-bottom: 1px solid #E6E6E6;
62
+ cursor: pointer;
63
+ padding-left: 0;
64
+ padding-bottom: 10px;
65
+ }
66
+ }
67
+ }
68
+
69
+ #wpuf-metabox-fields {
70
+ h2 {
71
+ margin:0;
72
+ }
73
+
74
+ .wpuf-form-buttons {
75
+ margin-bottom: 10px;
76
+ }
77
+
78
+ button {
79
+ margin-bottom: 5px;
80
+ }
81
+
82
+ .wpuf-loading {
83
+ width: 16px;
84
+ height: 16px;
85
+ background: url('../images/wpspin_light.gif') no-repeat;
86
+
87
+ &.hide {
88
+ display: none;
89
+ }
90
+ }
91
+ }
92
+
93
+ .wpuf-form-editor {
94
+ font-size: @fontSize;
95
+ margin: 0;
96
+
97
+ li {
98
+ background: #FFF;
99
+ margin-bottom: 10px;
100
+ border: 1px solid #dfdfdf;
101
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
102
+
103
+ &.ui-state-highlight {
104
+ border: 1px dashed #DDD;
105
+ min-height: 50px;
106
+ background: #eee;
107
+ }
108
+
109
+ &.password, &.user_email {
110
+ .required-field {
111
+ display: none;
112
+ }
113
+ }
114
+
115
+ .wpuf-legend {
116
+ .clearfix();
117
+
118
+ background: #fff;
119
+ color: #464646;
120
+ border-bottom: 1px solid #eee;
121
+ padding-bottom: 5px;
122
+ // margin-bottom: 5px;
123
+ padding: 7px 10px;
124
+
125
+ &:hover {
126
+ cursor: move;
127
+ }
128
+
129
+ .wpuf-label {
130
+ float: left;
131
+ width: 70%;
132
+ // font-weight: bold;
133
+ }
134
+
135
+ .wpuf-actions {
136
+ float: right;
137
+
138
+ a {
139
+ // background: #ccc;
140
+ font-size: 11px;
141
+ padding: 2px 5px;
142
+ }
143
+
144
+ a.wpuf-remove {
145
+ background: transparent url(../images/delete.png) no-repeat 70% 50%;
146
+ color: #f00;
147
+ width: 16px;
148
+ text-indent: -9999px;
149
+ display: inline-block;
150
+ }
151
+
152
+ a.wpuf-toggle {
153
+ background: transparent url(../images/arrows.png) no-repeat 0 2px;
154
+ width: 10px;
155
+ text-indent: -9999px;
156
+ display: inline-block;
157
+ }
158
+ }
159
+ }
160
+
161
+ .wpuf-form-holder {
162
+ padding: 10px;
163
+ }
164
+
165
+ .wpuf-form-rows {
166
+ .clearfix();
167
+ padding-bottom: 3px;
168
+
169
+ label {
170
+ float: left;
171
+ width: 20%;
172
+ font-size: @fontSize;
173
+ }
174
+
175
+ textarea {
176
+ width: 60%;
177
+ }
178
+
179
+ .wpuf-form-sub-fields {
180
+ width: 77%;
181
+ float: left;
182
+
183
+ label {
184
+ float: none;
185
+ display: inline-block;
186
+ width: auto;
187
+ }
188
+
189
+ .wpuf-show-field-value {
190
+ margin: 7px 0 7px 0;
191
+ }
192
+
193
+ .wpuf-option-label-value {
194
+ margin: 0;
195
+
196
+ span {
197
+ font-weight: bold;
198
+ margin-left: 5%;
199
+ margin-right: 27%;
200
+ }
201
+ }
202
+
203
+ &.wpuf-options {
204
+ margin-bottom: 10px;
205
+ }
206
+ }
207
+
208
+ table.address-table {
209
+ width: 100%;
210
+ margin-bottom: 15px;
211
+
212
+ label {
213
+ float: none;
214
+ width: 100%;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ .ui-state-highlight { height: 1.5em; line-height: 1.2em; }
222
+
223
+ .wpuf-form-template-modal {
224
+ background: #fff;
225
+ position: fixed;
226
+ top: 5%;
227
+ bottom: 5%;
228
+ right: 10%;
229
+ left: 10%;
230
+ // display: block;
231
+ display: none;
232
+ box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
233
+ z-index: 160000;
234
+
235
+ * { box-sizing: border-box; }
236
+
237
+
238
+ a.close {
239
+ position: absolute;
240
+ top: 0;
241
+ right: 0;
242
+ font: 300 1.71429em "dashicons" !important;
243
+ color: #777;
244
+ content: '\f335';
245
+ display: inline-block;
246
+ padding: 10px 20px;
247
+ z-index: 5;
248
+ text-decoration: none;
249
+ height: 50px;
250
+ cursor: pointer;
251
+ border-left: 1px solid #ddd;
252
+
253
+ &:hover {
254
+ background: #eee;
255
+ opacity: 0.8;
256
+ text-decoration: none;
257
+ }
258
+
259
+ &:active {
260
+ background: #eee;
261
+ opacity: 0.4;
262
+ }
263
+ }
264
+
265
+ .modal-header {
266
+ position: absolute;
267
+ top: 0;
268
+ left: 0;
269
+ right: 0;
270
+ height: 50px;
271
+ z-index: 4;
272
+ border-bottom: 1px solid #ddd;
273
+ padding-left: 15px;
274
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
275
+
276
+ h2 {
277
+ line-height: 50px;
278
+ text-align: left;
279
+ margin-top: 0;
280
+ color: #5d6d74;
281
+ font-size: 20px;
282
+ text-shadow: 0 1px 1px #fff;
283
+
284
+ small {
285
+ font-weight: normal;
286
+ font-size: 13px;
287
+ margin-left: 15px;
288
+ }
289
+ }
290
+ }
291
+
292
+ .content-container {
293
+ position: absolute;
294
+ top: 75px;
295
+ right: 0;
296
+ bottom: 50px;
297
+ left: 0;
298
+ overflow: auto;
299
+ padding: 2em 2em;
300
+ }
301
+
302
+ .content {
303
+ margin: 0 auto;
304
+ max-width: 900px;
305
+ text-align: left;
306
+
307
+ ul {
308
+ width: 100%;
309
+ margin: 0;
310
+ padding: 0;
311
+
312
+ li {
313
+ float: left;
314
+ width: 31.292517006803%;
315
+ border: 1px solid #e4e4e4;
316
+ padding: 0;
317
+ margin-left: 3.0612244897959%;
318
+ margin-bottom: 30px;
319
+ position: relative;
320
+ min-height: 120px;
321
+
322
+ &:hover {
323
+ background: #F5F5F5;
324
+ }
325
+
326
+ a {
327
+ text-decoration: none;
328
+ color: #555;
329
+ padding: 20px;
330
+ display: block;
331
+ min-height: 118px;
332
+ }
333
+
334
+ .title {
335
+ font-size: 17px;
336
+ margin: 0 0 10px 0;
337
+ line-height: 23px;
338
+ }
339
+
340
+ .description {
341
+ color: #888;
342
+ }
343
+
344
+ &:nth-child(3n+1) {
345
+ margin-left: 0;
346
+ clear: both;
347
+ }
348
+
349
+ &.template-inactive {
350
+ .title,
351
+ .description {
352
+ color: #ddd;
353
+ }
354
+ }
355
+
356
+ &.blank-form {
357
+ text-align: center;
358
+
359
+ span {
360
+ display: block;
361
+ }
362
+
363
+ span.dashicons {
364
+ font-size: 45px;
365
+ color: #ddd;
366
+ margin: 0 auto;
367
+ width: auto;
368
+ height: auto;
369
+ }
370
+
371
+ span.label {
372
+
373
+ }
374
+ }
375
+ }
376
+ }
377
+ }
378
+
379
+ footer {
380
+ position: absolute;
381
+ left: 0;
382
+ bottom: 0;
383
+ width: 100%;
384
+ padding: 12px 20px;
385
+ border-top: 1px solid #ddd;
386
+ background: #fff;
387
+ text-align: left;
388
+ }
389
+ }
390
+
391
+ .wpuf-form-template-modal-backdrop {
392
+ position: fixed;
393
+ z-index: 159999;
394
+ top: 0;
395
+ left: 0;
396
+ right: 0;
397
+ bottom: 0;
398
+ min-height: 360px;
399
+ background: #000;
400
+ opacity: .7;
401
+ display: none;
402
+ }
403
+
404
+ /* Smartphones (portrait and landscape) ----------- */
405
+ @media only screen
406
+ and (min-device-width : 320px)
407
+ and (max-device-width : 480px) {
408
+ .wpuf-form-template-modal {
409
+ .modal-header h2 small {
410
+ display: none;
411
+ }
412
+
413
+ .content {
414
+
415
+ ul {
416
+ li {
417
+ float: none;
418
+ width: 100%;
419
+ margin-left: 0;
420
+ }
421
+ }
422
+ }
423
+ }
424
+ }
assets/css/frontend-forms.css ADDED
@@ -0,0 +1,1161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-loading {
2
+ width: 16px;
3
+ height: 16px;
4
+ background: url('../images/wpspin_light.gif') no-repeat;
5
+ display: inline-block;
6
+ }
7
+ .wpuf-loading.hide {
8
+ display: none;
9
+ }
10
+ .wpuf-button {
11
+ background: #f3f3f3;
12
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#f4f4f4));
13
+ background-image: -webkit-linear-gradient(top, #fefefe, #f4f4f4);
14
+ background-image: -moz-linear-gradient(top, #fefefe, #f4f4f4);
15
+ background-image: -o-linear-gradient(top, #fefefe, #f4f4f4);
16
+ background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
17
+ border-color: #bbb;
18
+ color: #333;
19
+ text-shadow: 0 1px 0 #fff;
20
+ }
21
+ .wpuf-button:hover,
22
+ .wpuf-button:focus {
23
+ background: #f3f3f3;
24
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3));
25
+ background-image: -webkit-linear-gradient(top, #fff, #f3f3f3);
26
+ background-image: -moz-linear-gradient(top, #fff, #f3f3f3);
27
+ background-image: -ms-linear-gradient(top, #fff, #f3f3f3);
28
+ background-image: -o-linear-gradient(top, #fff, #f3f3f3);
29
+ background-image: linear-gradient(to bottom, #fff, #f3f3f3);
30
+ border-color: #999;
31
+ color: #222;
32
+ }
33
+ .wpuf-success {
34
+ background-color: #dff0d8;
35
+ border: 1px solid #d6e9c6;
36
+ color: #3c763d;
37
+ padding: 10px;
38
+ margin: 10px 0 20px 0;
39
+ }
40
+ .wpuf-error {
41
+ background-color: #f2dede;
42
+ color: #a94442;
43
+ border: 1px solid #ebccd1;
44
+ margin: 10px 0 20px 0;
45
+ padding: 10px;
46
+ -webkit-border-radius: 3px;
47
+ -moz-border-radius: 3px;
48
+ border-radius: 3px;
49
+ font-size: 13px;
50
+ }
51
+ .wpuf-message {
52
+ background: #fcf8e3;
53
+ border: 1px solid #faebcc;
54
+ color: #8a6d3b;
55
+ margin: 10px 0 20px 0;
56
+ padding: 10px;
57
+ -webkit-border-radius: 3px;
58
+ -moz-border-radius: 3px;
59
+ border-radius: 3px;
60
+ font-size: 13px;
61
+ }
62
+ .wpuf-info {
63
+ background-color: #fef5be;
64
+ border: 2px solid #fdd425;
65
+ border-radius: 5px;
66
+ -moz-border-radius: 5px;
67
+ -webkit-border-radius: 5px;
68
+ padding: 5px 10px;
69
+ margin: 0 0 10px 0;
70
+ font-size: 13px;
71
+ }
72
+ ul.wpuf-form {
73
+ list-style: none !important;
74
+ margin: 0 !important;
75
+ padding: 0 !important;
76
+ width: 100%;
77
+ }
78
+ ul.wpuf-form li {
79
+ margin-left: 0;
80
+ margin-bottom: 10px;
81
+ padding: 10px;
82
+ }
83
+ ul.wpuf-form li:after {
84
+ clear: both;
85
+ content: "";
86
+ display: table;
87
+ }
88
+ ul.wpuf-form li.has-error {
89
+ background: #FFE4E4;
90
+ }
91
+ ul.wpuf-form li .wp-editor-wrap {
92
+ border: 1px solid #eee;
93
+ }
94
+ ul.wpuf-form li .wpuf-label {
95
+ float: left;
96
+ width: 30%;
97
+ min-height: 1px;
98
+ font-weight: bold;
99
+ }
100
+ ul.wpuf-form li .wpuf-label .required {
101
+ color: red;
102
+ }
103
+ ul.wpuf-form li .wpuf-fields {
104
+ float: left;
105
+ width: 70%;
106
+ }
107
+ ul.wpuf-form li .wpuf-fields input[type=text],
108
+ ul.wpuf-form li .wpuf-fields input[type=password],
109
+ ul.wpuf-form li .wpuf-fields input[type=email],
110
+ ul.wpuf-form li .wpuf-fields input[type=url],
111
+ ul.wpuf-form li .wpuf-fields input[type=number],
112
+ ul.wpuf-form li .wpuf-fields textarea {
113
+ background: #fafafa;
114
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
115
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
116
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
117
+ border: 1px solid #ddd;
118
+ color: #888;
119
+ width: 95%;
120
+ }
121
+ ul.wpuf-form li .wpuf-fields input[type=text]:focus,
122
+ ul.wpuf-form li .wpuf-fields input[type=password]:focus,
123
+ ul.wpuf-form li .wpuf-fields input[type=email]:focus,
124
+ ul.wpuf-form li .wpuf-fields input[type=url]:focus,
125
+ ul.wpuf-form li .wpuf-fields input[type=number]:focus,
126
+ ul.wpuf-form li .wpuf-fields textarea:focus {
127
+ color: #373737;
128
+ }
129
+ ul.wpuf-form li .wpuf-fields textarea {
130
+ padding-left: 3px;
131
+ width: 95%;
132
+ }
133
+ ul.wpuf-form li .wpuf-fields input[type=text],
134
+ ul.wpuf-form li .wpuf-fields input[type=password],
135
+ ul.wpuf-form li .wpuf-fields input[type=email],
136
+ ul.wpuf-form li .wpuf-fields input[type=url],
137
+ ul.wpuf-form li .wpuf-fields input[type=number] {
138
+ padding: 5px;
139
+ }
140
+ ul.wpuf-form li .wpuf-fields select {
141
+ border: 1px solid #eee;
142
+ padding: 2px;
143
+ height: 2em;
144
+ -webkit-border-radius: 3px;
145
+ -moz-border-radius: 3px;
146
+ border-radius: 3px;
147
+ min-width: 150px;
148
+ }
149
+ ul.wpuf-form li .wpuf-fields select[multiple] {
150
+ height: auto;
151
+ }
152
+ ul.wpuf-form li .wpuf-fields .wpuf-radio-inline,
153
+ ul.wpuf-form li .wpuf-fields .wpuf-checkbox-inline {
154
+ display: inline-block;
155
+ margin-right: 10px;
156
+ }
157
+ ul.wpuf-form li .wpuf-fields a.file-selector {
158
+ display: inline;
159
+ padding: 5px 12px;
160
+ height: 30px;
161
+ line-height: 28px;
162
+ border: 1px solid #ccc;
163
+ -webkit-border-radius: 3px;
164
+ -moz-border-radius: 3px;
165
+ border-radius: 3px;
166
+ background-color: #21759b;
167
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
168
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
169
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
170
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
171
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
172
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
173
+ border-color: #21759b;
174
+ border-bottom-color: #1e6a8d;
175
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
176
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
177
+ color: #fff;
178
+ text-decoration: none;
179
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
180
+ }
181
+ ul.wpuf-form li .wpuf-fields a.file-selector:hover,
182
+ ul.wpuf-form li .wpuf-fields a.file-selector:focus {
183
+ background-color: #278ab7;
184
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
185
+ background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
186
+ background-image: -moz-linear-gradient(top, #2e9fd2, #21759b);
187
+ background-image: -ms-linear-gradient(top, #2e9fd2, #21759b);
188
+ background-image: -o-linear-gradient(top, #2e9fd2, #21759b);
189
+ background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
190
+ border-color: #1b607f;
191
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
192
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
193
+ color: #fff;
194
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
195
+ }
196
+ ul.wpuf-form li .wpuf-fields .google-map img {
197
+ max-width: none !important;
198
+ }
199
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap {
200
+ margin-bottom: 8px;
201
+ }
202
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap:after {
203
+ clear: both;
204
+ content: "";
205
+ display: table;
206
+ }
207
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-last .wpuf-name-field-first-name {
208
+ float: left;
209
+ width: 48%;
210
+ }
211
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-last .wpuf-name-field-middle-name {
212
+ display: none;
213
+ }
214
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-last .wpuf-name-field-last-name {
215
+ float: right;
216
+ width: 48%;
217
+ }
218
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-middle-last .wpuf-name-field-first-name {
219
+ float: left;
220
+ width: 37%;
221
+ margin-right: 3%;
222
+ }
223
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-middle-last .wpuf-name-field-middle-name {
224
+ float: left;
225
+ width: 20%;
226
+ }
227
+ ul.wpuf-form li .wpuf-fields .wpuf-name-field-wrap.format-first-middle-last .wpuf-name-field-last-name {
228
+ float: right;
229
+ width: 37%;
230
+ }
231
+ ul.wpuf-form li .wpuf-fields .wpuf-help {
232
+ color: #666;
233
+ margin: 2px 0 5px 0;
234
+ font-size: 12px;
235
+ font-style: italic;
236
+ font-family: sans-serif;
237
+ display: block;
238
+ }
239
+ ul.wpuf-form li .wpuf-fields table,
240
+ ul.wpuf-form li .wpuf-fields td {
241
+ border: none;
242
+ margin: 0;
243
+ }
244
+ ul.wpuf-form li .wpuf-fields table {
245
+ width: 100%;
246
+ }
247
+ ul.wpuf-form li .wpuf-fields img.wpuf-clone-field,
248
+ ul.wpuf-form li .wpuf-fields img.wpuf-remove-field {
249
+ cursor: pointer;
250
+ margin: 0 3px;
251
+ box-shadow: none;
252
+ border: none;
253
+ }
254
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list {
255
+ list-style: none;
256
+ margin: 5px 0 0 0;
257
+ padding: 0;
258
+ }
259
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li {
260
+ display: inline-block;
261
+ border: 1px solid #eee;
262
+ padding: 5px;
263
+ width: 150px;
264
+ margin-right: 5px;
265
+ -webkit-border-radius: 5px;
266
+ -moz-border-radius: 5px;
267
+ border-radius: 5px;
268
+ }
269
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap {
270
+ margin: 10px 0;
271
+ }
272
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap input,
273
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap textarea {
274
+ border: 1px solid #eee;
275
+ width: 93%;
276
+ }
277
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .attachment-name {
278
+ text-align: center;
279
+ }
280
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete,
281
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar {
282
+ text-decoration: none;
283
+ padding: 3px 12px;
284
+ border: 1px solid #C47272;
285
+ color: #ffffff;
286
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
287
+ -webkit-border-radius: 3px;
288
+ -moz-border-radius: 3px;
289
+ border-radius: 3px;
290
+ background-color: #da4f49;
291
+ background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
292
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
293
+ background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
294
+ background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
295
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
296
+ background-repeat: repeat-x;
297
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
298
+ border-color: #bd362f #bd362f #802420;
299
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
300
+ *background-color: #bd362f;
301
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
302
+ }
303
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete:hover,
304
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar:hover,
305
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete:active,
306
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar:active {
307
+ color: #ffffff;
308
+ background-color: #bd362f;
309
+ *background-color: #a9302a;
310
+ }
311
+ ul.wpuf-form li .wpuf-fields .progress {
312
+ background: -moz-linear-gradient(center bottom, #FFFFFF 0%, #F7F7F7 100%) repeat scroll 0 0 #FFFFFF;
313
+ border: 1px solid #D1D1D1;
314
+ border-radius: 3px 3px 3px 3px;
315
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) inset;
316
+ float: right;
317
+ height: 22px;
318
+ line-height: 2em;
319
+ margin: 0;
320
+ overflow: hidden;
321
+ padding: 0;
322
+ width: 200px;
323
+ }
324
+ ul.wpuf-form li .wpuf-fields .bar {
325
+ background-color: #83B4D8;
326
+ background-image: -moz-linear-gradient(center bottom, #72A7CF 0%, #90C5EE 100%);
327
+ border-radius: 3px 3px 3px 3px;
328
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
329
+ height: 100%;
330
+ width: 0;
331
+ z-index: 9;
332
+ }
333
+ ul.wpuf-form li .wpuf-fields .progress .percent {
334
+ color: rgba(0, 0, 0, 0.6);
335
+ padding: 0 8px;
336
+ position: relative;
337
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
338
+ width: 200px;
339
+ z-index: 10;
340
+ }
341
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist {
342
+ list-style: none;
343
+ margin: 0;
344
+ padding: 0;
345
+ }
346
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist li {
347
+ margin-bottom: 5px;
348
+ padding: 0;
349
+ }
350
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist ul.children {
351
+ list-style: none;
352
+ margin-left: 25px;
353
+ }
354
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container {
355
+ margin-bottom: 3px;
356
+ }
357
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container:after {
358
+ clear: both;
359
+ content: "";
360
+ display: table;
361
+ }
362
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container a.wpuf-insert-image {
363
+ text-decoration: none;
364
+ border: 1px solid #DFDFDF;
365
+ font-size: 11px;
366
+ -webkit-border-radius: 3px;
367
+ -moz-border-radius: 3px;
368
+ border-radius: 3px;
369
+ padding: 4px 6px;
370
+ margin-right: 10px;
371
+ }
372
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container a.wpuf-insert-image .wpuf-media-icon {
373
+ height: 12px;
374
+ width: 12px;
375
+ }
376
+ ul.wpuf-form li .wpuf-fields .wpuf-fields-list {
377
+ box-sizing: border-box;
378
+ margin: 0;
379
+ padding: 0;
380
+ list-style: none;
381
+ }
382
+ ul.wpuf-form li .wpuf-fields .wpuf-fields-list li {
383
+ padding: 0;
384
+ margin: 0 0 6px;
385
+ }
386
+ ul.wpuf-form li .wpuf-fields .wpuf-fields-list.wpuf-list-inline {
387
+ margin-left: -5px;
388
+ }
389
+ ul.wpuf-form li .wpuf-fields .wpuf-fields-list.wpuf-list-inline li {
390
+ display: inline-block;
391
+ padding-left: 5px;
392
+ padding-right: 5px;
393
+ }
394
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field {
395
+ border-collapse: collapse;
396
+ }
397
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field * {
398
+ box-sizing: border-box;
399
+ }
400
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field input {
401
+ width: 100%;
402
+ }
403
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field .wpuf-repeater-buttons {
404
+ width: 75px;
405
+ padding-left: 12px;
406
+ }
407
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field .wpuf-repeater-buttons img {
408
+ width: 100%;
409
+ height: auto;
410
+ }
411
+ ul.wpuf-form li .wpuf-fields table.wpuf-repeatable-field .wpuf-repeater-buttons i {
412
+ display: inline-block;
413
+ width: 15px;
414
+ height: 15px;
415
+ margin: 2px 4px 0 0;
416
+ }
417
+ ul.wpuf-form li .wpuf-address-field {
418
+ width: 100%;
419
+ margin-bottom: 10px;
420
+ }
421
+ ul.wpuf-form li .wpuf-address-field:after {
422
+ clear: both;
423
+ content: "";
424
+ display: table;
425
+ }
426
+ ul.wpuf-form li .wpuf-section-wrap {
427
+ border-bottom: 1px solid #ccc;
428
+ margin: 15px 0;
429
+ }
430
+ ul.wpuf-form li .wpuf-section-wrap h2.wpuf-section-title {
431
+ margin: 0;
432
+ }
433
+ ul.wpuf-form li .wpuf-section-wrap .wpuf-section-details {
434
+ padding: 4px 0 8px;
435
+ font-size: 12px;
436
+ }
437
+ ul.wpuf-form.form-label-above li .wpuf-label,
438
+ ul.wpuf-form.form-label-above li .wpuf-fields {
439
+ display: block;
440
+ float: none;
441
+ width: 100%;
442
+ }
443
+ ul.wpuf-form.form-label-above li .wpuf-label {
444
+ margin-bottom: 10px;
445
+ }
446
+ ul.wpuf-form.form-label-right li .wpuf-label {
447
+ float: right;
448
+ }
449
+ ul.wpuf-form.form-label-hidden li .wpuf-label {
450
+ display: none;
451
+ }
452
+ ul.wpuf-form.form-label-hidden li .wpuf-fields {
453
+ display: block;
454
+ float: none;
455
+ width: 100%;
456
+ }
457
+ ul.wpuf-form .wpuf-submit .wpuf-label {
458
+ display: none !important;
459
+ }
460
+ ul.wpuf-form .wpuf-submit input[type=submit] {
461
+ font-size: 16px;
462
+ padding: 5px 15px;
463
+ border: 1px solid #ccc;
464
+ -webkit-border-radius: 3px;
465
+ -moz-border-radius: 3px;
466
+ border-radius: 3px;
467
+ background-color: #21759b;
468
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
469
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
470
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
471
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
472
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
473
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
474
+ border-color: #21759b;
475
+ border-bottom-color: #1e6a8d;
476
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
477
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
478
+ color: #fff;
479
+ text-decoration: none;
480
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
481
+ }
482
+ ul.wpuf-form .wpuf-submit .button-primary-disabled {
483
+ color: #94cde7 !important;
484
+ background: #298cba !important;
485
+ border-color: #1b607f !important;
486
+ -webkit-box-shadow: none !important;
487
+ box-shadow: none !important;
488
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
489
+ cursor: default;
490
+ }
491
+ ul.wpuf-form .wpuf-submit .wpuf-errors {
492
+ background: #FFE4E4;
493
+ border: 1px solid #ffb1b1;
494
+ margin: 10px 0;
495
+ padding: 10px;
496
+ -webkit-border-radius: 3px;
497
+ -moz-border-radius: 3px;
498
+ border-radius: 3px;
499
+ font-size: 13px;
500
+ }
501
+ #wpuf-login-form label {
502
+ display: block;
503
+ }
504
+ #wpuf-login-form .forgetmenot label {
505
+ display: inline-block;
506
+ }
507
+ .wpuf_sub_info {
508
+ padding: 0;
509
+ margin: 10px 5px;
510
+ border: 1px solid #eee;
511
+ border-radius: 3px;
512
+ }
513
+ .wpuf_sub_info h3 {
514
+ background-color: #f1f1f1;
515
+ padding: 10px;
516
+ margin: 0 0 5px 0 !important;
517
+ font-weight: 300 !important;
518
+ }
519
+ .wpuf_sub_info .wpuf-text {
520
+ padding: 5px 10px;
521
+ }
522
+ .wpuf_sub_info .wpuf-expire {
523
+ border-top: 1px solid #eee;
524
+ padding-top: 5px;
525
+ margin-top: 5px;
526
+ }
527
+ .wpuf-coupon-info-wrap {
528
+ border: 1px solid #eee;
529
+ padding: 15px;
530
+ margin-bottom: 20px;
531
+ }
532
+ .wpuf-coupon-info-wrap .wpuf-coupon-field-spinner {
533
+ background: url('../images/wpspin_light.gif') no-repeat right scroll rgba(0, 0, 0, 0);
534
+ }
535
+ .wpuf-coupon-info-wrap .wpuf-copon-show {
536
+ background: #EEEEEE;
537
+ border-radius: 3px;
538
+ border-width: 1px;
539
+ box-shadow: 0 1px 0 rgba(217, 217, 217, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
540
+ color: #5C5A5A;
541
+ cursor: pointer;
542
+ display: inline-block;
543
+ font-size: 14px;
544
+ padding: 5px 12px;
545
+ text-decoration: none;
546
+ width: 175px;
547
+ margin-bottom: 8px;
548
+ }
549
+ .wpuf-coupon-info-wrap .wpuf-copon-wrap {
550
+ margin: 15px 0;
551
+ }
552
+ .wpuf-coupon-info-wrap .wpuf-pack-info {
553
+ margin-bottom: 20px;
554
+ }
555
+ .wpuf-coupon-info-wrap .wpuf-pack-info h3 {
556
+ margin: 0 0 10px 0;
557
+ padding: 0 0 10px 0;
558
+ border-bottom: 1px solid #eee;
559
+ }
560
+ .wpuf-coupon-info-wrap .wpuf-pack-info h3 a {
561
+ float: right;
562
+ text-decoration: none;
563
+ background: #64C3DE;
564
+ color: #fff;
565
+ padding: 3px 8px;
566
+ font-size: 14px;
567
+ }
568
+ .wpuf-coupon-info-wrap .wpuf-pack-info wpuf-subscription-error {
569
+ color: #D8000C;
570
+ }
571
+ .wpuf-coupon-info-wrap .wpuf-copon-show:hover {
572
+ background: none repeat scroll 0 0 #1E8CBE;
573
+ border-color: #0074A2;
574
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
575
+ color: #FFFFFF;
576
+ }
577
+ .wpuf-coupon-info-wrap a.wpuf-apply-coupon {
578
+ text-decoration: none;
579
+ font-size: 11px;
580
+ margin-top: 10px;
581
+ margin-right: 10px;
582
+ background: #21759b;
583
+ color: #fff;
584
+ padding: 5px 10px;
585
+ display: inline-block;
586
+ -webkit-border-radius: 3px;
587
+ -moz-border-radius: 3px;
588
+ border-radius: 3px;
589
+ }
590
+ .wpuf-coupon-info-wrap .wpuf-copon-cancel {
591
+ text-decoration: none;
592
+ font-size: 11px;
593
+ }
594
+ .entry-content ul.wpuf_packs,
595
+ ul.wpuf_packs {
596
+ overflow: hidden;
597
+ margin: 15px;
598
+ }
599
+ .entry-content ul.wpuf_packs > li,
600
+ ul.wpuf_packs > li {
601
+ background: #fff;
602
+ border: 1px solid #DDD;
603
+ border-radius: 5px 5px 5px 5px;
604
+ float: left;
605
+ list-style: none outside none;
606
+ margin: 5px 25px 25px 0;
607
+ position: relative;
608
+ width: 200px;
609
+ box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
610
+ }
611
+ .entry-content ul.wpuf_packs > li:first-child,
612
+ ul.wpuf_packs > li:first-child {
613
+ margin-left: 5px;
614
+ }
615
+ .entry-content ul.wpuf_packs h3,
616
+ ul.wpuf_packs h3 {
617
+ background: #52B5D5;
618
+ color: #fff;
619
+ font-size: 18px;
620
+ font-weight: normal;
621
+ margin: 0;
622
+ padding: 10px !important;
623
+ text-align: center;
624
+ border-bottom: 1px solid #3dacd0;
625
+ }
626
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap,
627
+ ul.wpuf_packs .wpuf-pricing-wrap {
628
+ background: #64C3DE;
629
+ }
630
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount,
631
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount {
632
+ position: relative;
633
+ text-align: center;
634
+ color: #FFF;
635
+ border-bottom: 1px solid #4fbbda;
636
+ padding: 10px 0;
637
+ }
638
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-symbol,
639
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-symbol {
640
+ font-size: 19px;
641
+ position: absolute;
642
+ top: 25px;
643
+ line-height: 10px;
644
+ }
645
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-cost,
646
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-cost {
647
+ font-size: 40px;
648
+ margin-left: 10px;
649
+ line-height: 50px;
650
+ }
651
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-pack-cycle,
652
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-pack-cycle {
653
+ font-size: 13px;
654
+ padding-bottom: 5px;
655
+ }
656
+ .entry-content ul.wpuf_packs .wpuf-sub-body,
657
+ ul.wpuf_packs .wpuf-sub-body {
658
+ margin: 0;
659
+ padding: 8px 0 0 8px;
660
+ background: #fff;
661
+ font-size: 11px;
662
+ color: #999;
663
+ }
664
+ .entry-content ul.wpuf_packs .wpuf-sub-button,
665
+ ul.wpuf_packs .wpuf-sub-button {
666
+ text-align: center;
667
+ margin-bottom: 20px;
668
+ margin-top: 20px;
669
+ overflow: hidden;
670
+ }
671
+ .entry-content ul.wpuf_packs .wpuf-sub-button a,
672
+ ul.wpuf_packs .wpuf-sub-button a {
673
+ background: #64C3DE;
674
+ color: #fff;
675
+ text-decoration: none;
676
+ padding: 5px 10px;
677
+ -webkit-border-radius: 3px;
678
+ -moz-border-radius: 3px;
679
+ border-radius: 3px;
680
+ display: inline-block;
681
+ }
682
+ .entry-content ul.wpuf_packs .wpuf-sub-button a:hover,
683
+ ul.wpuf_packs .wpuf-sub-button a:hover {
684
+ background: #3ab3d5;
685
+ }
686
+ .entry-content ul.wpuf_packs .wpuf-sub-button a:hover,
687
+ ul.wpuf_packs .wpuf-sub-button a:hover {
688
+ background: none repeat scroll 0 0 #1E8CBE;
689
+ border-color: #0074A2;
690
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
691
+ color: #FFFFFF;
692
+ }
693
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption,
694
+ ul.wpuf_packs .wpuf-sub-desciption {
695
+ margin-top: 15px;
696
+ }
697
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption ul,
698
+ ul.wpuf_packs .wpuf-sub-desciption ul,
699
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li,
700
+ ul.wpuf_packs .wpuf-sub-desciption li {
701
+ margin: 0;
702
+ padding: 0;
703
+ list-style: none;
704
+ }
705
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li,
706
+ ul.wpuf_packs .wpuf-sub-desciption li {
707
+ text-align: center;
708
+ border-top: 1px solid #eee;
709
+ padding: 7px 0;
710
+ }
711
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li:last-child,
712
+ ul.wpuf_packs .wpuf-sub-desciption li:last-child {
713
+ border-bottom: 1px solid #eee;
714
+ }
715
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li:first-child,
716
+ ul.wpuf_packs .wpuf-sub-desciption li:first-child {
717
+ border-top: none;
718
+ }
719
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption p,
720
+ ul.wpuf_packs .wpuf-sub-desciption p {
721
+ padding: 0 10px;
722
+ margin-bottom: 15px;
723
+ }
724
+ .entry-content ul.wpuf_packs .button,
725
+ ul.wpuf_packs .button {
726
+ background: none repeat scroll 0 0 #2EA2CC;
727
+ border-color: #0074A2;
728
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
729
+ color: #FFFFFF;
730
+ text-decoration: none;
731
+ padding: 0 12px 2px;
732
+ color: #fff;
733
+ }
734
+ .entry-content ul.wpuf_packs .cost,
735
+ ul.wpuf_packs .cost {
736
+ background: red;
737
+ border-radius: 30px 30px 30px 30px;
738
+ color: #FFFFFF;
739
+ margin: -16px -12px 0 0;
740
+ padding: 10px 8px 8px;
741
+ position: absolute;
742
+ right: 0;
743
+ top: 0;
744
+ }
745
+ /* css for timepicker */
746
+ .ui-timepicker-div .ui-widget-header {
747
+ margin-bottom: 8px;
748
+ }
749
+ .ui-timepicker-div dl {
750
+ text-align: left;
751
+ }
752
+ .ui-timepicker-div dl dt {
753
+ height: 25px;
754
+ margin-bottom: -25px;
755
+ }
756
+ .ui-timepicker-div dl dd {
757
+ margin: 0 10px 10px 65px;
758
+ }
759
+ .ui-timepicker-div td {
760
+ font-size: 90%;
761
+ }
762
+ .ui-tpicker-grid-label {
763
+ background: none;
764
+ border: none;
765
+ margin: 0;
766
+ padding: 0;
767
+ }
768
+ .ui-timepicker-rtl {
769
+ direction: rtl;
770
+ }
771
+ .ui-timepicker-rtl dl {
772
+ text-align: right;
773
+ }
774
+ .ui-timepicker-rtl dl dd {
775
+ margin: 0 65px 10px 10px;
776
+ }
777
+ #pass-strength-result {
778
+ border-style: solid;
779
+ border-width: 1px;
780
+ float: left;
781
+ margin: 0;
782
+ padding: 3px 5px;
783
+ text-align: center;
784
+ width: 200px;
785
+ display: none;
786
+ background-color: #eee;
787
+ border-color: #ddd !important;
788
+ }
789
+ #pass-strength-result.bad {
790
+ background-color: #ffb78c;
791
+ border-color: #ff853c !important;
792
+ }
793
+ #pass-strength-result.good {
794
+ background-color: #ffec8b;
795
+ border-color: #fc0 !important;
796
+ }
797
+ #pass-strength-result.short {
798
+ background-color: #ffa0a0;
799
+ border-color: #f04040 !important;
800
+ }
801
+ #pass-strength-result.strong {
802
+ background-color: #c3ff88;
803
+ border-color: #8dff1c !important;
804
+ }
805
+ .password[type="text"] {
806
+ display: none;
807
+ }
808
+ table.wpuf-table {
809
+ border: 1px solid #E7E7E7;
810
+ margin: 0 0px 10px 0;
811
+ text-align: left;
812
+ width: 100%;
813
+ }
814
+ table.wpuf-table thead th,
815
+ table.wpuf-table th {
816
+ color: #888888;
817
+ font-size: 12px;
818
+ font-weight: bold;
819
+ line-height: 18px;
820
+ padding: 9px 24px;
821
+ }
822
+ table.wpuf-table td {
823
+ border-top: 1px solid #E7E7E7;
824
+ padding: 6px 24px;
825
+ }
826
+ #wpuf-payment-gateway ul.wpuf-payment-gateways {
827
+ list-style: none;
828
+ margin: 10px 0;
829
+ }
830
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li {
831
+ margin: 0;
832
+ }
833
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li .wpuf-payment-instruction {
834
+ padding: 8px 10px;
835
+ margin: 0 10px;
836
+ }
837
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li .wpuf-instruction {
838
+ padding: 8px 10px;
839
+ margin-bottom: 10px;
840
+ background: #ebe8eb;
841
+ font-size: 13px;
842
+ -webkit-border-radius: 2px;
843
+ -moz-border-radius: 2px;
844
+ border-radius: 2px;
845
+ }
846
+ .wpuf-pagination div.pagination {
847
+ text-align: center;
848
+ padding: 7px;
849
+ margin: 3px;
850
+ }
851
+ .wpuf-pagination .page-numbers {
852
+ padding: 2px 8px;
853
+ margin: 2px;
854
+ border: 1px solid #4A5154;
855
+ text-decoration: none;
856
+ color: #4A5154;
857
+ background: #fff;
858
+ border-radius: 5px;
859
+ -moz-border-radius: 5px;
860
+ }
861
+ .wpuf-pagination .page-numbers:hover,
862
+ .wpuf-pagination .page-numbers:active {
863
+ border: 1px solid #4A5154;
864
+ background-color: #4A5154;
865
+ color: #fff;
866
+ border-radius: 5px;
867
+ -moz-border-radius: 5px;
868
+ }
869
+ .wpuf-pagination .page-numbers.current {
870
+ padding: 2px 8px;
871
+ margin: 2px;
872
+ border: 1px solid #4A5154;
873
+ font-weight: bold;
874
+ background-color: #4A5154;
875
+ color: #FFF;
876
+ border-radius: 5px;
877
+ -moz-border-radius: 5px;
878
+ }
879
+ /** author info **/
880
+ .wpuf-author {
881
+ margin: 20px 0;
882
+ }
883
+ .wpuf-author:after {
884
+ clear: both;
885
+ content: "";
886
+ display: table;
887
+ }
888
+ .wpuf-author h3 {
889
+ margin: 0 !important;
890
+ background: #CFCFCF;
891
+ text-align: left;
892
+ padding: 3px 10px;
893
+ }
894
+ .wpuf-author .wpuf-author-inside {
895
+ background: none repeat scroll 0 0 #F0F0F0;
896
+ border-bottom: 2px solid #DDDDDD;
897
+ height: auto;
898
+ padding-left: 10px;
899
+ padding-top: 15px;
900
+ margin-bottom: 15px;
901
+ }
902
+ .wpuf-author .wpuf-author-inside:after {
903
+ clear: both;
904
+ content: "";
905
+ display: table;
906
+ }
907
+ .wpuf-author .wpuf-author-inside .wpuf-user-image {
908
+ float: left;
909
+ padding-right: 15px;
910
+ }
911
+ .wpuf-author .wpuf-author-inside p {
912
+ margin-bottom: 10px !important;
913
+ }
914
+ .wpuf-author .wpuf-author-inside p.wpuf-author-info {
915
+ padding-top: 8px;
916
+ word-wrap: break-word;
917
+ }
918
+ .wpuf-author .wpuf-author-inside p.wpuf-user-name a {
919
+ color: #335160;
920
+ font-size: 1.2em;
921
+ font-weight: bold;
922
+ }
923
+ /** jQuery Suggest **/
924
+ .ac_results {
925
+ padding: 0;
926
+ margin: 0;
927
+ list-style: none;
928
+ position: absolute;
929
+ z-index: 10000;
930
+ display: none;
931
+ border: 1px solid #ccc;
932
+ }
933
+ .ac_results li {
934
+ padding: 2px 5px;
935
+ white-space: nowrap;
936
+ text-align: left;
937
+ }
938
+ .ac_over {
939
+ cursor: pointer;
940
+ }
941
+ .ac_match {
942
+ text-decoration: underline;
943
+ }
944
+ /*------------------------------------
945
+ * Multistep form
946
+ *-----------------------------------*/
947
+ fieldset.wpuf-multistep-fieldset {
948
+ position: relative;
949
+ padding-bottom: 50px;
950
+ border: none;
951
+ display: none;
952
+ }
953
+ fieldset.wpuf-multistep-fieldset.field-active {
954
+ display: block;
955
+ }
956
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-prev-btn,
957
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-next-btn {
958
+ position: absolute;
959
+ bottom: 5px;
960
+ }
961
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-prev-btn {
962
+ left: 10px;
963
+ }
964
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-next-btn {
965
+ right: 10px;
966
+ }
967
+ .wpuf-multistep-progressbar {
968
+ overflow: hidden;
969
+ }
970
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard {
971
+ margin: 20px 0 40px 0;
972
+ padding: 0;
973
+ list-style: none;
974
+ }
975
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard * {
976
+ box-sizing: border-box;
977
+ }
978
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li {
979
+ background-color: #E4E4E4;
980
+ border-radius: 5px;
981
+ display: inline-block;
982
+ padding: 10px 30px 10px 40px;
983
+ margin-right: -7px;
984
+ width: auto;
985
+ margin: 0;
986
+ position: relative;
987
+ text-align: center;
988
+ }
989
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::before,
990
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::after {
991
+ border: solid transparent;
992
+ content: " ";
993
+ height: 0;
994
+ width: 0;
995
+ position: absolute;
996
+ border-color: transparent;
997
+ border-left-color: #fff;
998
+ border-radius: 10px;
999
+ }
1000
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::before {
1001
+ border-width: 26px;
1002
+ margin-top: -14px;
1003
+ right: -50px;
1004
+ z-index: 98;
1005
+ }
1006
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::after {
1007
+ border-left-color: #E4E4E4;
1008
+ border-width: 25px;
1009
+ margin-top: -37px;
1010
+ right: -44px;
1011
+ z-index: 99;
1012
+ }
1013
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li.active-step {
1014
+ background-color: #00a0d2;
1015
+ color: #fff;
1016
+ }
1017
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li.active-step::after {
1018
+ border-left-color: #00a0d2;
1019
+ }
1020
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li:last-child::after {
1021
+ border-left-color: transparent;
1022
+ }
1023
+ .wpuf-form .wpuf-multistep-progressbar .ui-widget-header {
1024
+ background: #00a0d2;
1025
+ }
1026
+ .wpuf-form .wpuf-multistep-progressbar.ui-progressbar {
1027
+ margin-bottom: 30px;
1028
+ height: 25px;
1029
+ border: 1px solid #eee;
1030
+ position: relative;
1031
+ }
1032
+ .wpuf-form .wpuf-multistep-progressbar.ui-progressbar .wpuf-progress-percentage {
1033
+ position: absolute;
1034
+ left: 50%;
1035
+ font-size: 12px;
1036
+ font-weight: bold;
1037
+ text-shadow: 1px 1px 0 #fff;
1038
+ top: 20%;
1039
+ }
1040
+ input.wpuf-btn {
1041
+ text-decoration: none !important;
1042
+ font-size: 15px !important;
1043
+ margin-top: 10px;
1044
+ margin-right: 10px;
1045
+ background: #21759b !important;
1046
+ color: #fff !important;
1047
+ padding: 5px 10px;
1048
+ display: inline-block;
1049
+ -webkit-border-radius: 3px !important;
1050
+ -moz-border-radius: 3px !important;
1051
+ border-radius: 3px !important;
1052
+ border: none !important;
1053
+ }
1054
+ /*rtl*/
1055
+ body.rtl ul.wpuf-form li .wpuf-label {
1056
+ float: right;
1057
+ }
1058
+ @media (max-width: 480px) {
1059
+ ul.wpuf-form li .wpuf-label,
1060
+ ul.wpuf-form li .wpuf-fields {
1061
+ float: none;
1062
+ width: 100%;
1063
+ }
1064
+ }
1065
+ .wpuf-form .required {
1066
+ color: red;
1067
+ font-weight: 700;
1068
+ border: 0;
1069
+ }
1070
+ .wpuf-dashboard-container .wpuf-dashboard-navigation {
1071
+ width: 30%;
1072
+ float: left;
1073
+ }
1074
+ .wpuf-dashboard-container .wpuf-dashboard-navigation a {
1075
+ text-decoration: none;
1076
+ box-shadow: none;
1077
+ }
1078
+ .wpuf-dashboard-container .wpuf-dashboard-navigation ul {
1079
+ list-style: none;
1080
+ }
1081
+ .wpuf-dashboard-container .wpuf-dashboard-navigation ul li {
1082
+ padding-bottom: 2px;
1083
+ }
1084
+ .wpuf-dashboard-container .wpuf-dashboard-content {
1085
+ width: 68%;
1086
+ float: right;
1087
+ }
1088
+ .wpuf-dashboard-container table.items-table {
1089
+ border: 0;
1090
+ }
1091
+ .wpuf-dashboard-container table.items-table a {
1092
+ text-decoration: none;
1093
+ box-shadow: none;
1094
+ }
1095
+ .wpuf-dashboard-container table.items-table th,
1096
+ .wpuf-dashboard-container table.items-table td {
1097
+ border: 0;
1098
+ padding: 10px;
1099
+ }
1100
+ .wpuf-dashboard-container table.items-table tr {
1101
+ outline: 1px solid #f1f1f1;
1102
+ }
1103
+ .wpuf-dashboard-container table.items-table .items-list-header {
1104
+ background-color: #f1f1f1;
1105
+ }
1106
+ .wpuf-dashboard-container .wpuf-update-profile-form .form-row-first {
1107
+ float: left;
1108
+ width: 47%;
1109
+ overflow: visible;
1110
+ }
1111
+ .wpuf-dashboard-container .wpuf-update-profile-form .form-row-last {
1112
+ float: right;
1113
+ width: 47%;
1114
+ overflow: visible;
1115
+ }
1116
+ .wpuf-toc-container .wpuf-fields {
1117
+ position: relative;
1118
+ }
1119
+ .wpuf-toc-container .wpuf-fields .wpuf-toc-checkbox {
1120
+ position: absolute;
1121
+ top: 0;
1122
+ left: 0;
1123
+ }
1124
+ .wpuf-toc-container .wpuf-fields.has-toc-checkbox .wpuf-toc-description {
1125
+ margin-left: 25px;
1126
+ }
1127
+ .wpuf-field-google-map {
1128
+ height: 300px;
1129
+ width: 100%;
1130
+ }
1131
+ .wpuf-form-google-map {
1132
+ height: 300px;
1133
+ width: 100%;
1134
+ }
1135
+ input[type="text"].wpuf-google-map-search {
1136
+ margin-top: 10px !important;
1137
+ border: 1px solid transparent !important;
1138
+ border-radius: 2px 0 0 2px !important;
1139
+ box-sizing: border-box !important;
1140
+ -moz-box-sizing: border-box !important;
1141
+ height: 32px !important;
1142
+ outline: none !important;
1143
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
1144
+ background-color: #fff !important;
1145
+ text-overflow: ellipsis !important;
1146
+ width: 170px !important;
1147
+ font-family: Roboto !important;
1148
+ font-size: 15px !important;
1149
+ font-weight: 300 !important;
1150
+ padding: 0 11px 0 13px !important;
1151
+ display: none;
1152
+ }
1153
+ .gm-style input[type="text"].wpuf-google-map-search {
1154
+ display: block;
1155
+ }
1156
+ .wpuf-form-google-map-container input[type="text"].wpuf-google-map-search {
1157
+ width: 230px !important;
1158
+ }
1159
+ .wpuf-form-google-map-container.hide-search-box .gm-style input[type="text"].wpuf-google-map-search {
1160
+ display: none;
1161
+ }
assets/css/frontend-forms.less ADDED
@@ -0,0 +1,1306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @borderColor: #eee;
2
+ @mainColor: #64C3DE;
3
+
4
+ .clearfix() {
5
+ &:after {
6
+ clear: both;
7
+ content: "";
8
+ display: table;
9
+ }
10
+ }
11
+
12
+ .border-radius(@radius) {
13
+ -webkit-border-radius: @radius;
14
+ -moz-border-radius: @radius;
15
+ border-radius: @radius;
16
+ }
17
+
18
+ .core-button() {
19
+ background-color: #21759b;
20
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
21
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
22
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
23
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
24
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
25
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
26
+ border-color: #21759b;
27
+ border-bottom-color: #1e6a8d;
28
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
29
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
30
+ color: #fff;
31
+ text-decoration: none;
32
+ text-shadow: 0 1px 0 rgba(0,0,0,0.1);
33
+ }
34
+
35
+ .core-button-hover() {
36
+ background-color: #278ab7;
37
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
38
+ background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
39
+ background-image: -moz-linear-gradient(top, #2e9fd2, #21759b);
40
+ background-image: -ms-linear-gradient(top, #2e9fd2, #21759b);
41
+ background-image: -o-linear-gradient(top, #2e9fd2, #21759b);
42
+ background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
43
+ border-color: #1b607f;
44
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
45
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
46
+ color: #fff;
47
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
48
+ }
49
+
50
+ .wpuf-loading {
51
+ width: 16px;
52
+ height: 16px;
53
+ background: url('../images/wpspin_light.gif') no-repeat;
54
+ display: inline-block;
55
+
56
+ &.hide {
57
+ display: none;
58
+ }
59
+ }
60
+
61
+ .wpuf-button {
62
+ background: #f3f3f3;
63
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#f4f4f4));
64
+ background-image: -webkit-linear-gradient(top, #fefefe, #f4f4f4);
65
+ background-image: -moz-linear-gradient(top, #fefefe, #f4f4f4);
66
+ background-image: -o-linear-gradient(top, #fefefe, #f4f4f4);
67
+ background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
68
+ border-color: #bbb;
69
+ color: #333;
70
+ text-shadow: 0 1px 0 #fff;
71
+
72
+ &:hover, &:focus {
73
+ background: #f3f3f3;
74
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3));
75
+ background-image: -webkit-linear-gradient(top, #fff, #f3f3f3);
76
+ background-image: -moz-linear-gradient(top, #fff, #f3f3f3);
77
+ background-image: -ms-linear-gradient(top, #fff, #f3f3f3);
78
+ background-image: -o-linear-gradient(top, #fff, #f3f3f3);
79
+ background-image: linear-gradient(to bottom, #fff, #f3f3f3);
80
+ border-color: #999;
81
+ color: #222;
82
+ }
83
+ }
84
+
85
+ .wpuf-success {
86
+ background-color: #dff0d8;
87
+ border: 1px solid #d6e9c6;
88
+ color: #3c763d;
89
+ padding: 10px;
90
+ margin: 10px 0 20px 0;
91
+ }
92
+
93
+ .wpuf-error {
94
+ background-color: #f2dede;
95
+ color: #a94442;
96
+ border: 1px solid #ebccd1;
97
+ margin: 10px 0 20px 0;
98
+ padding: 10px;
99
+ .border-radius(3px);
100
+ font-size: 13px;
101
+ }
102
+
103
+ .wpuf-message {
104
+ background: #fcf8e3;
105
+ border: 1px solid #faebcc;
106
+ color: #8a6d3b;
107
+ margin: 10px 0 20px 0;
108
+ padding: 10px;
109
+ .border-radius(3px);
110
+ font-size: 13px;
111
+ }
112
+
113
+ .wpuf-info {
114
+ background-color: #fef5be;
115
+ border: 2px solid #fdd425;
116
+ border-radius: 5px;
117
+ -moz-border-radius: 5px;
118
+ -webkit-border-radius: 5px;
119
+ padding: 5px 10px;
120
+ margin: 0 0 10px 0;
121
+ font-size: 13px;
122
+ }
123
+
124
+ ul.wpuf-form {
125
+ list-style: none !important;
126
+ margin: 0 !important;
127
+ padding: 0 !important;
128
+ width: 100%;
129
+
130
+ li {
131
+ .clearfix();
132
+ margin-left: 0;
133
+ margin-bottom: 10px;
134
+ padding: 10px;
135
+
136
+ &.has-error {
137
+ background: #FFE4E4;
138
+ }
139
+
140
+ .wp-editor-wrap {
141
+ border: 1px solid @borderColor;
142
+ }
143
+
144
+ .wpuf-label {
145
+ float: left;
146
+ width: 30%;
147
+ min-height: 1px;
148
+ font-weight: bold;
149
+
150
+ .required {
151
+ color: red;
152
+ }
153
+ }
154
+
155
+ .wpuf-fields {
156
+ float: left;
157
+ width: 70%;
158
+
159
+ input[type=text],
160
+ input[type=password],
161
+ input[type=email],
162
+ input[type=url],
163
+ input[type=number],
164
+ textarea {
165
+ background: #fafafa;
166
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
167
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
168
+ box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
169
+ border: 1px solid #ddd;
170
+ color: #888;
171
+ width: 95%;
172
+ }
173
+
174
+ input[type=text]:focus,
175
+ input[type=password]:focus,
176
+ input[type=email]:focus,
177
+ input[type=url]:focus,
178
+ input[type=number]:focus,
179
+ textarea:focus {
180
+ color: #373737;
181
+ }
182
+ textarea {
183
+ padding-left: 3px;
184
+ width: 95%;
185
+ }
186
+ input[type=text],
187
+ input[type=password],
188
+ input[type=email],
189
+ input[type=url],
190
+ input[type=number] {
191
+ padding: 5px;
192
+ }
193
+
194
+ select {
195
+ border: 1px solid @borderColor;
196
+ padding: 2px;
197
+ height: 2em;
198
+ .border-radius(3px);
199
+ min-width: 150px;
200
+ }
201
+
202
+ select[multiple] {
203
+ height: auto;
204
+ }
205
+
206
+ .wpuf-radio-inline,
207
+ .wpuf-checkbox-inline{
208
+ display: inline-block;
209
+ margin-right: 10px;
210
+ }
211
+
212
+ a.file-selector {
213
+ display: inline;
214
+ text-decoration: none;
215
+ padding: 5px 12px;
216
+ height: 30px;
217
+ line-height: 28px;
218
+ border: 1px solid #ccc;
219
+ .border-radius(3px);
220
+ .core-button();
221
+
222
+ &:hover,
223
+ &:focus {
224
+ .core-button-hover();
225
+ }
226
+ }
227
+
228
+ .google-map {
229
+ img {
230
+ max-width: none !important;
231
+ }
232
+ }
233
+
234
+ .wpuf-name-field-wrap {
235
+ .clearfix();
236
+ margin-bottom: 8px;
237
+
238
+ &.format-first-last {
239
+ .wpuf-name-field-first-name {
240
+ float: left;
241
+ width: 48%;
242
+ }
243
+
244
+ .wpuf-name-field-middle-name {
245
+ display: none;
246
+ }
247
+
248
+ .wpuf-name-field-last-name {
249
+ float: right;
250
+ width: 48%;
251
+ }
252
+ }
253
+
254
+ &.format-first-middle-last {
255
+ .wpuf-name-field-first-name {
256
+ float: left;
257
+ width: 37%;
258
+ margin-right: 3%;
259
+ }
260
+
261
+ .wpuf-name-field-middle-name {
262
+ float: left;
263
+ width: 20%;
264
+ }
265
+
266
+ .wpuf-name-field-last-name {
267
+ float: right;
268
+ width: 37%;
269
+ }
270
+ }
271
+ }
272
+
273
+ .wpuf-help {
274
+ color: #666;
275
+ margin: 2px 0 5px 0;
276
+ font-size: 12px;
277
+ font-style: italic;
278
+ font-family: sans-serif;
279
+ display: block;
280
+ }
281
+
282
+ table, td {
283
+ border: none;
284
+ margin: 0;
285
+ }
286
+
287
+ table {
288
+ width: 100%;
289
+ }
290
+
291
+ img.wpuf-clone-field,
292
+ img.wpuf-remove-field {
293
+ cursor: pointer;
294
+ margin: 0 3px;
295
+ box-shadow: none;
296
+ border: none;
297
+ }
298
+
299
+ ul.wpuf-attachment-list {
300
+ list-style: none;
301
+ margin: 5px 0 0 0;
302
+ padding: 0;
303
+
304
+ li {
305
+ display: inline-block;
306
+ border: 1px solid @borderColor;
307
+ padding: 5px;
308
+ width: 150px;
309
+ margin-right: 5px;
310
+ .border-radius(5px);
311
+
312
+ .wpuf-file-input-wrap {
313
+ margin: 10px 0;
314
+
315
+ input, textarea {
316
+ border: 1px solid @borderColor;
317
+ width: 93%;
318
+ }
319
+ }
320
+
321
+ .attachment-name {
322
+ text-align: center;
323
+ }
324
+
325
+ a.attachment-delete,a.wpuf-delete-avatar {
326
+ text-decoration: none;
327
+ padding: 3px 12px;
328
+ border: 1px solid #C47272;
329
+ color:#ffffff;
330
+ text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);
331
+ .border-radius(3px);
332
+ background-color:#da4f49;
333
+ background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);
334
+ background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
335
+ background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);
336
+ background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);
337
+ background-image:linear-gradient(to bottom, #ee5f5b, #bd362f);
338
+ background-repeat:repeat-x;
339
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
340
+ border-color:#bd362f #bd362f #802420;
341
+ border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
342
+ *background-color:#bd362f;
343
+ filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);
344
+
345
+ &:hover, &:active {
346
+ color:#ffffff;
347
+ background-color:#bd362f;
348
+ *background-color:#a9302a;
349
+ }
350
+ }
351
+ }
352
+ }
353
+
354
+ .progress {
355
+ background: -moz-linear-gradient(center bottom , #FFFFFF 0%, #F7F7F7 100%) repeat scroll 0 0 #FFFFFF;
356
+ border: 1px solid #D1D1D1;
357
+ border-radius: 3px 3px 3px 3px;
358
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) inset;
359
+ float: right;
360
+ height: 22px;
361
+ line-height: 2em;
362
+ margin: 0;
363
+ overflow: hidden;
364
+ padding: 0;
365
+ width: 200px;
366
+ }
367
+
368
+ .bar {
369
+ background-color: #83B4D8;
370
+ background-image: -moz-linear-gradient(center bottom , #72A7CF 0%, #90C5EE 100%);
371
+ border-radius: 3px 3px 3px 3px;
372
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
373
+ height: 100%;
374
+ // margin-top: -26px;
375
+ width: 0;
376
+ z-index: 9;
377
+ }
378
+
379
+ .progress .percent {
380
+ color: rgba(0, 0, 0, 0.6);
381
+ padding: 0 8px;
382
+ position: relative;
383
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
384
+ width: 200px;
385
+ z-index: 10;
386
+ }
387
+
388
+ ul.wpuf-category-checklist {
389
+ list-style: none;
390
+ margin: 0;
391
+ padding: 0;
392
+
393
+ li {
394
+ margin-bottom: 5px;
395
+ padding: 0;
396
+ }
397
+
398
+ ul.children {
399
+ list-style: none;
400
+ margin-left: 25px;
401
+ }
402
+ }
403
+
404
+ #wpuf-insert-image-container {
405
+ .clearfix();
406
+ margin-bottom: 3px;
407
+
408
+ a.wpuf-insert-image {
409
+ text-decoration: none;
410
+ // float: left;
411
+ border: 1px solid #DFDFDF;
412
+ font-size: 11px;
413
+ .border-radius(3px);
414
+ padding: 4px 6px;
415
+ margin-right: 10px;
416
+
417
+ .wpuf-media-icon {
418
+ // background: url('../images/photo.png') no-repeat;
419
+ height: 12px;
420
+ width: 12px;
421
+ // display: inline-block;
422
+ }
423
+ }
424
+ }
425
+
426
+ .wpuf-fields-list {
427
+ box-sizing: border-box;
428
+ margin: 0;
429
+ padding: 0;
430
+ list-style: none;
431
+
432
+ li {
433
+ padding: 0;
434
+ margin: 0 0 6px;
435
+ }
436
+
437
+ &.wpuf-list-inline {
438
+ margin-left: -5px;
439
+
440
+ li {
441
+ display: inline-block;
442
+ padding-left: 5px;
443
+ padding-right: 5px;
444
+ }
445
+ }
446
+ }
447
+
448
+ table.wpuf-repeatable-field {
449
+ border-collapse: collapse;
450
+
451
+ & * {
452
+ box-sizing: border-box;
453
+ }
454
+
455
+ input {
456
+ width: 100%;
457
+ }
458
+
459
+ .wpuf-repeater-buttons {
460
+ width: 75px;
461
+ padding-left: 12px;
462
+
463
+ img {
464
+ width: 100%;
465
+ height: auto;
466
+ }
467
+
468
+ i {
469
+ display: inline-block;
470
+ width: 15px;
471
+ height: 15px;
472
+ margin: 2px 4px 0 0;
473
+ }
474
+ }
475
+ }
476
+ }
477
+
478
+ .wpuf-address-field {
479
+ .clearfix();
480
+ width: 100%;
481
+ margin-bottom: 10px;
482
+ }
483
+
484
+ .wpuf-section-wrap {
485
+ border-bottom: 1px solid #ccc;
486
+ margin: 15px 0;
487
+
488
+ h2.wpuf-section-title {
489
+ margin: 0;
490
+ }
491
+
492
+ .wpuf-section-details {
493
+ padding: 4px 0 8px;
494
+ font-size: 12px;
495
+ }
496
+ }
497
+ }
498
+
499
+ &.form-label-above li {
500
+ .wpuf-label,
501
+ .wpuf-fields {
502
+ display: block;
503
+ float: none;
504
+ width: 100%;
505
+ }
506
+
507
+ .wpuf-label {
508
+ margin-bottom: 10px;
509
+ }
510
+ }
511
+
512
+ &.form-label-right li {
513
+ .wpuf-label {
514
+ float: right;
515
+ }
516
+ }
517
+
518
+ &.form-label-hidden li {
519
+ .wpuf-label {
520
+ display: none;
521
+ }
522
+
523
+ .wpuf-fields {
524
+ display: block;
525
+ float: none;
526
+ width: 100%;
527
+ }
528
+ }
529
+
530
+ .wpuf-submit {
531
+ .wpuf-label {
532
+ display: none !important;
533
+ }
534
+
535
+ input[type=submit] {
536
+ font-size: 16px;
537
+ padding: 5px 15px;
538
+ border: 1px solid #ccc;
539
+ .border-radius(3px);
540
+ .core-button();
541
+ }
542
+
543
+ .button-primary-disabled {
544
+ color: #94cde7 !important;
545
+ background: #298cba !important;
546
+ border-color: #1b607f !important;
547
+ -webkit-box-shadow: none !important;
548
+ box-shadow: none !important;
549
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.1) !important;
550
+ cursor: default;
551
+ }
552
+
553
+ .wpuf-errors {
554
+ background: #FFE4E4;
555
+ border: 1px solid darken(#FFE4E4, 10%);
556
+ margin: 10px 0;
557
+ padding: 10px;
558
+ .border-radius(3px);
559
+ font-size: 13px;
560
+ }
561
+ }
562
+ }
563
+
564
+ #wpuf-login-form {
565
+ label {
566
+ display: block;
567
+ }
568
+
569
+ .forgetmenot label {
570
+ display: inline-block;
571
+ }
572
+ }
573
+
574
+ .wpuf_sub_info {
575
+ padding: 0;
576
+ margin: 10px 5px;
577
+ border: 1px solid @borderColor;
578
+ border-radius: 3px;
579
+
580
+ h3 {
581
+ background-color: #f1f1f1;
582
+ padding: 10px;
583
+ margin: 0 0 5px 0 !important;
584
+ font-weight: 300 !important;
585
+ }
586
+
587
+ .wpuf-text{
588
+ padding: 5px 10px;
589
+ }
590
+
591
+ .wpuf-expire {
592
+ border-top: 1px solid @borderColor;
593
+ padding-top: 5px;
594
+ margin-top: 5px;
595
+ }
596
+ }
597
+
598
+ .wpuf-coupon-info-wrap {
599
+ border: 1px solid @borderColor;
600
+ padding: 15px;
601
+ margin-bottom: 20px;
602
+
603
+ .wpuf-coupon-field-spinner {
604
+ background: url( '../images/wpspin_light.gif' ) no-repeat right scroll rgba(0, 0, 0, 0);
605
+ }
606
+ .wpuf-copon-show {
607
+ background: #EEEEEE;
608
+ border-radius: 3px;
609
+ border-width: 1px;
610
+ box-shadow: 0 1px 0 rgba(217, 217, 217, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
611
+ color: #5C5A5A;
612
+ cursor: pointer;
613
+ display: inline-block;
614
+ font-size: 14px;
615
+ padding: 5px 12px;
616
+ text-decoration: none;
617
+ width: 175px;
618
+ margin-bottom: 8px;
619
+ }
620
+
621
+ .wpuf-copon-wrap {
622
+ margin: 15px 0;
623
+ }
624
+
625
+ .wpuf-pack-info {
626
+ margin-bottom: 20px;
627
+
628
+ h3 {
629
+ margin: 0 0 10px 0;
630
+ padding: 0 0 10px 0;
631
+ border-bottom: 1px solid @borderColor;
632
+
633
+ a {
634
+ float: right;
635
+ text-decoration: none;
636
+ background: @mainColor;
637
+ color: #fff;
638
+ padding: 3px 8px;
639
+ font-size: 14px;
640
+ }
641
+ }
642
+
643
+ wpuf-subscription-error {
644
+ color: #D8000C;
645
+ }
646
+ }
647
+
648
+ .wpuf-copon-show:hover {
649
+ background: none repeat scroll 0 0 #1E8CBE;
650
+ border-color: #0074A2;
651
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
652
+ color: #FFFFFF;
653
+ }
654
+
655
+ a.wpuf-apply-coupon {
656
+ text-decoration: none;
657
+ font-size: 11px;
658
+ margin-top: 10px;
659
+ margin-right: 10px;
660
+ background: #21759b;
661
+ color: #fff;
662
+ padding: 5px 10px;
663
+ display: inline-block;
664
+ .border-radius(3px);
665
+ }
666
+
667
+ .wpuf-copon-cancel {
668
+ text-decoration: none;
669
+ font-size: 11px;
670
+ }
671
+ }
672
+
673
+ .entry-content ul.wpuf_packs,
674
+ ul.wpuf_packs {
675
+ overflow: hidden;
676
+ margin: 15px;
677
+
678
+ > li {
679
+ background: #fff;
680
+ border: 1px solid #DDD;
681
+ border-radius: 5px 5px 5px 5px;
682
+ float: left;
683
+ list-style: none outside none;
684
+ margin: 5px 25px 25px 0;
685
+ position: relative;
686
+ width: 200px;
687
+ box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
688
+
689
+ &:first-child {
690
+ margin-left: 5px;
691
+ }
692
+ }
693
+
694
+ h3 {
695
+ background: #52B5D5;
696
+ color: #fff;
697
+ font-size: 18px;
698
+ font-weight: normal;
699
+ margin: 0;
700
+ padding: 10px !important;
701
+ text-align: center;
702
+ border-bottom: 1px solid darken(#52B5D5, 5%);
703
+ }
704
+
705
+ .wpuf-pricing-wrap {
706
+ background: @mainColor;
707
+
708
+ .wpuf-sub-amount {
709
+ position: relative;
710
+ text-align: center;
711
+ color: #FFF;
712
+ border-bottom: 1px solid darken(@mainColor, 5%);
713
+ padding: 10px 0;
714
+
715
+ .wpuf-sub-symbol {
716
+ font-size: 19px;
717
+ position: absolute;
718
+ top: 25px;
719
+ line-height: 10px;
720
+ }
721
+
722
+ .wpuf-sub-cost {
723
+ font-size: 40px;
724
+ margin-left: 10px;
725
+ line-height: 50px;
726
+ }
727
+
728
+ .wpuf-pack-cycle {
729
+ font-size: 13px;
730
+ padding-bottom: 5px;
731
+ }
732
+ }
733
+ }
734
+
735
+ .wpuf-sub-body {
736
+ margin: 0;
737
+ padding: 8px 0 0 8px;
738
+ background: #fff;
739
+ font-size: 11px;
740
+ color: #999;
741
+ }
742
+
743
+ .wpuf-sub-button {
744
+ text-align: center;
745
+ margin-bottom: 20px;
746
+ margin-top: 20px;
747
+ overflow: hidden;
748
+
749
+ a {
750
+ // .core-button();
751
+ background: @mainColor;
752
+ color: #fff;
753
+ text-decoration: none;
754
+ padding: 5px 10px;
755
+ .border-radius(3px);
756
+ display: inline-block;
757
+
758
+ &:hover {
759
+ background: darken(@mainColor, 10%);
760
+ }
761
+ }
762
+
763
+ a:hover {
764
+ background: none repeat scroll 0 0 #1E8CBE;
765
+ border-color: #0074A2;
766
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
767
+ color: #FFFFFF;
768
+ }
769
+ }
770
+
771
+ .wpuf-sub-desciption {
772
+ margin-top: 15px;
773
+
774
+ ul, li {
775
+ margin: 0;
776
+ padding: 0;
777
+ list-style: none;
778
+ }
779
+
780
+ li {
781
+ text-align: center;
782
+ border-top: 1px solid #eee;
783
+ padding: 7px 0;
784
+
785
+ &:last-child {
786
+ border-bottom: 1px solid #eee;
787
+ }
788
+
789
+ &:first-child {
790
+ border-top: none;
791
+ }
792
+ }
793
+
794
+ p {
795
+ padding: 0 10px;
796
+ margin-bottom: 15px;
797
+ }
798
+ }
799
+
800
+ .button {
801
+ background: none repeat scroll 0 0 #2EA2CC;
802
+ border-color: #0074A2;
803
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
804
+ color: #FFFFFF;
805
+ text-decoration: none;
806
+ padding: 0 12px 2px;
807
+ color: #fff;
808
+ }
809
+
810
+ .cost {
811
+ background: red;
812
+ border-radius: 30px 30px 30px 30px;
813
+ color: #FFFFFF;
814
+ margin: -16px -12px 0 0;
815
+ padding: 10px 8px 8px;
816
+ position: absolute;
817
+ right: 0;
818
+ top: 0;
819
+ }
820
+ }
821
+
822
+ /* css for timepicker */
823
+ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
824
+ .ui-timepicker-div dl { text-align: left; }
825
+ .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
826
+ .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
827
+ .ui-timepicker-div td { font-size: 90%; }
828
+ .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
829
+
830
+ .ui-timepicker-rtl{ direction: rtl; }
831
+ .ui-timepicker-rtl dl { text-align: right; }
832
+ .ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
833
+
834
+ // Password Strength
835
+ #pass-strength-result {
836
+ border-style: solid;
837
+ border-width: 1px;
838
+ float: left;
839
+ margin: 0;
840
+ padding: 3px 5px;
841
+ text-align: center;
842
+ width: 200px;
843
+ display: none;
844
+ background-color: #eee;
845
+ border-color: #ddd !important;
846
+
847
+ &.bad {
848
+ background-color: #ffb78c;
849
+ border-color: #ff853c !important;
850
+ }
851
+
852
+ &.good {
853
+ background-color: #ffec8b;
854
+ border-color: #fc0 !important;
855
+ }
856
+
857
+ &.short {
858
+ background-color: #ffa0a0;
859
+ border-color: #f04040 !important;
860
+ }
861
+
862
+ &.strong {
863
+ background-color: #c3ff88;
864
+ border-color: #8dff1c !important;
865
+ }
866
+ }
867
+
868
+ .password[type="text"]{
869
+ display: none;
870
+ }
871
+
872
+ table.wpuf-table {
873
+ border: 1px solid #E7E7E7;
874
+ margin: 0 0px 10px 0;
875
+ text-align: left;
876
+ width: 100%;
877
+
878
+ thead th, th {
879
+ color: #888888;
880
+ font-size: 12px;
881
+ font-weight: bold;
882
+ line-height: 18px;
883
+ padding: 9px 24px;
884
+ }
885
+
886
+ td {
887
+ border-top: 1px solid #E7E7E7;
888
+ padding: 6px 24px;
889
+ }
890
+ }
891
+
892
+ #wpuf-payment-gateway {
893
+ ul.wpuf-payment-gateways {
894
+ list-style: none;
895
+ margin: 10px 0;
896
+
897
+ li {
898
+ margin: 0;
899
+
900
+ .wpuf-payment-instruction {
901
+ padding: 8px 10px;
902
+ margin: 0 10px;
903
+ }
904
+
905
+ .wpuf-instruction {
906
+ padding: 8px 10px;
907
+ margin-bottom: 10px;
908
+ background: #ebe8eb;
909
+ font-size: 13px;
910
+ .border-radius(2px);
911
+ }
912
+ }
913
+ }
914
+ }
915
+
916
+ .wpuf-pagination {
917
+ div.pagination{
918
+ text-align:center;
919
+ padding:7px;
920
+ margin:3px;
921
+ }
922
+
923
+ .page-numbers{
924
+ padding:2px 8px;
925
+ margin:2px;
926
+ border:1px solid #4A5154;
927
+ text-decoration:none;
928
+ color:#4A5154;
929
+ background: #fff;
930
+ border-radius: 5px;
931
+ -moz-border-radius: 5px;
932
+
933
+ &:hover,
934
+ &:active{
935
+ border:1px solid #4A5154;
936
+ background-color:#4A5154;
937
+ color:#fff;
938
+ border-radius: 5px;
939
+ -moz-border-radius: 5px;
940
+ }
941
+
942
+ &.current{
943
+ padding:2px 8px;
944
+ margin:2px;
945
+ border:1px solid #4A5154;
946
+ font-weight:bold;
947
+ background-color:#4A5154;
948
+ color:#FFF;
949
+ border-radius: 5px;
950
+ -moz-border-radius: 5px;
951
+ }
952
+ }
953
+ }
954
+
955
+ /** author info **/
956
+ .wpuf-author {
957
+ .clearfix();
958
+ margin: 20px 0;
959
+
960
+ h3{
961
+ margin: 0 !important;
962
+ background: #CFCFCF;
963
+ text-align: left;
964
+ padding: 3px 10px;
965
+ }
966
+
967
+ .wpuf-author-inside {
968
+ background: none repeat scroll 0 0 #F0F0F0;
969
+ border-bottom: 2px solid #DDDDDD;
970
+ height: auto;
971
+ padding-left: 10px;
972
+ padding-top: 15px;
973
+ margin-bottom: 15px;
974
+ .clearfix();
975
+
976
+ .wpuf-user-image {
977
+ float: left;
978
+ padding-right: 15px;
979
+ }
980
+
981
+ p {
982
+ margin-bottom: 10px !important;
983
+ }
984
+
985
+ p.wpuf-author-info {
986
+ padding-top: 8px;
987
+ word-wrap: break-word;
988
+ }
989
+
990
+ p.wpuf-user-name a {
991
+ color: #335160;
992
+ font-size: 1.2em;
993
+ font-weight: bold;
994
+ }
995
+ }
996
+ }
997
+
998
+ /** jQuery Suggest **/
999
+
1000
+ .ac_results {
1001
+ padding: 0;
1002
+ margin: 0;
1003
+ list-style: none;
1004
+ position: absolute;
1005
+ z-index: 10000;
1006
+ display: none;
1007
+ border: 1px solid #ccc;
1008
+
1009
+ li {
1010
+ padding: 2px 5px;
1011
+ white-space: nowrap;
1012
+ text-align: left;
1013
+ }
1014
+ }
1015
+
1016
+ .ac_over {
1017
+ cursor: pointer;
1018
+ }
1019
+
1020
+ .ac_match {
1021
+ text-decoration: underline;
1022
+ }
1023
+
1024
+ /*------------------------------------
1025
+ * Multistep form
1026
+ *-----------------------------------*/
1027
+ fieldset.wpuf-multistep-fieldset {
1028
+ position: relative;
1029
+ padding-bottom: 50px;
1030
+ border: none;
1031
+ display: none;
1032
+
1033
+ &.field-active {
1034
+ display: block;
1035
+ }
1036
+
1037
+ .wpuf-multistep-prev-btn,
1038
+ .wpuf-multistep-next-btn {
1039
+ position: absolute;
1040
+ bottom: 5px;
1041
+ }
1042
+ .wpuf-multistep-prev-btn {
1043
+ left: 10px;
1044
+ }
1045
+ .wpuf-multistep-next-btn {
1046
+ right: 10px;
1047
+ }
1048
+ }
1049
+
1050
+ .wpuf-multistep-progressbar {
1051
+ overflow: hidden;
1052
+ }
1053
+
1054
+ .wpuf-form .wpuf-multistep-progressbar {
1055
+
1056
+ @stepBackground: #00a0d2;
1057
+
1058
+ ul.wpuf-step-wizard {
1059
+ margin: 20px 0 40px 0;
1060
+ padding: 0;
1061
+ list-style: none;
1062
+
1063
+ * {
1064
+ box-sizing: border-box;
1065
+ }
1066
+
1067
+ li {
1068
+ background-color: #E4E4E4;
1069
+ border-radius: 5px;
1070
+ display: inline-block;
1071
+ padding: 10px 30px 10px 40px;
1072
+ margin-right: -7px;
1073
+ width: auto;
1074
+ margin: 0;
1075
+ position: relative;
1076
+ text-align: center;
1077
+
1078
+ &::before,
1079
+ &::after {
1080
+ border: solid transparent;
1081
+ content: " ";
1082
+ height: 0;
1083
+ width: 0;
1084
+ position: absolute;
1085
+ border-color: transparent;
1086
+ border-left-color: #fff;
1087
+ border-radius: 10px;
1088
+ }
1089
+
1090
+ &::before {
1091
+ border-width: 26px;
1092
+ margin-top: -14px;
1093
+ right: -50px;
1094
+ z-index: 98;
1095
+ }
1096
+
1097
+ &::after {
1098
+ border-left-color: #E4E4E4;
1099
+ border-width: 25px;
1100
+ margin-top: -37px;
1101
+ right: -44px;
1102
+ z-index: 99;
1103
+ }
1104
+
1105
+ &.active-step {
1106
+ background-color: @stepBackground;
1107
+ color: #fff;
1108
+
1109
+ &::after {
1110
+ border-left-color: @stepBackground;
1111
+ }
1112
+ }
1113
+
1114
+ &:last-child::after {
1115
+ border-left-color: transparent;
1116
+ }
1117
+ }
1118
+ }
1119
+
1120
+ .ui-widget-header {
1121
+ background: @stepBackground;
1122
+ }
1123
+
1124
+ &.ui-progressbar {
1125
+ margin-bottom: 30px;
1126
+ height: 25px;
1127
+ border: 1px solid @borderColor;
1128
+ position: relative;
1129
+
1130
+ .wpuf-progress-percentage {
1131
+ position: absolute;
1132
+ left: 50%;
1133
+ font-size: 12px;
1134
+ font-weight: bold;
1135
+ text-shadow: 1px 1px 0 #fff;
1136
+ top: 20%;
1137
+ }
1138
+ }
1139
+ }
1140
+ input.wpuf-btn {
1141
+ text-decoration: none !important;
1142
+ font-size: 15px !important;
1143
+ margin-top: 10px;
1144
+ margin-right: 10px;
1145
+ background: #21759b !important;
1146
+ color: #fff !important;
1147
+ padding: 5px 10px;
1148
+ display: inline-block;
1149
+ -webkit-border-radius: 3px !important;
1150
+ -moz-border-radius: 3px !important;
1151
+ border-radius: 3px !important;
1152
+ border: none !important;
1153
+ }
1154
+ /*rtl*/
1155
+ body.rtl{
1156
+ ul.wpuf-form li .wpuf-label{
1157
+ float: right;
1158
+ }
1159
+ }
1160
+
1161
+ // landscape phones and smaller
1162
+ @media (max-width: 480px) {
1163
+ ul.wpuf-form {
1164
+ li {
1165
+ .wpuf-label, .wpuf-fields {
1166
+ float: none;
1167
+ width: 100%;
1168
+ }
1169
+ }
1170
+ }
1171
+ }
1172
+
1173
+ .wpuf-form {
1174
+ .required {
1175
+ color: red;
1176
+ font-weight: 700;
1177
+ border: 0;
1178
+ }
1179
+ }
1180
+ .wpuf-dashboard-container {
1181
+ .wpuf-dashboard-navigation {
1182
+ width: 30%;
1183
+ float: left;
1184
+
1185
+ a {
1186
+ text-decoration: none;
1187
+ box-shadow: none;
1188
+ }
1189
+
1190
+ ul {
1191
+ list-style: none;
1192
+ li {
1193
+ padding-bottom: 2px;
1194
+ }
1195
+ }
1196
+ }
1197
+
1198
+ .wpuf-dashboard-content {
1199
+ width: 68%;
1200
+ float: right;
1201
+ }
1202
+
1203
+ table.items-table {
1204
+ a {
1205
+ text-decoration: none;
1206
+ box-shadow: none;
1207
+ }
1208
+
1209
+ border: 0;
1210
+
1211
+ th, td {
1212
+ border: 0;
1213
+ padding: 10px;
1214
+ }
1215
+
1216
+ tr {
1217
+ outline: 1px solid #f1f1f1;
1218
+ }
1219
+
1220
+ .items-list-header {
1221
+ background-color: #f1f1f1;
1222
+ }
1223
+ }
1224
+
1225
+ .wpuf-update-profile-form {
1226
+ .form-row-first {
1227
+ float: left;
1228
+ width: 47%;
1229
+ overflow: visible;
1230
+ }
1231
+
1232
+ .form-row-last {
1233
+ float: right;
1234
+ width: 47%;
1235
+ overflow: visible;
1236
+ }
1237
+ }
1238
+ }
1239
+
1240
+ .wpuf-toc-container {
1241
+ .wpuf-fields {
1242
+ position: relative;
1243
+
1244
+ .wpuf-toc-checkbox {
1245
+ position: absolute;
1246
+ top: 0;
1247
+ left: 0;
1248
+ }
1249
+
1250
+ &.has-toc-checkbox {
1251
+
1252
+ .wpuf-toc-description {
1253
+ margin-left: 25px;
1254
+ }
1255
+ }
1256
+ }
1257
+ }
1258
+
1259
+ // Google Map
1260
+ // --------------------------------------------------
1261
+ .wpuf-field-google-map {
1262
+ height: 300px;
1263
+ width: 100%;
1264
+ }
1265
+
1266
+ .wpuf-form-google-map {
1267
+ height: 300px;
1268
+ width: 100%;
1269
+ }
1270
+
1271
+ input[type="text"].wpuf-google-map-search {
1272
+ margin-top: 10px !important;
1273
+ border: 1px solid transparent !important;
1274
+ border-radius: 2px 0 0 2px !important;
1275
+ box-sizing: border-box !important;
1276
+ -moz-box-sizing: border-box !important;
1277
+ height: 32px !important;
1278
+ outline: none !important;
1279
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
1280
+ background-color: #fff !important;
1281
+ text-overflow: ellipsis !important;
1282
+ width: 170px !important;
1283
+ font-family: Roboto !important;
1284
+ font-size: 15px !important;
1285
+ font-weight: 300 !important;
1286
+ padding: 0 11px 0 13px !important;
1287
+ display: none;
1288
+
1289
+ .gm-style & {
1290
+ display: block;
1291
+ }
1292
+ }
1293
+
1294
+ .wpuf-form-google-map-container {
1295
+
1296
+ input[type="text"].wpuf-google-map-search {
1297
+ width: 230px !important;
1298
+ }
1299
+
1300
+ &.hide-search-box {
1301
+
1302
+ .gm-style input[type="text"].wpuf-google-map-search {
1303
+ display: none;
1304
+ }
1305
+ }
1306
+ }
assets/css/images/ui-bg_diagonals-small_75_cccccc_40x40.png ADDED
Binary file
assets/css/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
assets/css/images/ui-bg_flat_0_ffffff_40x100.png ADDED
Binary file
assets/css/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
assets/css/images/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
assets/css/images/ui-icons_222222_256x240.png ADDED
Binary file
assets/css/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
assets/css/images/ui-icons_454545_256x240.png ADDED
Binary file
assets/css/images/ui-icons_888888_256x240.png ADDED
Binary file
assets/css/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
assets/css/jquery-ui-1.9.1.custom.css ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.1 - 2012-11-14
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=07_diagonals_small.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=ffffff&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=90&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
+ * Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden { display: none; }
10
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
11
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
12
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
13
+ .ui-helper-clearfix:after { clear: both; }
14
+ .ui-helper-clearfix { zoom: 1; }
15
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
16
+
17
+
18
+ /* Interaction Cues
19
+ ----------------------------------*/
20
+ .ui-state-disabled { cursor: default !important; }
21
+
22
+
23
+ /* Icons
24
+ ----------------------------------*/
25
+
26
+ /* states and images */
27
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
28
+
29
+
30
+ /* Misc visuals
31
+ ----------------------------------*/
32
+
33
+ /* Overlays */
34
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
35
+ .ui-resizable { position: relative;}
36
+ .ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
37
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
38
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
39
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
40
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
41
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
42
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
43
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
44
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
45
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
46
+ .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
47
+ .ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
48
+ .ui-accordion .ui-accordion-noicons { padding-left: .7em; }
49
+ .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
50
+ .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
51
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
52
+ .ui-autocomplete {
53
+ position: absolute;
54
+ top: 0; /* #8656 */
55
+ cursor: default;
56
+ }
57
+
58
+ /* workarounds */
59
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
60
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
61
+ .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
62
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
63
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
64
+ .ui-button-icons-only { width: 3.4em; }
65
+ button.ui-button-icons-only { width: 3.7em; }
66
+
67
+ /*button text element */
68
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
69
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
70
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
71
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
72
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
73
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
74
+ /* no icon support for input elements, provide padding by default */
75
+ input.ui-button { padding: .4em 1em; }
76
+
77
+ /*button icon element(s) */
78
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
79
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
80
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
81
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
82
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
83
+
84
+ /*button sets*/
85
+ .ui-buttonset { margin-right: 7px; }
86
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
87
+
88
+ /* workarounds */
89
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
90
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
91
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
92
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
93
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
94
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
95
+ .ui-datepicker .ui-datepicker-next { right:2px; }
96
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
97
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
98
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
99
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
100
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
101
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
102
+ .ui-datepicker select.ui-datepicker-month,
103
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
104
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
105
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
106
+ .ui-datepicker td { border: 0; padding: 1px; }
107
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
108
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
109
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
110
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
111
+
112
+ /* with multiple calendars */
113
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
114
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
115
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
116
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
117
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
118
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
119
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
120
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
121
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
122
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
123
+
124
+ /* RTL support */
125
+ .ui-datepicker-rtl { direction: rtl; }
126
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
127
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
128
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
129
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
130
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
131
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
132
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
133
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
134
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
135
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
136
+
137
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
138
+ .ui-datepicker-cover {
139
+ position: absolute; /*must have*/
140
+ z-index: -1; /*must have*/
141
+ filter: mask(); /*must have*/
142
+ top: -4px; /*must have*/
143
+ left: -4px; /*must have*/
144
+ width: 200px; /*must have*/
145
+ height: 200px; /*must have*/
146
+ }.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
147
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
148
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
149
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
150
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
151
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
152
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
153
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
154
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
155
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
156
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
157
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
158
+ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
159
+ .ui-menu .ui-menu { margin-top: -3px; position: absolute; }
160
+ .ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
161
+ .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
162
+ .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
163
+ .ui-menu .ui-menu-item a.ui-state-focus,
164
+ .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
165
+
166
+ .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
167
+ .ui-menu .ui-state-disabled a { cursor: default; }
168
+
169
+ /* icon support */
170
+ .ui-menu-icons { position: relative; }
171
+ .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
172
+
173
+ /* left-aligned */
174
+ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
175
+
176
+ /* right-aligned */
177
+ .ui-menu .ui-menu-icon { position: static; float: right; }
178
+ .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
179
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }.ui-slider { position: relative; text-align: left; }
180
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
181
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
182
+
183
+ .ui-slider-horizontal { height: .8em; }
184
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
185
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
186
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
187
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
188
+
189
+ .ui-slider-vertical { width: .8em; height: 100px; }
190
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
191
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
192
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
193
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
194
+ .ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
195
+ .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
196
+ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
197
+ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
198
+ .ui-spinner-up { top: 0; }
199
+ .ui-spinner-down { bottom: 0; }
200
+
201
+ /* TR overrides */
202
+ .ui-spinner .ui-icon-triangle-1-s {
203
+ /* need to fix icons sprite */
204
+ background-position:-65px -16px;
205
+ }
206
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
207
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
208
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
209
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
210
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
211
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
212
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
213
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
214
+ .ui-tooltip {
215
+ padding: 8px;
216
+ position: absolute;
217
+ z-index: 9999;
218
+ max-width: 300px;
219
+ -webkit-box-shadow: 0 0 5px #aaa;
220
+ box-shadow: 0 0 5px #aaa;
221
+ }
222
+ /* Fades and background-images don't work well together in IE6, drop the image */
223
+ * html .ui-tooltip {
224
+ background-image: none;
225
+ }
226
+ body .ui-tooltip { border-width: 2px; }
227
+
228
+ /* Component containers
229
+ ----------------------------------*/
230
+ .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
231
+ .ui-widget .ui-widget { font-size: 1em; }
232
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
233
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
234
+ .ui-widget-content a { color: #222222; }
235
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_diagonals-small_75_cccccc_40x40.png) 50% 50% repeat; color: #222222; font-weight: bold; }
236
+ .ui-widget-header a { color: #222222; }
237
+
238
+ /* Interaction states
239
+ ----------------------------------*/
240
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
241
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
242
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
243
+ .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; }
244
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
245
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
246
+
247
+ /* Interaction Cues
248
+ ----------------------------------*/
249
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
250
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
251
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
252
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
253
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
254
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
255
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
256
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
257
+ .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
258
+
259
+ /* Icons
260
+ ----------------------------------*/
261
+
262
+ /* states and images */
263
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
264
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
265
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
266
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
267
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
268
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
269
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
270
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
271
+
272
+ /* positioning */
273
+ .ui-icon-carat-1-n { background-position: 0 0; }
274
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
275
+ .ui-icon-carat-1-e { background-position: -32px 0; }
276
+ .ui-icon-carat-1-se { background-position: -48px 0; }
277
+ .ui-icon-carat-1-s { background-position: -64px 0; }
278
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
279
+ .ui-icon-carat-1-w { background-position: -96px 0; }
280
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
281
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
282
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
283
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
284
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
285
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
286
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
287
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
288
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
289
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
290
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
291
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
292
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
293
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
294
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
295
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
296
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
297
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
298
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
299
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
300
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
301
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
302
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
303
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
304
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
305
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
306
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
307
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
308
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
309
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
310
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
311
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
312
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
313
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
314
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
315
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
316
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
317
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
318
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
319
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
320
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
321
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
322
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
323
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
324
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
325
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
326
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
327
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
328
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
329
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
330
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
331
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
332
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
333
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
334
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
335
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
336
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
337
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
338
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
339
+ .ui-icon-extlink { background-position: -32px -80px; }
340
+ .ui-icon-newwin { background-position: -48px -80px; }
341
+ .ui-icon-refresh { background-position: -64px -80px; }
342
+ .ui-icon-shuffle { background-position: -80px -80px; }
343
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
344
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
345
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
346
+ .ui-icon-folder-open { background-position: -16px -96px; }
347
+ .ui-icon-document { background-position: -32px -96px; }
348
+ .ui-icon-document-b { background-position: -48px -96px; }
349
+ .ui-icon-note { background-position: -64px -96px; }
350
+ .ui-icon-mail-closed { background-position: -80px -96px; }
351
+ .ui-icon-mail-open { background-position: -96px -96px; }
352
+ .ui-icon-suitcase { background-position: -112px -96px; }
353
+ .ui-icon-comment { background-position: -128px -96px; }
354
+ .ui-icon-person { background-position: -144px -96px; }
355
+ .ui-icon-print { background-position: -160px -96px; }
356
+ .ui-icon-trash { background-position: -176px -96px; }
357
+ .ui-icon-locked { background-position: -192px -96px; }
358
+ .ui-icon-unlocked { background-position: -208px -96px; }
359
+ .ui-icon-bookmark { background-position: -224px -96px; }
360
+ .ui-icon-tag { background-position: -240px -96px; }
361
+ .ui-icon-home { background-position: 0 -112px; }
362
+ .ui-icon-flag { background-position: -16px -112px; }
363
+ .ui-icon-calendar { background-position: -32px -112px; }
364
+ .ui-icon-cart { background-position: -48px -112px; }
365
+ .ui-icon-pencil { background-position: -64px -112px; }
366
+ .ui-icon-clock { background-position: -80px -112px; }
367
+ .ui-icon-disk { background-position: -96px -112px; }
368
+ .ui-icon-calculator { background-position: -112px -112px; }
369
+ .ui-icon-zoomin { background-position: -128px -112px; }
370
+ .ui-icon-zoomout { background-position: -144px -112px; }
371
+ .ui-icon-search { background-position: -160px -112px; }
372
+ .ui-icon-wrench { background-position: -176px -112px; }
373
+ .ui-icon-gear { background-position: -192px -112px; }
374
+ .ui-icon-heart { background-position: -208px -112px; }
375
+ .ui-icon-star { background-position: -224px -112px; }
376
+ .ui-icon-link { background-position: -240px -112px; }
377
+ .ui-icon-cancel { background-position: 0 -128px; }
378
+ .ui-icon-plus { background-position: -16px -128px; }
379
+ .ui-icon-plusthick { background-position: -32px -128px; }
380
+ .ui-icon-minus { background-position: -48px -128px; }
381
+ .ui-icon-minusthick { background-position: -64px -128px; }
382
+ .ui-icon-close { background-position: -80px -128px; }
383
+ .ui-icon-closethick { background-position: -96px -128px; }
384
+ .ui-icon-key { background-position: -112px -128px; }
385
+ .ui-icon-lightbulb { background-position: -128px -128px; }
386
+ .ui-icon-scissors { background-position: -144px -128px; }
387
+ .ui-icon-clipboard { background-position: -160px -128px; }
388
+ .ui-icon-copy { background-position: -176px -128px; }
389
+ .ui-icon-contact { background-position: -192px -128px; }
390
+ .ui-icon-image { background-position: -208px -128px; }
391
+ .ui-icon-video { background-position: -224px -128px; }
392
+ .ui-icon-script { background-position: -240px -128px; }
393
+ .ui-icon-alert { background-position: 0 -144px; }
394
+ .ui-icon-info { background-position: -16px -144px; }
395
+ .ui-icon-notice { background-position: -32px -144px; }
396
+ .ui-icon-help { background-position: -48px -144px; }
397
+ .ui-icon-check { background-position: -64px -144px; }
398
+ .ui-icon-bullet { background-position: -80px -144px; }
399
+ .ui-icon-radio-on { background-position: -96px -144px; }
400
+ .ui-icon-radio-off { background-position: -112px -144px; }
401
+ .ui-icon-pin-w { background-position: -128px -144px; }
402
+ .ui-icon-pin-s { background-position: -144px -144px; }
403
+ .ui-icon-play { background-position: 0 -160px; }
404
+ .ui-icon-pause { background-position: -16px -160px; }
405
+ .ui-icon-seek-next { background-position: -32px -160px; }
406
+ .ui-icon-seek-prev { background-position: -48px -160px; }
407
+ .ui-icon-seek-end { background-position: -64px -160px; }
408
+ .ui-icon-seek-start { background-position: -80px -160px; }
409
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
410
+ .ui-icon-seek-first { background-position: -80px -160px; }
411
+ .ui-icon-stop { background-position: -96px -160px; }
412
+ .ui-icon-eject { background-position: -112px -160px; }
413
+ .ui-icon-volume-off { background-position: -128px -160px; }
414
+ .ui-icon-volume-on { background-position: -144px -160px; }
415
+ .ui-icon-power { background-position: 0 -176px; }
416
+ .ui-icon-signal-diag { background-position: -16px -176px; }
417
+ .ui-icon-signal { background-position: -32px -176px; }
418
+ .ui-icon-battery-0 { background-position: -48px -176px; }
419
+ .ui-icon-battery-1 { background-position: -64px -176px; }
420
+ .ui-icon-battery-2 { background-position: -80px -176px; }
421
+ .ui-icon-battery-3 { background-position: -96px -176px; }
422
+ .ui-icon-circle-plus { background-position: 0 -192px; }
423
+ .ui-icon-circle-minus { background-position: -16px -192px; }
424
+ .ui-icon-circle-close { background-position: -32px -192px; }
425
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
426
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
427
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
428
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
429
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
430
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
431
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
432
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
433
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
434
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
435
+ .ui-icon-circle-check { background-position: -208px -192px; }
436
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
437
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
438
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
439
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
440
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
441
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
442
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
443
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
444
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
445
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
446
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
447
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
448
+
449
+
450
+ /* Misc visuals
451
+ ----------------------------------*/
452
+
453
+ /* Corner radius */
454
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
455
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
456
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
457
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
458
+
459
+ /* Overlays */
460
+ .ui-widget-overlay { background: #ffffff url(images/ui-bg_flat_0_ffffff_40x100.png) 50% 50% repeat-x; opacity: .9;filter:Alpha(Opacity=90); }
461
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
assets/css/jquery.smallipop.css ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* smallipop css */
2
+ .smallipopHint { display: none; }
3
+
4
+ .smallipop-instance { position: absolute; display: none; top: 0; left: 0; background-color: #314b64; border: 1px solid #0f161e; color: #d2dfe7; z-index: 9999; max-width: 400px; }
5
+ .smallipop-instance font { size: 11px; family: arial; }
6
+ .smallipop-instance a { color: #98cbea; }
7
+ .smallipop-instance .sipContent { padding: 10px; }
8
+ .smallipop-instance .sipArrow, .smallipop-instance .sipArrowBorder { position: absolute; left: 50%; height: 0; width: 0; }
9
+ .smallipop-instance .sipArrow { bottom: -20px; margin-left: -10px; border: 10px solid transparent; }
10
+ .smallipop-instance .sipArrowBorder { bottom: -24px; margin-left: -12px; border: 12px solid transparent; }
11
+ .smallipop-instance.sipAlignLeft .sipArrow { margin-left: 0; left: auto; right: 20px; }
12
+ .smallipop-instance.sipAlignLeft .sipArrowBorder { margin-left: 0; left: auto; right: 18px; }
13
+ .smallipop-instance.sipAlignRight .sipArrow { margin-left: 0; left: 20px; right: auto; }
14
+ .smallipop-instance.sipAlignRight .sipArrowBorder { margin-left: 0; left: 18px; right: auto; }
15
+ .smallipop-instance.sipAlignBottom .sipArrow { bottom: auto; top: -20px; }
16
+ .smallipop-instance.sipAlignBottom .sipArrowBorder { bottom: auto; top: -24px; }
17
+ .smallipop-instance.sipPositionedLeft .sipArrow, .smallipop-instance.sipPositionedLeft .sipArrowBorder { right: -16px; left: auto; top: 50%; bottom: auto; border-width: 8px; margin: -8px 0 0; }
18
+ .smallipop-instance.sipPositionedLeft .sipArrowBorder { right: -20px; border-width: 10px; margin: -10px 0 0; }
19
+ .smallipop-instance.sipPositionedRight .sipArrow, .smallipop-instance.sipPositionedRight .sipArrowBorder { left: -16px; right: auto; top: 50%; bottom: auto; border-width: 8px; margin: -8px 0 0; }
20
+ .smallipop-instance.sipPositionedRight .sipArrowBorder { left: -20px; border-width: 10px; margin: -10px 0 0; }
21
+ .smallipop-instance .smallipop-tour-content { padding: 5px 0; min-width: 150px; }
22
+ .smallipop-instance .smallipop-tour-footer { padding-top: 5px; position: relative; }
23
+ .smallipop-instance .smallipop-tour-progress { color: #bbb; text-align: center; position: absolute; left: 50%; width: 80px; margin-left: -40px; top: 8px; }
24
+ .smallipop-instance .smallipop-tour-close-icon { position: absolute; right: -8px; top: -8px; width: 16px; height: 16px; padding-top: 0px; font-size: 11px; background: #555; color: #ccc; text-align: center; text-shadow: 0 -1px 1px #666666; border-radius: 8px; -o-border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
25
+ .smallipop-instance .smallipop-tour-close-icon:hover { text-decoration: none; background: #666; color: #fff; }
26
+ .smallipop-instance .smallipop-tour-prev, .smallipop-instance .smallipop-tour-next, .smallipop-instance .smallipop-tour-close { color: #ccc; display: block; padding: 3px 4px 2px; line-height: 1em; float: left; background: #203142; border-radius: 3px; -o-border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
27
+ .smallipop-instance .smallipop-tour-prev:hover, .smallipop-instance .smallipop-tour-next:hover, .smallipop-instance .smallipop-tour-close:hover { color: #fff; background: #293e53; text-decoration: none; }
28
+ .smallipop-instance .smallipop-tour-next, .smallipop-instance .smallipop-tour-close { float: right; }
29
+
30
+ /* default theme */
31
+ .smallipop-instance.default { text-shadow: 0 -1px 1px #0f161e; -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 12px; -o-border-radius: 12px; -moz-border-radius: 12px; -webkit-border-radius: 12px; background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -moz-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -ms-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -o-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); /* Fallback for opera */ background-image: -webkit-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -moz-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -ms-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -o-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); }
32
+ .smallipop-instance.default a { text-shadow: 0 -1px 1px #0f161e; }
33
+ .smallipop-instance.default .sipContent { border-top: 1px solid #586d82; border-radius: 12px; -o-border-radius: 12px; -moz-border-radius: 12px; -webkit-border-radius: 12px; }
34
+ .smallipop-instance.default .sipArrow { border-color: #1a2634 transparent transparent transparent; }
35
+ .smallipop-instance.default .sipArrowBorder { border-color: #0f161e transparent transparent transparent; }
36
+ .smallipop-instance.default.sipAlignBottom .sipArrow { border-color: transparent transparent #1a2634 transparent; }
37
+ .smallipop-instance.default.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #0f161e transparent; }
38
+ .smallipop-instance.default.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #1a2634; }
39
+ .smallipop-instance.default.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #0f161e; }
40
+ .smallipop-instance.default.sipPositionedRight .sipArrow { border-color: transparent #1a2634 transparent transparent; }
41
+ .smallipop-instance.default.sipPositionedRight .sipArrowBorder { border-color: transparent #0f161e transparent transparent; }
42
+
43
+ .cssgradients.rgba .smallipop-instance.default { background-color: transparent; }
44
+
45
+ /* blue theme */
46
+ .smallipop-instance.blue { background: transparent; color: #111; border: 10px solid #0064b4; border-color: rgba(0, 100, 180, 0.9); -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 7px; -o-border-radius: 7px; -moz-border-radius: 7px; -webkit-border-radius: 7px; }
47
+ .smallipop-instance.blue a { color: #2276aa; }
48
+ .smallipop-instance.blue .sipContent { border: 0; background: #fcfcfc; }
49
+ .smallipop-instance.blue .sipArrow { bottom: -30px; border-color: #0064b4 transparent transparent transparent; border-color: rgba(0, 100, 180, 0.9) transparent transparent transparent; }
50
+ .smallipop-instance.blue.sipAlignBottom .sipArrow { top: -30px; border-color: transparent transparent #0064b4 transparent; border-color: transparent transparent rgba(0, 100, 180, 0.9) transparent; }
51
+ .smallipop-instance.blue.sipPositionedLeft .sipArrow { right: -26px; border-color: transparent transparent transparent #0064b4; border-color: transparent transparent transparent rgba(0, 100, 180, 0.9); }
52
+ .smallipop-instance.blue.sipPositionedRight .sipArrow { left: -26px; border-color: transparent #0064b4 transparent transparent; border-color: transparent rgba(0, 100, 180, 0.9) transparent transparent; }
53
+ .smallipop-instance.blue .smallipop-tour-progress { color: #777; }
54
+ .smallipop-instance.blue .smallipop-tour-prev, .smallipop-instance.blue .smallipop-tour-next, .smallipop-instance.blue .smallipop-tour-close { color: #222; background: #efefef; }
55
+ .smallipop-instance.blue .smallipop-tour-prev:hover, .smallipop-instance.blue .smallipop-tour-next:hover, .smallipop-instance.blue .smallipop-tour-close:hover { color: #111; background: #f7f7f7; }
56
+
57
+ /* black theme */
58
+ .smallipop-instance.black { background-color: #222; border-color: #111; text-shadow: 0 -1px 1px #111111; color: #f5f5f5; -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); border-radius: 5px; -o-border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
59
+ .smallipop-instance.black a { color: #eef8ff; text-shadow: 0 -1px 1px #111111; }
60
+ .smallipop-instance.black .sipContent { border-top: 1px solid #666; border-radius: 5px; -o-border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
61
+ .smallipop-instance.black .sipArrow { border-color: #222 transparent transparent transparent; }
62
+ .smallipop-instance.black .sipArrowBorder { border-color: #111 transparent transparent transparent; }
63
+ .smallipop-instance.black.sipAlignBottom .sipArrow { border-color: transparent transparent #222 transparent; }
64
+ .smallipop-instance.black.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #111 transparent; }
65
+ .smallipop-instance.black.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #222; }
66
+ .smallipop-instance.black.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #111; }
67
+ .smallipop-instance.black.sipPositionedRight .sipArrow { border-color: transparent #222 transparent transparent; }
68
+ .smallipop-instance.black.sipPositionedRight .sipArrowBorder { border-color: transparent #111 transparent transparent; }
69
+ .smallipop-instance.black .smallipop-tour-progress { color: #888; }
70
+ .smallipop-instance.black .smallipop-tour-prev, .smallipop-instance.black .smallipop-tour-next, .smallipop-instance.black .smallipop-tour-close { color: #ccc; background: #333; }
71
+ .smallipop-instance.black .smallipop-tour-prev:hover, .smallipop-instance.black .smallipop-tour-next:hover, .smallipop-instance.black .smallipop-tour-close:hover { color: #fff; background: #3a3a3a; }
72
+
73
+ .cssgradients .smallipop-instance.black { background-color: transparent; }
74
+
75
+ /* orange theme */
76
+ .smallipop-instance.orange { background-color: #f9aa18; border-color: #e17500; text-shadow: 0 1px 1px #fff24d; color: #714900; background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, #fff24d, #f9aa18); background-image: -moz-linear-gradient(top, #fff24d, #f9aa18); background-image: -ms-linear-gradient(top, #fff24d, #f9aa18); background-image: -o-linear-gradient(top, #fff24d, #f9aa18); background-image: linear-gradient(top, #fff24d, #f9aa18); -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 10px; -o-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; }
77
+ .smallipop-instance.orange a { color: #145d95; text-shadow: 0 1px 1px #fff24d; }
78
+ .smallipop-instance.orange .sipContent { border-top: 1px solid #fffabc; border-radius: 10px; -o-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; }
79
+ .smallipop-instance.orange .sipArrow { border-color: #f9aa18 transparent transparent transparent; }
80
+ .smallipop-instance.orange .sipArrowBorder { border-color: #e17500 transparent transparent transparent; }
81
+ .smallipop-instance.orange.sipAlignBottom .sipArrow { border-color: transparent transparent #f9aa18 transparent; }
82
+ .smallipop-instance.orange.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #e17500 transparent; }
83
+ .smallipop-instance.orange.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #f9c718; }
84
+ .smallipop-instance.orange.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #e17500; }
85
+ .smallipop-instance.orange.sipPositionedRight .sipArrow { border-color: transparent #f9c718 transparent transparent; }
86
+ .smallipop-instance.orange.sipPositionedRight .sipArrowBorder { border-color: transparent #e17500 transparent transparent; }
87
+ .smallipop-instance.orange .smallipop-tour-progress { color: #444; }
88
+ .smallipop-instance.orange .smallipop-tour-prev, .smallipop-instance.orange .smallipop-tour-next, .smallipop-instance.orange .smallipop-tour-close { color: #444; background: #f19f06; }
89
+ .smallipop-instance.orange .smallipop-tour-prev:hover, .smallipop-instance.orange .smallipop-tour-next:hover, .smallipop-instance.orange .smallipop-tour-close:hover { color: #333; background: #f9a509; }
90
+
91
+ /* white theme */
92
+ .smallipop-instance.white { background-color: #fcfcfc; border-color: #ccc; text-shadow: 0 1px 1px #eee; color: #444; width: 200px; max-width: 200px; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); border-radius: 6px; -o-border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; }
93
+ .smallipop-instance.white .sipContent { text-align: center; border-radius: 6px; -o-border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; }
94
+ .smallipop-instance.white .sipArrow { border-color: #fcfcfc transparent transparent transparent; }
95
+ .smallipop-instance.white .sipArrowBorder { border-color: #ccc transparent transparent transparent; }
96
+ .smallipop-instance.white.sipAlignBottom .sipArrow { border-color: transparent transparent #fcfcfc transparent; }
97
+ .smallipop-instance.white.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #ccc transparent; }
98
+ .smallipop-instance.white.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #fcfcfc; }
99
+ .smallipop-instance.white.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #ccc; }
100
+ .smallipop-instance.white.sipPositionedRight .sipArrow { border-color: transparent #fcfcfc transparent transparent; }
101
+ .smallipop-instance.white.sipPositionedRight .sipArrowBorder { border-color: transparent #ccc transparent transparent; }
102
+ .smallipop-instance.white .smallipop-tour-progress { color: #777; }
103
+ .smallipop-instance.white .smallipop-tour-close-icon { background: #fafafa; color: #555; text-shadow: 0 1px 1px #fff; }
104
+ .smallipop-instance.white .smallipop-tour-close-icon:hover { background: #f5f5f5; color: #222; }
105
+ .smallipop-instance.white .smallipop-tour-prev, .smallipop-instance.white .smallipop-tour-next, .smallipop-instance.white .smallipop-tour-close { color: #666; background: #f0f0f0; }
106
+ .smallipop-instance.white .smallipop-tour-prev:hover, .smallipop-instance.white .smallipop-tour-next:hover, .smallipop-instance.white .smallipop-tour-close:hover { color: #333; background: #f4f4f4; }
107
+
108
+ /* white theme extended, requires rgba support */
109
+ .smallipop-instance.whiteTransparent { background-color: rgba(255, 255, 255, 0.8); }
110
+ .smallipop-instance.whiteTransparent .sipArrow { bottom: -21px; border-color: rgba(255, 255, 255, 0.8) transparent transparent transparent; }
111
+ .smallipop-instance.whiteTransparent .sipArrowBorder { border-color: transparent; }
112
+ .smallipop-instance.whiteTransparent.sipAlignBottom .sipArrow { top: -21px; border-color: transparent transparent rgba(255, 255, 255, 0.8) transparent; }
113
+ .smallipop-instance.whiteTransparent.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent rgba(255, 255, 255, 0.8); }
114
+ .smallipop-instance.whiteTransparent.sipPositionedRight .sipArrow { border-color: transparent rgba(255, 255, 255, 0.8) transparent transparent; }
115
+
116
+ /* fat shadow extension theme */
117
+ .smallipop-instance.fatShadow { -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); -moz-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
assets/css/wpuf-form-builder.css ADDED
@@ -0,0 +1,725 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [v-cloak] {
2
+ display: none;
3
+ }
4
+ .wpuf-pro-text-alert {
5
+ font-style: italic;
6
+ color: #cccccc;
7
+ }
8
+ .wpuf-pro-text-alert a {
9
+ text-decoration: none;
10
+ color: #aaa;
11
+ }
12
+ #wpuf-pro-content {
13
+ opacity: 0.7;
14
+ }
15
+ .clearfix:before,
16
+ .clearfix:after {
17
+ content: " ";
18
+ display: table;
19
+ }
20
+ .clearfix:after {
21
+ clear: both;
22
+ }
23
+ .pull-left {
24
+ float: left !important;
25
+ }
26
+ .pull-right {
27
+ float: right !important;
28
+ }
29
+ .text-center {
30
+ text-align: center;
31
+ }
32
+ .text-right {
33
+ text-align: right;
34
+ }
35
+ .margin-0 {
36
+ margin: 0;
37
+ }
38
+ .margin-bottom-10 {
39
+ margin-bottom: 10px;
40
+ }
41
+ .list-inline {
42
+ padding-left: 0;
43
+ list-style: none;
44
+ margin-left: -5px;
45
+ }
46
+ .list-inline > li {
47
+ display: inline-block;
48
+ padding-left: 5px;
49
+ padding-right: 5px;
50
+ }
51
+ .disabled {
52
+ pointer-events: none;
53
+ cursor: not-allowed;
54
+ opacity: 0.7;
55
+ }
56
+ .label-hr {
57
+ border-bottom: 1px solid #ccc;
58
+ display: block;
59
+ padding-bottom: 8px;
60
+ }
61
+ .slide-fade-enter-active {
62
+ -webkit-transition: all 0.6s;
63
+ -o-transition: all 0.6s;
64
+ transition: all 0.6s;
65
+ overflow: hidden;
66
+ }
67
+ .slide-fade-leave-active {
68
+ -webkit-transition: all 0.4s;
69
+ -o-transition: all 0.4s;
70
+ transition: all 0.4s;
71
+ overflow: hidden;
72
+ }
73
+ .slide-fade-enter,
74
+ .slide-fade-leave-active {
75
+ opacity: .3 !important;
76
+ max-height: 0 !important;
77
+ margin: 0 !important;
78
+ }
79
+ .sweet-alert {
80
+ border-radius: 0;
81
+ }
82
+ .sweet-alert h2 {
83
+ font-size: 26px;
84
+ line-height: 1.6;
85
+ }
86
+ .sweet-alert p {
87
+ font-size: 15px;
88
+ font-weight: 400;
89
+ color: #656565;
90
+ line-height: 1.7;
91
+ }
92
+ .sweet-alert p a {
93
+ text-decoration: none;
94
+ }
95
+ .sweet-alert button {
96
+ border-radius: 3px;
97
+ padding: 10px 20px;
98
+ min-width: 100px;
99
+ }
100
+ .loader,
101
+ .loader:after {
102
+ border-radius: 50%;
103
+ width: 25px;
104
+ height: 25px;
105
+ }
106
+ .loader {
107
+ display: inline-block;
108
+ position: relative;
109
+ text-indent: -9999em;
110
+ border-top: 3px solid rgba(0, 115, 170, 0.2);
111
+ border-right: 3px solid rgba(0, 115, 170, 0.2);
112
+ border-bottom: 3px solid rgba(0, 115, 170, 0.2);
113
+ border-left: 3px solid #0073aa;
114
+ -webkit-transform: translateZ(0);
115
+ -ms-transform: translateZ(0);
116
+ transform: translateZ(0);
117
+ -webkit-animation: wpuf_form_builder_loader 1.1s infinite linear;
118
+ animation: wpuf_form_builder_loader 1.1s infinite linear;
119
+ }
120
+ .button.button-ajax-working .loader {
121
+ display: inline-block;
122
+ width: 17px;
123
+ height: 17px;
124
+ top: 4px;
125
+ margin-right: 3px;
126
+ border-top: 1px solid #66c6e4;
127
+ border-right: 1px solid #66c6e4;
128
+ border-bottom: 1px solid #66c6e4;
129
+ border-left: 1px solid rgba(102, 198, 228, 0);
130
+ }
131
+ @-webkit-keyframes wpuf_form_builder_loader {
132
+ 0% {
133
+ -webkit-transform: rotate(0deg);
134
+ transform: rotate(0deg);
135
+ }
136
+ 100% {
137
+ -webkit-transform: rotate(360deg);
138
+ transform: rotate(360deg);
139
+ }
140
+ }
141
+ @keyframes wpuf_form_builder_loader {
142
+ 0% {
143
+ -webkit-transform: rotate(0deg);
144
+ transform: rotate(0deg);
145
+ }
146
+ 100% {
147
+ -webkit-transform: rotate(360deg);
148
+ transform: rotate(360deg);
149
+ }
150
+ }
151
+ #toast-container.toast-top-right {
152
+ top: 40px;
153
+ right: 18px;
154
+ }
155
+ #toast-container > div {
156
+ opacity: 1;
157
+ }
158
+ #toast-container > :hover {
159
+ opacity: .9;
160
+ }
161
+ .wp-core-ui .button-group.wpuf-flex-button-group {
162
+ position: relative;
163
+ z-index: 1;
164
+ display: flex;
165
+ flex-flow: row nowrap;
166
+ justify-content: flex-start;
167
+ align-content: center;
168
+ align-items: center;
169
+ }
170
+ .wp-core-ui .button-group.wpuf-flex-button-group .button {
171
+ flex-grow: 1;
172
+ flex-shrink: 1;
173
+ flex-basis: 0;
174
+ align-self: auto;
175
+ text-align: center;
176
+ }
177
+ .selectize-input {
178
+ padding: 6px 5px;
179
+ border: 1px solid #ddd;
180
+ }
181
+ .selectize-dropdown .active {
182
+ background-color: #0073aa;
183
+ color: #fff;
184
+ }
185
+ .selectize-element-group {
186
+ display: none;
187
+ }
188
+ .selectize-element-group + .selectize-control {
189
+ display: none;
190
+ }
191
+ .selectize-element-group.active + .selectize-control {
192
+ display: block;
193
+ margin-top: 10px;
194
+ }
195
+ .selectize-control.multi .selectize-input [data-value] {
196
+ text-shadow: 0 1px 0 rgba(0, 51, 83, 0.3);
197
+ -webkit-border-radius: 3px;
198
+ -moz-border-radius: 3px;
199
+ border-radius: 3px;
200
+ background-color: rgba(0, 115, 170, 0.64);
201
+ background-image: -moz-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
202
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0, 115, 170, 0.4)), to(#0073aa));
203
+ background-image: -webkit-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
204
+ background-image: -o-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
205
+ background-image: linear-gradient(to bottom, rgba(0, 115, 170, 0.4), #0073aa);
206
+ background-repeat: repeat-x;
207
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#660073aa', endColorstr='#ff0073aa', GradientType=0);
208
+ -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
209
+ box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
210
+ }
211
+ .selectize-control.multi .selectize-input [data-value].active {
212
+ background-color: rgba(0, 115, 170, 0.64);
213
+ background-image: -moz-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
214
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0, 115, 170, 0.4)), to(#0073aa));
215
+ background-image: -webkit-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
216
+ background-image: -o-linear-gradient(top, rgba(0, 115, 170, 0.4), #0073aa);
217
+ background-image: linear-gradient(to bottom, rgba(0, 115, 170, 0.4), #0073aa);
218
+ background-repeat: repeat-x;
219
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#660073aa', endColorstr='#ff0073aa', GradientType=0);
220
+ }
221
+ #wpuf-form-builder {
222
+ width: calc(100% - 200px);
223
+ padding-top: 10px;
224
+ position: fixed;
225
+ top: 25px;
226
+ }
227
+ #wpuf-form-builder * {
228
+ box-sizing: border-box;
229
+ }
230
+ #wpuf-form-builder > fieldset > .nav-tab-wrapper .nav-tab:focus {
231
+ outline: 0;
232
+ -webkit-box-shadow: none;
233
+ box-shadow: none;
234
+ }
235
+ #wpuf-form-builder > fieldset > .nav-tab-wrapper .button {
236
+ font-weight: 400;
237
+ }
238
+ #wpuf-form-builder > fieldset > .tab-contents {
239
+ border-bottom: 1px solid #cccccc;
240
+ }
241
+ #wpuf-form-builder > fieldset > .tab-contents > .group {
242
+ display: none;
243
+ }
244
+ #wpuf-form-builder > fieldset > .tab-contents > .group.active {
245
+ display: block;
246
+ }
247
+ #wpuf-form-builder > fieldset > .tab-contents > .group:not(#wpuf-form-builder-container):not(#wpuf-form-builder-settings) {
248
+ height: calc(100vh - 125px);
249
+ overflow-y: auto;
250
+ padding-top: 15px;
251
+ }
252
+ #wpuf-form-builder .wpuf-settings-nav-tab-wrapper {
253
+ width: 200px;
254
+ }
255
+ #wpuf-form-builder .wp-picker-holder * {
256
+ box-sizing: content-box;
257
+ }
258
+ #wpuf-form-builder-settings {
259
+ position: relative;
260
+ margin-top: 15px;
261
+ }
262
+ #wpuf-form-builder-settings .nav-tab-wrapper {
263
+ position: absolute;
264
+ top: 0;
265
+ left: 0;
266
+ width: 170px;
267
+ border-bottom: 0;
268
+ }
269
+ #wpuf-form-builder-settings .nav-tab-wrapper a {
270
+ width: calc(100% - -1px);
271
+ margin-left: 0;
272
+ margin-bottom: .5em;
273
+ border-right: 1px solid #cccccc;
274
+ border-bottom: 1px solid #cccccc;
275
+ font-weight: 400;
276
+ font-size: 13px;
277
+ }
278
+ #wpuf-form-builder-settings .nav-tab-wrapper a.nav-tab-active {
279
+ border-right-color: #f1f1f1;
280
+ }
281
+ #wpuf-form-builder-settings .nav-tab-wrapper a:focus {
282
+ outline: 0;
283
+ -webkit-box-shadow: none;
284
+ box-shadow: none;
285
+ }
286
+ #wpuf-form-builder-settings .tab-contents {
287
+ margin-left: 170px;
288
+ border-left: 1px solid #cccccc;
289
+ padding-left: 20px;
290
+ }
291
+ #wpuf-form-builder-settings .tab-contents > .group {
292
+ display: none;
293
+ height: calc(100vh - 140px);
294
+ overflow-y: auto;
295
+ }
296
+ #wpuf-form-builder-settings .tab-contents > .group.active {
297
+ display: block;
298
+ }
299
+ #wpuf-form-builder-settings .tab-contents .form-table {
300
+ margin-top: 0;
301
+ }
302
+ #wpuf-form-builder-container {
303
+ position: relative;
304
+ }
305
+ #wpuf-form-builder-container header {
306
+ height: 45px;
307
+ border-right: 1px solid #cccccc;
308
+ }
309
+ #wpuf-form-builder-container header .form-title {
310
+ cursor: pointer;
311
+ font-size: 1.3em;
312
+ font-weight: 600;
313
+ float: left;
314
+ margin-right: 10px;
315
+ margin-top: 10px;
316
+ line-height: 1.5;
317
+ max-width: 300px;
318
+ white-space: nowrap;
319
+ overflow: hidden;
320
+ text-overflow: ellipsis;
321
+ }
322
+ #wpuf-form-builder-container header .form-title:hover {
323
+ background-color: rgba(85, 85, 85, 0.2);
324
+ }
325
+ #wpuf-form-builder-container header .form-switcher-arrow {
326
+ cursor: pointer;
327
+ font-size: 24px;
328
+ margin-top: 10px;
329
+ line-height: 1;
330
+ width: 20px;
331
+ text-align: center;
332
+ }
333
+ #wpuf-form-builder-container header .form-switcher-arrow:hover {
334
+ background-color: rgba(85, 85, 85, 0.2);
335
+ }
336
+ #wpuf-form-builder-container header .form-id {
337
+ color: #fff;
338
+ background-color: #008ec2;
339
+ line-height: 170%;
340
+ padding: 0 8px;
341
+ border-radius: 2px;
342
+ font-size: 13px;
343
+ display: inline-block;
344
+ margin: 10px 0 0 15px;
345
+ cursor: pointer;
346
+ }
347
+ #wpuf-form-builder-container section {
348
+ height: calc(100vh - 170px);
349
+ overflow-y: auto;
350
+ }
351
+ #wpuf-form-builder-container #builder-form-fields {
352
+ position: absolute;
353
+ top: 0;
354
+ right: 0;
355
+ width: 360px;
356
+ }
357
+ #wpuf-form-builder-container #builder-form-fields header ul {
358
+ margin: 0;
359
+ }
360
+ #wpuf-form-builder-container #builder-form-fields header ul li {
361
+ width: 50%;
362
+ text-align: center;
363
+ float: left;
364
+ line-height: 1;
365
+ margin: 0;
366
+ }
367
+ #wpuf-form-builder-container #builder-form-fields header ul li a {
368
+ text-decoration: none;
369
+ line-height: 44px;
370
+ display: block;
371
+ background-color: #e5e5e5;
372
+ color: #777;
373
+ border-bottom: 1px solid #cccccc;
374
+ -webkit-transition: background-color 0.4s;
375
+ -o-transition: background-color 0.4s;
376
+ transition: background-color 0.4s;
377
+ }
378
+ #wpuf-form-builder-container #builder-form-fields header ul li a:hover {
379
+ background-color: #f2f2f2;
380
+ }
381
+ #wpuf-form-builder-container #builder-form-fields header ul li a:focus {
382
+ outline: 0;
383
+ -webkit-box-shadow: none;
384
+ box-shadow: none;
385
+ }
386
+ #wpuf-form-builder-container #builder-form-fields header ul li.active a {
387
+ background-color: #fff;
388
+ color: #444;
389
+ border-bottom: 1px solid #fff;
390
+ }
391
+ #wpuf-form-builder-container #builder-form-fields header ul li:first-child {
392
+ border-right: 1px solid #cccccc;
393
+ }
394
+ #wpuf-form-builder-container #builder-form-fields section {
395
+ background-color: #fff;
396
+ border-right: 1px solid #cccccc;
397
+ }
398
+ #wpuf-form-builder-container #builder-form-fields section .wpuf-form-builder-panel {
399
+ padding: 10px;
400
+ }
401
+ #wpuf-form-builder-container #builder-stage {
402
+ margin-right: 360px;
403
+ }
404
+ #wpuf-form-builder-container #builder-stage section {
405
+ background-color: #6b6b6b;
406
+ padding: 30px;
407
+ }
408
+ #wpuf-form-builder-container #builder-stage section #form-preview {
409
+ background-color: #fff;
410
+ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
411
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
412
+ padding: 25px;
413
+ max-width: 800px;
414
+ margin: 0 auto;
415
+ }
416
+ #form-preview-stage .field-items {
417
+ position: relative;
418
+ background-color: #fff;
419
+ }
420
+ #form-preview-stage .field-items .control-buttons {
421
+ position: absolute;
422
+ top: 0;
423
+ left: 0;
424
+ z-index: 10;
425
+ display: none;
426
+ width: 100%;
427
+ height: 100%;
428
+ margin: 0;
429
+ text-align: center;
430
+ background: rgba(255, 185, 0, 0.08);
431
+ border: 1px dashed #ffb900;
432
+ }
433
+ #form-preview-stage .field-items .control-buttons p {
434
+ position: absolute;
435
+ top: 50%;
436
+ left: 50%;
437
+ margin: -14px 0 0 -61px;
438
+ line-height: 1;
439
+ color: #eee;
440
+ background-color: #23282d;
441
+ }
442
+ #form-preview-stage .field-items .control-buttons i {
443
+ cursor: pointer;
444
+ padding: 8px;
445
+ }
446
+ #form-preview-stage .field-items .control-buttons i.move {
447
+ cursor: move;
448
+ }
449
+ #form-preview-stage .field-items .control-buttons i:hover {
450
+ background-color: #0073aa;
451
+ }
452
+ #form-preview-stage .field-items:hover .control-buttons {
453
+ display: block;
454
+ }
455
+ #form-preview-stage .field-items.current-editing {
456
+ background-color: rgba(255, 185, 0, 0.15);
457
+ }
458
+ #form-preview-stage .field-items.current-editing.ui-sortable-helper {
459
+ background-color: #fff;
460
+ }
461
+ #form-preview-stage .field-items.ui-sortable-helper {
462
+ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
463
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
464
+ }
465
+ #form-preview-stage .form-preview-stage-dropzone {
466
+ background-color: rgba(255, 185, 0, 0.3) !important;
467
+ border: 1px solid #ffb900;
468
+ height: 50px;
469
+ }
470
+ #form-preview-stage .wpuf-submit + .button + .form-preview-stage-dropzone,
471
+ #form-preview-stage .field-items.empty-list-item + .form-preview-stage-dropzone {
472
+ display: none;
473
+ }
474
+ #form-preview-stage .field-items.empty-list-item {
475
+ padding: 24px;
476
+ margin: 0;
477
+ border: 1px dashed rgba(35, 40, 45, 0.5);
478
+ }
479
+ #form-preview-stage .form-preview-stage-dropzone + .field-items.empty-list-item {
480
+ display: none;
481
+ }
482
+ #form-preview-stage .hidden-field-list {
483
+ border-top: 1px dashed #cccccc;
484
+ }
485
+ #form-preview-stage .hidden-field-list h4 {
486
+ font-weight: 400;
487
+ font-size: 16px;
488
+ margin: 12px 0;
489
+ }
490
+ #form-preview-stage .hidden-field-list ul li {
491
+ background-color: #f1f1f1;
492
+ }
493
+ .panel-form-field-group {
494
+ margin-bottom: 15px;
495
+ }
496
+ .panel-form-field-group h3 {
497
+ margin: 0;
498
+ font-size: 15px;
499
+ border-bottom: 1px solid #eee;
500
+ padding-bottom: 10px;
501
+ cursor: pointer;
502
+ }
503
+ .panel-form-field-group h3 i {
504
+ float: right;
505
+ }
506
+ .panel-form-field-group .panel-form-field-buttons {
507
+ opacity: 1;
508
+ max-height: 100vh;
509
+ overflow: hidden;
510
+ margin: 15px 0 0;
511
+ }
512
+ .panel-form-field-group .button {
513
+ display: block;
514
+ width: 48%;
515
+ margin: 0 0 10px 0;
516
+ float: left;
517
+ text-align: left;
518
+ }
519
+ .panel-form-field-group .button:nth-child(odd) {
520
+ margin-right: 2%;
521
+ }
522
+ .panel-form-field-group .button.button-faded {
523
+ opacity: .5;
524
+ }
525
+ .button.ui-draggable-dragging {
526
+ margin: 0;
527
+ text-align: left;
528
+ }
529
+ .wpuf-form-builder-field-options .option-fields-section {
530
+ margin-bottom: 15px;
531
+ }
532
+ .wpuf-form-builder-field-options .section-title {
533
+ margin: 0;
534
+ font-size: 15px;
535
+ border-bottom: 1px solid #eee;
536
+ padding-bottom: 10px;
537
+ cursor: pointer;
538
+ }
539
+ .wpuf-form-builder-field-options .section-title i {
540
+ float: right;
541
+ }
542
+ .wpuf-form-builder-field-options .option-field-section-fields {
543
+ margin-top: 15px;
544
+ max-height: 150vh;
545
+ opacity: 1;
546
+ }
547
+ .wpuf-form-builder-field-options .panel-field-opt {
548
+ margin-bottom: 15px;
549
+ }
550
+ .wpuf-form-builder-field-options .panel-field-opt .field-helper-text {
551
+ color: rgba(35, 40, 45, 0.5);
552
+ margin-left: 6px;
553
+ }
554
+ .wpuf-form-builder-field-options .panel-field-opt.panel-field-opt-text input[type="text"],
555
+ .wpuf-form-builder-field-options .panel-field-opt.panel-field-opt-text input[type="number"] {
556
+ display: block;
557
+ width: 100%;
558
+ margin: 5px 0 0;
559
+ line-height: 1.75;
560
+ }
561
+ .wpuf-form-builder-field-options .panel-field-opt.panel-field-opt-radio > label {
562
+ display: block;
563
+ margin-bottom: 5px;
564
+ }
565
+ .wpuf-form-builder-field-options .panel-field-opt.panel-field-opt-radio > ul {
566
+ margin-top: 0;
567
+ margin-bottom: 0;
568
+ }
569
+ .wpuf-form-builder-field-options .panel-field-opt.panel-field-opt-select select {
570
+ width: 100%;
571
+ height: 32px;
572
+ margin: 4px 0 0;
573
+ }
574
+ .wpuf-form-builder-field-options .panel-field-opt .chosen-select + .chosen-container {
575
+ margin-top: 10px;
576
+ }
577
+ .wpuf-form-builder-field-options .panel-field-opt .label-title-block {
578
+ display: block;
579
+ margin-bottom: 3px;
580
+ }
581
+ .option-field-option-chooser {
582
+ margin: 12px 0 0;
583
+ }
584
+ .option-field-option-chooser.margin-0 {
585
+ margin: 0;
586
+ }
587
+ .option-field-option-chooser .selector,
588
+ .option-field-option-chooser .sort-handler,
589
+ .option-field-option-chooser .label,
590
+ .option-field-option-chooser .value,
591
+ .option-field-option-chooser .action-buttons {
592
+ float: left;
593
+ }
594
+ .option-field-option-chooser .selector {
595
+ width: 25px;
596
+ }
597
+ .option-field-option-chooser .selector input {
598
+ margin-top: 14px;
599
+ }
600
+ .option-field-option-chooser .sort-handler {
601
+ width: 22px;
602
+ cursor: ns-resize;
603
+ }
604
+ .option-field-option-chooser .sort-handler i {
605
+ margin-top: 14px;
606
+ font-size: 15px;
607
+ }
608
+ .option-field-option-chooser .label {
609
+ width: 208px;
610
+ margin-right: 8px;
611
+ }
612
+ .option-field-option-chooser.show-value .label,
613
+ .option-field-option-chooser.show-value .value {
614
+ width: 100px;
615
+ margin-right: 8px;
616
+ }
617
+ .option-field-option-chooser .header .label,
618
+ .option-field-option-chooser .header .value {
619
+ color: #909090;
620
+ }
621
+ .option-field-option-chooser .action-buttons {
622
+ width: 36px;
623
+ }
624
+ .option-field-option-chooser .action-buttons i {
625
+ cursor: pointer;
626
+ font-size: 16px;
627
+ margin-top: 13px;
628
+ }
629
+ .panel-field-opt-repeater-columns .repeater-columns li > div {
630
+ float: left;
631
+ }
632
+ .panel-field-opt-repeater-columns .repeater-columns .sorter {
633
+ width: 30px;
634
+ }
635
+ .panel-field-opt-repeater-columns .repeater-columns .sorter i {
636
+ cursor: ns-resize;
637
+ font-size: 16px;
638
+ margin-top: 5px;
639
+ }
640
+ .panel-field-opt-repeater-columns .repeater-columns .input-container {
641
+ width: 195px;
642
+ margin-right: 10px;
643
+ }
644
+ .panel-field-opt-repeater-columns .repeater-columns .input-container input {
645
+ width: 100%;
646
+ }
647
+ .panel-field-opt-repeater-columns .repeater-columns .action-buttons {
648
+ width: 50px;
649
+ }
650
+ .panel-field-opt-repeater-columns .repeater-columns .action-buttons i {
651
+ cursor: pointer;
652
+ font-size: 16px;
653
+ padding: 0 3px;
654
+ margin-top: 4px;
655
+ }
656
+ .panel-field-opt-textarea textarea {
657
+ display: block;
658
+ width: 100%;
659
+ margin: 5px 0 0;
660
+ line-height: 1.75;
661
+ }
662
+ .panel-field-html-help-text pre {
663
+ max-width: 100%;
664
+ overflow-x: auto;
665
+ }
666
+ .panel-field-opt-select .opt-select-element {
667
+ display: block;
668
+ max-width: 100%;
669
+ }
670
+ ul.wpuf-form li .wpuf-text-editor .wp-editor-wrap {
671
+ border: 0;
672
+ }
673
+ .form-switcher-content {
674
+ position: absolute;
675
+ background-color: #f9f9f9;
676
+ min-width: 160px;
677
+ box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
678
+ z-index: 9999;
679
+ margin: 0;
680
+ }
681
+ .form-switcher-content li {
682
+ margin: 0;
683
+ }
684
+ .form-switcher-content a {
685
+ color: black;
686
+ padding: 12px;
687
+ text-decoration: none;
688
+ display: block;
689
+ text-align: center;
690
+ }
691
+ .form-switcher-content a:hover {
692
+ color: #fff;
693
+ background-color: #008ec2;
694
+ }
695
+ .form-switcher-content a.active {
696
+ font-weight: bold;
697
+ color: #fff;
698
+ background-color: #008ec2;
699
+ }
700
+ .insert-photo-icon {
701
+ vertical-align: text-top;
702
+ color: #82878c;
703
+ font-size: 18px;
704
+ }
705
+ .password-strength-meter {
706
+ border-style: solid;
707
+ border-width: 1px;
708
+ float: left;
709
+ margin: 0;
710
+ padding: 3px 5px;
711
+ text-align: center;
712
+ width: 200px;
713
+ display: block;
714
+ background-color: #eee;
715
+ border-color: #ddd;
716
+ }
717
+ ul.wpuf-form li .wpuf-password-field {
718
+ width: 100%;
719
+ margin-bottom: 10px;
720
+ }
721
+ ul.wpuf-form li .wpuf-password-field:after {
722
+ clear: both;
723
+ content: "";
724
+ display: table;
725
+ }
assets/css/wpuf.css ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-post-form{
2
+ list-style: none;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+ .wpuf-post-form li{
7
+ margin: 5px 0;
8
+ padding: 0;
9
+ }
10
+
11
+ .wpuf-post-form label {
12
+ float: left;
13
+ font-weight: bold;
14
+ height: 20px;
15
+ margin: 0;
16
+ min-width: 130px;
17
+ padding: 0 10px 0 0;
18
+ font-size: 12px;
19
+ cursor: pointer;
20
+ }
21
+
22
+ .wpuf-post-form input, .wpuf-post-form textarea, .wpuf-post-form select{
23
+ margin: 0;
24
+ padding: 5px;
25
+ border: 1px solid #ccc;
26
+ font-size: 12px;
27
+ -moz-border-radius: 5px;
28
+ border-radius: 5px;
29
+ }
30
+
31
+ .wpuf-post-form input:focus, .wpuf-post-form textarea:focus, .wpuf-post-form select:focus{
32
+ background: #F2F2F2;
33
+ }
34
+
35
+ .wpuf-post-form .childCategory {
36
+ padding-top: 5px;
37
+ }
38
+
39
+ .wpuf-post-form input[type=text]{
40
+ width: 50%;
41
+ }
42
+
43
+ .wpuf-post-form textarea{
44
+ width: 70%;
45
+ }
46
+
47
+ .wpuf-post-form .wpuf-check-container {
48
+ float: left;
49
+ width: 70%;
50
+ }
51
+
52
+ .wpuf-post-form input[type=submit], .wpuf-submit, .wpuf-button{
53
+ -moz-border-radius: 5px;
54
+ border-radius: 5px;
55
+ color: #333;
56
+ padding: 5px 10px;
57
+ border: 1px solid #ccc;
58
+ text-shadow: 0 1px 0 #FFFFFF;
59
+ background: #eeeeee; /* old browsers */
60
+ background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* firefox */
61
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* webkit */
62
+ cursor: pointer;
63
+ }
64
+
65
+ .wpuf-post-form input[type=submit]:active, .wpuf-submit:active, .wpuf-button:active{
66
+ background: #ddd;
67
+ }
68
+
69
+ .wpuf-post-form input[type=submit]:hover, .wpuf-submit:hover, .wpuf-button:hover{
70
+ background: #ddd; /* old browsers */
71
+ background: -moz-linear-gradient(top, #cccccc 0%, #eeeeee 100%); /* firefox */
72
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(100%,#eeeeee)); /* webkit */
73
+ }
74
+
75
+ .wpuf-post-form p.description {
76
+ color: #868686;
77
+ margin: 0;
78
+ padding: 3px 0 3px 140px;
79
+ font-size: 12px;
80
+ }
81
+
82
+ .wpuf-post-form #wp-new-post-desc-wrap tr td {
83
+ padding: 0;
84
+ }
85
+
86
+ .clear{
87
+ clear:both;
88
+ height:0;
89
+ font-size: 1px;
90
+ line-height: 0px;
91
+ }
92
+
93
+ .success {
94
+ background-color: #DFF2BF;
95
+ border: 1px solid #BCDF7D;
96
+ color: #4F8A10;
97
+ padding: 10px;
98
+ font-size: 13px;
99
+ font-weight: bold;
100
+ margin-bottom: 10px;
101
+ -moz-border-radius: 5px;
102
+ -webkit-border-radius: 5px;
103
+ border-radius: 5px;
104
+ text-shadow: 0 1px 0 #FFFFFF;
105
+ font-size: 13px;
106
+ }
107
+
108
+
109
+ .error {
110
+ margin: 0 10px 10px 10px;
111
+ padding: 3px 10px;
112
+ color: #D8000C;
113
+ background-color: #FFBABA;
114
+ border: solid 1px #dd3c10;
115
+ border-radius: 5px;
116
+ -moz-border-radius: 5px;
117
+ -webkit-border-radius: 5px;
118
+ font-weight: bold;
119
+ text-shadow: 0 1px 0 #FFFFFF;
120
+ font-size: 13px;
121
+ }
122
+
123
+ .info {
124
+ background-color: #fef5be;
125
+ border: 2px solid #fdd425;
126
+ border-radius: 5px;
127
+ -moz-border-radius: 5px;
128
+ -webkit-border-radius: 5px;
129
+ padding: 5px 10px;
130
+ margin: 0 0 10px 0;
131
+ font-size: 13px;
132
+ }
133
+
134
+ #content .wpuf-profile table, .wpuf-profile table{
135
+ border: none;
136
+ }
137
+
138
+ #content .wpuf-profile legend, .wpuf-profile legend{
139
+ border: 1px solid #eee;
140
+ padding: 5px 10px;
141
+ }
142
+
143
+ #content .wpuf-profile th, #content .wpuf-profile td, .wpuf-profile th, .wpuf-profile td{
144
+ vertical-align: top;
145
+ border-top: 1px solid #eee;
146
+ border: none;
147
+ }
148
+
149
+ #content .wpuf-profile input, .wpuf-profile input, .wpuf-profile textarea{
150
+ border: 1px solid #CCCCCC;
151
+ margin: 0;
152
+ padding: 5px;
153
+ }
154
+
155
+ .wpuf-profile h3, #content .wpuf-profile h3{
156
+ margin: 0;
157
+ }
158
+
159
+ .wpuf-profile table, #content .wpuf-profile table{
160
+ margin: 0 0 5px 0;
161
+ }
162
+
163
+ #content #editorcontainer tr td, #content #editorcontainer table {
164
+ padding: 0;
165
+ margin: 0;
166
+ }
167
+
168
+ #wpuf-post-area li{
169
+ list-style: none;
170
+ }
171
+
172
+ span.required {
173
+ color: red;
174
+ }
175
+
176
+ table.wpuf-table {
177
+ border: 1px solid #E7E7E7;
178
+ margin: 0 opx 10px 0;
179
+ text-align: left;
180
+ width: 100%;
181
+ }
182
+
183
+ table.wpuf-table thead th, table.wpuf-table th {
184
+ color: #888888;
185
+ font-size: 12px;
186
+ font-weight: bold;
187
+ line-height: 18px;
188
+ padding: 9px 24px;
189
+ }
190
+
191
+ table.wpuf-table td {
192
+ border-top: 1px solid #E7E7E7;
193
+ padding: 6px 24px;
194
+ }
195
+
196
+ .post_count {
197
+ border: 1px solid #E7E7E7;
198
+ margin: 5px 0;
199
+ padding: 5px;
200
+ }
201
+
202
+ .post_count span {
203
+ font-weight: bold;
204
+ }
205
+
206
+ .wpuf-pagination {
207
+ display: block;
208
+ width: 100%;
209
+ margin: 10px 0;
210
+ }
211
+
212
+ /** author info **/
213
+ .wpuf-author {
214
+ clear: both;
215
+ margin: 10px 0;
216
+ }
217
+ .wpuf-author h3{
218
+ margin: 0 !important;
219
+ background: #CFCFCF;
220
+ text-align: left;
221
+ padding: 3px 10px;
222
+ }
223
+ .wpuf-author-inside {
224
+ background: none repeat scroll 0 0 #F0F0F0;
225
+ border-bottom: 2px solid #DDDDDD;
226
+ height: 90px;
227
+ padding-left: 10px;
228
+ padding-top: 15px;
229
+ margin-bottom: 15px;
230
+ }
231
+
232
+ .wpuf-author-inside .wpuf-user-image {
233
+ float: left;
234
+ padding-right: 15px;
235
+ }
236
+ .wpuf-author-body p {
237
+ margin-bottom: 10px !important;
238
+ }
239
+
240
+ .wpuf-author-body p.wpuf-user-name a {
241
+ color: #335160;
242
+ font-size: 1.2em;
243
+ font-weight: bold;
244
+ }
245
+
246
+ .wpuf-author-inside p.wpuf-author-info {
247
+ padding-top: 8px;
248
+ }
249
+
250
+ .invalid {
251
+ border: 1px solid #FF7272 !important;
252
+ }
253
+
254
+
255
+ #pass-strength-result {
256
+ border-radius: 6px 6px 6px 6px;
257
+ border-style: solid;
258
+ border-width: 1px;
259
+ float: left;
260
+ margin: 12px 5px 5px 1px;
261
+ padding: 7px;
262
+ text-align: center;
263
+ width: 248px;
264
+ }
265
+ #pass-strength-result.good {
266
+ background-color: #FFEC8B;
267
+ border-color: #FFCC00 !important;
268
+ }
269
+ #pass-strength-result {
270
+ background-color: #EEEEEE;
271
+ border-color: #DDDDDD !important;
272
+ }
273
+ #pass-strength-result.bad {
274
+ background-color: #FFB78C;
275
+ border-color: #FF853C !important;
276
+ }
277
+ #pass-strength-result.strong {
278
+ background-color: #C3FF88;
279
+ border-color: #8DFF1C !important;
280
+ }
281
+ #pass-strength-result.short {
282
+ background-color: #FFA0A0;
283
+ border-color: #F04040 !important;
284
+ }
285
+
286
+ .timestamp-wrap input {
287
+ width: 40px !important;
288
+ }
289
+
290
+ .wpuf_sub_info {
291
+ padding: 0;
292
+ margin: 10px 5px;
293
+ border: 1px solid green;
294
+ border-radius: 5px;
295
+ }
296
+
297
+ .wpuf_sub_info h3{
298
+ margin: 0 0 5px 0 !important;
299
+ background: green;
300
+ color: #fff !important;
301
+ padding: 3px 10px !important;
302
+ font-weight: bold;
303
+ }
304
+
305
+ .wpuf_sub_info .text{
306
+ padding: 5px 10px;
307
+ }
308
+
309
+
310
+ ul.wpuf_packs {
311
+ overflow: hidden;
312
+ margin: 35px 0 15px;
313
+ }
314
+
315
+ ul.wpuf_packs li {
316
+ background: #EEEEEE;
317
+ border: 1px solid #DDDDDD;
318
+ border-radius: 5px 5px 5px 5px;
319
+ float: left;
320
+ list-style: none outside none;
321
+ margin: 25px 25px 10px 0;
322
+ padding: 5px;
323
+ position: relative;
324
+ width: 200px;
325
+ }
326
+
327
+ ul.wpuf_packs h3 {
328
+ padding: 10px !important;
329
+ font-size: 14px;
330
+ font-weight: bold;
331
+ }
332
+
333
+ ul.wpuf_packs p {
334
+ padding: 0 10px;
335
+ margin-bottom: 8px;
336
+ }
337
+
338
+ .wpuf_packs .cost {
339
+ background: red;
340
+ border-radius: 30px 30px 30px 30px;
341
+ color: #FFFFFF;
342
+ margin: -16px -12px 0 0;
343
+ padding: 10px 8px 8px;
344
+ position: absolute;
345
+ right: 0;
346
+ top: 0;
347
+ }
348
+
349
+ .wpuf-loading {
350
+ height: 16px;
351
+ width: 16px;
352
+ background: url('../images/wpspin_light.gif') no-repeat;
353
+ padding: 0;
354
+ margin: 5px 10px;
355
+ right: -40px;
356
+ top: 0;
357
+ float: left;
358
+ }
359
+
360
+ .wpuf-pagination div.pagination{
361
+ text-align:center;
362
+ padding:7px;
363
+ margin:3px;
364
+ }
365
+
366
+ .wpuf-pagination .page-numbers{
367
+ padding:2px 8px;
368
+ margin:2px;
369
+ border:1px solid #4A5154;
370
+ text-decoration:none;
371
+ color:#4A5154;
372
+ background: #fff;
373
+ border-radius: 5px;
374
+ -moz-border-radius: 5px;
375
+ }
376
+
377
+ .wpuf-pagination .page-numbers:hover,
378
+ .wpuf-pagination .page-numbers:active{
379
+ border:1px solid #4A5154;
380
+ background-color:#4A5154;
381
+ color:#fff;
382
+ border-radius: 5px;
383
+ -moz-border-radius: 5px;
384
+ }
385
+
386
+ .wpuf-pagination .page-numbers.current{
387
+ padding:2px 8px;
388
+ margin:2px;
389
+ border:1px solid #4A5154;
390
+ font-weight:bold;
391
+ background-color:#4A5154;
392
+ color:#FFF;
393
+ border-radius: 5px;
394
+ -moz-border-radius: 5px;
395
+ }
396
+
397
+ #wpuf-ft-upload-filelist img {
398
+ border: 1px solid #ddd;
399
+ padding: 5px;
400
+ border-radius: 5px;
401
+ margin: 0 10px 10px 0;
402
+ float: left;
403
+ }
404
+
405
+ #wpuf-ft-upload-filelist .button {
406
+ border: 1px solid #ddd;
407
+ padding: 5px;
408
+ border-radius: 5px;
409
+ font-size: 12px;
410
+ color: #5F5F5F;
411
+ }
412
+
413
+ ul.wpuf-category-checklist {
414
+ margin: 0;
415
+ list-style: none;
416
+ }
417
+ .wpuf-post-form .category-wrap {
418
+ position: relative;
419
+ }
420
+
421
+ .wpuf-post-form .category-wrap select {
422
+ display: block;
423
+ margin: 0 0 5px 0;
424
+ }
425
+
426
+ #wpuf-attachment-upload-filelist .wpuf-attachment {
427
+ display: block;
428
+ margin: 0 0 10px 0;
429
+ padding: 0 0 10px 0;
430
+ border-bottom: 1px solid #eee;
431
+ }
432
+
433
+ #wpuf-attachment-upload-filelist .wpuf-attachment .attachment-name {
434
+ font-size: 12px;
435
+ margin: 0 0 0 15px;
436
+ }
437
+
438
+ #wpuf-attachment-upload-filelist .wpuf-attachment .button {
439
+ padding: 3px 8px;
440
+ border: 1px solid #ccc;
441
+ background: #f2f2f2;
442
+ color: #333;
443
+ font-size: 12px;
444
+ margin: 0 0 0 15px;
445
+ border-radius: 5px;
446
+ }
447
+
448
+ #wpuf-attachment-upload-pickfiles {
449
+ font-weight: bold;
450
+ color: #333;
451
+ padding: 3px 8px;
452
+ border: 1px solid #ccc;
453
+ background: #f2f2f2;
454
+ margin: 5px 0 15px 0;
455
+ border-radius: 5px;
456
+ }
457
+
458
+ #wpuf-attachment-upload-filelist .handle {
459
+ background: url('../images/arrow-move.png') no-repeat;
460
+ cursor: move;
461
+ display: inline-block;
462
+ height: 16px;
463
+ margin: 0 10px 0 0;
464
+ padding: 0;
465
+ text-indent: -9999px;
466
+ width: 16px;
467
+ }
assets/images/add.png ADDED
Binary file
assets/images/arrow-move.png ADDED
Binary file
assets/images/arrows.png ADDED
Binary file
assets/images/completed.png ADDED
Binary file
assets/images/cross.png ADDED
Binary file
assets/images/del.png ADDED
Binary file
assets/images/delete.png ADDED
Binary file
assets/images/edit.png ADDED
Binary file
assets/images/help.png ADDED
Binary file
assets/images/icon-minus.png ADDED
Binary file
assets/images/icon-plus.png ADDED
Binary file
assets/images/no-image.png ADDED
Binary file
assets/images/paypal.png ADDED
Binary file
assets/images/processing.png ADDED
Binary file
assets/images/remove.png ADDED
Binary file
assets/images/tick.png ADDED
Binary file
assets/images/ufp.png ADDED
Binary file
assets/images/wpspin_light.gif ADDED
Binary file
assets/js/admin-shortcode.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jshint devel:true */
2
+ /*global send_to_editor */
3
+ /*global tb_remove */
4
+
5
+ jQuery(function($) {
6
+
7
+ $('#wpuf-form-insert').on('click', function(e) {
8
+ e.preventDefault();
9
+
10
+ var shortcode = '',
11
+ type = $('#wpuf-form-type').val();
12
+
13
+ if ( type === 'post' ) {
14
+ var post = $('#wpuf-form-post').val();
15
+ shortcode += '[wpuf_form id="' + post + '"]';
16
+ } else {
17
+ var registration = $('#wpuf-form-registration').val();
18
+ shortcode += '[wpuf_profile type="registration" id="' + registration + '"] [wpuf_profile type="profile" id="' + registration + '"]';
19
+ }
20
+
21
+ send_to_editor(shortcode);
22
+ tb_remove();
23
+ });
24
+
25
+ $('#wpuf-form-type').on('change', function() {
26
+ var val = $(this).val();
27
+
28
+ if ( val === 'post' ) {
29
+ $('.show-if-post').show();
30
+ $('.show-if-registration').hide();
31
+ } else {
32
+ $('.show-if-post').hide();
33
+ $('.show-if-registration').show();
34
+ }
35
+ });
36
+
37
+ $('#wpuf-form-type').trigger('change');
38
+ });
assets/js/chosen.jquery.js ADDED
@@ -0,0 +1,1211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.1.0
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ (function() {
14
+ var $, AbstractChosen, Chosen, SelectParser, _ref,
15
+ __hasProp = {}.hasOwnProperty,
16
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
17
+
18
+ SelectParser = (function() {
19
+ function SelectParser() {
20
+ this.options_index = 0;
21
+ this.parsed = [];
22
+ }
23
+
24
+ SelectParser.prototype.add_node = function(child) {
25
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
26
+ return this.add_group(child);
27
+ } else {
28
+ return this.add_option(child);
29
+ }
30
+ };
31
+
32
+ SelectParser.prototype.add_group = function(group) {
33
+ var group_position, option, _i, _len, _ref, _results;
34
+ group_position = this.parsed.length;
35
+ this.parsed.push({
36
+ array_index: group_position,
37
+ group: true,
38
+ label: this.escapeExpression(group.label),
39
+ children: 0,
40
+ disabled: group.disabled
41
+ });
42
+ _ref = group.childNodes;
43
+ _results = [];
44
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
45
+ option = _ref[_i];
46
+ _results.push(this.add_option(option, group_position, group.disabled));
47
+ }
48
+ return _results;
49
+ };
50
+
51
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
52
+ if (option.nodeName.toUpperCase() === "OPTION") {
53
+ if (option.text !== "") {
54
+ if (group_position != null) {
55
+ this.parsed[group_position].children += 1;
56
+ }
57
+ this.parsed.push({
58
+ array_index: this.parsed.length,
59
+ options_index: this.options_index,
60
+ value: option.value,
61
+ text: option.text,
62
+ html: option.innerHTML,
63
+ selected: option.selected,
64
+ disabled: group_disabled === true ? group_disabled : option.disabled,
65
+ group_array_index: group_position,
66
+ classes: option.className,
67
+ style: option.style.cssText
68
+ });
69
+ } else {
70
+ this.parsed.push({
71
+ array_index: this.parsed.length,
72
+ options_index: this.options_index,
73
+ empty: true
74
+ });
75
+ }
76
+ return this.options_index += 1;
77
+ }
78
+ };
79
+
80
+ SelectParser.prototype.escapeExpression = function(text) {
81
+ var map, unsafe_chars;
82
+ if ((text == null) || text === false) {
83
+ return "";
84
+ }
85
+ if (!/[\&\<\>\"\'\`]/.test(text)) {
86
+ return text;
87
+ }
88
+ map = {
89
+ "<": "&lt;",
90
+ ">": "&gt;",
91
+ '"': "&quot;",
92
+ "'": "&#x27;",
93
+ "`": "&#x60;"
94
+ };
95
+ unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
96
+ return text.replace(unsafe_chars, function(chr) {
97
+ return map[chr] || "&amp;";
98
+ });
99
+ };
100
+
101
+ return SelectParser;
102
+
103
+ })();
104
+
105
+ SelectParser.select_to_array = function(select) {
106
+ var child, parser, _i, _len, _ref;
107
+ parser = new SelectParser();
108
+ _ref = select.childNodes;
109
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
110
+ child = _ref[_i];
111
+ parser.add_node(child);
112
+ }
113
+ return parser.parsed;
114
+ };
115
+
116
+ AbstractChosen = (function() {
117
+ function AbstractChosen(form_field, options) {
118
+ this.form_field = form_field;
119
+ this.options = options != null ? options : {};
120
+ if (!AbstractChosen.browser_is_supported()) {
121
+ return;
122
+ }
123
+ this.is_multiple = this.form_field.multiple;
124
+ this.set_default_text();
125
+ this.set_default_values();
126
+ this.setup();
127
+ this.set_up_html();
128
+ this.register_observers();
129
+ }
130
+
131
+ AbstractChosen.prototype.set_default_values = function() {
132
+ var _this = this;
133
+ this.click_test_action = function(evt) {
134
+ return _this.test_active_click(evt);
135
+ };
136
+ this.activate_action = function(evt) {
137
+ return _this.activate_field(evt);
138
+ };
139
+ this.active_field = false;
140
+ this.mouse_on_container = false;
141
+ this.results_showing = false;
142
+ this.result_highlighted = null;
143
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
144
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
145
+ this.disable_search = this.options.disable_search || false;
146
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
147
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
148
+ this.search_contains = this.options.search_contains || false;
149
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
150
+ this.max_selected_options = this.options.max_selected_options || Infinity;
151
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
152
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
153
+ return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
154
+ };
155
+
156
+ AbstractChosen.prototype.set_default_text = function() {
157
+ if (this.form_field.getAttribute("data-placeholder")) {
158
+ this.default_text = this.form_field.getAttribute("data-placeholder");
159
+ } else if (this.is_multiple) {
160
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
161
+ } else {
162
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
163
+ }
164
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
165
+ };
166
+
167
+ AbstractChosen.prototype.mouse_enter = function() {
168
+ return this.mouse_on_container = true;
169
+ };
170
+
171
+ AbstractChosen.prototype.mouse_leave = function() {
172
+ return this.mouse_on_container = false;
173
+ };
174
+
175
+ AbstractChosen.prototype.input_focus = function(evt) {
176
+ var _this = this;
177
+ if (this.is_multiple) {
178
+ if (!this.active_field) {
179
+ return setTimeout((function() {
180
+ return _this.container_mousedown();
181
+ }), 50);
182
+ }
183
+ } else {
184
+ if (!this.active_field) {
185
+ return this.activate_field();
186
+ }
187
+ }
188
+ };
189
+
190
+ AbstractChosen.prototype.input_blur = function(evt) {
191
+ var _this = this;
192
+ if (!this.mouse_on_container) {
193
+ this.active_field = false;
194
+ return setTimeout((function() {
195
+ return _this.blur_test();
196
+ }), 100);
197
+ }
198
+ };
199
+
200
+ AbstractChosen.prototype.results_option_build = function(options) {
201
+ var content, data, _i, _len, _ref;
202
+ content = '';
203
+ _ref = this.results_data;
204
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
205
+ data = _ref[_i];
206
+ if (data.group) {
207
+ content += this.result_add_group(data);
208
+ } else {
209
+ content += this.result_add_option(data);
210
+ }
211
+ if (options != null ? options.first : void 0) {
212
+ if (data.selected && this.is_multiple) {
213
+ this.choice_build(data);
214
+ } else if (data.selected && !this.is_multiple) {
215
+ this.single_set_selected_text(data.text);
216
+ }
217
+ }
218
+ }
219
+ return content;
220
+ };
221
+
222
+ AbstractChosen.prototype.result_add_option = function(option) {
223
+ var classes, option_el;
224
+ if (!option.search_match) {
225
+ return '';
226
+ }
227
+ if (!this.include_option_in_results(option)) {
228
+ return '';
229
+ }
230
+ classes = [];
231
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
232
+ classes.push("active-result");
233
+ }
234
+ if (option.disabled && !(option.selected && this.is_multiple)) {
235
+ classes.push("disabled-result");
236
+ }
237
+ if (option.selected) {
238
+ classes.push("result-selected");
239
+ }
240
+ if (option.group_array_index != null) {
241
+ classes.push("group-option");
242
+ }
243
+ if (option.classes !== "") {
244
+ classes.push(option.classes);
245
+ }
246
+ option_el = document.createElement("li");
247
+ option_el.className = classes.join(" ");
248
+ option_el.style.cssText = option.style;
249
+ option_el.setAttribute("data-option-array-index", option.array_index);
250
+ option_el.innerHTML = option.search_text;
251
+ return this.outerHTML(option_el);
252
+ };
253
+
254
+ AbstractChosen.prototype.result_add_group = function(group) {
255
+ var group_el;
256
+ if (!(group.search_match || group.group_match)) {
257
+ return '';
258
+ }
259
+ if (!(group.active_options > 0)) {
260
+ return '';
261
+ }
262
+ group_el = document.createElement("li");
263
+ group_el.className = "group-result";
264
+ group_el.innerHTML = group.search_text;
265
+ return this.outerHTML(group_el);
266
+ };
267
+
268
+ AbstractChosen.prototype.results_update_field = function() {
269
+ this.set_default_text();
270
+ if (!this.is_multiple) {
271
+ this.results_reset_cleanup();
272
+ }
273
+ this.result_clear_highlight();
274
+ this.results_build();
275
+ if (this.results_showing) {
276
+ return this.winnow_results();
277
+ }
278
+ };
279
+
280
+ AbstractChosen.prototype.reset_single_select_options = function() {
281
+ var result, _i, _len, _ref, _results;
282
+ _ref = this.results_data;
283
+ _results = [];
284
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
285
+ result = _ref[_i];
286
+ if (result.selected) {
287
+ _results.push(result.selected = false);
288
+ } else {
289
+ _results.push(void 0);
290
+ }
291
+ }
292
+ return _results;
293
+ };
294
+
295
+ AbstractChosen.prototype.results_toggle = function() {
296
+ if (this.results_showing) {
297
+ return this.results_hide();
298
+ } else {
299
+ return this.results_show();
300
+ }
301
+ };
302
+
303
+ AbstractChosen.prototype.results_search = function(evt) {
304
+ if (this.results_showing) {
305
+ return this.winnow_results();
306
+ } else {
307
+ return this.results_show();
308
+ }
309
+ };
310
+
311
+ AbstractChosen.prototype.winnow_results = function() {
312
+ var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
313
+ this.no_results_clear();
314
+ results = 0;
315
+ searchText = this.get_search_text();
316
+ escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
317
+ regexAnchor = this.search_contains ? "" : "^";
318
+ regex = new RegExp(regexAnchor + escapedSearchText, 'i');
319
+ zregex = new RegExp(escapedSearchText, 'i');
320
+ _ref = this.results_data;
321
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
322
+ option = _ref[_i];
323
+ option.search_match = false;
324
+ results_group = null;
325
+ if (this.include_option_in_results(option)) {
326
+ if (option.group) {
327
+ option.group_match = false;
328
+ option.active_options = 0;
329
+ }
330
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
331
+ results_group = this.results_data[option.group_array_index];
332
+ if (results_group.active_options === 0 && results_group.search_match) {
333
+ results += 1;
334
+ }
335
+ results_group.active_options += 1;
336
+ }
337
+ if (!(option.group && !this.group_search)) {
338
+ option.search_text = option.group ? option.label : option.html;
339
+ option.search_match = this.search_string_match(option.search_text, regex);
340
+ if (option.search_match && !option.group) {
341
+ results += 1;
342
+ }
343
+ if (option.search_match) {
344
+ if (searchText.length) {
345
+ startpos = option.search_text.search(zregex);
346
+ text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
347
+ option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
348
+ }
349
+ if (results_group != null) {
350
+ results_group.group_match = true;
351
+ }
352
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
353
+ option.search_match = true;
354
+ }
355
+ }
356
+ }
357
+ }
358
+ this.result_clear_highlight();
359
+ if (results < 1 && searchText.length) {
360
+ this.update_results_content("");
361
+ return this.no_results(searchText);
362
+ } else {
363
+ this.update_results_content(this.results_option_build());
364
+ return this.winnow_results_set_highlight();
365
+ }
366
+ };
367
+
368
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
369
+ var part, parts, _i, _len;
370
+ if (regex.test(search_string)) {
371
+ return true;
372
+ } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
373
+ parts = search_string.replace(/\[|\]/g, "").split(" ");
374
+ if (parts.length) {
375
+ for (_i = 0, _len = parts.length; _i < _len; _i++) {
376
+ part = parts[_i];
377
+ if (regex.test(part)) {
378
+ return true;
379
+ }
380
+ }
381
+ }
382
+ }
383
+ };
384
+
385
+ AbstractChosen.prototype.choices_count = function() {
386
+ var option, _i, _len, _ref;
387
+ if (this.selected_option_count != null) {
388
+ return this.selected_option_count;
389
+ }
390
+ this.selected_option_count = 0;
391
+ _ref = this.form_field.options;
392
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
393
+ option = _ref[_i];
394
+ if (option.selected) {
395
+ this.selected_option_count += 1;
396
+ }
397
+ }
398
+ return this.selected_option_count;
399
+ };
400
+
401
+ AbstractChosen.prototype.choices_click = function(evt) {
402
+ evt.preventDefault();
403
+ if (!(this.results_showing || this.is_disabled)) {
404
+ return this.results_show();
405
+ }
406
+ };
407
+
408
+ AbstractChosen.prototype.keyup_checker = function(evt) {
409
+ var stroke, _ref;
410
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
411
+ this.search_field_scale();
412
+ switch (stroke) {
413
+ case 8:
414
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
415
+ return this.keydown_backstroke();
416
+ } else if (!this.pending_backstroke) {
417
+ this.result_clear_highlight();
418
+ return this.results_search();
419
+ }
420
+ break;
421
+ case 13:
422
+ evt.preventDefault();
423
+ if (this.results_showing) {
424
+ return this.result_select(evt);
425
+ }
426
+ break;
427
+ case 27:
428
+ if (this.results_showing) {
429
+ this.results_hide();
430
+ }
431
+ return true;
432
+ case 9:
433
+ case 38:
434
+ case 40:
435
+ case 16:
436
+ case 91:
437
+ case 17:
438
+ break;
439
+ default:
440
+ return this.results_search();
441
+ }
442
+ };
443
+
444
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
445
+ var _this = this;
446
+ return setTimeout((function() {
447
+ return _this.results_search();
448
+ }), 50);
449
+ };
450
+
451
+ AbstractChosen.prototype.container_width = function() {
452
+ if (this.options.width != null) {
453
+ return this.options.width;
454
+ } else {
455
+ return "" + this.form_field.offsetWidth + "px";
456
+ }
457
+ };
458
+
459
+ AbstractChosen.prototype.include_option_in_results = function(option) {
460
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
461
+ return false;
462
+ }
463
+ if (!this.display_disabled_options && option.disabled) {
464
+ return false;
465
+ }
466
+ if (option.empty) {
467
+ return false;
468
+ }
469
+ return true;
470
+ };
471
+
472
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
473
+ this.touch_started = true;
474
+ return this.search_results_mouseover(evt);
475
+ };
476
+
477
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
478
+ this.touch_started = false;
479
+ return this.search_results_mouseout(evt);
480
+ };
481
+
482
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
483
+ if (this.touch_started) {
484
+ return this.search_results_mouseup(evt);
485
+ }
486
+ };
487
+
488
+ AbstractChosen.prototype.outerHTML = function(element) {
489
+ var tmp;
490
+ if (element.outerHTML) {
491
+ return element.outerHTML;
492
+ }
493
+ tmp = document.createElement("div");
494
+ tmp.appendChild(element);
495
+ return tmp.innerHTML;
496
+ };
497
+
498
+ AbstractChosen.browser_is_supported = function() {
499
+ if (window.navigator.appName === "Microsoft Internet Explorer") {
500
+ return document.documentMode >= 8;
501
+ }
502
+ if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
503
+ return false;
504
+ }
505
+ if (/Android/i.test(window.navigator.userAgent)) {
506
+ if (/Mobile/i.test(window.navigator.userAgent)) {
507
+ return false;
508
+ }
509
+ }
510
+ return true;
511
+ };
512
+
513
+ AbstractChosen.default_multiple_text = "Select Some Options";
514
+
515
+ AbstractChosen.default_single_text = "Select an Option";
516
+
517
+ AbstractChosen.default_no_result_text = "No results match";
518
+
519
+ return AbstractChosen;
520
+
521
+ })();
522
+
523
+ $ = jQuery;
524
+
525
+ $.fn.extend({
526
+ chosen: function(options) {
527
+ if (!AbstractChosen.browser_is_supported()) {
528
+ return this;
529
+ }
530
+ return this.each(function(input_field) {
531
+ var $this, chosen;
532
+ $this = $(this);
533
+ chosen = $this.data('chosen');
534
+ if (options === 'destroy' && chosen) {
535
+ chosen.destroy();
536
+ } else if (!chosen) {
537
+ $this.data('chosen', new Chosen(this, options));
538
+ }
539
+ });
540
+ }
541
+ });
542
+
543
+ Chosen = (function(_super) {
544
+ __extends(Chosen, _super);
545
+
546
+ function Chosen() {
547
+ _ref = Chosen.__super__.constructor.apply(this, arguments);
548
+ return _ref;
549
+ }
550
+
551
+ Chosen.prototype.setup = function() {
552
+ this.form_field_jq = $(this.form_field);
553
+ this.current_selectedIndex = this.form_field.selectedIndex;
554
+ return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
555
+ };
556
+
557
+ Chosen.prototype.set_up_html = function() {
558
+ var container_classes, container_props;
559
+ container_classes = ["chosen-container"];
560
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
561
+ if (this.inherit_select_classes && this.form_field.className) {
562
+ container_classes.push(this.form_field.className);
563
+ }
564
+ if (this.is_rtl) {
565
+ container_classes.push("chosen-rtl");
566
+ }
567
+ container_props = {
568
+ 'class': container_classes.join(' '),
569
+ 'style': "width: " + (this.container_width()) + ";",
570
+ 'title': this.form_field.title
571
+ };
572
+ if (this.form_field.id.length) {
573
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
574
+ }
575
+ this.container = $("<div />", container_props);
576
+ if (this.is_multiple) {
577
+ this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
578
+ } else {
579
+ this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
580
+ }
581
+ this.form_field_jq.hide().after(this.container);
582
+ this.dropdown = this.container.find('div.chosen-drop').first();
583
+ this.search_field = this.container.find('input').first();
584
+ this.search_results = this.container.find('ul.chosen-results').first();
585
+ this.search_field_scale();
586
+ this.search_no_results = this.container.find('li.no-results').first();
587
+ if (this.is_multiple) {
588
+ this.search_choices = this.container.find('ul.chosen-choices').first();
589
+ this.search_container = this.container.find('li.search-field').first();
590
+ } else {
591
+ this.search_container = this.container.find('div.chosen-search').first();
592
+ this.selected_item = this.container.find('.chosen-single').first();
593
+ }
594
+ this.results_build();
595
+ this.set_tab_index();
596
+ this.set_label_behavior();
597
+ return this.form_field_jq.trigger("chosen:ready", {
598
+ chosen: this
599
+ });
600
+ };
601
+
602
+ Chosen.prototype.register_observers = function() {
603
+ var _this = this;
604
+ this.container.bind('mousedown.chosen', function(evt) {
605
+ _this.container_mousedown(evt);
606
+ });
607
+ this.container.bind('mouseup.chosen', function(evt) {
608
+ _this.container_mouseup(evt);
609
+ });
610
+ this.container.bind('mouseenter.chosen', function(evt) {
611
+ _this.mouse_enter(evt);
612
+ });
613
+ this.container.bind('mouseleave.chosen', function(evt) {
614
+ _this.mouse_leave(evt);
615
+ });
616
+ this.search_results.bind('mouseup.chosen', function(evt) {
617
+ _this.search_results_mouseup(evt);
618
+ });
619
+ this.search_results.bind('mouseover.chosen', function(evt) {
620
+ _this.search_results_mouseover(evt);
621
+ });
622
+ this.search_results.bind('mouseout.chosen', function(evt) {
623
+ _this.search_results_mouseout(evt);
624
+ });
625
+ this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
626
+ _this.search_results_mousewheel(evt);
627
+ });
628
+ this.search_results.bind('touchstart.chosen', function(evt) {
629
+ _this.search_results_touchstart(evt);
630
+ });
631
+ this.search_results.bind('touchmove.chosen', function(evt) {
632
+ _this.search_results_touchmove(evt);
633
+ });
634
+ this.search_results.bind('touchend.chosen', function(evt) {
635
+ _this.search_results_touchend(evt);
636
+ });
637
+ this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
638
+ _this.results_update_field(evt);
639
+ });
640
+ this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
641
+ _this.activate_field(evt);
642
+ });
643
+ this.form_field_jq.bind("chosen:open.chosen", function(evt) {
644
+ _this.container_mousedown(evt);
645
+ });
646
+ this.form_field_jq.bind("chosen:close.chosen", function(evt) {
647
+ _this.input_blur(evt);
648
+ });
649
+ this.search_field.bind('blur.chosen', function(evt) {
650
+ _this.input_blur(evt);
651
+ });
652
+ this.search_field.bind('keyup.chosen', function(evt) {
653
+ _this.keyup_checker(evt);
654
+ });
655
+ this.search_field.bind('keydown.chosen', function(evt) {
656
+ _this.keydown_checker(evt);
657
+ });
658
+ this.search_field.bind('focus.chosen', function(evt) {
659
+ _this.input_focus(evt);
660
+ });
661
+ this.search_field.bind('cut.chosen', function(evt) {
662
+ _this.clipboard_event_checker(evt);
663
+ });
664
+ this.search_field.bind('paste.chosen', function(evt) {
665
+ _this.clipboard_event_checker(evt);
666
+ });
667
+ if (this.is_multiple) {
668
+ return this.search_choices.bind('click.chosen', function(evt) {
669
+ _this.choices_click(evt);
670
+ });
671
+ } else {
672
+ return this.container.bind('click.chosen', function(evt) {
673
+ evt.preventDefault();
674
+ });
675
+ }
676
+ };
677
+
678
+ Chosen.prototype.destroy = function() {
679
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
680
+ if (this.search_field[0].tabIndex) {
681
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
682
+ }
683
+ this.container.remove();
684
+ this.form_field_jq.removeData('chosen');
685
+ return this.form_field_jq.show();
686
+ };
687
+
688
+ Chosen.prototype.search_field_disabled = function() {
689
+ this.is_disabled = this.form_field_jq[0].disabled;
690
+ if (this.is_disabled) {
691
+ this.container.addClass('chosen-disabled');
692
+ this.search_field[0].disabled = true;
693
+ if (!this.is_multiple) {
694
+ this.selected_item.unbind("focus.chosen", this.activate_action);
695
+ }
696
+ return this.close_field();
697
+ } else {
698
+ this.container.removeClass('chosen-disabled');
699
+ this.search_field[0].disabled = false;
700
+ if (!this.is_multiple) {
701
+ return this.selected_item.bind("focus.chosen", this.activate_action);
702
+ }
703
+ }
704
+ };
705
+
706
+ Chosen.prototype.container_mousedown = function(evt) {
707
+ if (!this.is_disabled) {
708
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
709
+ evt.preventDefault();
710
+ }
711
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
712
+ if (!this.active_field) {
713
+ if (this.is_multiple) {
714
+ this.search_field.val("");
715
+ }
716
+ $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
717
+ this.results_show();
718
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
719
+ evt.preventDefault();
720
+ this.results_toggle();
721
+ }
722
+ return this.activate_field();
723
+ }
724
+ }
725
+ };
726
+
727
+ Chosen.prototype.container_mouseup = function(evt) {
728
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
729
+ return this.results_reset(evt);
730
+ }
731
+ };
732
+
733
+ Chosen.prototype.search_results_mousewheel = function(evt) {
734
+ var delta;
735
+ if (evt.originalEvent) {
736
+ delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
737
+ }
738
+ if (delta != null) {
739
+ evt.preventDefault();
740
+ if (evt.type === 'DOMMouseScroll') {
741
+ delta = delta * 40;
742
+ }
743
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
744
+ }
745
+ };
746
+
747
+ Chosen.prototype.blur_test = function(evt) {
748
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
749
+ return this.close_field();
750
+ }
751
+ };
752
+
753
+ Chosen.prototype.close_field = function() {
754
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
755
+ this.active_field = false;
756
+ this.results_hide();
757
+ this.container.removeClass("chosen-container-active");
758
+ this.clear_backstroke();
759
+ this.show_search_field_default();
760
+ return this.search_field_scale();
761
+ };
762
+
763
+ Chosen.prototype.activate_field = function() {
764
+ this.container.addClass("chosen-container-active");
765
+ this.active_field = true;
766
+ this.search_field.val(this.search_field.val());
767
+ return this.search_field.focus();
768
+ };
769
+
770
+ Chosen.prototype.test_active_click = function(evt) {
771
+ var active_container;
772
+ active_container = $(evt.target).closest('.chosen-container');
773
+ if (active_container.length && this.container[0] === active_container[0]) {
774
+ return this.active_field = true;
775
+ } else {
776
+ return this.close_field();
777
+ }
778
+ };
779
+
780
+ Chosen.prototype.results_build = function() {
781
+ this.parsing = true;
782
+ this.selected_option_count = null;
783
+ this.results_data = SelectParser.select_to_array(this.form_field);
784
+ if (this.is_multiple) {
785
+ this.search_choices.find("li.search-choice").remove();
786
+ } else if (!this.is_multiple) {
787
+ this.single_set_selected_text();
788
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
789
+ this.search_field[0].readOnly = true;
790
+ this.container.addClass("chosen-container-single-nosearch");
791
+ } else {
792
+ this.search_field[0].readOnly = false;
793
+ this.container.removeClass("chosen-container-single-nosearch");
794
+ }
795
+ }
796
+ this.update_results_content(this.results_option_build({
797
+ first: true
798
+ }));
799
+ this.search_field_disabled();
800
+ this.show_search_field_default();
801
+ this.search_field_scale();
802
+ return this.parsing = false;
803
+ };
804
+
805
+ Chosen.prototype.result_do_highlight = function(el) {
806
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
807
+ if (el.length) {
808
+ this.result_clear_highlight();
809
+ this.result_highlight = el;
810
+ this.result_highlight.addClass("highlighted");
811
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
812
+ visible_top = this.search_results.scrollTop();
813
+ visible_bottom = maxHeight + visible_top;
814
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
815
+ high_bottom = high_top + this.result_highlight.outerHeight();
816
+ if (high_bottom >= visible_bottom) {
817
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
818
+ } else if (high_top < visible_top) {
819
+ return this.search_results.scrollTop(high_top);
820
+ }
821
+ }
822
+ };
823
+
824
+ Chosen.prototype.result_clear_highlight = function() {
825
+ if (this.result_highlight) {
826
+ this.result_highlight.removeClass("highlighted");
827
+ }
828
+ return this.result_highlight = null;
829
+ };
830
+
831
+ Chosen.prototype.results_show = function() {
832
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
833
+ this.form_field_jq.trigger("chosen:maxselected", {
834
+ chosen: this
835
+ });
836
+ return false;
837
+ }
838
+ this.container.addClass("chosen-with-drop");
839
+ this.results_showing = true;
840
+ this.search_field.focus();
841
+ this.search_field.val(this.search_field.val());
842
+ this.winnow_results();
843
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
844
+ chosen: this
845
+ });
846
+ };
847
+
848
+ Chosen.prototype.update_results_content = function(content) {
849
+ return this.search_results.html(content);
850
+ };
851
+
852
+ Chosen.prototype.results_hide = function() {
853
+ if (this.results_showing) {
854
+ this.result_clear_highlight();
855
+ this.container.removeClass("chosen-with-drop");
856
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
857
+ chosen: this
858
+ });
859
+ }
860
+ return this.results_showing = false;
861
+ };
862
+
863
+ Chosen.prototype.set_tab_index = function(el) {
864
+ var ti;
865
+ if (this.form_field.tabIndex) {
866
+ ti = this.form_field.tabIndex;
867
+ this.form_field.tabIndex = -1;
868
+ return this.search_field[0].tabIndex = ti;
869
+ }
870
+ };
871
+
872
+ Chosen.prototype.set_label_behavior = function() {
873
+ var _this = this;
874
+ this.form_field_label = this.form_field_jq.parents("label");
875
+ if (!this.form_field_label.length && this.form_field.id.length) {
876
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
877
+ }
878
+ if (this.form_field_label.length > 0) {
879
+ return this.form_field_label.bind('click.chosen', function(evt) {
880
+ if (_this.is_multiple) {
881
+ return _this.container_mousedown(evt);
882
+ } else {
883
+ return _this.activate_field();
884
+ }
885
+ });
886
+ }
887
+ };
888
+
889
+ Chosen.prototype.show_search_field_default = function() {
890
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
891
+ this.search_field.val(this.default_text);
892
+ return this.search_field.addClass("default");
893
+ } else {
894
+ this.search_field.val("");
895
+ return this.search_field.removeClass("default");
896
+ }
897
+ };
898
+
899
+ Chosen.prototype.search_results_mouseup = function(evt) {
900
+ var target;
901
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
902
+ if (target.length) {
903
+ this.result_highlight = target;
904
+ this.result_select(evt);
905
+ return this.search_field.focus();
906
+ }
907
+ };
908
+
909
+ Chosen.prototype.search_results_mouseover = function(evt) {
910
+ var target;
911
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
912
+ if (target) {
913
+ return this.result_do_highlight(target);
914
+ }
915
+ };
916
+
917
+ Chosen.prototype.search_results_mouseout = function(evt) {
918
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
919
+ return this.result_clear_highlight();
920
+ }
921
+ };
922
+
923
+ Chosen.prototype.choice_build = function(item) {
924
+ var choice, close_link,
925
+ _this = this;
926
+ choice = $('<li />', {
927
+ "class": "search-choice"
928
+ }).html("<span>" + item.html + "</span>");
929
+ if (item.disabled) {
930
+ choice.addClass('search-choice-disabled');
931
+ } else {
932
+ close_link = $('<a />', {
933
+ "class": 'search-choice-close',
934
+ 'data-option-array-index': item.array_index
935
+ });
936
+ close_link.bind('click.chosen', function(evt) {
937
+ return _this.choice_destroy_link_click(evt);
938
+ });
939
+ choice.append(close_link);
940
+ }
941
+ return this.search_container.before(choice);
942
+ };
943
+
944
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
945
+ evt.preventDefault();
946
+ evt.stopPropagation();
947
+ if (!this.is_disabled) {
948
+ return this.choice_destroy($(evt.target));
949
+ }
950
+ };
951
+
952
+ Chosen.prototype.choice_destroy = function(link) {
953
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
954
+ this.show_search_field_default();
955
+ if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
956
+ this.results_hide();
957
+ }
958
+ link.parents('li').first().remove();
959
+ return this.search_field_scale();
960
+ }
961
+ };
962
+
963
+ Chosen.prototype.results_reset = function() {
964
+ this.reset_single_select_options();
965
+ this.form_field.options[0].selected = true;
966
+ this.single_set_selected_text();
967
+ this.show_search_field_default();
968
+ this.results_reset_cleanup();
969
+ this.form_field_jq.trigger("change");
970
+ if (this.active_field) {
971
+ return this.results_hide();
972
+ }
973
+ };
974
+
975
+ Chosen.prototype.results_reset_cleanup = function() {
976
+ this.current_selectedIndex = this.form_field.selectedIndex;
977
+ return this.selected_item.find("abbr").remove();
978
+ };
979
+
980
+ Chosen.prototype.result_select = function(evt) {
981
+ var high, item;
982
+ if (this.result_highlight) {
983
+ high = this.result_highlight;
984
+ this.result_clear_highlight();
985
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
986
+ this.form_field_jq.trigger("chosen:maxselected", {
987
+ chosen: this
988
+ });
989
+ return false;
990
+ }
991
+ if (this.is_multiple) {
992
+ high.removeClass("active-result");
993
+ } else {
994
+ this.reset_single_select_options();
995
+ }
996
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
997
+ item.selected = true;
998
+ this.form_field.options[item.options_index].selected = true;
999
+ this.selected_option_count = null;
1000
+ if (this.is_multiple) {
1001
+ this.choice_build(item);
1002
+ } else {
1003
+ this.single_set_selected_text(item.text);
1004
+ }
1005
+ if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
1006
+ this.results_hide();
1007
+ }
1008
+ this.search_field.val("");
1009
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1010
+ this.form_field_jq.trigger("change", {
1011
+ 'selected': this.form_field.options[item.options_index].value
1012
+ });
1013
+ }
1014
+ this.current_selectedIndex = this.form_field.selectedIndex;
1015
+ return this.search_field_scale();
1016
+ }
1017
+ };
1018
+
1019
+ Chosen.prototype.single_set_selected_text = function(text) {
1020
+ if (text == null) {
1021
+ text = this.default_text;
1022
+ }
1023
+ if (text === this.default_text) {
1024
+ this.selected_item.addClass("chosen-default");
1025
+ } else {
1026
+ this.single_deselect_control_build();
1027
+ this.selected_item.removeClass("chosen-default");
1028
+ }
1029
+ return this.selected_item.find("span").text(text);
1030
+ };
1031
+
1032
+ Chosen.prototype.result_deselect = function(pos) {
1033
+ var result_data;
1034
+ result_data = this.results_data[pos];
1035
+ if (!this.form_field.options[result_data.options_index].disabled) {
1036
+ result_data.selected = false;
1037
+ this.form_field.options[result_data.options_index].selected = false;
1038
+ this.selected_option_count = null;
1039
+ this.result_clear_highlight();
1040
+ if (this.results_showing) {
1041
+ this.winnow_results();
1042
+ }
1043
+ this.form_field_jq.trigger("change", {
1044
+ deselected: this.form_field.options[result_data.options_index].value
1045
+ });
1046
+ this.search_field_scale();
1047
+ return true;
1048
+ } else {
1049
+ return false;
1050
+ }
1051
+ };
1052
+
1053
+ Chosen.prototype.single_deselect_control_build = function() {
1054
+ if (!this.allow_single_deselect) {
1055
+ return;
1056
+ }
1057
+ if (!this.selected_item.find("abbr").length) {
1058
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1059
+ }
1060
+ return this.selected_item.addClass("chosen-single-with-deselect");
1061
+ };
1062
+
1063
+ Chosen.prototype.get_search_text = function() {
1064
+ if (this.search_field.val() === this.default_text) {
1065
+ return "";
1066
+ } else {
1067
+ return $('<div/>').text($.trim(this.search_field.val())).html();
1068
+ }
1069
+ };
1070
+
1071
+ Chosen.prototype.winnow_results_set_highlight = function() {
1072
+ var do_high, selected_results;
1073
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1074
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1075
+ if (do_high != null) {
1076
+ return this.result_do_highlight(do_high);
1077
+ }
1078
+ };
1079
+
1080
+ Chosen.prototype.no_results = function(terms) {
1081
+ var no_results_html;
1082
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
1083
+ no_results_html.find("span").first().html(terms);
1084
+ this.search_results.append(no_results_html);
1085
+ return this.form_field_jq.trigger("chosen:no_results", {
1086
+ chosen: this
1087
+ });
1088
+ };
1089
+
1090
+ Chosen.prototype.no_results_clear = function() {
1091
+ return this.search_results.find(".no-results").remove();
1092
+ };
1093
+
1094
+ Chosen.prototype.keydown_arrow = function() {
1095
+ var next_sib;
1096
+ if (this.results_showing && this.result_highlight) {
1097
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1098
+ if (next_sib) {
1099
+ return this.result_do_highlight(next_sib);
1100
+ }
1101
+ } else {
1102
+ return this.results_show();
1103
+ }
1104
+ };
1105
+
1106
+ Chosen.prototype.keyup_arrow = function() {
1107
+ var prev_sibs;
1108
+ if (!this.results_showing && !this.is_multiple) {
1109
+ return this.results_show();
1110
+ } else if (this.result_highlight) {
1111
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1112
+ if (prev_sibs.length) {
1113
+ return this.result_do_highlight(prev_sibs.first());
1114
+ } else {
1115
+ if (this.choices_count() > 0) {
1116
+ this.results_hide();
1117
+ }
1118
+ return this.result_clear_highlight();
1119
+ }
1120
+ }
1121
+ };
1122
+
1123
+ Chosen.prototype.keydown_backstroke = function() {
1124
+ var next_available_destroy;
1125
+ if (this.pending_backstroke) {
1126
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1127
+ return this.clear_backstroke();
1128
+ } else {
1129
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1130
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1131
+ this.pending_backstroke = next_available_destroy;
1132
+ if (this.single_backstroke_delete) {
1133
+ return this.keydown_backstroke();
1134
+ } else {
1135
+ return this.pending_backstroke.addClass("search-choice-focus");
1136
+ }
1137
+ }
1138
+ }
1139
+ };
1140
+
1141
+ Chosen.prototype.clear_backstroke = function() {
1142
+ if (this.pending_backstroke) {
1143
+ this.pending_backstroke.removeClass("search-choice-focus");
1144
+ }
1145
+ return this.pending_backstroke = null;
1146
+ };
1147
+
1148
+ Chosen.prototype.keydown_checker = function(evt) {
1149
+ var stroke, _ref1;
1150
+ stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1151
+ this.search_field_scale();
1152
+ if (stroke !== 8 && this.pending_backstroke) {
1153
+ this.clear_backstroke();
1154
+ }
1155
+ switch (stroke) {
1156
+ case 8:
1157
+ this.backstroke_length = this.search_field.val().length;
1158
+ break;
1159
+ case 9:
1160
+ if (this.results_showing && !this.is_multiple) {
1161
+ this.result_select(evt);
1162
+ }
1163
+ this.mouse_on_container = false;
1164
+ break;
1165
+ case 13:
1166
+ evt.preventDefault();
1167
+ break;
1168
+ case 38:
1169
+ evt.preventDefault();
1170
+ this.keyup_arrow();
1171
+ break;
1172
+ case 40:
1173
+ evt.preventDefault();
1174
+ this.keydown_arrow();
1175
+ break;
1176
+ }
1177
+ };
1178
+
1179
+ Chosen.prototype.search_field_scale = function() {
1180
+ var div, f_width, h, style, style_block, styles, w, _i, _len;
1181
+ if (this.is_multiple) {
1182
+ h = 0;
1183
+ w = 0;
1184
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1185
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1186
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
1187
+ style = styles[_i];
1188
+ style_block += style + ":" + this.search_field.css(style) + ";";
1189
+ }
1190
+ div = $('<div />', {
1191
+ 'style': style_block
1192
+ });
1193
+ div.text(this.search_field.val());
1194
+ $('body').append(div);
1195
+ w = div.width() + 25;
1196
+ div.remove();
1197
+ f_width = this.container.outerWidth();
1198
+ if (w > f_width - 10) {
1199
+ w = f_width - 10;
1200
+ }
1201
+ return this.search_field.css({
1202
+ 'width': w + 'px'
1203
+ });
1204
+ }
1205
+ };
1206
+
1207
+ return Chosen;
1208
+
1209
+ })(AbstractChosen);
1210
+
1211
+ }).call(this);
assets/js/conditional-logic.js ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+
3
+ var conditional_logic = {
4
+
5
+ init: function() {
6
+
7
+ var _this = this;
8
+ _this.change();
9
+
10
+ // events
11
+ $(document).on( 'change', '.wpuf-fields input, .wpuf-fields textarea, .wpuf-fields select', function(){
12
+ _this.change();
13
+ });
14
+ },
15
+
16
+ change: function() {
17
+
18
+ var cond_field_val = [],
19
+ all = [],
20
+ prefix = 'wpuf_';
21
+
22
+ if ( typeof wpuf_conditional_items === 'undefined' ) {
23
+ return;
24
+ }
25
+
26
+ $.each( wpuf_conditional_items, function( k, item ) {
27
+
28
+ $.each( item.cond_field, function( key, value ) {
29
+
30
+ var form_id = '_'+item.form_id,
31
+ selector = '.'+prefix+value+form_id,
32
+ value = item.cond_option[key],
33
+ operator = ( item.cond_operator[key] == '=' ) ? true : false,
34
+ select = $('select'+selector),
35
+ checkbox = $('input[type=checkbox][value="'+value+'"]'+selector ),
36
+ radio = $('input[type=radio][value="'+value+'"]'+selector),
37
+ select = $('select'+selector+'>option[value="'+value+'"]');
38
+
39
+
40
+ if ( select.length ) {
41
+
42
+ var select_selectd_status = select.is(':selected') ? true : false;
43
+
44
+ if ( operator && select_selectd_status ) {
45
+ all[key] = true;
46
+
47
+ } else if ( operator === false && select_selectd_status === false ) {
48
+ all[key] = true;
49
+
50
+ } else {
51
+ all[key] = false;
52
+ }
53
+ }
54
+
55
+ if ( radio.length ) {
56
+
57
+ var radio_checked_status = radio.is(':checked') ? true : false;
58
+
59
+ if ( operator && radio_checked_status ) {
60
+
61
+ all[key] = true;
62
+
63
+ } else if ( operator === false && radio_checked_status === false ) {
64
+
65
+ all[key] = true;
66
+
67
+ } else {
68
+ all[key] = false;
69
+ }
70
+ }
71
+
72
+ if ( checkbox.length ) {
73
+
74
+ var checkbox_checked_status = checkbox.is(':checked') ? true : false;
75
+
76
+ if( operator && checkbox_checked_status ) {
77
+ all[key] = true;
78
+
79
+ } else if ( operator === false && checkbox_checked_status === false ) {
80
+ all[key] = true;
81
+
82
+ } else {
83
+ all[key] = false;
84
+ }
85
+ }
86
+ });
87
+
88
+ if ( item.cond_logic == 'any') {
89
+
90
+ var check = all.indexOf( true );
91
+
92
+ if ( check != '-1') {
93
+
94
+ if ( item.type == 'address' ) {
95
+ $( 'li.wpuf-el.' + item.name ).show();
96
+ } else {
97
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
98
+ }
99
+
100
+ } else {
101
+
102
+ if ( item.type == 'address' ) {
103
+ $( 'li.wpuf-el.' + item.name ).hide();
104
+ } else {
105
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').hide();
106
+ }
107
+
108
+ }
109
+
110
+ } else {
111
+
112
+ var check = all.indexOf( false );
113
+
114
+ if ( check == '-1') {
115
+
116
+ if ( item.type == 'address' ) {
117
+ $( 'li.wpuf-el.' + item.name ).show();
118
+ } else {
119
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
120
+ }
121
+
122
+ } else {
123
+
124
+ if ( item.type == 'address' ) {
125
+ $( 'li.wpuf-el.' + item.name ).hide();
126
+ } else {
127
+ $( '.' + prefix+item.name + '_' + item.form_id).closest('li').hide();
128
+ }
129
+ }
130
+
131
+ }
132
+
133
+ all.length = 0;
134
+ });
135
+ }
136
+ }
137
+
138
+ conditional_logic.init();
139
+ })(jQuery);
assets/js/conditional.js ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This is a JavaScript Scratchpad.
3
+ *
4
+ * Enter some JavaScript, then Right Click or choose from the Execute Menu:
5
+ * 1. Run to evaluate the selected text (Cmd-R),
6
+ * 2. Inspect to bring up an Object Inspector on the result (Cmd-I), or,
7
+ * 3. Display to insert the result in a comment after the selection. (Cmd-L)
8
+ */
9
+
10
+ (function($, window) {
11
+
12
+ var WPUF_Conditional = {
13
+
14
+ init: function() {
15
+ var form = $('#wpuf-form-editor');
16
+ form.on('click', 'a.wpuf-conditional-plus', this.duplicateRow);
17
+ form.on('click', 'a.wpuf-conditional-minus', this.removeRow);
18
+ form.on('click', 'input[type=radio].wpuf-conditional-enable', this.showHide);
19
+ form.on('change', 'input[type=text][data-type="label"]', this.labelRender );
20
+ form.on('change', 'input[type=text][data-type="option"]', this.optionRender );
21
+ form.on('change', 'input[type=text][data-type="option_value"]', this.optionRender );
22
+ form.on('change', 'select.wpuf-conditional-fields', this.optionChange);
23
+
24
+ this.getLabel( true );
25
+
26
+ //initially get options values array
27
+ this.getOption( true );
28
+
29
+ this.labelRender();
30
+ this.optionRender();
31
+
32
+ },
33
+
34
+
35
+ newOptionValue: [],
36
+
37
+ prevOptionValue: [],
38
+
39
+ prevLabelValue: [],
40
+
41
+ newLabelValue: [],
42
+
43
+ getOption: function( optionStatus ) {
44
+ var labels = $('#wpuf-form-editor').find('input[data-type="name"]');
45
+
46
+ $.each( labels, function(k, label_field ) {
47
+ var label = $(label_field),
48
+ label_name = label.val();
49
+ if( label_name != '' ) {
50
+
51
+ var label_option = label.closest('.wpuf-form-holder').find('input[data-type="option_value"]');
52
+
53
+ var generate = [];
54
+
55
+ $.each( label_option, function( key, option ) {
56
+ var field_value = $(option).val();
57
+ if ( field_value == '' ) {
58
+ var field_value = $(option).closest('div').find('input[data-type=option]').val();
59
+ }
60
+ generate.push( field_value );
61
+ });
62
+
63
+ if( optionStatus === true ) {
64
+ WPUF_Conditional.prevOptionValue[label_name] = generate;
65
+ }
66
+
67
+ if( optionStatus === false ) {
68
+ WPUF_Conditional.newOptionValue[label_name] = generate;
69
+ }
70
+ }
71
+ });
72
+ },
73
+
74
+ getLabel: function( labelStatus ) {
75
+ var label = $('#wpuf-form-editor').find('input[data-type="name"]'),
76
+ prev_label = WPUF_Conditional.prevLabelValue,
77
+ new_label = WPUF_Conditional.newLabelValue;
78
+
79
+ if( labelStatus === true ) {
80
+ prev_label.length = 0;
81
+ }
82
+
83
+ if( labelStatus === false ) {
84
+ new_label.length = 0;
85
+ }
86
+
87
+ $.each( label, function(k, label_field ) {
88
+ var label = $(label_field),
89
+ label_name = label.val();
90
+ if( label_name != '' && labelStatus === true ) {
91
+ prev_label.push( label_name );
92
+ }
93
+
94
+ if( label_name != '' && labelStatus === false ) {
95
+ new_label.push( label_name );
96
+ }
97
+ });
98
+ },
99
+
100
+ labelRender: function() {
101
+
102
+ //after change get options values array
103
+ WPUF_Conditional.getLabel( false );
104
+
105
+ var options = WPUF_Conditional.fieldDropdown(),
106
+ label = $('#wpuf-form-editor').find('input[data-type="name"]'),
107
+ cond_select_wraps = $('select.wpuf-conditional-fields'),
108
+ wrap = $('.wpuf-form-holder'),
109
+ prev_label = WPUF_Conditional.prevLabelValue,
110
+ new_label = WPUF_Conditional.newLabelValue;
111
+
112
+ $.each( wrap, function( key, parent ) {
113
+
114
+ var label_name = $(parent).find('input[data-type="name"]').val(),
115
+ cond_select_wraps = $(parent).find('select.wpuf-conditional-fields'),
116
+ new_option = [];
117
+
118
+ $.each( options, function( k, opt_value ) {
119
+ var opt_val = $( opt_value ).attr('value');
120
+
121
+ if( opt_val !== label_name || label_name == '' ) {
122
+ new_option.push( opt_value );
123
+ }
124
+
125
+ });
126
+
127
+ $.each( cond_select_wraps, function( i, select_val) {
128
+ var select = $(select_val),
129
+ select_val = select.val();
130
+
131
+ var index = new_label.indexOf( select_val );
132
+
133
+ if( index == '-1' ) {
134
+ var oldindex = prev_label.indexOf( select_val );
135
+ select.html( new_option.join('') ).val( new_label[oldindex] );
136
+ } else {
137
+ select.html( new_option.join('') ).val( select_val );
138
+ }
139
+ });
140
+ });
141
+
142
+
143
+
144
+ WPUF_Conditional.getLabel( true );
145
+ WPUF_Conditional.getOption( true );
146
+ },
147
+
148
+ optionRender: function() {
149
+
150
+ //after change get options values array
151
+ WPUF_Conditional.getOption( false );
152
+
153
+ var option = WPUF_Conditional.labelOptionValue,
154
+ cond_select_wraps = $('select.wpuf-conditional-fields');
155
+
156
+ $.each( cond_select_wraps, function( i, select_val) {
157
+
158
+ var select = $(select_val),
159
+ select_val = $(select_val).val(),
160
+ option_generate = WPUF_Conditional.optionDropdown( select_val ),
161
+ optionDropdown = select.closest('tr').find('select.wpuf-conditional-fields-option'),
162
+ option_prev_val = optionDropdown.val(),
163
+ prev_options = WPUF_Conditional.prevOptionValue,
164
+ new_options = WPUF_Conditional.newOptionValue;
165
+
166
+ if( select_val !== '' ) {
167
+
168
+ var index = new_options[select_val].indexOf( option_prev_val );
169
+
170
+ if( index == '-1') {
171
+
172
+ var oldindex = prev_options[select_val].indexOf( option_prev_val );
173
+
174
+ optionDropdown.html(option_generate).val( new_options[select_val][oldindex] );
175
+ } else {
176
+ optionDropdown.html(option_generate).val(option_prev_val);
177
+ }
178
+ } else {
179
+ optionDropdown.html('<option>- select -</option>');
180
+ }
181
+ });
182
+
183
+ WPUF_Conditional.getOption( true );
184
+ },
185
+
186
+
187
+ getFields: function() {
188
+ var elements = [],
189
+ form_editor = $('#wpuf-form-editor');
190
+
191
+ form_editor.find('li.wpuf-conditional').each(function(i, el) {
192
+ el = $(el);
193
+
194
+ var label = el.find('input[type=text][data-type="label"]').val(),
195
+ name = el.find('[data-type="name"]').val();
196
+
197
+ elements[i] = {
198
+ 'name': name,
199
+ 'label': label,
200
+ 'options': [],
201
+ 'values': [],
202
+ };
203
+
204
+ el.find('.wpuf-options [data-type="option"]').each(function(j, jel){
205
+ var option_value = $(this).siblings('input[data-type="option_value"]').val();
206
+ if ( option_value == '') {
207
+ option_value = $(jel).val();
208
+ }
209
+ elements[i].options.push( $(jel).val() );
210
+ elements[i].values.push( option_value );
211
+ });
212
+ });
213
+
214
+ return elements;
215
+ },
216
+
217
+ fieldDropdown: function() {
218
+
219
+ var fields = this.getFields(),
220
+ dropdown = [];
221
+
222
+ dropdown.push('<option value="">- select -</option>');
223
+
224
+ for( var field in fields ) {
225
+
226
+ var label = fields[field].label;
227
+ if( label != '') {
228
+ dropdown.push('<option value="' + fields[field].name + '">' + label + '</option>');
229
+ }
230
+ }
231
+
232
+ return dropdown;
233
+ },
234
+
235
+ optionDropdown: function(fieldName) {
236
+ var fields = this.getFields(),
237
+ dropdown = '<option value="">- select -</option>',
238
+ options = [],
239
+ values =[];
240
+
241
+ for(field in fields) {
242
+
243
+ if(fields[field].name === fieldName) {
244
+ options = fields[field].options;
245
+ values = fields[field].values;
246
+ }
247
+ }
248
+
249
+ for( var option in options ) {
250
+
251
+ var o = options[option],
252
+ v = values[option];
253
+ dropdown += '<option value="' + v + '">' + o + '</option>';
254
+ }
255
+
256
+ return dropdown;
257
+ },
258
+
259
+ fillFields: function() {
260
+ var options = this.fieldDropdown();
261
+ $('.wpuf-conditional-fields').each(function(i, el) {
262
+ $(el).empty().append(options);
263
+ });
264
+ },
265
+
266
+ showHide: function() {
267
+
268
+ var self = $(this),
269
+ parent = self.closest('.wpuf-form-sub-fields').find('.conditional-rules-wrap'),
270
+ val = self.val();
271
+
272
+ if ( val === 'yes' ) {
273
+ parent.removeClass('wpuf-hide');
274
+ WPUF_Conditional.labelRender();
275
+ WPUF_Conditional.optionRender();
276
+
277
+ } else {
278
+ parent.addClass('wpuf-hide');
279
+ }
280
+ },
281
+
282
+ duplicateRow: function(e) {
283
+ e.preventDefault();
284
+
285
+ var self = $(this),
286
+ tr = self.closest('tr');
287
+
288
+ tr.clone().insertAfter(tr);
289
+ },
290
+
291
+ removeRow: function(e) {
292
+ e.preventDefault();
293
+
294
+ var table = $(this).closest('table'),
295
+ rows = table.find('tr').length;
296
+
297
+ if ( rows > 1 ) {
298
+ $(this).closest('tr').remove();
299
+ }
300
+ },
301
+
302
+ optionChange: function() {
303
+ var self = $(this),
304
+ value = self.val(),
305
+ optionDropdown = self.closest('tr').find('select.wpuf-conditional-fields-option');
306
+
307
+ if ( value !== '' ) {
308
+ options = WPUF_Conditional.optionDropdown(value);
309
+ optionDropdown.empty().append(options);
310
+ } else {
311
+ optionDropdown.html('<option>- Select -</option>');
312
+ }
313
+ }
314
+ };
315
+
316
+ $(function(){
317
+ window.wpuf_conditional = WPUF_Conditional;
318
+ WPUF_Conditional.init();
319
+ });
320
+
321
+ })(jQuery, window);
assets/js/countries.json ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {"name": "Afghanistan", "code": "AF"},
3
+ {"name": "Åland Islands", "code": "AX"},
4
+ {"name": "Albania", "code": "AL"},
5
+ {"name": "Algeria", "code": "DZ"},
6
+ {"name": "American Samoa", "code": "AS"},
7
+ {"name": "AndorrA", "code": "AD"},
8
+ {"name": "Angola", "code": "AO"},
9
+ {"name": "Anguilla", "code": "AI"},
10
+ {"name": "Antarctica", "code": "AQ"},
11
+ {"name": "Antigua and Barbuda", "code": "AG"},
12
+ {"name": "Argentina", "code": "AR"},
13
+ {"name": "Armenia", "code": "AM"},
14
+ {"name": "Aruba", "code": "AW"},
15
+ {"name": "Australia", "code": "AU"},
16
+ {"name": "Austria", "code": "AT"},
17
+ {"name": "Azerbaijan", "code": "AZ"},
18
+ {"name": "Bahamas", "code": "BS"},
19
+ {"name": "Bahrain", "code": "BH"},
20
+ {"name": "Bangladesh", "code": "BD"},
21
+ {"name": "Barbados", "code": "BB"},
22
+ {"name": "Belarus", "code": "BY"},
23
+ {"name": "Belgium", "code": "BE"},
24
+ {"name": "Belize", "code": "BZ"},
25
+ {"name": "Benin", "code": "BJ"},
26
+ {"name": "Bermuda", "code": "BM"},
27
+ {"name": "Bhutan", "code": "BT"},
28
+ {"name": "Bolivia", "code": "BO"},
29
+ {"name": "Bosnia and Herzegovina", "code": "BA"},
30
+ {"name": "Botswana", "code": "BW"},
31
+ {"name": "Bouvet Island", "code": "BV"},
32
+ {"name": "Brazil", "code": "BR"},
33
+ {"name": "British Indian Ocean Territory", "code": "IO"},
34
+ {"name": "Brunei Darussalam", "code": "BN"},
35
+ {"name": "Bulgaria", "code": "BG"},
36
+ {"name": "Burkina Faso", "code": "BF"},
37
+ {"name": "Burundi", "code": "BI"},
38
+ {"name": "Cambodia", "code": "KH"},
39
+ {"name": "Cameroon", "code": "CM"},
40
+ {"name": "Canada", "code": "CA"},
41
+ {"name": "Cape Verde", "code": "CV"},
42
+ {"name": "Cayman Islands", "code": "KY"},
43
+ {"name": "Central African Republic", "code": "CF"},
44
+ {"name": "Chad", "code": "TD"},
45
+ {"name": "Chile", "code": "CL"},
46
+ {"name": "China", "code": "CN"},
47
+ {"name": "Christmas Island", "code": "CX"},
48
+ {"name": "Cocos (Keeling) Islands", "code": "CC"},
49
+ {"name": "Colombia", "code": "CO"},
50
+ {"name": "Comoros", "code": "KM"},
51
+ {"name": "Congo", "code": "CG"},
52
+ {"name": "Congo, The Democratic Republic of the", "code": "CD"},
53
+ {"name": "Cook Islands", "code": "CK"},
54
+ {"name": "Costa Rica", "code": "CR"},
55
+ {"name": "Cote D\"Ivoire", "code": "CI"},
56
+ {"name": "Croatia", "code": "HR"},
57
+ {"name": "Cuba", "code": "CU"},
58
+ {"name": "Cyprus", "code": "CY"},
59
+ {"name": "Czech Republic", "code": "CZ"},
60
+ {"name": "Denmark", "code": "DK"},
61
+ {"name": "Djibouti", "code": "DJ"},
62
+ {"name": "Dominica", "code": "DM"},
63
+ {"name": "Dominican Republic", "code": "DO"},
64
+ {"name": "Ecuador", "code": "EC"},
65
+ {"name": "Egypt", "code": "EG"},
66
+ {"name": "El Salvador", "code": "SV"},
67
+ {"name": "Equatorial Guinea", "code": "GQ"},
68
+ {"name": "Eritrea", "code": "ER"},
69
+ {"name": "Estonia", "code": "EE"},
70
+ {"name": "Ethiopia", "code": "ET"},
71
+ {"name": "Falkland Islands (Malvinas)", "code": "FK"},
72
+ {"name": "Faroe Islands", "code": "FO"},
73
+ {"name": "Fiji", "code": "FJ"},
74
+ {"name": "Finland", "code": "FI"},
75
+ {"name": "France", "code": "FR"},
76
+ {"name": "French Guiana", "code": "GF"},
77
+ {"name": "French Polynesia", "code": "PF"},
78
+ {"name": "French Southern Territories", "code": "TF"},
79
+ {"name": "Gabon", "code": "GA"},
80
+ {"name": "Gambia", "code": "GM"},
81
+ {"name": "Georgia", "code": "GE"},
82
+ {"name": "Germany", "code": "DE"},
83
+ {"name": "Ghana", "code": "GH"},
84
+ {"name": "Gibraltar", "code": "GI"},
85
+ {"name": "Greece", "code": "GR"},
86
+ {"name": "Greenland", "code": "GL"},
87
+ {"name": "Grenada", "code": "GD"},
88
+ {"name": "Guadeloupe", "code": "GP"},
89
+ {"name": "Guam", "code": "GU"},
90
+ {"name": "Guatemala", "code": "GT"},
91
+ {"name": "Guernsey", "code": "GG"},
92
+ {"name": "Guinea", "code": "GN"},
93
+ {"name": "Guinea-Bissau", "code": "GW"},
94
+ {"name": "Guyana", "code": "GY"},
95
+ {"name": "Haiti", "code": "HT"},
96
+ {"name": "Heard Island and Mcdonald Islands", "code": "HM"},
97
+ {"name": "Holy See (Vatican City State)", "code": "VA"},
98
+ {"name": "Honduras", "code": "HN"},
99
+ {"name": "Hong Kong", "code": "HK"},
100
+ {"name": "Hungary", "code": "HU"},
101
+ {"name": "Iceland", "code": "IS"},
102
+ {"name": "India", "code": "IN"},
103
+ {"name": "Indonesia", "code": "ID"},
104
+ {"name": "Iran, Islamic Republic Of", "code": "IR"},
105
+ {"name": "Iraq", "code": "IQ"},
106
+ {"name": "Ireland", "code": "IE"},
107
+ {"name": "Isle of Man", "code": "IM"},
108
+ {"name": "Israel", "code": "IL"},
109
+ {"name": "Italy", "code": "IT"},
110
+ {"name": "Jamaica", "code": "JM"},
111
+ {"name": "Japan", "code": "JP"},
112
+ {"name": "Jersey", "code": "JE"},
113
+ {"name": "Jordan", "code": "JO"},
114
+ {"name": "Kazakhstan", "code": "KZ"},
115
+ {"name": "Kenya", "code": "KE"},
116
+ {"name": "Kiribati", "code": "KI"},
117
+ {"name": "Korea, Democratic People\"S Republic of", "code": "KP"},
118
+ {"name": "Korea, Republic of", "code": "KR"},
119
+ {"name": "Kuwait", "code": "KW"},
120
+ {"name": "Kyrgyzstan", "code": "KG"},
121
+ {"name": "Lao People\"S Democratic Republic", "code": "LA"},
122
+ {"name": "Latvia", "code": "LV"},
123
+ {"name": "Lebanon", "code": "LB"},
124
+ {"name": "Lesotho", "code": "LS"},
125
+ {"name": "Liberia", "code": "LR"},
126
+ {"name": "Libyan Arab Jamahiriya", "code": "LY"},
127
+ {"name": "Liechtenstein", "code": "LI"},
128
+ {"name": "Lithuania", "code": "LT"},
129
+ {"name": "Luxembourg", "code": "LU"},
130
+ {"name": "Macao", "code": "MO"},
131
+ {"name": "Macedonia, The Former Yugoslav Republic of", "code": "MK"},
132
+ {"name": "Madagascar", "code": "MG"},
133
+ {"name": "Malawi", "code": "MW"},
134
+ {"name": "Malaysia", "code": "MY"},
135
+ {"name": "Maldives", "code": "MV"},
136
+ {"name": "Mali", "code": "ML"},
137
+ {"name": "Malta", "code": "MT"},
138
+ {"name": "Marshall Islands", "code": "MH"},
139
+ {"name": "Martinique", "code": "MQ"},
140
+ {"name": "Mauritania", "code": "MR"},
141
+ {"name": "Mauritius", "code": "MU"},
142
+ {"name": "Mayotte", "code": "YT"},
143
+ {"name": "Mexico", "code": "MX"},
144
+ {"name": "Micronesia, Federated States of", "code": "FM"},
145
+ {"name": "Moldova, Republic of", "code": "MD"},
146
+ {"name": "Monaco", "code": "MC"},
147
+ {"name": "Mongolia", "code": "MN"},
148
+ {"name": "Montserrat", "code": "MS"},
149
+ {"name": "Morocco", "code": "MA"},
150
+ {"name": "Mozambique", "code": "MZ"},
151
+ {"name": "Myanmar", "code": "MM"},
152
+ {"name": "Namibia", "code": "NA"},
153
+ {"name": "Nauru", "code": "NR"},
154
+ {"name": "Nepal", "code": "NP"},
155
+ {"name": "Netherlands", "code": "NL"},
156
+ {"name": "Netherlands Antilles", "code": "AN"},
157
+ {"name": "New Caledonia", "code": "NC"},
158
+ {"name": "New Zealand", "code": "NZ"},
159
+ {"name": "Nicaragua", "code": "NI"},
160
+ {"name": "Niger", "code": "NE"},
161
+ {"name": "Nigeria", "code": "NG"},
162
+ {"name": "Niue", "code": "NU"},
163
+ {"name": "Norfolk Island", "code": "NF"},
164
+ {"name": "Northern Mariana Islands", "code": "MP"},
165
+ {"name": "Norway", "code": "NO"},
166
+ {"name": "Oman", "code": "OM"},
167
+ {"name": "Pakistan", "code": "PK"},
168
+ {"name": "Palau", "code": "PW"},
169
+ {"name": "Palestinian Territory, Occupied", "code": "PS"},
170
+ {"name": "Panama", "code": "PA"},
171
+ {"name": "Papua New Guinea", "code": "PG"},
172
+ {"name": "Paraguay", "code": "PY"},
173
+ {"name": "Peru", "code": "PE"},
174
+ {"name": "Philippines", "code": "PH"},
175
+ {"name": "Pitcairn", "code": "PN"},
176
+ {"name": "Poland", "code": "PL"},
177
+ {"name": "Portugal", "code": "PT"},
178
+ {"name": "Puerto Rico", "code": "PR"},
179
+ {"name": "Qatar", "code": "QA"},
180
+ {"name": "Reunion", "code": "RE"},
181
+ {"name": "Romania", "code": "RO"},
182
+ {"name": "Russian Federation", "code": "RU"},
183
+ {"name": "RWANDA", "code": "RW"},
184
+ {"name": "Saint Helena", "code": "SH"},
185
+ {"name": "Saint Kitts and Nevis", "code": "KN"},
186
+ {"name": "Saint Lucia", "code": "LC"},
187
+ {"name": "Saint Pierre and Miquelon", "code": "PM"},
188
+ {"name": "Saint Vincent and the Grenadines", "code": "VC"},
189
+ {"name": "Samoa", "code": "WS"},
190
+ {"name": "San Marino", "code": "SM"},
191
+ {"name": "Sao Tome and Principe", "code": "ST"},
192
+ {"name": "Saudi Arabia", "code": "SA"},
193
+ {"name": "Senegal", "code": "SN"},
194
+ {"name": "Serbia and Montenegro", "code": "CS"},
195
+ {"name": "Seychelles", "code": "SC"},
196
+ {"name": "Sierra Leone", "code": "SL"},
197
+ {"name": "Singapore", "code": "SG"},
198
+ {"name": "Slovakia", "code": "SK"},
199
+ {"name": "Slovenia", "code": "SI"},
200
+ {"name": "Solomon Islands", "code": "SB"},
201
+ {"name": "Somalia", "code": "SO"},
202
+ {"name": "South Africa", "code": "ZA"},
203
+ {"name": "South Georgia and the South Sandwich Islands", "code": "GS"},
204
+ {"name": "Spain", "code": "ES"},
205
+ {"name": "Sri Lanka", "code": "LK"},
206
+ {"name": "Sudan", "code": "SD"},
207
+ {"name": "Suriname", "code": "SR"},
208
+ {"name": "Svalbard and Jan Mayen", "code": "SJ"},
209
+ {"name": "Swaziland", "code": "SZ"},
210
+ {"name": "Sweden", "code": "SE"},
211
+ {"name": "Switzerland", "code": "CH"},
212
+ {"name": "Syrian Arab Republic", "code": "SY"},
213
+ {"name": "Taiwan, Province of China", "code": "TW"},
214
+ {"name": "Tajikistan", "code": "TJ"},
215
+ {"name": "Tanzania, United Republic of", "code": "TZ"},
216
+ {"name": "Thailand", "code": "TH"},
217
+ {"name": "Timor-Leste", "code": "TL"},
218
+ {"name": "Togo", "code": "TG"},
219
+ {"name": "Tokelau", "code": "TK"},
220
+ {"name": "Tonga", "code": "TO"},
221
+ {"name": "Trinidad and Tobago", "code": "TT"},
222
+ {"name": "Tunisia", "code": "TN"},
223
+ {"name": "Turkey", "code": "TR"},
224
+ {"name": "Turkmenistan", "code": "TM"},
225
+ {"name": "Turks and Caicos Islands", "code": "TC"},
226
+ {"name": "Tuvalu", "code": "TV"},
227
+ {"name": "Uganda", "code": "UG"},
228
+ {"name": "Ukraine", "code": "UA"},
229
+ {"name": "United Arab Emirates", "code": "AE"},
230
+ {"name": "United Kingdom", "code": "GB"},
231
+ {"name": "United States", "code": "US"},
232
+ {"name": "United States Minor Outlying Islands", "code": "UM"},
233
+ {"name": "Uruguay", "code": "UY"},
234
+ {"name": "Uzbekistan", "code": "UZ"},
235
+ {"name": "Vanuatu", "code": "VU"},
236
+ {"name": "Venezuela", "code": "VE"},
237
+ {"name": "Viet Nam", "code": "VN"},
238
+ {"name": "Virgin Islands, British", "code": "VG"},
239
+ {"name": "Virgin Islands, U.S.", "code": "VI"},
240
+ {"name": "Wallis and Futuna", "code": "WF"},
241
+ {"name": "Western Sahara", "code": "EH"},
242
+ {"name": "Yemen", "code": "YE"},
243
+ {"name": "Zambia", "code": "ZM"},
244
+ {"name": "Zimbabwe", "code": "ZW"}
245
+ ]
assets/js/formbuilder.js ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jshint devel:true */
2
+ /*global ajaxurl */
3
+
4
+ ;(function($) {
5
+
6
+ var $formEditor = $('ul#wpuf-form-editor');
7
+
8
+ var Editor = {
9
+ init: function() {
10
+
11
+ $(function() {
12
+ $('.wpuf-ms-color').wpColorPicker();
13
+ });
14
+
15
+ // make it sortable
16
+ this.makeSortable();
17
+
18
+ this.tooltip();
19
+ this.tabber();
20
+ this.showHideHelp();
21
+
22
+ var this_obj = this;
23
+ // Form Settings
24
+ $('#wpuf-metabox-settings').on('change', 'select[name="wpuf_settings[redirect_to]"]', this.settingsRedirect);
25
+ $('#wpuf-metabox-settings-update').on('change', 'select[name="wpuf_settings[edit_redirect_to]"]', this.settingsRedirect);
26
+ $('select[name="wpuf_settings[redirect_to]"]').change();
27
+ $('select[name="wpuf_settings[edit_redirect_to]"]').change();
28
+
29
+ // Form settings: Guest post
30
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_post]"]', this.settingsGuest);
31
+ $('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger('change');
32
+
33
+ // From settings: User details
34
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_details]"]', this.settingsGuestDetails);
35
+ // $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
36
+
37
+ // collapse all
38
+ $('button.wpuf-collapse').on('click', this.collpaseEditFields);
39
+
40
+ // add field click
41
+ $('.wpuf-form-buttons').on('click', 'button', this.addNewField);
42
+
43
+ // remove form field
44
+ $('#wpuf-form-editor').on('click', '.wpuf-remove', this.removeFormField);
45
+
46
+ // on change event: meta key
47
+ $('#wpuf-form-editor').on('change', 'li.custom-field input[data-type="label"]', this.setMetaKey);
48
+
49
+ // on change event: checkbox|radio fields
50
+ $('#wpuf-form-editor').on('change', '.wpuf-form-sub-fields input[type=text]', function() {
51
+ var self = $(this),
52
+ value = self.closest('div').find('input[data-type=option_value]').val();
53
+
54
+ if ( value === '' ) {
55
+ var replace_val = self.closest('div').find('input[data-type=option]').val();
56
+ self.siblings('input[type=checkbox], input[type=radio]').val(replace_val);
57
+ } else {
58
+ self.siblings('input[type=checkbox], input[type=radio]').val(value);
59
+ }
60
+
61
+
62
+ });
63
+
64
+ // on change event: checkbox|radio fields
65
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].multicolumn', function() {
66
+ // $(this).prev('input[type=checkbox], input[type=radio]').val($(this).val());
67
+ var $self = $(this),
68
+ $parent = $self.closest('.wpuf-form-rows');
69
+
70
+ if ($self.is(':checked')) {
71
+ $parent.next().hide().next().hide();
72
+ $parent.siblings('.column-names').show();
73
+ } else {
74
+ $parent.next().show().next().show();
75
+ $parent.siblings('.column-names').hide();
76
+ }
77
+ });
78
+
79
+ // on change event: checkbox|radio fields
80
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].retype-pass', function() {
81
+ // $(this).prev('input[type=checkbox], input[type=radio]').val($(this).val());
82
+ var $self = $(this),
83
+ $parent = $self.closest('.wpuf-form-rows');
84
+
85
+ if ($self.is(':checked')) {
86
+ $parent.next().show().next().show();
87
+ } else {
88
+ $parent.next().hide().next().hide();
89
+ }
90
+ });
91
+
92
+ // woo attribute
93
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].woo_attr', function() {
94
+ var $self = $(this),
95
+ $parent = $self.closest('.wpuf-form-rows');
96
+
97
+ if ($self.is(':checked')) {
98
+ $parent.next().show();
99
+ } else {
100
+ $parent.next().hide();
101
+ }
102
+ });
103
+
104
+ // toggle form field
105
+ $('#wpuf-form-editor').on('click', '.wpuf-toggle', this.toggleFormField);
106
+
107
+ // clone and remove repeated field
108
+ $('#wpuf-form-editor').on('click', 'img.wpuf-clone-field', this.cloneField);
109
+ $('#wpuf-form-editor').on('click', 'img.wpuf-remove-field', this.removeField);
110
+ $('#wpuf-form-editor').on('click', '.wpuf-value-handelar', this.showValueField);
111
+
112
+ //on change enable expiration check status
113
+ this.changeExpirationFieldVisibility(':checkbox#wpuf-enable_post_expiration')
114
+ $('.wpuf-metabox-post_expiration').on('change',':checkbox#wpuf-enable_post_expiration',this.changeExpirationFieldVisibility);
115
+ //on change expiration type drop down
116
+ //$('.wpuf-metabox-post_expiration').on('change','select#wpuf-expiration_time_type',this.setTimeExpiration);
117
+
118
+ this_obj.changeMultistepVisibility( $('.wpuf_enable_multistep_section :input[type="checkbox"]') );
119
+ $('.wpuf_enable_multistep_section :input[type="checkbox"]').click(function(){
120
+ this_obj.changeMultistepVisibility( $(this) );
121
+ });
122
+
123
+ //when changing the post type from the drop down
124
+ $(document).on( 'change', ':input[name="wpuf_settings[post_type]"]', function() {
125
+ $('.attributes_holder, .wpuf-custom-tax-btn', '.wpuf-taxonomies-holder ' ).hide();
126
+ $( '.attributes_holder.' + $(this).val() + ', .wpuf-custom-tax-btn.' + $(this).val(),'.wpuf-taxonomies-holder ').show();
127
+ } );
128
+ },
129
+
130
+ changeMultistepVisibility : function( target ){
131
+ if(target.is(':checked')){
132
+ $('.wpuf_multistep_content').show();
133
+ }else{
134
+ $('.wpuf_multistep_content').hide();
135
+ }
136
+ },
137
+
138
+ showValueField: function() {
139
+ var self = $(this),
140
+ field = self.closest('div').find( 'input[data-type=option_value], span.wpuf-option-value');
141
+
142
+ if ( self.is(':checked') ) {
143
+ field.show();
144
+ } else {
145
+ field.hide();
146
+ }
147
+
148
+ },
149
+
150
+ showHideHelp: function() {
151
+ var childs = $('ul#wpuf-form-editor').children('li');
152
+
153
+ if ( !childs.length) {
154
+ $('.wpuf-updated').show();
155
+ } else {
156
+ $('.wpuf-updated').hide();
157
+ }
158
+ },
159
+
160
+ makeSortable: function() {
161
+ $formEditor = $('ul#wpuf-form-editor');
162
+
163
+ if ($formEditor) {
164
+ $formEditor.sortable({
165
+ placeholder: "ui-state-highlight",
166
+ handle: '> .wpuf-legend',
167
+ distance: 5
168
+ });
169
+ }
170
+ },
171
+
172
+ addNewField: function(e) {
173
+ e.preventDefault();
174
+
175
+ var $self = $(this),
176
+ $formEditor = $('ul#wpuf-form-editor'),
177
+ name = $self.data('name'),
178
+ type = $self.data('type'),
179
+ data = {
180
+ name: name,
181
+ type: type,
182
+ order: $formEditor.find('li').length + 1,
183
+ action: 'wpuf_form_add_el'
184
+ };
185
+
186
+ // console.log($self, data);
187
+
188
+ // check if these are already inserted
189
+ var oneInstance = ['post_title', 'post_content', 'post_excerpt', 'featured_image',
190
+ 'user_login', 'first_name', 'last_name', 'nickname', 'user_email', 'user_url',
191
+ 'user_bio', 'password', 'user_avatar'];
192
+
193
+ if ($.inArray(name, oneInstance) >= 0) {
194
+ if( $formEditor.find('li.' + name).length ) {
195
+ alert('You already have this field in the form');
196
+ return false;
197
+ }
198
+ }
199
+
200
+ $('.wpuf-loading').removeClass('hide');
201
+ $.post(ajaxurl, data, function(res) {
202
+ $formEditor.append(res);
203
+
204
+ // re-call sortable
205
+ Editor.makeSortable();
206
+
207
+ // enable tooltip
208
+ Editor.tooltip();
209
+
210
+ $('.wpuf-loading').addClass('hide');
211
+ Editor.showHideHelp();
212
+ });
213
+ },
214
+
215
+ removeFormField: function(e) {
216
+ e.preventDefault();
217
+
218
+ if (confirm('are you sure?')) {
219
+
220
+ $(this).closest('li').fadeOut(function() {
221
+ $(this).remove();
222
+
223
+ Editor.showHideHelp();
224
+ });
225
+ }
226
+ },
227
+
228
+ toggleFormField: function(e) {
229
+ e.preventDefault();
230
+
231
+ $(this).closest('li').find('.wpuf-form-holder').slideToggle('fast');
232
+ },
233
+
234
+ cloneField: function(e) {
235
+ e.preventDefault();
236
+
237
+ var $div = $(this).closest('div');
238
+ var $clone = $div.clone();
239
+ // console.log($clone);
240
+
241
+ //clear the inputs
242
+ $clone.find('input').val('');
243
+ $clone.find(':checked').attr('checked', '');
244
+ $div.after($clone);
245
+ },
246
+
247
+ removeField: function() {
248
+ //check if it's the only item
249
+ var $parent = $(this).closest('div');
250
+ var items = $parent.siblings('.wpuf-clone-field').andSelf().length;
251
+
252
+ if( items > 1 ) {
253
+ $parent.remove();
254
+ }
255
+ },
256
+
257
+ setMetaKey: function() {
258
+ var $self = $(this),
259
+ val = $self.val().toLowerCase().split(' ').join('_').split('\'').join(''),
260
+ $metaKey = $(this).closest('.wpuf-form-rows').next().find('input[type=text]');
261
+
262
+ val = val.replace(/[^a-z0-9]|\s+|\r?\n|\r/gmi, "_");
263
+
264
+ if ($metaKey.length && !$metaKey.val()) {
265
+ $metaKey.val(val);
266
+ }
267
+ },
268
+
269
+ tooltip: function() {
270
+ $('.smallipopInput').smallipop({
271
+ preferredPosition: 'right',
272
+ theme: 'black',
273
+ popupOffset: 0,
274
+ triggerOnClick: true
275
+ });
276
+ },
277
+
278
+ collpaseEditFields: function(e) {
279
+ e.preventDefault();
280
+
281
+ $('ul#wpuf-form-editor').children('li').find('.wpuf-form-holder').slideToggle();
282
+ },
283
+
284
+ settingsGuest: function (e) {
285
+ e.preventDefault();
286
+
287
+ var table = $(this).closest('table');
288
+
289
+ if ( $(this).is(':checked') ) {
290
+ table.find('tr.show-if-guest').show();
291
+ table.find('tr.show-if-not-guest').hide();
292
+
293
+ $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
294
+
295
+ } else {
296
+ table.find('tr.show-if-guest').hide();
297
+ table.find('tr.show-if-not-guest').show();
298
+ }
299
+ },
300
+
301
+ settingsGuestDetails: function (e) {
302
+ e.preventDefault();
303
+
304
+ var table = $(this).closest('table');
305
+
306
+ if ( $(this).is(':checked') ) {
307
+ table.find('tr.show-if-details').show();
308
+ } else {
309
+ table.find('tr.show-if-details').hide();
310
+ }
311
+ },
312
+
313
+ settingsRedirect: function(e) {
314
+ e.preventDefault();
315
+
316
+ var $self = $(this),
317
+ $table = $self.closest('table'),
318
+ value = $self.val();
319
+
320
+ switch( value ) {
321
+ case 'post':
322
+ $table.find('tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page').hide();
323
+ break;
324
+
325
+ case 'page':
326
+ $table.find('tr.wpuf-page-id').show();
327
+ $table.find('tr.wpuf-same-page').hide();
328
+ $table.find('tr.wpuf-url').hide();
329
+ break;
330
+
331
+ case 'url':
332
+ $table.find('tr.wpuf-page-id').hide();
333
+ $table.find('tr.wpuf-same-page').hide();
334
+ $table.find('tr.wpuf-url').show();
335
+ break;
336
+
337
+ case 'same':
338
+ $table.find('tr.wpuf-page-id').hide();
339
+ $table.find('tr.wpuf-url').hide();
340
+ $table.find('tr.wpuf-same-page').show();
341
+ break;
342
+ }
343
+ },
344
+
345
+ tabber: function() {
346
+ // Switches option sections
347
+ $('.group').hide();
348
+ $('.group:first').fadeIn();
349
+
350
+ $('.group .collapsed').each(function(){
351
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
352
+ function(){
353
+ if ($(this).hasClass('last')) {
354
+ $(this).removeClass('hidden');
355
+ return false;
356
+ }
357
+ $(this).filter('.hidden').removeClass('hidden');
358
+ });
359
+ });
360
+
361
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
362
+
363
+ $('.nav-tab-wrapper a').click(function(evt) {
364
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
365
+ $(this).addClass('nav-tab-active').blur();
366
+ var clicked_group = $(this).attr('href');
367
+ $('.group').hide();
368
+ $(clicked_group).fadeIn();
369
+ evt.preventDefault();
370
+ });
371
+ },
372
+
373
+ setTimeExpiration: function(e){
374
+ var timeArray = {
375
+ 'day' : 30,
376
+ 'month' : 12,
377
+ 'year': 100
378
+ };
379
+ $('#wpuf-expiration_time_value').html('');
380
+ var timeVal = e.target?$(e.target).val():$(e).val();
381
+ for(var time = 1; time <= timeArray[timeVal]; time++){
382
+ $('#wpuf-expiration_time_value').append('<option value="'+ time +'" >'+ time +'</option>');
383
+ }
384
+ },
385
+
386
+ changeExpirationFieldVisibility : function(e){
387
+ console.log(e);
388
+ var checkbox_obj = e.target? $(e.target):$(e);
389
+ checkbox_obj.is(':checked')?$('.wpuf_expiration_field').show():$('.wpuf_expiration_field').hide();
390
+ }
391
+ };
392
+
393
+ // on DOM ready
394
+ $(function() {
395
+ Editor.init();
396
+ });
397
+
398
+ })(jQuery);
assets/js/formbuilder.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t=e("ul#wpuf-form-editor"),i={init:function(){this.makeSortable(),this.tooltip(),this.tabber(),this.showHideHelp(),e("#wpuf-metabox-settings").on("change",'select[name="wpuf_settings[redirect_to]"]',this.settingsRedirect),e("#wpuf-metabox-settings-update").on("change",'select[name="wpuf_settings[edit_redirect_to]"]',this.settingsRedirect),e('select[name="wpuf_settings[redirect_to]"]').change(),e('select[name="wpuf_settings[edit_redirect_to]"]').change(),e("#wpuf-metabox-settings").on("change",'input[type=checkbox][name="wpuf_settings[guest_post]"]',this.settingsGuest),e('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger("change"),e("#wpuf-metabox-settings").on("change",'input[type=checkbox][name="wpuf_settings[guest_details]"]',this.settingsGuestDetails),e("button.wpuf-collapse").on("click",this.collpaseEditFields),e(".wpuf-form-buttons").on("click","button",this.addNewField),e("#wpuf-form-editor").on("click",".wpuf-remove",this.removeFormField),e("#wpuf-form-editor").on("change",'li.custom-field input[data-type="label"]',this.setMetaKey),e("#wpuf-form-editor").on("change",".wpuf-form-sub-fields input[type=text]",function(){var t=e(this),i=t.closest("div").find("input[data-type=option_value]").val();if(""===i){var s=t.closest("div").find("input[data-type=option]").val();t.siblings("input[type=checkbox], input[type=radio]").val(s)}else t.siblings("input[type=checkbox], input[type=radio]").val(i)}),e("#wpuf-form-editor").on("click","input[type=checkbox].multicolumn",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?(i.next().hide().next().hide(),i.siblings(".column-names").show()):(i.next().show().next().show(),i.siblings(".column-names").hide())}),e("#wpuf-form-editor").on("click","input[type=checkbox].retype-pass",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?i.next().show().next().show():i.next().hide().next().hide()}),e("#wpuf-form-editor").on("click","input[type=checkbox].woo_attr",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?i.next().show():i.next().hide()}),e("#wpuf-form-editor").on("click",".wpuf-toggle",this.toggleFormField),e("#wpuf-form-editor").on("click","img.wpuf-clone-field",this.cloneField),e("#wpuf-form-editor").on("click","img.wpuf-remove-field",this.removeField),e("#wpuf-form-editor").on("click",".wpuf-value-handelar",this.showValueField)},showValueField:function(){var t=e(this),i=t.closest("div").find("input[data-type=option_value], span.wpuf-option-value");t.is(":checked")?i.show():i.hide()},showHideHelp:function(){var t=e("ul#wpuf-form-editor").children("li");t.length?e(".wpuf-updated").hide():e(".wpuf-updated").show()},makeSortable:function(){t=e("ul#wpuf-form-editor"),t&&t.sortable({placeholder:"ui-state-highlight",handle:"> .wpuf-legend",distance:5})},addNewField:function(t){t.preventDefault();var s=e(this),n=e("ul#wpuf-form-editor"),o=s.data("name"),a=s.data("type"),r={name:o,type:a,order:n.find("li").length+1,action:"wpuf_form_add_el"},l=["post_title","post_content","post_excerpt","featured_image","user_login","first_name","last_name","nickname","user_email","user_url","user_bio","password","user_avatar"];return e.inArray(o,l)>=0&&n.find("li."+o).length?(alert("You already have this field in the form"),!1):(e(".wpuf-loading").removeClass("hide"),void e.post(ajaxurl,r,function(t){n.append(t),i.makeSortable(),i.tooltip(),e(".wpuf-loading").addClass("hide"),i.showHideHelp()}))},removeFormField:function(t){t.preventDefault(),confirm("are you sure?")&&e(this).closest("li").fadeOut(function(){e(this).remove(),i.showHideHelp()})},toggleFormField:function(t){t.preventDefault(),e(this).closest("li").find(".wpuf-form-holder").slideToggle("fast")},cloneField:function(t){t.preventDefault();var i=e(this).closest("div"),s=i.clone();s.find("input").val(""),s.find(":checked").attr("checked",""),i.after(s)},removeField:function(){var t=e(this).closest("div"),i=t.siblings(".wpuf-clone-field").andSelf().length;i>1&&t.remove()},setMetaKey:function(){var t=e(this),i=t.val().toLowerCase().split(" ").join("_").split("'").join(""),s=e(this).closest(".wpuf-form-rows").next().find("input[type=text]");i=i.replace(/[^a-z0-9]|\s+|\r?\n|\r/gim,"_"),s.length&&s.val(i)},tooltip:function(){e(".smallipopInput").smallipop({preferredPosition:"right",theme:"black",popupOffset:0,triggerOnClick:!0})},collpaseEditFields:function(t){t.preventDefault(),e("ul#wpuf-form-editor").children("li").find(".wpuf-form-holder").slideToggle()},settingsGuest:function(t){t.preventDefault();var i=e(this).closest("table");e(this).is(":checked")?(i.find("tr.show-if-guest").show(),i.find("tr.show-if-not-guest").hide(),e('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger("change")):(i.find("tr.show-if-guest").hide(),i.find("tr.show-if-not-guest").show())},settingsGuestDetails:function(t){t.preventDefault();var i=e(this).closest("table");e(this).is(":checked")?i.find("tr.show-if-details").show():i.find("tr.show-if-details").hide()},settingsRedirect:function(t){t.preventDefault();var i=e(this),s=i.closest("table"),n=i.val();switch(n){case"post":s.find("tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page").hide();break;case"page":s.find("tr.wpuf-page-id").show(),s.find("tr.wpuf-same-page").hide(),s.find("tr.wpuf-url").hide();break;case"url":s.find("tr.wpuf-page-id").hide(),s.find("tr.wpuf-same-page").hide(),s.find("tr.wpuf-url").show();break;case"same":s.find("tr.wpuf-page-id").hide(),s.find("tr.wpuf-url").hide(),s.find("tr.wpuf-same-page").show()}},tabber:function(){e(".group").hide(),e(".group:first").fadeIn(),e(".group .collapsed").each(function(){e(this).find("input:checked").parent().parent().parent().nextAll().each(function(){return e(this).hasClass("last")?(e(this).removeClass("hidden"),!1):void e(this).filter(".hidden").removeClass("hidden")})}),e(".nav-tab-wrapper a:first").addClass("nav-tab-active"),e(".nav-tab-wrapper a").click(function(t){e(".nav-tab-wrapper a").removeClass("nav-tab-active"),e(this).addClass("nav-tab-active").blur();var i=e(this).attr("href");e(".group").hide(),e(i).fadeIn(),t.preventDefault()})}};e(function(){i.init()})}(jQuery);
assets/js/frontend-form.js ADDED
@@ -0,0 +1,903 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($, window) {
2
+
3
+ $.fn.listautowidth = function() {
4
+ return this.each(function() {
5
+ var w = $(this).width();
6
+ var liw = w / $(this).children('li').length;
7
+ $(this).children('li').each(function(){
8
+ var s = $(this).outerWidth(true)-$(this).width();
9
+ $(this).width(liw-s);
10
+ });
11
+ });
12
+ };
13
+
14
+ window.WP_User_Frontend = {
15
+
16
+ pass_val : '',
17
+ retype_pass_val : '',
18
+
19
+ init: function() {
20
+
21
+ //enable multistep
22
+ this.enableMultistep(this);
23
+
24
+ // clone and remove repeated field
25
+ $('.wpuf-form').on('click', 'img.wpuf-clone-field', this.cloneField);
26
+ $('.wpuf-form').on('click', 'img.wpuf-remove-field', this.removeField);
27
+ $('.wpuf-form').on('click', 'a.wpuf-delete-avatar', this.deleteAvatar);
28
+ $('.wpuf-form').on('click', 'a#wpuf-post-draft', this.draftPost);
29
+ $('.wpuf-form').on('click', 'button#wpuf-account-update-profile', this.account_update_profile);
30
+
31
+ $('.wpuf-form-add').on('submit', this.formSubmit);
32
+ $('form#post').on('submit', this.adminPostSubmit);
33
+ $( '.wpuf-form').on('keyup', '#pass1', this.check_pass_strength );
34
+
35
+ this.ajaxCategory();
36
+ // image insert
37
+ // this.insertImage();
38
+
39
+ //comfirmation alert for canceling subscription
40
+ $( ':submit[name="wpuf_cancel_subscription"]').click(function(){
41
+ if ( !confirm( 'Are you sure you want to cancel your current subscription ?' ) ) {
42
+ return false;
43
+ }
44
+
45
+ });
46
+ },
47
+
48
+ check_pass_strength : function() {
49
+ var pass1 = $('#pass1').val(), strength;
50
+
51
+ $('#pass-strength-result').show();
52
+
53
+ $('#pass-strength-result').removeClass('short bad good strong');
54
+ if ( ! pass1 ) {
55
+ $('#pass-strength-result').html( '&nbsp;' );
56
+ $('#pass-strength-result').hide();
57
+ return;
58
+ }
59
+
60
+ if ( typeof wp.passwordStrength != 'undefined' ) {
61
+
62
+ strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass1 );
63
+
64
+ switch ( strength ) {
65
+ case 2:
66
+ $('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
67
+ break;
68
+ case 3:
69
+ $('#pass-strength-result').addClass('good').html( pwsL10n.good );
70
+ break;
71
+ case 4:
72
+ $('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
73
+ break;
74
+ case 5:
75
+ $('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
76
+ break;
77
+ default:
78
+ $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
79
+ }
80
+
81
+ }
82
+ },
83
+
84
+ enableMultistep: function(o) {
85
+
86
+ var js_obj = this;
87
+ var step_number = 0;
88
+ var progressbar_type = $(':hidden[name="wpuf_multistep_type"]').val();
89
+
90
+ if ( progressbar_type == null ) {
91
+ return;
92
+ }
93
+
94
+ // first fieldset doesn't have prev button,
95
+ // last fieldset doesn't have next button
96
+ $('fieldset.wpuf-multistep-fieldset').find('.wpuf-multistep-prev-btn').first().remove();
97
+ $('fieldset.wpuf-multistep-fieldset').find('.wpuf-multistep-next-btn').last().remove();
98
+
99
+ // at first first fieldset will be shown, and others will be hidden
100
+ $('.wpuf-form fieldset').removeClass('field-active').first().addClass('field-active');
101
+
102
+ if ( progressbar_type == 'progressive' && $('.wpuf-form .wpuf-multistep-fieldset').length != 0 ) {
103
+
104
+ var firstLegend = $('fieldset.wpuf-multistep-fieldset legend').first();
105
+ $('.wpuf-multistep-progressbar').html('<div class="wpuf-progress-percentage"></div>' );
106
+
107
+ var progressbar = $( ".wpuf-multistep-progressbar" ),
108
+ progressLabel = $( ".wpuf-progress-percentage" );
109
+
110
+ $( ".wpuf-multistep-progressbar" ).progressbar({
111
+ change: function() {
112
+ progressLabel.text( progressbar.progressbar( "value" ) + "%" );
113
+ }
114
+ });
115
+
116
+ $('.wpuf-multistep-fieldset legend').hide();
117
+
118
+ } else {
119
+ $('.wpuf-form').each(function() {
120
+ var this_obj = $(this);
121
+ var progressbar = $('.wpuf-multistep-progressbar', this_obj);
122
+ var nav = '';
123
+
124
+ progressbar.addClass('wizard-steps');
125
+ nav += '<ul class="wpuf-step-wizard">';
126
+
127
+ $('.wpuf-multistep-fieldset', this).each(function(){
128
+ nav += '<li>' + $.trim( $('legend', this).text() ) + '</li>';
129
+ $('legend', this).hide();
130
+ });
131
+
132
+ nav += '</ul>';
133
+ progressbar.append( nav );
134
+
135
+ $('.wpuf-step-wizard li', progressbar).first().addClass('active-step');
136
+ $('.wpuf-step-wizard', progressbar).listautowidth();
137
+ });
138
+ }
139
+
140
+ this.change_fieldset(step_number, progressbar_type);
141
+
142
+ $('fieldset .wpuf-multistep-prev-btn, fieldset .wpuf-multistep-next-btn').click(function(e) {
143
+
144
+ // js_obj.formSubmit();
145
+ if ( $(this).hasClass('wpuf-multistep-next-btn') ) {
146
+ var result = js_obj.formStepCheck( '', $(this).closest('fieldset') );
147
+
148
+ if ( result != false ) {
149
+ o.change_fieldset(++step_number,progressbar_type);
150
+ }
151
+
152
+ } else if ( $(this).hasClass('wpuf-multistep-prev-btn') ) {
153
+ o.change_fieldset( --step_number,progressbar_type );
154
+ }
155
+
156
+ return false;
157
+ });
158
+ },
159
+
160
+ change_fieldset: function(step_number, progressbar_type) {
161
+ $('fieldset.wpuf-multistep-fieldset').removeClass('field-active').eq(step_number).addClass('field-active');
162
+
163
+ $('.wpuf-step-wizard li').each(function(){
164
+ if ( $(this).index() <= step_number ){
165
+ progressbar_type == 'step_by_step'? $(this).addClass('passed-wpuf-ms-bar') : $('.wpuf-ps-bar',this).addClass('passed-wpuf-ms-bar');
166
+ } else {
167
+ progressbar_type == 'step_by_step'? $(this).removeClass('passed-wpuf-ms-bar') : $('.wpuf-ps-bar',this).removeClass('passed-wpuf-ms-bar');
168
+ }
169
+ });
170
+
171
+ $('.wpuf-step-wizard li').removeClass('wpuf-ms-bar-active active-step completed-step');
172
+ $('.passed-wpuf-ms-bar').addClass('completed-step').last().addClass('wpuf-ms-bar-active');
173
+ $('.wpuf-ms-bar-active').addClass('active-step');
174
+
175
+ var legend = $('fieldset.wpuf-multistep-fieldset').eq(step_number).find('legend').text();
176
+ legend = $.trim( legend );
177
+
178
+ if ( progressbar_type == 'progressive' && $('.wpuf-form .wpuf-multistep-fieldset').length != 0 ) {
179
+ var progress_percent = ( step_number + 1 ) * 100 / $('fieldset.wpuf-multistep-fieldset').length ;
180
+ var progress_percent = Number( progress_percent.toFixed(2) );
181
+ $( ".wpuf-multistep-progressbar" ).progressbar({value: progress_percent });
182
+ $( '.wpuf-progress-percentage' ).text( legend + ' (' + progress_percent + '%)');
183
+ }
184
+
185
+ // trigger a change event
186
+ $('.wpuf-form').trigger('step-change-fieldset');
187
+ },
188
+
189
+ ajaxCategory: function () {
190
+
191
+ var el = '.cat-ajax',
192
+ wrap = '.category-wrap';
193
+
194
+ $(wrap).on('change', el, function(){
195
+ currentLevel = parseInt( $(this).parent().attr('level') );
196
+ WP_User_Frontend.getChildCats( $(this), 'lvl', currentLevel+1, wrap, 'category');
197
+ });
198
+ },
199
+
200
+ getChildCats: function (dropdown, result_div, level, wrap_div, taxonomy) {
201
+
202
+ cat = $(dropdown).val();
203
+ results_div = result_div + level;
204
+ taxonomy = typeof taxonomy !== 'undefined' ? taxonomy : 'category';
205
+ field_attr = $(dropdown).siblings('span').data('taxonomy');
206
+
207
+ $.ajax({
208
+ type: 'post',
209
+ url: wpuf_frontend.ajaxurl,
210
+ data: {
211
+ action: 'wpuf_get_child_cat',
212
+ catID: cat,
213
+ nonce: wpuf_frontend.nonce,
214
+ field_attr: field_attr
215
+ },
216
+ beforeSend: function() {
217
+ $(dropdown).parent().parent().next('.loading').addClass('wpuf-loading');
218
+ },
219
+ complete: function() {
220
+ $(dropdown).parent().parent().next('.loading').removeClass('wpuf-loading');
221
+ },
222
+ success: function(html) {
223
+ //console.log( html ); return;
224
+ $(dropdown).parent().nextAll().each(function(){
225
+ $(this).remove();
226
+ });
227
+
228
+ if(html != "") {
229
+ $(dropdown).parent().addClass('hasChild').parent().append('<div id="'+result_div+level+'" level="'+level+'"></div>');
230
+ dropdown.parent().parent().find('#'+results_div).html(html).slideDown('fast');
231
+ }
232
+ }
233
+ });
234
+ },
235
+
236
+ cloneField: function(e) {
237
+ e.preventDefault();
238
+
239
+ var $div = $(this).closest('tr');
240
+ var $clone = $div.clone();
241
+ // console.log($clone);
242
+
243
+ //clear the inputs
244
+ $clone.find('input').val('');
245
+ $clone.find(':checked').attr('checked', '');
246
+ $div.after($clone);
247
+ },
248
+
249
+ removeField: function() {
250
+ //check if it's the only item
251
+ var $parent = $(this).closest('tr');
252
+ var items = $parent.siblings().andSelf().length;
253
+
254
+ if( items > 1 ) {
255
+ $parent.remove();
256
+ }
257
+ },
258
+
259
+ adminPostSubmit: function(e) {
260
+ e.preventDefault();
261
+
262
+ var form = $(this),
263
+ form_data = WP_User_Frontend.validateForm(form);
264
+
265
+ if (form_data) {
266
+ return true;
267
+ }
268
+ },
269
+
270
+ draftPost: function (e) {
271
+ e.preventDefault();
272
+
273
+ var self = $(this),
274
+ form = $(this).closest('form'),
275
+ form_data = form.serialize() + '&action=wpuf_draft_post',
276
+ post_id = form.find('input[type="hidden"][name="post_id"]').val();
277
+
278
+ var rich_texts = [],
279
+ temp, val;
280
+
281
+ // grab rich texts from tinyMCE
282
+ $('.wpuf-rich-validation').each(function (index, item) {
283
+ temp = $(item).data('id');
284
+ val = $.trim( tinyMCE.get(temp).getContent() );
285
+
286
+ rich_texts.push(temp + '=' + encodeURIComponent( val ) );
287
+ });
288
+
289
+ // append them to the form var
290
+ form_data = form_data + '&' + rich_texts.join('&');
291
+
292
+
293
+ self.after(' <span class="wpuf-loading"></span>');
294
+ $.post(wpuf_frontend.ajaxurl, form_data, function(res) {
295
+ // console.log(res, post_id);
296
+ if ( typeof post_id === 'undefined') {
297
+ var html = '<input type="hidden" name="post_id" value="' + res.post_id +'">';
298
+ html += '<input type="hidden" name="post_date" value="' + res.date +'">';
299
+ html += '<input type="hidden" name="post_author" value="' + res.post_author +'">';
300
+ html += '<input type="hidden" name="comment_status" value="' + res.comment_status +'">';
301
+
302
+ form.append( html );
303
+ }
304
+
305
+ self.next('span.wpuf-loading').remove();
306
+
307
+ self.after('<span class="wpuf-draft-saved">&nbsp; Post Saved</span>');
308
+ $('.wpuf-draft-saved').delay(2500).fadeOut('fast', function(){
309
+ $(this).remove();
310
+ });
311
+ })
312
+ },
313
+
314
+ // Frontend account dashboard update profile
315
+ account_update_profile: function (e) {
316
+ e.preventDefault();
317
+ var form = $(this).closest('form');
318
+
319
+ $.post(wpuf_frontend.ajaxurl, form.serialize(), function (res) {
320
+ if (res.success) {
321
+ form.find('.wpuf-error').hide();
322
+ form.find('.wpuf-success').show();
323
+ } else {
324
+ form.find('.wpuf-success').hide();
325
+ form.find('.wpuf-error').show();
326
+ form.find('.wpuf-error').text(res.data);
327
+ }
328
+ });
329
+ },
330
+
331
+ formStepCheck : function(e,fieldset) {
332
+ var form = fieldset,
333
+ submitButton = form.find('input[type=submit]');
334
+ form_data = WP_User_Frontend.validateForm(form);
335
+
336
+ if ( form_data == false ) {
337
+ WP_User_Frontend.addErrorNotice( self, 'bottom' );
338
+ }
339
+ return form_data;
340
+ },
341
+
342
+ formSubmit: function(e) {
343
+ e.preventDefault();
344
+
345
+ var form = $(this),
346
+ submitButton = form.find('input[type=submit]')
347
+ form_data = WP_User_Frontend.validateForm(form);
348
+
349
+ if (form_data) {
350
+
351
+ // send the request
352
+ form.find('li.wpuf-submit').append('<span class="wpuf-loading"></span>');
353
+ submitButton.attr('disabled', 'disabled').addClass('button-primary-disabled');
354
+
355
+ $.post(wpuf_frontend.ajaxurl, form_data, function(res) {
356
+ // var res = $.parseJSON(res);
357
+
358
+ if ( res.success) {
359
+
360
+ // enable external plugins to use events
361
+ $('body').trigger('wpuf:postform:success', res);
362
+
363
+ if ( res.show_message == true) {
364
+ form.before( '<div class="wpuf-success">' + res.message + '</div>');
365
+ form.slideUp( 'fast', function() {
366
+ form.remove();
367
+ });
368
+
369
+ //focus
370
+ $('html, body').animate({
371
+ scrollTop: $('.wpuf-success').offset().top - 100
372
+ }, 'fast');
373
+
374
+ } else {
375
+ window.location = res.redirect_to;
376
+ }
377
+
378
+ } else {
379
+
380
+ if ( typeof res.type !== 'undefined' && res.type === 'login' ) {
381
+
382
+ if ( confirm(res.error) ) {
383
+ window.location = res.redirect_to;
384
+ } else {
385
+ submitButton.removeAttr('disabled');
386
+ submitButton.removeClass('button-primary-disabled');
387
+ form.find('span.wpuf-loading').remove();
388
+ }
389
+
390
+ return;
391
+ } else {
392
+ if ( form.find('.g-recaptcha').length > 0 ) {
393
+ grecaptcha.reset();
394
+ }
395
+
396
+ alert( res.error );
397
+ }
398
+
399
+ submitButton.removeAttr('disabled');
400
+ }
401
+
402
+ submitButton.removeClass('button-primary-disabled');
403
+ form.find('span.wpuf-loading').remove();
404
+ });
405
+ }
406
+ },
407
+
408
+ validateForm: function( self ) {
409
+
410
+ var temp,
411
+ temp_val = '',
412
+ error = false,
413
+ error_items = [];
414
+ error_type = '';
415
+
416
+ // remove all initial errors if any
417
+ WP_User_Frontend.removeErrors(self);
418
+ WP_User_Frontend.removeErrorNotice(self);
419
+
420
+ // ===== Validate: Text and Textarea ========
421
+ var required = self.find('[data-required="yes"]:visible');
422
+
423
+ required.each(function(i, item) {
424
+ // temp_val = $.trim($(item).val());
425
+
426
+ // console.log( $(item).data('type') );
427
+ var data_type = $(item).data('type')
428
+ val = '';
429
+
430
+ switch(data_type) {
431
+ case 'rich':
432
+ var name = $(item).data('id')
433
+ val = $.trim( tinyMCE.get(name).getContent() );
434
+
435
+ if ( val === '') {
436
+ error = true;
437
+
438
+ // make it warn collor
439
+ WP_User_Frontend.markError(item);
440
+ }
441
+ break;
442
+
443
+ case 'textarea':
444
+ case 'text':
445
+
446
+ if ( $(item).hasClass('password') ) {
447
+ if ( WP_User_Frontend.pass_val == '' ) {
448
+ WP_User_Frontend.pass_val = $(item).val();
449
+ } else {
450
+ WP_User_Frontend.retype_pass_val = $(item).val();
451
+ }
452
+ if ( WP_User_Frontend.pass_val != '' && WP_User_Frontend.retype_pass_val != '' && WP_User_Frontend.pass_val != WP_User_Frontend.retype_pass_val ) {
453
+ error = true;
454
+ error_type = 'mismatch';
455
+
456
+ WP_User_Frontend.markError( item, error_type );
457
+ break;
458
+ }
459
+
460
+ }
461
+ val = $.trim( $(item).val() );
462
+
463
+ if ( val === '') {
464
+ error = true;
465
+ error_type = 'required';
466
+
467
+ // make it warn collor
468
+ WP_User_Frontend.markError( item, error_type );
469
+ }
470
+ break;
471
+
472
+ case 'select':
473
+ val = $(item).val();
474
+
475
+ // console.log(val);
476
+ if ( !val || val === '-1' ) {
477
+ error = true;
478
+ error_type = 'required';
479
+
480
+ // make it warn collor
481
+ WP_User_Frontend.markError( item, error_type );
482
+ }
483
+ break;
484
+
485
+ case 'multiselect':
486
+ val = $(item).val();
487
+
488
+ if ( val === null || val.length === 0 ) {
489
+ error = true;
490
+ error_type = 'required';
491
+
492
+ // make it warn collor
493
+ WP_User_Frontend.markError( item, error_type );
494
+ }
495
+ break;
496
+
497
+ case 'tax-checkbox':
498
+ var length = $(item).children().find('input:checked').length;
499
+
500
+ if ( !length ) {
501
+ error = true;
502
+ error_type = 'required';
503
+
504
+ // make it warn collor
505
+ WP_User_Frontend.markError( item, error_type );
506
+ }
507
+ break;
508
+
509
+ case 'radio':
510
+ var length = $(item).find('input:checked').length;
511
+
512
+ if ( !length ) {
513
+ error = true;
514
+ error_type = 'required';
515
+
516
+ // make it warn collor
517
+ WP_User_Frontend.markError( item, error_type );
518
+ }
519
+ break;
520
+
521
+ case 'file':
522
+ var length = $(item).find('ul').children().length;
523
+
524
+ if ( !length ) {
525
+ error = true;
526
+ error_type = 'required';
527
+
528
+ // make it warn collor
529
+ WP_User_Frontend.markError( item, error_type );
530
+ }
531
+ break;
532
+
533
+ case 'email':
534
+ var val = $(item).val();
535
+
536
+ if ( val !== '' ) {
537
+ //run the validation
538
+ if( !WP_User_Frontend.isValidEmail( val ) ) {
539
+ error = true;
540
+ error_type = 'validation';
541
+
542
+ WP_User_Frontend.markError( item, error_type );
543
+ }
544
+ } else if( val === '' ) {
545
+ error = true;
546
+ error_type = 'required';
547
+
548
+ WP_User_Frontend.markError( item, error_type );
549
+ }
550
+ break;
551
+
552
+
553
+ case 'url':
554
+ var val = $(item).val();
555
+
556
+ if ( val !== '' ) {
557
+ //run the validation
558
+ if( !WP_User_Frontend.isValidURL( val ) ) {
559
+ error = true;
560
+ error_type = 'validation';
561
+
562
+ WP_User_Frontend.markError( item, error_type );
563
+ }
564
+ }
565
+ break;
566
+
567
+ };
568
+
569
+ });
570
+
571
+ // if already some error found, bail out
572
+ if (error) {
573
+ // add error notice
574
+ WP_User_Frontend.addErrorNotice(self,'end');
575
+
576
+ return false;
577
+ }
578
+
579
+ var form_data = self.serialize(),
580
+ rich_texts = [];
581
+
582
+ // grab rich texts from tinyMCE
583
+ $('.wpuf-rich-validation', self).each(function (index, item) {
584
+ var item = $(item);
585
+ var editor_id = item.data('id');
586
+ var item_name = item.data('name');
587
+ var val = $.trim( tinyMCE.get(editor_id).getContent() );
588
+
589
+ rich_texts.push(item_name + '=' + encodeURIComponent( val ) );
590
+ });
591
+
592
+ // append them to the form var
593
+ form_data = form_data + '&' + rich_texts.join('&');
594
+ return form_data;
595
+ },
596
+
597
+ /**
598
+ *
599
+ * @param form
600
+ * @param position (value = bottom or end) end if form is onepare, bottom, if form is multistep
601
+ */
602
+ addErrorNotice: function( form, position ) {
603
+ if( position == 'bottom' ) {
604
+ $('.wpuf-multistep-fieldset:visible').append('<div class="wpuf-errors">' + wpuf_frontend.error_message + '</div>');
605
+ } else {
606
+ $(form).find('li.wpuf-submit').append('<div class="wpuf-errors">' + wpuf_frontend.error_message + '</div>');
607
+ }
608
+
609
+ },
610
+
611
+ removeErrorNotice: function(form) {
612
+ $(form).find('.wpuf-errors').remove();
613
+ },
614
+
615
+ markError: function(item, error_type) {
616
+
617
+ var error_string = '';
618
+ $(item).closest('li').addClass('has-error');
619
+
620
+ if ( error_type ) {
621
+ error_string = $(item).closest('li').data('label');
622
+ switch ( error_type ) {
623
+ case 'required' :
624
+ error_string = error_string + ' ' + error_str_obj[error_type];
625
+ break;
626
+ case 'mismatch' :
627
+ error_string = error_string + ' ' +error_str_obj[error_type];
628
+ break;
629
+ case 'validation' :
630
+ error_string = error_string + ' ' + error_str_obj[error_type];
631
+ break
632
+ }
633
+ $(item).siblings('.wpuf-error-msg').remove();
634
+ $(item).after('<div class="wpuf-error-msg">'+ error_string +'</div>')
635
+ }
636
+
637
+ $(item).focus();
638
+ },
639
+
640
+ removeErrors: function(item) {
641
+ $(item).find('.has-error').removeClass('has-error');
642
+ $('.wpuf-error-msg').remove();
643
+ },
644
+
645
+ isValidEmail: function( email ) {
646
+ 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);
647
+ return pattern.test(email);
648
+ },
649
+
650
+ isValidURL: function(url) {
651
+ var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.|http:\/\/|https:\/\/){1}([0-9A-Za-z]+\.)");
652
+ return urlregex.test(url);
653
+ },
654
+
655
+ insertImage: function(button, form_id) {
656
+
657
+ var container = 'wpuf-insert-image-container';
658
+
659
+ if ( ! $( '#' + button ).length ) {
660
+ return;
661
+ };
662
+
663
+ var imageUploader = new plupload.Uploader({
664
+ runtimes: 'html5,html4',
665
+ browse_button: button,
666
+ container: container,
667
+ multipart: true,
668
+ multipart_params: {
669
+ action: 'wpuf_insert_image',
670
+ form_id: $( '#' + button ).data('form_id')
671
+ },
672
+ multiple_queues: false,
673
+ multi_selection: false,
674
+ urlstream_upload: true,
675
+ file_data_name: 'wpuf_file',
676
+ max_file_size: '2mb',
677
+ url: wpuf_frontend_upload.plupload.url,
678
+ flash_swf_url: wpuf_frontend_upload.flash_swf_url,
679
+ filters: [{
680
+ title: 'Allowed Files',
681
+ extensions: 'jpg,jpeg,gif,png,bmp'
682
+ }]
683
+ });
684
+
685
+ imageUploader.bind('Init', function(up, params) {
686
+ // console.log("Current runtime environment: " + params.runtime);
687
+ });
688
+
689
+ imageUploader.bind('FilesAdded', function(up, files) {
690
+ var $container = $('#' + container);
691
+
692
+ $.each(files, function(i, file) {
693
+ $container.append(
694
+ '<div class="upload-item" id="' + file.id + '"><div class="progress progress-striped active"><div class="bar"></div></div></div>');
695
+ });
696
+
697
+ up.refresh();
698
+ up.start();
699
+ });
700
+
701
+ imageUploader.bind('QueueChanged', function (uploader) {
702
+ imageUploader.start();
703
+ });
704
+
705
+ imageUploader.bind('UploadProgress', function(up, file) {
706
+ var item = $('#' + file.id);
707
+
708
+ $('.bar', item).css({ width: file.percent + '%' });
709
+ $('.percent', item).html( file.percent + '%' );
710
+ });
711
+
712
+ imageUploader.bind('Error', function(up, error) {
713
+ alert('Error #' + error.code + ': ' + error.message);
714
+ });
715
+
716
+ imageUploader.bind('FileUploaded', function(up, file, response) {
717
+
718
+ $('#' + file.id).remove();
719
+
720
+ if ( response.response !== 'error' ) {
721
+ var success = false;
722
+
723
+ if ( typeof tinyMCE !== 'undefined' ) {
724
+
725
+ if ( typeof tinyMCE.execInstanceCommand !== 'function' ) {
726
+ // tinyMCE 4.x
727
+ var mce = tinyMCE.get( 'post_content_' + form_id );
728
+
729
+ if ( mce !== null ) {
730
+ mce.insertContent(response.response);
731
+ }
732
+ } else {
733
+ // tinyMCE 3.x
734
+ tinyMCE.execInstanceCommand( 'post_content_' + form_id, 'mceInsertContent', false, response.response);
735
+ }
736
+ }
737
+
738
+ // insert failed to the edit, perhaps insert into textarea
739
+ var post_content = $('#post_content_' + form_id);
740
+ post_content.val( post_content.val() + response.response );
741
+
742
+ } else {
743
+ alert('Something went wrong');
744
+ }
745
+ });
746
+
747
+ imageUploader.init();
748
+ },
749
+
750
+ deleteAvatar: function(e) {
751
+ e.preventDefault();
752
+
753
+ if ( confirm( $(this).data('confirm') ) ) {
754
+ $.post(wpuf_frontend.ajaxurl, {action: 'wpuf_delete_avatar', _wpnonce: wpuf_frontend.nonce}, function() {
755
+ $(e.target).parent().remove();
756
+ });
757
+ }
758
+ },
759
+
760
+ editorLimit: {
761
+
762
+ bind: function(limit, field, type) {
763
+ if ( type === 'no' ) {
764
+ // it's a textarea
765
+ $('textarea#' + field).keydown( function(event) {
766
+ WP_User_Frontend.editorLimit.textLimit.call(this, event, limit);
767
+ });
768
+
769
+ $('input#' + field).keydown( function(event) {
770
+ WP_User_Frontend.editorLimit.textLimit.call(this, event, limit);
771
+ });
772
+
773
+ $('textarea#' + field).on('paste', function(event) {
774
+ var self = $(this);
775
+
776
+ setTimeout(function() {
777
+ WP_User_Frontend.editorLimit.textLimit.call(self, event, limit);
778
+ }, 100);
779
+ });
780
+
781
+ $('input#' + field).on('paste', function(event) {
782
+ var self = $(this);
783
+
784
+ setTimeout(function() {
785
+ WP_User_Frontend.editorLimit.textLimit.call(self, event, limit);
786
+ }, 100);
787
+ });
788
+
789
+ } else {
790
+ // it's a rich textarea
791
+ setTimeout(function () {
792
+ tinyMCE.get(field).onKeyDown.add( function(ed, event) {
793
+ WP_User_Frontend.editorLimit.tinymce.onKeyDown(ed, event, limit);
794
+ } );
795
+
796
+ tinyMCE.get(field).onPaste.add(function(ed, event) {
797
+ setTimeout(function() {
798
+ WP_User_Frontend.editorLimit.tinymce.onPaste(ed, event, limit);
799
+ }, 100);
800
+ });
801
+
802
+ }, 1000);
803
+ }
804
+ },
805
+
806
+ tinymce: {
807
+
808
+ getStats: function(ed) {
809
+ var body = ed.getBody(), text = tinymce.trim(body.innerText || body.textContent);
810
+
811
+ return {
812
+ chars: text.length,
813
+ words: text.split(/[\w\u2019\'-]+/).length
814
+ };
815
+ },
816
+
817
+ onKeyDown: function(ed, event, limit) {
818
+ var numWords = WP_User_Frontend.editorLimit.tinymce.getStats(ed).words - 1;
819
+
820
+ limit ? $('.mce-path-item.mce-last', ed.container).html('Word Limit : '+ numWords +'/'+limit):'';
821
+
822
+ if ( limit && numWords > limit ) {
823
+ WP_User_Frontend.editorLimit.blockTyping(event);
824
+ jQuery('.mce-path-item.mce-last', ed.container).html( wpuf_frontend.word_limit );
825
+ }
826
+ },
827
+
828
+ onPaste: function(ed, event, limit) {
829
+ var editorContent = ed.getContent().split(' ').slice(0, limit).join(' ');
830
+
831
+ // Let TinyMCE do the heavy lifting for inserting that content into the editor.
832
+ // ed.insertContent(content); //ed.execCommand('mceInsertContent', false, content);
833
+ ed.setContent(editorContent);
834
+
835
+ WP_User_Frontend.editorLimit.make_media_embed_code(editorContent, ed);
836
+ }
837
+ },
838
+
839
+ textLimit: function(event, limit) {
840
+ var self = $(this),
841
+ content = self.val().split(' ');
842
+
843
+ if ( limit && content.length > limit ) {
844
+ self.closest('.wpuf-fields').find('span.wpuf-wordlimit-message').html( wpuf_frontend.word_limit );
845
+ WP_User_Frontend.editorLimit.blockTyping(event);
846
+ } else {
847
+ self.closest('.wpuf-fields').find('span.wpuf-wordlimit-message').html('');
848
+ }
849
+
850
+ // handle the paste event
851
+ if ( event.type === 'paste' ) {
852
+ self.val( content.slice(0, limit).join( ' ' ) );
853
+ }
854
+ },
855
+
856
+ blockTyping: function(event) {
857
+ // Allow: backspace, delete, tab, escape, minus enter and . backspace = 8,delete=46,tab=9,enter=13,.=190,escape=27, minus = 189
858
+ if ($.inArray(event.keyCode, [46, 8, 9, 27, 13, 110, 190, 189]) !== -1 ||
859
+ // Allow: Ctrl+A
860
+ (event.keyCode == 65 && event.ctrlKey === true) ||
861
+ // Allow: home, end, left, right, down, up
862
+ (event.keyCode >= 35 && event.keyCode <= 40)) {
863
+ // let it happen, don't do anything
864
+ return;
865
+ }
866
+
867
+ event.preventDefault();
868
+ event.stopPropagation();
869
+ },
870
+
871
+ make_media_embed_code: function(content, editor){
872
+ $.post( ajaxurl, {
873
+ action:'make_media_embed_code',
874
+ content: content
875
+ },
876
+ function(data){
877
+ // console.log(data);
878
+ editor.setContent(editor.getContent() + editor.setContent(data));
879
+ }
880
+ )
881
+ }
882
+ }
883
+ };
884
+
885
+ $(function() {
886
+ WP_User_Frontend.init();
887
+
888
+ // payment gateway selection
889
+ $('ul.wpuf-payment-gateways').on('click', 'input[type=radio]', function(e) {
890
+ $('.wpuf-payment-instruction').slideUp(250);
891
+
892
+ $(this).parents('li').find('.wpuf-payment-instruction').slideDown(250);
893
+ });
894
+
895
+ if( !$('ul.wpuf-payment-gateways li').find('input[type=radio]').is(':checked') ) {
896
+ $('ul.wpuf-payment-gateways li').first().find('input[type=radio]').click()
897
+ } else {
898
+ var el = $('ul.wpuf-payment-gateways li').find('input[type=radio]:checked');
899
+ el.parents('li').find('.wpuf-payment-instruction').slideDown(250);
900
+ }
901
+ });
902
+
903
+ })(jQuery, window);
assets/js/frontend-form.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a,b){a.fn.listautowidth=function(){return this.each(function(){var b=a(this).width(),c=b/a(this).children("li").length;a(this).children("li").each(function(){var b=a(this).outerWidth(!0)-a(this).width();a(this).width(c-b)})})},b.WP_User_Frontend={pass_val:"",retype_pass_val:"",init:function(){this.enableMultistep(this),a(".wpuf-form").on("click","img.wpuf-clone-field",this.cloneField),a(".wpuf-form").on("click","img.wpuf-remove-field",this.removeField),a(".wpuf-form").on("click","a.wpuf-delete-avatar",this.deleteAvatar),a(".wpuf-form").on("click","a#wpuf-post-draft",this.draftPost),a(".wpuf-form").on("click","button#wpuf-account-update-profile",this.account_update_profile),a(".wpuf-form-add").on("submit",this.formSubmit),a("form#post").on("submit",this.adminPostSubmit),a(".wpuf-form").on("keyup","#pass1",this.check_pass_strength),this.ajaxCategory(),a(':submit[name="wpuf_cancel_subscription"]').click(function(){if(!confirm("Are you sure you want to cancel your current subscription ?"))return!1})},check_pass_strength:function(){var b=a("#pass1").val();if(a("#pass-strength-result").show(),a("#pass-strength-result").removeClass("short bad good strong"),!b)return a("#pass-strength-result").html("&nbsp;"),void a("#pass-strength-result").hide();if(void 0!==wp.passwordStrength)switch(wp.passwordStrength.meter(b,wp.passwordStrength.userInputBlacklist(),b)){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n.short)}},enableMultistep:function(b){var c=this,d=0,e=a(':hidden[name="wpuf_multistep_type"]').val();if(null!=e){if(a("fieldset.wpuf-multistep-fieldset").find(".wpuf-multistep-prev-btn").first().remove(),a("fieldset.wpuf-multistep-fieldset").find(".wpuf-multistep-next-btn").last().remove(),a(".wpuf-form fieldset").removeClass("field-active").first().addClass("field-active"),"progressive"==e&&0!=a(".wpuf-form .wpuf-multistep-fieldset").length){a("fieldset.wpuf-multistep-fieldset legend").first();a(".wpuf-multistep-progressbar").html('<div class="wpuf-progress-percentage"></div>');var f=a(".wpuf-multistep-progressbar"),g=a(".wpuf-progress-percentage");a(".wpuf-multistep-progressbar").progressbar({change:function(){g.text(f.progressbar("value")+"%")}}),a(".wpuf-multistep-fieldset legend").hide()}else a(".wpuf-form").each(function(){var b=a(this),c=a(".wpuf-multistep-progressbar",b),d="";c.addClass("wizard-steps"),d+='<ul class="wpuf-step-wizard">',a(".wpuf-multistep-fieldset",this).each(function(){d+="<li>"+a.trim(a("legend",this).text())+"</li>",a("legend",this).hide()}),d+="</ul>",c.append(d),a(".wpuf-step-wizard li",c).first().addClass("active-step"),a(".wpuf-step-wizard",c).listautowidth()});this.change_fieldset(d,e),a("fieldset .wpuf-multistep-prev-btn, fieldset .wpuf-multistep-next-btn").click(function(f){if(a(this).hasClass("wpuf-multistep-next-btn")){0!=c.formStepCheck("",a(this).closest("fieldset"))&&b.change_fieldset(++d,e)}else a(this).hasClass("wpuf-multistep-prev-btn")&&b.change_fieldset(--d,e);return!1})}},change_fieldset:function(b,c){a("fieldset.wpuf-multistep-fieldset").removeClass("field-active").eq(b).addClass("field-active"),a(".wpuf-step-wizard li").each(function(){a(this).index()<=b?"step_by_step"==c?a(this).addClass("passed-wpuf-ms-bar"):a(".wpuf-ps-bar",this).addClass("passed-wpuf-ms-bar"):"step_by_step"==c?a(this).removeClass("passed-wpuf-ms-bar"):a(".wpuf-ps-bar",this).removeClass("passed-wpuf-ms-bar")}),a(".wpuf-step-wizard li").removeClass("wpuf-ms-bar-active active-step completed-step"),a(".passed-wpuf-ms-bar").addClass("completed-step").last().addClass("wpuf-ms-bar-active"),a(".wpuf-ms-bar-active").addClass("active-step");var d=a("fieldset.wpuf-multistep-fieldset").eq(b).find("legend").text();if(d=a.trim(d),"progressive"==c&&0!=a(".wpuf-form .wpuf-multistep-fieldset").length){var e=100*(b+1)/a("fieldset.wpuf-multistep-fieldset").length,e=Number(e.toFixed(2));a(".wpuf-multistep-progressbar").progressbar({value:e}),a(".wpuf-progress-percentage").text(d+" ("+e+"%)")}a(".wpuf-form").trigger("step-change-fieldset")},ajaxCategory:function(){var b=".category-wrap";a(b).on("change",".cat-ajax",function(){currentLevel=parseInt(a(this).parent().attr("level")),WP_User_Frontend.getChildCats(a(this),"lvl",currentLevel+1,b,"category")})},getChildCats:function(b,c,d,e,f){cat=a(b).val(),results_div=c+d,f=void 0!==f?f:"category",field_attr=a(b).siblings("span").data("taxonomy"),a.ajax({type:"post",url:wpuf_frontend.ajaxurl,data:{action:"wpuf_get_child_cat",catID:cat,nonce:wpuf_frontend.nonce,field_attr:field_attr},beforeSend:function(){a(b).parent().parent().next(".loading").addClass("wpuf-loading")},complete:function(){a(b).parent().parent().next(".loading").removeClass("wpuf-loading")},success:function(e){a(b).parent().nextAll().each(function(){a(this).remove()}),""!=e&&(a(b).parent().addClass("hasChild").parent().append('<div id="'+c+d+'" level="'+d+'"></div>'),b.parent().parent().find("#"+results_div).html(e).slideDown("fast"))}})},cloneField:function(b){b.preventDefault();var c=a(this).closest("tr"),d=c.clone();d.find("input").val(""),d.find(":checked").attr("checked",""),c.after(d)},removeField:function(){var b=a(this).closest("tr");b.siblings().andSelf().length>1&&b.remove()},adminPostSubmit:function(b){b.preventDefault();var c=a(this);if(WP_User_Frontend.validateForm(c))return!0},draftPost:function(b){b.preventDefault();var c,d,e=a(this),f=a(this).closest("form"),g=f.serialize()+"&action=wpuf_draft_post",h=f.find('input[type="hidden"][name="post_id"]').val(),i=[];a(".wpuf-rich-validation").each(function(b,e){c=a(e).data("id"),d=a.trim(tinyMCE.get(c).getContent()),i.push(c+"="+encodeURIComponent(d))}),g=g+"&"+i.join("&"),e.after(' <span class="wpuf-loading"></span>'),a.post(wpuf_frontend.ajaxurl,g,function(b){if(void 0===h){var c='<input type="hidden" name="post_id" value="'+b.post_id+'">';c+='<input type="hidden" name="post_date" value="'+b.date+'">',c+='<input type="hidden" name="post_author" value="'+b.post_author+'">',c+='<input type="hidden" name="comment_status" value="'+b.comment_status+'">',f.append(c)}e.next("span.wpuf-loading").remove(),e.after('<span class="wpuf-draft-saved">&nbsp; Post Saved</span>'),a(".wpuf-draft-saved").delay(2500).fadeOut("fast",function(){a(this).remove()})})},account_update_profile:function(b){b.preventDefault();var c=a(this).closest("form");a.post(wpuf_frontend.ajaxurl,c.serialize(),function(a){a.success?(c.find(".wpuf-error").hide(),c.find(".wpuf-success").show()):(c.find(".wpuf-success").hide(),c.find(".wpuf-error").show(),c.find(".wpuf-error").text(a.data))})},formStepCheck:function(a,b){var c=b;c.find("input[type=submit]");return form_data=WP_User_Frontend.validateForm(c),0==form_data&&WP_User_Frontend.addErrorNotice(self,"bottom"),form_data},formSubmit:function(c){c.preventDefault();var d=a(this),e=d.find("input[type=submit]");form_data=WP_User_Frontend.validateForm(d),form_data&&(d.find("li.wpuf-submit").append('<span class="wpuf-loading"></span>'),e.attr("disabled","disabled").addClass("button-primary-disabled"),a.post(wpuf_frontend.ajaxurl,form_data,function(c){if(c.success)a("body").trigger("wpuf:postform:success",c),1==c.show_message?(d.before('<div class="wpuf-success">'+c.message+"</div>"),d.slideUp("fast",function(){d.remove()}),a("html, body").animate({scrollTop:a(".wpuf-success").offset().top-100},"fast")):b.location=c.redirect_to;else{if(void 0!==c.type&&"login"===c.type)return void(confirm(c.error)?b.location=c.redirect_to:(e.removeAttr("disabled"),e.removeClass("button-primary-disabled"),d.find("span.wpuf-loading").remove()));d.find(".g-recaptcha").length>0&&grecaptcha.reset(),alert(c.error),e.removeAttr("disabled")}e.removeClass("button-primary-disabled"),d.find("span.wpuf-loading").remove()}))},validateForm:function(b){var c=!1;if(error_type="",WP_User_Frontend.removeErrors(b),WP_User_Frontend.removeErrorNotice(b),b.find('[data-required="yes"]:visible').each(function(b,d){var e=a(d).data("type");switch(h="",e){case"rich":var f=a(d).data("id");""===(h=a.trim(tinyMCE.get(f).getContent()))&&(c=!0,WP_User_Frontend.markError(d));break;case"textarea":case"text":if(a(d).hasClass("password")&&(""==WP_User_Frontend.pass_val?WP_User_Frontend.pass_val=a(d).val():WP_User_Frontend.retype_pass_val=a(d).val(),""!=WP_User_Frontend.pass_val&&""!=WP_User_Frontend.retype_pass_val&&WP_User_Frontend.pass_val!=WP_User_Frontend.retype_pass_val)){c=!0,error_type="mismatch",WP_User_Frontend.markError(d,error_type);break}""===(h=a.trim(a(d).val()))&&(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"select":(h=a(d).val())&&"-1"!==h||(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"multiselect":null!==(h=a(d).val())&&0!==h.length||(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"tax-checkbox":var g=a(d).children().find("input:checked").length;g||(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"radio":var g=a(d).find("input:checked").length;g||(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"file":var g=a(d).find("ul").children().length;g||(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"email":var h=a(d).val();""!==h?WP_User_Frontend.isValidEmail(h)||(c=!0,error_type="validation",WP_User_Frontend.markError(d,error_type)):""===h&&(c=!0,error_type="required",WP_User_Frontend.markError(d,error_type));break;case"url":var h=a(d).val();""!==h&&(WP_User_Frontend.isValidURL(h)||(c=!0,error_type="validation",WP_User_Frontend.markError(d,error_type)))}}),c)return WP_User_Frontend.addErrorNotice(b,"end"),!1;var d=b.serialize(),e=[];return a(".wpuf-rich-validation",b).each(function(b,c){var c=a(c),d=c.data("id"),f=c.data("name"),g=a.trim(tinyMCE.get(d).getContent());e.push(f+"="+encodeURIComponent(g))}),d=d+"&"+e.join("&")},addErrorNotice:function(b,c){"bottom"==c?a(".wpuf-multistep-fieldset:visible").append('<div class="wpuf-errors">'+wpuf_frontend.error_message+"</div>"):a(b).find("li.wpuf-submit").append('<div class="wpuf-errors">'+wpuf_frontend.error_message+"</div>")},removeErrorNotice:function(b){a(b).find(".wpuf-errors").remove()},markError:function(b,c){var d="";if(a(b).closest("li").addClass("has-error"),c){switch(d=a(b).closest("li").data("label"),c){case"required":d=d+" "+error_str_obj[c];break;case"mismatch":d=d+" "+error_str_obj[c];break;case"validation":d=d+" "+error_str_obj[c]}a(b).siblings(".wpuf-error-msg").remove(),a(b).after('<div class="wpuf-error-msg">'+d+"</div>")}a(b).focus()},removeErrors:function(b){a(b).find(".has-error").removeClass("has-error"),a(".wpuf-error-msg").remove()},isValidEmail:function(a){return 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)},isValidURL:function(a){return new RegExp("^(http://www.|https://www.|ftp://www.|www.|http://|https://){1}([0-9A-Za-z]+.)").test(a)},insertImage:function(b,c){if(a("#"+b).length){var d=new plupload.Uploader({runtimes:"html5,html4",browse_button:b,container:"wpuf-insert-image-container",multipart:!0,multipart_params:{action:"wpuf_insert_image",form_id:a("#"+b).data("form_id")},multiple_queues:!1,multi_selection:!1,urlstream_upload:!0,file_data_name:"wpuf_file",max_file_size:"2mb",url:wpuf_frontend_upload.plupload.url,flash_swf_url:wpuf_frontend_upload.flash_swf_url,filters:[{title:"Allowed Files",extensions:"jpg,jpeg,gif,png,bmp"}]});d.bind("Init",function(a,b){}),d.bind("FilesAdded",function(b,c){var d=a("#wpuf-insert-image-container");a.each(c,function(a,b){d.append('<div class="upload-item" id="'+b.id+'"><div class="progress progress-striped active"><div class="bar"></div></div></div>')}),b.refresh(),b.start()}),d.bind("QueueChanged",function(a){d.start()}),d.bind("UploadProgress",function(b,c){var d=a("#"+c.id);a(".bar",d).css({width:c.percent+"%"}),a(".percent",d).html(c.percent+"%")}),d.bind("Error",function(a,b){alert("Error #"+b.code+": "+b.message)}),d.bind("FileUploaded",function(b,d,e){if(a("#"+d.id).remove(),"error"!==e.response){if("undefined"!=typeof tinyMCE)if("function"!=typeof tinyMCE.execInstanceCommand){var f=tinyMCE.get("post_content_"+c);null!==f&&f.insertContent(e.response)}else tinyMCE.execInstanceCommand("post_content_"+c,"mceInsertContent",!1,e.response);var g=a("#post_content_"+c);g.val(g.val()+e.response)}else alert("Something went wrong")}),d.init()}},deleteAvatar:function(b){b.preventDefault(),confirm(a(this).data("confirm"))&&a.post(wpuf_frontend.ajaxurl,{action:"wpuf_delete_avatar",_wpnonce:wpuf_frontend.nonce},function(){a(b.target).parent().remove()})},editorLimit:{bind:function(b,c,d){"no"===d?(a("textarea#"+c).keydown(function(a){WP_User_Frontend.editorLimit.textLimit.call(this,a,b)}),a("input#"+c).keydown(function(a){WP_User_Frontend.editorLimit.textLimit.call(this,a,b)}),a("textarea#"+c).on("paste",function(c){var d=a(this);setTimeout(function(){WP_User_Frontend.editorLimit.textLimit.call(d,c,b)},100)}),a("input#"+c).on("paste",function(c){var d=a(this);setTimeout(function(){WP_User_Frontend.editorLimit.textLimit.call(d,c,b)},100)})):setTimeout(function(){tinyMCE.get(c).onKeyDown.add(function(a,c){WP_User_Frontend.editorLimit.tinymce.onKeyDown(a,c,b)}),tinyMCE.get(c).onPaste.add(function(a,c){setTimeout(function(){WP_User_Frontend.editorLimit.tinymce.onPaste(a,c,b)},100)})},1e3)},tinymce:{getStats:function(a){var b=a.getBody(),c=tinymce.trim(b.innerText||b.textContent);return{chars:c.length,words:c.split(/[\w\u2019\'-]+/).length}},onKeyDown:function(b,c,d){var e=WP_User_Frontend.editorLimit.tinymce.getStats(b).words-1;d&&a(".mce-path-item.mce-last",b.container).html("Word Limit : "+e+"/"+d),d&&e>d&&(WP_User_Frontend.editorLimit.blockTyping(c),jQuery(".mce-path-item.mce-last",b.container).html(wpuf_frontend.word_limit))},onPaste:function(a,b,c){var d=a.getContent().split(" ").slice(0,c).join(" ");a.setContent(d),WP_User_Frontend.editorLimit.make_media_embed_code(d,a)}},textLimit:function(b,c){var d=a(this),e=d.val().split(" ");c&&e.length>c?(d.closest(".wpuf-fields").find("span.wpuf-wordlimit-message").html(wpuf_frontend.word_limit),WP_User_Frontend.editorLimit.blockTyping(b)):d.closest(".wpuf-fields").find("span.wpuf-wordlimit-message").html(""),"paste"===b.type&&d.val(e.slice(0,c).join(" "))},blockTyping:function(b){a.inArray(b.keyCode,[46,8,9,27,13,110,190,189])!==-1||65==b.keyCode&&b.ctrlKey===!0||b.keyCode>=35&&b.keyCode<=40||(b.preventDefault(),b.stopPropagation())},make_media_embed_code:function(b,c){a.post(ajaxurl,{action:"make_media_embed_code",content:b},function(a){c.setContent(c.getContent()+c.setContent(a))})}}},a(function(){if(WP_User_Frontend.init(),a("ul.wpuf-payment-gateways").on("click","input[type=radio]",function(b){a(".wpuf-payment-instruction").slideUp(250),a(this).parents("li").find(".wpuf-payment-instruction").slideDown(250)}),a("ul.wpuf-payment-gateways li").find("input[type=radio]").is(":checked")){a("ul.wpuf-payment-gateways li").find("input[type=radio]:checked").parents("li").find(".wpuf-payment-instruction").slideDown(250)}else a("ul.wpuf-payment-gateways li").first().find("input[type=radio]").click()})}(jQuery,window);
assets/js/jquery-ui-timepicker-addon.js ADDED
@@ -0,0 +1,1919 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery timepicker addon
3
+ * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 1.2
5
+ * Last Modified: 02/02/2013
6
+ *
7
+ * Copyright 2013 Trent Richardson
8
+ * You may use this project under MIT or GPL licenses.
9
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
+ */
12
+
13
+ /*jslint evil: true, white: false, undef: false, nomen: false */
14
+
15
+ (function($) {
16
+
17
+ /*
18
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
19
+ */
20
+ $.ui.timepicker = $.ui.timepicker || {};
21
+ if ($.ui.timepicker.version) {
22
+ return;
23
+ }
24
+
25
+ /*
26
+ * Extend jQueryUI, get it started with our version number
27
+ */
28
+ $.extend($.ui, {
29
+ timepicker: {
30
+ version: "1.2"
31
+ }
32
+ });
33
+
34
+ /*
35
+ * Timepicker manager.
36
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
37
+ * Settings for (groups of) time pickers are maintained in an instance object,
38
+ * allowing multiple different settings on the same page.
39
+ */
40
+ var Timepicker = function() {
41
+ this.regional = []; // Available regional settings, indexed by language code
42
+ this.regional[''] = { // Default regional settings
43
+ currentText: 'Now',
44
+ closeText: 'Done',
45
+ amNames: ['AM', 'A'],
46
+ pmNames: ['PM', 'P'],
47
+ timeFormat: 'HH:mm',
48
+ timeSuffix: '',
49
+ timeOnlyTitle: 'Choose Time',
50
+ timeText: 'Time',
51
+ hourText: 'Hour',
52
+ minuteText: 'Minute',
53
+ secondText: 'Second',
54
+ millisecText: 'Millisecond',
55
+ timezoneText: 'Time Zone',
56
+ isRTL: false
57
+ };
58
+ this._defaults = { // Global defaults for all the datetime picker instances
59
+ showButtonPanel: true,
60
+ timeOnly: false,
61
+ showHour: true,
62
+ showMinute: true,
63
+ showSecond: false,
64
+ showMillisec: false,
65
+ showTimezone: false,
66
+ showTime: true,
67
+ stepHour: 1,
68
+ stepMinute: 1,
69
+ stepSecond: 1,
70
+ stepMillisec: 1,
71
+ hour: 0,
72
+ minute: 0,
73
+ second: 0,
74
+ millisec: 0,
75
+ timezone: null,
76
+ useLocalTimezone: false,
77
+ defaultTimezone: "+0000",
78
+ hourMin: 0,
79
+ minuteMin: 0,
80
+ secondMin: 0,
81
+ millisecMin: 0,
82
+ hourMax: 23,
83
+ minuteMax: 59,
84
+ secondMax: 59,
85
+ millisecMax: 999,
86
+ minDateTime: null,
87
+ maxDateTime: null,
88
+ onSelect: null,
89
+ hourGrid: 0,
90
+ minuteGrid: 0,
91
+ secondGrid: 0,
92
+ millisecGrid: 0,
93
+ alwaysSetTime: true,
94
+ separator: ' ',
95
+ altFieldTimeOnly: true,
96
+ altTimeFormat: null,
97
+ altSeparator: null,
98
+ altTimeSuffix: null,
99
+ pickerTimeFormat: null,
100
+ pickerTimeSuffix: null,
101
+ showTimepicker: true,
102
+ timezoneIso8601: false,
103
+ timezoneList: null,
104
+ addSliderAccess: false,
105
+ sliderAccessArgs: null,
106
+ controlType: 'slider',
107
+ defaultValue: null,
108
+ parse: 'strict'
109
+ };
110
+ $.extend(this._defaults, this.regional['']);
111
+ };
112
+
113
+ $.extend(Timepicker.prototype, {
114
+ $input: null,
115
+ $altInput: null,
116
+ $timeObj: null,
117
+ inst: null,
118
+ hour_slider: null,
119
+ minute_slider: null,
120
+ second_slider: null,
121
+ millisec_slider: null,
122
+ timezone_select: null,
123
+ hour: 0,
124
+ minute: 0,
125
+ second: 0,
126
+ millisec: 0,
127
+ timezone: null,
128
+ defaultTimezone: "+0000",
129
+ hourMinOriginal: null,
130
+ minuteMinOriginal: null,
131
+ secondMinOriginal: null,
132
+ millisecMinOriginal: null,
133
+ hourMaxOriginal: null,
134
+ minuteMaxOriginal: null,
135
+ secondMaxOriginal: null,
136
+ millisecMaxOriginal: null,
137
+ ampm: '',
138
+ formattedDate: '',
139
+ formattedTime: '',
140
+ formattedDateTime: '',
141
+ timezoneList: null,
142
+ units: ['hour','minute','second','millisec'],
143
+ control: null,
144
+
145
+ /*
146
+ * Override the default settings for all instances of the time picker.
147
+ * @param settings object - the new settings to use as defaults (anonymous object)
148
+ * @return the manager object
149
+ */
150
+ setDefaults: function(settings) {
151
+ extendRemove(this._defaults, settings || {});
152
+ return this;
153
+ },
154
+
155
+ /*
156
+ * Create a new Timepicker instance
157
+ */
158
+ _newInst: function($input, o) {
159
+ var tp_inst = new Timepicker(),
160
+ inlineSettings = {},
161
+ fns = {},
162
+ overrides, i;
163
+
164
+ for (var attrName in this._defaults) {
165
+ if(this._defaults.hasOwnProperty(attrName)){
166
+ var attrValue = $input.attr('time:' + attrName);
167
+ if (attrValue) {
168
+ try {
169
+ inlineSettings[attrName] = eval(attrValue);
170
+ } catch (err) {
171
+ inlineSettings[attrName] = attrValue;
172
+ }
173
+ }
174
+ }
175
+ }
176
+ overrides = {
177
+ beforeShow: function (input, dp_inst) {
178
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
179
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
180
+ }
181
+ },
182
+ onChangeMonthYear: function (year, month, dp_inst) {
183
+ // Update the time as well : this prevents the time from disappearing from the $input field.
184
+ tp_inst._updateDateTime(dp_inst);
185
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
186
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
187
+ }
188
+ },
189
+ onClose: function (dateText, dp_inst) {
190
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
191
+ tp_inst._updateDateTime(dp_inst);
192
+ }
193
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
194
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
195
+ }
196
+ }
197
+ };
198
+ for (i in overrides) {
199
+ if (overrides.hasOwnProperty(i)) {
200
+ fns[i] = o[i] || null;
201
+ }
202
+ }
203
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
204
+ evnts:fns,
205
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
206
+ });
207
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) {
208
+ return val.toUpperCase();
209
+ });
210
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) {
211
+ return val.toUpperCase();
212
+ });
213
+
214
+ // controlType is string - key to our this._controls
215
+ if(typeof(tp_inst._defaults.controlType) === 'string'){
216
+ if($.fn[tp_inst._defaults.controlType] === undefined){
217
+ tp_inst._defaults.controlType = 'select';
218
+ }
219
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
220
+ }
221
+ // controlType is an object and must implement create, options, value methods
222
+ else{
223
+ tp_inst.control = tp_inst._defaults.controlType;
224
+ }
225
+
226
+ if (tp_inst._defaults.timezoneList === null) {
227
+ var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000',
228
+ '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930',
229
+ '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
230
+
231
+ if (tp_inst._defaults.timezoneIso8601) {
232
+ timezoneList = $.map(timezoneList, function(val) {
233
+ return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
234
+ });
235
+ }
236
+ tp_inst._defaults.timezoneList = timezoneList;
237
+ }
238
+
239
+ tp_inst.timezone = tp_inst._defaults.timezone;
240
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
241
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
242
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
243
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
244
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin :
245
+ tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
246
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
247
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
248
+ tp_inst.ampm = '';
249
+ tp_inst.$input = $input;
250
+
251
+ if (o.altField) {
252
+ tp_inst.$altInput = $(o.altField).css({
253
+ cursor: 'pointer'
254
+ }).focus(function() {
255
+ $input.trigger("focus");
256
+ });
257
+ }
258
+
259
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
260
+ tp_inst._defaults.minDate = new Date();
261
+ }
262
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
263
+ tp_inst._defaults.maxDate = new Date();
264
+ }
265
+
266
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
267
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
268
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
269
+ }
270
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
271
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
272
+ }
273
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
274
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
275
+ }
276
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
277
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
278
+ }
279
+ tp_inst.$input.bind('focus', function() {
280
+ tp_inst._onFocus();
281
+ });
282
+
283
+ return tp_inst;
284
+ },
285
+
286
+ /*
287
+ * add our sliders to the calendar
288
+ */
289
+ _addTimePicker: function(dp_inst) {
290
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
291
+
292
+ this.timeDefined = this._parseTime(currDT);
293
+ this._limitMinMaxDateTime(dp_inst, false);
294
+ this._injectTimePicker();
295
+ },
296
+
297
+ /*
298
+ * parse the time string from input value or _setTime
299
+ */
300
+ _parseTime: function(timeString, withDate) {
301
+ if (!this.inst) {
302
+ this.inst = $.datepicker._getInst(this.$input[0]);
303
+ }
304
+
305
+ if (withDate || !this._defaults.timeOnly) {
306
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
307
+ try {
308
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
309
+ if (!parseRes.timeObj) {
310
+ return false;
311
+ }
312
+ $.extend(this, parseRes.timeObj);
313
+ } catch (err) {
314
+ $.timepicker.log("Error parsing the date/time string: " + err +
315
+ "\ndate/time string = " + timeString +
316
+ "\ntimeFormat = " + this._defaults.timeFormat +
317
+ "\ndateFormat = " + dp_dateFormat);
318
+ return false;
319
+ }
320
+ return true;
321
+ } else {
322
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
323
+ if (!timeObj) {
324
+ return false;
325
+ }
326
+ $.extend(this, timeObj);
327
+ return true;
328
+ }
329
+ },
330
+
331
+ /*
332
+ * generate and inject html for timepicker into ui datepicker
333
+ */
334
+ _injectTimePicker: function() {
335
+ var $dp = this.inst.dpDiv,
336
+ o = this.inst.settings,
337
+ tp_inst = this,
338
+ litem = '',
339
+ uitem = '',
340
+ max = {},
341
+ gridSize = {},
342
+ size = null;
343
+
344
+ // Prevent displaying twice
345
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
346
+ var noDisplay = ' style="display:none;"',
347
+ html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
348
+ '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
349
+
350
+ // Create the markup
351
+ for(var i=0,l=this.units.length; i<l; i++){
352
+ litem = this.units[i];
353
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
354
+ // Added by Peter Medeiros:
355
+ // - Figure out what the hour/minute/second max should be based on the step values.
356
+ // - Example: if stepMinute is 15, then minMax is 45.
357
+ max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
358
+ gridSize[litem] = 0;
359
+
360
+ html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' +
361
+ '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + ((o['show'+uitem]) ? '' : noDisplay) + '></div>';
362
+
363
+ if (o['show'+uitem] && o[litem+'Grid'] > 0) {
364
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
365
+
366
+ if(litem == 'hour'){
367
+ for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
368
+ gridSize[litem]++;
369
+ var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o);
370
+ html += '<td data-for="'+litem+'">' + tmph + '</td>';
371
+ }
372
+ }
373
+ else{
374
+ for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) {
375
+ gridSize[litem]++;
376
+ html += '<td data-for="'+litem+'">' + ((m < 10) ? '0' : '') + m + '</td>';
377
+ }
378
+ }
379
+
380
+ html += '</tr></table></div>';
381
+ }
382
+ html += '</dd>';
383
+ }
384
+
385
+ // Timezone
386
+ html += '<dt class="ui_tpicker_timezone_label"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
387
+ html += '<dd class="ui_tpicker_timezone" ' + ((o.showTimezone) ? '' : noDisplay) + '></dd>';
388
+
389
+ // Create the elements from string
390
+ html += '</dl></div>';
391
+ var $tp = $(html);
392
+
393
+ // if we only want time picker...
394
+ if (o.timeOnly === true) {
395
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
396
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
397
+ }
398
+
399
+ // add sliders, adjust grids, add events
400
+ for(var i=0,l=tp_inst.units.length; i<l; i++){
401
+ litem = tp_inst.units[i];
402
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
403
+
404
+ // add the slider
405
+ tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
406
+
407
+ // adjust the grid and add click event
408
+ if (o['show'+uitem] && o[litem+'Grid'] > 0) {
409
+ size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
410
+ $tp.find('.ui_tpicker_'+litem+' table').css({
411
+ width: size + "%",
412
+ marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"),
413
+ marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0',
414
+ borderCollapse: 'collapse'
415
+ }).find("td").click(function(e){
416
+ var $t = $(this),
417
+ h = $t.html(),
418
+ n = parseInt(h.replace(/[^0-9]/g),10),
419
+ ap = h.replace(/[^apm]/ig),
420
+ f = $t.data('for'); // loses scope, so we use data-for
421
+
422
+ if(f == 'hour'){
423
+ if(ap.indexOf('p') !== -1 && n < 12){
424
+ n += 12;
425
+ }
426
+ else{
427
+ if(ap.indexOf('a') !== -1 && n === 12){
428
+ n = 0;
429
+ }
430
+ }
431
+ }
432
+
433
+ tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n);
434
+
435
+ tp_inst._onTimeChange();
436
+ tp_inst._onSelectHandler();
437
+ })
438
+ .css({
439
+ cursor: 'pointer',
440
+ width: (100 / gridSize[litem]) + '%',
441
+ textAlign: 'center',
442
+ overflow: 'hidden'
443
+ });
444
+ } // end if grid > 0
445
+ } // end for loop
446
+
447
+ // Add timezone options
448
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
449
+ $.fn.append.apply(this.timezone_select,
450
+ $.map(o.timezoneList, function(val, idx) {
451
+ return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
452
+ }));
453
+ if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
454
+ var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
455
+ var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
456
+ if (local_timezone == this.timezone) {
457
+ selectLocalTimeZone(tp_inst);
458
+ } else {
459
+ this.timezone_select.val(this.timezone);
460
+ }
461
+ } else {
462
+ if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
463
+ this.timezone_select.val(o.defaultTimezone);
464
+ } else {
465
+ selectLocalTimeZone(tp_inst);
466
+ }
467
+ }
468
+ this.timezone_select.change(function() {
469
+ tp_inst._defaults.useLocalTimezone = false;
470
+ tp_inst._onTimeChange();
471
+ tp_inst._onSelectHandler();
472
+ });
473
+ // End timezone options
474
+
475
+ // inject timepicker into datepicker
476
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
477
+ if ($buttonPanel.length) {
478
+ $buttonPanel.before($tp);
479
+ } else {
480
+ $dp.append($tp);
481
+ }
482
+
483
+ this.$timeObj = $tp.find('.ui_tpicker_time');
484
+
485
+ if (this.inst !== null) {
486
+ var timeDefined = this.timeDefined;
487
+ this._onTimeChange();
488
+ this.timeDefined = timeDefined;
489
+ }
490
+
491
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
492
+ if (this._defaults.addSliderAccess) {
493
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
494
+ rtl = this._defaults.isRTL;
495
+ sliderAccessArgs.isRTL = rtl;
496
+
497
+ setTimeout(function() { // fix for inline mode
498
+ if ($tp.find('.ui-slider-access').length === 0) {
499
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
500
+
501
+ // fix any grids since sliders are shorter
502
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
503
+ if (sliderAccessWidth) {
504
+ $tp.find('table:visible').each(function() {
505
+ var $g = $(this),
506
+ oldWidth = $g.outerWidth(),
507
+ oldMarginLeft = $g.css(rtl? 'marginRight':'marginLeft').toString().replace('%', ''),
508
+ newWidth = oldWidth - sliderAccessWidth,
509
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
510
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
511
+ css[rtl? 'marginRight':'marginLeft'] = newMarginLeft;
512
+ $g.css(css);
513
+ });
514
+ }
515
+ }
516
+ }, 10);
517
+ }
518
+ // end slideAccess integration
519
+
520
+ }
521
+ },
522
+
523
+ /*
524
+ * This function tries to limit the ability to go outside the
525
+ * min/max date range
526
+ */
527
+ _limitMinMaxDateTime: function(dp_inst, adjustSliders) {
528
+ var o = this._defaults,
529
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
530
+
531
+ if (!this._defaults.showTimepicker) {
532
+ return;
533
+ } // No time so nothing to check here
534
+
535
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
536
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
537
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
538
+
539
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null) {
540
+ this.hourMinOriginal = o.hourMin;
541
+ this.minuteMinOriginal = o.minuteMin;
542
+ this.secondMinOriginal = o.secondMin;
543
+ this.millisecMinOriginal = o.millisecMin;
544
+ }
545
+
546
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
547
+ this._defaults.hourMin = minDateTime.getHours();
548
+ if (this.hour <= this._defaults.hourMin) {
549
+ this.hour = this._defaults.hourMin;
550
+ this._defaults.minuteMin = minDateTime.getMinutes();
551
+ if (this.minute <= this._defaults.minuteMin) {
552
+ this.minute = this._defaults.minuteMin;
553
+ this._defaults.secondMin = minDateTime.getSeconds();
554
+ if (this.second <= this._defaults.secondMin) {
555
+ this.second = this._defaults.secondMin;
556
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
557
+ } else {
558
+ if (this.millisec < this._defaults.millisecMin) {
559
+ this.millisec = this._defaults.millisecMin;
560
+ }
561
+ this._defaults.millisecMin = this.millisecMinOriginal;
562
+ }
563
+ } else {
564
+ this._defaults.secondMin = this.secondMinOriginal;
565
+ this._defaults.millisecMin = this.millisecMinOriginal;
566
+ }
567
+ } else {
568
+ this._defaults.minuteMin = this.minuteMinOriginal;
569
+ this._defaults.secondMin = this.secondMinOriginal;
570
+ this._defaults.millisecMin = this.millisecMinOriginal;
571
+ }
572
+ } else {
573
+ this._defaults.hourMin = this.hourMinOriginal;
574
+ this._defaults.minuteMin = this.minuteMinOriginal;
575
+ this._defaults.secondMin = this.secondMinOriginal;
576
+ this._defaults.millisecMin = this.millisecMinOriginal;
577
+ }
578
+ }
579
+
580
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
581
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
582
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
583
+
584
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null) {
585
+ this.hourMaxOriginal = o.hourMax;
586
+ this.minuteMaxOriginal = o.minuteMax;
587
+ this.secondMaxOriginal = o.secondMax;
588
+ this.millisecMaxOriginal = o.millisecMax;
589
+ }
590
+
591
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
592
+ this._defaults.hourMax = maxDateTime.getHours();
593
+ if (this.hour >= this._defaults.hourMax) {
594
+ this.hour = this._defaults.hourMax;
595
+ this._defaults.minuteMax = maxDateTime.getMinutes();
596
+ if (this.minute >= this._defaults.minuteMax) {
597
+ this.minute = this._defaults.minuteMax;
598
+ this._defaults.secondMax = maxDateTime.getSeconds();
599
+ if (this.second >= this._defaults.secondMax) {
600
+ this.second = this._defaults.secondMax;
601
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
602
+ } else {
603
+ if (this.millisec > this._defaults.millisecMax) {
604
+ this.millisec = this._defaults.millisecMax;
605
+ }
606
+ this._defaults.millisecMax = this.millisecMaxOriginal;
607
+ }
608
+ } else {
609
+ this._defaults.secondMax = this.secondMaxOriginal;
610
+ this._defaults.millisecMax = this.millisecMaxOriginal;
611
+ }
612
+ } else {
613
+ this._defaults.minuteMax = this.minuteMaxOriginal;
614
+ this._defaults.secondMax = this.secondMaxOriginal;
615
+ this._defaults.millisecMax = this.millisecMaxOriginal;
616
+ }
617
+ } else {
618
+ this._defaults.hourMax = this.hourMaxOriginal;
619
+ this._defaults.minuteMax = this.minuteMaxOriginal;
620
+ this._defaults.secondMax = this.secondMaxOriginal;
621
+ this._defaults.millisecMax = this.millisecMaxOriginal;
622
+ }
623
+ }
624
+
625
+ if (adjustSliders !== undefined && adjustSliders === true) {
626
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
627
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
628
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
629
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
630
+
631
+ if (this.hour_slider) {
632
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
633
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
634
+ }
635
+ if (this.minute_slider) {
636
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
637
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
638
+ }
639
+ if (this.second_slider) {
640
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
641
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
642
+ }
643
+ if (this.millisec_slider) {
644
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
645
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
646
+ }
647
+ }
648
+
649
+ },
650
+
651
+ /*
652
+ * when a slider moves, set the internal time...
653
+ * on time change is also called when the time is updated in the text field
654
+ */
655
+ _onTimeChange: function() {
656
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
657
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
658
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
659
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
660
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
661
+ o = this._defaults,
662
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
663
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
664
+
665
+ if (typeof(hour) == 'object') {
666
+ hour = false;
667
+ }
668
+ if (typeof(minute) == 'object') {
669
+ minute = false;
670
+ }
671
+ if (typeof(second) == 'object') {
672
+ second = false;
673
+ }
674
+ if (typeof(millisec) == 'object') {
675
+ millisec = false;
676
+ }
677
+ if (typeof(timezone) == 'object') {
678
+ timezone = false;
679
+ }
680
+
681
+ if (hour !== false) {
682
+ hour = parseInt(hour, 10);
683
+ }
684
+ if (minute !== false) {
685
+ minute = parseInt(minute, 10);
686
+ }
687
+ if (second !== false) {
688
+ second = parseInt(second, 10);
689
+ }
690
+ if (millisec !== false) {
691
+ millisec = parseInt(millisec, 10);
692
+ }
693
+
694
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
695
+
696
+ // If the update was done in the input field, the input field should not be updated.
697
+ // If the update was done using the sliders, update the input field.
698
+ var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec
699
+ || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
700
+ || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
701
+
702
+ if (hasChanged) {
703
+
704
+ if (hour !== false) {
705
+ this.hour = hour;
706
+ }
707
+ if (minute !== false) {
708
+ this.minute = minute;
709
+ }
710
+ if (second !== false) {
711
+ this.second = second;
712
+ }
713
+ if (millisec !== false) {
714
+ this.millisec = millisec;
715
+ }
716
+ if (timezone !== false) {
717
+ this.timezone = timezone;
718
+ }
719
+
720
+ if (!this.inst) {
721
+ this.inst = $.datepicker._getInst(this.$input[0]);
722
+ }
723
+
724
+ this._limitMinMaxDateTime(this.inst, true);
725
+ }
726
+ if (useAmpm(o.timeFormat)) {
727
+ this.ampm = ampm;
728
+ }
729
+
730
+ // Updates the time within the timepicker
731
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
732
+ if (this.$timeObj) {
733
+ if(pickerTimeFormat === o.timeFormat){
734
+ this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
735
+ }
736
+ else{
737
+ this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
738
+ }
739
+ }
740
+
741
+ this.timeDefined = true;
742
+ if (hasChanged) {
743
+ this._updateDateTime();
744
+ }
745
+ },
746
+
747
+ /*
748
+ * call custom onSelect.
749
+ * bind to sliders slidestop, and grid click.
750
+ */
751
+ _onSelectHandler: function() {
752
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
753
+ var inputEl = this.$input ? this.$input[0] : null;
754
+ if (onSelect && inputEl) {
755
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
756
+ }
757
+ },
758
+
759
+ /*
760
+ * update our input with the new date time..
761
+ */
762
+ _updateDateTime: function(dp_inst) {
763
+ dp_inst = this.inst || dp_inst;
764
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
765
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
766
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
767
+ timeAvailable = dt !== null && this.timeDefined;
768
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
769
+ var formattedDateTime = this.formattedDate;
770
+
771
+ // if a slider was changed but datepicker doesn't have a value yet, set it
772
+ if(dp_inst.lastVal==""){
773
+ dp_inst.currentYear=dp_inst.selectedYear;
774
+ dp_inst.currentMonth=dp_inst.selectedMonth;
775
+ dp_inst.currentDay=dp_inst.selectedDay;
776
+ }
777
+
778
+ /*
779
+ * remove following lines to force every changes in date picker to change the input value
780
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
781
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
782
+ */
783
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
784
+ // return;
785
+ //}
786
+
787
+ if (this._defaults.timeOnly === true) {
788
+ formattedDateTime = this.formattedTime;
789
+ } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
790
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
791
+ }
792
+
793
+ this.formattedDateTime = formattedDateTime;
794
+
795
+ if (!this._defaults.showTimepicker) {
796
+ this.$input.val(this.formattedDate);
797
+ } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
798
+ this.$altInput.val(this.formattedTime);
799
+ this.$input.val(this.formattedDate);
800
+ } else if (this.$altInput) {
801
+ this.$input.val(formattedDateTime);
802
+ var altFormattedDateTime = '',
803
+ altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
804
+ altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
805
+
806
+ if (this._defaults.altFormat) altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
807
+ else altFormattedDateTime = this.formattedDate;
808
+ if (altFormattedDateTime) altFormattedDateTime += altSeparator;
809
+ if (this._defaults.altTimeFormat) altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
810
+ else altFormattedDateTime += this.formattedTime + altTimeSuffix;
811
+ this.$altInput.val(altFormattedDateTime);
812
+ } else {
813
+ this.$input.val(formattedDateTime);
814
+ }
815
+
816
+ this.$input.trigger("change");
817
+ },
818
+
819
+ _onFocus: function() {
820
+ if (!this.$input.val() && this._defaults.defaultValue) {
821
+ this.$input.val(this._defaults.defaultValue);
822
+ var inst = $.datepicker._getInst(this.$input.get(0)),
823
+ tp_inst = $.datepicker._get(inst, 'timepicker');
824
+ if (tp_inst) {
825
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
826
+ try {
827
+ $.datepicker._updateDatepicker(inst);
828
+ } catch (err) {
829
+ $.timepicker.log(err);
830
+ }
831
+ }
832
+ }
833
+ }
834
+ },
835
+
836
+ /*
837
+ * Small abstraction to control types
838
+ * We can add more, just be sure to follow the pattern: create, options, value
839
+ */
840
+ _controls: {
841
+ // slider methods
842
+ slider: {
843
+ create: function(tp_inst, obj, unit, val, min, max, step){
844
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
845
+ return obj.prop('slide', null).slider({
846
+ orientation: "horizontal",
847
+ value: rtl? val*-1 : val,
848
+ min: rtl? max*-1 : min,
849
+ max: rtl? min*-1 : max,
850
+ step: step,
851
+ slide: function(event, ui) {
852
+ tp_inst.control.value(tp_inst, $(this), unit, rtl? ui.value*-1:ui.value);
853
+ tp_inst._onTimeChange();
854
+ },
855
+ stop: function(event, ui) {
856
+ tp_inst._onSelectHandler();
857
+ }
858
+ });
859
+ },
860
+ options: function(tp_inst, obj, unit, opts, val){
861
+ if(tp_inst._defaults.isRTL){
862
+ if(typeof(opts) == 'string'){
863
+ if(opts == 'min' || opts == 'max'){
864
+ if(val !== undefined)
865
+ return obj.slider(opts, val*-1);
866
+ return Math.abs(obj.slider(opts));
867
+ }
868
+ return obj.slider(opts);
869
+ }
870
+ var min = opts.min,
871
+ max = opts.max;
872
+ opts.min = opts.max = null;
873
+ if(min !== undefined)
874
+ opts.max = min * -1;
875
+ if(max !== undefined)
876
+ opts.min = max * -1;
877
+ return obj.slider(opts);
878
+ }
879
+ if(typeof(opts) == 'string' && val !== undefined)
880
+ return obj.slider(opts, val);
881
+ return obj.slider(opts);
882
+ },
883
+ value: function(tp_inst, obj, unit, val){
884
+ if(tp_inst._defaults.isRTL){
885
+ if(val !== undefined)
886
+ return obj.slider('value', val*-1);
887
+ return Math.abs(obj.slider('value'));
888
+ }
889
+ if(val !== undefined)
890
+ return obj.slider('value', val);
891
+ return obj.slider('value');
892
+ }
893
+ },
894
+ // select methods
895
+ select: {
896
+ create: function(tp_inst, obj, unit, val, min, max, step){
897
+ var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
898
+ ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
899
+ m = 0;
900
+
901
+ for(var i=min; i<=max; i+=step){
902
+ sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
903
+ if(unit == 'hour' && useAmpm(tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat))
904
+ sel += $.datepicker.formatTime("hh TT", {hour:i}, tp_inst._defaults);
905
+ else if(unit == 'millisec' || i >= 10) sel += i;
906
+ else sel += '0'+ i.toString();
907
+ sel += '</option>';
908
+ }
909
+ sel += '</select>';
910
+
911
+ obj.children('select').remove();
912
+
913
+ $(sel).appendTo(obj).change(function(e){
914
+ tp_inst._onTimeChange();
915
+ tp_inst._onSelectHandler();
916
+ });
917
+
918
+ return obj;
919
+ },
920
+ options: function(tp_inst, obj, unit, opts, val){
921
+ var o = {},
922
+ $t = obj.children('select');
923
+ if(typeof(opts) == 'string'){
924
+ if(val === undefined)
925
+ return $t.data(opts);
926
+ o[opts] = val;
927
+ }
928
+ else o = opts;
929
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
930
+ },
931
+ value: function(tp_inst, obj, unit, val){
932
+ var $t = obj.children('select');
933
+ if(val !== undefined)
934
+ return $t.val(val);
935
+ return $t.val();
936
+ }
937
+ }
938
+ } // end _controls
939
+
940
+ });
941
+
942
+ $.fn.extend({
943
+ /*
944
+ * shorthand just to use timepicker..
945
+ */
946
+ timepicker: function(o) {
947
+ o = o || {};
948
+ var tmp_args = Array.prototype.slice.call(arguments);
949
+
950
+ if (typeof o == 'object') {
951
+ tmp_args[0] = $.extend(o, {
952
+ timeOnly: true
953
+ });
954
+ }
955
+
956
+ return $(this).each(function() {
957
+ $.fn.datetimepicker.apply($(this), tmp_args);
958
+ });
959
+ },
960
+
961
+ /*
962
+ * extend timepicker to datepicker
963
+ */
964
+ datetimepicker: function(o) {
965
+ o = o || {};
966
+ var tmp_args = arguments;
967
+
968
+ if (typeof(o) == 'string') {
969
+ if (o == 'getDate') {
970
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
971
+ } else {
972
+ return this.each(function() {
973
+ var $t = $(this);
974
+ $t.datepicker.apply($t, tmp_args);
975
+ });
976
+ }
977
+ } else {
978
+ return this.each(function() {
979
+ var $t = $(this);
980
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
981
+ });
982
+ }
983
+ }
984
+ });
985
+
986
+ /*
987
+ * Public Utility to parse date and time
988
+ */
989
+ $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
990
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
991
+ if (parseRes.timeObj) {
992
+ var t = parseRes.timeObj;
993
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
994
+ }
995
+
996
+ return parseRes.date;
997
+ };
998
+
999
+ /*
1000
+ * Public utility to parse time
1001
+ */
1002
+ $.datepicker.parseTime = function(timeFormat, timeString, options) {
1003
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
1004
+
1005
+ // Strict parse requires the timeString to match the timeFormat exactly
1006
+ var strictParse = function(f, s, o){
1007
+
1008
+ // pattern for standard and localized AM/PM markers
1009
+ var getPatternAmpm = function(amNames, pmNames) {
1010
+ var markers = [];
1011
+ if (amNames) {
1012
+ $.merge(markers, amNames);
1013
+ }
1014
+ if (pmNames) {
1015
+ $.merge(markers, pmNames);
1016
+ }
1017
+ markers = $.map(markers, function(val) {
1018
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1019
+ });
1020
+ return '(' + markers.join('|') + ')?';
1021
+ };
1022
+
1023
+ // figure out position of time elements.. cause js cant do named captures
1024
+ var getFormatPositions = function(timeFormat) {
1025
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z|'.*?')/g),
1026
+ orders = {
1027
+ h: -1,
1028
+ m: -1,
1029
+ s: -1,
1030
+ l: -1,
1031
+ t: -1,
1032
+ z: -1
1033
+ };
1034
+
1035
+ if (finds) {
1036
+ for (var i = 0; i < finds.length; i++) {
1037
+ if (orders[finds[i].toString().charAt(0)] == -1) {
1038
+ orders[finds[i].toString().charAt(0)] = i + 1;
1039
+ }
1040
+ }
1041
+ }
1042
+ return orders;
1043
+ };
1044
+
1045
+ var regstr = '^' + f.toString()
1046
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {
1047
+ var ml = match.length;
1048
+ switch (match.charAt(0).toLowerCase()) {
1049
+ case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1050
+ case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1051
+ case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1052
+ case 'l': return '(\\d?\\d?\\d)';
1053
+ case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1054
+ case 't': return getPatternAmpm(o.amNames, o.pmNames);
1055
+ default: // literal escaped in quotes
1056
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1057
+ }
1058
+ })
1059
+ .replace(/\s/g, '\\s?') +
1060
+ o.timeSuffix + '$',
1061
+ order = getFormatPositions(f),
1062
+ ampm = '',
1063
+ treg;
1064
+
1065
+ treg = s.match(new RegExp(regstr, 'i'));
1066
+
1067
+ var resTime = {
1068
+ hour: 0,
1069
+ minute: 0,
1070
+ second: 0,
1071
+ millisec: 0
1072
+ };
1073
+
1074
+ if (treg) {
1075
+ if (order.t !== -1) {
1076
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1077
+ ampm = '';
1078
+ resTime.ampm = '';
1079
+ } else {
1080
+ ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
1081
+ resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
1082
+ }
1083
+ }
1084
+
1085
+ if (order.h !== -1) {
1086
+ if (ampm == 'AM' && treg[order.h] == '12') {
1087
+ resTime.hour = 0; // 12am = 0 hour
1088
+ } else {
1089
+ if (ampm == 'PM' && treg[order.h] != '12') {
1090
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1091
+ } else {
1092
+ resTime.hour = Number(treg[order.h]);
1093
+ }
1094
+ }
1095
+ }
1096
+
1097
+ if (order.m !== -1) {
1098
+ resTime.minute = Number(treg[order.m]);
1099
+ }
1100
+ if (order.s !== -1) {
1101
+ resTime.second = Number(treg[order.s]);
1102
+ }
1103
+ if (order.l !== -1) {
1104
+ resTime.millisec = Number(treg[order.l]);
1105
+ }
1106
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1107
+ var tz = treg[order.z].toUpperCase();
1108
+ switch (tz.length) {
1109
+ case 1:
1110
+ // Z
1111
+ tz = o.timezoneIso8601 ? 'Z' : '+0000';
1112
+ break;
1113
+ case 5:
1114
+ // +hhmm
1115
+ if (o.timezoneIso8601) {
1116
+ tz = tz.substring(1) == '0000' ? 'Z' : tz.substring(0, 3) + ':' + tz.substring(3);
1117
+ }
1118
+ break;
1119
+ case 6:
1120
+ // +hh:mm
1121
+ if (!o.timezoneIso8601) {
1122
+ tz = tz == 'Z' || tz.substring(1) == '00:00' ? '+0000' : tz.replace(/:/, '');
1123
+ } else {
1124
+ if (tz.substring(1) == '00:00') {
1125
+ tz = 'Z';
1126
+ }
1127
+ }
1128
+ break;
1129
+ }
1130
+ resTime.timezone = tz;
1131
+ }
1132
+
1133
+
1134
+ return resTime;
1135
+ }
1136
+ return false;
1137
+ };// end strictParse
1138
+
1139
+ // First try JS Date, if that fails, use strictParse
1140
+ var looseParse = function(f,s,o){
1141
+ try{
1142
+ var d = new Date('2012-01-01 '+ s);
1143
+ if(isNaN(d.getTime())){
1144
+ d = new Date('2012-01-01T'+ s);
1145
+ if(isNaN(d.getTime())){
1146
+ d = new Date('01/01/2012 '+ s);
1147
+ if(isNaN(d.getTime())){
1148
+ throw "Unable to parse time with native Date: "+ s;
1149
+ }
1150
+ }
1151
+ }
1152
+
1153
+ return {
1154
+ hour: d.getHours(),
1155
+ minute: d.getMinutes(),
1156
+ second: d.getSeconds(),
1157
+ millisec: d.getMilliseconds(),
1158
+ timezone: $.timepicker.timeZoneOffsetString(d)
1159
+ };
1160
+ }
1161
+ catch(err){
1162
+ try{
1163
+ return strictParse(f,s,o);
1164
+ }
1165
+ catch(err2){
1166
+ $.timepicker.log("Unable to parse \ntimeString: "+ s +"\ntimeFormat: "+ f);
1167
+ }
1168
+ }
1169
+ return false;
1170
+ }; // end looseParse
1171
+
1172
+ if(typeof o.parse === "function"){
1173
+ return o.parse(timeFormat, timeString, o)
1174
+ }
1175
+ if(o.parse === 'loose'){
1176
+ return looseParse(timeFormat, timeString, o);
1177
+ }
1178
+ return strictParse(timeFormat, timeString, o);
1179
+ };
1180
+
1181
+ /*
1182
+ * Public utility to format the time
1183
+ * format = string format of the time
1184
+ * time = a {}, not a Date() for timezones
1185
+ * options = essentially the regional[].. amNames, pmNames, ampm
1186
+ */
1187
+ $.datepicker.formatTime = function(format, time, options) {
1188
+ options = options || {};
1189
+ options = $.extend({}, $.timepicker._defaults, options);
1190
+ time = $.extend({
1191
+ hour: 0,
1192
+ minute: 0,
1193
+ second: 0,
1194
+ millisec: 0,
1195
+ timezone: '+0000'
1196
+ }, time);
1197
+
1198
+ var tmptime = format,
1199
+ ampmName = options.amNames[0],
1200
+ hour = parseInt(time.hour, 10);
1201
+
1202
+ if (hour > 11) {
1203
+ ampmName = options.pmNames[0];
1204
+ }
1205
+
1206
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
1207
+ switch (match) {
1208
+ case 'HH':
1209
+ return ('0' + hour).slice(-2);
1210
+ case 'H':
1211
+ return hour;
1212
+ case 'hh':
1213
+ return ('0' + convert24to12(hour)).slice(-2);
1214
+ case 'h':
1215
+ return convert24to12(hour);
1216
+ case 'mm':
1217
+ return ('0' + time.minute).slice(-2);
1218
+ case 'm':
1219
+ return time.minute;
1220
+ case 'ss':
1221
+ return ('0' + time.second).slice(-2);
1222
+ case 's':
1223
+ return time.second;
1224
+ case 'l':
1225
+ return ('00' + time.millisec).slice(-3);
1226
+ case 'z':
1227
+ return time.timezone === null? options.defaultTimezone : time.timezone;
1228
+ case 'T':
1229
+ return ampmName.charAt(0).toUpperCase();
1230
+ case 'TT':
1231
+ return ampmName.toUpperCase();
1232
+ case 't':
1233
+ return ampmName.charAt(0).toLowerCase();
1234
+ case 'tt':
1235
+ return ampmName.toLowerCase();
1236
+ default:
1237
+ return match.replace(/\'/g, "") || "'";
1238
+ }
1239
+ });
1240
+
1241
+ tmptime = $.trim(tmptime);
1242
+ return tmptime;
1243
+ };
1244
+
1245
+ /*
1246
+ * the bad hack :/ override datepicker so it doesnt close on select
1247
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1248
+ */
1249
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1250
+ $.datepicker._selectDate = function(id, dateStr) {
1251
+ var inst = this._getInst($(id)[0]),
1252
+ tp_inst = this._get(inst, 'timepicker');
1253
+
1254
+ if (tp_inst) {
1255
+ tp_inst._limitMinMaxDateTime(inst, true);
1256
+ inst.inline = inst.stay_open = true;
1257
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1258
+ this._base_selectDate(id, dateStr);
1259
+ inst.inline = inst.stay_open = false;
1260
+ this._notifyChange(inst);
1261
+ this._updateDatepicker(inst);
1262
+ } else {
1263
+ this._base_selectDate(id, dateStr);
1264
+ }
1265
+ };
1266
+
1267
+ /*
1268
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1269
+ * and does not redraw the datepicker on every selectDate event
1270
+ */
1271
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1272
+ $.datepicker._updateDatepicker = function(inst) {
1273
+
1274
+ // don't popup the datepicker if there is another instance already opened
1275
+ var input = inst.input[0];
1276
+ if ($.datepicker._curInst && $.datepicker._curInst != inst && $.datepicker._datepickerShowing && $.datepicker._lastInput != input) {
1277
+ return;
1278
+ }
1279
+
1280
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1281
+
1282
+ this._base_updateDatepicker(inst);
1283
+
1284
+ // Reload the time control when changing something in the input text field.
1285
+ var tp_inst = this._get(inst, 'timepicker');
1286
+ if (tp_inst) {
1287
+ tp_inst._addTimePicker(inst);
1288
+
1289
+ // if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
1290
+ // var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
1291
+ // selectLocalTimeZone(tp_inst, date);
1292
+ // tp_inst._onTimeChange();
1293
+ // }
1294
+ }
1295
+ }
1296
+ };
1297
+
1298
+ /*
1299
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1300
+ */
1301
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1302
+ $.datepicker._doKeyPress = function(event) {
1303
+ var inst = $.datepicker._getInst(event.target),
1304
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1305
+
1306
+ if (tp_inst) {
1307
+ if ($.datepicker._get(inst, 'constrainInput')) {
1308
+ var ampm = useAmpm(tp_inst._defaults.timeFormat),
1309
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1310
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1311
+ .replace(/[hms]/g, '')
1312
+ .replace(/TT/g, ampm ? 'APM' : '')
1313
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1314
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1315
+ .replace(/T/g, ampm ? 'AP' : '')
1316
+ .replace(/tt/g, ampm ? 'apm' : '')
1317
+ .replace(/t/g, ampm ? 'ap' : '') +
1318
+ " " + tp_inst._defaults.separator +
1319
+ tp_inst._defaults.timeSuffix +
1320
+ (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
1321
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1322
+ dateChars,
1323
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1324
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1325
+ }
1326
+ }
1327
+
1328
+ return $.datepicker._base_doKeyPress(event);
1329
+ };
1330
+
1331
+ /*
1332
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1333
+ */
1334
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1335
+ /* Update any alternate field to synchronise with the main field. */
1336
+ $.datepicker._updateAlternate = function(inst) {
1337
+ var tp_inst = this._get(inst, 'timepicker');
1338
+ if(tp_inst){
1339
+ var altField = tp_inst._defaults.altField;
1340
+ if (altField) { // update alternate field too
1341
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1342
+ date = this._getDate(inst),
1343
+ formatCfg = $.datepicker._getFormatConfig(inst),
1344
+ altFormattedDateTime = '',
1345
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1346
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1347
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1348
+
1349
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1350
+ if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
1351
+ if(tp_inst._defaults.altFormat)
1352
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1353
+ else altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1354
+ }
1355
+ $(altField).val(altFormattedDateTime);
1356
+ }
1357
+ }
1358
+ else{
1359
+ $.datepicker._base_updateAlternate(inst);
1360
+ }
1361
+ };
1362
+
1363
+ /*
1364
+ * Override key up event to sync manual input changes.
1365
+ */
1366
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1367
+ $.datepicker._doKeyUp = function(event) {
1368
+ var inst = $.datepicker._getInst(event.target),
1369
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1370
+
1371
+ if (tp_inst) {
1372
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
1373
+ try {
1374
+ $.datepicker._updateDatepicker(inst);
1375
+ } catch (err) {
1376
+ $.timepicker.log(err);
1377
+ }
1378
+ }
1379
+ }
1380
+
1381
+ return $.datepicker._base_doKeyUp(event);
1382
+ };
1383
+
1384
+ /*
1385
+ * override "Today" button to also grab the time.
1386
+ */
1387
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1388
+ $.datepicker._gotoToday = function(id) {
1389
+ var inst = this._getInst($(id)[0]),
1390
+ $dp = inst.dpDiv;
1391
+ this._base_gotoToday(id);
1392
+ var tp_inst = this._get(inst, 'timepicker');
1393
+ selectLocalTimeZone(tp_inst);
1394
+ var now = new Date();
1395
+ this._setTime(inst, now);
1396
+ $('.ui-datepicker-today', $dp).click();
1397
+ };
1398
+
1399
+ /*
1400
+ * Disable & enable the Time in the datetimepicker
1401
+ */
1402
+ $.datepicker._disableTimepickerDatepicker = function(target) {
1403
+ var inst = this._getInst(target);
1404
+ if (!inst) {
1405
+ return;
1406
+ }
1407
+
1408
+ var tp_inst = this._get(inst, 'timepicker');
1409
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1410
+ if (tp_inst) {
1411
+ tp_inst._defaults.showTimepicker = false;
1412
+ tp_inst._updateDateTime(inst);
1413
+ }
1414
+ };
1415
+
1416
+ $.datepicker._enableTimepickerDatepicker = function(target) {
1417
+ var inst = this._getInst(target);
1418
+ if (!inst) {
1419
+ return;
1420
+ }
1421
+
1422
+ var tp_inst = this._get(inst, 'timepicker');
1423
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1424
+ if (tp_inst) {
1425
+ tp_inst._defaults.showTimepicker = true;
1426
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1427
+ tp_inst._updateDateTime(inst);
1428
+ }
1429
+ };
1430
+
1431
+ /*
1432
+ * Create our own set time function
1433
+ */
1434
+ $.datepicker._setTime = function(inst, date) {
1435
+ var tp_inst = this._get(inst, 'timepicker');
1436
+ if (tp_inst) {
1437
+ var defaults = tp_inst._defaults;
1438
+
1439
+ // calling _setTime with no date sets time to defaults
1440
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1441
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1442
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1443
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1444
+
1445
+ //check if within min/max times..
1446
+ tp_inst._limitMinMaxDateTime(inst, true);
1447
+
1448
+ tp_inst._onTimeChange();
1449
+ tp_inst._updateDateTime(inst);
1450
+ }
1451
+ };
1452
+
1453
+ /*
1454
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1455
+ */
1456
+ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
1457
+ var inst = this._getInst(target);
1458
+ if (!inst) {
1459
+ return;
1460
+ }
1461
+
1462
+ var tp_inst = this._get(inst, 'timepicker');
1463
+
1464
+ if (tp_inst) {
1465
+ this._setDateFromField(inst);
1466
+ var tp_date;
1467
+ if (date) {
1468
+ if (typeof date == "string") {
1469
+ tp_inst._parseTime(date, withDate);
1470
+ tp_date = new Date();
1471
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1472
+ } else {
1473
+ tp_date = new Date(date.getTime());
1474
+ }
1475
+ if (tp_date.toString() == 'Invalid Date') {
1476
+ tp_date = undefined;
1477
+ }
1478
+ this._setTime(inst, tp_date);
1479
+ }
1480
+ }
1481
+
1482
+ };
1483
+
1484
+ /*
1485
+ * override setDate() to allow setting time too within Date object
1486
+ */
1487
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1488
+ $.datepicker._setDateDatepicker = function(target, date) {
1489
+ var inst = this._getInst(target);
1490
+ if (!inst) {
1491
+ return;
1492
+ }
1493
+
1494
+ var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
1495
+
1496
+ this._updateDatepicker(inst);
1497
+ this._base_setDateDatepicker.apply(this, arguments);
1498
+ this._setTimeDatepicker(target, tp_date, true);
1499
+ };
1500
+
1501
+ /*
1502
+ * override getDate() to allow getting time too within Date object
1503
+ */
1504
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1505
+ $.datepicker._getDateDatepicker = function(target, noDefault) {
1506
+ var inst = this._getInst(target);
1507
+ if (!inst) {
1508
+ return;
1509
+ }
1510
+
1511
+ var tp_inst = this._get(inst, 'timepicker');
1512
+
1513
+ if (tp_inst) {
1514
+ // if it hasn't yet been defined, grab from field
1515
+ if(inst.lastVal === undefined){
1516
+ this._setDateFromField(inst, noDefault);
1517
+ }
1518
+
1519
+ var date = this._getDate(inst);
1520
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1521
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1522
+ }
1523
+ return date;
1524
+ }
1525
+ return this._base_getDateDatepicker(target, noDefault);
1526
+ };
1527
+
1528
+ /*
1529
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1530
+ * An option in datapicker to ignore extra format characters would be nicer.
1531
+ */
1532
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1533
+ $.datepicker.parseDate = function(format, value, settings) {
1534
+ var date;
1535
+ try {
1536
+ date = this._base_parseDate(format, value, settings);
1537
+ } catch (err) {
1538
+ // Hack! The error message ends with a colon, a space, and
1539
+ // the "extra" characters. We rely on that instead of
1540
+ // attempting to perfectly reproduce the parsing algorithm.
1541
+ date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1542
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1543
+ }
1544
+ return date;
1545
+ };
1546
+
1547
+ /*
1548
+ * override formatDate to set date with time to the input
1549
+ */
1550
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1551
+ $.datepicker._formatDate = function(inst, day, month, year) {
1552
+ var tp_inst = this._get(inst, 'timepicker');
1553
+ if (tp_inst) {
1554
+ tp_inst._updateDateTime(inst);
1555
+ return tp_inst.$input.val();
1556
+ }
1557
+ return this._base_formatDate(inst);
1558
+ };
1559
+
1560
+ /*
1561
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1562
+ */
1563
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1564
+ $.datepicker._optionDatepicker = function(target, name, value) {
1565
+ var inst = this._getInst(target),
1566
+ name_clone;
1567
+ if (!inst) {
1568
+ return null;
1569
+ }
1570
+
1571
+ var tp_inst = this._get(inst, 'timepicker');
1572
+ if (tp_inst) {
1573
+ var min = null,
1574
+ max = null,
1575
+ onselect = null,
1576
+ overrides = tp_inst._defaults.evnts,
1577
+ fns = {},
1578
+ prop;
1579
+ if (typeof name == 'string') { // if min/max was set with the string
1580
+ if (name === 'minDate' || name === 'minDateTime') {
1581
+ min = value;
1582
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1583
+ max = value;
1584
+ } else if (name === 'onSelect') {
1585
+ onselect = value;
1586
+ } else if (overrides.hasOwnProperty(name)) {
1587
+ if (typeof (value) === 'undefined') {
1588
+ return overrides[name];
1589
+ }
1590
+ fns[name] = value;
1591
+ name_clone = {}; //empty results in exiting function after overrides updated
1592
+ }
1593
+ } else if (typeof name == 'object') { //if min/max was set with the JSON
1594
+ if (name.minDate) {
1595
+ min = name.minDate;
1596
+ } else if (name.minDateTime) {
1597
+ min = name.minDateTime;
1598
+ } else if (name.maxDate) {
1599
+ max = name.maxDate;
1600
+ } else if (name.maxDateTime) {
1601
+ max = name.maxDateTime;
1602
+ }
1603
+ for (prop in overrides) {
1604
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1605
+ fns[prop] = name[prop];
1606
+ }
1607
+ }
1608
+ }
1609
+ for (prop in fns) {
1610
+ if (fns.hasOwnProperty(prop)) {
1611
+ overrides[prop] = fns[prop];
1612
+ if (!name_clone) { name_clone = $.extend({}, name);}
1613
+ delete name_clone[prop];
1614
+ }
1615
+ }
1616
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1617
+ if (min) { //if min was set
1618
+ if (min === 0) {
1619
+ min = new Date();
1620
+ } else {
1621
+ min = new Date(min);
1622
+ }
1623
+ tp_inst._defaults.minDate = min;
1624
+ tp_inst._defaults.minDateTime = min;
1625
+ } else if (max) { //if max was set
1626
+ if (max === 0) {
1627
+ max = new Date();
1628
+ } else {
1629
+ max = new Date(max);
1630
+ }
1631
+ tp_inst._defaults.maxDate = max;
1632
+ tp_inst._defaults.maxDateTime = max;
1633
+ } else if (onselect) {
1634
+ tp_inst._defaults.onSelect = onselect;
1635
+ }
1636
+ }
1637
+ if (value === undefined) {
1638
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1639
+ }
1640
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1641
+ };
1642
+ /*
1643
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1644
+ * it will return false for all objects
1645
+ */
1646
+ var isEmptyObject = function(obj) {
1647
+ var prop;
1648
+ for (prop in obj) {
1649
+ if (obj.hasOwnProperty(obj)) {
1650
+ return false;
1651
+ }
1652
+ }
1653
+ return true;
1654
+ };
1655
+
1656
+ /*
1657
+ * jQuery extend now ignores nulls!
1658
+ */
1659
+ var extendRemove = function(target, props) {
1660
+ $.extend(target, props);
1661
+ for (var name in props) {
1662
+ if (props[name] === null || props[name] === undefined) {
1663
+ target[name] = props[name];
1664
+ }
1665
+ }
1666
+ return target;
1667
+ };
1668
+
1669
+ /*
1670
+ * Determine by the time format if should use ampm
1671
+ * Returns true if should use ampm, false if not
1672
+ */
1673
+ var useAmpm = function(timeFormat){
1674
+ return (timeFormat.indexOf('t') !== -1 && timeFormat.indexOf('h') !== -1);
1675
+ };
1676
+
1677
+ /*
1678
+ * Converts 24 hour format into 12 hour
1679
+ * Returns 12 hour without leading 0
1680
+ */
1681
+ var convert24to12 = function(hour) {
1682
+ if (hour > 12) {
1683
+ hour = hour - 12;
1684
+ }
1685
+
1686
+ if (hour == 0) {
1687
+ hour = 12;
1688
+ }
1689
+
1690
+ return String(hour);
1691
+ };
1692
+
1693
+ /*
1694
+ * Splits datetime string into date ans time substrings.
1695
+ * Throws exception when date can't be parsed
1696
+ * Returns [dateString, timeString]
1697
+ */
1698
+ var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) {
1699
+ try {
1700
+ // The idea is to get the number separator occurances in datetime and the time format requested (since time has
1701
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1702
+ var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator,
1703
+ format = timeSettings && timeSettings.timeFormat ? timeSettings.timeFormat : $.timepicker._defaults.timeFormat,
1704
+ timeParts = format.split(separator), // how many occurances of separator may be in our format?
1705
+ timePartsLen = timeParts.length,
1706
+ allParts = dateTimeString.split(separator),
1707
+ allPartsLen = allParts.length;
1708
+
1709
+ if (allPartsLen > 1) {
1710
+ return [
1711
+ allParts.splice(0,allPartsLen-timePartsLen).join(separator),
1712
+ allParts.splice(0,timePartsLen).join(separator)
1713
+ ];
1714
+ }
1715
+
1716
+ } catch (err) {
1717
+ $.timepicker.log('Could not split the date from the time. Please check the following datetimepicker options' +
1718
+ "\nthrown error: " + err +
1719
+ "\ndateTimeString" + dateTimeString +
1720
+ "\ndateFormat = " + dateFormat +
1721
+ "\nseparator = " + timeSettings.separator +
1722
+ "\ntimeFormat = " + timeSettings.timeFormat);
1723
+
1724
+ if (err.indexOf(":") >= 0) {
1725
+ // Hack! The error message ends with a colon, a space, and
1726
+ // the "extra" characters. We rely on that instead of
1727
+ // attempting to perfectly reproduce the parsing algorithm.
1728
+ var dateStringLength = dateTimeString.length - (err.length - err.indexOf(':') - 2),
1729
+ timeString = dateTimeString.substring(dateStringLength);
1730
+
1731
+ return [$.trim(dateTimeString.substring(0, dateStringLength)), $.trim(dateTimeString.substring(dateStringLength))];
1732
+
1733
+ } else {
1734
+ throw err;
1735
+ }
1736
+ }
1737
+ return [dateTimeString, ''];
1738
+ };
1739
+
1740
+ /*
1741
+ * Internal function to parse datetime interval
1742
+ * Returns: {date: Date, timeObj: Object}, where
1743
+ * date - parsed date without time (type Date)
1744
+ * timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
1745
+ */
1746
+ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1747
+ var date;
1748
+ var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
1749
+ date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
1750
+ if (splitRes[1] !== '') {
1751
+ var timeString = splitRes[1],
1752
+ parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
1753
+
1754
+ if (parsedTime === null) {
1755
+ throw 'Wrong time format';
1756
+ }
1757
+ return {
1758
+ date: date,
1759
+ timeObj: parsedTime
1760
+ };
1761
+ } else {
1762
+ return {
1763
+ date: date
1764
+ };
1765
+ }
1766
+ };
1767
+
1768
+ /*
1769
+ * Internal function to set timezone_select to the local timezone
1770
+ */
1771
+ var selectLocalTimeZone = function(tp_inst, date) {
1772
+ if (tp_inst && tp_inst.timezone_select) {
1773
+ tp_inst._defaults.useLocalTimezone = true;
1774
+ var now = typeof date !== 'undefined' ? date : new Date();
1775
+ var tzoffset = $.timepicker.timeZoneOffsetString(now);
1776
+ if (tp_inst._defaults.timezoneIso8601) {
1777
+ tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
1778
+ }
1779
+ tp_inst.timezone_select.val(tzoffset);
1780
+ }
1781
+ };
1782
+
1783
+ /*
1784
+ * Create a Singleton Insance
1785
+ */
1786
+ $.timepicker = new Timepicker();
1787
+
1788
+ /**
1789
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1790
+ * @param date
1791
+ * @return string
1792
+ */
1793
+ $.timepicker.timeZoneOffsetString = function(date) {
1794
+ var off = date.getTimezoneOffset() * -1,
1795
+ minutes = off % 60,
1796
+ hours = (off - minutes) / 60;
1797
+ return (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + ('0' + (minutes * 101).toString()).slice(-2);
1798
+ };
1799
+
1800
+ /**
1801
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
1802
+ * enforce date range limits.
1803
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
1804
+ * @param Element startTime
1805
+ * @param Element endTime
1806
+ * @param obj options Options for the timepicker() call
1807
+ * @return jQuery
1808
+ */
1809
+ $.timepicker.timeRange = function(startTime, endTime, options) {
1810
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
1811
+ };
1812
+
1813
+ /**
1814
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
1815
+ * enforce date range limits.
1816
+ * @param Element startTime
1817
+ * @param Element endTime
1818
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1819
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1820
+ * @param string method Can be used to specify the type of picker to be added
1821
+ * @return jQuery
1822
+ */
1823
+ $.timepicker.dateTimeRange = function(startTime, endTime, options) {
1824
+ $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
1825
+ };
1826
+
1827
+ /**
1828
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1829
+ * enforce date range limits.
1830
+ * @param Element startTime
1831
+ * @param Element endTime
1832
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1833
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1834
+ * @param string method Can be used to specify the type of picker to be added
1835
+ * @return jQuery
1836
+ */
1837
+ $.timepicker.dateRange = function(startTime, endTime, options, method) {
1838
+ method = method || 'datepicker';
1839
+ $.timepicker.handleRange(method, startTime, endTime, options);
1840
+ };
1841
+
1842
+ /**
1843
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1844
+ * enforce date range limits.
1845
+ * @param string method Can be used to specify the type of picker to be added
1846
+ * @param Element startTime
1847
+ * @param Element endTime
1848
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1849
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1850
+ * @return jQuery
1851
+ */
1852
+ $.timepicker.handleRange = function(method, startTime, endTime, options) {
1853
+ $.fn[method].call(startTime, $.extend({
1854
+ onClose: function(dateText, inst) {
1855
+ checkDates(this, endTime, dateText);
1856
+ },
1857
+ onSelect: function(selectedDateTime) {
1858
+ selected(this, endTime, 'minDate');
1859
+ }
1860
+ }, options, options.start));
1861
+ $.fn[method].call(endTime, $.extend({
1862
+ onClose: function(dateText, inst) {
1863
+ checkDates(this, startTime, dateText);
1864
+ },
1865
+ onSelect: function(selectedDateTime) {
1866
+ selected(this, startTime, 'maxDate');
1867
+ }
1868
+ }, options, options.end));
1869
+ // timepicker doesn't provide access to its 'timeFormat' option,
1870
+ // nor could I get datepicker.formatTime() to behave with times, so I
1871
+ // have disabled reformatting for timepicker
1872
+ if (method != 'timepicker' && options.reformat) {
1873
+ $([startTime, endTime]).each(function() {
1874
+ var format = $(this)[method].call($(this), 'option', 'dateFormat'),
1875
+ date = new Date($(this).val());
1876
+ if ($(this).val() && date) {
1877
+ $(this).val($.datepicker.formatDate(format, date));
1878
+ }
1879
+ });
1880
+ }
1881
+ checkDates(startTime, endTime, startTime.val());
1882
+
1883
+ function checkDates(changed, other, dateText) {
1884
+ if (other.val() && (new Date(startTime.val()) > new Date(endTime.val()))) {
1885
+ other.val(dateText);
1886
+ }
1887
+ }
1888
+ selected(startTime, endTime, 'minDate');
1889
+ selected(endTime, startTime, 'maxDate');
1890
+
1891
+ function selected(changed, other, option) {
1892
+ if (!$(changed).val()) {
1893
+ return;
1894
+ }
1895
+ var date = $(changed)[method].call($(changed), 'getDate');
1896
+ // timepicker doesn't implement 'getDate' and returns a jQuery
1897
+ if (date.getTime) {
1898
+ $(other)[method].call($(other), 'option', option, date);
1899
+ }
1900
+ }
1901
+ return $([startTime.get(0), endTime.get(0)]);
1902
+ };
1903
+
1904
+ /**
1905
+ * Log error or data to the console during error or debugging
1906
+ * @param Object err pass any type object to log to the console during error or debugging
1907
+ * @return void
1908
+ */
1909
+ $.timepicker.log = function(err){
1910
+ if(window.console)
1911
+ console.log(err);
1912
+ };
1913
+
1914
+ /*
1915
+ * Keep up with the version
1916
+ */
1917
+ $.timepicker.version = "1.2";
1918
+
1919
+ })(jQuery);
assets/js/jquery.smallipop-0.4.0.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Smallipop (02/05/2013)
3
+ Copyright (c) 2011-2013 Small Improvements (http://www.small-improvements.com)
4
+
5
+ Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
6
+
7
+ @author Sebastian Helzle (sebastian@helzle.net)
8
+ */
9
+ (function(b){var a;b.smallipop=a={version:"0.4.0",defaults:{autoscrollPadding:200,contentAnimationSpeed:150,cssAnimations:{enabled:false,show:"animated fadeIn",hide:"animated fadeOut"},funcEase:"easeInOutQuad",handleInputs:true,hideDelay:500,hideTrigger:false,hideOnPopupClick:true,hideOnTriggerClick:true,infoClass:"smallipopHint",invertAnimation:false,popupOffset:31,popupYOffset:0,popupDistance:20,popupDelay:100,popupAnimationSpeed:200,preferredPosition:"top",referencedSelector:null,theme:"default",touchSupport:true,triggerAnimationSpeed:150,triggerOnClick:false,onAfterHide:null,onAfterShow:null,onBeforeHide:null,onBeforeShow:null,onTourClose:null,onTourNext:null,onTourPrev:null,windowPadding:30},currentTour:null,lastId:1,nextInstanceId:1,lastScrollCheck:0,labels:{prev:"Back",next:"Next",close:"Close",of:"of"},instances:{},scrollTimer:null,templates:{popup:b.trim(' <div class="smallipop-instance"> <div class="sipContent"/> <div class="sipArrowBorder"/> <div class="sipArrow"/> </div>')},tours:{},_hideSmallipop:function(p){var s,i,m,d,g,c,q,o,h,j,r,f,n,l,k;o=(p!=null?p.target:void 0)?b(p.target):p;n=a.instances;k=[];for(c in n){d=n[c];g=d.data();if(!(q=g.shown)){continue}if(g.isTour&&!d.is(o)){continue}h=b(".smallipop"+q);j=((l=h.data("smallipop"))!=null?l.options:void 0)||a.defaults;m=!j.hideOnTriggerClick&&o.is(h);i=!j.hideOnPopupClick&&d.find(o).length;if(o&&h.length&&(p!=null?p.type:void 0)==="click"&&(m||i)){continue}if(q&&j.hideTrigger){h.stop(true).fadeTo(j.triggerAnimationSpeed,1)}d.data({hideDelayTimer:null,beingShown:false});if(j.cssAnimations.enabled){d.removeClass(j.cssAnimations.show).addClass(j.cssAnimations.hide).data("shown","");if(j.onAfterHide){k.push(window.setTimeout(j.onAfterHide,j.popupAnimationSpeed))}else{k.push(void 0)}}else{s=j.invertAnimation?-1:1;r=g.xDistance*s;f=g.yDistance*s;k.push(d.stop(true).animate({top:"-="+r+"px",left:"+="+f+"px",opacity:0},j.popupAnimationSpeed,j.funcEase,function(){var e;e=b(this);if(!e.data("beingShown")){e.css("display","none").data("shown","")}return typeof j.onAfterHide==="function"?j.onAfterHide():void 0}))}}return k},_showSmallipop:function(f){var c,d;c=b(this).data("smallipop");if(c.popupInstance.data("shown")!==c.id&&((d=!c.type)==="checkbox"||d==="radio")){if(f!=null){f.preventDefault()}}return a._triggerMouseover.call(this)},_onTouchDevice:function(){return typeof Modernizr!=="undefined"&&Modernizr!==null?Modernizr.touch:void 0},_killTimers:function(c){clearTimeout(c.data("hideDelayTimer"));return clearTimeout(c.data("showDelayTimer"))},_refreshPosition:function(){var E,q,n,h,i,c,D,o,B,p,l,m,k,A,s,C,H,F,I,g,x,z,w,j,e,v,y,u,G,r,t,f,d;t=a.instances;d=[];for(A in t){c=t[A];o=c.data();z=o.shown;if(!z){continue}w=b(".smallipop"+z);i=w.data("smallipop").options;c.removeClass(function(J,K){return((K!=null?K.match(/sip\w+/g):void 0)||[]).join(" ")});c.addClass(i.theme);j=b(window);u=G=i.popupDistance;r=i.popupYOffset;q=c.data("position")==="fixed";n=w.offset();k=c.outerHeight();H=c.outerWidth();D=H/2;v=j.width();e=j.height();y=i.windowPadding;g=w.outerWidth();I=w.outerHeight();x=n.top-j.scrollTop();s=n.left+g/2;C=n.top-k+r;F=k+i.popupDistance-r;m=x-F;B=e-x-I-F;p=n.left-H-i.popupOffset;l=v-n.left-g-H;if((f=i.preferredPosition)==="left"||f==="right"){u=0;C+=I/2+k/2;if((i.preferredPosition==="left"&&p>y)||l<y){c.addClass("sipPositionedLeft");s=n.left-H-i.popupOffset;G=-G}else{c.addClass("sipPositionedRight");s=n.left+g+i.popupOffset}}else{G=0;if(s+D>v-y){s-=D*2-i.popupOffset;c.addClass("sipAlignLeft")}else{if(s-D<y){s-=i.popupOffset;c.addClass("sipAlignRight")}else{s-=D}}if((i.preferredPosition==="bottom"&&B>y)||m<y){C+=k+I-2*r;u=-u;r=0;c.addClass("sipAlignBottom")}}if(i.hideTrigger){w.stop(true).fadeTo(i.triggerAnimationSpeed,0)}h=0;E=o.beingShown&&!i.cssAnimations.enabled;if(!E){C-=u;s+=G;u=0;G=0;h=1}if(q){s-=j.scrollLeft();C-=j.scrollTop()}c.data({xDistance:u,yDistance:G}).css({top:C,left:s,display:"block",opacity:h});d.push(a._fadeInPopup(c,{top:"-="+u+"px",left:"+="+G+"px",opacity:1}))}return d},_fadeInPopup:function(d,c){var e,f;e=((f=a._getTrigger(d.data("shown")).data("smallipop"))!=null?f.options:void 0)||a.defaults;if(e.cssAnimations.enabled){d.addClass(e.cssAnimations.show);return window.setTimeout(function(){return a._fadeInPopupFinished(d,e)},e.popupAnimationSpeed)}else{return d.stop(true).animate(c,e.popupAnimationSpeed,e.funcEase,function(){return a._fadeInPopupFinished(d,e)})}},_fadeInPopupFinished:function(d,e){var c;c=d.data();if(c.beingShown){d.data("beingShown",false);return typeof e.onAfterShow==="function"?e.onAfterShow(a._getTrigger(c.shown)):void 0}},_getTrigger:function(c){return b(".smallipop"+c)},_showPopup:function(e,h){var j,i,d,c,f,g;if(h==null){h=""}g=e.data("smallipop");d=g.popupInstance;if(!d.data("triggerHovered")){return}f=d.data("shown");if(f){j=a._getTrigger(f);if(j.length){i=j.data("smallipop").options||a.defaults;if(i.hideTrigger){j.stop(true).fadeTo(i.fadeSpeed,1)}}}c=h||g.hint;if(g.options.referencedContent&&!h){c=b(g.options.referencedContent).html()||c}d.data({beingShown:true,shown:g.id}).find(".sipContent").html(c);d.data("position","").css("position","absolute");if(this._isElementFixed(e)){d.data("position","fixed").css("position","fixed")}if(g.id!==f){d.attr("class","smallipop-instance")}return a._refreshPosition()},_isElementFixed:function(c){var d;d=c;while(d.length&&d[0].nodeName!=="HTML"){if(d.css("position")==="fixed"){return true}d=d.parent()}return false},_triggerMouseover:function(){var h,c,e,d,g,f;d=c=b(this);h=d.hasClass("sipInitialized");if(!h){d=a._getTrigger(c.data("shown"))}if(!d.length){return}g=d.data("smallipop");c=g.popupInstance.data((h?"triggerHovered":"hovered"),true);a._killTimers(c);e=c.data("shown");if(e!==g.id||c.css("opacity")===0){if(typeof(f=g.options).onBeforeShow==="function"){f.onBeforeShow(d)}return c.data("showDelayTimer",setTimeout(function(){return a._showPopup(d)},g.options.popupDelay))}},_triggerMouseout:function(){var h,d,c,e,g,f;e=d=b(this);h=e.hasClass("sipInitialized");if(!h){e=a._getTrigger(d.data("shown"))}if(!e.length){return}g=e.data("smallipop");d=g.popupInstance.data((h?"triggerHovered":"hovered"),false);a._killTimers(d);c=d.data();if(!(c.hovered||c.triggerHovered)){if(typeof(f=g.options).onBeforeHide==="function"){f.onBeforeHide(e)}return d.data("hideDelayTimer",setTimeout(function(){return a._hideSmallipop(d)},g.options.hideDelay))}},_onWindowScroll:function(c){clearTimeout(a.scrollTimer);return a.scrollTimer=setTimeout(a._refreshPosition,250)},setContent:function(e,g){var d,c,f;if(!(e!=null?e.length:void 0)){return}f=e.data("smallipop");d=f.tourTitle;if(d){c=f.popupInstance.find(".smallipop-tour-content")}else{c=f.popupInstance.find(".sipContent")}if(c.html()!==g){return c.stop(true).fadeTo(f.options.contentAnimationSpeed,0,function(){b(this).html(g).fadeTo(f.options.contentAnimationSpeed,1);return a._refreshPosition()})}},_runTour:function(d){var g,e,c,f,j,h;f=d.data("smallipop");c=f!=null?f.tourTitle:void 0;if(!(c&&a.tours[c])){return}a.tours[c].sort(function(k,i){return k.index-i.index});a.currentTour=c;g=a.tours[c];for(e=j=0,h=g.length-1;0<=h?j<=h:j>=h;e=0<=h?++j:--j){if(g[e].id===f.id){return a._tourShow(c,e)}}},_tourShow:function(j,g){var d,e,h,i,l,k,f,c;i=a.tours[j];if(!i){return}f=i[g].trigger;c=f.data("smallipop");k=g>0?'<a href="#" class="smallipop-tour-prev">'+a.labels.prev+"</a>":"";l=g<i.length-1?'<a href="#" class="smallipop-tour-next">'+a.labels.next+"</a>":"";d=g===i.length-1?'<a href="#" class="smallipop-tour-close">'+a.labels.close+"</a>":"";e='<a href="#" class="smallipop-tour-close-icon">&Chi;</a>';h=' <div class="smallipop-tour-content">'+c.hint+"</div> "+e+' <div class="smallipop-tour-footer"> <div class="smallipop-tour-progress"> '+(g+1)+" "+a.labels.of+" "+i.length+" </div> "+k+" "+l+" "+d+' <br style="clear:both;"/> </div>';a._killTimers(c.popupInstance);c.popupInstance.data("triggerHovered",true);return a._showWhenVisible(f,h)},_showWhenVisible:function(c,e){var g,d,f,h;d=c.offset().top;g=d-b(document).scrollTop();h=b(window).height();f=c.data("smallipop").options;if(!this._isElementFixed(c)&&(g<f.autoscrollPadding||g>h-f.autoscrollPadding)){return b("html, body").animate({scrollTop:d-h/2},800,"swing",function(){return a._showPopup(c,e)})}else{return a._showPopup(c,e)}},_tourNext:function(j){var l,h,c,k,m,f,g,d;if(j!=null){j.preventDefault()}l=a.tours[a.currentTour];if(!l){return}c=l[0].popupInstance;k=c.data("shown")||l[0].id;for(h=f=0,g=l.length-2;0<=g?f<=g:f>=g;h=0<=g?++f:--f){if(!(l[h].id===k)){continue}if((d=l[h].trigger.data("smallipop"))!=null){if(typeof(m=d.options).onTourNext==="function"){m.onTourNext(l[h+1].trigger)}}return a._tourShow(a.currentTour,h+1)}},_tourPrev:function(j){var l,h,c,k,m,f,g,d;if(j!=null){j.preventDefault()}l=a.tours[a.currentTour];if(!l){return}c=l[0].popupInstance;k=c.data("shown")||l[0].id;for(h=f=1,g=l.length-1;1<=g?f<=g:f>=g;h=1<=g?++f:--f){if(!(l[h].id===k)){continue}if((d=l[h].trigger.data("smallipop"))!=null){if(typeof(m=d.options).onTourPrev==="function"){m.onTourPrev(l[h-1].trigger)}}return a._tourShow(a.currentTour,h-1)}},_tourClose:function(g){var c,d,f;if(g!=null){g.preventDefault()}c=b(g.target).closest(".smallipop-instance");if((f=a._getTrigger(c.data("shown")).data("smallipop"))!=null){if(typeof(d=f.options).onTourClose==="function"){d.onTourClose()}}return a._hideSmallipop(c)},_destroy:function(c){return c.each(function(){var e,d;d=b(this);e=d.data("smallipop");if(e){return d.unbind(".smallipop").data("smallipop",{}).removeClass("smallipop sipInitialized smallipop"+e.id+" "+e.options.theme)}})},_onWindowKeyUp:function(j){var f,g,h,i,c,d;h=(i=j!=null?j.target.tagName.toLowerCase():void 0)==="input"||i==="textarea";switch(j.which){case 27:c=a.instances;d=[];for(g in c){f=c[g];d.push(a._hideSmallipop(f))}return d;break;case 37:if(!h){return a._tourPrev()}break;case 39:if(!h){return a._tourNext()}}},_getInstance:function(e,d){var c;if(e==null){e="default"}if(d==null){d=false}if(a.instances[e]){return a.instances[e]}c=b(a.templates.popup).css("opacity",0).attr("id","smallipop"+(a.nextInstanceId++)).addClass("smallipop-instance").data({xDistance:0,yDistance:0,isTour:d}).bind({"mouseover.smallipop":a._triggerMouseover,"mouseout.smallipop":a._triggerMouseout});b("body").append(c);if(d){c.delegate(".smallipop-tour-prev","click.smallipop",a._tourPrev).delegate(".smallipop-tour-next","click.smallipop",a._tourNext).delegate(".smallipop-tour-close, .smallipop-tour-close-icon","click.smallipop",a._tourClose)}else{c.delegate("a","click.smallipop",a._hideSmallipop)}if(a.nextInstanceId===2){b(document).bind("click.smallipop touchend.smallipop",a._hideSmallipop);b(window).bind({"resize.smallipop":a._refreshPosition,"scroll.smallipop":a._onWindowScroll,keyup:a._onWindowKeyUp})}return a.instances[e]=c}};if(!b.easing.easeInOutQuad){b.easing.easeInOutQuad=function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g+e}else{return -i/2*((--g)*(g-2)-1)+e}}}return b.fn.smallipop=function(d,e){var c;if(d==null){d={}}if(e==null){e=""}if(typeof d==="string"){switch(d.toLowerCase()){case"show":a._showSmallipop.call(this.first().get(0));break;case"hide":a._hideSmallipop(this.first().get(0));break;case"destroy":a._destroy(this);break;case"tour":a._runTour(this.first());break;case"update":a.setContent(this.first(),e)}return this}d=b.extend({},a.defaults,d);if((typeof Modernizr!=="undefined"&&Modernizr!==null?Modernizr.cssanimations:void 0)===false){d.cssAnimations.enabled=false}c=a._getInstance();return this.each(function(){var l,i,r,n,g,s,h,k,f,o,j,m,p,q;s=b(this);h=s[0].tagName.toLowerCase();p=s.attr("type");f=s.data();r=e||s.find("."+d.infoClass).html()||s.attr("title");if(r&&!s.hasClass("sipInitialized")){i=a.lastId++;o={};m=c;j=b.extend(true,{},d);for(n in f){q=f[n];if(!(n.indexOf("smallipop")>=0)){continue}g=n.replace("smallipop","");g=g.substr(0,1).toLowerCase()+g.substr(1);j[g]=q}l=j.handleInputs&&(h==="input"||h==="select"||h==="textarea");if(l){j.hideOnTriggerClick=false;o["focus.smallipop"]=a._triggerMouseover;o["blur.smallipop"]=a._triggerMouseout}else{o["mouseout.smallipop"]=a._triggerMouseout}if(j.triggerOnClick||(j.touchSupport&&a._onTouchDevice())){o["click.smallipop"]=a._showSmallipop}else{o["click.smallipop"]=a._triggerMouseout;o["mouseover.smallipop"]=a._triggerMouseover}if(j.tourIndex){k=j.tourTitle||"defaultTour";o={};j.hideOnTriggerClick=false;j.hideOnPopupClick=false;m=a._getInstance(k,true);if(!a.tours[k]){a.tours[k]=[]}a.tours[k].push({index:j.tourIndex||0,id:i,trigger:s,popupInstance:m})}s.addClass("sipInitialized smallipop"+i).attr("title","").data("smallipop",{id:i,hint:r,options:j,tagName:h,type:p,tourTitle:k,popupInstance:m}).bind(o);if(!j.hideOnTriggerClick){return s.delegate("a","click.smallipop",a._hideSmallipop)}}})}})(jQuery);
assets/js/jquery.validate.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery Validation Plugin - v1.11.0 - 2/4/2013
2
+ * https://github.com/jzaefferer/jquery-validation
3
+ * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */
4
+ (function(e){e.extend(e.fn,{validate:function(t){if(!this.length){t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.");return}var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(t.target).hasClass("cancel")&&(n.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return n.settings.submitHandler?(n.submitButton&&(r=e("<input type='hidden'/>").attr("name",n.submitButton.name).val(n.submitButton.value).appendTo(n.currentForm)),n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&r.remove(),!1):!0}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,r()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):r():(n.focusInvalid(),!1)})),n)},valid:function(){if(e(this[0]).is("form"))return this.validate().form();var t=!0,n=e(this[0].form).validate();return this.each(function(){t&=n.element(this)}),t},removeAttrs:function(t){var n={},r=this;return e.each(t.split(/\s/),function(e,t){n[t]=r.attr(t),r.removeAttr(t)}),n},rules:function(t,n){var r=this[0];if(t){var i=e.data(r.form,"validator").settings,s=i.rules,o=e.validator.staticRules(r);switch(t){case"add":e.extend(o,e.validator.normalizeRule(n)),s[r.name]=o,n.messages&&(i.messages[r.name]=e.extend(i.messages[r.name],n.messages));break;case"remove":if(!n)return delete s[r.name],o;var u={};return e.each(n.split(/\s/),function(e,t){u[t]=o[t],delete o[t]}),u}}var a=e.validator.normalizeRules(e.extend({},e.validator.classRules(r),e.validator.attributeRules(r),e.validator.dataRules(r),e.validator.staticRules(r)),r);if(a.required){var f=a.required;delete a.required,a=e.extend({required:f},a)}return a}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+t.value)},filled:function(t){return!!e.trim(""+t.value)},unchecked:function(e){return!e.checked}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return arguments.length===1?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\\{"+e+"\\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e,t){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e,t){!this.checkable(e)&&(e.name in this.submitted||!this.optional(e))&&this.element(e)},onkeyup:function(e,t){if(t.which===9&&this.elementValue(e)==="")return;(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e,t){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).addClass(n).removeClass(r):e(t).addClass(n).removeClass(r)},unhighlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).removeClass(n).addClass(r):e(t).removeClass(n).addClass(r)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function r(t){var n=e.data(this[0].form,"validator"),r="on"+t.type.replace(/^validate/,"");n.settings[r]&&n.settings[r].call(n,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var t=this.groups={};e.each(this.settings.groups,function(n,r){typeof r=="string"&&(r=r.split(/\s/)),e.each(r,function(e,r){t[r]=n})});var n=this.settings.rules;e.each(n,function(t,r){n[t]=e.validator.normalizeRule(r)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",r).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",r),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t)),this.lastElement=t,this.prepareElement(t),this.currentElements=e(t);var n=this.check(t)!==!1;return n?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var n in t)this.errorList.push({message:t[n],element:this.findByName(n)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t=0;for(var n in e)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&e.grep(this.errorList,function(e){return e.element.name===t.name}).length===1&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in n||!t.objectLength(e(this).rules())?!1:(n[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n=e(t).attr("type"),r=e(t).val();return n==="radio"||n==="checkbox"?e("input[name='"+e(t).attr("name")+"']:checked").val():typeof r=="string"?r.replace(/\r/g,""):r},check:function(t){t=this.validationTargetFor(this.clean(t));var n=e(t).rules(),r=!1,i=this.elementValue(t),s;for(var o in n){var u={method:o,parameters:n[o]};try{s=e.validator.methods[o].call(this,i,t,u.parameters);if(s==="dependency-mismatch"){r=!0;continue}r=!1;if(s==="pending"){this.toHide=this.toHide.not(this.errorsFor(t));return}if(!s)return this.formatAndAdd(t,u),!1}catch(a){throw this.settings.debug&&window.console&&console.log("Exception occured when checking element "+t.id+", check the '"+u.method+"' method.",a),a}}if(r)return;return this.objectLength(n)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg-"+n.toLowerCase())||t.attributes&&e(t).attr("data-msg-"+n.toLowerCase())},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(arguments[e]!==undefined)return arguments[e];return undefined},defaultMessage:function(t,n){return this.findDefined(this.customMessage(t.name,n),this.customDataMessage(t,n),!this.settings.ignoreTitle&&t.title||undefined,e.validator.messages[n],"<strong>Warning: No message defined for "+t.name+"</strong>")},formatAndAdd:function(t,n){var r=this.defaultMessage(t,n.method),i=/\$?\{(\d+)\}/g;typeof r=="function"?r=r.call(this,n.parameters,t):i.test(r)&&(r=e.validator.format(r.replace(i,"{$1}"),n.parameters)),this.errorList.push({message:r,element:t}),this.errorMap[t.name]=r,this.submitted[t.name]=r},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message)}this.errorList.length&&(this.toShow=this.toShow.add(this.containers));if(this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(n)):(r=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,e(t)):r.insertAfter(t))),!n&&this.settings.success&&(r.text(""),typeof this.settings.success=="string"?r.addClass(this.settings.success):this.settings.success(r,t)),this.toShow=this.toShow.add(r)},errorsFor:function(t){var n=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===n})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return this.dependTypes[typeof e]?this.dependTypes[typeof e](e,t):!0},dependTypes:{"boolean":function(e,t){return e},string:function(t,n){return!!e(t,n.form).length},"function":function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],n&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&this.pendingRequest===0&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},r=e(t).attr("class");return r&&e.each(r.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},attributeRules:function(t){var n={},r=e(t);for(var i in e.validator.methods){var s;i==="required"?(s=r.get(0).getAttribute(i),s===""&&(s=!0),s=!!s):s=r.attr(i),s?n[i]=s:r[0].getAttribute("type")===i&&(n[i]=!0)}return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(t){var n,r,i={},s=e(t);for(n in e.validator.methods)r=s.data("rule-"+n.toLowerCase()),r!==undefined&&(i[n]=r);return i},staticRules:function(t){var n={},r=e.data(t.form,"validator");return r.settings.rules&&(n=e.validator.normalizeRule(r.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(r,i){if(i===!1){delete t[r];return}if(i.param||i.depends){var s=!0;switch(typeof i.depends){case"string":s=!!e(i.depends,n.form).length;break;case"function":s=i.depends.call(n,n)}s?t[r]=i.param!==undefined?i.param:!0:delete t[r]}}),e.each(t,function(r,i){t[r]=e.isFunction(i)?i(n):i}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:typeof t[this]=="string"&&(n=t[this].split(/[\s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if(typeof t=="string"){var n={};e.each(t.split(/\s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,r){e.validator.methods[t]=n,e.validator.messages[t]=r!==undefined?r:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,r){if(!this.depend(r,n))return"dependency-mismatch";if(n.nodeName.toLowerCase()==="select"){var i=e(n).val();return i&&i.length>0}return this.checkable(n)?this.getLength(t,n)>0:e.trim(t).length>0},remote:function(t,n,r){if(this.optional(n))return"dependency-mismatch";var i=this.previousValue(n);this.settings.messages[n.name]||(this.settings.messages[n.name]={}),i.originalMessage=this.settings.messages[n.name].remote,this.settings.messages[n.name].remote=i.message,r=typeof r=="string"&&{url:r}||r;if(i.old===t)return i.valid;i.old=t;var s=this;this.startRequest(n);var o={};return o[n.name]=t,e.ajax(e.extend(!0,{url:r,mode:"abort",port:"validate"+n.name,dataType:"json",data:o,success:function(r){s.settings.messages[n.name].remote=i.originalMessage;var o=r===!0||r==="true";if(o){var u=s.formSubmitted;s.prepareElement(n),s.formSubmitted=u,s.successList.push(n),delete s.invalid[n.name],s.showErrors()}else{var a={},f=r||s.defaultMessage(n,"remote");a[n.name]=i.message=e.isFunction(f)?f(t):f,s.invalid[n.name]=!0,s.showErrors(a)}i.valid=o,s.stopRequest(n,o)}},r)),"pending"},minlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r},maxlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i<=r},rangelength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r[0]&&i<=r[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},email:function(e,t){return this.optional(t)||/^((([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(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([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])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test((new Date(e)).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var n=0,r=0,i=!1;e=e.replace(/\D/g,"");for(var s=e.length-1;s>=0;s--){var o=e.charAt(s);r=parseInt(o,10),i&&(r*=2)>9&&(r-=9),n+=r,i=!i}return n%10===0},equalTo:function(t,n,r){var i=e(r);return this.settings.onfocusout&&i.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(n).valid()}),t===i.val()}}}),e.format=e.validator.format})(jQuery),function(e){var t={};if(e.ajaxPrefilter)e.ajaxPrefilter(function(e,n,r){var i=e.port;e.mode==="abort"&&(t[i]&&t[i].abort(),t[i]=r)});else{var n=e.ajax;e.ajax=function(r){var i=("mode"in r?r:e.ajaxSettings).mode,s=("port"in r?r:e.ajaxSettings).port;return i==="abort"?(t[s]&&t[s].abort(),t[s]=n.apply(this,arguments)):n.apply(this,arguments)}}}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,n,r){return this.bind(n,function(n){var i=e(n.target);if(i.is(t))return r.apply(i,arguments)})}})}(jQuery);
assets/js/subscriptions.js ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+
3
+ var subscription = {
4
+
5
+ init: function() {
6
+
7
+ $('input#wpuf-recuring-pay').on('click', this.showSubscriptionRecurring );
8
+
9
+ $('input#wpuf-trial-status').on('click', this.showSubscriptionPack );
10
+
11
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-apply-coupon', this.couponApply );
12
+
13
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-copon-show', this.couponShow );
14
+
15
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-copon-cancel', this.couponCancel );
16
+
17
+ $('.wpuf-assing-pack-btn').on( 'click', this.showPackDropdown );
18
+
19
+ $('.wpuf-delete-pack-btn').on( 'click', this.deletePack );
20
+
21
+ $('.wpuf-disabled-link').click( this.packAlert );
22
+
23
+ //on change enable expiration check status
24
+ this.changeExpirationFieldVisibility(':checkbox#wpuf-enable_post_expiration');
25
+
26
+ $('.wpuf-metabox-post_expiration').on('change',':checkbox#wpuf-enable_post_expiration',this.changeExpirationFieldVisibility);
27
+ //on change expiration type drop down
28
+ //this.setTimeExpiration('select#wpuf-expiration_time_type');
29
+ $('.wpuf-metabox-post_expiration').on('change','select#wpuf-expiration_time_type',this.setTimeExpiration);
30
+
31
+ },
32
+
33
+ packAlert : function () {
34
+ alert( 'Please Cancel Your Currently Active Pack first ! ' );
35
+ },
36
+
37
+ showPackDropdown: function(e) {
38
+ e.preventDefault();
39
+ var self = $(this),
40
+ wrap = self.parents('.wpuf-user-subscription'),
41
+ sub_dropdown = wrap.find('.wpuf-pack-dropdown'),
42
+ sub_details = wrap.find('.wpuf-user-sub-info'),
43
+ cancel_btn = wrap.find('.wpuf-cancel-pack'),
44
+ add_btn = wrap.find('.wpuf-add-pack');
45
+
46
+ if ( sub_dropdown.attr( 'disabled' ) === 'disabled' ) {
47
+ sub_dropdown.show().removeAttr('disabled');
48
+ sub_details.hide().attr('disabled', true );
49
+ cancel_btn.show();
50
+ add_btn.hide();
51
+ } else {
52
+ sub_details.show().removeAttr('disabled');
53
+ sub_dropdown.hide().attr('disabled', true );
54
+ cancel_btn.hide();
55
+ add_btn.show();
56
+ }
57
+
58
+ },
59
+
60
+ deletePack: function(e){
61
+ var userid = $(e.target).attr('data-userid');
62
+ $.post(
63
+ ajaxurl,
64
+ {
65
+ 'action' : 'wpuf_delete_user_package',
66
+ 'userid' : userid
67
+ },
68
+ function(data){
69
+ if(data){
70
+ $('.wpuf-user-sub-info').remove();
71
+ $(e.target).remove();
72
+ }
73
+ }
74
+ );
75
+
76
+ },
77
+
78
+ couponCancel: function(e) {
79
+
80
+ e.preventDefault();
81
+
82
+ var self = $(this),
83
+
84
+ data = {
85
+
86
+ action: 'coupon_cancel',
87
+
88
+ _wpnonce: wpuf_frontend.nonce,
89
+
90
+ pack_id: self.data('pack_id')
91
+
92
+ },
93
+
94
+ coupon_field = self.parents('.wpuf-coupon-info-wrap').find('input.wpuf-coupon-field');
95
+
96
+
97
+
98
+ coupon_field.addClass('wpuf-coupon-field-spinner');
99
+
100
+ $.post( wpuf_frontend.ajaxurl, data, function( res ) {
101
+
102
+ coupon_field.removeClass('wpuf-coupon-field-spinner');
103
+
104
+ if ( res.success ) {
105
+
106
+ $('.wpuf-pack-inner' ).html( res.data.append_data );
107
+
108
+ $('.wpuf-coupon-id-field').val('');
109
+
110
+ var coupon_wrap = self.closest('.wpuf-copon-wrap');
111
+
112
+ coupon_wrap.hide();
113
+
114
+ coupon_wrap.siblings('.wpuf-copon-show').show();
115
+
116
+ }
117
+
118
+ });
119
+
120
+
121
+
122
+ },
123
+
124
+
125
+
126
+ couponShow: function(e) {
127
+
128
+ e.preventDefault();
129
+
130
+ var self = $(this);
131
+
132
+ self.hide();
133
+
134
+ self.parents('.wpuf-coupon-info-wrap').find('.wpuf-copon-wrap').show();
135
+
136
+ },
137
+
138
+
139
+
140
+ couponApply: function(e) {
141
+
142
+ e.preventDefault();
143
+
144
+ var self = $(this),
145
+
146
+ coupon_field = self.parents('.wpuf-coupon-info-wrap').find('input.wpuf-coupon-field'),
147
+
148
+ coupon = coupon_field.val();
149
+
150
+ if ( coupon === '' ) {
151
+
152
+ $('.wpuf-subscription-error').html('Please enter a coupon code!');
153
+ return;
154
+
155
+ }
156
+
157
+ var data = {
158
+
159
+ action: 'coupon_apply',
160
+
161
+ _wpnonce: wpuf_frontend.nonce,
162
+
163
+ coupon: coupon,
164
+
165
+ pack_id: self.data('pack_id')
166
+
167
+ };
168
+
169
+
170
+
171
+ if ( self.attr('disabled') === 'disabled' ) {
172
+
173
+ //return;
174
+
175
+ }
176
+
177
+ self.attr( 'disabled', true );
178
+
179
+ coupon_field.addClass('wpuf-coupon-field-spinner');
180
+
181
+
182
+
183
+ $.post( wpuf_frontend.ajaxurl, data, function( res ) {
184
+
185
+ coupon_field.removeClass('wpuf-coupon-field-spinner');
186
+
187
+ if ( res.success ) {
188
+
189
+
190
+
191
+ $('.wpuf-pack-inner' ).html( res.data.append_data );
192
+
193
+ $('.wpuf-coupon-id-field').val( res.data.coupon_id );
194
+
195
+ if ( res.data.amount <= 0 ) {
196
+
197
+ $('.wpuf-nullamount-hide').hide();
198
+
199
+ }
200
+
201
+ } else {
202
+
203
+ $('.wpuf-subscription-error').html(res.data.message);
204
+
205
+ }
206
+
207
+ });
208
+
209
+ },
210
+
211
+
212
+
213
+ showSubscriptionRecurring: function() {
214
+
215
+
216
+
217
+ var self = $(this),
218
+
219
+ wrap = self.parents('table.form-table'),
220
+
221
+ pack_child = wrap.find('.wpuf-recurring-child'),
222
+
223
+ trial_checkbox = wrap.find( 'input#wpuf-trial-status'),
224
+
225
+ trial_child = wrap.find('.wpuf-trial-child'),
226
+
227
+ expire_field = wrap.find('.wpuf-subcription-expire');
228
+
229
+
230
+
231
+ if ( self.is(':checked') ) {
232
+
233
+ if ( trial_checkbox.is(':checked') ) {
234
+
235
+ trial_child.show();
236
+
237
+ }
238
+
239
+ pack_child.show();
240
+
241
+ expire_field.hide();
242
+
243
+ } else {
244
+
245
+ trial_child.hide();
246
+
247
+ pack_child.hide();
248
+
249
+ expire_field.show();
250
+
251
+ }
252
+
253
+ },
254
+
255
+
256
+
257
+ showSubscriptionPack: function() {
258
+
259
+ var self = $(this),
260
+
261
+ pack_status = self.closest('table.form-table').find('.wpuf-trial-child');
262
+
263
+ if ( self.is(':checked') ) {
264
+
265
+ pack_status.show();
266
+
267
+ } else {
268
+
269
+ pack_status.hide();
270
+
271
+ }
272
+
273
+ },
274
+
275
+ setTimeExpiration: function(e){
276
+ var timeArray = {
277
+ 'day' : 30,
278
+ 'month' : 12,
279
+ 'year': 100
280
+ };
281
+ $('#wpuf-expiration_time_value').html('');
282
+ var timeVal = e.target?$(e.target).val():$(e).val();
283
+ for(var time = 1; time <= timeArray[timeVal]; time++){
284
+ $('#wpuf-expiration_time_value').append('<option>'+ time +'</option>');
285
+ }
286
+ },
287
+
288
+ changeExpirationFieldVisibility : function(e){
289
+
290
+ var checkbox_obj = e.target? $(e.target) : $(e);
291
+
292
+ if ( checkbox_obj.is(':checked') ) {
293
+ $('.wpuf_expiration_field').show();
294
+ } else {
295
+ $('.wpuf_expiration_field').hide();
296
+ }
297
+ }
298
+
299
+ };
300
+
301
+ if ( typeof datepicker === 'function') {
302
+ $('.wpuf-date-picker').datepicker({ dateFormat: "yy-mm-dd" });
303
+ }
304
+
305
+ subscription.init();
306
+
307
+ })(jQuery);
assets/js/upload.js ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+
3
+ /**
4
+ * Upload handler helper
5
+ *
6
+ * @param string {browse_button} browse_button ID of the pickfile
7
+ * @param string {container} container ID of the wrapper
8
+ * @param int {max} maximum number of file uplaods
9
+ * @param string {type}
10
+ */
11
+ window.WPUF_Uploader = function (browse_button, container, max, type, allowed_type, max_file_size) {
12
+ this.removed_files = [],
13
+ this.container = container;
14
+ this.browse_button = browse_button;
15
+ this.max = max || 1;
16
+ this.count = $('#' + container).find('.wpuf-attachment-list > li').length; //count how many items are there
17
+ this.perFileCount = 0; //file count on each upload
18
+
19
+ //if no element found on the page, bail out
20
+ if( !$('#'+browse_button).length ) {
21
+ return;
22
+ }
23
+
24
+ //instantiate the uploader
25
+ this.uploader = new plupload.Uploader({
26
+ runtimes: 'html5,html4',
27
+ browse_button: browse_button,
28
+ container: container,
29
+ multipart: true,
30
+ multipart_params: {
31
+ action: 'wpuf_file_upload',
32
+ form_id: $( '#' + browse_button ).data('form_id')
33
+ },
34
+ max_file_count : 2,
35
+ multiple_queues: false,
36
+ multi_selection: ( ( browse_button == 'wpuf-avatar-pickfiles' || browse_button == 'wpuf-featured_image-pickfiles' ) ? false : true ),
37
+ urlstream_upload: true,
38
+ file_data_name: 'wpuf_file',
39
+ max_file_size: max_file_size + 'kb',
40
+ url: wpuf_frontend_upload.plupload.url + '&type=' + type,
41
+ flash_swf_url: wpuf_frontend_upload.flash_swf_url,
42
+ filters: [{
43
+ title: 'Allowed Files',
44
+ extensions: allowed_type
45
+ }]
46
+ });
47
+
48
+ //attach event handlers
49
+ this.uploader.bind('Init', $.proxy(this, 'init'));
50
+ this.uploader.bind('FilesAdded', $.proxy(this, 'added'));
51
+ this.uploader.bind('QueueChanged', $.proxy(this, 'upload'));
52
+ this.uploader.bind('UploadProgress', $.proxy(this, 'progress'));
53
+ this.uploader.bind('Error', $.proxy(this, 'error'));
54
+ this.uploader.bind('FileUploaded', $.proxy(this, 'uploaded'));
55
+
56
+ this.uploader.init();
57
+
58
+ $('#' + container).on('click', 'a.attachment-delete', $.proxy(this.removeAttachment, this));
59
+ };
60
+
61
+ WPUF_Uploader.prototype = {
62
+
63
+ init: function (up, params) {
64
+ this.showHide();
65
+ $('#' + this.container).prepend('<div class="wpuf-file-warning"></div>');
66
+ },
67
+
68
+ showHide: function () {
69
+
70
+ if ( this.count >= this.max) {
71
+
72
+ if ( this.count > this.max ) {
73
+ $('#' + this.container + ' .wpuf-file-warning').html( wpuf_frontend_upload.warning );
74
+ } else {
75
+ $('#' + this.container + ' .wpuf-file-warning').html( wpuf_frontend_upload.warning );
76
+ }
77
+
78
+ $('#' + this.container).find('.file-selector').hide();
79
+
80
+ return;
81
+ };
82
+ $('#' + this.container + ' .wpuf-file-warning').html( '' );
83
+ $('#' + this.container).find('.file-selector').show();
84
+ },
85
+
86
+ added: function (up, files) {
87
+ var $container = $('#' + this.container).find('.wpuf-attachment-upload-filelist');
88
+
89
+ this.showHide();
90
+
91
+ $.each(files, function(i, file) {
92
+ $container.append(
93
+ '<div class="upload-item" id="' + file.id + '"><div class="progress progress-striped active"><div class="bar"></div></div><div class="filename original">' +
94
+ file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
95
+ '</div></div>');
96
+ });
97
+
98
+ up.refresh(); // Reposition Flash/Silverlight
99
+ up.start();
100
+ },
101
+
102
+ upload: function (uploader) {
103
+
104
+
105
+ this.count = uploader.files.length - this.removed_files.length ;
106
+ this.showHide();
107
+
108
+
109
+ },
110
+
111
+ progress: function (up, file) {
112
+ var item = $('#' + file.id);
113
+
114
+ $('.bar', item).css({ width: file.percent + '%' });
115
+ $('.percent', item).html( file.percent + '%' );
116
+ },
117
+
118
+ error: function (up, error) {
119
+ $('#' + this.container).find('#' + error.file.id).remove();
120
+
121
+ var msg = '';
122
+ switch (error.code) {
123
+ case -600:
124
+ msg = wpuf_frontend_upload.plupload.size_error;
125
+ break;
126
+
127
+ case -601:
128
+ msg = wpuf_frontend_upload.plupload.type_error;
129
+ break;
130
+
131
+ default:
132
+ msg = 'Error #' + error.code + ': ' + error.message;
133
+ break;
134
+ }
135
+
136
+ alert(msg);
137
+
138
+ this.count -= 1;
139
+ this.showHide();
140
+ this.uploader.refresh();
141
+ },
142
+
143
+ uploaded: function (up, file, response) {
144
+ // var res = $.parseJSON(response.response);
145
+ var self = this;
146
+
147
+ $('#' + file.id + " b").html("100%");
148
+ $('#' + file.id).remove();
149
+
150
+ if(response.response !== 'error') {
151
+
152
+ this.perFileCount++;
153
+ var $container = $('#' + this.container).find('.wpuf-attachment-list');
154
+ $container.append(response.response);
155
+
156
+ if ( this.perFileCount > this.max ) {
157
+ var attach_id = $('.wpuf-image-wrap:last a.attachment-delete',$container).data('attach_id');
158
+ self.removeExtraAttachment(attach_id);
159
+ $('.wpuf-image-wrap',$container).last().remove();
160
+ this.perFileCount--;
161
+ }
162
+
163
+ } else {
164
+ alert(response.error);
165
+
166
+ this.count -= 1;
167
+ this.showHide();
168
+ }
169
+ },
170
+
171
+ removeAttachment: function(e) {
172
+ e.preventDefault();
173
+
174
+ var self = this,
175
+ el = $(e.currentTarget);
176
+
177
+ if ( confirm(wpuf_frontend_upload.confirmMsg) ) {
178
+ var data = {
179
+ 'attach_id' : el.data('attach_id'),
180
+ 'nonce' : wpuf_frontend_upload.nonce,
181
+ 'action' : 'wpuf_file_del'
182
+ };
183
+ this.removed_files.push(data);
184
+ jQuery.post(wpuf_frontend_upload.ajaxurl, data, function() {
185
+ self.perFileCount--;
186
+ el.parent().parent().remove();
187
+
188
+ self.count -= 1;
189
+ self.showHide();
190
+ self.uploader.refresh();
191
+ });
192
+ }
193
+ },
194
+
195
+ removeExtraAttachment : function( attach_id ) {
196
+
197
+
198
+ var self = this;
199
+
200
+ var data = {
201
+ 'attach_id' : attach_id,
202
+ 'nonce' : wpuf_frontend_upload.nonce,
203
+ 'action' : 'wpuf_file_del'
204
+ };
205
+ this.removed_files.push(data);
206
+ jQuery.post(wpuf_frontend_upload.ajaxurl, data, function() {
207
+ self.count -= 1;
208
+ self.showHide();
209
+ self.uploader.refresh();
210
+ });
211
+ }
212
+
213
+ };
214
+ })(jQuery);
assets/js/upload.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){window.WPUF_Uploader=function(b,c,d,e,f,g){this.removed_files=[],this.container=c,this.browse_button=b,this.max=d||1,this.count=a("#"+c).find(".wpuf-attachment-list > li").length,this.perFileCount=0,a("#"+b).length&&(this.uploader=new plupload.Uploader({runtimes:"html5,html4",browse_button:b,container:c,multipart:!0,multipart_params:{action:"wpuf_file_upload",form_id:a("#"+b).data("form_id")},max_file_count:2,multiple_queues:!1,multi_selection:"wpuf-avatar-pickfiles"!=b&&"wpuf-featured_image-pickfiles"!=b,urlstream_upload:!0,file_data_name:"wpuf_file",max_file_size:g+"kb",url:wpuf_frontend_upload.plupload.url+"&type="+e,flash_swf_url:wpuf_frontend_upload.flash_swf_url,filters:[{title:"Allowed Files",extensions:f}]}),this.uploader.bind("Init",a.proxy(this,"init")),this.uploader.bind("FilesAdded",a.proxy(this,"added")),this.uploader.bind("QueueChanged",a.proxy(this,"upload")),this.uploader.bind("UploadProgress",a.proxy(this,"progress")),this.uploader.bind("Error",a.proxy(this,"error")),this.uploader.bind("FileUploaded",a.proxy(this,"uploaded")),this.uploader.init(),a("#"+c).on("click","a.attachment-delete",a.proxy(this.removeAttachment,this)))},WPUF_Uploader.prototype={init:function(b,c){this.showHide(),a("#"+this.container).prepend('<div class="wpuf-file-warning"></div>')},showHide:function(){if(this.count>=this.max)return this.count,this.max,a("#"+this.container+" .wpuf-file-warning").html(wpuf_frontend_upload.warning),void a("#"+this.container).find(".file-selector").hide();a("#"+this.container+" .wpuf-file-warning").html(""),a("#"+this.container).find(".file-selector").show()},added:function(b,c){var d=a("#"+this.container).find(".wpuf-attachment-upload-filelist");this.showHide(),a.each(c,function(a,b){d.append('<div class="upload-item" id="'+b.id+'"><div class="progress progress-striped active"><div class="bar"></div></div><div class="filename original">'+b.name+" ("+plupload.formatSize(b.size)+") <b></b></div></div>")}),b.refresh(),b.start()},upload:function(a){this.count=a.files.length-this.removed_files.length,this.showHide()},progress:function(b,c){var d=a("#"+c.id);a(".bar",d).css({width:c.percent+"%"}),a(".percent",d).html(c.percent+"%")},error:function(b,c){a("#"+this.container).find("#"+c.file.id).remove();var d="";switch(c.code){case-600:d=wpuf_frontend_upload.plupload.size_error;break;case-601:d=wpuf_frontend_upload.plupload.type_error;break;default:d="Error #"+c.code+": "+c.message}alert(d),this.count-=1,this.showHide(),this.uploader.refresh()},uploaded:function(b,c,d){var e=this;if(a("#"+c.id+" b").html("100%"),a("#"+c.id).remove(),"error"!==d.response){this.perFileCount++;var f=a("#"+this.container).find(".wpuf-attachment-list");if(f.append(d.response),this.perFileCount>this.max){var g=a(".wpuf-image-wrap:last a.attachment-delete",f).data("attach_id");e.removeExtraAttachment(g),a(".wpuf-image-wrap",f).last().remove(),this.perFileCount--}}else alert(d.error),this.count-=1,this.showHide()},removeAttachment:function(b){b.preventDefault();var c=this,d=a(b.currentTarget);if(confirm(wpuf_frontend_upload.confirmMsg)){var e={attach_id:d.data("attach_id"),nonce:wpuf_frontend_upload.nonce,action:"wpuf_file_del"};this.removed_files.push(e),jQuery.post(wpuf_frontend_upload.ajaxurl,e,function(){c.perFileCount--,d.parent().parent().remove(),c.count-=1,c.showHide(),c.uploader.refresh()})}},removeExtraAttachment:function(a){var b=this,c={attach_id:a,nonce:wpuf_frontend_upload.nonce,action:"wpuf_file_del"};this.removed_files.push(c),jQuery.post(wpuf_frontend_upload.ajaxurl,c,function(){b.count-=1,b.showHide(),b.uploader.refresh()})}}}(jQuery);
assets/js/wpuf-form-builder-components.js ADDED
@@ -0,0 +1,1065 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+ 'use strict';
3
+
4
+ Vue.component('builder-stage', {
5
+ template: '#tmpl-wpuf-builder-stage',
6
+
7
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.builder_stage),
8
+
9
+ computed: {
10
+ form_fields: function () {
11
+ return this.$store.state.form_fields;
12
+ },
13
+
14
+ field_settings: function () {
15
+ return this.$store.state.field_settings;
16
+ },
17
+
18
+ hidden_fields: function () {
19
+ return this.$store.state.form_fields.filter(function (item) {
20
+ return 'hidden' === item.input_type;
21
+ });
22
+ },
23
+
24
+ editing_form_id: function () {
25
+ return this.$store.state.editing_field_id;
26
+ },
27
+
28
+ pro_link: function () {
29
+ return wpuf_form_builder.pro_link;
30
+ }
31
+ },
32
+
33
+ mounted: function () {
34
+ var self = this;
35
+
36
+ // bind jquery ui sortable
37
+ $('#form-preview-stage .wpuf-form.sortable-list').sortable({
38
+ placeholder: 'form-preview-stage-dropzone',
39
+ items: '.field-items',
40
+ handle: '.control-buttons .move',
41
+ scroll: true,
42
+ update: function (e, ui) {
43
+ var item = ui.item[0],
44
+ data = item.dataset,
45
+ source = data.source,
46
+ toIndex = parseInt($(ui.item).index()),
47
+ payload = {
48
+ toIndex: toIndex
49
+ };
50
+
51
+ if ('panel' === source) {
52
+ // prepare the payload to add new form element
53
+ var field_template = ui.item[0].dataset.formField,
54
+ field = $.extend(true, {}, self.field_settings[field_template].field_props);
55
+
56
+ // add a random integer id
57
+ field.id = self.get_random_id();
58
+
59
+ // add meta key
60
+ if ('yes' === field.is_meta && !field.name) {
61
+ field.name = field.label.replace(/\W/g, '_').toLowerCase() + '_' + field.id;
62
+ }
63
+
64
+ payload.field = field;
65
+
66
+ // add new form element
67
+ self.$store.commit('add_form_field_element', payload);
68
+
69
+ // remove button from stage
70
+ $(this).find('.button.ui-draggable.ui-draggable-handle').remove();
71
+
72
+ } else if ('stage' === source) {
73
+ payload.fromIndex = parseInt(data.index);
74
+
75
+ self.$store.commit('swap_form_field_elements', payload);
76
+ }
77
+
78
+ }
79
+ });
80
+ },
81
+
82
+ methods: {
83
+
84
+ open_field_settings: function(field_id) {
85
+ this.$store.commit('open_field_settings', field_id);
86
+ },
87
+
88
+ clone_field: function(field_id, index) {
89
+ var payload = {
90
+ field_id: field_id,
91
+ index: index,
92
+ new_id: this.get_random_id()
93
+ };
94
+
95
+ // single instance checking
96
+ var field = _.find(this.$store.state.form_fields, function (item) {
97
+ return parseInt(item.id) === parseInt(payload.field_id);
98
+ });
99
+
100
+ // check if these are already inserted
101
+ if ( this.isSingleInstance( field.template ) && this.containsField( field.template ) ) {
102
+ swal({
103
+ title: "Oops...",
104
+ text: "You already have this field in the form"
105
+ });
106
+ return;
107
+ }
108
+
109
+ this.$store.commit('clone_form_field_element', payload);
110
+ },
111
+
112
+ delete_field: function(index) {
113
+ var self = this;
114
+
115
+ self.warn({
116
+ text: self.i18n.delete_field_warn_msg,
117
+ confirmButtonText: self.i18n.yes_delete_it,
118
+ cancelButtonText: self.i18n.no_cancel_it,
119
+ }, function (is_confirm) {
120
+ if (is_confirm) {
121
+ self.$store.commit('delete_form_field_element', index);
122
+ }
123
+ });
124
+ },
125
+
126
+ delete_hidden_field: function (field_id) {
127
+ var i = 0;
128
+
129
+ for (i = 0; i < this.form_fields.length; i++) {
130
+ if (parseInt(field_id) === parseInt(this.form_fields[i].id)) {
131
+ this.delete_field(i);
132
+ }
133
+ }
134
+ },
135
+
136
+ is_pro_feature: function (template) {
137
+ return (this.field_settings[template] && this.field_settings[template].pro_feature) ? true : false;
138
+ },
139
+
140
+ is_template_available: function (field) {
141
+ var template = field.template;
142
+
143
+ if (this.field_settings[template]) {
144
+ if (this.is_pro_feature(template)) {
145
+ return false;
146
+ }
147
+
148
+ return true;
149
+ }
150
+
151
+ // for example see 'mixin_builder_stage' mixin's 'is_taxonomy_template_available' method
152
+ if (_.isFunction(this['is_' + template + '_template_available'])) {
153
+ return this['is_' + template + '_template_available'].call(this, field);
154
+ }
155
+
156
+ return false;
157
+ },
158
+
159
+ is_full_width: function (template) {
160
+ if (this.field_settings[template] && this.field_settings[template].is_full_width) {
161
+ return true;
162
+ }
163
+
164
+ return false;
165
+ },
166
+
167
+ get_field_name: function (template) {
168
+ return this.field_settings[template].title;
169
+ }
170
+ }
171
+ });
172
+
173
+ Vue.component('field-checkbox', {
174
+ template: '#tmpl-wpuf-field-checkbox',
175
+
176
+ mixins: [
177
+ wpuf_mixins.option_field_mixin
178
+ ],
179
+
180
+ computed: {
181
+ value: {
182
+ get: function () {
183
+ var value = this.editing_form_field[this.option_field.name];
184
+
185
+ if (this.option_field.is_single_opt) {
186
+ var option = Object.keys(this.option_field.options)[0];
187
+
188
+ if (value === option) {
189
+ return true;
190
+
191
+ } else {
192
+ return false;
193
+ }
194
+ }
195
+
196
+ return this.editing_form_field[this.option_field.name];
197
+ },
198
+
199
+ set: function (value) {
200
+ if (this.option_field.is_single_opt) {
201
+ value = value ? Object.keys(this.option_field.options)[0] : '';
202
+ }
203
+
204
+
205
+ this.$store.commit('update_editing_form_field', {
206
+ editing_field_id: this.editing_form_field.id,
207
+ field_name: this.option_field.name,
208
+ value: value
209
+ });
210
+ }
211
+ }
212
+ }
213
+ });
214
+
215
+ Vue.component('field-html_help_text', {
216
+ template: '#tmpl-wpuf-field-html_help_text',
217
+
218
+ mixins: [
219
+ wpuf_mixins.option_field_mixin
220
+ ],
221
+ });
222
+
223
+ /**
224
+ * Common settings component for option based fields
225
+ * like select, multiselect, checkbox, radio
226
+ */
227
+ Vue.component('field-option-data', {
228
+ template: '#tmpl-wpuf-field-option-data',
229
+
230
+ mixins: [
231
+ wpuf_mixins.option_field_mixin
232
+ ],
233
+
234
+ data: function () {
235
+ return {
236
+ show_value: false,
237
+ options: [],
238
+ selected: []
239
+ };
240
+ },
241
+
242
+ computed: {
243
+ field_options: function () {
244
+ return this.editing_form_field.options;
245
+ },
246
+
247
+ field_selected: function () {
248
+ return this.editing_form_field.selected;
249
+ }
250
+ },
251
+
252
+ mounted: function () {
253
+ var self = this;
254
+
255
+ this.set_options();
256
+
257
+ $(this.$el).find('.option-field-option-chooser').sortable({
258
+ items: '.option-field-option',
259
+ handle: '.sort-handler',
260
+ update: function (e, ui) {
261
+ var item = ui.item[0],
262
+ data = item.dataset,
263
+ toIndex = parseInt($(ui.item).index()),
264
+ fromIndex = parseInt(data.index);
265
+
266
+ self.options.swap(fromIndex, toIndex);
267
+ }
268
+ });
269
+ },
270
+
271
+ methods: {
272
+ set_options: function () {
273
+ var self = this;
274
+ var field_options = $.extend(true, {}, this.editing_form_field.options);
275
+
276
+ _.each(field_options, function (label, value) {
277
+ self.options.push({label: label, value: value, id: self.get_random_id()});
278
+ });
279
+
280
+ if (this.option_field.is_multiple && !_.isArray(this.field_selected)) {
281
+ this.selected = [this.field_selected];
282
+ } else {
283
+ this.selected = this.field_selected;
284
+ }
285
+ },
286
+
287
+ // in case of select or radio buttons, user should deselect default value
288
+ clear_selection: function () {
289
+ this.selected = null;
290
+ },
291
+
292
+ add_option: function () {
293
+ var count = this.options.length,
294
+ new_opt = this.i18n.option + ' - ' + (count + 1);
295
+
296
+ this.options.push({
297
+ label: new_opt , value: new_opt, id: this.get_random_id()
298
+ });
299
+ },
300
+
301
+ delete_option: function (index) {
302
+ if (this.options.length === 1) {
303
+ this.warn({
304
+ text: this.i18n.last_choice_warn_msg,
305
+ showCancelButton: false,
306
+ confirmButtonColor: "#46b450",
307
+ });
308
+
309
+ return;
310
+ }
311
+
312
+ this.options.splice(index, 1);
313
+ },
314
+
315
+ set_option_label: function (index, label) {
316
+ this.options[index].value = label.toLocaleLowerCase().replace(' ', '_');
317
+ }
318
+ },
319
+
320
+ watch: {
321
+ options: {
322
+ deep: true,
323
+ handler: function (new_opts) {
324
+ var options = {},
325
+ i = 0;
326
+
327
+ for (i = 0; i < new_opts.length; i++) {
328
+ options[new_opts[i].value] = new_opts[i].label;
329
+ }
330
+
331
+ this.update_value('options', options);
332
+ }
333
+ },
334
+
335
+ selected: function (new_val) {
336
+ this.update_value('selected', new_val);
337
+ }
338
+ }
339
+ });
340
+
341
+ Vue.component('field-option-pro-feature-alert', {
342
+ template: '#tmpl-wpuf-field-option-pro-feature-alert',
343
+
344
+ mixins: [
345
+ wpuf_mixins.option_field_mixin
346
+ ],
347
+
348
+ computed: {
349
+ pro_link: function () {
350
+ return wpuf_form_builder.pro_link;
351
+ }
352
+ }
353
+ });
354
+
355
+ /**
356
+ * Sidebar field options panel
357
+ */
358
+ Vue.component('field-options', {
359
+ template: '#tmpl-wpuf-field-options',
360
+
361
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.field_options),
362
+
363
+ data: function() {
364
+ return {
365
+ show_basic_settings: true,
366
+ show_advanced_settings: false
367
+ };
368
+ },
369
+
370
+ computed: {
371
+ editing_field_id: function () {
372
+ this.show_basic_settings = true;
373
+ this.show_advanced_settings = false;
374
+
375
+ return parseInt(this.$store.state.editing_field_id);
376
+ },
377
+
378
+ editing_form_field: function () {
379
+ var self = this;
380
+ return _.find(this.$store.state.form_fields, function (item) {
381
+ return parseInt(item.id) === parseInt(self.editing_field_id);
382
+ });
383
+ },
384
+
385
+ settings: function() {
386
+ var settings = [],
387
+ template = this.editing_form_field.template;
388
+
389
+ if (_.isFunction(this['settings_' + template])) {
390
+ settings = this['settings_' + template].call(this, this.editing_form_field);
391
+ } else {
392
+ settings = this.$store.state.field_settings[template].settings;
393
+ }
394
+
395
+ return _.sortBy(settings, function (item) {
396
+ return parseInt(item.priority);
397
+ });
398
+ },
399
+
400
+ basic_settings: function () {
401
+ return this.settings.filter(function (item) {
402
+ return 'basic' === item.section;
403
+ });
404
+ },
405
+
406
+ advanced_settings: function () {
407
+ return this.settings.filter(function (item) {
408
+ return 'advanced' === item.section;
409
+ });
410
+ },
411
+
412
+ form_field_type_title: function() {
413
+ var template = this.editing_form_field.template;
414
+
415
+ if (_.isFunction(this['form_field_' + template + '_title'])) {
416
+ return this['form_field_' + template + '_title'].call(this, this.editing_form_field);
417
+ }
418
+
419
+ return this.$store.state.field_settings[template].title;
420
+ }
421
+ }
422
+ });
423
+
424
+ Vue.component('field-radio', {
425
+ template: '#tmpl-wpuf-field-radio',
426
+
427
+ mixins: [
428
+ wpuf_mixins.option_field_mixin
429
+ ],
430
+
431
+ computed: {
432
+ value: {
433
+ get: function () {
434
+ return this.editing_form_field[this.option_field.name];
435
+ },
436
+
437
+ set: function (value) {
438
+ this.$store.commit('update_editing_form_field', {
439
+ editing_field_id: this.editing_form_field.id,
440
+ field_name: this.option_field.name,
441
+ value: value
442
+ });
443
+ }
444
+ }
445
+ }
446
+ });
447
+
448
+ Vue.component('field-select', {
449
+ template: '#tmpl-wpuf-field-select',
450
+
451
+ mixins: [
452
+ wpuf_mixins.option_field_mixin
453
+ ],
454
+
455
+ computed: {
456
+ value: {
457
+ get: function () {
458
+ return this.editing_form_field[this.option_field.name];
459
+ },
460
+
461
+ set: function (value) {
462
+ this.$store.commit('update_editing_form_field', {
463
+ editing_field_id: this.editing_form_field.id,
464
+ field_name: this.option_field.name,
465
+ value: value
466
+ });
467
+ }
468
+ }
469
+ }
470
+ });
471
+
472
+ Vue.component('field-text', {
473
+ template: '#tmpl-wpuf-field-text',
474
+
475
+ mixins: [
476
+ wpuf_mixins.option_field_mixin
477
+ ],
478
+
479
+ computed: {
480
+ value: {
481
+ get: function () {
482
+ return this.editing_form_field[this.option_field.name];
483
+ },
484
+
485
+ set: function (value) {
486
+ this.update_value(this.option_field.name, value);
487
+ }
488
+ }
489
+ },
490
+
491
+ methods: {
492
+ on_focusout: function (e) {
493
+ wpuf_form_builder.event_hub.$emit('field-text-focusout', e, this);
494
+ },
495
+ on_keyup: function (e) {
496
+ wpuf_form_builder.event_hub.$emit('field-text-keyup', e, this);
497
+ }
498
+ }
499
+ });
500
+
501
+ Vue.component('field-text-meta', {
502
+ template: '#tmpl-wpuf-field-text-meta',
503
+
504
+ mixins: [
505
+ wpuf_mixins.option_field_mixin
506
+ ],
507
+
508
+ computed: {
509
+ value: {
510
+ get: function () {
511
+ return this.editing_form_field[this.option_field.name];
512
+ },
513
+
514
+ set: function (value) {
515
+ this.update_value(this.option_field.name, value);
516
+ }
517
+ }
518
+ },
519
+
520
+ created: function () {
521
+ if ('yes' === this.editing_form_field.is_meta) {
522
+ if (!this.value) {
523
+ this.value = this.editing_form_field.label.replace(/\W/g, '_').toLowerCase();
524
+ }
525
+
526
+ wpuf_form_builder.event_hub.$on('field-text-keyup', this.meta_key_autocomplete);
527
+ }
528
+ },
529
+
530
+ methods: {
531
+ meta_key_autocomplete: function (e, label_vm) {
532
+ if (
533
+ 'label' === label_vm.option_field.name &&
534
+ parseInt(this.editing_form_field.id) === parseInt(label_vm.editing_form_field.id)
535
+ ) {
536
+ this.value = label_vm.value.replace(/\W/g, '_').toLowerCase();
537
+ }
538
+ }
539
+ }
540
+ });
541
+
542
+ Vue.component('field-textarea', {
543
+ template: '#tmpl-wpuf-field-textarea',
544
+
545
+ mixins: [
546
+ wpuf_mixins.option_field_mixin
547
+ ],
548
+
549
+ computed: {
550
+ value: {
551
+ get: function () {
552
+ return this.editing_form_field[this.option_field.name];
553
+ },
554
+
555
+ set: function (value) {
556
+ this.update_value(this.option_field.name, value);
557
+ }
558
+ }
559
+ },
560
+ });
561
+
562
+ /**
563
+ * Field template: Checkbox
564
+ */
565
+ Vue.component('form-checkbox_field', {
566
+ template: '#tmpl-wpuf-form-checkbox_field',
567
+
568
+ mixins: [
569
+ wpuf_mixins.form_field_mixin
570
+ ]
571
+ });
572
+
573
+ /**
574
+ * Field template: Hidden
575
+ */
576
+ Vue.component('form-custom_hidden_field', {
577
+ template: '#tmpl-wpuf-form-custom_hidden_field',
578
+
579
+ mixins: [
580
+ wpuf_mixins.form_field_mixin
581
+ ]
582
+ });
583
+
584
+ /**
585
+ * Field template: Custom HTML
586
+ */
587
+ Vue.component('form-custom_html', {
588
+ template: '#tmpl-wpuf-form-custom_html',
589
+
590
+ mixins: [
591
+ wpuf_mixins.form_field_mixin
592
+ ],
593
+
594
+ data: function () {
595
+ return {
596
+ raw_html: '<p>from data</p>'
597
+ };
598
+ }
599
+ });
600
+
601
+ /**
602
+ * Field template: Dropdown/Select
603
+ */
604
+ Vue.component('form-dropdown_field', {
605
+ template: '#tmpl-wpuf-form-dropdown_field',
606
+
607
+ mixins: [
608
+ wpuf_mixins.form_field_mixin
609
+ ]
610
+ });
611
+
612
+ /**
613
+ * Field template: Email
614
+ */
615
+ Vue.component('form-email_address', {
616
+ template: '#tmpl-wpuf-form-email_address',
617
+
618
+ mixins: [
619
+ wpuf_mixins.form_field_mixin
620
+ ]
621
+ });
622
+
623
+ /**
624
+ * Field template: Featured Image
625
+ */
626
+ Vue.component('form-featured_image', {
627
+ template: '#tmpl-wpuf-form-featured_image',
628
+
629
+ mixins: [
630
+ wpuf_mixins.form_field_mixin
631
+ ]
632
+ });
633
+
634
+ /**
635
+ * Sidebar form fields panel
636
+ */
637
+ Vue.component('form-fields', {
638
+ template: '#tmpl-wpuf-form-fields',
639
+
640
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.form_fields),
641
+
642
+ computed: {
643
+ panel_sections: function () {
644
+ return this.$store.state.panel_sections;
645
+ },
646
+
647
+ field_settings: function () {
648
+ return this.$store.state.field_settings;
649
+ },
650
+
651
+ form_fields: function () {
652
+ return this.$store.state.form_fields;
653
+ }
654
+ },
655
+
656
+ mounted: function () {
657
+ // bind jquery ui draggable
658
+ $(this.$el).find('.panel-form-field-buttons .button').draggable({
659
+ connectToSortable: '#form-preview-stage .wpuf-form',
660
+ helper: 'clone',
661
+ revert: 'invalid',
662
+ cancel: '.button-faded',
663
+ }).disableSelection();
664
+ },
665
+
666
+ methods: {
667
+ panel_toggle: function (index) {
668
+ this.$store.commit('panel_toggle', index);
669
+ },
670
+
671
+ add_form_field: function (field_template) {
672
+ var payload = {
673
+ toIndex: this.$store.state.form_fields.length,
674
+ };
675
+
676
+ // check if these are already inserted
677
+ if ( this.isSingleInstance( field_template ) && this.containsField( field_template ) ) {
678
+ swal({
679
+ title: "Oops...",
680
+ text: "You already have this field in the form"
681
+ });
682
+ return;
683
+ }
684
+
685
+ var field = $.extend(true, {}, this.$store.state.field_settings[field_template].field_props);
686
+
687
+ field.id = this.get_random_id();
688
+
689
+ if (!field.name && field.label) {
690
+ field.name = field.label.replace(/\W/g, '_').toLowerCase();
691
+
692
+ var same_template_fields = this.form_fields.filter(function (form_field) {
693
+ return (form_field.template === field.template);
694
+ });
695
+
696
+ if (same_template_fields.length) {
697
+ field.name += '_' + same_template_fields.length;
698
+ }
699
+ }
700
+
701
+ payload.field = field;
702
+
703
+ // add new form element
704
+ this.$store.commit('add_form_field_element', payload);
705
+ },
706
+
707
+ is_pro_feature: function (field) {
708
+ return this.field_settings[field].pro_feature;
709
+ },
710
+
711
+ alert_pro_feature: function (field) {
712
+ var title = this.field_settings[field].title;
713
+
714
+ swal({
715
+ title: '<i class="fa fa-lock"></i> ' + title + ' <br>' + this.i18n.is_a_pro_feature,
716
+ text: this.i18n.pro_feature_msg,
717
+ type: '',
718
+ html: true,
719
+ showCancelButton: true,
720
+ cancelButtonText: this.i18n.close,
721
+ confirmButtonColor: '#46b450',
722
+ confirmButtonText: this.i18n.upgrade_to_pro
723
+ }, function (is_confirm) {
724
+ if (is_confirm) {
725
+ window.open(wpuf_form_builder.pro_link, '_blank');
726
+ }
727
+ });
728
+ },
729
+
730
+ alert_invalidate_msg: function (field) {
731
+ var validator = this.field_settings[field].validator;
732
+
733
+ if (validator && validator.msg) {
734
+ this.warn({
735
+ title: validator.msg_title || '',
736
+ text: validator.msg,
737
+ html: true,
738
+ type: 'warning',
739
+ showCancelButton: false,
740
+ confirmButtonColor: '#46b450',
741
+ confirmButtonText: this.i18n.ok
742
+ });
743
+ }
744
+ },
745
+
746
+ get_invalidate_btn_class: function (field) {
747
+ return this.field_settings[field].validator.button_class;
748
+ }
749
+ }
750
+ });
751
+
752
+ /**
753
+ * Field template: Image Upload
754
+ */
755
+ Vue.component('form-image_upload', {
756
+ template: '#tmpl-wpuf-form-image_upload',
757
+
758
+ mixins: [
759
+ wpuf_mixins.form_field_mixin
760
+ ]
761
+ });
762
+
763
+ /**
764
+ * Field template: Multi-Select
765
+ */
766
+ Vue.component('form-multiple_select', {
767
+ template: '#tmpl-wpuf-form-multiple_select',
768
+
769
+ mixins: [
770
+ wpuf_mixins.form_field_mixin
771
+ ]
772
+ });
773
+
774
+ /**
775
+ * Field Template: Post Content
776
+ */
777
+ Vue.component('form-post_content', {
778
+ template: '#tmpl-wpuf-form-post_content',
779
+
780
+ mixins: [
781
+ wpuf_mixins.form_field_mixin
782
+ ]
783
+ });
784
+
785
+ /**
786
+ * Field Template: Post Excerpt
787
+ */
788
+ Vue.component('form-post_excerpt', {
789
+ template: '#tmpl-wpuf-form-post_excerpt',
790
+
791
+ mixins: [
792
+ wpuf_mixins.form_field_mixin
793
+ ]
794
+ });
795
+
796
+ /**
797
+ * Field template: post_tags
798
+ */
799
+ Vue.component('form-post_tags', {
800
+ template: '#tmpl-wpuf-form-post_tags',
801
+
802
+ mixins: [
803
+ wpuf_mixins.form_field_mixin
804
+ ]
805
+ });
806
+
807
+ /**
808
+ * Field template: Post Title
809
+ */
810
+ Vue.component('form-post_title', {
811
+ template: '#tmpl-wpuf-form-post_title',
812
+
813
+ mixins: [
814
+ wpuf_mixins.form_field_mixin
815
+ ]
816
+ });
817
+
818
+ /**
819
+ * Field template: Radio
820
+ */
821
+ Vue.component('form-radio_field', {
822
+ template: '#tmpl-wpuf-form-radio_field',
823
+
824
+ mixins: [
825
+ wpuf_mixins.form_field_mixin
826
+ ]
827
+ });
828
+
829
+ /**
830
+ * Field template: Section Break
831
+ */
832
+ Vue.component('form-section_break', {
833
+ template: '#tmpl-wpuf-form-section_break',
834
+
835
+ mixins: [
836
+ wpuf_mixins.form_field_mixin
837
+ ]
838
+ });
839
+
840
+ /**
841
+ * Field template: taxonomy
842
+ */
843
+ Vue.component('form-taxonomy', {
844
+ template: '#tmpl-wpuf-form-taxonomy',
845
+
846
+ mixins: [
847
+ wpuf_mixins.form_field_mixin
848
+ ],
849
+
850
+ computed: {
851
+ terms: function () {
852
+ var i;
853
+
854
+ for (i in wpuf_form_builder.wp_post_types) {
855
+ var taxonomies = wpuf_form_builder.wp_post_types[i];
856
+
857
+ if (taxonomies.hasOwnProperty(this.field.name)) {
858
+ var tax_field = taxonomies[this.field.name];
859
+
860
+ if (tax_field.terms) {
861
+ return tax_field.terms;
862
+ }
863
+ }
864
+ }
865
+
866
+ return [];
867
+ },
868
+
869
+ sorted_terms: function () {
870
+ var self = this;
871
+ var terms = $.extend(true, [], this.terms);
872
+
873
+ // selection type and terms
874
+ if (this.field.exclude_type && this.field.exclude) {
875
+ var filter_ids = this.field.exclude.split(',').map(function (id) {
876
+ id = id.trim();
877
+ id = parseInt(id);
878
+ return id;
879
+ }).filter(function (id) {
880
+ return isFinite(id);
881
+ });
882
+
883
+ terms = terms.filter(function (term) {
884
+
885
+ switch(self.field.exclude_type) {
886
+ case 'exclude':
887
+ return _.indexOf(filter_ids, term.term_id) < 0;
888
+
889
+ case 'include':
890
+ return _.indexOf(filter_ids, term.term_id) >= 0;
891
+
892
+ case 'child_of':
893
+ return _.indexOf(filter_ids, parseInt(term.parent)) >= 0;
894
+ }
895
+ });
896
+ }
897
+
898
+ // order
899
+ terms = _.sortBy(terms, function (term) {
900
+ return term[self.field.orderby];
901
+ });
902
+
903
+ if ('DESC' === this.field.order) {
904
+ terms = terms.reverse();
905
+ }
906
+
907
+ var parent_terms = terms.filter(function (term) {
908
+ return !term.parent;
909
+ });
910
+
911
+ parent_terms.map(function (parent) {
912
+ parent.children = self.get_child_terms(parent.term_id, terms);
913
+ });
914
+
915
+ return parent_terms.length ? parent_terms : terms;
916
+ }
917
+ },
918
+
919
+ methods: {
920
+ get_child_terms: function (parent_id, terms) {
921
+ var self = this;
922
+
923
+ var child_terms = terms.filter(function (term) {
924
+ return parseInt(term.parent) === parseInt(parent_id);
925
+ });
926
+
927
+ child_terms.map(function (child) {
928
+ child.children = self.get_child_terms(child.term_id, terms);
929
+ });
930
+
931
+ return child_terms;
932
+ },
933
+
934
+ get_term_dropdown_options: function () {
935
+ var self = this,
936
+ options = '';
937
+
938
+ _.each(self.sorted_terms, function (term) {
939
+ options += self.get_term_dropdown_options_children(term, 0);
940
+ });
941
+
942
+ return options;
943
+ },
944
+
945
+ get_term_dropdown_options_children: function (term, level) {
946
+ var self = this,
947
+ option = '';
948
+
949
+ var indent = '',
950
+ i = 0;
951
+
952
+ for (i = 0; i < level; i++) {
953
+ indent += '&nbsp;&nbsp;';
954
+ }
955
+
956
+ option += '<option value="' + term.id + '">' + indent + term.name + '</option>';
957
+
958
+ if (term.children.length) {
959
+ _.each(term.children, function (child_term) {
960
+ option += self.get_term_dropdown_options_children(child_term, (level + 1));
961
+ });
962
+ }
963
+
964
+ return option;
965
+ },
966
+
967
+ get_term_checklist: function () {
968
+ var self = this,
969
+ checklist = '';
970
+
971
+
972
+ checklist += '<ul class="wpuf-category-checklist">';
973
+
974
+ _.each(this.sorted_terms, function (term) {
975
+ checklist += self.get_term_checklist_li(term);
976
+ });
977
+
978
+ checklist += '</ul>';
979
+
980
+ return checklist;
981
+ },
982
+
983
+ get_term_checklist_li: function (term) {
984
+ var self = this,
985
+ li = '';
986
+
987
+ li += '<li><label class="selectit"><input type="checkbox"> ' + term.name + '</label></li>';
988
+
989
+ if (term.children.length) {
990
+ li += '<ul class="children">';
991
+
992
+ _.each(term.children, function (child_term) {
993
+ li += self.get_term_checklist_li(child_term);
994
+ });
995
+
996
+ li += '</ul>';
997
+ }
998
+
999
+ return li;
1000
+ }
1001
+ }
1002
+ });
1003
+
1004
+ /**
1005
+ * Field template: Text
1006
+ */
1007
+ Vue.component('form-text_field', {
1008
+ template: '#tmpl-wpuf-form-text_field',
1009
+
1010
+ mixins: [
1011
+ wpuf_mixins.form_field_mixin
1012
+ ]
1013
+ });
1014
+
1015
+ Vue.component('form-textarea_field', {
1016
+ template: '#tmpl-wpuf-form-textarea_field',
1017
+
1018
+ mixins: [
1019
+ wpuf_mixins.form_field_mixin
1020
+ ]
1021
+ });
1022
+
1023
+ /**
1024
+ * Field template: Website URL
1025
+ */
1026
+ Vue.component('form-website_url', {
1027
+ template: '#tmpl-wpuf-form-website_url',
1028
+
1029
+ mixins: [
1030
+ wpuf_mixins.form_field_mixin
1031
+ ]
1032
+ });
1033
+
1034
+ Vue.component('help-text', {
1035
+ template: '#tmpl-wpuf-help-text',
1036
+
1037
+ props: {
1038
+ text: {
1039
+ type: String,
1040
+ default: ''
1041
+ }
1042
+ },
1043
+
1044
+ mounted: function () {
1045
+ $(".wpuf-tooltip").tooltip();
1046
+ }
1047
+ });
1048
+
1049
+ Vue.component('text-editor', {
1050
+ template: '#tmpl-wpuf-text-editor',
1051
+
1052
+ props: ['rich'],
1053
+
1054
+ computed: {
1055
+ site_url: function () {
1056
+ return wpuf_form_builder.site_url;
1057
+ },
1058
+
1059
+ is_full: function () {
1060
+ return 'yes' === this.rich;
1061
+ }
1062
+ }
1063
+ });
1064
+
1065
+ })(jQuery);
assets/js/wpuf-form-builder-mixins.js ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Mixin for form fields like
6
+ * form-text_field, form-field_textarea etc
7
+ */
8
+ wpuf_mixins.form_field_mixin = {
9
+ props: {
10
+ field: {
11
+ type: Object,
12
+ default: {}
13
+ }
14
+ },
15
+
16
+ computed: {
17
+ form_id: function () {
18
+ return this.$store.state.post.ID;
19
+ },
20
+
21
+ has_options: function () {
22
+ if (!this.field.hasOwnProperty('options')) {
23
+ return false;
24
+ }
25
+
26
+ return !!Object.keys(this.field.options).length;
27
+ }
28
+ },
29
+
30
+ methods: {
31
+ class_names: function(type_class) {
32
+ return [
33
+ type_class,
34
+ this.required_class(),
35
+ 'wpuf_' + this.field.name + '_' + this.form_id
36
+ ];
37
+ },
38
+
39
+ required_class: function () {
40
+ return ('yes' === this.required) ? 'required' : '';
41
+ },
42
+
43
+ is_selected: function (label) {
44
+ if (_.isArray(this.field.selected)) {
45
+ if (_.indexOf(this.field.selected, label) >= 0) {
46
+ return true;
47
+ }
48
+
49
+ } else if (label === this.field.selected) {
50
+ return true;
51
+ }
52
+
53
+ return false;
54
+ }
55
+ }
56
+ };
57
+
58
+ /**
59
+ * Global mixin
60
+ */
61
+ Vue.mixin({
62
+ computed: {
63
+ i18n: function () {
64
+ return wpuf_form_builder.i18n;
65
+ }
66
+ },
67
+
68
+ methods: {
69
+ get_random_id: function() {
70
+ var min = 999999,
71
+ max = 9999999999;
72
+
73
+ return Math.floor(Math.random() * (max - min + 1)) + min;
74
+ },
75
+
76
+ warn: function (settings, callback) {
77
+ settings = $.extend(true, {
78
+ title: '',
79
+ text: '',
80
+ type: 'warning',
81
+ showCancelButton: true,
82
+ confirmButtonColor: '#d54e21',
83
+ confirmButtonText: this.i18n.ok,
84
+ cancelButtonText: this.i18n.cancel,
85
+ }, settings);
86
+
87
+ swal(settings, callback);
88
+ },
89
+
90
+ is_failed_to_validate: function (template) {
91
+ var validator = this.field_settings[template] ? this.field_settings[template].validator : false;
92
+
93
+ if (validator && validator.callback && !this[validator.callback]()) {
94
+ return true;
95
+ }
96
+
97
+ return false;
98
+ },
99
+
100
+ containsField: function(field_name) {
101
+ var i = 0;
102
+
103
+ for (i = 0; i < this.$store.state.form_fields.length; i++) {
104
+ if (this.$store.state.form_fields[i].name === field_name) {
105
+ return true;
106
+ }
107
+ }
108
+
109
+ return false;
110
+ },
111
+
112
+ isSingleInstance: function(field_name) {
113
+ var singleInstance = ['post_title', 'post_content', 'post_excerpt', 'featured_image',
114
+ 'user_login', 'first_name', 'last_name', 'nickname', 'user_email', 'user_url',
115
+ 'user_bio', 'password', 'user_avatar'];
116
+
117
+ if ( $.inArray(field_name, singleInstance) >= 0 ) {
118
+ return true;
119
+ }
120
+
121
+ return false;
122
+ }
123
+ }
124
+ });
125
+
126
+ /**
127
+ * Mixin for option fields like
128
+ * field-text, field-text-meta, field-radio etc
129
+ */
130
+ wpuf_mixins.option_field_mixin = {
131
+ props: {
132
+ option_field: {
133
+ type: Object,
134
+ default: {}
135
+ },
136
+
137
+ editing_form_field: {
138
+ type: Object,
139
+ default: {}
140
+ }
141
+ },
142
+
143
+ computed: {
144
+ // show/hide on basis of depenedent settings
145
+ met_dependencies: function () {
146
+ // no 'dependencies' key
147
+ if (!this.option_field.hasOwnProperty('dependencies')) {
148
+ return true;
149
+ }
150
+
151
+ var deps = Object.keys(this.option_field.dependencies),
152
+ i = 0;
153
+
154
+ // has 'dependencies' key, but no property is set
155
+ if (!deps.length) {
156
+ return true;
157
+ }
158
+
159
+ // check if dependencies met
160
+ for (i = 0; i < deps.length; i++) {
161
+ var required_dep_value = this.option_field.dependencies[ deps[i] ],
162
+ editing_field_value = this.editing_form_field[ deps[i] ];
163
+
164
+ if (required_dep_value !== editing_field_value) {
165
+ return false;
166
+ }
167
+ }
168
+
169
+ return true;
170
+ }
171
+ },
172
+
173
+ methods: {
174
+ update_value: function(property, value) {
175
+ this.$store.commit('update_editing_form_field', {
176
+ editing_field_id: this.editing_form_field.id,
177
+ field_name: property,
178
+ value: value
179
+ });
180
+ },
181
+ }
182
+ };
183
+
184
+ })(jQuery);
assets/js/wpuf-form-builder-wpuf-forms.js ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Only proceed if current page is a 'Post Forms' form builder page
6
+ */
7
+ if (!$('#wpuf-form-builder.wpuf-form-builder-post').length) {
8
+ return;
9
+ }
10
+
11
+ window.wpuf_forms_mixin_root = {
12
+ data: function () {
13
+ return {
14
+ validation_error_msg: wpuf_form_builder.i18n.any_of_three_needed
15
+ };
16
+ },
17
+
18
+ methods: {
19
+ // wpuf_forms must have either 'post_title', 'post_content' or 'post_excerpt'
20
+ // field template
21
+ validate_form_before_submit: function () {
22
+ var is_valid = false;
23
+
24
+ _.each(this.form_fields, function (form_field) {
25
+ if (_.indexOf(['post_title', 'post_content', 'post_excerpt'], form_field.template) >= 0) {
26
+ is_valid = true;
27
+ return;
28
+ }
29
+ });
30
+
31
+ return is_valid;
32
+ }
33
+ }
34
+ };
35
+
36
+ window.wpuf_forms_mixin_builder_stage = {
37
+ data: function () {
38
+ return {
39
+ label_type: 'left',
40
+ post_form_settings: {
41
+ submit_text: '',
42
+ draft_post: false,
43
+ }
44
+ };
45
+ },
46
+
47
+ mounted: function () {
48
+ var self = this;
49
+
50
+ // submit button text
51
+ this.post_form_settings.submit_text = $('[name="wpuf_settings[submit_text]"]').val();
52
+
53
+ $('[name="wpuf_settings[submit_text]"]').on('change', function () {
54
+ self.post_form_settings.submit_text = $(this).val();
55
+ });
56
+
57
+ // draft post text
58
+ this.post_form_settings.draft_post = $('[type="checkbox"][name="wpuf_settings[draft_post]"]').is(':checked') ? true : false;
59
+ $('[type="checkbox"][name="wpuf_settings[draft_post]"]').on('change', function () {
60
+ self.post_form_settings.draft_post = $(this).is(':checked') ? true : false;
61
+ });
62
+
63
+ // set taxonomies according to selected post type
64
+ var post_type_dropdown = $('select[name="wpuf_settings[post_type]"]'),
65
+ post_type = post_type_dropdown.val();
66
+
67
+ this.set_taxonomies(post_type);
68
+
69
+ post_type_dropdown.on('change', function () {
70
+ self.set_taxonomies($(this).val());
71
+ });
72
+ },
73
+
74
+ methods: {
75
+ set_taxonomies: function (post_type) {
76
+ var self = this,
77
+ taxonomies = wpuf_form_builder.wp_post_types[post_type],
78
+ tax_names = taxonomies ? Object.keys(taxonomies) : [];
79
+
80
+ self.$store.commit('set_panel_section_fields', {
81
+ id: 'taxonomies',
82
+ fields: tax_names
83
+ });
84
+
85
+ // Bind jquery ui draggable. But first destory any previous binding
86
+ Vue.nextTick(function () {
87
+ var buttons = $('#panel-form-field-buttons-taxonomies .button');
88
+
89
+ buttons.each(function () {
90
+ if ($(this).draggable('instance')) {
91
+ $(this).draggable('destroy');
92
+ }
93
+ });
94
+
95
+ buttons.draggable({
96
+ connectToSortable: '#form-preview-stage .wpuf-form',
97
+ helper: 'clone',
98
+ revert: 'invalid',
99
+ cancel: '.button-faded',
100
+ }).disableSelection();
101
+ });
102
+ },
103
+
104
+ // executed in 'builder-stage' component by 'is_template_available' method
105
+ is_post_tags_template_available: function () {
106
+ return true;
107
+ },
108
+
109
+ // executed in 'builder-stage' component by 'is_template_available' method
110
+ is_taxonomy_template_available: function (field) {
111
+ return this.field_settings[field.name] ? true : false;
112
+ }
113
+ }
114
+ };
115
+
116
+ window.wpuf_forms_mixin_field_options = {
117
+ methods: {
118
+ form_field_post_tags_title: function () {
119
+ return this.$store.state.field_settings.post_tag.title;
120
+ },
121
+
122
+ form_field_taxonomy_title: function (form_field) {
123
+ return this.$store.state.field_settings[form_field.name].title;
124
+ },
125
+
126
+ settings_post_tags: function () {
127
+ return this.$store.state.field_settings.post_tag.settings;
128
+ },
129
+
130
+ settings_taxonomy: function (form_field) {
131
+ return this.$store.state.field_settings[form_field.name].settings;
132
+ }
133
+ }
134
+ };
135
+ })(jQuery);
assets/js/wpuf-form-builder.js ADDED
@@ -0,0 +1,458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Only proceed if current page is a form builder page
6
+ */
7
+ if (!$('#wpuf-form-builder').length) {
8
+ return;
9
+ }
10
+
11
+ if (!Array.prototype.hasOwnProperty('swap')) {
12
+ Array.prototype.swap = function (from, to) {
13
+ this.splice(to, 0, this.splice(from, 1)[0]);
14
+ };
15
+ }
16
+
17
+ // check if an element is visible in browser viewport
18
+ function is_element_in_viewport (el) {
19
+ if (typeof jQuery === "function" && el instanceof jQuery) {
20
+ el = el[0];
21
+ }
22
+
23
+ var rect = el.getBoundingClientRect();
24
+
25
+ return (
26
+ rect.top >= 0 &&
27
+ rect.left >= 0 &&
28
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
29
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Vuex Store data
35
+ */
36
+ var wpuf_form_builder_store = new Vuex.Store({
37
+ state: {
38
+ post: wpuf_form_builder.post,
39
+ form_fields: wpuf_form_builder.form_fields,
40
+ panel_sections: wpuf_form_builder.panel_sections,
41
+ field_settings: wpuf_form_builder.field_settings,
42
+ notifications: wpuf_form_builder.notifications,
43
+ current_panel: 'form-fields',
44
+ editing_field_id: 0, // editing form field id
45
+ },
46
+
47
+ mutations: {
48
+ set_form_fields: function (state, form_fields) {
49
+ Vue.set(state, 'form_fields', form_fields);
50
+ },
51
+
52
+ // set the current panel
53
+ set_current_panel: function (state, panel) {
54
+ if ('field-options' !== state.current_panel &&
55
+ 'field-options' === panel &&
56
+ state.form_fields.length
57
+ ) {
58
+ state.editing_field_id = state.form_fields[0].id;
59
+ }
60
+
61
+ state.current_panel = panel;
62
+
63
+ // reset editing field id
64
+ if ('form-fields' === panel) {
65
+ state.editing_field_id = 0;
66
+ }
67
+ },
68
+
69
+ // add show property to every panel section
70
+ panel_add_show_prop: function (state) {
71
+ state.panel_sections.map(function (section, index) {
72
+ if (!section.hasOwnProperty('show')) {
73
+ Vue.set(state.panel_sections[index], 'show', true);
74
+ }
75
+ });
76
+ },
77
+
78
+ // toggle panel sections
79
+ panel_toggle: function (state, index) {
80
+ state.panel_sections[index].show = !state.panel_sections[index].show;
81
+ },
82
+
83
+ // open field settings panel
84
+ open_field_settings: function (state, field_id) {
85
+ var field = state.form_fields.filter(function(item) {
86
+ return parseInt(field_id) === parseInt(item.id);
87
+ });
88
+
89
+ if ('field-options' === state.current_panel && field[0].id === state.editing_field_id) {
90
+ return;
91
+ }
92
+
93
+ if (field.length) {
94
+ state.editing_field_id = 0;
95
+ state.current_panel = 'field-options';
96
+
97
+ setTimeout(function () {
98
+ state.editing_field_id = field[0].id;
99
+ }, 400);
100
+ }
101
+ },
102
+
103
+ update_editing_form_field: function (state, payload) {
104
+ var editing_field = _.find(state.form_fields, function (item) {
105
+ return parseInt(item.id) === parseInt(payload.editing_field_id);
106
+ });
107
+
108
+ editing_field[payload.field_name] = payload.value;
109
+ },
110
+
111
+ // add new form field element
112
+ add_form_field_element: function (state, payload) {
113
+ state.form_fields.splice(payload.toIndex, 0, payload.field);
114
+
115
+ // bring newly added element into viewport
116
+ Vue.nextTick(function () {
117
+ var el = $('#form-preview-stage .wpuf-form .field-items').eq(payload.toIndex);
118
+
119
+ if (el && !is_element_in_viewport(el.get(0))) {
120
+ $('#builder-stage section').scrollTo(el, 800, {offset: -50});
121
+ }
122
+ });
123
+ },
124
+
125
+ // sorting inside stage
126
+ swap_form_field_elements: function (state, payload) {
127
+ state.form_fields.swap(payload.fromIndex, payload.toIndex);
128
+ },
129
+
130
+ clone_form_field_element: function (state, payload) {
131
+ var field = _.find(state.form_fields, function (item) {
132
+ return parseInt(item.id) === parseInt(payload.field_id);
133
+ });
134
+
135
+ var clone = $.extend(true, {}, field),
136
+ index = parseInt(payload.index) + 1;
137
+
138
+ clone.id = payload.new_id;
139
+ clone.name = clone.name + '_copy';
140
+
141
+ state.form_fields.splice(index, 0, clone);
142
+ },
143
+
144
+ // delete a field
145
+ delete_form_field_element: function (state, index) {
146
+ state.current_panel = 'form-fields';
147
+ state.form_fields.splice(index, 1);
148
+ },
149
+
150
+ // set fields for a panel section
151
+ set_panel_section_fields: function (state, payload) {
152
+ var section = _.find(state.panel_sections, function (item) {
153
+ return item.id === payload.id;
154
+ });
155
+
156
+ section.fields = payload.fields;
157
+ },
158
+
159
+ // notifications
160
+ addNotification: function(state, payload) {
161
+ state.notifications.push(payload);
162
+ },
163
+
164
+ deleteNotification: function(state, index) {
165
+ state.notifications.splice(index, 1);
166
+ },
167
+
168
+ cloneNotification: function(state, index) {
169
+ var clone = $.extend(true, {}, state.notifications[index]);
170
+
171
+ index = parseInt(index) + 1;
172
+ state.notifications.splice(index, 0, clone);
173
+ },
174
+
175
+ // update by it's property
176
+ updateNotificationProperty: function(state, payload) {
177
+ state.notifications[payload.index][payload.property] = payload.value;
178
+ },
179
+
180
+ updateNotification: function(state, payload) {
181
+ state.notifications[payload.index] = payload.value;
182
+ }
183
+ }
184
+ });
185
+
186
+ /**
187
+ * The main form builder vue instance
188
+ */
189
+ new Vue({
190
+ el: '#wpuf-form-builder',
191
+
192
+ mixins: wpuf_form_builder_mixins(wpuf_mixins.root),
193
+
194
+ store: wpuf_form_builder_store,
195
+
196
+ data: {
197
+ is_form_saving: false,
198
+ is_form_saved: false,
199
+ is_form_switcher: false,
200
+ post_title_editing: false,
201
+ },
202
+
203
+ computed: {
204
+ current_panel: function () {
205
+ return this.$store.state.current_panel;
206
+ },
207
+
208
+ post: function () {
209
+ return this.$store.state.post;
210
+ },
211
+
212
+ form_fields_count: function () {
213
+ return this.$store.state.form_fields.length;
214
+ },
215
+
216
+ form_fields: function () {
217
+ return this.$store.state.form_fields;
218
+ },
219
+
220
+ notifications: function() {
221
+ return this.$store.state.notifications;
222
+ }
223
+ },
224
+
225
+ created: function () {
226
+ this.$store.commit('panel_add_show_prop');
227
+
228
+ /**
229
+ * This is the event hub we'll use in every
230
+ * component to communicate between them
231
+ */
232
+ wpuf_form_builder.event_hub = new Vue();
233
+ },
234
+
235
+ mounted: function () {
236
+ // primary nav tabs and their contents
237
+ this.bind_tab_on_click($('#wpuf-form-builder > fieldset > .nav-tab-wrapper > a'), '#wpuf-form-builder');
238
+
239
+ // secondary settings tabs and their contents
240
+ var settings_tabs = $('#wpuf-form-builder-settings .nav-tab'),
241
+ settings_tab_contents = $('#wpuf-form-builder-settings .tab-contents .group');
242
+
243
+ settings_tabs.first().addClass('nav-tab-active');
244
+ settings_tab_contents.first().addClass('active');
245
+
246
+ this.bind_tab_on_click(settings_tabs, '#wpuf-form-builder-settings');
247
+
248
+ var clipboard = new window.Clipboard('.form-id');
249
+ $(".form-id").tooltip();
250
+
251
+ var self = this;
252
+
253
+ clipboard.on('success', function(e) {
254
+ // Show copied tooltip
255
+ $(e.trigger)
256
+ .attr('data-original-title', 'Copied!')
257
+ .tooltip('show');
258
+
259
+ // Reset the copied tooltip
260
+ setTimeout(function() {
261
+ $(e.trigger).tooltip('hide')
262
+ .attr('data-original-title', self.i18n.copy_shortcode);
263
+ }, 1000);
264
+
265
+ e.clearSelection();
266
+ });
267
+
268
+ window.onbeforeunload = function () {
269
+ if (!self.is_form_saved) {
270
+ return self.i18n.unsaved_changes;
271
+ }
272
+ };
273
+ },
274
+
275
+ methods: {
276
+ // tabs and their contents
277
+ bind_tab_on_click: function (tabs, scope) {
278
+ tabs.on('click', function (e) {
279
+ e.preventDefault();
280
+
281
+ var button = $(this),
282
+ tab_contents = $(scope + ' > fieldset > .tab-contents'),
283
+ group_id = button.attr('href');
284
+
285
+ button.addClass('nav-tab-active').siblings('.nav-tab-active').removeClass('nav-tab-active');
286
+
287
+ tab_contents.children().removeClass('active');
288
+ $(group_id).addClass('active');
289
+ });
290
+ },
291
+
292
+ // switch form
293
+ switch_form: function () {
294
+ this.is_form_switcher = (this.is_form_switcher) ? false : true;
295
+ },
296
+
297
+ // set current sidebar panel
298
+ set_current_panel: function (panel) {
299
+ this.$store.commit('set_current_panel', panel);
300
+ },
301
+
302
+ // save form builder data
303
+ save_form_builder: function () {
304
+ var self = this;
305
+
306
+ if (_.isFunction(this.validate_form_before_submit) && !this.validate_form_before_submit()) {
307
+
308
+ this.warn({
309
+ text: this.validation_error_msg
310
+ });
311
+
312
+ return;
313
+ }
314
+
315
+ self.is_form_saving = true;
316
+ self.set_current_panel('form-fields');
317
+
318
+ wp.ajax.send('wpuf_form_builder_save_form', {
319
+ data: {
320
+ form_data: $('#wpuf-form-builder').serialize(),
321
+ form_fields: JSON.stringify(self.form_fields),
322
+ notifications: JSON.stringify(self.notifications)
323
+ },
324
+
325
+ success: function (response) {
326
+ if (response.form_fields) {
327
+ self.$store.commit('set_form_fields', response.form_fields);
328
+ }
329
+
330
+ self.is_form_saving = false;
331
+ self.is_form_saved = true;
332
+
333
+ toastr.success(self.i18n.saved_form_data);
334
+ },
335
+
336
+ error: function () {
337
+ self.is_form_saving = false;
338
+ }
339
+ });
340
+ }
341
+ }
342
+ });
343
+
344
+ var SettingsTab = {
345
+ init: function() {
346
+ $(function() {
347
+ $('.wpuf-ms-color').wpColorPicker();
348
+ });
349
+
350
+ $('#wpuf-metabox-settings').on('change', 'select[name="wpuf_settings[redirect_to]"]', this.settingsRedirect);
351
+ $('#wpuf-metabox-settings-update').on('change', 'select[name="wpuf_settings[edit_redirect_to]"]', this.settingsRedirect);
352
+ $('select[name="wpuf_settings[redirect_to]"]').change();
353
+ $('select[name="wpuf_settings[edit_redirect_to]"]').change();
354
+
355
+ // Form settings: Guest post
356
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_post]"]', this.settingsGuest);
357
+ $('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger('change');
358
+
359
+ // From settings: User details
360
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_details]"]', this.settingsGuestDetails);
361
+
362
+ this.changeMultistepVisibility($('.wpuf_enable_multistep_section :input[type="checkbox"]'));
363
+ var self = this;
364
+ $('.wpuf_enable_multistep_section :input[type="checkbox"]').click(function() {
365
+ self.changeMultistepVisibility($(this));
366
+ });
367
+ },
368
+
369
+ settingsGuest: function (e) {
370
+ e.preventDefault();
371
+
372
+ var table = $(this).closest('table');
373
+
374
+ if ( $(this).is(':checked') ) {
375
+ table.find('tr.show-if-guest').show();
376
+ table.find('tr.show-if-not-guest').hide();
377
+
378
+ $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
379
+
380
+ } else {
381
+ table.find('tr.show-if-guest').hide();
382
+ table.find('tr.show-if-not-guest').show();
383
+ }
384
+ },
385
+
386
+ settingsGuestDetails: function (e) {
387
+ e.preventDefault();
388
+
389
+ var table = $(this).closest('table');
390
+
391
+ if ( $(this).is(':checked') ) {
392
+ table.find('tr.show-if-details').show();
393
+ } else {
394
+ table.find('tr.show-if-details').hide();
395
+ }
396
+ },
397
+
398
+ settingsRedirect: function(e) {
399
+ e.preventDefault();
400
+
401
+ var $self = $(this),
402
+ $table = $self.closest('table'),
403
+ value = $self.val();
404
+
405
+ switch( value ) {
406
+ case 'post':
407
+ $table.find('tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page').hide();
408
+ break;
409
+
410
+ case 'page':
411
+ $table.find('tr.wpuf-page-id').show();
412
+ $table.find('tr.wpuf-same-page').hide();
413
+ $table.find('tr.wpuf-url').hide();
414
+ break;
415
+
416
+ case 'url':
417
+ $table.find('tr.wpuf-page-id').hide();
418
+ $table.find('tr.wpuf-same-page').hide();
419
+ $table.find('tr.wpuf-url').show();
420
+ break;
421
+
422
+ case 'same':
423
+ $table.find('tr.wpuf-page-id').hide();
424
+ $table.find('tr.wpuf-url').hide();
425
+ $table.find('tr.wpuf-same-page').show();
426
+ break;
427
+ }
428
+ },
429
+
430
+ changeMultistepVisibility: function(target) {
431
+ if (target.is(':checked')) {
432
+ $('.wpuf_multistep_content').show();
433
+ } else {
434
+ $('.wpuf_multistep_content').hide();
435
+ }
436
+ }
437
+ };
438
+
439
+ // on DOM ready
440
+ $(function() {
441
+ resizeBuilderContainer();
442
+
443
+ $("#collapse-menu").click(function () {
444
+ resizeBuilderContainer();
445
+ });
446
+
447
+ function resizeBuilderContainer() {
448
+ if ($(document.body).hasClass('folded')) {
449
+ $("#wpuf-form-builder").css("width", "calc(100% - 80px)");
450
+ } else {
451
+ $("#wpuf-form-builder").css("width", "calc(100% - 200px)");
452
+ }
453
+ }
454
+
455
+ SettingsTab.init();
456
+ });
457
+
458
+ })(jQuery);
assets/js/wpuf-tmc-button.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+
3
+ tinymce.create('tinymce.plugins.wpuf_button', {
4
+ init : function(editor, url) {
5
+ var menuItem = [];
6
+ var ds_img = wpuf_assets_url +'/images/ufp.png';
7
+ $.each( wpuf_shortcodes, function( i, val ){
8
+ var tempObj = {
9
+ text : val.title,
10
+ onclick: function() {
11
+ editor.insertContent(val.content)
12
+ }
13
+ };
14
+
15
+ menuItem.push( tempObj );
16
+ } );
17
+ // Register buttons - trigger above command when clickeditor
18
+ editor.addButton('wpuf_button', {
19
+ title : 'WPUF shortcodes',
20
+ classes : 'wpuf-ss',
21
+ type : 'menubutton',
22
+ menu : menuItem,
23
+ style : ' background-size : 22px; background-repeat : no-repeat; background-image: url( '+ ds_img +' );'
24
+ });
25
+ },
26
+ });
27
+
28
+ // Register our TinyMCE plugin
29
+
30
+ tinymce.PluginManager.add('wpuf_button', tinymce.plugins.wpuf_button);
31
+ });
assets/vendor/clipboard/clipboard.js ADDED
@@ -0,0 +1,778 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * clipboard.js v1.6.0
3
+ * https://zenorocha.github.io/clipboard.js
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
8
+ var DOCUMENT_NODE_TYPE = 9;
9
+
10
+ /**
11
+ * A polyfill for Element.matches()
12
+ */
13
+ if (Element && !Element.prototype.matches) {
14
+ var proto = Element.prototype;
15
+
16
+ proto.matches = proto.matchesSelector ||
17
+ proto.mozMatchesSelector ||
18
+ proto.msMatchesSelector ||
19
+ proto.oMatchesSelector ||
20
+ proto.webkitMatchesSelector;
21
+ }
22
+
23
+ /**
24
+ * Finds the closest parent that matches a selector.
25
+ *
26
+ * @param {Element} element
27
+ * @param {String} selector
28
+ * @return {Function}
29
+ */
30
+ function closest (element, selector) {
31
+ while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
32
+ if (element.matches(selector)) return element;
33
+ element = element.parentNode;
34
+ }
35
+ }
36
+
37
+ module.exports = closest;
38
+
39
+ },{}],2:[function(require,module,exports){
40
+ var closest = require('./closest');
41
+
42
+ /**
43
+ * Delegates event to a selector.
44
+ *
45
+ * @param {Element} element
46
+ * @param {String} selector
47
+ * @param {String} type
48
+ * @param {Function} callback
49
+ * @param {Boolean} useCapture
50
+ * @return {Object}
51
+ */
52
+ function delegate(element, selector, type, callback, useCapture) {
53
+ var listenerFn = listener.apply(this, arguments);
54
+
55
+ element.addEventListener(type, listenerFn, useCapture);
56
+
57
+ return {
58
+ destroy: function() {
59
+ element.removeEventListener(type, listenerFn, useCapture);
60
+ }
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Finds closest match and invokes callback.
66
+ *
67
+ * @param {Element} element
68
+ * @param {String} selector
69
+ * @param {String} type
70
+ * @param {Function} callback
71
+ * @return {Function}
72
+ */
73
+ function listener(element, selector, type, callback) {
74
+ return function(e) {
75
+ e.delegateTarget = closest(e.target, selector);
76
+
77
+ if (e.delegateTarget) {
78
+ callback.call(element, e);
79
+ }
80
+ }
81
+ }
82
+
83
+ module.exports = delegate;
84
+
85
+ },{"./closest":1}],3:[function(require,module,exports){
86
+ /**
87
+ * Check if argument is a HTML element.
88
+ *
89
+ * @param {Object} value
90
+ * @return {Boolean}
91
+ */
92
+ exports.node = function(value) {
93
+ return value !== undefined
94
+ && value instanceof HTMLElement
95
+ && value.nodeType === 1;
96
+ };
97
+
98
+ /**
99
+ * Check if argument is a list of HTML elements.
100
+ *
101
+ * @param {Object} value
102
+ * @return {Boolean}
103
+ */
104
+ exports.nodeList = function(value) {
105
+ var type = Object.prototype.toString.call(value);
106
+
107
+ return value !== undefined
108
+ && (type === '[object NodeList]' || type === '[object HTMLCollection]')
109
+ && ('length' in value)
110
+ && (value.length === 0 || exports.node(value[0]));
111
+ };
112
+
113
+ /**
114
+ * Check if argument is a string.
115
+ *
116
+ * @param {Object} value
117
+ * @return {Boolean}
118
+ */
119
+ exports.string = function(value) {
120
+ return typeof value === 'string'
121
+ || value instanceof String;
122
+ };
123
+
124
+ /**
125
+ * Check if argument is a function.
126
+ *
127
+ * @param {Object} value
128
+ * @return {Boolean}
129
+ */
130
+ exports.fn = function(value) {
131
+ var type = Object.prototype.toString.call(value);
132
+
133
+ return type === '[object Function]';
134
+ };
135
+
136
+ },{}],4:[function(require,module,exports){
137
+ var is = require('./is');
138
+ var delegate = require('delegate');
139
+
140
+ /**
141
+ * Validates all params and calls the right
142
+ * listener function based on its target type.
143
+ *
144
+ * @param {String|HTMLElement|HTMLCollection|NodeList} target
145
+ * @param {String} type
146
+ * @param {Function} callback
147
+ * @return {Object}
148
+ */
149
+ function listen(target, type, callback) {
150
+ if (!target && !type && !callback) {
151
+ throw new Error('Missing required arguments');
152
+ }
153
+
154
+ if (!is.string(type)) {
155
+ throw new TypeError('Second argument must be a String');
156
+ }
157
+
158
+ if (!is.fn(callback)) {
159
+ throw new TypeError('Third argument must be a Function');
160
+ }
161
+
162
+ if (is.node(target)) {
163
+ return listenNode(target, type, callback);
164
+ }
165
+ else if (is.nodeList(target)) {
166
+ return listenNodeList(target, type, callback);
167
+ }
168
+ else if (is.string(target)) {
169
+ return listenSelector(target, type, callback);
170
+ }
171
+ else {
172
+ throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Adds an event listener to a HTML element
178
+ * and returns a remove listener function.
179
+ *
180
+ * @param {HTMLElement} node
181
+ * @param {String} type
182
+ * @param {Function} callback
183
+ * @return {Object}
184
+ */
185
+ function listenNode(node, type, callback) {
186
+ node.addEventListener(type, callback);
187
+
188
+ return {
189
+ destroy: function() {
190
+ node.removeEventListener(type, callback);
191
+ }
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Add an event listener to a list of HTML elements
197
+ * and returns a remove listener function.
198
+ *
199
+ * @param {NodeList|HTMLCollection} nodeList
200
+ * @param {String} type
201
+ * @param {Function} callback
202
+ * @return {Object}
203
+ */
204
+ function listenNodeList(nodeList, type, callback) {
205
+ Array.prototype.forEach.call(nodeList, function(node) {
206
+ node.addEventListener(type, callback);
207
+ });
208
+
209
+ return {
210
+ destroy: function() {
211
+ Array.prototype.forEach.call(nodeList, function(node) {
212
+ node.removeEventListener(type, callback);
213
+ });
214
+ }
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Add an event listener to a selector
220
+ * and returns a remove listener function.
221
+ *
222
+ * @param {String} selector
223
+ * @param {String} type
224
+ * @param {Function} callback
225
+ * @return {Object}
226
+ */
227
+ function listenSelector(selector, type, callback) {
228
+ return delegate(document.body, selector, type, callback);
229
+ }
230
+
231
+ module.exports = listen;
232
+
233
+ },{"./is":3,"delegate":2}],5:[function(require,module,exports){
234
+ function select(element) {
235
+ var selectedText;
236
+
237
+ if (element.nodeName === 'SELECT') {
238
+ element.focus();
239
+
240
+ selectedText = element.value;
241
+ }
242
+ else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
243
+ var isReadOnly = element.hasAttribute('readonly');
244
+
245
+ if (!isReadOnly) {
246
+ element.setAttribute('readonly', '');
247
+ }
248
+
249
+ element.select();
250
+ element.setSelectionRange(0, element.value.length);
251
+
252
+ if (!isReadOnly) {
253
+ element.removeAttribute('readonly');
254
+ }
255
+
256
+ selectedText = element.value;
257
+ }
258
+ else {
259
+ if (element.hasAttribute('contenteditable')) {
260
+ element.focus();
261
+ }
262
+
263
+ var selection = window.getSelection();
264
+ var range = document.createRange();
265
+
266
+ range.selectNodeContents(element);
267
+ selection.removeAllRanges();
268
+ selection.addRange(range);
269
+
270
+ selectedText = selection.toString();
271
+ }
272
+
273
+ return selectedText;
274
+ }
275
+
276
+ module.exports = select;
277
+
278
+ },{}],6:[function(require,module,exports){
279
+ function E () {
280
+ // Keep this empty so it's easier to inherit from
281
+ // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
282
+ }
283
+
284
+ E.prototype = {
285
+ on: function (name, callback, ctx) {
286
+ var e = this.e || (this.e = {});
287
+
288
+ (e[name] || (e[name] = [])).push({
289
+ fn: callback,
290
+ ctx: ctx
291
+ });
292
+
293
+ return this;
294
+ },
295
+
296
+ once: function (name, callback, ctx) {
297
+ var self = this;
298
+ function listener () {
299
+ self.off(name, listener);
300
+ callback.apply(ctx, arguments);
301
+ };
302
+
303
+ listener._ = callback
304
+ return this.on(name, listener, ctx);
305
+ },
306
+
307
+ emit: function (name) {
308
+ var data = [].slice.call(arguments, 1);
309
+ var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
310
+ var i = 0;
311
+ var len = evtArr.length;
312
+
313
+ for (i; i < len; i++) {
314
+ evtArr[i].fn.apply(evtArr[i].ctx, data);
315
+ }
316
+
317
+ return this;
318
+ },
319
+
320
+ off: function (name, callback) {
321
+ var e = this.e || (this.e = {});
322
+ var evts = e[name];
323
+ var liveEvents = [];
324
+
325
+ if (evts && callback) {
326
+ for (var i = 0, len = evts.length; i < len; i++) {
327
+ if (evts[i].fn !== callback && evts[i].fn._ !== callback)
328
+ liveEvents.push(evts[i]);
329
+ }
330
+ }
331
+
332
+ // Remove event from queue to prevent memory leak
333
+ // Suggested by https://github.com/lazd
334
+ // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
335
+
336
+ (liveEvents.length)
337
+ ? e[name] = liveEvents
338
+ : delete e[name];
339
+
340
+ return this;
341
+ }
342
+ };
343
+
344
+ module.exports = E;
345
+
346
+ },{}],7:[function(require,module,exports){
347
+ (function (global, factory) {
348
+ if (typeof define === "function" && define.amd) {
349
+ define(['module', 'select'], factory);
350
+ } else if (typeof exports !== "undefined") {
351
+ factory(module, require('select'));
352
+ } else {
353
+ var mod = {
354
+ exports: {}
355
+ };
356
+ factory(mod, global.select);
357
+ global.clipboardAction = mod.exports;
358
+ }
359
+ })(this, function (module, _select) {
360
+ 'use strict';
361
+
362
+ var _select2 = _interopRequireDefault(_select);
363
+
364
+ function _interopRequireDefault(obj) {
365
+ return obj && obj.__esModule ? obj : {
366
+ default: obj
367
+ };
368
+ }
369
+
370
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
371
+ return typeof obj;
372
+ } : function (obj) {
373
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
374
+ };
375
+
376
+ function _classCallCheck(instance, Constructor) {
377
+ if (!(instance instanceof Constructor)) {
378
+ throw new TypeError("Cannot call a class as a function");
379
+ }
380
+ }
381
+
382
+ var _createClass = function () {
383
+ function defineProperties(target, props) {
384
+ for (var i = 0; i < props.length; i++) {
385
+ var descriptor = props[i];
386
+ descriptor.enumerable = descriptor.enumerable || false;
387
+ descriptor.configurable = true;
388
+ if ("value" in descriptor) descriptor.writable = true;
389
+ Object.defineProperty(target, descriptor.key, descriptor);
390
+ }
391
+ }
392
+
393
+ return function (Constructor, protoProps, staticProps) {
394
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
395
+ if (staticProps) defineProperties(Constructor, staticProps);
396
+ return Constructor;
397
+ };
398
+ }();
399
+
400
+ var ClipboardAction = function () {
401
+ /**
402
+ * @param {Object} options
403
+ */
404
+ function ClipboardAction(options) {
405
+ _classCallCheck(this, ClipboardAction);
406
+
407
+ this.resolveOptions(options);
408
+ this.initSelection();
409
+ }
410
+
411
+ /**
412
+ * Defines base properties passed from constructor.
413
+ * @param {Object} options
414
+ */
415
+
416
+
417
+ _createClass(ClipboardAction, [{
418
+ key: 'resolveOptions',
419
+ value: function resolveOptions() {
420
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
421
+
422
+ this.action = options.action;
423
+ this.emitter = options.emitter;
424
+ this.target = options.target;
425
+ this.text = options.text;
426
+ this.trigger = options.trigger;
427
+
428
+ this.selectedText = '';
429
+ }
430
+ }, {
431
+ key: 'initSelection',
432
+ value: function initSelection() {
433
+ if (this.text) {
434
+ this.selectFake();
435
+ } else if (this.target) {
436
+ this.selectTarget();
437
+ }
438
+ }
439
+ }, {
440
+ key: 'selectFake',
441
+ value: function selectFake() {
442
+ var _this = this;
443
+
444
+ var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
445
+
446
+ this.removeFake();
447
+
448
+ this.fakeHandlerCallback = function () {
449
+ return _this.removeFake();
450
+ };
451
+ this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
452
+
453
+ this.fakeElem = document.createElement('textarea');
454
+ // Prevent zooming on iOS
455
+ this.fakeElem.style.fontSize = '12pt';
456
+ // Reset box model
457
+ this.fakeElem.style.border = '0';
458
+ this.fakeElem.style.padding = '0';
459
+ this.fakeElem.style.margin = '0';
460
+ // Move element out of screen horizontally
461
+ this.fakeElem.style.position = 'absolute';
462
+ this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
463
+ // Move element to the same position vertically
464
+ var yPosition = window.pageYOffset || document.documentElement.scrollTop;
465
+ this.fakeElem.style.top = yPosition + 'px';
466
+
467
+ this.fakeElem.setAttribute('readonly', '');
468
+ this.fakeElem.value = this.text;
469
+
470
+ document.body.appendChild(this.fakeElem);
471
+
472
+ this.selectedText = (0, _select2.default)(this.fakeElem);
473
+ this.copyText();
474
+ }
475
+ }, {
476
+ key: 'removeFake',
477
+ value: function removeFake() {
478
+ if (this.fakeHandler) {
479
+ document.body.removeEventListener('click', this.fakeHandlerCallback);
480
+ this.fakeHandler = null;
481
+ this.fakeHandlerCallback = null;
482
+ }
483
+
484
+ if (this.fakeElem) {
485
+ document.body.removeChild(this.fakeElem);
486
+ this.fakeElem = null;
487
+ }
488
+ }
489
+ }, {
490
+ key: 'selectTarget',
491
+ value: function selectTarget() {
492
+ this.selectedText = (0, _select2.default)(this.target);
493
+ this.copyText();
494
+ }
495
+ }, {
496
+ key: 'copyText',
497
+ value: function copyText() {
498
+ var succeeded = void 0;
499
+
500
+ try {
501
+ succeeded = document.execCommand(this.action);
502
+ } catch (err) {
503
+ succeeded = false;
504
+ }
505
+
506
+ this.handleResult(succeeded);
507
+ }
508
+ }, {
509
+ key: 'handleResult',
510
+ value: function handleResult(succeeded) {
511
+ this.emitter.emit(succeeded ? 'success' : 'error', {
512
+ action: this.action,
513
+ text: this.selectedText,
514
+ trigger: this.trigger,
515
+ clearSelection: this.clearSelection.bind(this)
516
+ });
517
+ }
518
+ }, {
519
+ key: 'clearSelection',
520
+ value: function clearSelection() {
521
+ if (this.target) {
522
+ this.target.blur();
523
+ }
524
+
525
+ window.getSelection().removeAllRanges();
526
+ }
527
+ }, {
528
+ key: 'destroy',
529
+ value: function destroy() {
530
+ this.removeFake();
531
+ }
532
+ }, {
533
+ key: 'action',
534
+ set: function set() {
535
+ var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
536
+
537
+ this._action = action;
538
+
539
+ if (this._action !== 'copy' && this._action !== 'cut') {
540
+ throw new Error('Invalid "action" value, use either "copy" or "cut"');
541
+ }
542
+ },
543
+ get: function get() {
544
+ return this._action;
545
+ }
546
+ }, {
547
+ key: 'target',
548
+ set: function set(target) {
549
+ if (target !== undefined) {
550
+ if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
551
+ if (this.action === 'copy' && target.hasAttribute('disabled')) {
552
+ throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
553
+ }
554
+
555
+ if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
556
+ throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
557
+ }
558
+
559
+ this._target = target;
560
+ } else {
561
+ throw new Error('Invalid "target" value, use a valid Element');
562
+ }
563
+ }
564
+ },
565
+ get: function get() {
566
+ return this._target;
567
+ }
568
+ }]);
569
+
570
+ return ClipboardAction;
571
+ }();
572
+
573
+ module.exports = ClipboardAction;
574
+ });
575
+
576
+ },{"select":5}],8:[function(require,module,exports){
577
+ (function (global, factory) {
578
+ if (typeof define === "function" && define.amd) {
579
+ define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
580
+ } else if (typeof exports !== "undefined") {
581
+ factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
582
+ } else {
583
+ var mod = {
584
+ exports: {}
585
+ };
586
+ factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
587
+ global.clipboard = mod.exports;
588
+ }
589
+ })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
590
+ 'use strict';
591
+
592
+ var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
593
+
594
+ var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
595
+
596
+ var _goodListener2 = _interopRequireDefault(_goodListener);
597
+
598
+ function _interopRequireDefault(obj) {
599
+ return obj && obj.__esModule ? obj : {
600
+ default: obj
601
+ };
602
+ }
603
+
604
+ function _classCallCheck(instance, Constructor) {
605
+ if (!(instance instanceof Constructor)) {
606
+ throw new TypeError("Cannot call a class as a function");
607
+ }
608
+ }
609
+
610
+ var _createClass = function () {
611
+ function defineProperties(target, props) {
612
+ for (var i = 0; i < props.length; i++) {
613
+ var descriptor = props[i];
614
+ descriptor.enumerable = descriptor.enumerable || false;
615
+ descriptor.configurable = true;
616
+ if ("value" in descriptor) descriptor.writable = true;
617
+ Object.defineProperty(target, descriptor.key, descriptor);
618
+ }
619
+ }
620
+
621
+ return function (Constructor, protoProps, staticProps) {
622
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
623
+ if (staticProps) defineProperties(Constructor, staticProps);
624
+ return Constructor;
625
+ };
626
+ }();
627
+
628
+ function _possibleConstructorReturn(self, call) {
629
+ if (!self) {
630
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
631
+ }
632
+
633
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
634
+ }
635
+
636
+ function _inherits(subClass, superClass) {
637
+ if (typeof superClass !== "function" && superClass !== null) {
638
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
639
+ }
640
+
641
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
642
+ constructor: {
643
+ value: subClass,
644
+ enumerable: false,
645
+ writable: true,
646
+ configurable: true
647
+ }
648
+ });
649
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
650
+ }
651
+
652
+ var Clipboard = function (_Emitter) {
653
+ _inherits(Clipboard, _Emitter);
654
+
655
+ /**
656
+ * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
657
+ * @param {Object} options
658
+ */
659
+ function Clipboard(trigger, options) {
660
+ _classCallCheck(this, Clipboard);
661
+
662
+ var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
663
+
664
+ _this.resolveOptions(options);
665
+ _this.listenClick(trigger);
666
+ return _this;
667
+ }
668
+
669
+ /**
670
+ * Defines if attributes would be resolved using internal setter functions
671
+ * or custom functions that were passed in the constructor.
672
+ * @param {Object} options
673
+ */
674
+
675
+
676
+ _createClass(Clipboard, [{
677
+ key: 'resolveOptions',
678
+ value: function resolveOptions() {
679
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
680
+
681
+ this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
682
+ this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
683
+ this.text = typeof options.text === 'function' ? options.text : this.defaultText;
684
+ }
685
+ }, {
686
+ key: 'listenClick',
687
+ value: function listenClick(trigger) {
688
+ var _this2 = this;
689
+
690
+ this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
691
+ return _this2.onClick(e);
692
+ });
693
+ }
694
+ }, {
695
+ key: 'onClick',
696
+ value: function onClick(e) {
697
+ var trigger = e.delegateTarget || e.currentTarget;
698
+
699
+ if (this.clipboardAction) {
700
+ this.clipboardAction = null;
701
+ }
702
+
703
+ this.clipboardAction = new _clipboardAction2.default({
704
+ action: this.action(trigger),
705
+ target: this.target(trigger),
706
+ text: this.text(trigger),
707
+ trigger: trigger,
708
+ emitter: this
709
+ });
710
+ }
711
+ }, {
712
+ key: 'defaultAction',
713
+ value: function defaultAction(trigger) {
714
+ return getAttributeValue('action', trigger);
715
+ }
716
+ }, {
717
+ key: 'defaultTarget',
718
+ value: function defaultTarget(trigger) {
719
+ var selector = getAttributeValue('target', trigger);
720
+
721
+ if (selector) {
722
+ return document.querySelector(selector);
723
+ }
724
+ }
725
+ }, {
726
+ key: 'defaultText',
727
+ value: function defaultText(trigger) {
728
+ return getAttributeValue('text', trigger);
729
+ }
730
+ }, {
731
+ key: 'destroy',
732
+ value: function destroy() {
733
+ this.listener.destroy();
734
+
735
+ if (this.clipboardAction) {
736
+ this.clipboardAction.destroy();
737
+ this.clipboardAction = null;
738
+ }
739
+ }
740
+ }], [{
741
+ key: 'isSupported',
742
+ value: function isSupported() {
743
+ var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
744
+
745
+ var actions = typeof action === 'string' ? [action] : action;
746
+ var support = !!document.queryCommandSupported;
747
+
748
+ actions.forEach(function (action) {
749
+ support = support && !!document.queryCommandSupported(action);
750
+ });
751
+
752
+ return support;
753
+ }
754
+ }]);
755
+
756
+ return Clipboard;
757
+ }(_tinyEmitter2.default);
758
+
759
+ /**
760
+ * Helper function to retrieve attribute value.
761
+ * @param {String} suffix
762
+ * @param {Element} element
763
+ */
764
+ function getAttributeValue(suffix, element) {
765
+ var attribute = 'data-clipboard-' + suffix;
766
+
767
+ if (!element.hasAttribute(attribute)) {
768
+ return;
769
+ }
770
+
771
+ return element.getAttribute(attribute);
772
+ }
773
+
774
+ module.exports = Clipboard;
775
+ });
776
+
777
+ },{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)
778
+ });
assets/vendor/clipboard/clipboard.min.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*!
2
+ * clipboard.js v1.6.0
3
+ * https://zenorocha.github.io/clipboard.js
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Clipboard=e()}}(function(){var e,t,n;return function e(t,n,o){function i(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){var n=t[a][1][e];return i(n?n:e)},s,s.exports,e,t,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,n){function o(e,t){for(;e&&e.nodeType!==i;){if(e.matches(t))return e;e=e.parentNode}}var i=9;if(Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}t.exports=o},{}],2:[function(e,t,n){function o(e,t,n,o,r){var a=i.apply(this,arguments);return e.addEventListener(n,a,r),{destroy:function(){e.removeEventListener(n,a,r)}}}function i(e,t,n,o){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&o.call(e,n)}}var r=e("./closest");t.exports=o},{"./closest":1}],3:[function(e,t,n){n.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},n.nodeList=function(e){var t=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===t||"[object HTMLCollection]"===t)&&"length"in e&&(0===e.length||n.node(e[0]))},n.string=function(e){return"string"==typeof e||e instanceof String},n.fn=function(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t}},{}],4:[function(e,t,n){function o(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!c.string(t))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(e))return i(e,t,n);if(c.nodeList(e))return r(e,t,n);if(c.string(e))return a(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}function r(e,t,n){return Array.prototype.forEach.call(e,function(e){e.addEventListener(t,n)}),{destroy:function(){Array.prototype.forEach.call(e,function(e){e.removeEventListener(t,n)})}}}function a(e,t,n){return l(document.body,e,t,n)}var c=e("./is"),l=e("delegate");t.exports=o},{"./is":3,delegate:2}],5:[function(e,t,n){function o(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var o=window.getSelection(),i=document.createRange();i.selectNodeContents(e),o.removeAllRanges(),o.addRange(i),t=o.toString()}return t}t.exports=o},{}],6:[function(e,t,n){function o(){}o.prototype={on:function(e,t,n){var o=this.e||(this.e={});return(o[e]||(o[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){function o(){i.off(e,o),t.apply(n,arguments)}var i=this;return o._=t,this.on(e,o,n)},emit:function(e){var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),o=0,i=n.length;for(o;o<i;o++)n[o].fn.apply(n[o].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),o=n[e],i=[];if(o&&t)for(var r=0,a=o.length;r<a;r++)o[r].fn!==t&&o[r].fn._!==t&&i.push(o[r]);return i.length?n[e]=i:delete n[e],this}},t.exports=o},{}],7:[function(t,n,o){!function(i,r){if("function"==typeof e&&e.amd)e(["module","select"],r);else if("undefined"!=typeof o)r(n,t("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(t),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=function(){function e(t){o(this,e),this.resolveOptions(t),this.initSelection()}return a(e,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function e(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function e(){var t=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function e(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function e(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function e(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function e(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function e(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function e(){this.removeFake()}},{key:"action",set:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function e(){return this._action}},{key:"target",set:function e(t){if(void 0!==t){if(!t||"object"!==("undefined"==typeof t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function e(){return this._target}}]),e}();e.exports=c})},{select:5}],8:[function(t,n,o){!function(i,r){if("function"==typeof e&&e.amd)e(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof o)r(n,t("./clipboard-action"),t("tiny-emitter"),t("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(e,t,n,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n="data-clipboard-"+e;if(t.hasAttribute(n))return t.getAttribute(n)}var u=i(t),s=i(n),f=i(o),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),h=function(e){function t(e,n){r(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.resolveOptions(n),o.listenClick(e),o}return c(t,e),d(t,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function e(t){var n=this;this.listener=(0,f.default)(t,"click",function(e){return n.onClick(e)})}},{key:"onClick",value:function e(t){var n=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new u.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})}},{key:"defaultAction",value:function e(t){return l("action",t)}},{key:"defaultTarget",value:function e(t){var n=l("target",t);if(n)return document.querySelector(n)}},{key:"defaultText",value:function e(t){return l("text",t)}},{key:"destroy",value:function e(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof t?[t]:t,o=!!document.queryCommandSupported;return n.forEach(function(e){o=o&&!!document.queryCommandSupported(e)}),o}}]),t}(s.default);e.exports=h})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});
assets/vendor/vue/vue.js CHANGED
File without changes
assets/vendor/vue/vue.min.js CHANGED
File without changes
assets/vendor/vuex/vuex.js CHANGED
File without changes
assets/vendor/vuex/vuex.min.js CHANGED
File without changes
class/frontend-form-post.php CHANGED
@@ -79,7 +79,7 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
79
  $post_id = isset( $_GET['pid'] ) ? intval( $_GET['pid'] ) : 0;
80
 
81
  if ( !$post_id ) {
82
- return '<div class="wpuf-info">' . __( 'Invalid post', 'wpuf' );
83
  }
84
 
85
  //is editing enabled?
@@ -188,13 +188,12 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
188
  $user = get_user_by( 'email', $guest_email );
189
  if ( $user ) {
190
  // $post_author = $user->ID;
191
- echo json_encode( array(
192
  'success' => false,
193
  'error' => __( "You already have an account in our site. Please login to continue.\n\nClicking 'OK' will redirect you to the login page and you will lost the form data.\nClick 'Cancel' to stay at this page.", 'wpuf' ),
194
  'type' => 'login',
195
  'redirect_to' => wp_login_url( get_permalink( $_POST['page_id'] ) )
196
  ) );
197
- exit;
198
  } else {
199
 
200
  // user not found, lets register him
@@ -458,6 +457,12 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
458
  }
459
 
460
  wp_set_post_terms( $post_id, $non_hierarchical, $taxonomy['name'] );
 
 
 
 
 
 
461
  }
462
  } // hierarchical
463
  } // is text
@@ -545,8 +550,7 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
545
 
546
  wpuf_clear_buffer();
547
 
548
- echo json_encode( $response );
549
- exit;
550
  }
551
 
552
  $this->send_error( __( 'Something went wrong', 'wpuf' ) );
@@ -575,17 +579,13 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
575
  $form_settings = wpuf_get_form_settings( $form_id );
576
 
577
  $content_slug = 'post_content_' . $form_id;
578
- $post_content = isset( $_POST[ $content_slug ] ) ? trim( $_POST[ $content_slug ] ) : $_POST[ 'post_content' ];
579
 
580
  list( $post_vars, $taxonomy_vars, $meta_vars ) = $form_vars;
581
 
582
- $charging_enabled = wpuf_get_option( 'charge_posting', 'wpuf_payment' );
583
-
584
- $user_wpuf_subscription_pack = get_user_meta( get_current_user_id(), '_wpuf_subscription_pack', true );
585
-
586
  $postarr = array(
587
  'post_type' => $form_settings['post_type'],
588
- 'post_status' => ( $charging_enabled == 'yes' && ! isset( $_POST['post_id'] ) ) ? 'pending' : 'draft',
589
  'post_author' => get_current_user_id(),
590
  'post_title' => isset( $_POST['post_title'] ) ? trim( $_POST['post_title'] ) : '',
591
  'post_content' => $post_content,
79
  $post_id = isset( $_GET['pid'] ) ? intval( $_GET['pid'] ) : 0;
80
 
81
  if ( !$post_id ) {
82
+ return '<div class="wpuf-info">' . __( 'Invalid post', 'wpuf' ) . '</div>';
83
  }
84
 
85
  //is editing enabled?
188
  $user = get_user_by( 'email', $guest_email );
189
  if ( $user ) {
190
  // $post_author = $user->ID;
191
+ wp_send_json( array(
192
  'success' => false,
193
  'error' => __( "You already have an account in our site. Please login to continue.\n\nClicking 'OK' will redirect you to the login page and you will lost the form data.\nClick 'Cancel' to stay at this page.", 'wpuf' ),
194
  'type' => 'login',
195
  'redirect_to' => wp_login_url( get_permalink( $_POST['page_id'] ) )
196
  ) );
 
197
  } else {
198
 
199
  // user not found, lets register him
457
  }
458
 
459
  wp_set_post_terms( $post_id, $non_hierarchical, $taxonomy['name'] );
460
+
461
+ // woocommerce check
462
+ if ( isset( $taxonomy['woo_attr'] ) && $taxonomy['woo_attr'] == 'yes' && !empty( $_POST[$taxonomy['name']] ) ) {
463
+ $woo_attr[sanitize_title( $taxonomy['name'] )] = $this->woo_attribute( $taxonomy );
464
+ }
465
+
466
  }
467
  } // hierarchical
468
  } // is text
550
 
551
  wpuf_clear_buffer();
552
 
553
+ wp_send_json( $response );
 
554
  }
555
 
556
  $this->send_error( __( 'Something went wrong', 'wpuf' ) );
579
  $form_settings = wpuf_get_form_settings( $form_id );
580
 
581
  $content_slug = 'post_content_' . $form_id;
582
+ $post_content = isset( $_POST[ $content_slug ] ) ? trim( $_POST[ $content_slug ] ) : isset( $_POST[ 'post_content' ] ) ? $_POST[ 'post_content' ] : '';
583
 
584
  list( $post_vars, $taxonomy_vars, $meta_vars ) = $form_vars;
585
 
 
 
 
 
586
  $postarr = array(
587
  'post_type' => $form_settings['post_type'],
588
+ 'post_status' => wpuf_get_draft_post_status( $form_settings ),
589
  'post_author' => get_current_user_id(),
590
  'post_title' => isset( $_POST['post_title'] ) ? trim( $_POST['post_title'] ) : '',
591
  'post_content' => $post_content,
class/payment.php CHANGED
@@ -279,7 +279,7 @@ class WPUF_Payment {
279
  $pack = WPUF_Subscription::init()->get_subscription( $pack_id );
280
  $custom = $pack->meta_value;
281
  $billing_amount = $pack->meta_value['billing_amount'];
282
- $amount = $this->coupon_discount( $_POST['coupon_code'], $billing_amount, $pack_id );
283
  $item_name = $pack->post_title;
284
  $item_number = $pack->ID;
285
  break;
@@ -306,54 +306,6 @@ class WPUF_Payment {
306
  }
307
  }
308
 
309
- function coupon_discount( $coupon_code, $amount, $pack_id ) {
310
- if ( empty( $coupon_code ) ) {
311
- return $amount;
312
- }
313
-
314
- $coupon = get_page_by_title( $coupon_code, 'OBJECT', 'wpuf_coupon' );
315
- $coupon_meta = WPUF_Coupons::init()->get_coupon_meta( $coupon->ID );
316
- $coupon_usage = get_post_meta( $coupon->ID, 'coupon_usage', true );
317
- $coupon_usage = count( $coupon_usage );
318
- $start_date = date( 'Y-d-m', strtotime( $coupon_meta['start_date'] ) );
319
- $end_date = date( 'Y-d-m', strtotime( $coupon_meta['end_date'] ) );
320
- $today = date( 'Y-d-m', time() );
321
- $current_use_email = wp_get_current_user()->user_email;
322
-
323
- if ( empty( $coupon_meta['amount'] ) || $coupon_meta['amount'] == 0 ) {
324
- return $amount;
325
- }
326
-
327
- if ( $coupon_meta['package'] != 'all' && $coupon_meta['package'] != $pack_id ) {
328
- return $amount;
329
- }
330
-
331
- if ( $coupon_meta['usage_limit'] < $coupon_usage ) {
332
- return $amount;
333
- }
334
-
335
- if ( $start_date > $today && $today > $end_date ) {
336
- return $amount;
337
- }
338
-
339
- if ( count( $coupon_meta['access'] ) && !in_array( $current_use_email, $coupon_meta['access'] ) ) {
340
- return $amount;
341
- }
342
-
343
- if ( $coupon_meta['type'] == 'amount' ) {
344
- $new_amount = $amount - $coupon_meta['amount'];
345
- } else {
346
- $new_amount = ( $amount * $coupon_meta['amount'] ) / 100;
347
- }
348
-
349
- if ( $new_amount >= 0 ) {
350
- return $new_amount;
351
- }
352
-
353
- return $amount;
354
-
355
- }
356
-
357
  /**
358
  * Insert payment info to database
359
  *
279
  $pack = WPUF_Subscription::init()->get_subscription( $pack_id );
280
  $custom = $pack->meta_value;
281
  $billing_amount = $pack->meta_value['billing_amount'];
282
+ $amount = $billing_amount;
283
  $item_name = $pack->post_title;
284
  $item_number = $pack->ID;
285
  break;
306
  }
307
  }
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  /**
310
  * Insert payment info to database
311
  *
class/post-form-template.php CHANGED
@@ -49,6 +49,15 @@ abstract class WPUF_Post_Form_Template {
49
  */
50
  protected $form_settings;
51
 
 
 
 
 
 
 
 
 
 
52
  public function __construct() {
53
  $this->conditionals = array(
54
  'condition_status' => 'no',
@@ -95,6 +104,17 @@ abstract class WPUF_Post_Form_Template {
95
  return apply_filters( 'wpuf_post_form_template_form_settings', $this->form_settings, $this );
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
98
  /**
99
  * Check if the template is enabled
100
  *
49
  */
50
  protected $form_settings;
51
 
52
+ /**
53
+ * Form notifications
54
+ *
55
+ * @since 2.5.2
56
+ *
57
+ * @var array
58
+ */
59
+ protected $form_notifications;
60
+
61
  public function __construct() {
62
  $this->conditionals = array(
63
  'condition_status' => 'no',
104
  return apply_filters( 'wpuf_post_form_template_form_settings', $this->form_settings, $this );
105
  }
106
 
107
+ /**
108
+ * Get form notifications
109
+ *
110
+ * @since 2.5.2
111
+ *
112
+ * @return array
113
+ */
114
+ public function get_form_notifications() {
115
+ return apply_filters( 'wpuf_post_form_template_form_notifications', $this->form_notifications, $this );
116
+ }
117
+
118
  /**
119
  * Check if the template is enabled
120
  *
class/render-form.php CHANGED
@@ -191,74 +191,98 @@ class WPUF_Render_Form {
191
 
192
  foreach ($meta_vars as $key => $value) {
193
 
194
- // put files in a separate array, we'll process it later
195
- if ( ($value['input_type'] == 'file_upload') || ($value['input_type'] == 'image_upload') ) {
196
- $files[] = array(
197
- 'name' => $value['name'],
198
- 'value' => isset( $_POST['wpuf_files'][$value['name']] ) ? $_POST['wpuf_files'][$value['name']] : array(),
199
- 'count' => $value['count']
200
- );
201
 
202
- // process repeatable fiels
203
- } elseif ( $value['input_type'] == 'repeat' ) {
 
 
 
 
204
 
205
- // if it is a multi column repeat field
206
- if ( isset( $value['multiple'] ) && $value['multiple'] == 'true' ) {
207
 
208
- // if there's any items in the array, process it
209
- if ( $_POST[$value['name']] ) {
210
 
211
- $ref_arr = array();
212
- $cols = count( $value['columns'] );
213
- $first = array_shift( array_values( $_POST[$value['name']] ) ); //first element
214
- $rows = count( $first );
215
 
216
- // loop through columns
217
- for ($i = 0; $i < $rows; $i++) {
 
 
218
 
219
- // loop through the rows and store in a temp array
220
- $temp = array();
221
- for ($j = 0; $j < $cols; $j++) {
 
 
 
 
 
 
222
 
223
- $temp[] = $_POST[$value['name']][$j][$i];
 
224
  }
225
 
226
- // store all fields in a row with self::$separator separated
227
- $ref_arr[] = implode( self::$separator, $temp );
 
 
228
  }
 
 
 
 
 
229
 
230
- // now, if we found anything in $ref_arr, store to $multi_repeated
231
- if ( $ref_arr ) {
232
- $multi_repeated[$value['name']] = array_slice( $ref_arr, 0, $rows );
 
 
233
  }
234
  }
235
- } else {
236
- $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
237
- }
238
 
239
- // process other fields
240
- } elseif ( $value['input_type'] == 'address' ) {
241
 
242
- if ( isset( $_POST[ $value['name'] ] ) && is_array( $_POST[ $value['name'] ] ) ) {
243
- foreach ( $_POST[ $value['name'] ] as $address_field => $field_value ) {
244
- $meta_key_value[ $value['name'] ][ $address_field ] = $field_value;
245
- }
246
- }
247
 
248
- }
249
- else {
250
- // if it's an array, implode with this->separator
251
- if ( is_array( $_POST[$value['name']] ) ) {
 
252
 
253
- if ( $value['input_type'] == 'address' ) {
254
- $meta_key_value[$value['name']] = $_POST[$value['name']];
 
 
 
 
 
 
 
 
 
 
 
255
  } else {
256
- $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
257
  }
258
- } else {
259
- $meta_key_value[$value['name']] = trim( $_POST[$value['name']] );
260
- }
261
  }
 
262
  } //end foreach
263
 
264
  return array($meta_key_value, $multi_repeated, $files);
@@ -291,9 +315,10 @@ class WPUF_Render_Form {
291
  /**
292
  * Handles the add post shortcode
293
  *
294
- * @param $atts
 
295
  */
296
- function render_form( $form_id, $post_id = NULL, $preview = false ) {
297
 
298
  $form_status = get_post_status( $form_id );
299
 
@@ -312,16 +337,13 @@ class WPUF_Render_Form {
312
 
313
  if ( ! is_user_logged_in() && $form_settings['guest_post'] != 'true' ) {
314
  echo '<div class="wpuf-message">' . $form_settings['message_restrict'] . '</div>';
315
- //wp_login_form();
316
  return;
317
  }
318
 
319
  if ( $form_vars ) {
320
  ?>
321
 
322
- <?php if ( !$preview ) { ?>
323
- <form class="wpuf-form-add" action="" method="post">
324
- <?php } ?>
325
 
326
  <ul class="wpuf-form">
327
 
@@ -348,9 +370,7 @@ class WPUF_Render_Form {
348
 
349
  </ul>
350
 
351
- <?php if ( !$preview ) { ?>
352
- </form>
353
- <?php } ?>
354
 
355
  <?php
356
  } //endif
@@ -540,6 +560,14 @@ class WPUF_Render_Form {
540
  break;
541
 
542
  default:
 
 
 
 
 
 
 
 
543
  do_action( 'wpuf_render_form_' . $form_field['input_type'], $form_field, $form_id, $post_id, $form_settings );
544
  do_action( 'wpuf_render_pro_' . $form_field['input_type'], $form_field, $post_id, $type, $form_id, $form_settings, 'WPUF_Render_Form', $this, $this->multiform_start, isset( $form_settings['enable_multistep'] )?$form_settings['enable_multistep']:'' );
545
  break;
@@ -632,7 +660,7 @@ class WPUF_Render_Form {
632
  </head>
633
  <body>
634
  <div class="container">
635
- <?php $this->render_form( $form_id, null, true ); ?>
636
  </div>
637
  </body>
638
  </html>
@@ -799,19 +827,26 @@ class WPUF_Render_Form {
799
  ?>
800
 
801
  <div class="wpuf-fields">
802
- <input class="textfield<?php echo $this->required_class( $attr ); echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" id="<?php echo $attr['name']; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $attr['size'] ) ?>" <?php echo $username ? 'disabled' : ''; ?> />
 
803
  <?php $this->help_text( $attr ); ?>
804
 
805
  <?php if ( $taxonomy ) { ?>
806
  <script type="text/javascript">
807
- jQuery(function($) {
808
- $('li.tags input[name=tags]').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
809
- });
 
 
810
  </script>
811
  <?php } ?>
812
  </div>
813
 
814
  <?php
 
 
 
 
815
  }
816
 
817
 
@@ -827,8 +862,8 @@ class WPUF_Render_Form {
827
  }
828
  ?>
829
  <script type="text/javascript">
830
- (function($) {
831
- $(function() {
832
  WP_User_Frontend.editorLimit.bind(<?php printf( '%d, "%s", "%s"', $word_nums, $field_name, $rich_text ); ?>);
833
  });
834
  })(jQuery);
@@ -875,9 +910,11 @@ class WPUF_Render_Form {
875
  </div>
876
 
877
  <script type="text/javascript">
878
- jQuery(function() {
879
- WP_User_Frontend.insertImage('wpuf-insert-image_<?php echo $form_id; ?>', '<?php echo $form_id; ?>');
880
- });
 
 
881
  </script>
882
  <?php } ?>
883
 
@@ -991,7 +1028,7 @@ class WPUF_Render_Form {
991
  foreach ($attr['options'] as $value => $option) {
992
  ?>
993
 
994
- <label>
995
  <input name="<?php echo $attr['name']; ?>" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" type="radio" value="<?php echo esc_attr( $value ); ?>"<?php checked( $selected, $value ); ?> />
996
  <?php echo $option; ?>
997
  </label>
@@ -1031,7 +1068,7 @@ class WPUF_Render_Form {
1031
 
1032
  ?>
1033
 
1034
- <label>
1035
  <input type="checkbox" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" name="<?php echo $attr['name']; ?>[]" value="<?php echo esc_attr( $value ); ?>"<?php echo in_array( $value, $selected ) ? ' checked="checked"' : ''; ?> />
1036
  <?php echo $option; ?>
1037
  </label>
@@ -1334,9 +1371,11 @@ class WPUF_Render_Form {
1334
  <input class="textfield<?php echo $this->required_class( $attr ); ?>" id="<?php echo $attr['name']; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" value="<?php echo esc_attr( implode( ', ', $terms ) ); ?>" size="40" />
1335
 
1336
  <script type="text/javascript">
1337
- jQuery(function($) {
1338
- $('#<?php echo $attr['name']; ?>').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=<?php echo $attr['name']; ?>', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
1339
- });
 
 
1340
  </script>
1341
 
1342
  <?php
@@ -1438,9 +1477,11 @@ class WPUF_Render_Form {
1438
  </div> <!-- .wpuf-fields -->
1439
 
1440
  <script type="text/javascript">
1441
- jQuery(function($) {
 
1442
  new WPUF_Uploader('wpuf-<?php echo $unique_id; ?>-pickfiles', 'wpuf-<?php echo $unique_id; ?>-upload-container', <?php echo $attr['count']; ?>, '<?php echo $attr['name']; ?>', 'jpg,jpeg,gif,png,bmp', <?php echo $attr['max_size'] ?>);
1443
- });
 
1444
  </script>
1445
  <?php
1446
 
191
 
192
  foreach ($meta_vars as $key => $value) {
193
 
194
+ switch ( $value['input_type'] ) {
195
+
196
+ // put files in a separate array, we'll process it later
197
+ case 'file_upload':
198
+ case 'image_upload':
 
 
199
 
200
+ $files[] = array(
201
+ 'name' => $value['name'],
202
+ 'value' => isset( $_POST['wpuf_files'][$value['name']] ) ? $_POST['wpuf_files'][$value['name']] : array(),
203
+ 'count' => $value['count']
204
+ );
205
+ break;
206
 
207
+ case 'repeat':
 
208
 
209
+ // if it is a multi column repeat field
210
+ if ( isset( $value['multiple'] ) && $value['multiple'] == 'true' ) {
211
 
212
+ // if there's any items in the array, process it
213
+ if ( $_POST[$value['name']] ) {
 
 
214
 
215
+ $ref_arr = array();
216
+ $cols = count( $value['columns'] );
217
+ $first = array_shift( array_values( $_POST[$value['name']] ) ); //first element
218
+ $rows = count( $first );
219
 
220
+ // loop through columns
221
+ for ($i = 0; $i < $rows; $i++) {
222
+
223
+ // loop through the rows and store in a temp array
224
+ $temp = array();
225
+ for ($j = 0; $j < $cols; $j++) {
226
+
227
+ $temp[] = $_POST[$value['name']][$j][$i];
228
+ }
229
 
230
+ // store all fields in a row with self::$separator separated
231
+ $ref_arr[] = implode( self::$separator, $temp );
232
  }
233
 
234
+ // now, if we found anything in $ref_arr, store to $multi_repeated
235
+ if ( $ref_arr ) {
236
+ $multi_repeated[$value['name']] = array_slice( $ref_arr, 0, $rows );
237
+ }
238
  }
239
+ } else {
240
+ $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
241
+ }
242
+
243
+ break;
244
 
245
+ case 'address':
246
+
247
+ if ( isset( $_POST[ $value['name'] ] ) && is_array( $_POST[ $value['name'] ] ) ) {
248
+ foreach ( $_POST[ $value['name'] ] as $address_field => $field_value ) {
249
+ $meta_key_value[ $value['name'] ][ $address_field ] = sanitize_text_field( $field_value );
250
  }
251
  }
 
 
 
252
 
253
+ break;
 
254
 
255
+ case 'text':
256
+ case 'email':
257
+ case 'number':
258
+ case 'date':
 
259
 
260
+ $meta_key_value[$value['name']] = sanitize_text_field( trim( $_POST[$value['name']] ) );
261
+
262
+ break;
263
+
264
+ case 'textarea':
265
 
266
+ $meta_key_value[$value['name']] = wp_kses_post( $_POST[$value['name']] );
267
+
268
+ break;
269
+
270
+ default:
271
+ // if it's an array, implode with this->separator
272
+ if ( is_array( $_POST[$value['name']] ) ) {
273
+
274
+ if ( $value['input_type'] == 'address' ) {
275
+ $meta_key_value[$value['name']] = $_POST[$value['name']];
276
+ } else {
277
+ $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
278
+ }
279
  } else {
280
+ $meta_key_value[$value['name']] = trim( $_POST[$value['name']] );
281
  }
282
+
283
+ break;
 
284
  }
285
+
286
  } //end foreach
287
 
288
  return array($meta_key_value, $multi_repeated, $files);
315
  /**
316
  * Handles the add post shortcode
317
  *
318
+ * @param int $form_id
319
+ * @param int $post_id
320
  */
321
+ function render_form( $form_id, $post_id = NULL ) {
322
 
323
  $form_status = get_post_status( $form_id );
324
 
337
 
338
  if ( ! is_user_logged_in() && $form_settings['guest_post'] != 'true' ) {
339
  echo '<div class="wpuf-message">' . $form_settings['message_restrict'] . '</div>';
 
340
  return;
341
  }
342
 
343
  if ( $form_vars ) {
344
  ?>
345
 
346
+ <form class="wpuf-form-add" action="" method="post">
 
 
347
 
348
  <ul class="wpuf-form">
349
 
370
 
371
  </ul>
372
 
373
+ </form>
 
 
374
 
375
  <?php
376
  } //endif
560
  break;
561
 
562
  default:
563
+
564
+ // fallback for a dynamic method of this class if exists
565
+ $dynamic_method = 'field_' . $form_field['input_type'];
566
+
567
+ if ( method_exists( $this, $dynamic_method ) ) {
568
+ $this->{$dynamic_method}( $form_field, $post_id, $type, $form_id );
569
+ }
570
+
571
  do_action( 'wpuf_render_form_' . $form_field['input_type'], $form_field, $form_id, $post_id, $form_settings );
572
  do_action( 'wpuf_render_pro_' . $form_field['input_type'], $form_field, $post_id, $type, $form_id, $form_settings, 'WPUF_Render_Form', $this, $this->multiform_start, isset( $form_settings['enable_multistep'] )?$form_settings['enable_multistep']:'' );
573
  break;
660
  </head>
661
  <body>
662
  <div class="container">
663
+ <?php $this->render_form( $form_id, null ); ?>
664
  </div>
665
  </body>
666
  </html>
827
  ?>
828
 
829
  <div class="wpuf-fields">
830
+ <input class="textfield<?php echo $this->required_class( $attr ); echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" id="<?php echo $attr['name'].'_'.$form_id; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $attr['size'] ) ?>" <?php echo $username ? 'disabled' : ''; ?> />
831
+ <span class="wpuf-wordlimit-message wpuf-help"></span>
832
  <?php $this->help_text( $attr ); ?>
833
 
834
  <?php if ( $taxonomy ) { ?>
835
  <script type="text/javascript">
836
+ ;(function($) {
837
+ $(document).ready( function(){
838
+ $('li.tags input[name=tags]').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
839
+ });
840
+ })(jQuery);
841
  </script>
842
  <?php } ?>
843
  </div>
844
 
845
  <?php
846
+ // var_dump($attr);
847
+ if ( isset( $attr['word_restriction'] ) && $attr['word_restriction'] ) {
848
+ $this->check_word_restriction_func( $attr['word_restriction'], 'no', $attr['name'] . '_' . $form_id );
849
+ }
850
  }
851
 
852
 
862
  }
863
  ?>
864
  <script type="text/javascript">
865
+ ;(function($) {
866
+ $(document).ready( function(){
867
  WP_User_Frontend.editorLimit.bind(<?php printf( '%d, "%s", "%s"', $word_nums, $field_name, $rich_text ); ?>);
868
  });
869
  })(jQuery);
910
  </div>
911
 
912
  <script type="text/javascript">
913
+ ;(function($) {
914
+ $(document).ready( function(){
915
+ WP_User_Frontend.insertImage('wpuf-insert-image_<?php echo $form_id; ?>', '<?php echo $form_id; ?>');
916
+ });
917
+ })(jQuery);
918
  </script>
919
  <?php } ?>
920
 
1028
  foreach ($attr['options'] as $value => $option) {
1029
  ?>
1030
 
1031
+ <label <?php echo $attr['inline'] == 'yes' ? 'class="wpuf-radio-inline"' : null; ?>>
1032
  <input name="<?php echo $attr['name']; ?>" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" type="radio" value="<?php echo esc_attr( $value ); ?>"<?php checked( $selected, $value ); ?> />
1033
  <?php echo $option; ?>
1034
  </label>
1068
 
1069
  ?>
1070
 
1071
+ <label <?php echo $attr['inline'] == 'yes' ? 'class="wpuf-checkbox-inline"' : null; ?>>
1072
  <input type="checkbox" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" name="<?php echo $attr['name']; ?>[]" value="<?php echo esc_attr( $value ); ?>"<?php echo in_array( $value, $selected ) ? ' checked="checked"' : ''; ?> />
1073
  <?php echo $option; ?>
1074
  </label>
1371
  <input class="textfield<?php echo $this->required_class( $attr ); ?>" id="<?php echo $attr['name']; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" value="<?php echo esc_attr( implode( ', ', $terms ) ); ?>" size="40" />
1372
 
1373
  <script type="text/javascript">
1374
+ ;(function($) {
1375
+ $(document).ready( function(){
1376
+ $('#<?php echo $attr['name']; ?>').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=<?php echo $attr['name']; ?>', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
1377
+ });
1378
+ })(jQuery);
1379
  </script>
1380
 
1381
  <?php
1477
  </div> <!-- .wpuf-fields -->
1478
 
1479
  <script type="text/javascript">
1480
+ ;(function($) {
1481
+ $(document).ready( function(){
1482
  new WPUF_Uploader('wpuf-<?php echo $unique_id; ?>-pickfiles', 'wpuf-<?php echo $unique_id; ?>-upload-container', <?php echo $attr['count']; ?>, '<?php echo $attr['name']; ?>', 'jpg,jpeg,gif,png,bmp', <?php echo $attr['max_size'] ?>);
1483
+ });
1484
+ })(jQuery);
1485
  </script>
1486
  <?php
1487
 
class/subscription.php CHANGED
@@ -59,15 +59,14 @@ class WPUF_Subscription {
59
  wp_die( __( 'Nonce failure', 'wpuf' ) );
60
  }
61
 
62
- $user_id = get_current_user_id();
63
- $current_pack = self::get_user_pack( $user_id );
64
 
65
  $gateway = ( $_POST['gateway'] == 'bank/manual' ) ? 'bank' : sanitize_text_field( $_POST['gateway'] );
66
-
67
- do_action( "wpuf_cancel_subscription_{$gateway}", $_POST );
68
-
69
- if ( $_POST['gateway'] == 'bank/manual' ) {
70
- WPUF_Subscription::init()->update_user_subscription_meta( $user_id, 'Cancel' );
71
  }
72
 
73
  wp_redirect( $_SERVER['REQUEST_URI'] );
@@ -825,6 +824,7 @@ class WPUF_Subscription {
825
 
826
  <form action="" method="post">
827
  <?php wp_nonce_field( 'wpuf-sub-cancel' ); ?>
 
828
  <input type="hidden" name="gateway" value="<?php echo $payment_gateway; ?>">
829
  <input type="submit" name="wpuf_cancel_subscription" class="btn btn-sm btn-danger" value="<?php _e( 'Cancel', 'wpuf' ); ?>">
830
  </form>
@@ -939,7 +939,7 @@ class WPUF_Subscription {
939
  ?>
940
  <div class="wpuf-info">
941
  <?php
942
- $text = sprintf( __( 'This will cost you <strong>%s</strong> to add a new post. ', 'wpuf' ), wpuf_format_price( wpuf_get_option( 'cost_per_post', 'wpuf_payment' ) ) );
943
 
944
  echo apply_filters( 'wpuf_ppp_notice', $text, $form_id, $form_settings );
945
  ?>
59
  wp_die( __( 'Nonce failure', 'wpuf' ) );
60
  }
61
 
62
+ $current_pack = self::get_user_pack( $_POST['user_id'] );
 
63
 
64
  $gateway = ( $_POST['gateway'] == 'bank/manual' ) ? 'bank' : sanitize_text_field( $_POST['gateway'] );
65
+
66
+ if ( 'bank' == $gateway || 'no' == $current_pack['recurring'] ) {
67
+ WPUF_Subscription::init()->update_user_subscription_meta( $_POST['user_id'], 'Cancel' );
68
+ } else {
69
+ do_action( "wpuf_cancel_subscription_{$gateway}", $_POST );
70
  }
71
 
72
  wp_redirect( $_SERVER['REQUEST_URI'] );
824
 
825
  <form action="" method="post">
826
  <?php wp_nonce_field( 'wpuf-sub-cancel' ); ?>
827
+ <input type="hidden" name="user_id" value="<?php echo get_current_user_id(); ?>">
828
  <input type="hidden" name="gateway" value="<?php echo $payment_gateway; ?>">
829
  <input type="submit" name="wpuf_cancel_subscription" class="btn btn-sm btn-danger" value="<?php _e( 'Cancel', 'wpuf' ); ?>">
830
  </form>
939
  ?>
940
  <div class="wpuf-info">
941
  <?php
942
+ $text = sprintf( __( 'There is a <strong>%s</strong> charge to add a new post.', 'wpuf' ), wpuf_format_price( wpuf_get_option( 'cost_per_post', 'wpuf_payment' ) ) );
943
 
944
  echo apply_filters( 'wpuf_ppp_notice', $text, $form_id, $form_settings );
945
  ?>
includes/free/admin/shortcode-builder.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="wpuf-media-dialog" style="display: none;">
2
+
3
+ <div class="wpuf-popup-container">
4
+
5
+ <h3><?php _e( 'Select a form to insert', 'wpuf' ); ?></h3>
6
+
7
+ <?php $form_types = apply_filters( 'wpuf_shortcode_dialog_form_type', array(
8
+ 'post' => __( 'Post Form', 'wpuf' ),
9
+ 'registration' => __( 'Registration Form', 'wpuf' ),
10
+ ) ); ?>
11
+
12
+ <div class="wpuf-div">
13
+ <label for="wpuf-form-type" class="label"><?php _e( 'Form Type', 'wpuf' ); ?></label>
14
+ <select id="wpuf-form-type">
15
+
16
+ <?php foreach ( $form_types as $key => $form_type ) { ?>
17
+ <option value="<?php echo $key; ?>"><?php echo $form_type; ?></option>
18
+ <?php } ?>
19
+
20
+ </select>
21
+ </div>
22
+
23
+ <?php foreach ( $form_types as $key => $form_type ) {
24
+
25
+ switch ( $key ) {
26
+ case 'post':
27
+ $form_post_type = 'wpuf_forms';
28
+ break;
29
+
30
+ case 'registration':
31
+ $form_post_type = 'wpuf_profile';
32
+ break;
33
+
34
+ default:
35
+ $form_post_type = apply_filters( 'wpuf_shortcode_dialog_form_type_post', $key, $form_types );
36
+ break;
37
+
38
+ } ?>
39
+
40
+ <div class="wpuf-div show-if-<?php echo $key; ?>">
41
+
42
+ <label for="wpuf-form-<?php echo $key; ?>" class="label"><?php echo $form_type; ?></label>
43
+
44
+ <select id="wpuf-form-<?php echo $key; ?>">
45
+
46
+ <?php
47
+ $args = array(
48
+ 'post_type' => $form_post_type,
49
+ 'post_status' => 'publish',
50
+ );
51
+ $form_posts = get_posts( $args );
52
+
53
+ foreach ($form_posts as $form) { ?>
54
+
55
+ <option value="<?php echo $form->ID; ?>"><?php echo $form->post_title; ?></option>
56
+
57
+ <?php } ?>
58
+
59
+ </select>
60
+
61
+ </div>
62
+
63
+ <?php }
64
+
65
+ do_action( 'wpuf_shortcode_dialog_content', $form_types ); ?>
66
+
67
+ <div class="submit-button wpuf-div">
68
+ <button id="wpuf-form-insert" class="button-primary"><?php _e( 'Insert Form', 'wpuf' ); ?></button>
69
+ <button id="wpuf-form-close" class="button-secondary" style="margin-left: 5px;" onClick="tb_remove();"><?php _e( 'Close', 'wpuf' ); ?></a>
70
+ </div>
71
+
72
+ </div>
73
+ </div>
74
+
75
+ <style type="text/css">
76
+ .wpuf-popup-container {
77
+ padding: 15px 0 0 20px;
78
+ }
79
+ .wpuf-div {
80
+ padding: 10px;
81
+ clear: left;
82
+ }
83
+ .wpuf-div label.label {
84
+ float: left;
85
+ width: 25%;
86
+ }
87
+ </style>
includes/free/admin/shortcode-button.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * wpuf tinyMce Shortcode Button class
5
+ *
6
+ * @since 2.5.2
7
+ */
8
+ class WPUF_Shortcodes_Button {
9
+
10
+ /**
11
+ * Constructor for shortcode class
12
+ */
13
+ public function __construct() {
14
+
15
+ add_filter( 'mce_external_plugins', array( $this, 'enqueue_plugin_scripts' ) );
16
+ add_filter( 'mce_buttons', array( $this, 'register_buttons_editor' ) );
17
+
18
+ add_action( 'admin_enqueue_scripts', array( $this, 'localize_shortcodes' ) , 90 );
19
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts'), 80 );
20
+
21
+ add_action( 'media_buttons', array( $this, 'add_media_button' ), 20 );
22
+ add_action( 'admin_footer', array( $this, 'media_thickbox_content' ) );
23
+ }
24
+
25
+
26
+ /**
27
+ * Enqueue scripts and styles for form builder
28
+ *
29
+ * @global string $pagenow
30
+ * @return void
31
+ */
32
+ function enqueue_scripts() {
33
+ global $pagenow;
34
+
35
+ if ( !in_array( $pagenow, array( 'post.php', 'post-new.php') ) ) {
36
+ return;
37
+ }
38
+
39
+ wp_enqueue_script( 'wpuf-shortcode', WPUF_ASSET_URI . '/js/admin-shortcode.js', array('jquery') );
40
+ }
41
+
42
+ /**
43
+ * Adds a media button (for inserting a form) to the Post Editor
44
+ *
45
+ * @param int $editor_id The editor ID
46
+ * @return void
47
+ */
48
+ function add_media_button( $editor_id ) {
49
+ ?>
50
+ <a href="#TB_inline?width=480&amp;inlineId=wpuf-media-dialog" class="button thickbox insert-form" data-editor="<?php echo esc_attr( $editor_id ); ?>" title="<?php _e( 'Add a Form', 'wpuf' ); ?>">
51
+ <?php echo '<span class="wp-media-buttons-icon dashicons dashicons-welcome-widgets-menus"></span>' . __( ' Add Form', 'wpuf' ); ?>
52
+ </a>
53
+ <?php
54
+
55
+ }
56
+
57
+ /**
58
+ * Prints the thickbox popup content
59
+ *
60
+ * @return void
61
+ */
62
+ public function media_thickbox_content() {
63
+ global $pagenow;
64
+
65
+ if ( !in_array( $pagenow, array( 'post.php', 'post-new.php') ) ) {
66
+ return;
67
+ }
68
+
69
+ include dirname( __FILE__ ) . '/shortcode-builder.php';
70
+ }
71
+
72
+ /**
73
+ * Generate shortcode array
74
+ *
75
+ * @since 2.5.2
76
+ *
77
+ */
78
+ function localize_shortcodes() {
79
+
80
+ $shortcodes = apply_filters( 'wpuf_page_shortcodes', array(
81
+ 'wpuf-dashboard'=> array(
82
+ 'title' => __( 'Dashboard', 'wpuf' ),
83
+ 'content' => '[wpuf_dashboard]'
84
+ ),
85
+ 'wpuf-account' => array(
86
+ 'title' => __( 'Account', 'wpuf' ),
87
+ 'content' => '[wpuf_account]'
88
+ ),
89
+ 'wpuf-edit' => array(
90
+ 'title' => __( 'Edit', 'wpuf' ),
91
+ 'content' => '[wpuf_edit]'
92
+ ),
93
+ 'wpuf-login' => array(
94
+ 'title' => __( 'Login', 'wpuf' ),
95
+ 'content' => '[wpuf-login]'
96
+ ),
97
+ 'wpuf-sub-pack' => array(
98
+ 'title' => __( 'Subscription', 'wpuf' ),
99
+ 'content' => '[wpuf_sub_pack]'
100
+ )
101
+ ) );
102
+
103
+ $assets_url = WPUF_ASSET_URI;
104
+
105
+ wp_localize_script( 'wpuf-subscriptions', 'wpuf_shortcodes', apply_filters( 'wpuf_button_shortcodes', $shortcodes ) );
106
+ wp_localize_script( 'wpuf-subscriptions', 'wpuf_assets_url', $assets_url );
107
+ }
108
+
109
+ /**
110
+ * * Singleton object
111
+ *
112
+ * @staticvar boolean $instance
113
+ *
114
+ * @return \self
115
+ */
116
+ public static function init() {
117
+ static $instance = false;
118
+
119
+ if ( !$instance ) {
120
+ $instance = new WPUF_Shortcodes_Button();
121
+ }
122
+
123
+ return $instance;
124
+ }
125
+
126
+ /**
127
+ * Add button on Post Editor
128
+ *
129
+ * @since 2.5.2
130
+ *
131
+ * @param array $plugin_array
132
+ *
133
+ * @return array
134
+ */
135
+ function enqueue_plugin_scripts( $plugin_array ) {
136
+ //enqueue TinyMCE plugin script with its ID.
137
+ $plugin_array["wpuf_button"] = WPUF_ASSET_URI . "/js/wpuf-tmc-button.js";
138
+
139
+ return $plugin_array;
140
+ }
141
+
142
+ /**
143
+ * Register tinyMce button
144
+ *
145
+ * @since 2.5.2
146
+ *
147
+ * @param array $buttons
148
+ *
149
+ * @return array
150
+ */
151
+ function register_buttons_editor( $buttons ) {
152
+ //register buttons with their id.
153
+ array_push( $buttons, "wpuf_button" );
154
+
155
+ return $buttons;
156
+ }
157
+
158
+ }
159
+
160
+ WPUF_Shortcodes_Button::init();
languages/wpuf.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPL2.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP User Frontend 2.5\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wedevs.com/support/forum/plugin-support/wp-user-frontend/\n"
8
- "POT-Creation-Date: 2017-03-17 18:28:18+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -22,37 +22,41 @@ msgstr ""
22
  msgid "Add fields by dragging the fields from the right sidebar to this area."
23
  msgstr ""
24
 
25
- #: admin/form-builder/assets/js/components/builder-stage/template.php:28
26
  msgid "is available in Pro Version"
27
  msgstr ""
28
 
29
- #: admin/form-builder/assets/js/components/builder-stage/template.php:52
30
  msgid "Hidden Fields"
31
  msgstr ""
32
 
33
- #: admin/form-builder/assets/js/components/builder-stage/template.php:59
34
  msgid "key"
35
  msgstr ""
36
 
37
- #: admin/form-builder/assets/js/components/builder-stage/template.php:59
38
  msgid "value"
39
  msgstr ""
40
 
41
  #: admin/form-builder/assets/js/components/field-option-data/template.php:5
42
- #: admin/template.php:223
43
  msgid "Show values"
44
  msgstr ""
45
 
46
  #: admin/form-builder/assets/js/components/field-option-data/template.php:16
47
- #: admin/template.php:226 admin/template.php:284
48
  msgid "Label"
49
  msgstr ""
50
 
51
  #: admin/form-builder/assets/js/components/field-option-data/template.php:20
52
- #: admin/template.php:226 admin/template.php:284
53
  msgid "Value"
54
  msgstr ""
55
 
 
 
 
 
56
  #: admin/form-builder/assets/js/components/field-option-pro-feature-alert/template.php:4
57
  msgid "Available in Pro Version"
58
  msgstr ""
@@ -63,12 +67,12 @@ msgstr ""
63
 
64
  #: admin/form-builder/assets/js/components/form-featured_image/template.php:5
65
  #: admin/form-builder/assets/js/components/form-image_upload/template.php:5
66
- #: class/render-form.php:1409
67
  msgid "Select Image"
68
  msgstr ""
69
 
70
  #: admin/form-builder/assets/js/components/form-post_content/template.php:4
71
- #: class/render-form.php:873
72
  msgid "Insert Photo"
73
  msgstr ""
74
 
@@ -84,89 +88,90 @@ msgstr ""
84
  msgid "Invalid form id"
85
  msgstr ""
86
 
87
- #: admin/form-builder/class-wpuf-admin-form-builder.php:291
88
  msgid "Custom Fields"
89
  msgstr ""
90
 
91
- #: admin/form-builder/class-wpuf-admin-form-builder.php:312
92
  msgid "Others"
93
  msgstr ""
94
 
95
- #: admin/form-builder/class-wpuf-admin-form-builder.php:328
96
  msgid "Advanced Options"
97
  msgstr ""
98
 
99
- #: admin/form-builder/class-wpuf-admin-form-builder.php:329
100
  msgid "Are you sure you want to delete this field?"
101
  msgstr ""
102
 
103
- #: admin/form-builder/class-wpuf-admin-form-builder.php:330
104
  msgid "Yes, delete it"
105
  msgstr ""
106
 
107
- #: admin/form-builder/class-wpuf-admin-form-builder.php:331
108
  msgid "No, cancel it"
109
  msgstr ""
110
 
111
- #: admin/form-builder/class-wpuf-admin-form-builder.php:332
112
  msgid "OK"
113
  msgstr ""
114
 
115
- #: admin/form-builder/class-wpuf-admin-form-builder.php:333
116
  #: class/payment.php:168 class/subscription.php:829
117
  #: templates/dashboard/subscription.php:59
118
  msgid "Cancel"
119
  msgstr ""
120
 
121
- #: admin/form-builder/class-wpuf-admin-form-builder.php:334
 
122
  msgid "Close"
123
  msgstr ""
124
 
125
- #: admin/form-builder/class-wpuf-admin-form-builder.php:335
126
  msgid "This field must contain at least one choice"
127
  msgstr ""
128
 
129
- #: admin/form-builder/class-wpuf-admin-form-builder.php:336
130
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:362
131
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:402
132
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:458
133
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:513
134
  msgid "Option"
135
  msgstr ""
136
 
137
- #: admin/form-builder/class-wpuf-admin-form-builder.php:337
138
  msgid "Column"
139
  msgstr ""
140
 
141
- #: admin/form-builder/class-wpuf-admin-form-builder.php:338
142
  msgid "This field must contain at least one column"
143
  msgstr ""
144
 
145
- #: admin/form-builder/class-wpuf-admin-form-builder.php:339
146
  msgid "is available in Pro version"
147
  msgstr ""
148
 
149
- #: admin/form-builder/class-wpuf-admin-form-builder.php:340
150
  msgid "Please upgrade to the Pro version to unlock all these awesome features"
151
  msgstr ""
152
 
153
- #: admin/form-builder/class-wpuf-admin-form-builder.php:341
154
  msgid "Get the Pro version"
155
  msgstr ""
156
 
157
- #: admin/form-builder/class-wpuf-admin-form-builder.php:342 admin/form.php:1111
158
  msgid "Select"
159
  msgstr ""
160
 
161
- #: admin/form-builder/class-wpuf-admin-form-builder.php:343
162
  msgid "Saved form data"
163
  msgstr ""
164
 
165
- #: admin/form-builder/class-wpuf-admin-form-builder.php:344
166
  msgid "You have unsaved changes."
167
  msgstr ""
168
 
169
- #: admin/form-builder/class-wpuf-admin-form-builder.php:345
170
  #: admin/form-builder/views/form-builder.php:45
171
  msgid "Click to copy shortcode"
172
  msgstr ""
@@ -187,7 +192,6 @@ msgid "Help text"
187
  msgstr ""
188
 
189
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:57
190
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:81
191
  #: admin/template.php:98
192
  msgid "Give the user some information about this field"
193
  msgstr ""
@@ -198,8 +202,8 @@ msgid "Required"
198
  msgstr ""
199
 
200
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:65
201
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:429
202
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:484
203
  #: admin/post-forms-list-table.php:340 admin/settings-options.php:94
204
  #: admin/settings-options.php:174 admin/settings-options.php:185
205
  #: admin/settings-options.php:274 admin/subscription.php:145
@@ -208,8 +212,8 @@ msgid "Yes"
208
  msgstr ""
209
 
210
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:66
211
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:430
212
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:485
213
  #: admin/post-forms-list-table.php:341 admin/settings-options.php:95
214
  #: admin/settings-options.php:175 admin/settings-options.php:186
215
  #: admin/settings-options.php:275 admin/subscription.php:147
@@ -228,272 +232,278 @@ msgstr ""
228
  msgid "CSS Class Name"
229
  msgstr ""
230
 
 
 
 
 
231
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:88
232
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:602
233
- #: admin/template.php:85 admin/template.php:565
234
  msgid "Meta Key"
235
  msgstr ""
236
 
237
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:92
238
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:606
239
- #: admin/template.php:86 admin/template.php:566
240
  msgid "Name of the meta key this field will save to"
241
  msgstr ""
242
 
243
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:110
244
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:167
245
- #: admin/template.php:127 admin/template.php:175
246
  msgid "Placeholder text"
247
  msgstr ""
248
 
249
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:114
250
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:171
251
- #: admin/template.php:128
252
  msgid "Text for HTML5 placeholder attribute"
253
  msgstr ""
254
 
255
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:119
256
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:179
257
- #: admin/template.php:132 admin/template.php:180
258
  msgid "Default value"
259
  msgstr ""
260
 
261
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:123
262
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:183
263
- #: admin/template.php:133
264
  msgid "The default value this field will have"
265
  msgstr ""
266
 
267
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:128
268
- #: admin/template.php:137
269
  msgid "Size"
270
  msgstr ""
271
 
272
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:133
273
- #: admin/template.php:138
274
  msgid "Size of this input field"
275
  msgstr ""
276
 
277
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:149
278
- #: admin/template.php:165
 
 
 
 
 
 
 
 
 
 
 
 
279
  msgid "Rows"
280
  msgstr ""
281
 
282
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:153
283
  msgid "Number of rows in textarea"
284
  msgstr ""
285
 
286
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:158
287
- #: admin/template.php:170
288
  msgid "Columns"
289
  msgstr ""
290
 
291
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:162
292
  msgid "Number of columns in textarea"
293
  msgstr ""
294
 
295
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:188
296
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:276
297
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:283
298
- #: admin/template.php:185
299
  msgid "Textarea"
300
  msgstr ""
301
 
302
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:191
303
- #: admin/template.php:188
304
  msgid "Normal"
305
  msgstr ""
306
 
307
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:192
308
- #: admin/template.php:189
309
  msgid "Rich textarea"
310
  msgstr ""
311
 
312
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:193
313
- #: admin/template.php:190
314
- msgid "Teeny Rich textarea"
315
- msgstr ""
316
-
317
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:202
318
- #: admin/template-post.php:53 admin/template.php:363
319
- msgid "Word Restriction"
320
- msgstr ""
321
-
322
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:206
323
- #: admin/template-post.php:57 admin/template.php:367
324
- msgid "Numebr of words the author to be restricted in"
325
  msgstr ""
326
 
327
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:223
328
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:363
329
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:403
330
  msgid "- select -"
331
  msgstr ""
332
 
333
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:241
334
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:248
335
  msgid "Text"
336
  msgstr ""
337
 
338
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:313
339
- #: admin/template.php:388 admin/template.php:412 admin/template.php:444
340
- #: admin/template.php:476 templates/dashboard/posts.php:84
341
- #: templates/dashboard.php:38
342
  msgid "Options"
343
  msgstr ""
344
 
345
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:318
346
  msgid "Add options for the form field"
347
  msgstr ""
348
 
349
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:337
350
- #: admin/template.php:439 admin/template.php:471
351
  msgid "Select Text"
352
  msgstr ""
353
 
354
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:341
355
- #: admin/template.php:428 admin/template.php:460
356
  msgid ""
357
  "First element of the select dropdown. Leave this empty if you don't want to "
358
  "show this field"
359
  msgstr ""
360
 
361
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:349
362
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:356
363
- #: admin/template-post.php:166
364
  msgid "Dropdown"
365
  msgstr ""
366
 
367
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:389
368
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:396
369
- #: admin/form.php:1112 admin/template-post.php:167
370
  msgid "Multi Select"
371
  msgstr ""
372
 
373
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:426
374
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:481
375
  msgid "Show in inline list"
376
  msgstr ""
377
 
378
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:436
379
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:491
380
  msgid "Show this option in an inline list"
381
  msgstr ""
382
 
383
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:444
384
  msgid "Radio"
385
  msgstr ""
386
 
387
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:451
388
  msgid "Radio Field"
389
  msgstr ""
390
 
391
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:499
392
- #: admin/form.php:1113 admin/template-post.php:168
393
  msgid "Checkbox"
394
  msgstr ""
395
 
396
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:506
397
  msgid "Checkbox Field"
398
  msgstr ""
399
 
400
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:534
401
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:541
402
  msgid "URL"
403
  msgstr ""
404
 
405
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:569
406
  msgid "Email Address"
407
  msgstr ""
408
 
409
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:576
410
- #: admin/form.php:286 class/transactions-list-table.php:48
411
  #: includes/free/edit-user.php:153
412
  msgid "Email"
413
  msgstr ""
414
 
415
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:611
416
- #: admin/template.php:572
417
  msgid "Meta Value"
418
  msgstr ""
419
 
420
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:615
421
- #: admin/template.php:573
422
  msgid "Enter the meta value"
423
  msgstr ""
424
 
425
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:621
426
  msgid "Hidden Field"
427
  msgstr ""
428
 
429
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:651
430
- #: admin/form.php:1030 admin/template-post.php:115 admin/template.php:636
431
  msgid "Max. file size"
432
  msgstr ""
433
 
434
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:655
435
- #: admin/form.php:1034 admin/template-post.php:103 admin/template.php:624
436
  msgid "Enter maximum upload size limit in KB"
437
  msgstr ""
438
 
439
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:660
440
- #: admin/template.php:641
441
  msgid "Max. files"
442
  msgstr ""
443
 
444
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:664
445
- #: admin/template.php:625
446
  msgid "Number of images can be uploaded"
447
  msgstr ""
448
 
449
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:670
450
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:677
451
  #: includes/free/form-element.php:8
452
  msgid "Image Upload"
453
  msgstr ""
454
 
455
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:702
456
- #: admin/template.php:534 admin/template.php:594 class/upload.php:164
457
- #: templates/dashboard/posts.php:74 templates/dashboard.php:28
458
  #: wpuf-functions.php:703
459
  msgid "Title"
460
  msgstr ""
461
 
462
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:706
463
  msgid "Title of the section"
464
  msgstr ""
465
 
466
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:711
467
- #: admin/subscription.php:206 admin/template.php:599 class/upload.php:166
468
  #: wpuf-functions.php:709
469
  msgid "Description"
470
  msgstr ""
471
 
472
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:715
473
  msgid "Some details text about the section"
474
  msgstr ""
475
 
476
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:721
477
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:727
478
  msgid "Section Break"
479
  msgstr ""
480
 
481
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:728
482
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:764
483
  msgid "Some description about this section"
484
  msgstr ""
485
 
486
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:747
487
- #: admin/template.php:539
488
  msgid "HTML Codes"
489
  msgstr ""
490
 
491
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:751
492
  msgid "Paste your HTML codes, WordPress shortcodes will also work here"
493
  msgstr ""
494
 
495
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:757
496
- #: admin/form-builder/class-wpuf-form-builder-field-settings.php:763
497
  msgid "Custom HTML"
498
  msgstr ""
499
 
@@ -555,15 +565,25 @@ msgstr[1] ""
555
  msgid "Form duplicated successfully. <a href=\"%s\">View form.</a>"
556
  msgstr ""
557
 
558
- #: admin/form-template.php:166
 
 
 
 
 
 
 
 
 
 
559
  msgid "Form Template"
560
  msgstr ""
561
 
562
- #: admin/form-template.php:169
563
  msgid "&mdash; No Template &mdash;"
564
  msgstr ""
565
 
566
- #: admin/form-template.php:178
567
  msgid ""
568
  "If selected a form template, it will try to execute that integration "
569
  "options when new post created and updated."
@@ -587,8 +607,9 @@ msgstr ""
587
 
588
  #: admin/form.php:76 admin/form.php:114 admin/installer.php:75
589
  #: admin/post-forms-list-table.php:387 admin/subscription.php:227
590
- #: class/subscription.php:361 includes/free/edit-user.php:100
591
- #: templates/dashboard/posts.php:150 templates/dashboard.php:105
 
592
  msgid "Edit"
593
  msgstr ""
594
 
@@ -645,330 +666,341 @@ msgstr ""
645
  msgid "Post Expiration"
646
  msgstr ""
647
 
648
- #: admin/form.php:276
649
- msgid "This page is restricted. Please Log in / Register to view this page."
650
  msgstr ""
651
 
652
- #: admin/form.php:285 admin/form.php:1127 admin/subscription.php:205
653
- #: admin/template-post.php:177 includes/free/edit-profile.php:92
654
- msgid "Name"
655
  msgstr ""
656
 
657
- #: admin/form.php:290
658
- msgid "Post saved"
659
  msgstr ""
660
 
661
- #: admin/form.php:291 admin/form.php:536
662
- msgid "Post updated successfully"
 
663
  msgstr ""
664
 
665
- #: admin/form.php:296
666
- msgid "Submit"
667
  msgstr ""
668
 
669
- #: admin/form.php:297 admin/form.php:791 class/render-form.php:587
670
- msgid "Save Draft"
671
  msgstr ""
672
 
673
- #: admin/form.php:298
674
- msgid "Preview"
675
  msgstr ""
676
 
677
- #: admin/form.php:306 admin/form.php:310
678
- msgid "Disable Subscription"
679
  msgstr ""
680
 
681
- #: admin/form.php:313
682
- msgid ""
683
- "If checked, any subscription and pay-per-post will be disabled on the form "
684
- "and will take no effect."
685
  msgstr ""
686
 
687
- #: admin/form.php:318 admin/post-forms-list-table.php:292
688
- msgid "Post Type"
 
689
  msgstr ""
690
 
691
- #: admin/form.php:338 admin/post-forms-list-table.php:293
692
- msgid "Post Status"
693
  msgstr ""
694
 
695
- #: admin/form.php:352
696
- msgid "Post Format"
697
  msgstr ""
698
 
699
- #: admin/form.php:355 admin/form.php:378
700
- msgid "- None -"
701
  msgstr ""
702
 
703
- #: admin/form.php:370
704
- msgid "Default Post Category"
705
  msgstr ""
706
 
707
- #: admin/form.php:382
708
- msgid ""
709
- "If users are not allowed to choose any category, this category will be used "
710
- "instead (if post type supports)"
711
  msgstr ""
712
 
713
- #: admin/form.php:387 admin/post-forms-list-table.php:294
714
- msgid "Guest Post"
2
  # This file is distributed under the GPL2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP User Frontend 2.5.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wedevs.com/support/forum/plugin-support/wp-user-frontend/\n"
8
+ "POT-Creation-Date: 2017-04-27 10:13:37+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
22
  msgid "Add fields by dragging the fields from the right sidebar to this area."
23
  msgstr ""
24
 
25
+ #: admin/form-builder/assets/js/components/builder-stage/template.php:30
26
  msgid "is available in Pro Version"
27
  msgstr ""
28
 
29
+ #: admin/form-builder/assets/js/components/builder-stage/template.php:54
30
  msgid "Hidden Fields"
31
  msgstr ""
32
 
33
+ #: admin/form-builder/assets/js/components/builder-stage/template.php:61
34
  msgid "key"
35
  msgstr ""
36
 
37
+ #: admin/form-builder/assets/js/components/builder-stage/template.php:61
38
  msgid "value"
39
  msgstr ""
40
 
41
  #: admin/form-builder/assets/js/components/field-option-data/template.php:5
42
+ #: admin/template.php:247
43
  msgid "Show values"
44
  msgstr ""
45
 
46
  #: admin/form-builder/assets/js/components/field-option-data/template.php:16
47
+ #: admin/template.php:250 admin/template.php:308
48
  msgid "Label"
49
  msgstr ""
50
 
51
  #: admin/form-builder/assets/js/components/field-option-data/template.php:20
52
+ #: admin/template.php:250 admin/template.php:308
53
  msgid "Value"
54
  msgstr ""
55
 
56
+ #: admin/form-builder/assets/js/components/field-option-data/template.php:64
57
+ msgid "Clear Selection"
58
+ msgstr ""
59
+
60
  #: admin/form-builder/assets/js/components/field-option-pro-feature-alert/template.php:4
61
  msgid "Available in Pro Version"
62
  msgstr ""
67
 
68
  #: admin/form-builder/assets/js/components/form-featured_image/template.php:5
69
  #: admin/form-builder/assets/js/components/form-image_upload/template.php:5
70
+ #: class/render-form.php:1448
71
  msgid "Select Image"
72
  msgstr ""
73
 
74
  #: admin/form-builder/assets/js/components/form-post_content/template.php:4
75
+ #: class/render-form.php:908
76
  msgid "Insert Photo"
77
  msgstr ""
78
 
88
  msgid "Invalid form id"
89
  msgstr ""
90
 
91
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:302
92
  msgid "Custom Fields"
93
  msgstr ""
94
 
95
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:323
96
  msgid "Others"
97
  msgstr ""
98
 
99
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:339
100
  msgid "Advanced Options"
101
  msgstr ""
102
 
103
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:340
104
  msgid "Are you sure you want to delete this field?"
105
  msgstr ""
106
 
107
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:341
108
  msgid "Yes, delete it"
109
  msgstr ""
110
 
111
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:342
112
  msgid "No, cancel it"
113
  msgstr ""
114
 
115
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:343
116
  msgid "OK"
117
  msgstr ""
118
 
119
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:344
120
  #: class/payment.php:168 class/subscription.php:829
121
  #: templates/dashboard/subscription.php:59
122
  msgid "Cancel"
123
  msgstr ""
124
 
125
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:345
126
+ #: includes/free/admin/shortcode-builder.php:69
127
  msgid "Close"
128
  msgstr ""
129
 
130
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:346
131
  msgid "This field must contain at least one choice"
132
  msgstr ""
133
 
134
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:347
135
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:376
136
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:416
137
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:472
138
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:527
139
  msgid "Option"
140
  msgstr ""
141
 
142
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:348
143
  msgid "Column"
144
  msgstr ""
145
 
146
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:349
147
  msgid "This field must contain at least one column"
148
  msgstr ""
149
 
150
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:350
151
  msgid "is available in Pro version"
152
  msgstr ""
153
 
154
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:351
155
  msgid "Please upgrade to the Pro version to unlock all these awesome features"
156
  msgstr ""
157
 
158
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:352
159
  msgid "Get the Pro version"
160
  msgstr ""
161
 
162
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:353 admin/form.php:743
163
  msgid "Select"
164
  msgstr ""
165
 
166
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:354
167
  msgid "Saved form data"
168
  msgstr ""
169
 
170
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:355
171
  msgid "You have unsaved changes."
172
  msgstr ""
173
 
174
+ #: admin/form-builder/class-wpuf-admin-form-builder.php:356
175
  #: admin/form-builder/views/form-builder.php:45
176
  msgid "Click to copy shortcode"
177
  msgstr ""
192
  msgstr ""
193
 
194
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:57
 
195
  #: admin/template.php:98
196
  msgid "Give the user some information about this field"
197
  msgstr ""
202
  msgstr ""
203
 
204
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:65
205
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:443
206
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:498
207
  #: admin/post-forms-list-table.php:340 admin/settings-options.php:94
208
  #: admin/settings-options.php:174 admin/settings-options.php:185
209
  #: admin/settings-options.php:274 admin/subscription.php:145
212
  msgstr ""
213
 
214
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:66
215
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:444
216
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:499
217
  #: admin/post-forms-list-table.php:341 admin/settings-options.php:95
218
  #: admin/settings-options.php:175 admin/settings-options.php:186
219
  #: admin/settings-options.php:275 admin/subscription.php:147
232
  msgid "CSS Class Name"
233
  msgstr ""
234
 
235
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:81
236
+ msgid "Provide a container class name for this field."
237
+ msgstr ""
238
+
239
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:88
240
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:616
241
+ #: admin/template.php:85 admin/template.php:578
242
  msgid "Meta Key"
243
  msgstr ""
244
 
245
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:92
246
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:620
247
+ #: admin/template.php:86 admin/template.php:579
248
  msgid "Name of the meta key this field will save to"
249
  msgstr ""
250
 
251
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:110
252
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:180
253
+ #: admin/template.php:129 admin/template.php:189
254
  msgid "Placeholder text"
255
  msgstr ""
256
 
257
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:114
258
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:184
259
+ #: admin/template.php:130
260
  msgid "Text for HTML5 placeholder attribute"
261
  msgstr ""
262
 
263
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:119
264
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:192
265
+ #: admin/template.php:134 admin/template.php:194
266
  msgid "Default value"
267
  msgstr ""
268
 
269
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:123
270
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:196
271
+ #: admin/template.php:135
272
  msgid "The default value this field will have"
273
  msgstr ""
274
 
275
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:128
276
+ #: admin/template.php:139
277
  msgid "Size"
278
  msgstr ""
279
 
280
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:133
281
+ #: admin/template.php:140
282
  msgid "Size of this input field"
283
  msgstr ""
284
 
285
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:140
286
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:215
287
+ #: admin/template.php:144 admin/template.php:209
288
+ msgid "Word Restriction"
289
+ msgstr ""
290
+
291
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:144
292
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:219
293
+ #: admin/template.php:148 admin/template.php:213
294
+ msgid "Numebr of words the author to be restricted in"
295
+ msgstr ""
296
+
297
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:162
298
+ #: admin/template.php:179
299
  msgid "Rows"
300
  msgstr ""
301
 
302
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:166
303
  msgid "Number of rows in textarea"
304
  msgstr ""
305
 
306
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:171
307
+ #: admin/template.php:184
308
  msgid "Columns"
309
  msgstr ""
310
 
311
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:175
312
  msgid "Number of columns in textarea"
313
  msgstr ""
314
 
315
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:201
316
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:290
317
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:297
318
+ #: admin/template.php:199
319
  msgid "Textarea"
320
  msgstr ""
321
 
322
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:204
323
+ #: admin/template.php:202
324
  msgid "Normal"
325
  msgstr ""
326
 
327
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:205
328
+ #: admin/template.php:203
329
  msgid "Rich textarea"
330
  msgstr ""
331
 
 
 
 
 
 
 
 
 
 
 
332
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:206
333
+ #: admin/template.php:204
334
+ msgid "Teeny Rich textarea"
335
  msgstr ""
336
 
337
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:236
338
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:377
339
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:417
340
  msgid "- select -"
341
  msgstr ""
342
 
343
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:254
344
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:261
345
  msgid "Text"
346
  msgstr ""
347
 
348
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:327
349
+ #: admin/template.php:401 admin/template.php:425 admin/template.php:457
350
+ #: admin/template.php:489 templates/dashboard/posts.php:84
351
+ #: templates/dashboard.php:37
352
  msgid "Options"
353
  msgstr ""
354
 
355
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:332
356
  msgid "Add options for the form field"
357
  msgstr ""
358
 
359
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:351
360
+ #: admin/template.php:452 admin/template.php:484
361
  msgid "Select Text"
362
  msgstr ""
363
 
364
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:355
365
+ #: admin/template.php:441 admin/template.php:473
366
  msgid ""
367
  "First element of the select dropdown. Leave this empty if you don't want to "
368
  "show this field"
369
  msgstr ""
370
 
371
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:363
372
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:370
373
+ #: admin/template-post.php:156
374
  msgid "Dropdown"
375
  msgstr ""
376
 
377
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:403
378
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:410
379
+ #: admin/form.php:744 admin/template-post.php:157
380
  msgid "Multi Select"
381
  msgstr ""
382
 
383
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:440
384
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:495
385
  msgid "Show in inline list"
386
  msgstr ""
387
 
388
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:450
389
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:505
390
  msgid "Show this option in an inline list"
391
  msgstr ""
392
 
393
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:458
394
  msgid "Radio"
395
  msgstr ""
396
 
397
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:465
398
  msgid "Radio Field"
399
  msgstr ""
400
 
401
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:513
402
+ #: admin/form.php:745 admin/template-post.php:158
403
  msgid "Checkbox"
404
  msgstr ""
405
 
406
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:520
407
  msgid "Checkbox Field"
408
  msgstr ""
409
 
410
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:548
411
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:555
412
  msgid "URL"
413
  msgstr ""
414
 
415
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:583
416
  msgid "Email Address"
417
  msgstr ""
418
 
419
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:590
420
+ #: admin/html/form-settings-post.php:17 class/transactions-list-table.php:48
421
  #: includes/free/edit-user.php:153
422
  msgid "Email"
423
  msgstr ""
424
 
425
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:625
426
+ #: admin/template.php:585
427
  msgid "Meta Value"
428
  msgstr ""
429
 
430
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:629
431
+ #: admin/template.php:586
432
  msgid "Enter the meta value"
433
  msgstr ""
434
 
435
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:635
436
  msgid "Hidden Field"
437
  msgstr ""
438
 
439
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:665
440
+ #: admin/form.php:662 admin/template-post.php:105 admin/template.php:649
441
  msgid "Max. file size"
442
  msgstr ""
443
 
444
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:669
445
+ #: admin/form.php:666 admin/template-post.php:93 admin/template.php:637
446
  msgid "Enter maximum upload size limit in KB"
447
  msgstr ""
448
 
449
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:674
450
+ #: admin/template.php:654
451
  msgid "Max. files"
452
  msgstr ""
453
 
454
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:678
455
+ #: admin/template.php:638
456
  msgid "Number of images can be uploaded"
457
  msgstr ""
458
 
459
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:684
460
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:691
461
  #: includes/free/form-element.php:8
462
  msgid "Image Upload"
463
  msgstr ""
464
 
465
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:716
466
+ #: admin/template.php:547 admin/template.php:607 class/upload.php:164
467
+ #: templates/dashboard/posts.php:74 templates/dashboard.php:27
468
  #: wpuf-functions.php:703
469
  msgid "Title"
470
  msgstr ""
471
 
472
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:720
473
  msgid "Title of the section"
474
  msgstr ""
475
 
476
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:725
477
+ #: admin/subscription.php:206 admin/template.php:612 class/upload.php:166
478
  #: wpuf-functions.php:709
479
  msgid "Description"
480
  msgstr ""
481
 
482
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:729
483
  msgid "Some details text about the section"
484
  msgstr ""
485
 
486
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:735
487
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:741
488
  msgid "Section Break"
489
  msgstr ""
490
 
491
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:742
492
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:778
493
  msgid "Some description about this section"
494
  msgstr ""
495
 
496
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:761
497
+ #: admin/template.php:552
498
  msgid "HTML Codes"
499
  msgstr ""
500
 
501
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:765
502
  msgid "Paste your HTML codes, WordPress shortcodes will also work here"
503
  msgstr ""
504
 
505
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:771
506
+ #: admin/form-builder/class-wpuf-form-builder-field-settings.php:777
507
  msgid "Custom HTML"
508
  msgstr ""
509
 
565
  msgid "Form duplicated successfully. <a href=\"%s\">View form.</a>"
566
  msgstr ""
567
 
568
+ #: admin/form-template.php:63
569
+ msgid ""
570
+ "List of available templates can be found <a href=\"%s\" "
571
+ "target=\"_blank\">here</a>."
572
+ msgstr ""
573
+
574
+ #: admin/form-template.php:64
575
+ msgid "Want a new integration? <a href=\"%s\" target=\"_blank\">Let us know</a>."
576
+ msgstr ""
577
+
578
+ #: admin/form-template.php:170
579
  msgid "Form Template"
580
  msgstr ""
581
 
582
+ #: admin/form-template.php:173
583
  msgid "&mdash; No Template &mdash;"
584
  msgstr ""
585
 
586
+ #: admin/form-template.php:182
587
  msgid ""
588
  "If selected a form template, it will try to execute that integration "
589
  "options when new post created and updated."
607
 
608
  #: admin/form.php:76 admin/form.php:114 admin/installer.php:75
609
  #: admin/post-forms-list-table.php:387 admin/subscription.php:227
610
+ #: class/subscription.php:360 includes/free/admin/shortcode-button.php:90
611
+ #: includes/free/edit-user.php:100 templates/dashboard/posts.php:150
612
+ #: templates/dashboard.php:104
613
  msgid "Edit"
614
  msgstr ""
615
 
666
  msgid "Post Expiration"
667
  msgstr ""
668
 
669
+ #: admin/form.php:276 admin/form.php:280
670
+ msgid "- Select -"
671
  msgstr ""
672
 
673
+ #: admin/form.php:314
674
+ msgid "Post Fields"
 
675
  msgstr ""
676
 
677
+ #: admin/form.php:320
678
+ msgid "Taxonomies"
679
  msgstr ""
680
 
681
+ #: admin/form.php:422 admin/html/form-settings-post.php:28
682
+ #: class/render-form.php:615
683
+ msgid "Save Draft"
684
  msgstr ""
685
 
686
+ #: admin/form.php:532 admin/form.php:539
687
+ msgid "Post Title"
688
  msgstr ""
689
 
690
+ #: admin/form.php:569 admin/template-post.php:41
691
+ msgid "Enable Image Insertion"
692
  msgstr ""
693
 
694
+ #: admin/form.php:571 admin/template-post.php:47
695
+ msgid "Enable image upload in post area"
696
  msgstr ""
697
 
698
+ #: admin/form.php:580 admin/form.php:587
699
+ msgid "Post Body"
700
  msgstr ""
701
 
702
+ #: admin/form.php:624 admin/form.php:631
703
+ msgid "Excerpt"
 
 
704
  msgstr ""
705
 
706
+ #: admin/form.php:672 admin/form.php:679 templates/dashboard/posts.php:71
707
+ #: templates/dashboard.php:24
708
+ msgid "Featured Image"
709
  msgstr ""
710
 
711
+ #: admin/form.php:706 admin/form.php:712
712
+ msgid "Tags"
713
  msgstr ""
714
 
715
+ #: admin/form.php:740 admin/template-post.php:154
716
+ msgid "Type"
717
  msgstr ""
718
 
719
+ #: admin/form.php:746 admin/template-post.php:159
720
+ msgid "Text Input"
721
  msgstr ""
722
 
723
+ #: admin/form.php:747 admin/template-post.php:160
724
+ msgid "Ajax"
725
  msgstr ""
726
 
727
+ #: admin/form.php:756 admin/template-post.php:165
728
+ msgid "Order By"
 
 
729
  msgstr ""
730
 
731
+ #: admin/form.php:759 admin/html/form-settings-post.php:16
732
+