User registration & user profile – Profile Builder - Version 3.0.5

Version Description

  • Fixed: Elementor Templates restriction brakes rendering of templates

=

Download this release

Release Info

Developer sareiodata
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 3.0.5
Comparing to
See all releases

Code changes from version 3.0.4 to 3.0.5

Files changed (95) hide show
  1. admin/add-ons.php +450 -450
  2. admin/admin-bar.php +127 -127
  3. admin/admin-functions.php +306 -306
  4. admin/basic-info.php +227 -227
  5. admin/feedback.php +241 -241
  6. admin/general-settings.php +361 -361
  7. admin/manage-fields.php +1593 -1593
  8. admin/pms-cross-promotion.php +243 -243
  9. admin/private-website.php +134 -134
  10. admin/register-version.php +269 -269
  11. assets/css/rtl.css +59 -59
  12. assets/css/select2/select2.min.css +1 -1
  13. assets/css/serial-notice.css +50 -50
  14. assets/css/style-back-end.css +835 -835
  15. assets/css/style-front-end.css +832 -832
  16. assets/js/jquery-edit-profile.js +0 -16
  17. assets/js/jquery-email-confirmation.js +66 -66
  18. assets/js/jquery-epf-rf.js +165 -165
  19. assets/js/jquery-manage-fields-live-change.js +902 -902
  20. assets/js/jquery-pb-add-ons.js +236 -236
  21. assets/js/jquery-pb-sitewide.js +166 -166
  22. assets/js/select2/i18n/ar.js +2 -2
  23. assets/js/select2/i18n/az.js +2 -2
  24. assets/js/select2/i18n/bg.js +2 -2
  25. assets/js/select2/i18n/ca.js +2 -2
  26. assets/js/select2/i18n/cs.js +2 -2
  27. assets/js/select2/i18n/da.js +2 -2
  28. assets/js/select2/i18n/de.js +2 -2
  29. assets/js/select2/i18n/el.js +2 -2
  30. assets/js/select2/i18n/en.js +2 -2
  31. assets/js/select2/i18n/es.js +2 -2
  32. assets/js/select2/i18n/et.js +2 -2
  33. assets/js/select2/i18n/eu.js +2 -2
  34. assets/js/select2/i18n/fa.js +2 -2
  35. assets/js/select2/i18n/fi.js +2 -2
  36. assets/js/select2/i18n/fr.js +2 -2
  37. assets/js/select2/i18n/gl.js +2 -2
  38. assets/js/select2/i18n/he.js +2 -2
  39. assets/js/select2/i18n/hi.js +2 -2
  40. assets/js/select2/i18n/hr.js +2 -2
  41. assets/js/select2/i18n/hu.js +2 -2
  42. assets/js/select2/i18n/id.js +2 -2
  43. assets/js/select2/i18n/is.js +2 -2
  44. assets/js/select2/i18n/it.js +2 -2
  45. assets/js/select2/i18n/ja.js +2 -2
  46. assets/js/select2/i18n/km.js +2 -2
  47. assets/js/select2/i18n/ko.js +2 -2
  48. assets/js/select2/i18n/lt.js +2 -2
  49. assets/js/select2/i18n/lv.js +2 -2
  50. assets/js/select2/i18n/mk.js +2 -2
  51. assets/js/select2/i18n/ms.js +2 -2
  52. assets/js/select2/i18n/nb.js +2 -2
  53. assets/js/select2/i18n/nl.js +2 -2
  54. assets/js/select2/i18n/pl.js +2 -2
  55. assets/js/select2/i18n/pt-BR.js +2 -2
  56. assets/js/select2/i18n/pt.js +2 -2
  57. assets/js/select2/i18n/ro.js +2 -2
  58. assets/js/select2/i18n/ru.js +2 -2
  59. assets/js/select2/i18n/sk.js +2 -2
  60. assets/js/select2/i18n/sr-Cyrl.js +2 -2
  61. assets/js/select2/i18n/sr.js +2 -2
  62. assets/js/select2/i18n/sv.js +2 -2
  63. assets/js/select2/i18n/th.js +2 -2
  64. assets/js/select2/i18n/tr.js +2 -2
  65. assets/js/select2/i18n/uk.js +2 -2
  66. assets/js/select2/i18n/vi.js +2 -2
  67. assets/js/select2/i18n/zh-CN.js +2 -2
  68. assets/js/select2/i18n/zh-TW.js +2 -2
  69. assets/js/select2/select2.min.js +2 -2
  70. assets/lib/Mustache/Autoloader.php +75 -75
  71. assets/lib/Mustache/Compiler.php +476 -476
  72. assets/lib/Mustache/Context.php +149 -149
  73. assets/lib/Mustache/Engine.php +748 -748
  74. assets/lib/Mustache/Exception.php +18 -18
  75. assets/lib/Mustache/Exception/InvalidArgumentException.php +18 -18
  76. assets/lib/Mustache/Exception/LogicException.php +18 -18
  77. assets/lib/Mustache/Exception/RuntimeException.php +18 -18
  78. assets/lib/Mustache/Exception/SyntaxException.php +29 -29
  79. assets/lib/Mustache/Exception/UnknownFilterException.php +29 -29
  80. assets/lib/Mustache/Exception/UnknownHelperException.php +29 -29
  81. assets/lib/Mustache/Exception/UnknownTemplateException.php +29 -29
  82. assets/lib/Mustache/HelperCollection.php +170 -170
  83. assets/lib/Mustache/LambdaHelper.php +49 -49
  84. assets/lib/Mustache/Loader.php +28 -28
  85. assets/lib/Mustache/Loader/ArrayLoader.php +78 -78
  86. assets/lib/Mustache/Loader/CascadingLoader.php +69 -69
  87. assets/lib/Mustache/Loader/FilesystemLoader.php +124 -124
  88. assets/lib/Mustache/Loader/InlineLoader.php +123 -123
  89. assets/lib/Mustache/Loader/MutableLoader.php +32 -32
  90. assets/lib/Mustache/Loader/StringLoader.php +40 -40
  91. assets/lib/Mustache/Logger.php +135 -135
  92. assets/lib/Mustache/Logger/AbstractLogger.php +121 -121
  93. assets/lib/Mustache/Logger/StreamLogger.php +193 -193
  94. assets/lib/Mustache/Parser.php +194 -194
  95. assets/lib/Mustache/Template.php +0 -92
admin/add-ons.php CHANGED
@@ -1,451 +1,451 @@
1
- <?php
2
- /**
3
- * Function that creates the "Add-Ons" submenu page
4
- *
5
- * @since v.2.1.0
6
- *
7
- * @return void
8
- */
9
- function wppb_register_add_ons_submenu_page() {
10
- add_submenu_page( 'profile-builder', __( 'Add-Ons', 'profile-builder' ), __( 'Add-Ons', 'profile-builder' ), 'manage_options', 'profile-builder-add-ons', 'wppb_add_ons_content' );
11
- }
12
- add_action( 'admin_menu', 'wppb_register_add_ons_submenu_page', 19 );
13
-
14
-
15
- /**
16
- * Function that adds content to the "Add-Ons" submenu page
17
- *
18
- * @since v.2.1.0
19
- *
20
- * @return string
21
- */
22
- function wppb_add_ons_content() {
23
-
24
- $version = 'Free';
25
- $version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
26
- $version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
27
-
28
- $wppb_add_ons = wppb_add_ons_get_remote_content();
29
- $wppb_get_all_plugins = get_plugins();
30
- $wppb_get_active_plugins = get_option('active_plugins');
31
- $ajax_nonce = wp_create_nonce("wppb-activate-addon");
32
-
33
- ?>
34
-
35
- <div class="wrap wppb-add-on-wrap">
36
-
37
-
38
-
39
-
40
- <div>
41
- <h2><?php _e( 'Recommended Plugins', 'profile-builder' ) ?></h2>
42
-
43
-
44
- <?php
45
- $trp_add_on_exists = 0;
46
- $trp_add_on_is_active = 0;
47
- $trp_add_on_is_network_active = 0;
48
- // Check to see if add-on is in the plugins folder
49
- foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
50
- if( strtolower($wppb_plugin['Name']) == strtolower( 'TranslatePress - Multilingual' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
51
- $trp_add_on_exists = 1;
52
- if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
53
- $trp_add_on_is_active = 1;
54
- }
55
- // Consider the add-on active if it's network active
56
- if (is_plugin_active_for_network($wppb_plugin_key)) {
57
- $trp_add_on_is_network_active = 1;
58
- $trp_add_on_is_active = 1;
59
- }
60
- $plugin_file = $wppb_plugin_key;
61
- }
62
- }
63
- ?>
64
- <div class="plugin-card wppb-recommended-plugin wppb-add-on">
65
- <div class="plugin-card-top">
66
- <a target="_blank" href="https://wordpress.org/plugins/translatepress-multilingual/">
67
- <img src="<?php echo plugins_url( '../assets/images/trp-recommended.png', __FILE__ ); ?>" width="100%">
68
- </a>
69
- <h3 class="wppb-add-on-title">
70
- <a target="_blank" href="https://wordpress.org/plugins/translatepress-multilingual/">TranslatePress</a>
71
- </h3>
72
- <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
73
- <p class="wppb-add-on-description">
74
- <?php _e( 'Translate your Profile Builder forms with a WordPress translation plugin that anyone can use. It offers a simpler way to translate WordPress sites, with full support for WooCommerce and site builders.', 'profile-builder' ) ?>
75
- <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=translatepress-multilingual&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about TranslatePress - Multilingual" data-title="TranslatePress - Multilingual"><?php _e( 'More Details' ); ?></a>
76
- </p>
77
- </div>
78
- <div class="plugin-card-bottom wppb-add-on-compatible">
79
- <?php
80
- if ($trp_add_on_exists) {
81
-
82
- // Display activate/deactivate buttons
83
- if (!$trp_add_on_is_active) {
84
- echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
85
-
86
- // If add-on is network activated don't allow deactivation
87
- } elseif (!$trp_add_on_is_network_active) {
88
- echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
89
- }
90
-
91
- // Display message to the user
92
- if( !$trp_add_on_is_active ){
93
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
94
- } else {
95
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
96
- }
97
-
98
- } else {
99
- // handles the in-page download
100
- $wppb_paid_link_class = 'button-secondary';
101
- $wppb_paid_link_text = __('Install Now', 'profile-builder');
102
-
103
- echo '<a class="right install-now button ' . $wppb_paid_link_class . '" href="'. wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=translatepress-multilingual'), 'install-plugin_translatepress-multilingual') .'" data-add-on-slug="translatepress-multilingual" data-add-on-name="TranslatePress - Multilingual" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
104
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
105
-
106
- }
107
- ?>
108
- <div class="spinner"></div>
109
- <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'https://www.wordpress.org/plugins/translatepress-multilingual' )) ?></a>.</span>
110
- </div>
111
- </div>
112
-
113
-
114
-
115
- <?php
116
- $pms_add_on_exists = 0;
117
- $pms_add_on_is_active = 0;
118
- $pms_add_on_is_network_active = 0;
119
- // Check to see if add-on is in the plugins folder
120
- foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
121
- if( strtolower($wppb_plugin['Name']) == strtolower( 'Paid Member Subscriptions' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
122
- $pms_add_on_exists = 1;
123
- if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
124
- $pms_add_on_is_active = 1;
125
- }
126
- // Consider the add-on active if it's network active
127
- if (is_plugin_active_for_network($wppb_plugin_key)) {
128
- $pms_add_on_is_network_active = 1;
129
- $pms_add_on_is_active = 1;
130
- }
131
- $plugin_file = $wppb_plugin_key;
132
- }
133
- }
134
- ?>
135
- <div class="plugin-card wppb-recommended-plugin wppb-add-on">
136
- <div class="plugin-card-top">
137
- <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">
138
- <img src="<?php echo plugins_url( '../assets/images/pms-recommended.png', __FILE__ ); ?>" width="100%">
139
- </a>
140
- <h3 class="wppb-add-on-title">
141
- <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">Paid Member Subscriptions</a>
142
- </h3>
143
- <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
144
- <p class="wppb-add-on-description">
145
- <?php _e( 'Accept user payments, create subscription plans and restrict content on your membership site.', 'profile-builder' ) ?>
146
- <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=paid-member-subscriptions&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about Paid Member Subscriptions - membership & content restriction" data-title="Paid Member Subscriptions - membership & content restriction"><?php _e( 'More Details' ); ?></a>
147
- </p>
148
- </div>
149
- <div class="plugin-card-bottom wppb-add-on-compatible">
150
- <?php
151
- if ($pms_add_on_exists) {
152
-
153
- // Display activate/deactivate buttons
154
- if (!$pms_add_on_is_active) {
155
- echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
156
-
157
- // If add-on is network activated don't allow deactivation
158
- } elseif (!$pms_add_on_is_network_active) {
159
- echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
160
- }
161
-
162
- // Display message to the user
163
- if( !$pms_add_on_is_active ){
164
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
165
- } else {
166
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
167
- }
168
-
169
- } else {
170
- // handles the in-page download
171
- $wppb_paid_link_class = 'button-secondary';
172
- $wppb_paid_link_text = __('Install Now', 'profile-builder');
173
-
174
- echo '<a class="right install-now button ' . $wppb_paid_link_class . '" href="'. wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=paid-member-subscriptions'), 'install-plugin_paid-member-subscriptions') .'" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
175
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
176
-
177
- }
178
- ?>
179
- <div class="spinner"></div>
180
- <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span>
181
- </div>
182
- </div>
183
-
184
-
185
-
186
-
187
-
188
-
189
- </div>
190
-
191
- <div class="clear"></div>
192
-
193
- <h2><?php _e( 'Add-Ons', 'profile-builder' ); ?></h2>
194
-
195
- <span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Activate', 'profile-builder' ); ?></span>
196
-
197
- <span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Downloading and installing...', 'profile-builder' ); ?></span>
198
- <span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Installation complete', 'profile-builder' ); ?></span>
199
-
200
- <span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is Active', 'profile-builder' ); ?></span>
201
- <span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been activated', 'profile-builder' ) ?></span>
202
- <span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Retry Install', 'profile-builder' ) ?></span>
203
-
204
- <span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>active</strong>', 'profile-builder' ); ?></span>
205
- <span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>inactive</strong>', 'profile-builder' ); ?></span>
206
-
207
- <span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Deactivate', 'profile-builder' ) ?></span>
208
- <span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been deactivated.', 'profile-builder' ) ?></span>
209
-
210
- <div id="the-list">
211
-
212
- <?php
213
-
214
- if( $wppb_add_ons === false ) {
215
-
216
- echo __('Something went wrong, we could not connect to the server. Please try again later.', 'profile-builder');
217
-
218
- } else {
219
-
220
- foreach( $wppb_add_ons as $key => $wppb_add_on ) {
221
-
222
- $wppb_add_on_exists = 0;
223
- $wppb_add_on_is_active = 0;
224
- $wppb_add_on_is_network_active = 0;
225
-
226
- // Check to see if add-on is in the plugins folder
227
- foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
228
- if (strpos(strtolower($wppb_plugin['Name']), strtolower($wppb_add_on['name'])) !== false && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
229
- $wppb_add_on_exists = 1;
230
-
231
- if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
232
- $wppb_add_on_is_active = 1;
233
- }
234
-
235
- // Consider the add-on active if it's network active
236
- if (is_plugin_active_for_network($wppb_plugin_key)) {
237
- $wppb_add_on_is_network_active = 1;
238
- $wppb_add_on_is_active = 1;
239
- }
240
-
241
- $wppb_add_on['plugin_file'] = $wppb_plugin_key;
242
- }
243
- }
244
-
245
- echo '<div class="plugin-card wppb-add-on">';
246
- echo '<div class="plugin-card-top">';
247
-
248
- echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
249
- echo '<img src="' . $wppb_add_on['thumbnail_url'] . '" />';
250
- echo '</a>';
251
-
252
- echo '<h3 class="wppb-add-on-title">';
253
- echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
254
- echo $wppb_add_on['name'];
255
- echo '</a>';
256
- echo '</h3>';
257
-
258
- //echo '<h3 class="wppb-add-on-price">' . $wppb_add_on['price'] . '</h3>';
259
- if( $wppb_add_on['type'] == 'paid' )
260
- echo '<h3 class="wppb-add-on-price">' . __( 'Available in Hobbyist and Pro Versions', 'profile-builder' ) . '</h3>';
261
- else
262
- echo '<h3 class="wppb-add-on-price">' . __( 'Available in All Versions', 'profile-builder' ) . '</h3>';
263
-
264
- echo '<p class="wppb-add-on-description">' . $wppb_add_on['description'] . '</p>';
265
-
266
- echo '</div>';
267
-
268
- $wppb_version_validation = version_compare(PROFILE_BUILDER_VERSION, $wppb_add_on['product_version']);
269
-
270
- ($wppb_version_validation != -1) ? $wppb_version_validation_class = 'wppb-add-on-compatible' : $wppb_version_validation_class = 'wppb-add-on-not-compatible';
271
-
272
- echo '<div class="plugin-card-bottom ' . $wppb_version_validation_class . '">';
273
-
274
- // PB minimum version number is all good
275
- if ($wppb_version_validation != -1) {
276
-
277
- // PB version type does match
278
- if (in_array(strtolower($version), $wppb_add_on['product_version_type'])) {
279
-
280
- if ($wppb_add_on_exists) {
281
-
282
- // Display activate/deactivate buttons
283
- if (!$wppb_add_on_is_active) {
284
- echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
285
-
286
- // If add-on is network activated don't allow deactivation
287
- } elseif (!$wppb_add_on_is_network_active) {
288
- echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
289
- }
290
-
291
- // Display message to the user
292
- if (!$wppb_add_on_is_active) {
293
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Add-On is <strong>inactive</strong>', 'profile-builder') . '</span>';
294
- } else {
295
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Add-On is <strong>active</strong>', 'profile-builder') . '</span>';
296
- }
297
-
298
- } else {
299
-
300
- // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
301
- // handles the in-page download
302
- ($wppb_add_on['paid']) ? $wppb_paid_link_class = 'button-primary' : $wppb_paid_link_class = 'button-secondary';
303
- ($wppb_add_on['paid']) ? $wppb_paid_link_text = __('Learn More', 'profile-builder') : $wppb_paid_link_text = __('Download Now', 'profile-builder');
304
-
305
- ($wppb_add_on['paid']) ? $wppb_paid_href_utm_text = '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page-buy-button&utm_campaign=PB' . $version : $wppb_paid_href_utm_text = '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version;
306
-
307
- echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="' . $wppb_add_on['url'] . $wppb_paid_href_utm_text . '" data-add-on-slug="profile-builder-' . $wppb_add_on['slug'] . '" data-add-on-name="' . $wppb_add_on['name'] . '" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
308
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
309
-
310
- }
311
-
312
- echo '<div class="spinner"></div>';
313
-
314
- // PB version type does not match
315
- } else {
316
-
317
- echo '<a target="_blank" class="button button-secondary right" href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page-upgrade-button&utm_campaign=PB' . $version . '">' . __('Upgrade Profile Builder', 'profile-builder') . '</a>';
318
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Not compatible with Profile Builder', 'profile-builder') . ' ' . $version . '</span>';
319
-
320
- }
321
-
322
- } else {
323
-
324
- // If PB version is older than the minimum required version of the add-on
325
- echo ' ' . '<a class="button button-secondary right" href="' . admin_url('plugins.php') . '">' . __('Update', 'profile-builder') . '</a>';
326
- echo '<span class="wppb-add-on-message">' . __('Not compatible with your version of Profile Builder.', 'profile-builder') . '</span><br />';
327
- echo '<span class="wppb-add-on-message">' . __('Minimum required Profile Builder version:', 'profile-builder') . '<strong> ' . $wppb_add_on['product_version'] . '</strong></span>';
328
-
329
- }
330
-
331
- // We had to put this error here because we need the url of the add-on
332
- echo '<span class="wppb-add-on-user-messages wppb-error-manual-install">' . sprintf(__('Could not install add-on. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url($wppb_add_on['url'])) . '</span>';
333
-
334
- echo '</div>';
335
- echo '</div>';
336
-
337
- } /* end $wppb_add_ons foreach */
338
- }
339
-
340
- ?>
341
- </div>
342
-
343
-
344
-
345
- </div>
346
- <?php
347
- }
348
-
349
- /*
350
- * Function that returns the array of add-ons from cozmoslabs.com if it finds the file
351
- * If something goes wrong it returns false
352
- *
353
- * @since v.2.1.0
354
- */
355
- function wppb_add_ons_get_remote_content() {
356
-
357
- $response = wp_remote_get('https://www.cozmoslabs.com/wp-content/plugins/cozmoslabs-products-add-ons/profile-builder-add-ons.json');
358
-
359
- if( is_wp_error($response) ) {
360
- return false;
361
- } else {
362
- $json_file_contents = $response['body'];
363
- $wppb_add_ons = json_decode( $json_file_contents, true );
364
- }
365
-
366
- if( !is_object( $wppb_add_ons ) && !is_array( $wppb_add_ons ) ) {
367
- return false;
368
- }
369
-
370
- return $wppb_add_ons;
371
-
372
- }
373
-
374
-
375
- /*
376
- * Function that is triggered through Ajax to activate an add-on
377
- *
378
- * @since v.2.1.0
379
- */
380
- function wppb_add_on_activate() {
381
- check_ajax_referer( 'wppb-activate-addon', 'nonce' );
382
- if( current_user_can( 'manage_options' ) ){
383
- // Setup variables from POST
384
- $wppb_add_on_to_activate = sanitize_text_field( $_POST['wppb_add_on_to_activate'] );
385
- $response = filter_var( $_POST['wppb_add_on_index'], FILTER_SANITIZE_NUMBER_INT );
386
-
387
- if( !empty( $wppb_add_on_to_activate ) && !is_plugin_active( $wppb_add_on_to_activate )) {
388
- activate_plugin( $wppb_add_on_to_activate );
389
- }
390
-
391
- if( !empty( $response ) )
392
- echo $response;
393
- }
394
- wp_die();
395
- }
396
- add_action( 'wp_ajax_wppb_add_on_activate', 'wppb_add_on_activate' );
397
-
398
-
399
- /*
400
- * Function that is triggered through Ajax to deactivate an add-on
401
- *
402
- * @since v.2.1.0
403
- */
404
- function wppb_add_on_deactivate() {
405
- check_ajax_referer( 'wppb-activate-addon', 'nonce' );
406
- if( current_user_can( 'manage_options' ) ){
407
- // Setup variables from POST
408
- $wppb_add_on_to_deactivate = sanitize_text_field( $_POST['wppb_add_on_to_deactivate'] );
409
- $response = filter_var( $_POST['wppb_add_on_index'], FILTER_SANITIZE_NUMBER_INT );
410
-
411
- if( !empty( $wppb_add_on_to_deactivate ))
412
- deactivate_plugins( $wppb_add_on_to_deactivate );
413
-
414
- if( !empty( $response ) )
415
- echo $response;
416
- }
417
- wp_die();
418
-
419
- }
420
- add_action( 'wp_ajax_wppb_add_on_deactivate', 'wppb_add_on_deactivate' );
421
-
422
-
423
- /*
424
- * Function that retrieves the data of the newly added plugin
425
- *
426
- * @since v.2.1.0
427
- */
428
- function wppb_add_on_get_new_plugin_data() {
429
- if(isset( $_POST['wppb_add_on_name'] ) ){
430
- $wppb_add_on_name = sanitize_text_field( $_POST['wppb_add_on_name'] );
431
- }
432
-
433
- $wppb_get_all_plugins = get_plugins();
434
- foreach( $wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin ) {
435
-
436
- if( strpos( $wppb_plugin['Name'], $wppb_add_on_name ) !== false && strpos( $wppb_plugin['AuthorName'], 'Cozmoslabs' ) !== false ) {
437
-
438
- // Deactivate the add-on if it's active
439
- if( is_plugin_active( $wppb_plugin_key )) {
440
- deactivate_plugins( $wppb_plugin_key );
441
- }
442
-
443
- // Return the plugin path
444
- echo $wppb_plugin_key;
445
- wp_die();
446
- }
447
- }
448
-
449
- wp_die();
450
- }
451
  add_action( 'wp_ajax_wppb_add_on_get_new_plugin_data', 'wppb_add_on_get_new_plugin_data' );
1
+ <?php
2
+ /**
3
+ * Function that creates the "Add-Ons" submenu page
4
+ *
5
+ * @since v.2.1.0
6
+ *
7
+ * @return void
8
+ */
9
+ function wppb_register_add_ons_submenu_page() {
10
+ add_submenu_page( 'profile-builder', __( 'Add-Ons', 'profile-builder' ), __( 'Add-Ons', 'profile-builder' ), 'manage_options', 'profile-builder-add-ons', 'wppb_add_ons_content' );
11
+ }
12
+ add_action( 'admin_menu', 'wppb_register_add_ons_submenu_page', 19 );
13
+
14
+
15
+ /**
16
+ * Function that adds content to the "Add-Ons" submenu page
17
+ *
18
+ * @since v.2.1.0
19
+ *
20
+ * @return string
21
+ */
22
+ function wppb_add_ons_content() {
23
+
24
+ $version = 'Free';
25
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
26
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
27
+
28
+ $wppb_add_ons = wppb_add_ons_get_remote_content();
29
+ $wppb_get_all_plugins = get_plugins();
30
+ $wppb_get_active_plugins = get_option('active_plugins');
31
+ $ajax_nonce = wp_create_nonce("wppb-activate-addon");
32
+
33
+ ?>
34
+
35
+ <div class="wrap wppb-add-on-wrap">
36
+
37
+
38
+
39
+
40
+ <div>
41
+ <h2><?php _e( 'Recommended Plugins', 'profile-builder' ) ?></h2>
42
+
43
+
44
+ <?php
45
+ $trp_add_on_exists = 0;
46
+ $trp_add_on_is_active = 0;
47
+ $trp_add_on_is_network_active = 0;
48
+ // Check to see if add-on is in the plugins folder
49
+ foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
50
+ if( strtolower($wppb_plugin['Name']) == strtolower( 'TranslatePress - Multilingual' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
51
+ $trp_add_on_exists = 1;
52
+ if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
53
+ $trp_add_on_is_active = 1;
54
+ }
55
+ // Consider the add-on active if it's network active
56
+ if (is_plugin_active_for_network($wppb_plugin_key)) {
57
+ $trp_add_on_is_network_active = 1;
58
+ $trp_add_on_is_active = 1;
59
+ }
60
+ $plugin_file = $wppb_plugin_key;
61
+ }
62
+ }
63
+ ?>
64
+ <div class="plugin-card wppb-recommended-plugin wppb-add-on">
65
+ <div class="plugin-card-top">
66
+ <a target="_blank" href="https://wordpress.org/plugins/translatepress-multilingual/">
67
+ <img src="<?php echo plugins_url( '../assets/images/trp-recommended.png', __FILE__ ); ?>" width="100%">
68
+ </a>
69
+ <h3 class="wppb-add-on-title">
70
+ <a target="_blank" href="https://wordpress.org/plugins/translatepress-multilingual/">TranslatePress</a>
71
+ </h3>
72
+ <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
73
+ <p class="wppb-add-on-description">
74
+ <?php _e( 'Translate your Profile Builder forms with a WordPress translation plugin that anyone can use. It offers a simpler way to translate WordPress sites, with full support for WooCommerce and site builders.', 'profile-builder' ) ?>
75
+ <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=translatepress-multilingual&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about TranslatePress - Multilingual" data-title="TranslatePress - Multilingual"><?php _e( 'More Details' ); ?></a>
76
+ </p>
77
+ </div>
78
+ <div class="plugin-card-bottom wppb-add-on-compatible">
79
+ <?php
80
+ if ($trp_add_on_exists) {
81
+
82
+ // Display activate/deactivate buttons
83
+ if (!$trp_add_on_is_active) {
84
+ echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
85
+
86
+ // If add-on is network activated don't allow deactivation
87
+ } elseif (!$trp_add_on_is_network_active) {
88
+ echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
89
+ }
90
+
91
+ // Display message to the user
92
+ if( !$trp_add_on_is_active ){
93
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
94
+ } else {
95
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
96
+ }
97
+
98
+ } else {
99
+ // handles the in-page download
100
+ $wppb_paid_link_class = 'button-secondary';
101
+ $wppb_paid_link_text = __('Install Now', 'profile-builder');
102
+
103
+ echo '<a class="right install-now button ' . $wppb_paid_link_class . '" href="'. wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=translatepress-multilingual'), 'install-plugin_translatepress-multilingual') .'" data-add-on-slug="translatepress-multilingual" data-add-on-name="TranslatePress - Multilingual" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
104
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
105
+
106
+ }
107
+ ?>
108
+ <div class="spinner"></div>
109
+ <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'https://www.wordpress.org/plugins/translatepress-multilingual' )) ?></a>.</span>
110
+ </div>
111
+ </div>
112
+
113
+
114
+
115
+ <?php
116
+ $pms_add_on_exists = 0;
117
+ $pms_add_on_is_active = 0;
118
+ $pms_add_on_is_network_active = 0;
119
+ // Check to see if add-on is in the plugins folder
120
+ foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
121
+ if( strtolower($wppb_plugin['Name']) == strtolower( 'Paid Member Subscriptions' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
122
+ $pms_add_on_exists = 1;
123
+ if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
124
+ $pms_add_on_is_active = 1;
125
+ }
126
+ // Consider the add-on active if it's network active
127
+ if (is_plugin_active_for_network($wppb_plugin_key)) {
128
+ $pms_add_on_is_network_active = 1;
129
+ $pms_add_on_is_active = 1;
130
+ }
131
+ $plugin_file = $wppb_plugin_key;
132
+ }
133
+ }
134
+ ?>
135
+ <div class="plugin-card wppb-recommended-plugin wppb-add-on">
136
+ <div class="plugin-card-top">
137
+ <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">
138
+ <img src="<?php echo plugins_url( '../assets/images/pms-recommended.png', __FILE__ ); ?>" width="100%">
139
+ </a>
140
+ <h3 class="wppb-add-on-title">
141
+ <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">Paid Member Subscriptions</a>
142
+ </h3>
143
+ <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
144
+ <p class="wppb-add-on-description">
145
+ <?php _e( 'Accept user payments, create subscription plans and restrict content on your membership site.', 'profile-builder' ) ?>
146
+ <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=paid-member-subscriptions&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about Paid Member Subscriptions - membership & content restriction" data-title="Paid Member Subscriptions - membership & content restriction"><?php _e( 'More Details' ); ?></a>
147
+ </p>
148
+ </div>
149
+ <div class="plugin-card-bottom wppb-add-on-compatible">
150
+ <?php
151
+ if ($pms_add_on_exists) {
152
+
153
+ // Display activate/deactivate buttons
154
+ if (!$pms_add_on_is_active) {
155
+ echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
156
+
157
+ // If add-on is network activated don't allow deactivation
158
+ } elseif (!$pms_add_on_is_network_active) {
159
+ echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
160
+ }
161
+
162
+ // Display message to the user
163
+ if( !$pms_add_on_is_active ){
164
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
165
+ } else {
166
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
167
+ }
168
+
169
+ } else {
170
+ // handles the in-page download
171
+ $wppb_paid_link_class = 'button-secondary';
172
+ $wppb_paid_link_text = __('Install Now', 'profile-builder');
173
+
174
+ echo '<a class="right install-now button ' . $wppb_paid_link_class . '" href="'. wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=paid-member-subscriptions'), 'install-plugin_paid-member-subscriptions') .'" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
175
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
176
+
177
+ }
178
+ ?>
179
+ <div class="spinner"></div>
180
+ <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span>
181
+ </div>
182
+ </div>
183
+
184
+
185
+
186
+
187
+
188
+
189
+ </div>
190
+
191
+ <div class="clear"></div>
192
+
193
+ <h2><?php _e( 'Add-Ons', 'profile-builder' ); ?></h2>
194
+
195
+ <span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Activate', 'profile-builder' ); ?></span>
196
+
197
+ <span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Downloading and installing...', 'profile-builder' ); ?></span>
198
+ <span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Installation complete', 'profile-builder' ); ?></span>
199
+
200
+ <span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is Active', 'profile-builder' ); ?></span>
201
+ <span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been activated', 'profile-builder' ) ?></span>
202
+ <span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Retry Install', 'profile-builder' ) ?></span>
203
+
204
+ <span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>active</strong>', 'profile-builder' ); ?></span>
205
+ <span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>inactive</strong>', 'profile-builder' ); ?></span>
206
+
207
+ <span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Deactivate', 'profile-builder' ) ?></span>
208
+ <span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been deactivated.', 'profile-builder' ) ?></span>
209
+
210
+ <div id="the-list">
211
+
212
+ <?php
213
+
214
+ if( $wppb_add_ons === false ) {
215
+
216
+ echo __('Something went wrong, we could not connect to the server. Please try again later.', 'profile-builder');
217
+
218
+ } else {
219
+
220
+ foreach( $wppb_add_ons as $key => $wppb_add_on ) {
221
+
222
+ $wppb_add_on_exists = 0;
223
+ $wppb_add_on_is_active = 0;
224
+ $wppb_add_on_is_network_active = 0;
225
+
226
+ // Check to see if add-on is in the plugins folder
227
+ foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
228
+ if (strpos(strtolower($wppb_plugin['Name']), strtolower($wppb_add_on['name'])) !== false && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
229
+ $wppb_add_on_exists = 1;
230
+
231
+ if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
232
+ $wppb_add_on_is_active = 1;
233
+ }
234
+
235
+ // Consider the add-on active if it's network active
236
+ if (is_plugin_active_for_network($wppb_plugin_key)) {
237
+ $wppb_add_on_is_network_active = 1;
238
+ $wppb_add_on_is_active = 1;
239
+ }
240
+
241
+ $wppb_add_on['plugin_file'] = $wppb_plugin_key;
242
+ }
243
+ }
244
+
245
+ echo '<div class="plugin-card wppb-add-on">';
246
+ echo '<div class="plugin-card-top">';
247
+
248
+ echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
249
+ echo '<img src="' . $wppb_add_on['thumbnail_url'] . '" />';
250
+ echo '</a>';
251
+
252
+ echo '<h3 class="wppb-add-on-title">';
253
+ echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
254
+ echo $wppb_add_on['name'];
255
+ echo '</a>';
256
+ echo '</h3>';
257
+
258
+ //echo '<h3 class="wppb-add-on-price">' . $wppb_add_on['price'] . '</h3>';
259
+ if( $wppb_add_on['type'] == 'paid' )
260
+ echo '<h3 class="wppb-add-on-price">' . __( 'Available in Hobbyist and Pro Versions', 'profile-builder' ) . '</h3>';
261
+ else
262
+ echo '<h3 class="wppb-add-on-price">' . __( 'Available in All Versions', 'profile-builder' ) . '</h3>';
263
+
264
+ echo '<p class="wppb-add-on-description">' . $wppb_add_on['description'] . '</p>';
265
+
266
+ echo '</div>';
267
+
268
+ $wppb_version_validation = version_compare(PROFILE_BUILDER_VERSION, $wppb_add_on['product_version']);
269
+
270
+ ($wppb_version_validation != -1) ? $wppb_version_validation_class = 'wppb-add-on-compatible' : $wppb_version_validation_class = 'wppb-add-on-not-compatible';
271
+
272
+ echo '<div class="plugin-card-bottom ' . $wppb_version_validation_class . '">';
273
+
274
+ // PB minimum version number is all good
275
+ if ($wppb_version_validation != -1) {
276
+
277
+ // PB version type does match
278
+ if (in_array(strtolower($version), $wppb_add_on['product_version_type'])) {
279
+
280
+ if ($wppb_add_on_exists) {
281
+
282
+ // Display activate/deactivate buttons
283
+ if (!$wppb_add_on_is_active) {
284
+ echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
285
+
286
+ // If add-on is network activated don't allow deactivation
287
+ } elseif (!$wppb_add_on_is_network_active) {
288
+ echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
289
+ }
290
+
291
+ // Display message to the user
292
+ if (!$wppb_add_on_is_active) {
293
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Add-On is <strong>inactive</strong>', 'profile-builder') . '</span>';
294
+ } else {
295
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Add-On is <strong>active</strong>', 'profile-builder') . '</span>';
296
+ }
297
+
298
+ } else {
299
+
300
+ // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
301
+ // handles the in-page download
302
+ ($wppb_add_on['paid']) ? $wppb_paid_link_class = 'button-primary' : $wppb_paid_link_class = 'button-secondary';
303
+ ($wppb_add_on['paid']) ? $wppb_paid_link_text = __('Learn More', 'profile-builder') : $wppb_paid_link_text = __('Download Now', 'profile-builder');
304
+
305
+ ($wppb_add_on['paid']) ? $wppb_paid_href_utm_text = '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page-buy-button&utm_campaign=PB' . $version : $wppb_paid_href_utm_text = '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version;
306
+
307
+ echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="' . $wppb_add_on['url'] . $wppb_paid_href_utm_text . '" data-add-on-slug="profile-builder-' . $wppb_add_on['slug'] . '" data-add-on-name="' . $wppb_add_on['name'] . '" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
308
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
309
+
310
+ }
311
+
312
+ echo '<div class="spinner"></div>';
313
+
314
+ // PB version type does not match
315
+ } else {
316
+
317
+ echo '<a target="_blank" class="button button-secondary right" href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page-upgrade-button&utm_campaign=PB' . $version . '">' . __('Upgrade Profile Builder', 'profile-builder') . '</a>';
318
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Not compatible with Profile Builder', 'profile-builder') . ' ' . $version . '</span>';
319
+
320
+ }
321
+
322
+ } else {
323
+
324
+ // If PB version is older than the minimum required version of the add-on
325
+ echo ' ' . '<a class="button button-secondary right" href="' . admin_url('plugins.php') . '">' . __('Update', 'profile-builder') . '</a>';
326
+ echo '<span class="wppb-add-on-message">' . __('Not compatible with your version of Profile Builder.', 'profile-builder') . '</span><br />';
327
+ echo '<span class="wppb-add-on-message">' . __('Minimum required Profile Builder version:', 'profile-builder') . '<strong> ' . $wppb_add_on['product_version'] . '</strong></span>';
328
+
329
+ }
330
+
331
+ // We had to put this error here because we need the url of the add-on
332
+ echo '<span class="wppb-add-on-user-messages wppb-error-manual-install">' . sprintf(__('Could not install add-on. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url($wppb_add_on['url'])) . '</span>';
333
+
334
+ echo '</div>';
335
+ echo '</div>';
336
+
337
+ } /* end $wppb_add_ons foreach */
338
+ }
339
+
340
+ ?>
341
+ </div>
342
+
343
+
344
+
345
+ </div>
346
+ <?php
347
+ }
348
+
349
+ /*
350
+ * Function that returns the array of add-ons from cozmoslabs.com if it finds the file
351
+ * If something goes wrong it returns false
352
+ *
353
+ * @since v.2.1.0
354
+ */
355
+ function wppb_add_ons_get_remote_content() {
356
+
357
+ $response = wp_remote_get('https://www.cozmoslabs.com/wp-content/plugins/cozmoslabs-products-add-ons/profile-builder-add-ons.json');
358
+
359
+ if( is_wp_error($response) ) {
360
+ return false;
361
+ } else {
362
+ $json_file_contents = $response['body'];
363
+ $wppb_add_ons = json_decode( $json_file_contents, true );
364
+ }
365
+
366
+ if( !is_object( $wppb_add_ons ) && !is_array( $wppb_add_ons ) ) {
367
+ return false;
368
+ }
369
+
370
+ return $wppb_add_ons;
371
+
372
+ }
373
+
374
+
375
+ /*
376
+ * Function that is triggered through Ajax to activate an add-on
377
+ *
378
+ * @since v.2.1.0
379
+ */
380
+ function wppb_add_on_activate() {
381
+ check_ajax_referer( 'wppb-activate-addon', 'nonce' );
382
+ if( current_user_can( 'manage_options' ) ){
383
+ // Setup variables from POST
384
+ $wppb_add_on_to_activate = sanitize_text_field( $_POST['wppb_add_on_to_activate'] );
385
+ $response = filter_var( $_POST['wppb_add_on_index'], FILTER_SANITIZE_NUMBER_INT );
386
+
387
+ if( !empty( $wppb_add_on_to_activate ) && !is_plugin_active( $wppb_add_on_to_activate )) {
388
+ activate_plugin( $wppb_add_on_to_activate );
389
+ }
390
+
391
+ if( !empty( $response ) )
392
+ echo $response;
393
+ }
394
+ wp_die();
395
+ }
396
+ add_action( 'wp_ajax_wppb_add_on_activate', 'wppb_add_on_activate' );
397
+
398
+
399
+ /*
400
+ * Function that is triggered through Ajax to deactivate an add-on
401
+ *
402
+ * @since v.2.1.0
403
+ */
404
+ function wppb_add_on_deactivate() {
405
+ check_ajax_referer( 'wppb-activate-addon', 'nonce' );
406
+ if( current_user_can( 'manage_options' ) ){
407
+ // Setup variables from POST
408
+ $wppb_add_on_to_deactivate = sanitize_text_field( $_POST['wppb_add_on_to_deactivate'] );
409
+ $response = filter_var( $_POST['wppb_add_on_index'], FILTER_SANITIZE_NUMBER_INT );
410
+
411
+ if( !empty( $wppb_add_on_to_deactivate ))
412
+ deactivate_plugins( $wppb_add_on_to_deactivate );
413
+
414
+ if( !empty( $response ) )
415
+ echo $response;
416
+ }
417
+ wp_die();
418
+
419
+ }
420
+ add_action( 'wp_ajax_wppb_add_on_deactivate', 'wppb_add_on_deactivate' );
421
+
422
+
423
+ /*
424
+ * Function that retrieves the data of the newly added plugin
425
+ *
426
+ * @since v.2.1.0
427
+ */
428
+ function wppb_add_on_get_new_plugin_data() {
429
+ if(isset( $_POST['wppb_add_on_name'] ) ){
430
+ $wppb_add_on_name = sanitize_text_field( $_POST['wppb_add_on_name'] );
431
+ }
432
+
433
+ $wppb_get_all_plugins = get_plugins();
434
+ foreach( $wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin ) {
435
+
436
+ if( strpos( $wppb_plugin['Name'], $wppb_add_on_name ) !== false && strpos( $wppb_plugin['AuthorName'], 'Cozmoslabs' ) !== false ) {
437
+
438
+ // Deactivate the add-on if it's active
439
+ if( is_plugin_active( $wppb_plugin_key )) {
440
+ deactivate_plugins( $wppb_plugin_key );
441
+ }
442
+
443
+ // Return the plugin path
444
+ echo $wppb_plugin_key;
445
+ wp_die();
446
+ }
447
+ }
448
+
449
+ wp_die();
450
+ }
451
  add_action( 'wp_ajax_wppb_add_on_get_new_plugin_data', 'wppb_add_on_get_new_plugin_data' );
admin/admin-bar.php CHANGED
@@ -1,128 +1,128 @@
1
- <?php
2
- /**
3
- * Function that creates the "Show/Hide the Admin Bar on the Front-End" submenu page
4
- *
5
- * @since v.2.0
6
- *
7
- * @return void
8
- */
9
- function wppb_show_hide_admin_bar_submenu_page() {
10
- add_submenu_page( 'profile-builder', __( 'Show/Hide the Admin Bar on the Front-End', 'profile-builder' ), __( 'Admin Bar Settings', 'profile-builder' ), 'manage_options', 'profile-builder-admin-bar-settings', 'wppb_show_hide_admin_bar_content' );
11
- }
12
- add_action( 'admin_menu', 'wppb_show_hide_admin_bar_submenu_page', 4 );
13
-
14
-
15
- function wppb_generate_admin_bar_default_values( $roles ){
16
- $wppb_display_admin_settings = get_option( 'wppb_display_admin_settings', 'not_found' );
17
-
18
- if ( $wppb_display_admin_settings == 'not_found' ){
19
- if( !empty( $roles ) ){
20
- $admin_settings = array();
21
- foreach ( $roles as $role ){
22
- if( !empty( $role['name'] ) )
23
- $admin_settings[$role['name']] = 'default';
24
- }
25
-
26
- update_option( 'wppb_display_admin_settings', $admin_settings );
27
- }
28
- }
29
- }
30
-
31
-
32
- /**
33
- * Function that adds content to the "Show/Hide the Admin Bar on the Front-End" submenu page
34
- *
35
- * @since v.2.0
36
- *
37
- * @return string
38
- */
39
- function wppb_show_hide_admin_bar_content() {
40
- global $wp_roles;
41
-
42
- wppb_generate_admin_bar_default_values( $wp_roles );
43
- ?>
44
-
45
- <div class="wrap wppb-wrap wppb-admin-bar">
46
-
47
- <h2><?php _e( 'Admin Bar Settings', 'profile-builder' );?></h2>
48
-
49
- <?php settings_errors(); ?>
50
-
51
- <?php wppb_generate_settings_tabs() ?>
52
-
53
- <p class="description"><?php _e( 'Choose which user roles view the admin bar in the front-end of the website.', 'profile-builder' ); ?>
54
- <form method="post" action="options.php#show-hide-admin-bar">
55
- <?php
56
- $admin_bar_settings = get_option( 'wppb_display_admin_settings' );
57
- settings_fields( 'wppb_display_admin_settings' );
58
- ?>
59
- <table class="widefat">
60
- <thead>
61
- <tr>
62
- <th class="row-title" scope="col"><?php _e('User-Role', 'profile-builder');?></th>
63
- <th scope="col"><?php _e('Visibility', 'profile-builder');?></th>
64
- </tr>
65
- </thead>
66
- <tbody>
67
- <?php
68
- $alt_i = 0;
69
- foreach ( $wp_roles->roles as $role ) {
70
- $alt_i++;
71
- $key = $role['name'];
72
- $setting_exists = !empty( $admin_bar_settings[$key] );
73
- $alt_class = ( ( $alt_i%2 == 0 ) ? ' class="alternate"' : '' );
74
-
75
- echo'<tr'.$alt_class.'>
76
- <td>'.translate_user_role($key).'</td>
77
- <td>
78
- <span><input id="rd'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="default"'.( ( !$setting_exists || $admin_bar_settings[$key] == 'default' ) ? ' checked' : '' ).'/><label for="rd'.$key.'">'.__( 'Default', 'profile-builder' ).'</label></span>
79
- <span><input id="rs'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="show"'.( ( $setting_exists && $admin_bar_settings[$key] == 'show') ? ' checked' : '' ).'/><label for="rs'.$key.'">'.__( 'Show', 'profile-builder' ).'</label></span>
80
- <span><input id="rh'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="hide"'.( ( $setting_exists && $admin_bar_settings[$key] == 'hide') ? ' checked' : '' ).'/><label for="rh'.$key.'">'.__( 'Hide', 'profile-builder' ).'</label></span>
81
- </td>
82
- </tr>';
83
- }
84
- ?>
85
-
86
- </table>
87
-
88
- <div id="wppb_submit_button_div">
89
- <input type="hidden" name="action" value="update" />
90
- <p class="submit">
91
- <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
92
- </p>
93
- </div>
94
-
95
- </form>
96
-
97
- </div>
98
- <?php
99
- }
100
-
101
- /**
102
- * Function that changes the username on the top right menu (admin bar)
103
- *
104
- * @since v.2.0
105
- *
106
- * @return string
107
- */
108
- function wppb_replace_username_on_admin_bar( $wp_admin_bar ) {
109
- $wppb_general_settings = get_option( 'wppb_general_settings' );
110
-
111
- if ( isset( $wppb_general_settings['loginWith'] ) && ( $wppb_general_settings['loginWith'] == 'email' ) ){
112
- $current_user = wp_get_current_user();
113
-
114
- if ( $current_user->ID != 0 ) {
115
- if( $current_user->display_name === $current_user->user_login ) {
116
- $my_account_main = $wp_admin_bar->get_node('my-account');
117
- $new_title1 = str_replace($current_user->display_name, $current_user->user_email, $my_account_main->title);
118
- $wp_admin_bar->add_node(array('id' => 'my-account', 'title' => $new_title1));
119
-
120
- $my_account_sub = $wp_admin_bar->get_node('user-info');
121
- $wp_admin_bar->add_node(array('parent' => 'user-actions', 'id' => 'user-info', 'title' => get_avatar($current_user->ID, 64) . "<span class='display-name'>{$current_user->user_email}</span>", 'href' => get_edit_profile_url($current_user->ID), 'meta' => array('tabindex' => -1)));
122
- }
123
- }
124
- }
125
-
126
- return $wp_admin_bar;
127
- }
128
  add_filter( 'admin_bar_menu', 'wppb_replace_username_on_admin_bar', 25 );
1
+ <?php
2
+ /**
3
+ * Function that creates the "Show/Hide the Admin Bar on the Front-End" submenu page
4
+ *
5
+ * @since v.2.0
6
+ *
7
+ * @return void
8
+ */
9
+ function wppb_show_hide_admin_bar_submenu_page() {
10
+ add_submenu_page( 'profile-builder', __( 'Show/Hide the Admin Bar on the Front-End', 'profile-builder' ), __( 'Admin Bar Settings', 'profile-builder' ), 'manage_options', 'profile-builder-admin-bar-settings', 'wppb_show_hide_admin_bar_content' );
11
+ }
12
+ add_action( 'admin_menu', 'wppb_show_hide_admin_bar_submenu_page', 4 );
13
+
14
+
15
+ function wppb_generate_admin_bar_default_values( $roles ){
16
+ $wppb_display_admin_settings = get_option( 'wppb_display_admin_settings', 'not_found' );
17
+
18
+ if ( $wppb_display_admin_settings == 'not_found' ){
19
+ if( !empty( $roles ) ){
20
+ $admin_settings = array();
21
+ foreach ( $roles as $role ){
22
+ if( !empty( $role['name'] ) )
23
+ $admin_settings[$role['name']] = 'default';
24
+ }
25
+
26
+ update_option( 'wppb_display_admin_settings', $admin_settings );
27
+ }
28
+ }
29
+ }
30
+
31
+
32
+ /**
33
+ * Function that adds content to the "Show/Hide the Admin Bar on the Front-End" submenu page
34
+ *
35
+ * @since v.2.0
36
+ *
37
+ * @return string
38
+ */
39
+ function wppb_show_hide_admin_bar_content() {
40
+ global $wp_roles;
41
+
42
+ wppb_generate_admin_bar_default_values( $wp_roles );
43
+ ?>
44
+
45
+ <div class="wrap wppb-wrap wppb-admin-bar">
46
+
47
+ <h2><?php _e( 'Admin Bar Settings', 'profile-builder' );?></h2>
48
+
49
+ <?php settings_errors(); ?>
50
+
51
+ <?php wppb_generate_settings_tabs() ?>
52
+
53
+ <p class="description"><?php _e( 'Choose which user roles view the admin bar in the front-end of the website.', 'profile-builder' ); ?>
54
+ <form method="post" action="options.php#show-hide-admin-bar">
55
+ <?php
56
+ $admin_bar_settings = get_option( 'wppb_display_admin_settings' );
57
+ settings_fields( 'wppb_display_admin_settings' );
58
+ ?>
59
+ <table class="widefat">
60
+ <thead>
61
+ <tr>
62
+ <th class="row-title" scope="col"><?php _e('User-Role', 'profile-builder');?></th>
63
+ <th scope="col"><?php _e('Visibility', 'profile-builder');?></th>
64
+ </tr>
65
+ </thead>
66
+ <tbody>
67
+ <?php
68
+ $alt_i = 0;
69
+ foreach ( $wp_roles->roles as $role ) {
70
+ $alt_i++;
71
+ $key = $role['name'];
72
+ $setting_exists = !empty( $admin_bar_settings[$key] );
73
+ $alt_class = ( ( $alt_i%2 == 0 ) ? ' class="alternate"' : '' );
74
+
75
+ echo'<tr'.$alt_class.'>
76
+ <td>'.translate_user_role($key).'</td>
77
+ <td>
78
+ <span><input id="rd'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="default"'.( ( !$setting_exists || $admin_bar_settings[$key] == 'default' ) ? ' checked' : '' ).'/><label for="rd'.$key.'">'.__( 'Default', 'profile-builder' ).'</label></span>
79
+ <span><input id="rs'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="show"'.( ( $setting_exists && $admin_bar_settings[$key] == 'show') ? ' checked' : '' ).'/><label for="rs'.$key.'">'.__( 'Show', 'profile-builder' ).'</label></span>
80
+ <span><input id="rh'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="hide"'.( ( $setting_exists && $admin_bar_settings[$key] == 'hide') ? ' checked' : '' ).'/><label for="rh'.$key.'">'.__( 'Hide', 'profile-builder' ).'</label></span>
81
+ </td>
82
+ </tr>';
83
+ }
84
+ ?>
85
+
86
+ </table>
87
+
88
+ <div id="wppb_submit_button_div">
89
+ <input type="hidden" name="action" value="update" />
90
+ <p class="submit">
91
+ <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
92
+ </p>
93
+ </div>
94
+
95
+ </form>
96
+
97
+ </div>
98
+ <?php
99
+ }
100
+
101
+ /**
102
+ * Function that changes the username on the top right menu (admin bar)
103
+ *
104
+ * @since v.2.0
105
+ *
106
+ * @return string
107
+ */
108
+ function wppb_replace_username_on_admin_bar( $wp_admin_bar ) {
109
+ $wppb_general_settings = get_option( 'wppb_general_settings' );
110
+
111
+ if ( isset( $wppb_general_settings['loginWith'] ) && ( $wppb_general_settings['loginWith'] == 'email' ) ){
112
+ $current_user = wp_get_current_user();
113
+
114
+ if ( $current_user->ID != 0 ) {
115
+ if( $current_user->display_name === $current_user->user_login ) {
116
+ $my_account_main = $wp_admin_bar->get_node('my-account');
117
+ $new_title1 = str_replace($current_user->display_name, $current_user->user_email, $my_account_main->title);
118
+ $wp_admin_bar->add_node(array('id' => 'my-account', 'title' => $new_title1));
119
+
120
+ $my_account_sub = $wp_admin_bar->get_node('user-info');
121
+ $wp_admin_bar->add_node(array('parent' => 'user-actions', 'id' => 'user-info', 'title' => get_avatar($current_user->ID, 64) . "<span class='display-name'>{$current_user->user_email}</span>", 'href' => get_edit_profile_url($current_user->ID), 'meta' => array('tabindex' => -1)));
122
+ }
123
+ }
124
+ }
125
+
126
+ return $wp_admin_bar;
127
+ }
128
  add_filter( 'admin_bar_menu', 'wppb_replace_username_on_admin_bar', 25 );
admin/admin-functions.php CHANGED
@@ -1,306 +1,306 @@
1
- <?php
2
- /**
3
- * Function which returns the same field-format over and over again.
4
- *
5
- * @since v.2.0
6
- *
7
- * @param string $field
8
- * @param string $field_title
9
- *
10
- * @return string
11
- */
12
- function wppb_field_format ( $field_title, $field ){
13
-
14
- return trim( $field_title ).' ( '.trim( $field ).' )';
15
- }
16
-
17
-
18
- /**
19
- * Add a notification for either the Username or the Email field letting the user know that, even though it is there, it won't do anything
20
- *
21
- * @since v.2.0
22
- *
23
- * @param string $form
24
- * @param integer $id
25
- * @param string $value
26
- *
27
- * @return string $form
28
- */
29
-
30
- function wppb_manage_fields_display_field_title_slug( $form ){
31
- // add a notice to fields
32
- global $wppb_results_field;
33
- switch ($wppb_results_field){
34
- case 'Default - Username':
35
- $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' );
36
- if ( $wppb_generalSettings != 'not_found' && $wppb_generalSettings['loginWith'] == 'email' ) {
37
- $form .= '<div id="wppb-login-email-nag" class="wppb-backend-notice">' . sprintf(__('Login is set to be done using the E-mail. This field will NOT appear in the front-end! ( you can change these settings under the "%s" tab )', 'profile-builder'), '<a href="' . admin_url('admin.php?page=profile-builder-general-settings') . '" target="_blank">' . __('General Settings', 'profile-builder') . '</a>') . '</div>';
38
- }
39
- break;
40
- case 'Default - Display name publicly as':
41
- $form .= '<div id="wppb-display-name-nag" class="wppb-backend-notice">' . __( 'Display name publicly as - only appears on the Edit Profile page!', 'profile-builder' ) . '</div>';
42
- break;
43
- case 'Default - Blog Details':
44
- $form .= '<div id="wppb-blog-details-nag" class="wppb-backend-notice">' . __( 'Blog Details - only appears on the Registration page!', 'profile-builder' ) . '</div>';
45
- break;
46
- }
47
-
48
- return $form;
49
- }
50
-
51
- add_filter( 'wck_after_content_element', 'wppb_manage_fields_display_field_title_slug' );
52
-
53
- /**
54
- * Check if field type is 'Default - Display name publicly as' so we can add a notification for it
55
- *
56
- * @since v.2.2
57
- *
58
- * @param string $wck_element_class
59
- * @param string $meta
60
- * @param array $results
61
- * @param integer $element_id
62
- *
63
- */
64
- function wppb_manage_fields_display_name_notice( $wck_element_class, $meta, $results, $element_id ) {
65
- global $wppb_results_field;
66
-
67
- $wppb_results_field = $results[$element_id]['field'];
68
- }
69
- add_filter( 'wck_element_class_wppb_manage_fields', 'wppb_manage_fields_display_name_notice', 10, 4 );
70
-
71
-
72
-
73
- /**
74
- * Function that adds a custom class to the existing container
75
- *
76
- * @since v.2.0
77
- *
78
- * @param string $update_container_class - the new class name
79
- * @param string $meta - the name of the meta
80
- * @param array $results
81
- * @param integer $element_id - the ID of the element
82
- *
83
- * @return string
84
- */
85
- function wppb_update_container_class( $update_container_class, $meta, $results, $element_id ) {
86
- $wppb_element_type = Wordpress_Creation_Kit_PB::wck_generate_slug( $results[$element_id]["field"] );
87
-
88
- return "class='wck_update_container update_container_$meta update_container_$wppb_element_type element_type_$wppb_element_type'";
89
- }
90
- add_filter( 'wck_update_container_class_wppb_manage_fields', 'wppb_update_container_class', 10, 4 );
91
-
92
-
93
- /**
94
- * Function that adds a custom class to the existing element
95
- *
96
- * @since v.2.0
97
- *
98
- * @param string $element_class - the new class name
99
- * @param string $meta - the name of the meta
100
- * @param array $results
101
- * @param integer $element_id - the ID of the element
102
- *
103
- * @return string
104
- */
105
- function wppb_element_class( $element_class, $meta, $results, $element_id ){
106
- $wppb_element_type = Wordpress_Creation_Kit_PB::wck_generate_slug( $results[$element_id]["field"] );
107
-
108
- return "class='element_type_$wppb_element_type added_fields_list'";
109
- }
110
- add_filter( 'wck_element_class_wppb_manage_fields', 'wppb_element_class', 10, 4 );
111
-
112
- /**
113
- * Functions to check password length and strength
114
- *
115
- * @since v.2.0
116
- */
117
- /* on add user and update profile from WP admin area */
118
- add_action( 'user_profile_update_errors', 'wppb_password_check_on_profile_update', 0, 3 );
119
- function wppb_password_check_on_profile_update( $errors, $update, $user ){
120
- wppb_password_check_extra_conditions( $errors, $user );
121
- }
122
-
123
- /* on reset password */
124
- add_action( 'validate_password_reset', 'wppb_password_check_extra_conditions', 10, 2 );
125
- function wppb_password_check_extra_conditions( $errors, $user ){
126
- $password = ( isset( $_POST[ 'pass1' ] ) && trim( $_POST[ 'pass1' ] ) ) ? $_POST[ 'pass1' ] : false;
127
-
128
- if( $password ){
129
- $wppb_generalSettings = get_option( 'wppb_general_settings' );
130
- if( !empty( $wppb_generalSettings['minimum_password_length'] ) ){
131
- if( strlen( $password ) < $wppb_generalSettings['minimum_password_length'] )
132
- $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have the minimum length of %s characters', 'profile-builder' ), $wppb_generalSettings['minimum_password_length'] ) );
133
- }
134
-
135
- if( isset( $_POST['wppb_password_strength'] ) && !empty( $wppb_generalSettings['minimum_password_strength'] ) ){
136
- $password_strength_array = array( 'short' => 0, 'bad' => 1, 'good' => 2, 'strong' => 3 );
137
- $password_strength_text = array( 'short' => __( 'Very weak', 'profile-builder' ), 'bad' => __( 'Weak', 'profile-builder' ), 'good' => __( 'Medium', 'profile-builder' ), 'strong' => __( 'Strong', 'profile-builder' ) );
138
-
139
- foreach( $password_strength_text as $psr_key => $psr_text ){
140
- if( $psr_text == sanitize_text_field( $_POST['wppb_password_strength'] ) ){
141
- $password_strength_result_slug = $psr_key;
142
- break;
143
- }
144
- }
145
-
146
- if( !empty( $password_strength_result_slug ) ){
147
- if( $password_strength_array[$password_strength_result_slug] < $password_strength_array[$wppb_generalSettings['minimum_password_strength']] )
148
- $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have a minimum strength of %s', 'profile-builder' ), $password_strength_text[$wppb_generalSettings['minimum_password_strength']] ) );
149
- }
150
- }
151
- }
152
-
153
- return $errors;
154
- }
155
-
156
- /* we need to create a hidden field that contains the results of the password strength from the js strength tester */
157
- add_action( 'admin_footer', 'wppb_add_hidden_password_strength_on_backend' );
158
- add_action( 'login_footer', 'wppb_add_hidden_password_strength_on_backend' );
159
- function wppb_add_hidden_password_strength_on_backend(){
160
- if( $GLOBALS['pagenow'] == 'profile.php' || $GLOBALS['pagenow'] == 'user-new.php' || ( $GLOBALS['pagenow'] == 'wp-login.php' && isset( $_GET['action'] ) && ( $_GET['action'] == 'rp' || $_GET['action'] == 'resetpass' ) ) ){
161
- $wppb_generalSettings = get_option( 'wppb_general_settings' );
162
- if( !empty( $wppb_generalSettings['minimum_password_strength'] ) ){
163
- ?>
164
- <script type="text/javascript">
165
- jQuery( document ).ready( function() {
166
- var passswordStrengthResult = jQuery( '#pass-strength-result' );
167
- // Check for password strength meter
168
- if ( passswordStrengthResult.length ) {
169
- // Attach submit event to form
170
- passswordStrengthResult.parents( 'form' ).on( 'submit', function() {
171
- // Store check results in hidden field
172
- jQuery( this ).append( '<input type="hidden" name="wppb_password_strength" value="' + passswordStrengthResult.text() + '">' );
173
- });
174
- }
175
- });
176
- </script>
177
- <?php
178
- }
179
- }
180
- }
181
-
182
-
183
- /* Modify the Add Entry buttons for WCK metaboxes according to context */
184
- add_filter( 'wck_add_entry_button', 'wppb_change_add_entry_button', 10, 2 );
185
- function wppb_change_add_entry_button( $string, $meta ){
186
- if( $meta == 'wppb_manage_fields' || $meta == 'wppb_epf_fields' || $meta == 'wppb_rf_fields' ){
187
- return __( "Add Field", 'profile-builder' );
188
- }elseif( $meta == 'wppb_epf_page_settings' || $meta == 'wppb_rf_page_settings' || $meta == 'wppb_ul_page_settings' ){
189
- return __( "Save Settings", 'profile-builder' );
190
- }
191
-
192
- return $string;
193
- }
194
-
195
- /* Add admin footer text for encouraging users to leave a review of the plugin on wordpress.org */
196
- function wppb_admin_rate_us( $footer_text ) {
197
- global $current_screen;
198
-
199
- if ($current_screen->parent_base == 'profile-builder'){
200
- $rate_text = sprintf( __( 'If you enjoy using <strong> %1$s </strong> please <a href="%2$s" target="_blank">rate us on WordPress.org</a>. More happy users means more features, less bugs and better support for everyone. ', 'profile-builder' ),
201
- PROFILE_BUILDER,
202
- 'https://wordpress.org/support/view/plugin-reviews/profile-builder?filter=5#postform'
203
- );
204
- return '<span id="footer-thankyou">' .$rate_text . '</span>';
205
- } else {
206
- return $footer_text;
207
- }
208
- }
209
- add_filter('admin_footer_text','wppb_admin_rate_us');
210
-
211
- /**
212
- * add links on plugin page
213
- */
214
- add_filter( 'plugin_action_links', 'wppb_plugin_action_links', 10, 2 );
215
- function wppb_plugin_action_links( $links, $file ) {
216
- if ( $file != WPPB_PLUGIN_BASENAME ) {
217
- return $links;
218
- }
219
-
220
- if ( ! current_user_can( 'manage_options' ) ) {
221
- return $links;
222
- }
223
-
224
- $settings_link = sprintf( '<a href="%1$s">%2$s</a>',
225
- menu_page_url( 'profile-builder-general-settings', false ),
226
- esc_html( __( 'Settings', 'profile-builder' ) ) );
227
-
228
- array_unshift( $links, $settings_link );
229
-
230
- return $links;
231
- }
232
-
233
- /**
234
- * add links on plugin page
235
- */
236
- add_filter( 'plugin_row_meta', 'wppb_plugin_row_meta', 10, 2 );
237
- function wppb_plugin_row_meta( $links, $file ) {
238
- if ( WPPB_PLUGIN_BASENAME == $file ) {
239
- $row_meta = array(
240
- 'docs' => '<a href="' . esc_url( 'https://www.cozmoslabs.com/docs/profile-builder-2/' ) . '" target="_blank" aria-label="' . esc_attr__( 'View Profile Builder documentation', 'profile-builder' ) . '">' . esc_html__( 'Docs', 'profile-builder' ) . '</a>',
241
- );
242
-
243
- return array_merge( $links, $row_meta );
244
- }
245
-
246
- return (array) $links;
247
- }
248
-
249
-
250
-
251
- /* In plugin notifications */
252
- add_action( 'admin_init', 'wppb_add_plugin_notifications' );
253
- function wppb_add_plugin_notifications() {
254
- /* initiate the plugin notifications class */
255
- $notifications = WPPB_Plugin_Notifications::get_instance();
256
- /* this must be unique */
257
- $notification_id = 'wppb_new_feature_customization_toolbox';
258
-
259
- $message = '<img style="float: left; margin: 10px 12px 10px 0; max-width: 100px;" src="https://www.cozmoslabs.com/wp-content/themes/cozmiclight/img/pb_addon_small_toolbox.png" alt="Customization Toolbox Add-on"/>';
260
- $message .= '<p style="margin-top: 16px;">' . __( 'Check out the Customization Toolbox add-on which packs the most popular customization requests from Profile Builder.', 'profile-builder' ) . '</p>';
261
- // be careful to use wppb_dismiss_admin_notification as query arg
262
- $message .= '<p><a href="https://www.cozmoslabs.com/add-ons/customization-toolbox/" class="button-primary">' . __( 'See details', 'profile-builder' ) . '</a></p>';
263
- $message .= '<a href="' . add_query_arg( array( 'wppb_dismiss_admin_notification' => $notification_id ) ) . '" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss this notice.', 'profile-builder' ) . '</span></a>';
264
-
265
- $notifications->add_notification( $notification_id, $message, 'wppb-notice wppb-narrow notice notice-info', true, array( 'profile-builder-add-ons' ) );
266
- }
267
-
268
-
269
- /* hook to create pages for out forms when a user press the create pages/setup button */
270
- add_action( 'admin_init', 'wppb_create_form_pages' );
271
- function wppb_create_form_pages(){
272
- if( isset( $_GET['page'] ) && $_GET['page'] == 'profile-builder-basic-info' && isset( $_GET['wppb_create_pages'] ) && $_GET['wppb_create_pages'] == 'true' ){
273
-
274
- $wppb_pages_created = get_option( 'wppb_pages_created' );
275
-
276
- if( empty( $wppb_pages_created ) || ( isset( $_GET['wppb_force_create_pages'] ) && $_GET['wppb_force_create_pages'] == 'true' ) ) {
277
- $register_page = array(
278
- 'post_title' => 'Register',
279
- 'post_content' => '[wppb-register]',
280
- 'post_status' => 'publish',
281
- 'post_type' => 'page'
282
- );
283
- $register_id = wp_insert_post($register_page);
284
-
285
- $edit_page = array(
286
- 'post_title' => 'Edit Profile',
287
- 'post_content' => '[wppb-edit-profile]',
288
- 'post_status' => 'publish',
289
- 'post_type' => 'page'
290
- );
291
- $edit_id = wp_insert_post($edit_page);
292
-
293
- $login_page = array(
294
- 'post_title' => 'Log In',
295
- 'post_content' => '[wppb-login]',
296
- 'post_status' => 'publish',
297
- 'post_type' => 'page'
298
- );
299
- $login_id = wp_insert_post($login_page);
300
-
301
- update_option('wppb_pages_created', 'true' );
302
-
303
- wp_safe_redirect( admin_url('edit.php?s=%5Bwppb-&post_status=all&post_type=page&action=-1&m=0&paged=1&action2=-1') );
304
- }
305
- }
306
- }
1
+ <?php
2
+ /**
3
+ * Function which returns the same field-format over and over again.
4
+ *
5
+ * @since v.2.0
6
+ *
7
+ * @param string $field
8
+ * @param string $field_title
9
+ *
10
+ * @return string
11
+ */
12
+ function wppb_field_format ( $field_title, $field ){
13
+
14
+ return trim( $field_title ).' ( '.trim( $field ).' )';
15
+ }
16
+
17
+
18
+ /**
19
+ * Add a notification for either the Username or the Email field letting the user know that, even though it is there, it won't do anything
20
+ *
21
+ * @since v.2.0
22
+ *
23
+ * @param string $form
24
+ * @param integer $id
25
+ * @param string $value
26
+ *
27
+ * @return string $form
28
+ */
29
+
30
+ function wppb_manage_fields_display_field_title_slug( $form ){
31
+ // add a notice to fields
32
+ global $wppb_results_field;
33
+ switch ($wppb_results_field){
34
+ case 'Default - Username':
35
+ $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' );
36
+ if ( $wppb_generalSettings != 'not_found' && $wppb_generalSettings['loginWith'] == 'email' ) {
37
+ $form .= '<div id="wppb-login-email-nag" class="wppb-backend-notice">' . sprintf(__('Login is set to be done using the E-mail. This field will NOT appear in the front-end! ( you can change these settings under the "%s" tab )', 'profile-builder'), '<a href="' . admin_url('admin.php?page=profile-builder-general-settings') . '" target="_blank">' . __('General Settings', 'profile-builder') . '</a>') . '</div>';
38
+ }
39
+ break;
40
+ case 'Default - Display name publicly as':
41
+ $form .= '<div id="wppb-display-name-nag" class="wppb-backend-notice">' . __( 'Display name publicly as - only appears on the Edit Profile page!', 'profile-builder' ) . '</div>';
42
+ break;
43
+ case 'Default - Blog Details':
44
+ $form .= '<div id="wppb-blog-details-nag" class="wppb-backend-notice">' . __( 'Blog Details - only appears on the Registration page!', 'profile-builder' ) . '</div>';
45
+ break;
46
+ }
47
+
48
+ return $form;
49
+ }
50
+
51
+ add_filter( 'wck_after_content_element', 'wppb_manage_fields_display_field_title_slug' );
52
+
53
+ /**
54
+ * Check if field type is 'Default - Display name publicly as' so we can add a notification for it
55
+ *
56
+ * @since v.2.2
57
+ *
58
+ * @param string $wck_element_class
59
+ * @param string $meta
60
+ * @param array $results
61
+ * @param integer $element_id
62
+ *
63
+ */
64
+ function wppb_manage_fields_display_name_notice( $wck_element_class, $meta, $results, $element_id ) {
65
+ global $wppb_results_field;
66
+
67
+ $wppb_results_field = $results[$element_id]['field'];
68
+ }
69
+ add_filter( 'wck_element_class_wppb_manage_fields', 'wppb_manage_fields_display_name_notice', 10, 4 );
70
+
71
+
72
+
73
+ /**
74
+ * Function that adds a custom class to the existing container
75
+ *
76
+ * @since v.2.0
77
+ *
78
+ * @param string $update_container_class - the new class name
79
+ * @param string $meta - the name of the meta
80
+ * @param array $results
81
+ * @param integer $element_id - the ID of the element
82
+ *
83
+ * @return string
84
+ */
85
+ function wppb_update_container_class( $update_container_class, $meta, $results, $element_id ) {
86
+ $wppb_element_type = Wordpress_Creation_Kit_PB::wck_generate_slug( $results[$element_id]["field"] );
87
+
88
+ return "class='wck_update_container update_container_$meta update_container_$wppb_element_type element_type_$wppb_element_type'";
89
+ }
90
+ add_filter( 'wck_update_container_class_wppb_manage_fields', 'wppb_update_container_class', 10, 4 );
91
+
92
+
93
+ /**
94
+ * Function that adds a custom class to the existing element
95
+ *
96
+ * @since v.2.0
97
+ *
98
+ * @param string $element_class - the new class name
99
+ * @param string $meta - the name of the meta
100
+ * @param array $results
101
+ * @param integer $element_id - the ID of the element
102
+ *
103
+ * @return string
104
+ */
105
+ function wppb_element_class( $element_class, $meta, $results, $element_id ){
106
+ $wppb_element_type = Wordpress_Creation_Kit_PB::wck_generate_slug( $results[$element_id]["field"] );
107
+
108
+ return "class='element_type_$wppb_element_type added_fields_list'";
109
+ }
110
+ add_filter( 'wck_element_class_wppb_manage_fields', 'wppb_element_class', 10, 4 );
111
+
112
+ /**
113
+ * Functions to check password length and strength
114
+ *
115
+ * @since v.2.0
116
+ */
117
+ /* on add user and update profile from WP admin area */
118
+ add_action( 'user_profile_update_errors', 'wppb_password_check_on_profile_update', 0, 3 );
119
+ function wppb_password_check_on_profile_update( $errors, $update, $user ){
120
+ wppb_password_check_extra_conditions( $errors, $user );
121
+ }
122
+
123
+ /* on reset password */
124
+ add_action( 'validate_password_reset', 'wppb_password_check_extra_conditions', 10, 2 );
125
+ function wppb_password_check_extra_conditions( $errors, $user ){
126
+ $password = ( isset( $_POST[ 'pass1' ] ) && trim( $_POST[ 'pass1' ] ) ) ? $_POST[ 'pass1' ] : false;
127
+
128
+ if( $password ){
129
+ $wppb_generalSettings = get_option( 'wppb_general_settings' );
130
+ if( !empty( $wppb_generalSettings['minimum_password_length'] ) ){
131
+ if( strlen( $password ) < $wppb_generalSettings['minimum_password_length'] )
132
+ $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have the minimum length of %s characters', 'profile-builder' ), $wppb_generalSettings['minimum_password_length'] ) );
133
+ }
134
+
135
+ if( isset( $_POST['wppb_password_strength'] ) && !empty( $wppb_generalSettings['minimum_password_strength'] ) ){
136
+ $password_strength_array = array( 'short' => 0, 'bad' => 1, 'good' => 2, 'strong' => 3 );
137
+ $password_strength_text = array( 'short' => __( 'Very weak', 'profile-builder' ), 'bad' => __( 'Weak', 'profile-builder' ), 'good' => __( 'Medium', 'profile-builder' ), 'strong' => __( 'Strong', 'profile-builder' ) );
138
+
139
+ foreach( $password_strength_text as $psr_key => $psr_text ){
140
+ if( $psr_text == sanitize_text_field( $_POST['wppb_password_strength'] ) ){
141
+ $password_strength_result_slug = $psr_key;
142
+ break;
143
+ }
144
+ }
145
+
146
+ if( !empty( $password_strength_result_slug ) ){
147
+ if( $password_strength_array[$password_strength_result_slug] < $password_strength_array[$wppb_generalSettings['minimum_password_strength']] )
148
+ $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have a minimum strength of %s', 'profile-builder' ), $password_strength_text[$wppb_generalSettings['minimum_password_strength']] ) );
149
+ }
150
+ }
151
+ }
152
+
153
+ return $errors;
154
+ }
155
+
156
+ /* we need to create a hidden field that contains the results of the password strength from the js strength tester */
157
+ add_action( 'admin_footer', 'wppb_add_hidden_password_strength_on_backend' );
158
+ add_action( 'login_footer', 'wppb_add_hidden_password_strength_on_backend' );
159
+ function wppb_add_hidden_password_strength_on_backend(){
160
+ if( $GLOBALS['pagenow'] == 'profile.php' || $GLOBALS['pagenow'] == 'user-new.php' || ( $GLOBALS['pagenow'] == 'wp-login.php' && isset( $_GET['action'] ) && ( $_GET['action'] == 'rp' || $_GET['action'] == 'resetpass' ) ) ){
161
+ $wppb_generalSettings = get_option( 'wppb_general_settings' );
162
+ if( !empty( $wppb_generalSettings['minimum_password_strength'] ) ){
163
+ ?>
164
+ <script type="text/javascript">
165
+ jQuery( document ).ready( function() {
166
+ var passswordStrengthResult = jQuery( '#pass-strength-result' );
167
+ // Check for password strength meter
168
+ if ( passswordStrengthResult.length ) {
169
+ // Attach submit event to form
170
+ passswordStrengthResult.parents( 'form' ).on( 'submit', function() {
171
+ // Store check results in hidden field
172
+ jQuery( this ).append( '<input type="hidden" name="wppb_password_strength" value="' + passswordStrengthResult.text() + '">' );
173
+ });
174
+ }
175
+ });
176
+ </script>
177
+ <?php
178
+ }
179
+ }
180
+ }
181
+
182
+
183
+ /* Modify the Add Entry buttons for WCK metaboxes according to context */
184
+ add_filter( 'wck_add_entry_button', 'wppb_change_add_entry_button', 10, 2 );
185
+ function wppb_change_add_entry_button( $string, $meta ){
186
+ if( $meta == 'wppb_manage_fields' || $meta == 'wppb_epf_fields' || $meta == 'wppb_rf_fields' ){
187
+ return __( "Add Field", 'profile-builder' );
188
+ }elseif( $meta == 'wppb_epf_page_settings' || $meta == 'wppb_rf_page_settings' || $meta == 'wppb_ul_page_settings' ){
189
+ return __( "Save Settings", 'profile-builder' );
190
+ }
191
+
192
+ return $string;
193
+ }
194
+
195
+ /* Add admin footer text for encouraging users to leave a review of the plugin on wordpress.org */
196
+ function wppb_admin_rate_us( $footer_text ) {
197
+ global $current_screen;
198
+
199
+ if ($current_screen->parent_base == 'profile-builder'){
200
+ $rate_text = sprintf( __( 'If you enjoy using <strong> %1$s </strong> please <a href="%2$s" target="_blank">rate us on WordPress.org</a>. More happy users means more features, less bugs and better support for everyone. ', 'profile-builder' ),
201
+ PROFILE_BUILDER,
202
+ 'https://wordpress.org/support/view/plugin-reviews/profile-builder?filter=5#postform'
203
+ );
204
+ return '<span id="footer-thankyou">' .$rate_text . '</span>';
205
+ } else {
206
+ return $footer_text;
207
+ }
208
+ }
209
+ add_filter('admin_footer_text','wppb_admin_rate_us');
210
+
211
+ /**
212
+ * add links on plugin page
213
+ */
214
+ add_filter( 'plugin_action_links', 'wppb_plugin_action_links', 10, 2 );
215
+ function wppb_plugin_action_links( $links, $file ) {
216
+ if ( $file != WPPB_PLUGIN_BASENAME ) {
217
+ return $links;
218
+ }
219
+
220
+ if ( ! current_user_can( 'manage_options' ) ) {
221
+ return $links;
222
+ }
223
+
224
+ $settings_link = sprintf( '<a href="%1$s">%2$s</a>',
225
+ menu_page_url( 'profile-builder-general-settings', false ),
226
+ esc_html( __( 'Settings', 'profile-builder' ) ) );
227
+
228
+ array_unshift( $links, $settings_link );
229
+
230
+ return $links;
231
+ }
232
+
233
+ /**
234
+ * add links on plugin page
235
+ */
236
+ add_filter( 'plugin_row_meta', 'wppb_plugin_row_meta', 10, 2 );
237
+ function wppb_plugin_row_meta( $links, $file ) {
238
+ if ( WPPB_PLUGIN_BASENAME == $file ) {
239
+ $row_meta = array(
240
+ 'docs' => '<a href="' . esc_url( 'https://www.cozmoslabs.com/docs/profile-builder-2/' ) . '" target="_blank" aria-label="' . esc_attr__( 'View Profile Builder documentation', 'profile-builder' ) . '">' . esc_html__( 'Docs', 'profile-builder' ) . '</a>',
241
+ );
242
+
243
+ return array_merge( $links, $row_meta );
244
+ }
245
+
246
+ return (array) $links;
247
+ }
248
+
249
+
250
+
251
+ /* In plugin notifications */
252
+ add_action( 'admin_init', 'wppb_add_plugin_notifications' );
253
+ function wppb_add_plugin_notifications() {
254
+ /* initiate the plugin notifications class */
255
+ $notifications = WPPB_Plugin_Notifications::get_instance();
256
+ /* this must be unique */
257
+ $notification_id = 'wppb_new_feature_customization_toolbox';
258
+
259
+ $message = '<img style="float: left; margin: 10px 12px 10px 0; max-width: 100px;" src="https://www.cozmoslabs.com/wp-content/themes/cozmiclight/img/pb_addon_small_toolbox.png" alt="Customization Toolbox Add-on"/>';
260
+ $message .= '<p style="margin-top: 16px;">' . __( 'Check out the Customization Toolbox add-on which packs the most popular customization requests from Profile Builder.', 'profile-builder' ) . '</p>';
261
+ // be careful to use wppb_dismiss_admin_notification as query arg
262
+ $message .= '<p><a href="https://www.cozmoslabs.com/add-ons/customization-toolbox/" class="button-primary">' . __( 'See details', 'profile-builder' ) . '</a></p>';
263
+ $message .= '<a href="' . add_query_arg( array( 'wppb_dismiss_admin_notification' => $notification_id ) ) . '" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss this notice.', 'profile-builder' ) . '</span></a>';
264
+
265
+ $notifications->add_notification( $notification_id, $message, 'wppb-notice wppb-narrow notice notice-info', true, array( 'profile-builder-add-ons' ) );
266
+ }
267
+
268
+
269
+ /* hook to create pages for out forms when a user press the create pages/setup button */
270
+ add_action( 'admin_init', 'wppb_create_form_pages' );
271
+ function wppb_create_form_pages(){
272
+ if( isset( $_GET['page'] ) && $_GET['page'] == 'profile-builder-basic-info' && isset( $_GET['wppb_create_pages'] ) && $_GET['wppb_create_pages'] == 'true' ){
273
+
274
+ $wppb_pages_created = get_option( 'wppb_pages_created' );
275
+
276
+ if( empty( $wppb_pages_created ) || ( isset( $_GET['wppb_force_create_pages'] ) && $_GET['wppb_force_create_pages'] == 'true' ) ) {
277
+ $register_page = array(
278
+ 'post_title' => 'Register',
279
+ 'post_content' => '[wppb-register]',
280
+ 'post_status' => 'publish',
281
+ 'post_type' => 'page'
282
+ );
283
+ $register_id = wp_insert_post($register_page);
284
+
285
+ $edit_page = array(
286
+ 'post_title' => 'Edit Profile',
287
+ 'post_content' => '[wppb-edit-profile]',
288
+ 'post_status' => 'publish',
289
+ 'post_type' => 'page'
290
+ );
291
+ $edit_id = wp_insert_post($edit_page);
292
+
293
+ $login_page = array(
294
+ 'post_title' => 'Log In',
295
+ 'post_content' => '[wppb-login]',
296
+ 'post_status' => 'publish',
297
+ 'post_type' => 'page'
298
+ );
299
+ $login_id = wp_insert_post($login_page);
300
+
301
+ update_option('wppb_pages_created', 'true' );
302
+
303
+ wp_safe_redirect( admin_url('edit.php?s=%5Bwppb-&post_status=all&post_type=page&action=-1&m=0&paged=1&action2=-1') );
304
+ }
305
+ }
306
+ }
admin/basic-info.php CHANGED
@@ -1,228 +1,228 @@
1
- <?php
2
- /**
3
- * Function that creates the "Basic Information" submenu page
4
- *
5
- * @since v.2.0
6
- *
7
- * @return void
8
- */
9
- function wppb_register_basic_info_submenu_page() {
10
- add_submenu_page( 'profile-builder', __( 'Basic Information', 'profile-builder' ), __( 'Basic Information', 'profile-builder' ), 'manage_options', 'profile-builder-basic-info', 'wppb_basic_info_content' );
11
- }
12
- add_action( 'admin_menu', 'wppb_register_basic_info_submenu_page', 2 );
13
-
14
- /**
15
- * Function that adds content to the "Basic Information" submenu page
16
- *
17
- * @since v.2.0
18
- *
19
- * @return string
20
- */
21
- function wppb_basic_info_content() {
22
-
23
- $version = 'Free';
24
- $version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
25
- $version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
26
-
27
- ?>
28
- <div class="wrap wppb-wrap wppb-info-wrap">
29
- <div class="wppb-badge <?php echo $version; ?>"><span><?php printf( __( 'Version %s' ), PROFILE_BUILDER_VERSION ); ?></span></div>
30
- <h1><?php printf( __( '<strong>Profile Builder </strong> %s', 'profile-builder' ), $version ); ?></h1>
31
- <p class="wppb-info-text"><?php printf( __( 'The best way to add front-end registration, edit profile and login forms.', 'profile-builder' ) ); ?></p>
32
- <hr />
33
- <?php
34
- $wppb_pages_created = get_option( 'wppb_pages_created' );
35
- $shortcode_pages_query = new WP_Query( array( 'post_type' => 'page', 's' => '[wppb-' ) );
36
- if( empty( $wppb_pages_created ) && !$shortcode_pages_query->have_posts() ){
37
- ?>
38
- <div class="wppb-auto-form-creation wppb-2-1-col">
39
- <div><h3><?php _e( 'Speed up the setup process by automatically creating the form pages:', 'profile-builder' ); ?></h3></div>
40
- <div><a href="<?php echo admin_url('admin.php?page=profile-builder-basic-info&wppb_create_pages=true') ?>" class="button primary button-primary button-hero"><?php _e( 'Create Form Pages', 'profile-builder' ); ?></a></div>
41
- </div>
42
- <?php }else{ ?>
43
- <div class="wppb-auto-form-creation wppb-forms-created wppb-2-1-col">
44
- <div><h3><?php _e( 'You can see all the pages with Profile Builder form shortcodes here:', 'profile-builder' ); ?></h3></div>
45
- <div><a href="<?php echo admin_url('edit.php?s=%5Bwppb-&post_status=all&post_type=page&action=-1&m=0&paged=1&action2=-1') ?>" class="button primary button-primary button-hero"><?php _e( 'View Form Pages', 'profile-builder' ); ?></a></div>
46
- </div>
47
- <?php } ?>
48
-
49
- <div class="wppb-row wppb-3-col">
50
- <div>
51
- <h3><?php _e( 'Login Form', 'profile-builder' ); ?></h3>
52
- <p><?php printf( __( 'Friction-less login using %s shortcode or a widget.', 'profile-builder' ), '<strong class="nowrap">[wppb-login]</strong>' ); ?></p>
53
- </div>
54
- <div>
55
- <h3><?php _e( 'Registration Form', 'profile-builder' ); ?></h3>
56
- <p><?php printf( __( 'Beautiful registration forms fully customizable using the %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-register]</strong>' ); ?></p>
57
- </div>
58
- <div>
59
- <h3><?php _e( 'Edit Profile Form', 'profile-builder' ); ?></h3>
60
- <p><?php printf( __( 'Straight forward edit profile forms using %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-edit-profile]</strong>' ); ?></p>
61
- </div>
62
- </div>
63
- <?php ob_start(); ?>
64
- <hr/>
65
- <div>
66
- <h3><?php _e( 'Extra Features', 'profile-builder' );?></h3>
67
- <p><?php _e( 'Features that give you more control over your users, increased security and help you fight user registration spam.', 'profile-builder' ); ?></p>
68
- <p><a href="admin.php?page=profile-builder-general-settings" class="button"><?php _e( 'Enable extra features', 'profile-builder' ); ?></a></p>
69
- </div>
70
- <div class="wppb-row wppb-3-col">
71
- <div>
72
- <h3><?php _e( 'Recover Password', 'profile-builder' ); ?></h3>
73
- <p><?php printf( __( 'Allow users to recover their password in the front-end using the %s.', 'profile-builder' ), '<strong class="nowrap">[wppb-recover-password]</strong>' ); ?></p>
74
- </div>
75
- <div>
76
- <h3><?php _e( 'Admin Approval (*)', 'profile-builder' ); ?></h3>
77
- <p><?php _e( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI.', 'profile-builder' ); ?></p>
78
- </div>
79
- <div>
80
- <h3><?php _e( 'Email Confirmation', 'profile-builder' ); ?></h3>
81
- <p><?php _e( 'Make sure users sign up with genuine emails. On registration users will receive a notification to confirm their email address.', 'profile-builder' ); ?></p>
82
- </div>
83
- <div>
84
- <h3><?php _e( 'Content Restriction', 'profile-builder' ); ?></h3>
85
- <p><?php _e( 'Restrict users from accessing certain pages, posts or custom post types based on user role or logged-in status.', 'profile-builder' ); ?></p>
86
- </div>
87
- <div>
88
- <h3><?php _e( 'Minimum Password Length and Strength Meter', 'profile-builder' ); ?></h3>
89
- <p><?php _e( 'Eliminate weak passwords altogether by setting a minimum password length and enforcing a certain password strength.', 'profile-builder' ); ?></p>
90
- </div>
91
- <div>
92
- <h3><?php _e( 'Login with Email or Username', 'profile-builder' ); ?></h3>
93
- <p><?php _e( 'Allow users to log in with their email or username when accessing your site.', 'profile-builder' ); ?></p>
94
- </div>
95
- <div style="clear:left;">
96
- <h3><?php _e( 'Roles Editor', 'profile-builder' ); ?></h3>
97
- <p><?php _e( 'Add, remove, clone and edit roles and also capabilities for these roles.', 'profile-builder' ); ?></p>
98
- </div>
99
- </div>
100
-
101
- <?php
102
- // Output here the Extra Features html for the Free version
103
- $extra_features_html = ob_get_contents();
104
- ob_end_clean();
105
- if ( $version == 'Free' ) echo $extra_features_html; ?>
106
-
107
- <hr/>
108
- <div class="wppb-row wppb-2-col">
109
- <div>
110
- <h3><?php _e( 'Customize Your Forms The Way You Want (*)', 'profile-builder' ); ?></h3>
111
- <p><?php _e( 'With Extra Profile Fields you can create the exact registration form your project needs.', 'profile-builder' ); ?></p>
112
- <?php if ($version == 'Free'){ ?>
113
- <p><a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extrafields&utm_campaign=PBFree" class="wppb-button-free"><?php _e( 'Extra Profile Fields are available in Hobbyist or PRO versions', 'profile-builder' ); ?></a></p>
114
- <?php } else {?>
115
- <p><a href="admin.php?page=manage-fields" class="button"><?php _e( 'Get started with extra fields', 'profile-builder' ); ?></a></p>
116
- <?php } ?>
117
- <ul style="float: left; margin-right: 50px;">
118
- <li><?php _e( 'Avatar Upload', 'profile-builder' ); ?></li>
119
- <li><?php _e( 'Generic Uploads', 'profile-builder' ); ?></li>
120
- <li><?php _e( 'Agree To Terms Checkbox', 'profile-builder' ); ?></li>
121
- <li><?php _e( 'Datepicker', 'profile-builder' ); ?> </li>
122
- <li><?php _e( 'Timepicker', 'profile-builder' ); ?> </li>
123
- <li><?php _e( 'Colorpicker', 'profile-builder' ); ?> </li>
124
- <li><?php _e( 'reCAPTCHA', 'profile-builder' ); ?></li>
125
- <li><?php _e( 'Country Select', 'profile-builder' ); ?></li>
126
- <li><?php _e( 'Currency Select', 'profile-builder' ); ?></li>
127
- <li><?php _e( 'Timezone Select', 'profile-builder' ); ?></li>
128
- </ul>
129
-
130
- <ul style="float: left;">
131
- <li><?php _e( 'Input / Hidden Input', 'profile-builder' ); ?></li>
132
- <li><?php _e( 'Number', 'profile-builder' ); ?></li>
133
- <li><?php _e( 'Checkbox', 'profile-builder' ); ?></li>
134
- <li><?php _e( 'Select', 'profile-builder' ); ?></li>
135
- <li><?php _e( 'Radio Buttons', 'profile-builder' ); ?></li>
136
- <li><?php _e( 'Textarea', 'profile-builder' ); ?></li>
137
- <li><?php _e( 'Validation', 'profile-builder' ); ?></li>
138
- <li><?php _e( 'Map', 'profile-builder' ); ?></li>
139
- <li><?php _e( 'HTML', 'profile-builder' ); ?></li>
140
- </ul>
141
- </div>
142
- <div>
143
- <img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pb_fields.png" alt="Profile Builder Extra Fields" class="wppb-fields-image" />
144
- </div>
145
- </div>
146
- <hr/>
147
- <div>
148
- <h3><?php _e( 'Powerful Modules (**)', 'profile-builder' );?></h3>
149
- <p><?php _e( 'Everything you will need to manage your users is probably already available using the Pro Modules.', 'profile-builder' ); ?></p>
150
- <?php if( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ): ?>
151
- <p><a href="admin.php?page=profile-builder-modules" class="button"><?php _e( 'Enable your modules', 'profile-builder' ); ?></a></p>
152
- <?php endif; ?>
153
- <?php if ($version == 'Free'){ ?>
154
- <p><a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-modules&utm_campaign=PBFree" class="wppb-button-free"><?php _e( 'Find out more about PRO Modules', 'profile-builder' ); ?></a></p>
155
- <?php }?>
156
- </div>
157
- <div class="wppb-row wppb-3-col">
158
- <div>
159
- <h3><?php _e( 'User Listing', 'profile-builder' ); ?></h3>
160
- <?php if ($version == 'Free'): ?>
161
- <p><?php _e( 'Easy to edit templates for listing your website users as well as creating single user pages. Shortcode based, offering many options to customize your listings.', 'profile-builder' ); ?></p>
162
- <?php else : ?>
163
- <p><?php printf( __( 'To create a page containing the users registered to this current site/blog, insert the following shortcode in a page of your chosing: %s.', 'profile-builder' ), '<strong class="nowrap">[wppb-list-users]</strong>' ); ?></p>
164
- <?php endif;?>
165
- </div>
166
- <div>
167
- <h3><?php _e( 'Email Customizer', 'profile-builder' ); ?></h3>
168
- <p><?php _e( 'Personalize all emails sent to your users or admins. On registration, email confirmation, admin approval / un-approval.', 'profile-builder' ); ?></p>
169
- </div>
170
- <div>
171
- <h3><?php _e( 'Custom Redirects', 'profile-builder' ); ?></h3>
172
- <p><?php _e( 'Keep your users out of the WordPress dashboard, redirect them to the front-page after login or registration, everything is just a few clicks away.', 'profile-builder' ); ?></p>
173
- </div>
174
- </div>
175
- <div class="wppb-row wppb-3-col">
176
- <div>
177
- <h3><?php _e( 'Multiple Registration Forms', 'profile-builder' ); ?></h3>
178
- <p><?php _e( 'Set up multiple registration forms with different fields for certain user roles. Capture different information from different types of users.', 'profile-builder' ); ?></p>
179
- </div>
180
- <div>
181
- <h3><?php _e( 'Multiple Edit-profile Forms', 'profile-builder' ); ?></h3>
182
- <p><?php _e( 'Allow different user roles to edit their specific information. Set up multiple edit-profile forms with different fields for certain user roles.', 'profile-builder' ); ?></p>
183
- </div>
184
- <div>
185
- <h3><?php _e( 'Repeater Fields', 'profile-builder' ); ?></h3>
186
- <p><?php _e( 'Set up a repeating group of fields on register and edit profile forms. Limit the number of repeated groups for each user role.', 'profile-builder' ); ?></p>
187
- </div>
188
- </div>
189
-
190
- <?php
191
- //Output here Extra Features html for Hobbyist or Pro versions
192
- if ( $version != 'Free' ) echo $extra_features_html; ?>
193
- <hr/>
194
- <div class="wrap wppb-wrap wppb-1-3-col">
195
- <div>
196
- <a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>"><img src="<?php echo plugins_url( '../assets/images/pb-pms-cross-promotion.png', __FILE__ ); ?>" alt="paid member subscriptions"/></a>
197
- </div>
198
- <div>
199
- <h3>Paid user profiles with Profile Builder and Paid Member Subscriptions</h3>
200
- <p>One of the most requested features in Profile Builder was for users to be able to pay for an account.</p>
201
- <p>Now that's possible using the free WordPress plugin - <a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>">Paid Member Subscriptions</a>.</p>
202
- <p><a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>" class="button">Find out how</a></p>
203
-
204
- </div>
205
- </div>
206
- <div class="wrap wppb-wrap wppb-1-3-col">
207
- <div>
208
- <a href="https://wordpress.org/plugins/translatepress-multilingual/" target="_blank"><img src="<?php echo plugins_url( '../assets/images/pb-trp-cross-promotion.png', __FILE__ ); ?>" alt="TranslatePress Logo"/></a>
209
- </div>
210
- <div>
211
- <h3>Easily translate your entire WordPress website</h3>
212
- <p>Translate your Profile Builder forms with a WordPress translation plugin that anyone can use.</p>
213
- <p>It offers a simpler way to translate WordPress sites, with full support for WooCommerce and site builders.</p>
214
- <p><a href="https://wordpress.org/plugins/translatepress-multilingual/" class="button" target="_blank">Find out how</a></p>
215
-
216
- </div>
217
- </div>
218
- <hr/>
219
- <div>
220
- <h3>Extra Notes</h3>
221
- <ul>
222
- <li><?php printf( __( ' * only available in the %1$sHobbyist and Pro versions%2$s.', 'profile-builder' ) ,'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extranotes&utm_campaign=PB'.$version.'" target="_blank">', '</a>' );?></li>
223
- <li><?php printf( __( '** only available in the %1$sPro version%2$s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extranotes&utm_campaign=PB'.$version.'" target="_blank">', '</a>' );?></li>
224
- </ul>
225
- </div>
226
- </div>
227
- <?php
228
  }
1
+ <?php
2
+ /**
3
+ * Function that creates the "Basic Information" submenu page
4
+ *
5
+ * @since v.2.0
6
+ *
7
+ * @return void
8
+ */
9
+ function wppb_register_basic_info_submenu_page() {
10
+ add_submenu_page( 'profile-builder', __( 'Basic Information', 'profile-builder' ), __( 'Basic Information', 'profile-builder' ), 'manage_options', 'profile-builder-basic-info', 'wppb_basic_info_content' );
11
+ }
12
+ add_action( 'admin_menu', 'wppb_register_basic_info_submenu_page', 2 );
13
+
14
+ /**
15
+ * Function that adds content to the "Basic Information" submenu page
16
+ *
17
+ * @since v.2.0
18
+ *
19
+ * @return string
20
+ */
21
+ function wppb_basic_info_content() {
22
+
23
+ $version = 'Free';
24
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
25
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
26
+
27
+ ?>
28
+ <div class="wrap wppb-wrap wppb-info-wrap">
29
+ <div class="wppb-badge <?php echo $version; ?>"><span><?php printf( __( 'Version %s' ), PROFILE_BUILDER_VERSION ); ?></span></div>
30
+ <h1><?php printf( __( '<strong>Profile Builder </strong> %s', 'profile-builder' ), $version ); ?></h1>
31
+ <p class="wppb-info-text"><?php printf( __( 'The best way to add front-end registration, edit profile and login forms.', 'profile-builder' ) ); ?></p>
32
+ <hr />
33
+ <?php
34
+ $wppb_pages_created = get_option( 'wppb_pages_created' );
35
+ $shortcode_pages_query = new WP_Query( array( 'post_type' => 'page', 's' => '[wppb-' ) );
36
+ if( empty( $wppb_pages_created ) && !$shortcode_pages_query->have_posts() ){
37
+ ?>
38
+ <div class="wppb-auto-form-creation wppb-2-1-col">
39
+ <div><h3><?php _e( 'Speed up the setup process by automatically creating the form pages:', 'profile-builder' ); ?></h3></div>
40
+ <div><a href="<?php echo admin_url('admin.php?page=profile-builder-basic-info&wppb_create_pages=true') ?>" class="button primary button-primary button-hero"><?php _e( 'Create Form Pages', 'profile-builder' ); ?></a></div>
41
+ </div>
42
+ <?php }else{ ?>
43
+ <div class="wppb-auto-form-creation wppb-forms-created wppb-2-1-col">
44
+ <div><h3><?php _e( 'You can see all the pages with Profile Builder form shortcodes here:', 'profile-builder' ); ?></h3></div>
45
+ <div><a href="<?php echo admin_url('edit.php?s=%5Bwppb-&post_status=all&post_type=page&action=-1&m=0&paged=1&action2=-1') ?>" class="button primary button-primary button-hero"><?php _e( 'View Form Pages', 'profile-builder' ); ?></a></div>
46
+ </div>
47
+ <?php } ?>
48
+
49
+ <div class="wppb-row wppb-3-col">
50
+ <div>
51
+ <h3><?php _e( 'Login Form', 'profile-builder' ); ?></h3>
52
+ <p><?php printf( __( 'Friction-less login using %s shortcode or a widget.', 'profile-builder' ), '<strong class="nowrap">[wppb-login]</strong>' ); ?></p>
53
+ </div>
54
+ <div>
55
+ <h3><?php _e( 'Registration Form', 'profile-builder' ); ?></h3>
56
+ <p><?php printf( __( 'Beautiful registration forms fully customizable using the %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-register]</strong>' ); ?></p>
57
+ </div>
58
+ <div>
59
+ <h3><?php _e( 'Edit Profile Form', 'profile-builder' ); ?></h3>
60
+ <p><?php printf( __( 'Straight forward edit profile forms using %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-edit-profile]</strong>' ); ?></p>
61
+ </div>
62
+ </div>
63
+ <?php ob_start(); ?>
64
+ <hr/>
65
+ <div>
66
+ <h3><?php _e( 'Extra Features', 'profile-builder' );?></h3>
67
+ <p><?php _e( 'Features that give you more control over your users, increased security and help you fight user registration spam.', 'profile-builder' ); ?></p>
68
+ <p><a href="admin.php?page=profile-builder-general-settings" class="button"><?php _e( 'Enable extra features', 'profile-builder' ); ?></a></p>
69
+ </div>
70
+ <div class="wppb-row wppb-3-col">
71
+ <div>
72
+ <h3><?php _e( 'Recover Password', 'profile-builder' ); ?></h3>
73
+ <p><?php printf( __( 'Allow users to recover their password in the front-end using the %s.', 'profile-builder' ), '<strong class="nowrap">[wppb-recover-password]</strong>' ); ?></p>
74
+ </div>
75
+ <div>
76
+ <h3><?php _e( 'Admin Approval (*)', 'profile-builder' ); ?></h3>
77
+ <p><?php _e( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI.', 'profile-builder' ); ?></p>
78
+ </div>
79
+ <div>
80
+ <h3><?php _e( 'Email Confirmation', 'profile-builder' ); ?></h3>
81
+ <p><?php _e( 'Make sure users sign up with genuine emails. On registration users will receive a notification to confirm their email address.', 'profile-builder' ); ?></p>
82
+ </div>
83
+ <div>
84
+ <h3><?php _e( 'Content Restriction', 'profile-builder' ); ?></h3>
85
+ <p><?php _e( 'Restrict users from accessing certain pages, posts or custom post types based on user role or logged-in status.', 'profile-builder' ); ?></p>
86
+ </div>
87
+ <div>
88
+ <h3><?php _e( 'Minimum Password Length and Strength Meter', 'profile-builder' ); ?></h3>
89
+ <p><?php _e( 'Eliminate weak passwords altogether by setting a minimum password length and enforcing a certain password strength.', 'profile-builder' ); ?></p>
90
+ </div>
91
+ <div>
92
+ <h3><?php _e( 'Login with Email or Username', 'profile-builder' ); ?></h3>
93
+ <p><?php _e( 'Allow users to log in with their email or username when accessing your site.', 'profile-builder' ); ?></p>
94
+ </div>
95
+ <div style="clear:left;">
96
+ <h3><?php _e( 'Roles Editor', 'profile-builder' ); ?></h3>
97
+ <p><?php _e( 'Add, remove, clone and edit roles and also capabilities for these roles.', 'profile-builder' ); ?></p>
98
+ </div>
99
+ </div>
100
+
101
+ <?php
102
+ // Output here the Extra Features html for the Free version
103
+ $extra_features_html = ob_get_contents();
104
+ ob_end_clean();
105
+ if ( $version == 'Free' ) echo $extra_features_html; ?>
106
+
107
+ <hr/>
108
+ <div class="wppb-row wppb-2-col">
109
+ <div>
110
+ <h3><?php _e( 'Customize Your Forms The Way You Want (*)', 'profile-builder' ); ?></h3>
111
+ <p><?php _e( 'With Extra Profile Fields you can create the exact registration form your project needs.', 'profile-builder' ); ?></p>
112
+ <?php if ($version == 'Free'){ ?>
113
+ <p><a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extrafields&utm_campaign=PBFree" class="wppb-button-free"><?php _e( 'Extra Profile Fields are available in Hobbyist or PRO versions', 'profile-builder' ); ?></a></p>
114
+ <?php } else {?>
115
+ <p><a href="admin.php?page=manage-fields" class="button"><?php _e( 'Get started with extra fields', 'profile-builder' ); ?></a></p>
116
+ <?php } ?>
117
+ <ul style="float: left; margin-right: 50px;">
118
+ <li><?php _e( 'Avatar Upload', 'profile-builder' ); ?></li>
119
+ <li><?php _e( 'Generic Uploads', 'profile-builder' ); ?></li>
120
+ <li><?php _e( 'Agree To Terms Checkbox', 'profile-builder' ); ?></li>
121
+ <li><?php _e( 'Datepicker', 'profile-builder' ); ?> </li>
122
+ <li><?php _e( 'Timepicker', 'profile-builder' ); ?> </li>
123
+ <li><?php _e( 'Colorpicker', 'profile-builder' ); ?> </li>
124
+ <li><?php _e( 'reCAPTCHA', 'profile-builder' ); ?></li>
125
+ <li><?php _e( 'Country Select', 'profile-builder' ); ?></li>
126
+ <li><?php _e( 'Currency Select', 'profile-builder' ); ?></li>
127
+ <li><?php _e( 'Timezone Select', 'profile-builder' ); ?></li>
128
+ </ul>
129
+
130
+ <ul style="float: left;">
131
+ <li><?php _e( 'Input / Hidden Input', 'profile-builder' ); ?></li>
132
+ <li><?php _e( 'Number', 'profile-builder' ); ?></li>
133
+ <li><?php _e( 'Checkbox', 'profile-builder' ); ?></li>
134
+ <li><?php _e( 'Select', 'profile-builder' ); ?></li>
135
+ <li><?php _e( 'Radio Buttons', 'profile-builder' ); ?></li>
136
+ <li><?php _e( 'Textarea', 'profile-builder' ); ?></li>
137
+ <li><?php _e( 'Validation', 'profile-builder' ); ?></li>
138
+ <li><?php _e( 'Map', 'profile-builder' ); ?></li>
139
+ <li><?php _e( 'HTML', 'profile-builder' ); ?></li>
140
+ </ul>
141
+ </div>
142
+ <div>
143
+ <img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pb_fields.png" alt="Profile Builder Extra Fields" class="wppb-fields-image" />
144
+ </div>
145
+ </div>
146
+ <hr/>
147
+ <div>
148
+ <h3><?php _e( 'Powerful Modules (**)', 'profile-builder' );?></h3>
149
+ <p><?php _e( 'Everything you will need to manage your users is probably already available using the Pro Modules.', 'profile-builder' ); ?></p>
150
+ <?php if( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ): ?>
151
+ <p><a href="admin.php?page=profile-builder-modules" class="button"><?php _e( 'Enable your modules', 'profile-builder' ); ?></a></p>
152
+ <?php endif; ?>
153
+ <?php if ($version == 'Free'){ ?>
154
+ <p><a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-modules&utm_campaign=PBFree" class="wppb-button-free"><?php _e( 'Find out more about PRO Modules', 'profile-builder' ); ?></a></p>
155
+ <?php }?>
156
+ </div>
157
+ <div class="wppb-row wppb-3-col">
158
+ <div>
159
+ <h3><?php _e( 'User Listing', 'profile-builder' ); ?></h3>
160
+ <?php if ($version == 'Free'): ?>
161
+ <p><?php _e( 'Easy to edit templates for listing your website users as well as creating single user pages. Shortcode based, offering many options to customize your listings.', 'profile-builder' ); ?></p>
162
+ <?php else : ?>
163
+ <p><?php printf( __( 'To create a page containing the users registered to this current site/blog, insert the following shortcode in a page of your chosing: %s.', 'profile-builder' ), '<strong class="nowrap">[wppb-list-users]</strong>' ); ?></p>
164
+ <?php endif;?>
165
+ </div>
166
+ <div>
167
+ <h3><?php _e( 'Email Customizer', 'profile-builder' ); ?></h3>
168
+ <p><?php _e( 'Personalize all emails sent to your users or admins. On registration, email confirmation, admin approval / un-approval.', 'profile-builder' ); ?></p>
169
+ </div>
170
+ <div>
171
+ <h3><?php _e( 'Custom Redirects', 'profile-builder' ); ?></h3>
172
+ <p><?php _e( 'Keep your users out of the WordPress dashboard, redirect them to the front-page after login or registration, everything is just a few clicks away.', 'profile-builder' ); ?></p>
173
+ </div>
174
+ </div>
175
+ <div class="wppb-row wppb-3-col">
176
+ <div>
177
+ <h3><?php _e( 'Multiple Registration Forms', 'profile-builder' ); ?></h3>
178
+ <p><?php _e( 'Set up multiple registration forms with different fields for certain user roles. Capture different information from different types of users.', 'profile-builder' ); ?></p>
179
+ </div>
180
+ <div>
181
+ <h3><?php _e( 'Multiple Edit-profile Forms', 'profile-builder' ); ?></h3>
182
+ <p><?php _e( 'Allow different user roles to edit their specific information. Set up multiple edit-profile forms with different fields for certain user roles.', 'profile-builder' ); ?></p>
183
+ </div>
184
+ <div>
185
+ <h3><?php _e( 'Repeater Fields', 'profile-builder' ); ?></h3>
186
+ <p><?php _e( 'Set up a repeating group of fields on register and edit profile forms. Limit the number of repeated groups for each user role.', 'profile-builder' ); ?></p>
187
+ </div>
188
+ </div>
189
+
190
+ <?php
191
+ //Output here Extra Features html for Hobbyist or Pro versions
192
+ if ( $version != 'Free' ) echo $extra_features_html; ?>
193
+ <hr/>
194
+ <div class="wrap wppb-wrap wppb-1-3-col">
195
+ <div>
196
+ <a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>"><img src="<?php echo plugins_url( '../assets/images/pb-pms-cross-promotion.png', __FILE__ ); ?>" alt="paid member subscriptions"/></a>
197
+ </div>
198
+ <div>
199
+ <h3>Paid user profiles with Profile Builder and Paid Member Subscriptions</h3>
200
+ <p>One of the most requested features in Profile Builder was for users to be able to pay for an account.</p>
201
+ <p>Now that's possible using the free WordPress plugin - <a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>">Paid Member Subscriptions</a>.</p>
202
+ <p><a href="<?php echo admin_url('options.php?page=profile-builder-pms-promo'); ?>" class="button">Find out how</a></p>
203
+
204
+ </div>
205
+ </div>
206
+ <div class="wrap wppb-wrap wppb-1-3-col">
207
+ <div>
208
+ <a href="https://wordpress.org/plugins/translatepress-multilingual/" target="_blank"><img src="<?php echo plugins_url( '../assets/images/pb-trp-cross-promotion.png', __FILE__ ); ?>" alt="TranslatePress Logo"/></a>
209
+ </div>
210
+ <div>
211
+ <h3>Easily translate your entire WordPress website</h3>
212
+ <p>Translate your Profile Builder forms with a WordPress translation plugin that anyone can use.</p>
213
+ <p>It offers a simpler way to translate WordPress sites, with full support for WooCommerce and site builders.</p>
214
+ <p><a href="https://wordpress.org/plugins/translatepress-multilingual/" class="button" target="_blank">Find out how</a></p>
215
+
216
+ </div>
217
+ </div>
218
+ <hr/>
219
+ <div>
220
+ <h3>Extra Notes</h3>
221
+ <ul>
222
+ <li><?php printf( __( ' * only available in the %1$sHobbyist and Pro versions%2$s.', 'profile-builder' ) ,'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extranotes&utm_campaign=PB'.$version.'" target="_blank">', '</a>' );?></li>
223
+ <li><?php printf( __( '** only available in the %1$sPro version%2$s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=basicinfo-extranotes&utm_campaign=PB'.$version.'" target="_blank">', '</a>' );?></li>
224
+ </ul>
225
+ </div>
226
+ </div>
227
+ <?php
228
  }
admin/feedback.php CHANGED
@@ -1,242 +1,242 @@
1
- <?php
2
- global $gf_feedback_custom_poll_id;
3
- global $gf_feedback_custom_poll_action_link;
4
- $gf_feedback_custom_poll_id = '14';
5
- $gf_feedback_custom_poll_action_link = 'https://www.cozmoslabs.com/profile-builder-poll/';
6
-
7
- /* add the modal on the plugin screen and embed a polldaddy form in it */
8
- add_action( 'admin_footer', 'wppb_add_feedback_modal' );
9
- function wppb_add_feedback_modal(){
10
- global $current_screen;
11
- global $gf_feedback_custom_poll_id;
12
- global $gf_feedback_custom_poll_action_link;
13
-
14
- $gf_id = $gf_feedback_custom_poll_id;
15
- $action_link = $gf_feedback_custom_poll_action_link;
16
-
17
- if( $current_screen->base == 'plugins' ){
18
- ?>
19
- <div id="custom-feedback-modal">
20
-
21
- <div class="custom-feedback-poll-content">
22
-
23
- <h1 style="padding-left:10px;padding-top:15px;"><?php _e('Quick Feedback', 'profile-builder'); ?></h1>
24
- <p><?php _e( 'Because we care about our clients, please leave us feedback on why you are no longer using our plugin.', 'profile-builder'); ?></p>
25
- <form method="post" enctype="multipart/form-data" id="gform_<?php echo $gf_id; ?>" class="gpoll_enabled gpoll" action="<?php echo $action_link; ?>">
26
- <div>
27
- <ul>
28
- <li>
29
- <input name="input_1" type="radio" value="gpoll1d7fc0436" id="choice_<?php echo $gf_id; ?>_1_0">
30
- <label for="choice_<?php echo $gf_id; ?>_1_0" id="label_<?php echo $gf_id; ?>_1_0"><?php _e( 'Lacking certain features', 'profile-builder'); ?></label>
31
- <input class="poll_custom_hidden_detail" name="input_2" id="input_<?php echo $gf_id; ?>_2" type="text" value="" placeholder="<?php _e( 'What feature would you like to see?', 'profile-builder' ); ?>">
32
- </li>
33
- <li>
34
- <input name="input_1" type="radio" value="gpoll19c993bd1" id="choice_<?php echo $gf_id; ?>_1_1">
35
- <label for="choice_<?php echo $gf_id; ?>_1_1" id="label_<?php echo $gf_id; ?>_1_1"><?php _e( 'Hard to use', 'profile-builder'); ?></label>
36
- <input class="poll_custom_hidden_detail" name="input_3" id="input_<?php echo $gf_id; ?>_3" type="text" value="" placeholder="<?php _e( 'How can we improve our user experience ?', 'profile-builder' ); ?>">
37
- </li>
38
- <li>
39
- <input name="input_1" type="radio" value="gpoll147502d8a" id="choice_<?php echo $gf_id; ?>_1_2">
40
- <label for="choice_<?php echo $gf_id; ?>_1_2" id="label_<?php echo $gf_id; ?>_1_2"><?php _e( 'Unsatisfactory support', 'profile-builder' ); ?></label>
41
- <span class="poll_custom_hidden_detail"><?php _e( "Give us another try! Open a support ticket <a href='https://www.cozmoslabs.com/support/open-ticket/' target='_blank'>here</a>" ) ?></span>
42
- </li>
43
- <li>
44
- <input name="input_1" type="radio" value="gpoll1353bb209" id="choice_<?php echo $gf_id; ?>_1_4">
45
- <label for="choice_<?php echo $gf_id; ?>_1_4" id="label_<?php echo $gf_id; ?>_1_4"><?php _e( 'Other', 'profile-builder'); ?></label>
46
- <input class="poll_custom_hidden_detail" name="input_4" id="input_<?php echo $gf_id; ?>_4" type="text" value="" placeholder="<?php _e( 'Please tell us more', 'profile-builder' ); ?>">
47
- </li>
48
- <li>
49
- <input name="input_1" type="radio" value="gpoll18cbe0189" id="choice_<?php echo $gf_id; ?>_1_3">
50
- <label for="choice_<?php echo $gf_id; ?>_1_3" id="label_<?php echo $gf_id; ?>_1_3"><?php _e( 'Poor Documentation', 'profile-builder'); ?></label>
51
- <input class="poll_custom_hidden_detail" name="input_5" id="input_<?php echo $gf_id; ?>_5" type="text" value="" placeholder="<?php _e( "Tell us what you couldn't find", 'profile-builder' ); ?>">
52
- </li>
53
- </ul>
54
- </div>
55
- <div class="gform_footer">
56
- <input type="submit" id="gform_submit_button_<?php echo $gf_id; ?>" class="button button-primary" value="<?php _e( 'Submit & Deactivate', 'profile-builder' ); ?>" disabled="disabled">
57
- <input type="hidden" class="gform_hidden" name="is_submit_<?php echo $gf_id; ?>" value="1">
58
- <input type="hidden" class="gform_hidden" name="gform_submit" value="<?php echo $gf_id; ?>">
59
- <a href="#" class="button secondary custom-feedback-skip"><?php _e('Skip and Deactivate', 'profile-builder'); ?></a>
60
- </div>
61
- </form>
62
-
63
-
64
- </div>
65
-
66
- </div>
67
- <?php
68
- }
69
- }
70
-
71
- /* add the scripts for the modal on the plugin screen */
72
- add_action( 'admin_footer', 'wppb_add_feedback_script' );
73
- function wppb_add_feedback_script(){
74
- global $current_screen;
75
- global $gf_feedback_custom_poll_id;
76
- global $gf_feedback_custom_poll_action_link;
77
- $action_link = $gf_feedback_custom_poll_action_link;
78
-
79
- $gf_id = $gf_feedback_custom_poll_id;
80
-
81
- if( $current_screen->base == 'plugins' ) {
82
- ?>
83
- <script>
84
- jQuery(function () {
85
- pluginSlug = 'profile-builder';// define the plugin slug here
86
-
87
- if (jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').length != 0) {
88
-
89
- /* the conditional fields */
90
- jQuery("#gform_<?php echo $gf_id; ?> input[type='radio']").click(function(){
91
- jQuery("#gform_<?php echo $gf_id; ?> input[type='submit']").prop("disabled", false);
92
- jQuery( '.poll_custom_hidden_detail' ).hide();
93
- jQuery( '.poll_custom_hidden_detail', jQuery(this).parent() ).show();
94
- });
95
-
96
- /* this is the deactivation link */
97
- deactivationLink = jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').attr('href');
98
-
99
- /* show the modal when you click deactivate */
100
- jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').click(function (e){
101
- e . preventDefault();
102
- e . stopPropagation();
103
- tb_show("Profile Builder Quick Feedback", "#TB_inline?width=740&height=500&inlineId=custom-feedback-modal");
104
- jQuery('#TB_ajaxContent').closest('#TB_window').css({ height : "auto", top: "50%", marginTop: "-300px" });
105
- });
106
-
107
- /* on submit */
108
- jQuery("#gform_<?php echo $gf_id; ?>").submit(function(e) {
109
- var url = "<?php echo $action_link; ?>"; // the script where you handle the form input.
110
-
111
- jQuery.ajax({
112
- type: "POST",
113
- url: url,
114
- data: jQuery("#gform_<?php echo $gf_id; ?>").serialize(), // serializes the form's elements.
115
- complete: function()
116
- {
117
- tb_remove();
118
- window.location.href = deactivationLink;
119
- }
120
- });
121
-
122
- e.preventDefault(); // avoid to execute the actual submit of the form.
123
- });
124
-
125
- /* on skip */
126
- jQuery('.custom-feedback-skip').on('click', function(e){
127
- e.preventDefault();
128
- self.parent.tb_remove();
129
- window.location.href = deactivationLink;
130
- });
131
-
132
- }
133
- });
134
- </script>
135
- <?php
136
- }
137
- }
138
-
139
- /* add styling for the modal */
140
- add_action( 'admin_footer', 'wppb_add_feedback_style' );
141
- function wppb_add_feedback_style(){
142
- global $current_screen;
143
- if( $current_screen->base == 'plugins' ) {
144
- ?>
145
- <style type="text/css">
146
- #TB_window .pds-box{
147
- border:0 !important;
148
- }
149
- #TB_window .pds-links{
150
- display:none;
151
- }
152
- #TB_window .pds-question-top{
153
- font-size:13px;
154
- font-weight:normal;
155
- }
156
- #TB_window .pds-answer{
157
- border:0;
158
- }
159
- #TB_window .pds-vote-button span{
160
- display:none;
161
- }
162
- #TB_window .pds-vote-button:after{
163
- content:"<?php _e('Submit and Deactivate', 'profile-builder')?>";
164
- }
165
- #TB_window .pds-vote-button{
166
- padding: 6px 14px;
167
- line-height: normal;
168
- font-size: 14px;
169
- font-weight: normal;
170
- vertical-align: middle;
171
- height: auto;
172
- margin-bottom: 4px;
173
- background: #0085ba;
174
- border-color: #0073aa #006799 #006799;
175
- box-shadow: 0 1px 0 #006799;
176
- color: #fff;
177
- text-decoration: none;
178
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
179
- cursor: pointer;
180
- border-width: 1px;
181
- border-style: solid;
182
- -webkit-appearance: none;
183
- border-radius: 3px;
184
- }
185
-
186
- #custom-feedback-modal{
187
- display: none;
188
- }
189
-
190
- .custom-feedback-poll-content{
191
- font-size:15px;
192
- padding:0 10px;
193
- }
194
-
195
- .custom-feedback-poll-content h1{
196
- padding-left: 0 !important;
197
- margin-left:0;
198
- }
199
-
200
- .custom-feedback-poll-content form ul li > *{
201
- vertical-align: middle;
202
- }
203
-
204
- .custom-feedback-poll-content label{
205
- line-height:27px;
206
- }
207
-
208
- .custom-feedback-poll-content span{
209
- font-size: 13px;
210
- line-height:27px;
211
- }
212
-
213
- .custom-feedback-poll-content input[type='radio']{
214
- margin-top:2px;
215
- }
216
-
217
- .custom-feedback-poll-content p{
218
- margin-bottom:30px;
219
- }
220
-
221
- .custom-feedback-poll-content .gform_footer{
222
- margin-top:25px;
223
- }
224
-
225
- .custom-feedback-poll-content .button-primary{
226
- font-size:15px;
227
- }
228
-
229
- .custom-feedback-skip{
230
- float: right;
231
- }
232
-
233
- .poll_custom_hidden_detail{
234
- display:none;
235
- width:300px;
236
- margin-left:15px;
237
- }
238
-
239
- </style>
240
- <?php
241
- }
242
  }
1
+ <?php
2
+ global $gf_feedback_custom_poll_id;
3
+ global $gf_feedback_custom_poll_action_link;
4
+ $gf_feedback_custom_poll_id = '14';
5
+ $gf_feedback_custom_poll_action_link = 'https://www.cozmoslabs.com/profile-builder-poll/';
6
+
7
+ /* add the modal on the plugin screen and embed a polldaddy form in it */
8
+ add_action( 'admin_footer', 'wppb_add_feedback_modal' );
9
+ function wppb_add_feedback_modal(){
10
+ global $current_screen;
11
+ global $gf_feedback_custom_poll_id;
12
+ global $gf_feedback_custom_poll_action_link;
13
+
14
+ $gf_id = $gf_feedback_custom_poll_id;
15
+ $action_link = $gf_feedback_custom_poll_action_link;
16
+
17
+ if( $current_screen->base == 'plugins' ){
18
+ ?>
19
+ <div id="custom-feedback-modal">
20
+
21
+ <div class="custom-feedback-poll-content">
22
+
23
+ <h1 style="padding-left:10px;padding-top:15px;"><?php _e('Quick Feedback', 'profile-builder'); ?></h1>
24
+ <p><?php _e( 'Because we care about our clients, please leave us feedback on why you are no longer using our plugin.', 'profile-builder'); ?></p>
25
+ <form method="post" enctype="multipart/form-data" id="gform_<?php echo $gf_id; ?>" class="gpoll_enabled gpoll" action="<?php echo $action_link; ?>">
26
+ <div>
27
+ <ul>
28
+ <li>
29
+ <input name="input_1" type="radio" value="gpoll1d7fc0436" id="choice_<?php echo $gf_id; ?>_1_0">
30
+ <label for="choice_<?php echo $gf_id; ?>_1_0" id="label_<?php echo $gf_id; ?>_1_0"><?php _e( 'Lacking certain features', 'profile-builder'); ?></label>
31
+ <input class="poll_custom_hidden_detail" name="input_2" id="input_<?php echo $gf_id; ?>_2" type="text" value="" placeholder="<?php _e( 'What feature would you like to see?', 'profile-builder' ); ?>">
32
+ </li>
33
+ <li>
34
+ <input name="input_1" type="radio" value="gpoll19c993bd1" id="choice_<?php echo $gf_id; ?>_1_1">
35
+ <label for="choice_<?php echo $gf_id; ?>_1_1" id="label_<?php echo $gf_id; ?>_1_1"><?php _e( 'Hard to use', 'profile-builder'); ?></label>
36
+ <input class="poll_custom_hidden_detail" name="input_3" id="input_<?php echo $gf_id; ?>_3" type="text" value="" placeholder="<?php _e( 'How can we improve our user experience ?', 'profile-builder' ); ?>">
37
+ </li>
38
+ <li>
39
+ <input name="input_1" type="radio" value="gpoll147502d8a" id="choice_<?php echo $gf_id; ?>_1_2">
40
+ <label for="choice_<?php echo $gf_id; ?>_1_2" id="label_<?php echo $gf_id; ?>_1_2"><?php _e( 'Unsatisfactory support', 'profile-builder' ); ?></label>
41
+ <span class="poll_custom_hidden_detail"><?php _e( "Give us another try! Open a support ticket <a href='https://www.cozmoslabs.com/support/open-ticket/' target='_blank'>here</a>" ) ?></span>
42
+ </li>
43
+ <li>
44
+ <input name="input_1" type="radio" value="gpoll1353bb209" id="choice_<?php echo $gf_id; ?>_1_4">
45
+ <label for="choice_<?php echo $gf_id; ?>_1_4" id="label_<?php echo $gf_id; ?>_1_4"><?php _e( 'Other', 'profile-builder'); ?></label>
46
+ <input class="poll_custom_hidden_detail" name="input_4" id="input_<?php echo $gf_id; ?>_4" type="text" value="" placeholder="<?php _e( 'Please tell us more', 'profile-builder' ); ?>">
47
+ </li>
48
+ <li>
49
+ <input name="input_1" type="radio" value="gpoll18cbe0189" id="choice_<?php echo $gf_id; ?>_1_3">
50
+ <label for="choice_<?php echo $gf_id; ?>_1_3" id="label_<?php echo $gf_id; ?>_1_3"><?php _e( 'Poor Documentation', 'profile-builder'); ?></label>
51
+ <input class="poll_custom_hidden_detail" name="input_5" id="input_<?php echo $gf_id; ?>_5" type="text" value="" placeholder="<?php _e( "Tell us what you couldn't find", 'profile-builder' ); ?>">
52
+ </li>
53
+ </ul>
54
+ </div>
55
+ <div class="gform_footer">
56
+ <input type="submit" id="gform_submit_button_<?php echo $gf_id; ?>" class="button button-primary" value="<?php _e( 'Submit & Deactivate', 'profile-builder' ); ?>" disabled="disabled">
57
+ <input type="hidden" class="gform_hidden" name="is_submit_<?php echo $gf_id; ?>" value="1">
58
+ <input type="hidden" class="gform_hidden" name="gform_submit" value="<?php echo $gf_id; ?>">
59
+ <a href="#" class="button secondary custom-feedback-skip"><?php _e('Skip and Deactivate', 'profile-builder'); ?></a>
60
+ </div>
61
+ </form>
62
+
63
+
64
+ </div>
65
+
66
+ </div>
67
+ <?php
68
+ }
69
+ }
70
+
71
+ /* add the scripts for the modal on the plugin screen */
72
+ add_action( 'admin_footer', 'wppb_add_feedback_script' );
73
+ function wppb_add_feedback_script(){
74
+ global $current_screen;
75
+ global $gf_feedback_custom_poll_id;
76
+ global $gf_feedback_custom_poll_action_link;
77
+ $action_link = $gf_feedback_custom_poll_action_link;
78
+
79
+ $gf_id = $gf_feedback_custom_poll_id;
80
+
81
+ if( $current_screen->base == 'plugins' ) {
82
+ ?>
83
+ <script>
84
+ jQuery(function () {
85
+ pluginSlug = 'profile-builder';// define the plugin slug here
86
+
87
+ if (jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').length != 0) {
88
+
89
+ /* the conditional fields */
90
+ jQuery("#gform_<?php echo $gf_id; ?> input[type='radio']").click(function(){
91
+ jQuery("#gform_<?php echo $gf_id; ?> input[type='submit']").prop("disabled", false);
92
+ jQuery( '.poll_custom_hidden_detail' ).hide();
93
+ jQuery( '.poll_custom_hidden_detail', jQuery(this).parent() ).show();
94
+ });
95
+
96
+ /* this is the deactivation link */
97
+ deactivationLink = jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').attr('href');
98
+
99
+ /* show the modal when you click deactivate */
100
+ jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').click(function (e){
101
+ e . preventDefault();
102
+ e . stopPropagation();
103
+ tb_show("Profile Builder Quick Feedback", "#TB_inline?width=740&height=500&inlineId=custom-feedback-modal");
104
+ jQuery('#TB_ajaxContent').closest('#TB_window').css({ height : "auto", top: "50%", marginTop: "-300px" });
105
+ });
106
+
107
+ /* on submit */
108
+ jQuery("#gform_<?php echo $gf_id; ?>").submit(function(e) {
109
+ var url = "<?php echo $action_link; ?>"; // the script where you handle the form input.
110
+
111
+ jQuery.ajax({
112
+ type: "POST",
113
+ url: url,
114
+ data: jQuery("#gform_<?php echo $gf_id; ?>").serialize(), // serializes the form's elements.
115
+ complete: function()
116
+ {
117
+ tb_remove();
118
+ window.location.href = deactivationLink;
119
+ }
120
+ });
121
+
122
+ e.preventDefault(); // avoid to execute the actual submit of the form.
123
+ });
124
+
125
+ /* on skip */
126
+ jQuery('.custom-feedback-skip').on('click', function(e){
127
+ e.preventDefault();
128
+ self.parent.tb_remove();
129
+ window.location.href = deactivationLink;
130
+ });
131
+
132
+ }
133
+ });
134
+ </script>
135
+ <?php
136
+ }
137
+ }
138
+
139
+ /* add styling for the modal */
140
+ add_action( 'admin_footer', 'wppb_add_feedback_style' );
141
+ function wppb_add_feedback_style(){
142
+ global $current_screen;
143
+ if( $current_screen->base == 'plugins' ) {
144
+ ?>
145
+ <style type="text/css">
146
+ #TB_window .pds-box{
147
+ border:0 !important;
148
+ }
149
+ #TB_window .pds-links{
150
+ display:none;
151
+ }
152
+ #TB_window .pds-question-top{
153
+ font-size:13px;
154
+ font-weight:normal;
155
+ }
156
+ #TB_window .pds-answer{
157
+ border:0;
158
+ }
159
+ #TB_window .pds-vote-button span{
160
+ display:none;
161
+ }
162
+ #TB_window .pds-vote-button:after{
163
+ content:"<?php _e('Submit and Deactivate', 'profile-builder')?>";
164
+ }
165
+ #TB_window .pds-vote-button{
166
+ padding: 6px 14px;
167
+ line-height: normal;
168
+ font-size: 14px;
169
+ font-weight: normal;
170
+ vertical-align: middle;
171
+ height: auto;
172
+ margin-bottom: 4px;
173
+ background: #0085ba;
174
+ border-color: #0073aa #006799 #006799;
175
+ box-shadow: 0 1px 0 #006799;
176
+ color: #fff;
177
+ text-decoration: none;
178
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
179
+ cursor: pointer;
180
+ border-width: 1px;
181
+ border-style: solid;
182
+ -webkit-appearance: none;
183
+ border-radius: 3px;
184
+ }
185
+
186
+ #custom-feedback-modal{
187
+ display: none;
188
+ }
189
+
190
+ .custom-feedback-poll-content{
191
+ font-size:15px;
192
+ padding:0 10px;
193
+ }
194
+
195
+ .custom-feedback-poll-content h1{
196
+ padding-left: 0 !important;
197
+ margin-left:0;
198
+ }
199
+
200
+ .custom-feedback-poll-content form ul li > *{
201
+ vertical-align: middle;
202
+ }
203
+
204
+ .custom-feedback-poll-content label{
205
+ line-height:27px;
206
+ }
207
+
208
+ .custom-feedback-poll-content span{
209
+ font-size: 13px;
210
+ line-height:27px;
211
+ }
212
+
213
+ .custom-feedback-poll-content input[type='radio']{
214
+ margin-top:2px;
215
+ }
216
+
217
+ .custom-feedback-poll-content p{
218
+ margin-bottom:30px;
219
+ }
220
+
221
+ .custom-feedback-poll-content .gform_footer{
222
+ margin-top:25px;
223
+ }
224
+
225
+ .custom-feedback-poll-content .button-primary{
226
+ font-size:15px;
227
+ }
228
+
229
+ .custom-feedback-skip{
230
+ float: right;
231
+ }
232
+
233
+ .poll_custom_hidden_detail{
234
+ display:none;
235
+ width:300px;
236
+ margin-left:15px;
237
+ }
238
+
239
+ </style>
240
+ <?php
241
+ }
242
  }
admin/general-settings.php CHANGED
@@ -1,361 +1,361 @@
1
- <?php
2
- /**
3
- * Function that returns an array with the settings tabs(pages) and subtabs(subpages)
4
- * @return array with the tabs
5
- */
6
- function wppb_get_settings_pages(){
7
- $settings_pages['pages'] = array(
8
- 'profile-builder-general-settings' => __( 'General Settings', 'profile-builder' ),
9
- 'profile-builder-admin-bar-settings' => __( 'Admin Bar', 'profile-builder' ),
10
- 'profile-builder-content_restriction' => __( 'Content Restriction', 'profile-builder' ),
11
- 'profile-builder-private-website' => __( 'Private Website', 'profile-builder' ),
12
- );
13
-
14
- if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
15
- $wppb_module_settings = get_option('wppb_module_settings');
16
- if( ( isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) || ( isset($wppb_module_settings['wppb_emailCustomizer']) && $wppb_module_settings['wppb_emailCustomizer'] == 'show') ){
17
- $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' );
18
- //add subpages here for email customizer
19
- $settings_pages['subpages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' );
20
- $settings_pages['subpages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' );
21
- }
22
- }
23
-
24
- return $settings_pages;
25
- }
26
-
27
- /**
28
- * Function that generates the html for the tabs and subtabs on the settings page
29
- */
30
- function wppb_generate_settings_tabs(){
31
- ?>
32
- <h3 class="nav-tab-wrapper">
33
- <?php
34
- $pages = wppb_get_settings_pages();
35
-
36
- $active_tab = sanitize_text_field($_GET['page']);
37
- //if we are on a subpage we need to change the active tab to the parent
38
- if( !empty( $pages['subpages'] ) ) {
39
- foreach ($pages['subpages'] as $parent_slug => $subpages) {
40
- if (array_key_exists($active_tab, $subpages)) {
41
- $active_tab = $parent_slug;
42
- }
43
- }
44
- }
45
-
46
- foreach( $pages['pages'] as $page_slug => $tab_name ){
47
- echo '<a href="' . admin_url( add_query_arg( array( 'page' => $page_slug ), 'admin.php' ) ) . '" class="nav-tab ' . ( $active_tab == $page_slug ? 'nav-tab-active' : '' ) . '">'. $tab_name .'</a>';
48
- }
49
- ?>
50
- </h3>
51
- <?php
52
- if( !empty( $pages['subpages'] ) ) {
53
- $active_subpage = sanitize_text_field($_GET['page']);
54
- echo '<ul class="wppb-subtabs subsubsub">';
55
- foreach ($pages['subpages'] as $parent_slug => $subpages) {
56
- if (array_key_exists($_GET['page'], $subpages)) {
57
- foreach ($subpages as $subpage_slug => $subpage_name) {
58
- echo '<li><a href="' . admin_url(add_query_arg(array('page' => $subpage_slug), 'admin.php')) . '" class="nav-sub-tab ' . ($active_subpage == $subpage_slug ? 'current' : '') . '">' . $subpage_name . '</a></li>';
59
- }
60
- }
61
- }
62
- echo '</ul>';
63
- }
64
-
65
-
66
- }
67
-
68
- /**
69
- * Function that creates the "General Settings" submenu page
70
- *
71
- * @since v.2.0
72
- *
73
- * @return void
74
- */
75
- function wppb_register_general_settings_submenu_page() {
76
- add_submenu_page( 'profile-builder', __( 'Settings', 'profile-builder' ), __( 'Settings', 'profile-builder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' );
77
- }
78
- add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
79
-
80
-
81
- function wppb_generate_default_settings_defaults(){
82
- add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no' ) );
83
- }
84
-
85
-
86
- /**
87
- * Function that adds content to the "General Settings" submenu page
88
- *
89
- * @since v.2.0
90
- *
91
- * @return string
92
- */
93
- function wppb_general_settings_content() {
94
- wppb_generate_default_settings_defaults();
95
- ?>
96
- <div class="wrap wppb-wrap">
97
- <h2><?php _e( 'Profile Builder Settings', 'profile-builder' ); ?></h2>
98
-
99
- <?php settings_errors(); ?>
100
-
101
- <?php wppb_generate_settings_tabs() ?>
102
-
103
- <form method="post" action="options.php#general-settings">
104
- <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
105
- <?php settings_fields( 'wppb_general_settings' ); ?>
106
-
107
- <table class="form-table">
108
- <tr>
109
- <th scope="row">
110
- <?php _e( "Load Profile Builder's own CSS file in the front-end:", "profile-builder" ); ?>
111
- </th>
112
- <td>
113
- <label><input type="checkbox" name="wppb_general_settings[extraFieldsLayout]"<?php echo ( ( isset( $wppb_generalSettings['extraFieldsLayout'] ) && ( $wppb_generalSettings['extraFieldsLayout'] == 'default' ) ) ? ' checked' : '' ); ?> value="default" class="wppb-select"><?php _e( 'Yes', 'profile-builder' ); ?></label>
114
- <ul>
115
- <li class="description"><?php printf( __( 'You can find the default file here: %1$s', 'profile-builder' ), '<a href="'.dirname( plugin_dir_url( __FILE__ ) ).'/assets/css/style-front-end.css" target="_blank">'.dirname( dirname( plugin_basename( __FILE__ ) ) ).'\assets\css\style-front-end.css</a>' ); ?></li>
116
- </ul>
117
- </td>
118
- </tr>
119
-
120
- <tr>
121
- <th scope="row">
122
- <?php _e( '"Email Confirmation" Activated:', 'profile-builder' );?>
123
- </th>
124
- <td>
125
- <select name="wppb_general_settings[emailConfirmation]" class="wppb-select" id="wppb_settings_email_confirmation" onchange="wppb_display_page_select(this.value)">
126
- <option value="yes" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
127
- <option value="no" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
128
- </select>
129
- <ul>
130
- <li class="description"><?php _e( 'This works with front-end forms only. Recommended to redirect WP default registration to a Profile Builder one using "Custom Redirects" module.', 'profile-builder' ); ?></li>
131
- <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) { ?>
132
- <li class="description dynamic1"><?php printf( __( 'You can find a list of unconfirmed email addresses %1$sUsers > All Users > Email Confirmation%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=unconfirmed_emails">', '</a>' )?></li>
133
- <?php } ?>
134
- </ul>
135
- </td>
136
- </tr>
137
-
138
- <tr id="wppb-settings-activation-page">
139
- <th scope="row">
140
- <?php _e( '"Email Confirmation" Landing Page:', 'profile-builder' ); ?>
141
- </th>
142
- <td>
143
- <select name="wppb_general_settings[activationLandingPage]" class="wppb-select">
144
- <option value="" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) ) echo 'selected'; ?>></option>
145
- <optgroup label="<?php _e( 'Existing Pages', 'profile-builder' ); ?>">
146
- <?php
147
- $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
148
-
149
- foreach ( $pages as $key => $value ){
150
- echo '<option value="'.$value->ID.'"';
151
- if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
152
- echo ' selected';
153
-
154
- echo '>' . $value->post_title . '</option>';
155
- }
156
- ?>
157
- </optgroup>
158
- </select>
159
- <p class="description">
160
- <?php _e( 'Specify the page where the users will be directed when confirming the email account. This page can differ from the register page(s) and can be changed at any time. If none selected, a simple confirmation page will be displayed for the user.', 'profile-builder' ); ?>
161
- </p>
162
- </td>
163
- </tr>
164
-
165
-
166
- <?php
167
- if ( file_exists( WPPB_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ){
168
- ?>
169
- <tr>
170
- <th scope="row">
171
- <?php _e( '"Admin Approval" Activated:', 'profile-builder' ); ?>
172
- </th>
173
- <td>
174
- <select id="adminApprovalSelect" name="wppb_general_settings[adminApproval]" class="wppb-select" onchange="wppb_display_page_select_aa(this.value)">
175
- <option value="yes" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
176
- <option value="no" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
177
- </select>
178
- <ul>
179
- <li class="description dynamic2"><?php printf( __( 'You can find a list of users at %1$sUsers > All Users > Admin Approval%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=admin_approval&orderby=registered&order=desc">', '</a>' )?></li>
180
- <ul>
181
- </td>
182
- </tr>
183
-
184
- <tr class="dynamic2">
185
- <th scope="row">
186
- <?php _e( '"Admin Approval" on User Role:', 'profile-builder' ); ?>
187
- </th>
188
- <td>
189
- <div id="wrap">
190
- <?php
191
- $wppb_userRoles = wppb_adminApproval_onUserRole();
192
-
193
- if( ! empty( $wppb_userRoles ) ) {
194
- foreach( $wppb_userRoles as $role => $role_name ) {
195
- echo '<label><input type="checkbox" id="adminApprovalOnUserRoleCheckbox" name="wppb_general_settings[adminApprovalOnUserRole][]" class="wppb-checkboxes" value="' . esc_attr( $role ) . '"';
196
- if( ! empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) && in_array( $role, $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
197
- if( empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
198
- echo '>';
199
- echo $role_name . '</label><br>';
200
- }
201
- }
202
- ?>
203
- </div>
204
- <ul>
205
- <li class="description"><?php printf( __( 'Select on what user roles to activate Admin Approval.', 'profile-builder' ) ) ?></li>
206
- <ul>
207
- </td>
208
- </tr>
209
-
210
- <?php } ?>
211
-
212
- <?php
213
- if( file_exists( WPPB_PLUGIN_DIR.'/features/roles-editor/roles-editor.php' ) ) {
214
- ?>
215
- <tr>
216
- <th scope="row">
217
- <?php _e( '"Roles Editor" Activated:', 'profile-builder' ); ?>
218
- </th>
219
- <td>
220
- <select id="rolesEditorSelect" name="wppb_general_settings[rolesEditor]" class="wppb-select" onchange="wppb_display_page_select_re(this.value)">
221
- <option value="no" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
222
- <option value="yes" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
223
- </select>
224
- <ul>
225
- <li class="description dynamic3"><?php printf( __( 'You can add / edit user roles at %1$sUsers > Roles Editor%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/edit.php?post_type=wppb-roles-editor">', '</a>' )?></li>
226
- <ul>
227
- </td>
228
- </tr>
229
- <?php } ?>
230
-
231
- <?php
232
- if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
233
- ?>
234
- <tr>
235
- <th scope="row">
236
- <?php _e( '"Admin Approval" Feature:', 'profile-builder' ); ?>
237
- </th>
238
- <td>
239
- <p><em> <?php printf( __( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI. Enable Admin Approval by upgrading to %1$sHobbyist or PRO versions%2$s.', 'profile-builder' ),'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p>
240
- </td>
241
- </tr>
242
- <?php } ?>
243
-
244
- <tr>
245
- <th scope="row">
246
- <?php _e( 'Allow Users to Log in With:', 'profile-builder' ); ?>
247
- </th>
248
- <td>
249
- <select name="wppb_general_settings[loginWith]" class="wppb-select">
250
- <option value="usernameemail" <?php if ( $wppb_generalSettings['loginWith'] == 'usernameemail' ) echo 'selected'; ?>><?php _e( 'Username and Email', 'profile-builder' ); ?></option>
251
- <option value="username" <?php if ( $wppb_generalSettings['loginWith'] == 'username' ) echo 'selected'; ?>><?php _e( 'Username', 'profile-builder' ); ?></option>
252
- <option value="email" <?php if ( $wppb_generalSettings['loginWith'] == 'email' ) echo 'selected'; ?>><?php _e( 'Email', 'profile-builder' ); ?></option>
253
- </select>
254
- <ul>
255
- <li class="description"><?php _e( '"Username and Email" - users can Log In with both Username and Email.', 'profile-builder' ); ?></li>
256
- <li class="description"><?php _e( '"Username" - users can Log In only with Username.', 'profile-builder' ); ?></li>
257
- <li class="description"><?php _e( '"Email" - users can Log In only with Email.', 'profile-builder' ); ?></li>
258
- </ul>
259
- </td>
260
- </tr>
261
-
262
- <tr>
263
- <th scope="row">
264
- <?php _e( 'Minimum Password Length:', 'profile-builder' ); ?>
265
- </th>
266
- <td>
267
- <input type="text" name="wppb_general_settings[minimum_password_length]" class="wppb-text" value="<?php if( !empty( $wppb_generalSettings['minimum_password_length'] ) ) echo esc_attr( $wppb_generalSettings['minimum_password_length'] ); ?>"/>
268
- <ul>
269
- <li class="description"><?php _e( 'Enter the minimum characters the password should have. Leave empty for no minimum limit', 'profile-builder' ); ?> </li>
270
- </ul>
271
- </td>
272
- </tr>
273
-
274
- <tr>
275
- <th scope="row">
276
- <?php _e( 'Minimum Password Strength:', 'profile-builder' ); ?>
277
- </th>
278
- <td>
279
- <select name="wppb_general_settings[minimum_password_strength]" class="wppb-select">
280
- <option value=""><?php _e( 'Disabled', 'profile-builder' ); ?></option>
281
- <option value="short" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'short' ) echo 'selected'; ?>><?php _e( 'Very weak', 'profile-builder' ); ?></option>
282
- <option value="bad" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'bad' ) echo 'selected'; ?>><?php _e( 'Weak', 'profile-builder' ); ?></option>
283
- <option value="good" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'good' ) echo 'selected'; ?>><?php _e( 'Medium', 'profile-builder' ); ?></option>
284
- <option value="strong" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'strong' ) echo 'selected'; ?>><?php _e( 'Strong', 'profile-builder' ); ?></option>
285
- </select>
286
- </td>
287
- </tr>
288
-
289
- <?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?>
290
- </table>
291
-
292
-
293
-
294
- <input type="hidden" name="action" value="update" />
295
- <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" /></p>
296
- </form>
297
- </div>
298
-
299
- <?php
300
- }
301
-
302
-
303
- /*
304
- * Function that sanitizes the general settings
305
- *
306
- * @param array $wppb_generalSettings
307
- *
308
- * @since v.2.0.7
309
- */
310
- function wppb_general_settings_sanitize( $wppb_generalSettings ) {
311
- $wppb_generalSettings = apply_filters( 'wppb_general_settings_sanitize_extra', $wppb_generalSettings );
312
-
313
- if( !empty( $wppb_generalSettings ) ){
314
- foreach( $wppb_generalSettings as $settings_name => $settings_value ){
315
- if( $settings_name == "minimum_password_length" || $settings_name == "activationLandingPage" )
316
- $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_NUMBER_INT );
317
- elseif( $settings_name == "extraFieldsLayout" || $settings_name == "emailConfirmation" || $settings_name == "adminApproval" || $settings_name == "loginWith" || $settings_name == "minimum_password_strength" )
318
- $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_STRING );
319
- elseif( $settings_name == "adminApprovalOnUserRole" ){
320
- if( is_array( $settings_value ) && !empty( $settings_value ) ){
321
- foreach( $settings_value as $key => $value ){
322
- $wppb_generalSettings[$settings_name][$key] = filter_var( $value, FILTER_SANITIZE_STRING );
323
- }
324
- }
325
- }
326
- }
327
- }
328
-
329
- return $wppb_generalSettings;
330
- }
331
-
332
-
333
- /*
334
- * Function that pushes settings errors to the user
335
- *
336
- * @since v.2.0.7
337
- */
338
- function wppb_general_settings_admin_notices() {
339
- settings_errors( 'wppb_general_settings' );
340
- }
341
- add_action( 'admin_notices', 'wppb_general_settings_admin_notices' );
342
-
343
-
344
- /*
345
- * Function that return user roles
346
- *
347
- * @since v.2.2.0
348
- *
349
- * @return array
350
- */
351
- function wppb_adminApproval_onUserRole() {
352
- global $wp_roles;
353
-
354
- $wp_roles = new WP_Roles();
355
-
356
- $roles = $wp_roles->get_names();
357
-
358
- unset( $roles['administrator'] );
359
-
360
- return $roles;
361
- }
1
+ <?php
2
+ /**
3
+ * Function that returns an array with the settings tabs(pages) and subtabs(subpages)
4
+ * @return array with the tabs
5
+ */
6
+ function wppb_get_settings_pages(){
7
+ $settings_pages['pages'] = array(
8
+ 'profile-builder-general-settings' => __( 'General Settings', 'profile-builder' ),
9
+ 'profile-builder-admin-bar-settings' => __( 'Admin Bar', 'profile-builder' ),
10
+ 'profile-builder-content_restriction' => __( 'Content Restriction', 'profile-builder' ),
11
+ 'profile-builder-private-website' => __( 'Private Website', 'profile-builder' ),
12
+ );
13
+
14
+ if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
15
+ $wppb_module_settings = get_option('wppb_module_settings');
16
+ if( ( isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) || ( isset($wppb_module_settings['wppb_emailCustomizer']) && $wppb_module_settings['wppb_emailCustomizer'] == 'show') ){
17
+ $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' );
18
+ //add subpages here for email customizer
19
+ $settings_pages['subpages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' );
20
+ $settings_pages['subpages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' );
21
+ }
22
+ }
23
+
24
+ return $settings_pages;
25
+ }
26
+
27
+ /**
28
+ * Function that generates the html for the tabs and subtabs on the settings page
29
+ */
30
+ function wppb_generate_settings_tabs(){
31
+ ?>
32
+ <h3 class="nav-tab-wrapper">
33
+ <?php
34
+ $pages = wppb_get_settings_pages();
35
+
36
+ $active_tab = sanitize_text_field($_GET['page']);
37
+ //if we are on a subpage we need to change the active tab to the parent
38
+ if( !empty( $pages['subpages'] ) ) {
39
+ foreach ($pages['subpages'] as $parent_slug => $subpages) {
40
+ if (array_key_exists($active_tab, $subpages)) {
41
+ $active_tab = $parent_slug;
42
+ }
43
+ }
44
+ }
45
+
46
+ foreach( $pages['pages'] as $page_slug => $tab_name ){
47
+ echo '<a href="' . admin_url( add_query_arg( array( 'page' => $page_slug ), 'admin.php' ) ) . '" class="nav-tab ' . ( $active_tab == $page_slug ? 'nav-tab-active' : '' ) . '">'. $tab_name .'</a>';
48
+ }
49
+ ?>
50
+ </h3>
51
+ <?php
52
+ if( !empty( $pages['subpages'] ) ) {
53
+ $active_subpage = sanitize_text_field($_GET['page']);
54
+ echo '<ul class="wppb-subtabs subsubsub">';
55
+ foreach ($pages['subpages'] as $parent_slug => $subpages) {
56
+ if (array_key_exists($_GET['page'], $subpages)) {
57
+ foreach ($subpages as $subpage_slug => $subpage_name) {
58
+ echo '<li><a href="' . admin_url(add_query_arg(array('page' => $subpage_slug), 'admin.php')) . '" class="nav-sub-tab ' . ($active_subpage == $subpage_slug ? 'current' : '') . '">' . $subpage_name . '</a></li>';
59
+ }
60
+ }
61
+ }
62
+ echo '</ul>';
63
+ }
64
+
65
+
66
+ }
67
+
68
+ /**
69
+ * Function that creates the "General Settings" submenu page
70
+ *
71
+ * @since v.2.0
72
+ *
73
+ * @return void
74
+ */
75
+ function wppb_register_general_settings_submenu_page() {
76
+ add_submenu_page( 'profile-builder', __( 'Settings', 'profile-builder' ), __( 'Settings', 'profile-builder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' );
77
+ }
78
+ add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
79
+
80
+
81
+ function wppb_generate_default_settings_defaults(){
82
+ add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no' ) );
83
+ }
84
+
85
+
86
+ /**
87
+ * Function that adds content to the "General Settings" submenu page
88
+ *
89
+ * @since v.2.0
90
+ *
91
+ * @return string
92
+ */
93
+ function wppb_general_settings_content() {
94
+ wppb_generate_default_settings_defaults();
95
+ ?>
96
+ <div class="wrap wppb-wrap">
97
+ <h2><?php _e( 'Profile Builder Settings', 'profile-builder' ); ?></h2>
98
+
99
+ <?php settings_errors(); ?>
100
+
101
+ <?php wppb_generate_settings_tabs() ?>
102
+
103
+ <form method="post" action="options.php#general-settings">
104
+ <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
105
+ <?php settings_fields( 'wppb_general_settings' ); ?>
106
+
107
+ <table class="form-table">
108
+ <tr>
109
+ <th scope="row">
110
+ <?php _e( "Load Profile Builder's own CSS file in the front-end:", "profile-builder" ); ?>
111
+ </th>
112
+ <td>
113
+ <label><input type="checkbox" name="wppb_general_settings[extraFieldsLayout]"<?php echo ( ( isset( $wppb_generalSettings['extraFieldsLayout'] ) && ( $wppb_generalSettings['extraFieldsLayout'] == 'default' ) ) ? ' checked' : '' ); ?> value="default" class="wppb-select"><?php _e( 'Yes', 'profile-builder' ); ?></label>
114
+ <ul>
115
+ <li class="description"><?php printf( __( 'You can find the default file here: %1$s', 'profile-builder' ), '<a href="'.dirname( plugin_dir_url( __FILE__ ) ).'/assets/css/style-front-end.css" target="_blank">'.dirname( dirname( plugin_basename( __FILE__ ) ) ).'\assets\css\style-front-end.css</a>' ); ?></li>
116
+ </ul>
117
+ </td>
118
+ </tr>
119
+
120
+ <tr>
121
+ <th scope="row">
122
+ <?php _e( '"Email Confirmation" Activated:', 'profile-builder' );?>
123
+ </th>
124
+ <td>
125
+ <select name="wppb_general_settings[emailConfirmation]" class="wppb-select" id="wppb_settings_email_confirmation" onchange="wppb_display_page_select(this.value)">
126
+ <option value="yes" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
127
+ <option value="no" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
128
+ </select>
129
+ <ul>
130
+ <li class="description"><?php _e( 'This works with front-end forms only. Recommended to redirect WP default registration to a Profile Builder one using "Custom Redirects" module.', 'profile-builder' ); ?></li>
131
+ <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) { ?>
132
+ <li class="description dynamic1"><?php printf( __( 'You can find a list of unconfirmed email addresses %1$sUsers > All Users > Email Confirmation%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=unconfirmed_emails">', '</a>' )?></li>
133
+ <?php } ?>
134
+ </ul>
135
+ </td>
136
+ </tr>
137
+
138
+ <tr id="wppb-settings-activation-page">
139
+ <th scope="row">
140
+ <?php _e( '"Email Confirmation" Landing Page:', 'profile-builder' ); ?>
141
+ </th>
142
+ <td>
143
+ <select name="wppb_general_settings[activationLandingPage]" class="wppb-select">
144
+ <option value="" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) ) echo 'selected'; ?>></option>
145
+ <optgroup label="<?php _e( 'Existing Pages', 'profile-builder' ); ?>">
146
+ <?php
147
+ $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
148
+
149
+ foreach ( $pages as $key => $value ){
150
+ echo '<option value="'.$value->ID.'"';
151
+ if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
152
+ echo ' selected';
153
+
154
+ echo '>' . $value->post_title . '</option>';
155
+ }
156
+ ?>
157
+ </optgroup>
158
+ </select>
159
+ <p class="description">
160
+ <?php _e( 'Specify the page where the users will be directed when confirming the email account. This page can differ from the register page(s) and can be changed at any time. If none selected, a simple confirmation page will be displayed for the user.', 'profile-builder' ); ?>
161
+ </p>
162
+ </td>
163
+ </tr>
164
+
165
+
166
+ <?php
167
+ if ( file_exists( WPPB_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ){
168
+ ?>
169
+ <tr>
170
+ <th scope="row">
171
+ <?php _e( '"Admin Approval" Activated:', 'profile-builder' ); ?>
172
+ </th>
173
+ <td>
174
+ <select id="adminApprovalSelect" name="wppb_general_settings[adminApproval]" class="wppb-select" onchange="wppb_display_page_select_aa(this.value)">
175
+ <option value="yes" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
176
+ <option value="no" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
177
+ </select>
178
+ <ul>
179
+ <li class="description dynamic2"><?php printf( __( 'You can find a list of users at %1$sUsers > All Users > Admin Approval%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=admin_approval&orderby=registered&order=desc">', '</a>' )?></li>
180
+ <ul>
181
+ </td>
182
+ </tr>
183
+
184
+ <tr class="dynamic2">
185
+ <th scope="row">
186
+ <?php _e( '"Admin Approval" on User Role:', 'profile-builder' ); ?>
187
+ </th>
188
+ <td>
189
+ <div id="wrap">
190
+ <?php
191
+ $wppb_userRoles = wppb_adminApproval_onUserRole();
192
+
193
+ if( ! empty( $wppb_userRoles ) ) {
194
+ foreach( $wppb_userRoles as $role => $role_name ) {
195
+ echo '<label><input type="checkbox" id="adminApprovalOnUserRoleCheckbox" name="wppb_general_settings[adminApprovalOnUserRole][]" class="wppb-checkboxes" value="' . esc_attr( $role ) . '"';
196
+ if( ! empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) && in_array( $role, $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
197
+ if( empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
198
+ echo '>';
199
+ echo $role_name . '</label><br>';
200
+ }
201
+ }
202
+ ?>
203
+ </div>
204
+ <ul>
205
+ <li class="description"><?php printf( __( 'Select on what user roles to activate Admin Approval.', 'profile-builder' ) ) ?></li>
206
+ <ul>
207
+ </td>
208
+ </tr>
209
+
210
+ <?php } ?>
211
+
212
+ <?php
213
+ if( file_exists( WPPB_PLUGIN_DIR.'/features/roles-editor/roles-editor.php' ) ) {
214
+ ?>
215
+ <tr>
216
+ <th scope="row">
217
+ <?php _e( '"Roles Editor" Activated:', 'profile-builder' ); ?>
218
+ </th>
219
+ <td>
220
+ <select id="rolesEditorSelect" name="wppb_general_settings[rolesEditor]" class="wppb-select" onchange="wppb_display_page_select_re(this.value)">
221
+ <option value="no" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
222
+ <option value="yes" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
223
+ </select>
224
+ <ul>
225
+ <li class="description dynamic3"><?php printf( __( 'You can add / edit user roles at %1$sUsers > Roles Editor%2$s.', 'profile-builder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/edit.php?post_type=wppb-roles-editor">', '</a>' )?></li>
226
+ <ul>
227
+ </td>
228
+ </tr>
229
+ <?php } ?>
230
+
231
+ <?php
232
+ if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
233
+ ?>
234
+ <tr>
235
+ <th scope="row">
236
+ <?php _e( '"Admin Approval" Feature:', 'profile-builder' ); ?>
237
+ </th>
238
+ <td>
239
+ <p><em> <?php printf( __( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI. Enable Admin Approval by upgrading to %1$sHobbyist or PRO versions%2$s.', 'profile-builder' ),'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p>
240
+ </td>
241
+ </tr>
242
+ <?php } ?>
243
+
244
+ <tr>
245
+ <th scope="row">
246
+ <?php _e( 'Allow Users to Log in With:', 'profile-builder' ); ?>
247
+ </th>
248
+ <td>
249
+ <select name="wppb_general_settings[loginWith]" class="wppb-select">
250
+ <option value="usernameemail" <?php if ( $wppb_generalSettings['loginWith'] == 'usernameemail' ) echo 'selected'; ?>><?php _e( 'Username and Email', 'profile-builder' ); ?></option>
251
+ <option value="username" <?php if ( $wppb_generalSettings['loginWith'] == 'username' ) echo 'selected'; ?>><?php _e( 'Username', 'profile-builder' ); ?></option>
252
+ <option value="email" <?php if ( $wppb_generalSettings['loginWith'] == 'email' ) echo 'selected'; ?>><?php _e( 'Email', 'profile-builder' ); ?></option>
253
+ </select>
254
+ <ul>
255
+ <li class="description"><?php _e( '"Username and Email" - users can Log In with both Username and Email.', 'profile-builder' ); ?></li>
256
+ <li class="description"><?php _e( '"Username" - users can Log In only with Username.', 'profile-builder' ); ?></li>
257
+ <li class="description"><?php _e( '"Email" - users can Log In only with Email.', 'profile-builder' ); ?></li>
258
+ </ul>
259
+ </td>
260
+ </tr>
261
+
262
+ <tr>
263
+ <th scope="row">
264
+ <?php _e( 'Minimum Password Length:', 'profile-builder' ); ?>
265
+ </th>
266
+ <td>
267
+ <input type="text" name="wppb_general_settings[minimum_password_length]" class="wppb-text" value="<?php if( !empty( $wppb_generalSettings['minimum_password_length'] ) ) echo esc_attr( $wppb_generalSettings['minimum_password_length'] ); ?>"/>
268
+ <ul>
269
+ <li class="description"><?php _e( 'Enter the minimum characters the password should have. Leave empty for no minimum limit', 'profile-builder' ); ?> </li>
270
+ </ul>
271
+ </td>
272
+ </tr>
273
+
274
+ <tr>
275
+ <th scope="row">
276
+ <?php _e( 'Minimum Password Strength:', 'profile-builder' ); ?>
277
+ </th>
278
+ <td>
279
+ <select name="wppb_general_settings[minimum_password_strength]" class="wppb-select">
280
+ <option value=""><?php _e( 'Disabled', 'profile-builder' ); ?></option>
281
+ <option value="short" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'short' ) echo 'selected'; ?>><?php _e( 'Very weak', 'profile-builder' ); ?></option>
282
+ <option value="bad" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'bad' ) echo 'selected'; ?>><?php _e( 'Weak', 'profile-builder' ); ?></option>
283
+ <option value="good" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'good' ) echo 'selected'; ?>><?php _e( 'Medium', 'profile-builder' ); ?></option>
284
+ <option value="strong" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'strong' ) echo 'selected'; ?>><?php _e( 'Strong', 'profile-builder' ); ?></option>
285
+ </select>
286
+ </td>
287
+ </tr>
288
+
289
+ <?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?>
290
+ </table>
291
+
292
+
293
+
294
+ <input type="hidden" name="action" value="update" />
295
+ <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" /></p>
296
+ </form>
297
+ </div>
298
+
299
+ <?php
300
+ }
301
+
302
+
303
+ /*
304
+ * Function that sanitizes the general settings
305
+ *
306
+ * @param array $wppb_generalSettings
307
+ *
308
+ * @since v.2.0.7
309
+ */
310
+ function wppb_general_settings_sanitize( $wppb_generalSettings ) {
311
+ $wppb_generalSettings = apply_filters( 'wppb_general_settings_sanitize_extra', $wppb_generalSettings );
312
+
313
+ if( !empty( $wppb_generalSettings ) ){
314
+ foreach( $wppb_generalSettings as $settings_name => $settings_value ){
315
+ if( $settings_name == "minimum_password_length" || $settings_name == "activationLandingPage" )
316
+ $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_NUMBER_INT );
317
+ elseif( $settings_name == "extraFieldsLayout" || $settings_name == "emailConfirmation" || $settings_name == "adminApproval" || $settings_name == "loginWith" || $settings_name == "minimum_password_strength" )
318
+ $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_STRING );
319
+ elseif( $settings_name == "adminApprovalOnUserRole" ){
320
+ if( is_array( $settings_value ) && !empty( $settings_value ) ){
321
+ foreach( $settings_value as $key => $value ){
322
+ $wppb_generalSettings[$settings_name][$key] = filter_var( $value, FILTER_SANITIZE_STRING );
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ return $wppb_generalSettings;
330
+ }
331
+
332
+
333
+ /*
334
+ * Function that pushes settings errors to the user
335
+ *
336
+ * @since v.2.0.7
337
+ */
338
+ function wppb_general_settings_admin_notices() {
339
+ settings_errors( 'wppb_general_settings' );
340
+ }
341
+ add_action( 'admin_notices', 'wppb_general_settings_admin_notices' );
342
+
343
+
344
+ /*
345
+ * Function that return user roles
346
+ *
347
+ * @since v.2.2.0
348
+ *
349
+ * @return array
350
+ */
351
+ function wppb_adminApproval_onUserRole() {
352
+ global $wp_roles;
353
+
354
+ $wp_roles = new WP_Roles();
355
+
356
+ $roles = $wp_roles->get_names();
357
+
358
+ unset( $roles['administrator'] );
359
+
360
+ return $roles;
361
+ }
admin/manage-fields.php CHANGED
@@ -1,1593 +1,1593 @@
1
- <?php
2
- // Define the default values.
3
- define( 'WPPB_DEFAULTS_MAP_LAT', 48 );
4
- define( 'WPPB_DEFAULTS_MAP_LNG', 12 );
5
- define( 'WPPB_DEFAULTS_MAP_ZOOM', 4 );
6
-
7
- /**
8
- * Function that creates the Manage Fields submenu and populates it with a repeater field form
9
- *
10
- * @since v.2.0
11
- *
12
- * @return void
13
- */
14
- function wppb_manage_fields_submenu(){
15
- // create a new sub_menu page which holds the data for the default + extra fields
16
- $args = array(
17
- 'menu_title' => __('Form Fields', 'profile-builder'),
18
- 'page_title' => __('Manage Form Fields', 'profile-builder'),
19
- 'menu_slug' => 'manage-fields',
20
- 'page_type' => 'submenu_page',
21
- 'capability' => 'manage_options',
22
- 'priority' => 5,
23
- 'parent_slug' => 'profile-builder'
24
- );
25
- $manage_fields_page = new WCK_Page_Creator_PB($args);
26
- }
27
- add_action( 'admin_menu', 'wppb_manage_fields_submenu', 1 );
28
-
29
- function wppb_populate_manage_fields(){
30
-
31
- $manage_field_types = array(
32
- 'optgroups' => array(
33
- 'default' =>
34
- array(
35
- 'label' => __('Default'),
36
- 'options' => array(
37
- 'Default - Name (Heading)',
38
- 'Default - Contact Info (Heading)',
39
- 'Default - About Yourself (Heading)',
40
- 'Default - Username',
41
- 'Default - First Name',
42
- 'Default - Last Name',
43
- 'Default - Nickname',
44
- 'Default - E-mail',
45
- 'Default - Website',
46
- 'Default - Password',
47
- 'Default - Repeat Password',
48
- 'Default - Biographical Info',
49
- 'Default - Display name publicly as',
50
- ),
51
- ),
52
- 'standard' =>
53
- array(
54
- 'label' => __('Standard'),
55
- 'options' => array(),
56
- ),
57
- 'advanced' =>
58
- array(
59
- 'label' => __('Advanced'),
60
- 'options' => array(),
61
- ),
62
- 'other' =>
63
- array(
64
- 'label' => __('Other'),
65
- 'options' => array(
66
- 'GDPR Checkbox', // since 2.8.2
67
- 'GDPR Delete Button', // since 3.0.1
68
- ),
69
- ),
70
- ),
71
- );
72
-
73
- // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
74
- if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
75
- $manage_field_types['optgroups']['default']['options'][] = 'Default - AIM';
76
- $manage_field_types['optgroups']['default']['options'][] = 'Default - Yahoo IM';
77
- $manage_field_types['optgroups']['default']['options'][] = 'Default - Jabber / Google Talk';
78
- }
79
-
80
- if ( wppb_can_users_signup_blog() ) {
81
- $manage_field_types['optgroups']['advanced']['options'][] = 'Default - Blog Details';
82
- }
83
-
84
- if( PROFILE_BUILDER != 'Profile Builder Free' ) {
85
- $manage_field_types['optgroups']['standard']['options'][] = 'Heading';
86
- $manage_field_types['optgroups']['standard']['options'][] = 'Input';
87
- $manage_field_types['optgroups']['standard']['options'][] = 'Number';
88
- $manage_field_types['optgroups']['standard']['options'][] = 'Input (Hidden)';
89
- $manage_field_types['optgroups']['standard']['options'][] = 'Textarea';
90
- $manage_field_types['optgroups']['standard']['options'][] = 'WYSIWYG';
91
- $manage_field_types['optgroups']['standard']['options'][] = 'Select';
92
- $manage_field_types['optgroups']['standard']['options'][] = 'Select (Multiple)';
93
- $manage_field_types['optgroups']['standard']['options'][] = 'Checkbox';
94
- $manage_field_types['optgroups']['standard']['options'][] = 'Radio';
95
- $manage_field_types['optgroups']['standard']['options'][] = 'HTML';
96
- $manage_field_types['optgroups']['standard']['options'][] = 'Upload';
97
- $manage_field_types['optgroups']['standard']['options'][] = 'Avatar';
98
-
99
- $manage_field_types['optgroups']['advanced']['options'][] = 'Phone';
100
- $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Country)';
101
- $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Timezone)';
102
- $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Currency)';
103
- $manage_field_types['optgroups']['advanced']['options'][] = 'Select (CPT)';
104
- $manage_field_types['optgroups']['advanced']['options'][] = 'Checkbox (Terms and Conditions)';
105
- $manage_field_types['optgroups']['advanced']['options'][] = 'Datepicker';
106
- $manage_field_types['optgroups']['advanced']['options'][] = 'Timepicker';
107
- $manage_field_types['optgroups']['advanced']['options'][] = 'Colorpicker';
108
- $manage_field_types['optgroups']['advanced']['options'][] = 'Validation';
109
- $manage_field_types['optgroups']['advanced']['options'][] = 'Map';
110
-
111
- $manage_field_types['optgroups']['other']['options'][] = 'Email';
112
- $manage_field_types['optgroups']['other']['options'][] = 'URL';
113
- }
114
-
115
- /* added recaptcha and user role field since version 2.6.2 */
116
- $manage_field_types['optgroups']['advanced']['options'][] = 'reCAPTCHA';
117
- $manage_field_types['optgroups']['advanced']['options'][] = 'Select (User Role)';
118
-
119
-
120
- $manage_field_types['optgroups']['other']['options'] = apply_filters( 'wppb_manage_fields_types', $manage_field_types['optgroups']['other']['options'] );
121
-
122
- $manage_field_types = apply_filters( 'wppb_all_manage_fields_types', $manage_field_types );
123
-
124
- //Free to Pro call to action on Manage Fields page
125
- $field_description = __('Choose one of the supported field types','profile-builder');
126
- if( PROFILE_BUILDER == 'Profile Builder Free' ) {
127
- $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) );
128
- }
129
-
130
- //user roles
131
- global $wp_roles;
132
-
133
- // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
134
- $user_roles = array();
135
- foreach( $wp_roles->roles as $user_role_slug => $user_role )
136
- if( $user_role_slug !== 'administrator' )
137
- array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug );
138
-
139
-
140
- // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
141
- // country select
142
- $default_country_array = wppb_country_select_options( 'back_end' );
143
- foreach( $default_country_array as $iso_country_code => $country_name ) {
144
- $default_country_options[] = '%'.$country_name.'%'.$iso_country_code;
145
- }
146
-
147
- // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
148
- // currency select
149
- $default_currency_array = wppb_get_currencies( 'back_end' );
150
- array_unshift( $default_currency_array, '' );
151
- foreach( $default_currency_array as $iso_currency_code => $currency_name ) {
152
- $default_currency_options[] = '%'.$currency_name.'%'.$iso_currency_code;
153
- }
154
-
155
- //cpt select
156
- $post_types = get_post_types( array( 'public' => true ), 'names' );
157
-
158
-
159
- if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
160
- $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' );
161
- }
162
- else{
163
- $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this will only affect subsequent entries', 'profile-builder' );
164
- }
165
-
166
- // Initiate the list of available tags for the pin bubble.
167
- if( function_exists( 'wppb_generate_userlisting_merge_tags' ) ) {
168
- $bubble_meta_tags = wppb_generate_userlisting_merge_tags('meta');
169
- $bubble_meta_tags = wp_list_pluck($bubble_meta_tags, 'label', 'name');
170
- }
171
- else
172
- $bubble_meta_tags = array();
173
-
174
- // set up the fields array
175
- $fields = apply_filters( 'wppb_manage_fields', array(
176
-
177
- array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ),
178
- array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profile-builder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => $field_description ),
179
- array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => $meta_key_description ),
180
- array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profile-builder' ), 'default' => wppb_get_unique_id(), 'description' => __( "A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder' ), 'readonly' => true ),
181
- array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profile-builder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder') ),
182
- array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profile-builder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder' ) ),
183
- array( 'type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __( 'Allowed Image Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to: .jpg,.jpeg,.gif,.png (.*)', 'profile-builder' ) ),
184
- array( 'type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __( 'Allowed Upload Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all WordPress allowed file extensions (.*)', 'profile-builder' ) ),
185
- array( 'type' => 'text', 'slug' => 'avatar-size', 'title' => __( 'Avatar Size', 'profile-builder' ), 'default' => 100, 'description' => __( "Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profile-builder' ) ),
186
- array( 'type' => 'text', 'slug' => 'date-format', 'title' => __( 'Date-format', 'profile-builder' ), 'default' => 'mm/dd/yy', 'description' => __( 'Specify the format of the date when using Datepicker<br/>Valid options: mm/dd/yy, mm/yy/dd, dd/yy/mm, dd/mm/yy, yy/dd/mm, yy/mm/dd, mm-dd-yy, yy-mm-dd, D, dd M yy, D, d M y, DD, dd-M-y, D, d M yy, @<br/>If not specified, defaults to mm/dd/yy', 'profile-builder' ) ),
187
- array( 'type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __( 'Terms of Agreement', 'profile-builder' ), 'description' => __( 'Enter a detailed description of the temrs of agreement for the user to read.<br/>Links can be inserted by using standard HTML syntax: &lt;a href="custom_url"&gt;custom_text&lt;/a&gt;', 'profile-builder' ) ),
188
- array( 'type' => 'text', 'slug' => 'options', 'title' => __( 'Options', 'profile-builder' ), 'description' => __( "Enter a comma separated list of values<br/>This can be anything, as it is hidden from the user, but should not contain special characters or apostrophes", 'profile-builder' ) ),
189
- array( 'type' => 'text', 'slug' => 'labels', 'title' => __( 'Labels', 'profile-builder' ), 'description' => __( "Enter a comma separated list of labels<br/>Visible for the user", 'profile-builder' ) ),
190
- array( 'type' => 'select', 'slug' => 'recaptcha-type', 'title' => __( 'reCAPTCHA Type', 'profile-builder' ), 'options' => array('%reCAPTCHA V2%v2', '%Invisible reCAPTCHA%invisible'), 'default' => 'v2', 'description' => __( 'Choose the <a href="https://developers.google.com/recaptcha/docs/versions" target="_blank">type of reCAPTCHA</a> you wish to add to this site.', 'profile-builder' ) ),
191
- array( 'type' => 'text', 'slug' => 'public-key', 'title' => __( 'Site Key', 'profile-builder' ), 'description' => __( 'The site key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ),
192
- array( 'type' => 'text', 'slug' => 'private-key', 'title' => __( 'Secret Key', 'profile-builder' ), 'description' => __( 'The secret key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ),
193
- array( 'type' => 'checkbox', 'slug' => 'captcha-pb-forms', 'title' => __( 'Display on PB forms', 'profile-builder' ), 'options' => array( '%'.__('PB Login','profile-builder').'%'.'pb_login', '%'.__('PB Register','profile-builder').'%'.'pb_register', '%'.__('PB Recover Password','profile-builder').'%'.'pb_recover_password' ), 'default' => 'pb_register', 'description' => __( "Select on which Profile Builder forms to display reCAPTCHA", 'profile-builder' ) ),
194
- array( 'type' => 'checkbox', 'slug' => 'captcha-wp-forms', 'title' => __( 'Display on default WP forms', 'profile-builder' ), 'options' => array( '%'.__('Default WP Login', 'profile-builder').'%'.'default_wp_login', '%'.__('Default WP Register', 'profile-builder').'%'.'default_wp_register', '%'.__('Default WP Recover Password', 'profile-builder').'%'.'default_wp_recover_password'), 'default' => 'default_wp_register', 'description' => __( "Select on which default WP forms to display reCAPTCHA", 'profile-builder' ) ),
195
- array( 'type' => 'checkbox', 'slug' => 'user-roles', 'title' => __( 'User Roles', 'profile-builder' ), 'options' => $user_roles, 'description' => __( "Select which user roles to show to the user ( drag and drop to re-order )", 'profile-builder' ) ),
196
- array( 'type' => 'text', 'slug' => 'user-roles-sort-order', 'title' => __( 'User Roles Order', 'profile-builder' ), 'description' => __( "Save the user role order from the user roles checkboxes", 'profile-builder' ) ),
197
- array( 'type' => 'text', 'slug' => 'default-value', 'title' => __( 'Default Value', 'profile-builder' ), 'description' => __( "Default value of the field", 'profile-builder' ) ),
198
- array( 'type' => 'text', 'slug' => 'default-option', 'title' => __( 'Default Option', 'profile-builder' ), 'description' => __( "Specify the option which should be selected by default", 'profile-builder' ) ),
199
- array( 'type' => 'text', 'slug' => 'default-options', 'title' => __( 'Default Option(s)', 'profile-builder' ), 'description' => __( "Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profile-builder' ) ),
200
- array( 'type' => 'select', 'slug' => 'default-option-country', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => ( isset( $default_country_options ) ) ? $default_country_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ),
201
- array( 'type' => 'select', 'slug' => 'default-option-timezone', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => wppb_timezone_select_options( 'back_end' ), 'description' => __( "Default option of the field", 'profile-builder' ) ),
202
- array( 'type' => 'select', 'slug' => 'default-option-currency', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => ( isset( $default_currency_options ) ) ? $default_currency_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ),
203
- array( 'type' => 'select', 'slug' => 'show-currency-symbol', 'title' => __( 'Show Currency Symbol', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the currency symbol should be displayed after the currency name in the select option.', 'profile-builder' ) ),
204
- array( 'type' => 'select', 'slug' => 'cpt', 'title' => __( 'Show Post Type', 'profile-builder' ), 'options' => $post_types, 'default' => 'post', 'description' => __( 'Posts from what post type will be displayed in the select.', 'profile-builder' ) ),
205
- array( 'type' => 'text', 'slug' => 'validation-possible-values', 'title' => __( 'Allowable Values', 'profile-builder' ), 'description' => __( "Enter a comma separated list of possible values. Upon registration if the value provided by the user does not match one of these values, the user will not be registered.", 'profile-builder' ) ),
206
- array( 'type' => 'text', 'slug' => 'custom-error-message', 'title' => __( 'Error Message', 'profile-builder' ), 'description' => __( "Set a custom error message that will be displayed to the user.", 'profile-builder' ) ),
207
- array( 'type' => 'select', 'slug' => 'time-format', 'title' => __( 'Time Format', 'profile-builder' ), 'options' => array( '%12 Hours%12', '%24 Hours%24' ), 'description' => __( 'Specify the time format.', 'profile-builder' ) ),
208
- array( 'type' => 'text', 'slug' => 'map-api-key', 'title' => __( 'Google Maps API Key', 'profile-builder' ), 'description' => __( 'Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder' ) ),
209
-
210
- array(
211
- 'type' => 'text',
212
- 'slug' => 'map-default-lat',
213
- 'title' => __( 'Default Latitude', 'profile-builder' ),
214
- 'description' => __( 'The latitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
215
- 'default' => WPPB_DEFAULTS_MAP_LAT,
216
- ),
217
- array(
218
- 'type' => 'text',
219
- 'slug' => 'map-default-lng',
220
- 'title' => __( 'Default Longitude', 'profile-builder' ),
221
- 'description' => __( 'The longitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
222
- 'default' => WPPB_DEFAULTS_MAP_LNG,
223
- ),
224
- array(
225
- 'type' => 'text',
226
- 'slug' => 'map-default-zoom',
227
- 'title' => __( 'Default Zoom Level', 'profile-builder' ),
228
- 'description' => __( 'Add a number from 0 to 19. The higher the number the higher the zoom.', 'profile-builder' ),
229
- 'default' => WPPB_DEFAULTS_MAP_ZOOM,
230
- ),
231
-
232
- array( 'type' => 'text', 'slug' => 'map-height', 'title' => __( 'Map Height', 'profile-builder' ), 'description' => __( "The height of the map.", 'profile-builder' ), 'default' => 400 ),
233
- array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ),
234
- array( 'type' => 'textarea', 'slug' => 'html-content', 'title' => __( 'HTML Content', 'profile-builder' ), 'description' => __( "Add your HTML (or text) content", 'profile-builder' ) ),
235
- array( 'type' => 'text', 'slug' => 'phone-format', 'title' => __( 'Phone Format', 'profile-builder' ), 'default' => '(###) ###-####', 'description' => __( "You can use: # for numbers, parentheses ( ), - sign, + sign, dot . and spaces.", 'profile-builder' ) .'<br>'. __( "Eg. (###) ###-####", 'profile-builder' ) .'<br>'. __( "Empty field won't check for correct phone number.", 'profile-builder' ) ),
236
- array( 'type' => 'select', 'slug' => 'heading-tag', 'title' => __( 'Heading Tag', 'profile-builder' ), 'options' => array( '%h1 - biggest size%h1', 'h2', 'h3', 'h4', 'h5', '%h6 - smallest size%h6' ), 'default' => 'h4', 'description' => __( 'Change heading field size on front-end forms', 'profile-builder' ) ),
237
- array( 'type' => 'text', 'slug' => 'min-number-value', 'title' => __( 'Min Number Value', 'profile-builder' ), 'description' => __( "Min allowed number value (0 to allow only positive numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no min value", 'profile-builder' ) ),
238
- array( 'type' => 'text', 'slug' => 'max-number-value', 'title' => __( 'Max Number Value', 'profile-builder' ), 'description' => __( "Max allowed number value (0 to allow only negative numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no max value", 'profile-builder' ) ),
239
- array( 'type' => 'text', 'slug' => 'number-step-value', 'title' => __( 'Number Step Value', 'profile-builder' ), 'description' => __( "Step value 1 to allow only integers, 0.1 to allow integers and numbers with 1 decimal", 'profile-builder' ) .'<br>'. __( "To allow multiple decimals use for eg. 0.01 (for 2 deciamls) and so on", 'profile-builder' ) .'<br>'. __( "You can also use step value to specify the legal number intervals (eg. step value 2 will allow only -4, -2, 0, 2 and so on)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no restriction", 'profile-builder' ) ),
240
- array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ),
241
- array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ),
242
-
243
- // Added the new option for the map field type, that allows to customize the POIs load type.
244
- array(
245
- 'type' => 'select',
246
- 'slug' => 'map-pins-load-type',
247
- 'title' => __( 'POIs Load Type', 'profile-builder' ),
248
- 'options' => array(
249
- '%' . __( 'POIs of the listed users (as filtered & paginated)', 'profile-builder' ) . '%',
250
- '%' . __( 'POIs of all the users for the filter* (no pagination)', 'profile-builder' ) . '%all',
251
- ),
252
- 'default' => '',
253
- 'description' => __( 'This option allows you to load on a single map the POIs for all users, or just these for the listed ones (this will take into account the filters and the faceted menus). *Please use this feature wisely, it will impact the performance.', 'profile-builder' ),
254
- ),
255
-
256
- // Added the new option for the map field type, that allows to customize the POI bubble content.
257
- array(
258
- 'type' => 'checkbox',
259
- 'slug' => 'map-bubble-fields',
260
- 'title' => __( 'POI Bubble Info', 'profile-builder' ),
261
- 'options' => wppb_prepare_key_value_options( apply_filters( 'wppb_map_bubble_fields', $bubble_meta_tags ) ),
262
- 'default' => 'avatar_or_gravatar, meta_display_name',
263
- 'description' => __( 'Select the attributes to be listed inside the POI bubble.', 'profile-builder' ),
264
- 'extra_attributes' => array(
265
- 'dropdown_options' => true,
266
- 'sortable_options' => true,
267
- ),
268
- ),
269
-
270
- // Added the new option for the map field type, that allows to customize the number of users per iteration.
271
- array(
272
- 'type' => 'text',
273
- 'slug' => 'map-pagination-number',
274
- 'title' => __( 'Number of Users per Map Iteration', 'profile-builder' ),
275
- 'description' => __( 'When loading the map of all users with no pagination, the map script will iterate multiple times and will expose gradually POIs on the map, until all the POIs for the users that match the criteria will be added on the map (think of this as of pagination for the map POIs). The smaller the number of users per iteration, the fastest the iteration response will be, but for a large number of users, the map script will iterate multiple times. Setting a higher limit will decrease the performance, but might produce a smaller number of iterations. <br><br><b>Please adjust this value to your hosting capabilities, and make sure that the value you set is the best for performance.</b> We recommend a <b>maximum</b> value of 300.', 'profile-builder' ),
276
- 'default' => 50,
277
- ),
278
- ) );
279
-
280
- // create the new submenu with the above options
281
- $args = array(
282
- 'metabox_id' => 'manage-fields',
283
- 'metabox_title' => __( 'Form Field Properties', 'profile-builder' ),
284
- 'post_type' => 'manage-fields',
285
- 'meta_name' => 'wppb_manage_fields',
286
- 'meta_array' => $fields,
287
- 'context' => 'option'
288
- );
289
- new Wordpress_Creation_Kit_PB( $args );
290
-
291
- /* this is redundant but it should have a very low impact and for comfort we leave it here as well */
292
- wppb_prepopulate_fields();
293
-
294
- // create the info side meta-box
295
- $args = array(
296
- 'metabox_id' => 'manage-fields-info',
297
- 'metabox_title' => __( 'Registration & Edit Profile Forms', 'profile-builder' ),
298
- 'post_type' => 'manage-fields',
299
- 'meta_name' => 'wppb_manage_fields_info',
300
- 'meta_array' => '',
301
- 'context' => 'option',
302
- 'mb_context' => 'side'
303
- );
304
- new Wordpress_Creation_Kit_PB( $args );
305
- }
306
- add_action( 'admin_init', 'wppb_populate_manage_fields', 1 );
307
-
308
- /**
309
- * Function that prepopulates the manage fields list with the default fields of WP
310
- *
311
- * @since v.2.0
312
- *
313
- * @return void
314
- */
315
- function wppb_prepopulate_fields(){
316
- $prepopulated_fields[] = array( 'field' => 'Default - Name (Heading)', 'field-title' => __( 'Name', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '1', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
317
- $prepopulated_fields[] = array( 'field' => 'Default - Username', 'field-title' => __( 'Username', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '2', 'description' => __( 'Usernames cannot be changed.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
318
- $prepopulated_fields[] = array( 'field' => 'Default - First Name', 'field-title' => __( 'First Name', 'profile-builder' ), 'meta-name' => 'first_name', 'overwrite-existing' => 'No', 'id' => '3', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
319
- $prepopulated_fields[] = array( 'field' => 'Default - Last Name', 'field-title' => __( 'Last Name', 'profile-builder' ), 'meta-name' => 'last_name', 'overwrite-existing' => 'No', 'id' => '4', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
320
- $prepopulated_fields[] = array( 'field' => 'Default - Nickname', 'field-title' => __( 'Nickname', 'profile-builder' ), 'meta-name' => 'nickname', 'overwrite-existing' => 'No', 'id' => '5', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
321
- $prepopulated_fields[] = array( 'field' => 'Default - Display name publicly as', 'field-title' => __( 'Display name publicly as', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '6', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
322
- $prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '7', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
323
- $prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '8', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
324
- $prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '9', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
325
-
326
- // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
327
- if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
328
- $prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profile-builder' ), 'meta-name' => 'aim', 'overwrite-existing' => 'No', 'id' => '10', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
329
- $prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profile-builder' ), 'meta-name' => 'yim', 'overwrite-existing' => 'No', 'id' => '11', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
330
- $prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profile-builder' ), 'meta-name' => 'jabber', 'overwrite-existing' => 'No', 'id' => '12', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
331
- }
332
-
333
- $prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '13', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
334
- $prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profile-builder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'required' => 'No' );
335
- $prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
336
- $prepopulated_fields[] = array( 'field' => 'Default - Repeat Password', 'field-title' => __( 'Repeat Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '16', 'description' => __( 'Type your password again. ', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
337
- if ( wppb_can_users_signup_blog() ){
338
- $prepopulated_fields[] = array( 'field' => 'Default - Blog Details', 'field-title' => __( 'Blog Details', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '17', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
339
- }
340
-
341
- add_option ( 'wppb_manage_fields', apply_filters ( 'wppb_prepopulated_fields', $prepopulated_fields ) );
342
- }
343
-
344
- /**
345
- * Function that returns a unique meta-name
346
- *
347
- * @since v.2.0
348
- *
349
- * @return string
350
- */
351
- function wppb_get_meta_name( $option = 'wppb_manage_fields', $prefix = 'custom_field_' ){
352
- $id = 1;
353
-
354
- $wppb_manage_fields = get_option( $option, 'not_found' );
355
-
356
- if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){
357
- return $prefix . $id;
358
- }
359
- else{
360
- $meta_names = array();
361
- foreach( $wppb_manage_fields as $value ){
362
- if ( strpos( $value['meta-name'], $prefix ) === 0 ){
363
- $meta_names[] = $value['meta-name'];
364
- }
365
- }
366
-
367
- if( !empty( $meta_names ) ){
368
- $meta_numbers = array();
369
- foreach( $meta_names as $meta_name ){
370
- $number = str_replace( $prefix, '', $meta_name );
371
- /* we should have an underscore present in custom_field_# so remove it */
372
- $number = str_replace( '_', '', $number );
373
-
374
- $meta_numbers[] = $number;
375
- }
376
- if( !empty( $meta_numbers ) ){
377
- rsort( $meta_numbers );
378
- $id = (int)$meta_numbers[0] + 1;
379
- }
380
- }
381
-
382
- return $prefix . $id;
383
- }
384
- }
385
-
386
-
387
- /**
388
- * Function that returns an array with countries
389
- *
390
- * @since v.2.0
391
- *
392
- * @return array
393
- */
394
- function wppb_country_select_options( $form_location ) {
395
- $country_array = apply_filters( 'wppb_'.$form_location.'_country_select_array',
396
- array(
397
- '' => __( 'Select a Country', 'profile-builder' ),
398
- 'AF' => __( 'Afghanistan', 'profile-builder' ),
399
- 'AX' => __( 'Aland Islands', 'profile-builder' ),
400
- 'AL' => __( 'Albania', 'profile-builder' ),
401
- 'DZ' => __( 'Algeria', 'profile-builder' ),
402
- 'AS' => __( 'American Samoa', 'profile-builder' ),
403
- 'AD' => __( 'Andorra', 'profile-builder' ),
404
- 'AO' => __( 'Angola', 'profile-builder' ),
405
- 'AI' => __( 'Anguilla', 'profile-builder' ),
406
- 'AQ' => __( 'Antarctica', 'profile-builder' ),
407
- 'AG' => __( 'Antigua and Barbuda', 'profile-builder' ),
408
- 'AR' => __( 'Argentina', 'profile-builder' ),
409
- 'AM' => __( 'Armenia', 'profile-builder' ),
410
- 'AW' => __( 'Aruba', 'profile-builder' ),
411
- 'AU' => __( 'Australia', 'profile-builder' ),
412
- 'AT' => __( 'Austria', 'profile-builder' ),
413
- 'AZ' => __( 'Azerbaijan', 'profile-builder' ),
414
- 'BS' => __( 'Bahamas', 'profile-builder' ),
415
- 'BH' => __( 'Bahrain', 'profile-builder' ),
416
- 'BD' => __( 'Bangladesh', 'profile-builder' ),
417
- 'BB' => __( 'Barbados', 'profile-builder' ),
418
- 'BY' => __( 'Belarus', 'profile-builder' ),
419
- 'BE' => __( 'Belgium', 'profile-builder' ),
420
- 'BZ' => __( 'Belize', 'profile-builder' ),
421
- 'BJ' => __( 'Benin', 'profile-builder' ),
422
- 'BM' => __( 'Bermuda', 'profile-builder' ),
423
- 'BT' => __( 'Bhutan', 'profile-builder' ),
424
- 'BO' => __( 'Bolivia', 'profile-builder' ),
425
- 'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'profile-builder' ),
426
- 'BA' => __( 'Bosnia and Herzegovina', 'profile-builder' ),
427
- 'BW' => __( 'Botswana', 'profile-builder' ),
428
- 'BV' => __( 'Bouvet Island', 'profile-builder' ),
429
- 'BR' => __( 'Brazil', 'profile-builder' ),
430
- 'IO' => __( 'British Indian Ocean Territory', 'profile-builder' ),
431
- 'VG' => __( 'British Virgin Islands', 'profile-builder' ),
432
- 'BN' => __( 'Brunei', 'profile-builder' ),
433
- 'BG' => __( 'Bulgaria', 'profile-builder' ),
434
- 'BF' => __( 'Burkina Faso', 'profile-builder' ),
435
- 'BI' => __( 'Burundi', 'profile-builder' ),
436
- 'KH' => __( 'Cambodia', 'profile-builder' ),
437
- 'CM' => __( 'Cameroon', 'profile-builder' ),
438
- 'CA' => __( 'Canada', 'profile-builder' ),
439
- 'CV' => __( 'Cape Verde', 'profile-builder' ),
440
- 'KY' => __( 'Cayman Islands', 'profile-builder' ),
441
- 'CF' => __( 'Central African Republic', 'profile-builder' ),
442
- 'TD' => __( 'Chad', 'profile-builder' ),
443
- 'CL' => __( 'Chile', 'profile-builder' ),
444
- 'CN' => __( 'China', 'profile-builder' ),
445
- 'CX' => __( 'Christmas Island', 'profile-builder' ),
446
- 'CC' => __( 'Cocos Islands', 'profile-builder' ),
447
- 'CO' => __( 'Colombia', 'profile-builder' ),
448
- 'KM' => __( 'Comoros', 'profile-builder' ),
449
- 'CK' => __( 'Cook Islands', 'profile-builder' ),
450
- 'CR' => __( 'Costa Rica', 'profile-builder' ),
451
- 'HR' => __( 'Croatia', 'profile-builder' ),
452
- 'CU' => __( 'Cuba', 'profile-builder' ),
453
- 'CW' => __( 'Curacao', 'profile-builder' ),
454
- 'CY' => __( 'Cyprus', 'profile-builder' ),
455
- 'CZ' => __( 'Czech Republic', 'profile-builder' ),
456
- 'CD' => __( 'Democratic Republic of the Congo', 'profile-builder' ),
457
- 'DK' => __( 'Denmark', 'profile-builder' ),
458
- 'DJ' => __( 'Djibouti', 'profile-builder' ),
459
- 'DM' => __( 'Dominica', 'profile-builder' ),
460
- 'DO' => __( 'Dominican Republic', 'profile-builder' ),
461
- 'TL' => __( 'East Timor', 'profile-builder' ),
462
- 'EC' => __( 'Ecuador', 'profile-builder' ),
463
- 'EG' => __( 'Egypt', 'profile-builder' ),
464
- 'SV' => __( 'El Salvador', 'profile-builder' ),
465
- 'GQ' => __( 'Equatorial Guinea', 'profile-builder' ),
466
- 'ER' => __( 'Eritrea', 'profile-builder' ),
467
- 'EE' => __( 'Estonia', 'profile-builder' ),
468
- 'ET' => __( 'Ethiopia', 'profile-builder' ),
469
- 'FK' => __( 'Falkland Islands', 'profile-builder' ),
470
- 'FO' => __( 'Faroe Islands', 'profile-builder' ),
471
- 'FJ' => __( 'Fiji', 'profile-builder' ),
472
- 'FI' => __( 'Finland', 'profile-builder' ),
473
- 'FR' => __( 'France', 'profile-builder' ),
474
- 'GF' => __( 'French Guiana', 'profile-builder' ),
475
- 'PF' => __( 'French Polynesia', 'profile-builder' ),
476
- 'TF' => __( 'French Southern Territories', 'profile-builder' ),
477
- 'GA' => __( 'Gabon', 'profile-builder' ),
478
- 'GM' => __( 'Gambia', 'profile-builder' ),
479
- 'GE' => __( 'Georgia', 'profile-builder' ),
480
- 'DE' => __( 'Germany', 'profile-builder' ),
481
- 'GH' => __( 'Ghana', 'profile-builder' ),
482
- 'GI' => __( 'Gibraltar', 'profile-builder' ),
483
- 'GR' => __( 'Greece', 'profile-builder' ),
484
- 'GL' => __( 'Greenland', 'profile-builder' ),
485
- 'GD' => __( 'Grenada', 'profile-builder' ),
486
- 'GP' => __( 'Guadeloupe', 'profile-builder' ),
487
- 'GU' => __( 'Guam', 'profile-builder' ),
488
- 'GT' => __( 'Guatemala', 'profile-builder' ),
489
- 'GG' => __( 'Guernsey', 'profile-builder' ),
490
- 'GN' => __( 'Guinea', 'profile-builder' ),
491
- 'GW' => __( 'Guinea-Bissau', 'profile-builder' ),
492
- 'GY' => __( 'Guyana', 'profile-builder' ),
493
- 'HT' => __( 'Haiti', 'profile-builder' ),
494
- 'HM' => __( 'Heard Island and McDonald Islands', 'profile-builder' ),
495
- 'HN' => __( 'Honduras', 'profile-builder' ),
496
- 'HK' => __( 'Hong Kong', 'profile-builder' ),
497
- 'HU' => __( 'Hungary', 'profile-builder' ),
498
- 'IS' => __( 'Iceland', 'profile-builder' ),
499
- 'IN' => __( 'India', 'profile-builder' ),
500
- 'ID' => __( 'Indonesia', 'profile-builder' ),
501
- 'IR' => __( 'Iran', 'profile-builder' ),
502
- 'IQ' => __( 'Iraq', 'profile-builder' ),
503
- 'IE' => __( 'Ireland', 'profile-builder' ),
504
- 'IM' => __( 'Isle of Man', 'profile-builder' ),
505
- 'IL' => __( 'Israel', 'profile-builder' ),
506
- 'IT' => __( 'Italy', 'profile-builder' ),
507
- 'CI' => __( 'Ivory Coast', 'profile-builder' ),
508
- 'JM' => __( 'Jamaica', 'profile-builder' ),
509
- 'JP' => __( 'Japan', 'profile-builder' ),
510
- 'JE' => __( 'Jersey', 'profile-builder' ),
511
- 'JO' => __( 'Jordan', 'profile-builder' ),
512
- 'KZ' => __( 'Kazakhstan', 'profile-builder' ),
513
- 'KE' => __( 'Kenya', 'profile-builder' ),
514
- 'KI' => __( 'Kiribati', 'profile-builder' ),
515
- 'XK' => __( 'Kosovo', 'profile-builder' ),
516
- 'KW' => __( 'Kuwait', 'profile-builder' ),
517
- 'KG' => __( 'Kyrgyzstan', 'profile-builder' ),
518
- 'LA' => __( 'Laos', 'profile-builder' ),
519
- 'LV' => __( 'Latvia', 'profile-builder' ),
520
- 'LB' => __( 'Lebanon', 'profile-builder' ),
521
- 'LS' => __( 'Lesotho', 'profile-builder' ),
522
- 'LR' => __( 'Liberia', 'profile-builder' ),
523
- 'LY' => __( 'Libya', 'profile-builder' ),
524
- 'LI' => __( 'Liechtenstein', 'profile-builder' ),
525
- 'LT' => __( 'Lithuania', 'profile-builder' ),
526
- 'LU' => __( 'Luxembourg', 'profile-builder' ),
527
- 'MO' => __( 'Macao', 'profile-builder' ),
528
- 'MK' => __( 'Macedonia', 'profile-builder' ),
529
- 'MG' => __( 'Madagascar', 'profile-builder' ),
530
- 'MW' => __( 'Malawi', 'profile-builder' ),
531
- 'MY' => __( 'Malaysia', 'profile-builder' ),
532
- 'MV' => __( 'Maldives', 'profile-builder' ),
533
- 'ML' => __( 'Mali', 'profile-builder' ),
534
- 'MT' => __( 'Malta', 'profile-builder' ),
535
- 'MH' => __( 'Marshall Islands', 'profile-builder' ),
536
- 'MQ' => __( 'Martinique', 'profile-builder' ),
537
- 'MR' => __( 'Mauritania', 'profile-builder' ),
538
- 'MU' => __( 'Mauritius', 'profile-builder' ),
539
- 'YT' => __( 'Mayotte', 'profile-builder' ),
540
- 'MX' => __( 'Mexico', 'profile-builder' ),
541
- 'FM' => __( 'Micronesia', 'profile-builder' ),
542
- 'MD' => __( 'Moldova', 'profile-builder' ),
543
- 'MC' => __( 'Monaco', 'profile-builder' ),
544
- 'MN' => __( 'Mongolia', 'profile-builder' ),
545
- 'ME' => __( 'Montenegro', 'profile-builder' ),
546
- 'MS' => __( 'Montserrat', 'profile-builder' ),
547
- 'MA' => __( 'Morocco', 'profile-builder' ),
548
- 'MZ' => __( 'Mozambique', 'profile-builder' ),
549
- 'MM' => __( 'Myanmar', 'profile-builder' ),
550
- 'NA' => __( 'Namibia', 'profile-builder' ),
551
- 'NR' => __( 'Nauru', 'profile-builder' ),
552
- 'NP' => __( 'Nepal', 'profile-builder' ),
553
- 'NL' => __( 'Netherlands', 'profile-builder' ),
554
- 'NC' => __( 'New Caledonia', 'profile-builder' ),
555
- 'NZ' => __( 'New Zealand', 'profile-builder' ),
556
- 'NI' => __( 'Nicaragua', 'profile-builder' ),
557
- 'NE' => __( 'Niger', 'profile-builder' ),
558
- 'NG' => __( 'Nigeria', 'profile-builder' ),
559
- 'NU' => __( 'Niue', 'profile-builder' ),
560
- 'NF' => __( 'Norfolk Island', 'profile-builder' ),
561
- 'KP' => __( 'North Korea', 'profile-builder' ),
562
- 'MP' => __( 'Northern Mariana Islands', 'profile-builder' ),
563
- 'NO' => __( 'Norway', 'profile-builder' ),
564
- 'OM' => __( 'Oman', 'profile-builder' ),
565
- 'PK' => __( 'Pakistan', 'profile-builder' ),
566
- 'PW' => __( 'Palau', 'profile-builder' ),
567
- 'PS' => __( 'Palestinian Territory', 'profile-builder' ),
568
- 'PA' => __( 'Panama', 'profile-builder' ),
569
- 'PG' => __( 'Papua New Guinea', 'profile-builder' ),
570
- 'PY' => __( 'Paraguay', 'profile-builder' ),
571
- 'PE' => __( 'Peru', 'profile-builder' ),
572
- 'PH' => __( 'Philippines', 'profile-builder' ),
573
- 'PN' => __( 'Pitcairn', 'profile-builder' ),
574
- 'PL' => __( 'Poland', 'profile-builder' ),
575
- 'PT' => __( 'Portugal', 'profile-builder' ),
576
- 'PR' => __( 'Puerto Rico', 'profile-builder' ),
577
- 'QA' => __( 'Qatar', 'profile-builder' ),
578
- 'CG' => __( 'Republic of the Congo', 'profile-builder' ),
579
- 'RE' => __( 'Reunion', 'profile-builder' ),
580
- 'RO' => __( 'Romania', 'profile-builder' ),
581
- 'RU' => __( 'Russia', 'profile-builder' ),
582
- 'RW' => __( 'Rwanda', 'profile-builder' ),
583
- 'BL' => __( 'Saint Barthelemy', 'profile-builder' ),
584
- 'SH' => __( 'Saint Helena', 'profile-builder' ),
585
- 'KN' => __( 'Saint Kitts and Nevis', 'profile-builder' ),
586
- 'LC' => __( 'Saint Lucia', 'profile-builder' ),
587
- 'MF' => __( 'Saint Martin', 'profile-builder' ),
588
- 'PM' => __( 'Saint Pierre and Miquelon', 'profile-builder' ),
589
- 'VC' => __( 'Saint Vincent and the Grenadines', 'profile-builder' ),
590
- 'WS' => __( 'Samoa', 'profile-builder' ),
591
- 'SM' => __( 'San Marino', 'profile-builder' ),
592
- 'ST' => __( 'Sao Tome and Principe', 'profile-builder' ),
593
- 'SA' => __( 'Saudi Arabia', 'profile-builder' ),
594
- 'SN' => __( 'Senegal', 'profile-builder' ),
595
- 'RS' => __( 'Serbia', 'profile-builder' ),
596
- 'SC' => __( 'Seychelles', 'profile-builder' ),
597
- 'SL' => __( 'Sierra Leone', 'profile-builder' ),
598
- 'SG' => __( 'Singapore', 'profile-builder' ),
599
- 'SX' => __( 'Sint Maarten', 'profile-builder' ),
600
- 'SK' => __( 'Slovakia', 'profile-builder' ),
601
- 'SI' => __( 'Slovenia', 'profile-builder' ),
602
- 'SB' => __( 'Solomon Islands', 'profile-builder' ),
603
- 'SO' => __( 'Somalia', 'profile-builder' ),
604
- 'ZA' => __( 'South Africa', 'profile-builder' ),
605
- 'GS' => __( 'South Georgia and the South Sandwich Islands', 'profile-builder' ),
606
- 'KR' => __( 'South Korea', 'profile-builder' ),
607
- 'SS' => __( 'South Sudan', 'profile-builder' ),
608
- 'ES' => __( 'Spain', 'profile-builder' ),
609
- 'LK' => __( 'Sri Lanka', 'profile-builder' ),
610
- 'SD' => __( 'Sudan', 'profile-builder' ),
611
- 'SR' => __( 'Suriname', 'profile-builder' ),
612
- 'SJ' => __( 'Svalbard and Jan Mayen', 'profile-builder' ),
613
- 'SZ' => __( 'Swaziland', 'profile-builder' ),
614
- 'SE' => __( 'Sweden', 'profile-builder' ),
615
- 'CH' => __( 'Switzerland', 'profile-builder' ),
616
- 'SY' => __( 'Syria', 'profile-builder' ),
617
- 'TW' => __( 'Taiwan', 'profile-builder' ),
618
- 'TJ' => __( 'Tajikistan', 'profile-builder' ),
619
- 'TZ' => __( 'Tanzania', 'profile-builder' ),
620
- 'TH' => __( 'Thailand', 'profile-builder' ),
621
- 'TG' => __( 'Togo', 'profile-builder' ),
622
- 'TK' => __( 'Tokelau', 'profile-builder' ),
623
- 'TO' => __( 'Tonga', 'profile-builder' ),
624
- 'TT' => __( 'Trinidad and Tobago', 'profile-builder' ),
625
- 'TN' => __( 'Tunisia', 'profile-builder' ),
626
- 'TR' => __( 'Turkey', 'profile-builder' ),
627
- 'TM' => __( 'Turkmenistan', 'profile-builder' ),
628
- 'TC' => __( 'Turks and Caicos Islands', 'profile-builder' ),
629
- 'TV' => __( 'Tuvalu', 'profile-builder' ),
630
- 'VI' => __( 'U.S. Virgin Islands', 'profile-builder' ),
631
- 'UG' => __( 'Uganda', 'profile-builder' ),
632
- 'UA' => __( 'Ukraine', 'profile-builder' ),
633
- 'AE' => __( 'United Arab Emirates', 'profile-builder' ),
634
- 'GB' => __( 'United Kingdom', 'profile-builder' ),
635
- 'US' => __( 'United States', 'profile-builder' ),
636
- 'UM' => __( 'United States Minor Outlying Islands', 'profile-builder' ),
637
- 'UY' => __( 'Uruguay', 'profile-builder' ),
638
- 'UZ' => __( 'Uzbekistan', 'profile-builder' ),
639
- 'VU' => __( 'Vanuatu', 'profile-builder' ),
640
- 'VA' => __( 'Vatican', 'profile-builder' ),
641
- 'VE' => __( 'Venezuela', 'profile-builder' ),
642
- 'VN' => __( 'Vietnam', 'profile-builder' ),
643
- 'WF' => __( 'Wallis and Futuna', 'profile-builder' ),
644
- 'EH' => __( 'Western Sahara', 'profile-builder' ),
645
- 'YE' => __( 'Yemen', 'profile-builder' ),
646
- 'ZM' => __( 'Zambia', 'profile-builder' ),
647
- 'ZW' => __( 'Zimbabwe', 'profile-builder' ),
648
- )
649
- );
650
-
651
- return $country_array;
652
- }
653
-
654
-
655
- /**
656
- * Function that returns an array with timezone options
657
- *
658
- * @since v.2.0
659
- *
660
- * @return array
661
- */
662
- function wppb_timezone_select_options( $form_location ) {
663
- $timezone_array = apply_filters( 'wppb_'.$form_location.'_timezone_select_array', array ( '(GMT -12:00) Eniwetok, Kwajalein', '(GMT -11:00) Midway Island, Samoa', '(GMT -10:00) Hawaii', '(GMT -9:00) Alaska', '(GMT -8:00) Pacific Time (US & Canada)', '(GMT -7:00) Mountain Time (US & Canada)', '(GMT -6:00) Central Time (US & Canada), Mexico City', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '(GMT -3:30) Newfoundland', '(GMT -3:00) Brazil, Buenos Aires, Georgetown', '(GMT -2:00) Mid-Atlantic', '(GMT -1:00) Azores, Cape Verde Islands', '(GMT) Western Europe Time, London, Lisbon, Casablanca', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris', '(GMT +2:00) Kaliningrad, South Africa', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg', '(GMT +3:30) Tehran', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '(GMT +4:30) Kabul', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi', '(GMT +5:45) Kathmandu', '(GMT +6:00) Almaty, Dhaka, Colombo', '(GMT +7:00) Bangkok, Hanoi, Jakarta', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk', '(GMT +9:30) Adelaide, Darwin', '(GMT +10:00) Eastern Australia, Guam, Vladivostok', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka' ) );
664
-
665
- return $timezone_array;
666
- }
667
-
668
-
669
- /*
670
- * Array with the currency ISO code and associated currency name
671
- *
672
- * @param string $form_location
673
- *
674
- * @return array
675
- *
676
- */
677
- function wppb_get_currencies( $form_location = '' ) {
678
-
679
- $currencies = array(
680
- 'ALL' => __( 'Albania Lek', 'profile-builder' ),
681
- 'AFN' => __( 'Afghanistan Afghani', 'profile-builder' ),
682
- 'ARS' => __( 'Argentina Peso', 'profile-builder' ),
683
- 'AWG' => __( 'Aruba Guilder', 'wkc' ),
684
- 'AUD' => __( 'Australia Dollar', 'profile-builder' ),
685
- 'AZN' => __( 'Azerbaijan New Manat', 'profile-builder' ),
686
- 'BSD' => __( 'Bahamas Dollar', 'profile-builder' ),
687
- 'BBD' => __( 'Barbados Dollar','profile-builder' ),
688
- 'BDT' => __( 'Bangladeshi taka','profile-builder' ),
689
- 'BYR' => __( 'Belarus Ruble','profile-builder' ),
690
- 'BZD' => __( 'Belize Dollar','profile-builder' ),
691
- 'BMD' => __( 'Bermuda Dollar','profile-builder' ),
692
- 'BOB' => __( 'Bolivia Boliviano','profile-builder' ),
693
- 'BAM' => __( 'Bosnia and Herzegovina Convertible Marka','profile-builder' ),
694
- 'BWP' => __( 'Botswana Pula','profile-builder' ),
695
- 'BGN' => __( 'Bulgaria Lev','profile-builder' ),
696
- 'BRL' => __( 'Brazil Real','profile-builder' ),
697
- 'BND' => __( 'Brunei Darussalam Dollar','profile-builder' ),
698
- 'KHR' => __( 'Cambodia Riel','profile-builder' ),
699
- 'CAD' => __( 'Canada Dollar','profile-builder' ),
700
- 'KYD' => __( 'Cayman Islands Dollar','profile-builder' ),
701
- 'CLP' => __( 'Chile Peso','profile-builder' ),
702
- 'CNY' => __( 'China Yuan Renminbi','profile-builder' ),
703
- 'COP' => __( 'Colombia Peso','profile-builder' ),
704
- 'CRC' => __( 'Costa Rica Colon','profile-builder' ),
705
- 'HRK' => __( 'Croatia Kuna','profile-builder' ),
706
- 'CUP' => __( 'Cuba Peso','profile-builder' ),
707
- 'CZK' => __( 'Czech Republic Koruna','profile-builder' ),
708
- 'DKK' => __( 'Denmark Krone','profile-builder' ),
709
- 'DOP' => __( 'Dominican Republic Peso','profile-builder' ),
710
- 'XCD' => __( 'East Caribbean Dollar','profile-builder' ),
711
- 'EGP' => __( 'Egypt Pound','profile-builder' ),
712
- 'SVC' => __( 'El Salvador Colon','profile-builder' ),
713
- 'EEK' => __( 'Estonia Kroon','profile-builder' ),
714
- 'EUR' => __( 'Euro','profile-builder' ),
715
- 'FKP' => __( 'Falkland Islands (Malvinas) Pound','profile-builder' ),
716
- 'FJD' => __( 'Fiji Dollar','profile-builder' ),
717
- 'GHC' => __( 'Ghana Cedis','profile-builder' ),
718
- 'GIP' => __( 'Gibraltar Pound','profile-builder' ),
719
- 'GTQ' => __( 'Guatemala Quetzal','profile-builder' ),
720
- 'GGP' => __( 'Guernsey Pound','profile-builder' ),
721
- 'GYD' => __( 'Guyana Dollar','profile-builder' ),
722
- 'HNL' => __( 'Honduras Lempira','profile-builder' ),
723
- 'HKD' => __( 'Hong Kong Dollar','profile-builder' ),
724
- 'HUF' => __( 'Hungary Forint','profile-builder' ),
725
- 'ISK' => __( 'Iceland Krona','profile-builder' ),
726
- 'INR' => __( 'India Rupee','profile-builder' ),
727
- 'IDR' => __( 'Indonesia Rupiah','profile-builder' ),
728
- 'IRR' => __( 'Iran Rial','profile-builder' ),
729
- 'IMP' => __( 'Isle of Man Pound','profile-builder' ),
730
- 'ILS' => __( 'Israel Shekel','profile-builder' ),
731
- 'JMD' => __( 'Jamaica Dollar','profile-builder' ),
732
- 'JPY' => __( 'Japan Yen','profile-builder' ),
733
- 'JEP' => __( 'Jersey Pound','profile-builder' ),
734
- 'KZT' => __( 'Kazakhstan Tenge','profile-builder' ),
735
- 'KPW' => __( 'Korea (North) Won','profile-builder' ),
736
- 'KRW' => __( 'Korea (South) Won','profile-builder' ),
737
- 'KGS' => __( 'Kyrgyzstan Som','profile-builder' ),
738
- 'LAK' => __( 'Laos Kip','profile-builder' ),
739
- 'LVL' => __( 'Latvia Lat','profile-builder' ),
740
- 'LBP' => __( 'Lebanon Pound','profile-builder' ),
741
- 'LRD' => __( 'Liberia Dollar','profile-builder' ),
742
- 'LTL' => __( 'Lithuania Litas','profile-builder' ),
743
- 'MKD' => __( 'Macedonia Denar','profile-builder' ),
744
- 'MYR' => __( 'Malaysia Ringgit','profile-builder' ),
745
- 'MUR' => __( 'Mauritius Rupee','profile-builder' ),
746
- 'MXN' => __( 'Mexico Peso','profile-builder' ),
747
- 'MNT' => __( 'Mongolia Tughrik','profile-builder' ),
748
- 'MZN' => __( 'Mozambique Metical','profile-builder' ),
749
- 'NAD' => __( 'Namibia Dollar','profile-builder' ),
750
- 'NPR' => __( 'Nepal Rupee','profile-builder' ),
751
- 'ANG' => __( 'Netherlands Antilles Guilder','profile-builder' ),
752
- 'NZD' => __( 'New Zealand Dollar','profile-builder' ),
753
- 'NIO' => __( 'Nicaragua Cordoba','profile-builder' ),
754
- 'NGN' => __( 'Nigeria Naira','profile-builder' ),
755
- 'NOK' => __( 'Norway Krone','profile-builder' ),
756
- 'OMR' => __( 'Oman Rial', 'profile-builder' ),
757
- 'PKR' => __( 'Pakistan Rupee', 'profile-builder' ),
758
- 'PAB' => __( 'Panama Balboa', 'profile-builder' ),
759
- 'PYG' => __( 'Paraguay Guarani', 'profile-builder' ),
760
- 'PEN' => __( 'Peru Nuevo Sol', 'profile-builder' ),
761
- 'PHP' => __( 'Philippines Peso', 'profile-builder' ),
762
- 'PLN' => __( 'Poland Zloty', 'profile-builder' ),
763
- 'QAR' => __( 'Qatar Riyal', 'profile-builder' ),
764
- 'RON' => __( 'Romania New Leu', 'profile-builder' ),
765
- 'RUB' => __( 'Russia Ruble', 'profile-builder' ),
766
- 'SHP' => __( 'Saint Helena Pound', 'profile-builder' ),
767
- 'SAR' => __( 'Saudi Arabia Riyal', 'profile-builder' ),
768
- 'RSD' => __( 'Serbia Dinar', 'profile-builder' ),
769
- 'SCR' => __( 'Seychelles Rupee', 'profile-builder' ),
770
- 'SGD' => __( 'Singapore Dollar', 'profile-builder' ),
771
- 'SBD' => __( 'Solomon Islands Dollar', 'profile-builder' ),
772
- 'SOS' => __( 'Somalia Shilling', 'profile-builder' ),
773
- 'ZAR' => __( 'South Africa Rand', 'profile-builder' ),
774
- 'LKR' => __( 'Sri Lanka Rupee', 'profile-builder' ),
775
- 'SEK' => __( 'Sweden Krona', 'profile-builder' ),
776
- 'CHF' => __( 'Switzerland Franc', 'profile-builder' ),
777
- 'SRD' => __( 'Suriname Dollar', 'profile-builder' ),
778
- 'SYP' => __( 'Syria Pound', 'profile-builder' ),
779
- 'TWD' => __( 'Taiwan New Dollar', 'profile-builder' ),
780
- 'THB' => __( 'Thailand Baht', 'profile-builder' ),
781
- 'TTD' => __( 'Trinidad and Tobago Dollar', 'profile-builder' ),
782
- 'TRY' => __( 'Turkey Lira', 'profile-builder' ),
783
- 'TRL' => __( 'Turkey Lira', 'profile-builder' ),
784
- 'TVD' => __( 'Tuvalu Dollar', 'profile-builder' ),
785
- 'UAH' => __( 'Ukraine Hryvna', 'profile-builder' ),
786
- 'GBP' => __( 'United Kingdom Pound', 'profile-builder' ),
787
- 'UGX' => __( 'Uganda Shilling', 'profile-builder' ),
788
- 'USD' => __( 'US Dollar', 'profile-builder' ),
789
- 'UYU' => __( 'Uruguay Peso', 'profile-builder' ),
790
- 'UZS' => __( 'Uzbekistan Som', 'profile-builder' ),
791
- 'VEF' => __( 'Venezuela Bolivar', 'profile-builder' ),
792
- 'VND' => __( 'Viet Nam Dong', 'profile-builder' ),
793
- 'YER' => __( 'Yemen Rial', 'profile-builder' ),
794
- 'ZWD' => __( 'Zimbabwe Dollar', 'profile-builder' )
795
- );
796
-
797
- $filter_name = ( empty( $form_location ) ? 'wppb_get_currencies' : 'wppb_get_currencies_' . $form_location );
798
-
799
- return apply_filters( $filter_name, $currencies );
800
-
801
- }
802
-
803
-
804
- /*
805
- * Returns the currency symbol for a given currency code
806
- *
807
- * @param string $currency_code
808
- *
809
- * @return string
810
- *
811
- */
812
- function wppb_get_currency_symbol( $currency_code ) {
813
-
814
- $currency_symbols = array(
815
- 'AED' => '&#1583;.&#1573;', // ?
816
- 'AFN' => '&#65;&#102;',
817
- 'ALL' => '&#76;&#101;&#107;',
818
- 'AMD' => '',
819
- 'ANG' => '&#402;',
820
- 'AOA' => '&#75;&#122;', // ?
821
- 'ARS' => '&#36;',
822
- 'AUD' => '&#36;',
823
- 'AWG' => '&#402;',
824
- 'AZN' => '&#1084;&#1072;&#1085;',
825
- 'BAM' => '&#75;&#77;',
826
- 'BBD' => '&#36;',
827
- 'BDT' => '&#2547;', // ?
828
- 'BGN' => '&#1083;&#1074;',
829
- 'BHD' => '.&#1583;.&#1576;', // ?
830
- 'BIF' => '&#70;&#66;&#117;', // ?
831
- 'BMD' => '&#36;',
832
- 'BND' => '&#36;',
833
- 'BOB' => '&#36;&#98;',
834
- 'BRL' => '&#82;&#36;',
835
- 'BSD' => '&#36;',
836
- 'BTN' => '&#78;&#117;&#46;', // ?
837
- 'BWP' => '&#80;',
838
- 'BYR' => '&#112;&#46;',
839
- 'BZD' => '&#66;&#90;&#36;',
840
- 'CAD' => '&#36;',
841
- 'CDF' => '&#70;&#67;',
842
- 'CHF' => '&#67;&#72;&#70;',
843
- 'CLF' => '', // ?
844
- 'CLP' => '&#36;',
845
- 'CNY' => '&#165;',
846
- 'COP' => '&#36;',
847
- 'CRC' => '&#8353;',
848
- 'CUP' => '&#8396;',
849
- 'CVE' => '&#36;', // ?
850
- 'CZK' => '&#75;&#269;',
851
- 'DJF' => '&#70;&#100;&#106;', // ?
852
- 'DKK' => '&#107;&#114;',
853
- 'DOP' => '&#82;&#68;&#36;',
854
- 'DZD' => '&#1583;&#1580;', // ?
855
- 'EGP' => '&#163;',
856
- 'ETB' => '&#66;&#114;',
857
- 'EUR' => '&#8364;',
858
- 'FJD' => '&#36;',
859
- 'FKP' => '&#163;',
860
- 'GBP' => '&#163;',
861
- 'GEL' => '&#4314;', // ?
862
- 'GHS' => '&#162;',
863
- 'GIP' => '&#163;',
864
- 'GMD' => '&#68;', // ?
865
- 'GNF' => '&#70;&#71;', // ?
866
- 'GTQ' => '&#81;',
867
- 'GYD' => '&#36;',
868
- 'HKD' => '&#36;',
869
- 'HNL' => '&#76;',
870
- 'HRK' => '&#107;&#110;',
871
- 'HTG' => '&#71;', // ?
872
- 'HUF' => '&#70;&#116;',
873
- 'IDR' => '&#82;&#112;',
874
- 'ILS' => '&#8362;',
875
- 'INR' => '&#8377;',
876
- 'IQD' => '&#1593;.&#1583;', // ?
877
- 'IRR' => '&#65020;',
878
- 'ISK' => '&#107;&#114;',
879
- 'JEP' => '&#163;',
880
- 'JMD' => '&#74;&#36;',
881
- 'JOD' => '&#74;&#68;', // ?
882
- 'JPY' => '&#165;',
883
- 'KES' => '&#75;&#83;&#104;', // ?
884
- 'KGS' => '&#1083;&#1074;',
885
- 'KHR' => '&#6107;',
886
- 'KMF' => '&#67;&#70;', // ?
887
- 'KPW' => '&#8361;',
888
- 'KRW' => '&#8361;',
889
- 'KWD' => '&#1583;.&#1603;', // ?
890
- 'KYD' => '&#36;',
891
- 'KZT' => '&#1083;&#1074;',
892
- 'LAK' => '&#8365;',
893
- 'LBP' => '&#163;',
894
- 'LKR' => '&#8360;',
895
- 'LRD' => '&#36;',
896
- 'LSL' => '&#76;', // ?
897
- 'LTL' => '&#76;&#116;',
898
- 'LVL' => '&#76;&#115;',
899
- 'LYD' => '&#1604;.&#1583;', // ?
900
- 'MAD' => '&#1583;.&#1605;.', //?
901
- 'MDL' => '&#76;',
902
- 'MGA' => '&#65;&#114;', // ?
903
- 'MKD' => '&#1076;&#1077;&#1085;',
904
- 'MMK' => '&#75;',
905
- 'MNT' => '&#8366;',
906
- 'MOP' => '&#77;&#79;&#80;&#36;', // ?
907
- 'MRO' => '&#85;&#77;', // ?
908
- 'MUR' => '&#8360;', // ?
909
- 'MVR' => '.&#1923;', // ?
910
- 'MWK' => '&#77;&#75;',
911
- 'MXN' => '&#36;',
912
- 'MYR' => '&#82;&#77;',
913
- 'MZN' => '&#77;&#84;',
914
- 'NAD' => '&#36;',
915
- 'NGN' => '&#8358;',
916
- 'NIO' => '&#67;&#36;',
917
- 'NOK' => '&#107;&#114;',
918
- 'NPR' => '&#8360;',
919
- 'NZD' => '&#36;',
920
- 'OMR' => '&#65020;',
921
- 'PAB' => '&#66;&#47;&#46;',
922
- 'PEN' => '&#83;&#47;&#46;',
923
- 'PGK' => '&#75;', // ?
924
- 'PHP' => '&#8369;',
925
- 'PKR' => '&#8360;',
926
- 'PLN' => '&#122;&#322;',
927
- 'PYG' => '&#71;&#115;',
928
- 'QAR' => '&#65020;',
929
- 'RON' => '&#108;&#101;&#105;',
930
- 'RSD' => '&#1044;&#1080;&#1085;&#46;',
931
- 'RUB' => '&#1088;&#1091;&#1073;',
932
- 'RWF' => '&#1585;.&#1587;',
933
- 'SAR' => '&#65020;',
934
- 'SBD' => '&#36;',
935
- 'SCR' => '&#8360;',
936
- 'SDG' => '&#163;', // ?
937
- 'SEK' => '&#107;&#114;',
938
- 'SGD' => '&#36;',
939
- 'SHP' => '&#163;',
940
- 'SLL' => '&#76;&#101;', // ?
941
- 'SOS' => '&#83;',
942
- 'SRD' => '&#36;',
943
- 'STD' => '&#68;&#98;', // ?
944
- 'SVC' => '&#36;',
945
- 'SYP' => '&#163;',
946
- 'SZL' => '&#76;', // ?
947
- 'THB' => '&#3647;',
948
- 'TJS' => '&#84;&#74;&#83;', // ? TJS (guess)
949
- 'TMT' => '&#109;',
950
- 'TND' => '&#1583;.&#1578;',
951
- 'TOP' => '&#84;&#36;',
952
- 'TRY' => '&#8356;', // New Turkey Lira (old symbol used)
953
- 'TTD' => '&#36;',
954
- 'TWD' => '&#78;&#84;&#36;',
955
- 'TZS' => '',
956
- 'UAH' => '&#8372;',
957
- 'UGX' => '&#85;&#83;&#104;',
958
- 'USD' => '&#36;',
959
- 'UYU' => '&#36;&#85;',
960
- 'UZS' => '&#1083;&#1074;',
961
- 'VEF' => '&#66;&#115;',
962
- 'VND' => '&#8363;',
963
- 'VUV' => '&#86;&#84;',
964
- 'WST' => '&#87;&#83;&#36;',
965
- 'XAF' => '&#70;&#67;&#70;&#65;',
966
- 'XCD' => '&#36;',
967
- 'XDR' => '',
968
- 'XOF' => '',
969
- 'XPF' => '&#70;',
970
- 'YER' => '&#65020;',
971
- 'ZAR' => '&#82;',
972
- 'ZMK' => '&#90;&#75;', // ?
973
- 'ZWL' => '&#90;&#36;',
974
- );
975
-
976
- if( !empty( $currency_symbols[$currency_code] ) )
977
- return $currency_symbols[$currency_code];
978
- else
979
- return '';
980
-
981
- }
982
-
983
-
984
- /**
985
- * Function that returns a unique, incremented ID
986
- *
987
- * @since v.2.0
988
- *
989
- * @return integer id
990
- */
991
- function wppb_get_unique_id(){
992
- $id = 1;
993
- $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );
994
- if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){
995
- return $id;
996
- }
997
- else{
998
- $ids_array = array();
999
- foreach( $wppb_manage_fields as $value ){
1000
- $ids_array[] = $value['id'];
1001
- }
1002
- if( !empty( $ids_array ) ){
1003
- rsort( $ids_array );
1004
- $id = $ids_array[0] + 1;
1005
- }
1006
- }
1007
- return apply_filters( 'wppb_field_unique_id', $id, $ids_array, $wppb_manage_fields );
1008
- }
1009
-
1010
- /**
1011
- * Function that checks to see if the id is unique when saving the new field
1012
- *
1013
- * @param array $values
1014
- *
1015
- * @return array
1016
- */
1017
- function wppb_check_unique_id_on_saving( $values ) {
1018
- $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );
1019
-
1020
- if( $wppb_manage_fields != 'not_found' ) {
1021
-
1022
- $ids_array = array();
1023
- foreach( $wppb_manage_fields as $field ){
1024
- $ids_array[] = $field['id'];
1025
- }
1026
-
1027
- if( in_array( $values['id'], $ids_array ) ) {
1028
- rsort( $ids_array );
1029
- $values['id'] = $ids_array[0] + 1;
1030
- }
1031
-
1032
- }
1033
- return $values;
1034
- }
1035
- add_filter( 'wck_add_meta_filter_values_wppb_manage_fields', 'wppb_check_unique_id_on_saving' );
1036
-
1037
-
1038
- function wppb_return_unique_field_list( $only_default_fields = false ){
1039
-
1040
- $unique_field_list[] = 'Default - Name (Heading)';
1041
- $unique_field_list[] = 'Default - Contact Info (Heading)';
1042
- $unique_field_list[] = 'Default - About Yourself (Heading)';
1043
- $unique_field_list[] = 'Default - Username';
1044
- $unique_field_list[] = 'Default - First Name';
1045
- $unique_field_list[] = 'Default - Last Name';
1046
- $unique_field_list[] = 'Default - Nickname';
1047
- $unique_field_list[] = 'Default - E-mail';
1048
- $unique_field_list[] = 'Default - Website';
1049
-
1050
- // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
1051
- if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
1052
- $unique_field_list[] = 'Default - AIM';
1053
- $unique_field_list[] = 'Default - Yahoo IM';
1054
- $unique_field_list[] = 'Default - Jabber / Google Talk';
1055
- }
1056
-
1057
- $unique_field_list[] = 'Default - Password';
1058
- $unique_field_list[] = 'Default - Repeat Password';
1059
- $unique_field_list[] = 'Default - Biographical Info';
1060
- $unique_field_list[] = 'Default - Display name publicly as';
1061
-
1062
- if ( wppb_can_users_signup_blog() ) {
1063
- $unique_field_list[] = 'Default - Blog Details';
1064
- }
1065
-
1066
- if( !$only_default_fields ){
1067
- $unique_field_list[] = 'Avatar';
1068
- $unique_field_list[] = 'reCAPTCHA';
1069
- $unique_field_list[] = 'Select (User Role)';
1070
- $unique_field_list[] = 'Map';
1071
- }
1072
-
1073
- return apply_filters ( 'wppb_unique_field_list', $unique_field_list );
1074
- }
1075
-
1076
-
1077
- /**
1078
- * Function that checks several things when adding/editing the fields
1079
- *
1080
- * @since v.2.0
1081
- *
1082
- * @param string $message - the message to be displayed
1083
- * @param array $fields - the added fields
1084
- * @param array $required_fields
1085
- * @param string $meta - the meta-name of the option
1086
- * @param string $values - The values entered for each option
1087
- * @param integer $post_id
1088
- * @return boolean
1089
- */
1090
- function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $meta_name, $posted_values, $post_id ){
1091
- global $wpdb;
1092
-
1093
- if ( $meta_name == 'wppb_manage_fields' ){
1094
-
1095
- // check for a valid field-type (fallback)
1096
- if ( $posted_values['field'] == '' )
1097
- $message .= __( "You must select a field\n", 'profile-builder' );
1098
- // END check for a valid field-type (fallback)
1099
-
1100
- $unique_field_list = wppb_return_unique_field_list();
1101
- $all_fields = apply_filters( 'wppb_manage_fields_check_field_on_edit_add', get_option ( $meta_name, 'not_set' ), $posted_values );
1102
-
1103
- // check if the unique fields are only added once
1104
- if( $all_fields != 'not_set' ){
1105
- foreach( $all_fields as $field ){
1106
- if ( ( in_array ( $posted_values['field'], $unique_field_list ) ) && ( $posted_values['field'] == $field['field'] ) && ( $posted_values['id'] != $field['id'] ) ){
1107
- $message .= __( "Please choose a different field type as this one already exists in your form (must be unique)\n", 'profile-builder' );
1108
- break;
1109
- }
1110
- }
1111
- }
1112
- // END check if the unique fields are only added once
1113
-
1114
- // check for avatar size
1115
- if ( $posted_values['field'] == 'Avatar' ){
1116
- if ( is_numeric( $posted_values['avatar-size'] ) ){
1117
- if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) )
1118
- $message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' );
1119
-
1120
- }else
1121
- $message .= __( "The entered avatar size is not numerical\n", 'profile-builder' );
1122
-
1123
- }
1124
- // END check for avatar size
1125
-
1126
- // check for correct row value
1127
- if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){
1128
- if ( !is_numeric( $posted_values['row-count'] ) )
1129
- $message .= __( "The entered row number is not numerical\n", 'profile-builder' );
1130
-
1131
- elseif ( trim( $posted_values['row-count'] ) == '' )
1132
- $message .= __( "You must enter a value for the row number\n", 'profile-builder' );
1133
- }
1134
- // END check for correct row value
1135
-
1136
-
1137
- // check for the public and private keys
1138
- if ( $posted_values['field'] == 'reCAPTCHA'){
1139
- if ( trim( $posted_values['public-key'] ) == '' )
1140
- $message .= __( "You must enter the site key\n", 'profile-builder' );
1141
- if ( trim( $posted_values['private-key'] ) == '' )
1142
- $message .= __( "You must enter the secret key\n", 'profile-builder' );
1143
- }
1144
- // END check for the public and private keys
1145
-
1146
- // check for the correct the date-format
1147
- if ( $posted_values['field'] == 'Datepicker' ){
1148
- $date_format = strtolower( $posted_values['date-format'] );
1149
- if ( trim( $date_format ) != 'mm/dd/yy' && trim( $date_format ) != 'mm/yy/dd' && trim( $date_format ) != 'dd/yy/mm' &&
1150
- trim( $date_format ) != 'dd/mm/yy' && trim( $date_format ) != 'yy/dd/mm' && trim( $date_format ) != 'yy/mm/dd' &&
1151
- trim( $date_format ) != 'yy-mm-dd' && trim( $date_format ) != 'DD, dd-M-y' && trim( $date_format ) != 'D, dd M yy' &&
1152
- trim( $date_format ) != 'D, d M y' && trim( $date_format ) != 'D, d M yy' && trim( $date_format ) != 'mm-dd-yy' && trim( $date_format ) != '@' )
1153
- $message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' );
1154
-
1155
- elseif ( trim( $date_format ) == '' )
1156
- $message .= __( "You must enter a value for the date-format\n", 'profile-builder' );
1157
- }
1158
- // END check for the correct the date-format
1159
-
1160
- //check for empty meta-name and duplicate meta-name
1161
- if ( $posted_values['overwrite-existing'] == 'No' ){
1162
- $skip_check_for_fields = wppb_return_unique_field_list(true);
1163
- $skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields );
1164
-
1165
- if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){
1166
- $unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' );
1167
-
1168
- //check to see if meta-name is empty
1169
- $skip_empty_check_for_fields = array( 'Heading', 'Select (User Role)', 'reCAPTCHA', 'HTML', 'GDPR Delete Button' );
1170
-
1171
- if( !in_array( $posted_values['field'], $skip_empty_check_for_fields ) && empty( $posted_values['meta-name'] ) ) {
1172
- $message .= __( "The meta-name cannot be empty\n", 'profile-builder' );
1173
- }
1174
-
1175
- // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
1176
- if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
1177
- $unique_meta_name_list[] = 'aim';
1178
- $unique_meta_name_list[] = 'yim';
1179
- $unique_meta_name_list[] = 'jabber';
1180
- }
1181
-
1182
- // if the desired meta-name is one of the following, automatically give an error
1183
- if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) )
1184
- $message .= __( "That meta-name is already in use\n", 'profile-builder' );
1185
-
1186
- else{
1187
- $found_in_custom_fields = false;
1188
-
1189
- if( $all_fields != 'not_set' )
1190
- foreach( $all_fields as $field ){
1191
- if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){
1192
- $message .= __( "That meta-name is already in use\n", 'profile-builder' );
1193
- $found_in_custom_fields = true;
1194
-
1195
- }elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) )
1196
- $found_in_custom_fields = true;
1197
- }
1198
-
1199
- if ( $found_in_custom_fields === false ){
1200
- if( $posted_values['meta-name'] != '' ) {
1201
- $found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name']));
1202
- if ($found_meta_name != null)
1203
- $message .= __("That meta-name is already in use\n", 'profile-builder');
1204
- }
1205
- }
1206
- }
1207
- }
1208
- }
1209
- //END check duplicate meta-name
1210
-
1211
- // check for correct meta name on upload field
1212
- if( $posted_values['field'] == 'Upload' ) {
1213
- if( ! empty( $posted_values['meta-name'] ) && preg_match( '/([^a-z\d_-])/', $posted_values['meta-name'] ) ) {
1214
- $message .= __( "The meta-name can only contain lowercase letters, numbers, _ , - and no spaces.\n", 'profile-builder' );
1215
- }
1216
- }
1217
- // END check for correct meta name on upload field
1218
-
1219
- // check for valid default option (checkbox, select, radio)
1220
- if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) {
1221
- $options = array_map( 'trim', explode( ',', $posted_values['options'] ) );
1222
- $default_options = ( ( trim( $posted_values['default-options'] ) == '' ) ? array() : array_map( 'trim', explode( ',', $posted_values['default-options'] ) ) );
1223
-
1224
- /* echo "<script>console.log( Posted options: " . print_r($options, true) . "' );</script>";
1225
- echo "<script>console.log( Default options: " . print_r($default_options, true) . "' );</script>"; */
1226
-
1227
- $not_found = '';
1228
- foreach ( $default_options as $key => $value ){
1229
- if ( !in_array( $value, $options ) )
1230
- $not_found .= $value . ', ';
1231
- }
1232
-
1233
- if ( $not_found != '' )
1234
- $message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) );
1235
-
1236
- }elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){
1237
- if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) )
1238
- $message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] );
1239
- }
1240
- // END check for valid default option (checkbox, select, radio)
1241
-
1242
- // check to see if any user role is selected (user-role field)
1243
- if( $posted_values['field'] == 'Select (User Role)' ) {
1244
- if( empty( $posted_values['user-roles'] ) ) {
1245
- $message .= __( "Please select at least one user role\n", 'profile-builder' );
1246
- }
1247
- }
1248
- // END check to see if Administrator user role has been selected (user-role field)
1249
-
1250
- $message = apply_filters( 'wppb_check_extra_manage_fields', $message, $posted_values );
1251
-
1252
- }elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){
1253
- if ( $posted_values['field'] == '' ){
1254
- $message .= __( "You must select a field\n", 'profile-builder' );
1255
-
1256
- }else{
1257
- $fields_so_far = get_post_meta ( $post_id, $meta_name, true );
1258
-
1259
- foreach ( $fields_so_far as $key => $value ){
1260
- if ( $value['id'] == $posted_values['id'] )
1261
- $message .= __( "That field is already added in this form\n", 'profile-builder' );
1262
- }
1263
- }
1264
- }
1265
- return $message;
1266
- }
1267
- add_filter( 'wck_extra_message', 'wppb_check_field_on_edit_add', 10, 6 );
1268
-
1269
-
1270
- /**
1271
- * Function that calls the wppb_hide_properties_for_already_added_fields and wppb_enable_select2 after a field-update
1272
- *
1273
- * @since v.2.0
1274
- *
1275
- * @param void
1276
- *
1277
- * @return string
1278
- */
1279
- function wppb_manage_fields_after_refresh_list( $id ){
1280
- echo "<script type=\"text/javascript\">wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' );</script>";
1281
- echo "<script type=\"text/javascript\">wppb_enable_select2( '#wppb_manage_fields' );</script>";
1282
-
1283
- }
1284
- add_action( "wck_refresh_list_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" );
1285
- add_action( "wck_refresh_entry_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" );
1286
-
1287
- /**
1288
- * Function that calls the wppb_hide_all and wppb_enable_select2
1289
- *
1290
- * @since v.2.0
1291
- *
1292
- * @param void
1293
- *
1294
- * @return string
1295
- */
1296
- function wppb_manage_fields_after_ajax_add_field( $id ){
1297
- echo "<script type=\"text/javascript\">wppb_hide_all( '#wppb_manage_fields' );</script>";
1298
- echo "<script type=\"text/javascript\">wppb_enable_select2( '#wppb_manage_fields' );</script>";
1299
- }
1300
- add_action("wck_ajax_add_form_wppb_manage_fields", "wppb_manage_fields_after_ajax_add_field" );
1301
-
1302
- /**
1303
- * Function that modifies the table header in Manage Fields to add Field Name, Field Type, Meta Key, Required
1304
- *
1305
- * @since v.2.0
1306
- *
1307
- * @param $list, $id
1308
- *
1309
- * @return string
1310
- */
1311
- function wppb_manage_fields_header( $list_header ){
1312
- return '<thead><tr><th class="wck-number">#</th><th class="wck-content">'. __( '<pre>Title</pre><pre>Type</pre><pre>Meta Name</pre><pre class="wppb-mb-head-required">Required</pre>', 'profile-builder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'profile-builder' ) .'</th><th class="wck-delete">'. __( 'Delete', 'profile-builder' ) .'</th></tr></thead>';
1313
- }
1314
- add_action( 'wck_metabox_content_header_wppb_manage_fields', 'wppb_manage_fields_header' );
1315
-
1316
- /**
1317
- * Add contextual help to the side of manage fields for the shortcodes
1318
- *
1319
- * @since v.2.0
1320
- *
1321
- * @param $hook
1322
- *
1323
- * @return string
1324
- */
1325
- function wppb_add_content_before_manage_fields(){
1326
- ?>
1327
- <p><?php _e('Use these shortcodes on the pages you want the forms to be displayed:', 'profile-builder'); ?></p>
1328
- <ul>
1329
- <li><strong class="nowrap">[wppb-register]</strong></li>
1330
- <li><strong class="nowrap">[wppb-edit-profile]</strong></li>
1331
- <li><strong class="nowrap">[wppb-register role="author"]</strong></li>
1332
- </ul>
1333
- <p>
1334
- <?php
1335
- if( PROFILE_BUILDER == 'Profile Builder Pro' )
1336
- _e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Modules.", 'profile-builder');
1337
- else
1338
- _e( "With Profile Builder Pro you can display different fields in the registration and edit profile forms, using the Multiple Registration & Edit Profile Forms module.", "profile-builder" )
1339
- ?>
1340
- </p>
1341
- <?php
1342
- }
1343
- add_action('wck_metabox_content_wppb_manage_fields_info', 'wppb_add_content_before_manage_fields');
1344
-
1345
-
1346
- /**
1347
- * Function that calls the wppb_edit_form_properties
1348
- *
1349
- * @since v.2.0
1350
- *
1351
- * @param void
1352
- *
1353
- * @return string
1354
- */
1355
- function wppb_remove_properties_from_added_form( $meta_name, $id, $element_id ){
1356
- if ( ( $meta_name == 'wppb_epf_fields' ) || ( $meta_name == 'wppb_rf_fields' ) )
1357
- echo "<script type=\"text/javascript\">wppb_disable_delete_on_default_mandatory_fields();</script>";
1358
-
1359
- if ( $meta_name == 'wppb_manage_fields' ) {
1360
- echo "<script type=\"text/javascript\">wppb_edit_form_properties( '#container_wppb_manage_fields', 'update_container_wppb_manage_fields_" . $element_id . "' );</script>";
1361
- echo "<script type=\"text/javascript\">wppb_enable_select2( '#container_wppb_manage_fields' );</script>";
1362
- }
1363
- }
1364
- add_action("wck_after_adding_form", "wppb_remove_properties_from_added_form", 10, 3);
1365
-
1366
- /*
1367
- * WPML Support for dynamic strings in Profile Builder. Tags: WPML, fields, translate
1368
- */
1369
- add_filter( 'update_option_wppb_manage_fields', 'wppb_wpml_compat_with_fields', 10, 2 );
1370
- function wppb_wpml_compat_with_fields( $oldvalue, $_newvalue ){
1371
- $default_fields = array(
1372
- 'Default - Name (Heading)',
1373
- 'Default - Contact Info (Heading)',
1374
- 'Default - About Yourself (Heading)',
1375
- 'Default - Username',
1376
- 'Default - First Name',
1377
- 'Default - Last Name',
1378
- 'Default - Nickname',
1379
- 'Default - E-mail',
1380
- 'Default - Website',
1381
- 'Default - AIM',
1382
- 'Default - Yahoo IM',
1383
- 'Default - Jabber / Google Talk',
1384
- 'Default - Password',
1385
- 'Default - Repeat Password',
1386
- 'Default - Biographical Info',
1387
- 'Default - Blog Details',
1388
- 'Default - Display name publicly as'
1389
- );
1390
-
1391
- if ( is_array( $_newvalue ) ){
1392
- foreach ( $_newvalue as $field ){
1393
- if ( in_array($field['field'], $default_fields) ){
1394
- $prefix = 'default_field_';
1395
- } else {
1396
- $prefix = 'custom_field_';
1397
- }
1398
- if (function_exists('icl_register_string')){
1399
- if( !empty( $field['field-title'] ) )
1400
- icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_title_translation' , $field['field-title'] );
1401
- if( !empty( $field['description'] ) )
1402
- icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_description_translation', $field['description'] );
1403
- if( !empty( $field['labels'] ) )
1404
- icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_labels_translation', $field['labels'] );
1405
- if( !empty( $field['default-value'] ) )
1406
- icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_value_translation', $field['default-value'] );
1407
- if( !empty( $field['default-content'] ) )
1408
- icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_content_translation', $field['default-content'] );
1409
- }
1410
- }
1411
- }
1412
- }
1413
-
1414
-
1415
- /*
1416
- * Returns the HTML for a map given the field
1417
- *
1418
- */
1419
- function wppb_get_map_output( $field, $args ) {
1420
-
1421
- $defaults = array(
1422
- 'markers' => array(),
1423
- 'editable' => true,
1424
- 'show_search' => true,
1425
- 'extra_attr' => ''
1426
- );
1427
-
1428
- $args = wp_parse_args( $args, $defaults );
1429
-
1430
- $return = '';
1431
-
1432
- // Search box
1433
- // The style:left=-99999px is set to hide the input from the viewport. It will be rewritten when the map gets initialised
1434
- if ( $args['show_search'] ) {
1435
- $return .= '<input style="left: -99999px" type="text" id="' . $field['meta-name'] . '-search-box" class="wppb-map-search-box" placeholder="' . __( 'Search Location', 'profile-builder' ) . '" />';
1436
- }
1437
-
1438
- $lng = ( ! empty( $field['map-default-lng'] ) ) ? (float) $field['map-default-lng'] : WPPB_DEFAULTS_MAP_LNG;
1439
- $lat = ( ! empty( $field['map-default-lat'] ) ) ? (float) $field['map-default-lat'] : WPPB_DEFAULTS_MAP_LAT;
1440
- $zoom = ( ! empty( $field['map-default-zoom'] ) ) ? (int) $field['map-default-zoom'] : WPPB_DEFAULTS_MAP_ZOOM;
1441
-
1442
- // Get one time the settings.
1443
- $settings = wppb_options_get_map_settings();
1444
- $pin_info = ( ! empty( $args['user_id'] ) ) ? wppb_compute_simple_pin_content_for_user( $args['user_id'], $settings ) : '';
1445
-
1446
- // Map container.
1447
- $return .= '<div id="' . $field['meta-name'] . '" class="wppb-map-container" style="height: ' . $field['map-height'] . 'px;" data-editable="' . ( $args['editable'] ? 1 : 0 ) . '" data-default-zoom="' . $zoom . '" data-default-lat="' . $lat . '" data-default-lng="' . $lng . '" ' . $args['extra_attr'] . '></div>';
1448
-
1449
- if ( ! empty( $args['markers'] ) ) {
1450
- foreach ( $args['markers'] as $marker ) {
1451
- if ( ! empty( $args['user_id'] ) ) {
1452
- // Also compute the marker bubble content.
1453
- $bubble = wppb_get_user_pin_bubble(
1454
- $args['user_id'],
1455
- strstr( $marker, ',', true ),
1456
- ltrim( strstr( $marker, ',' ), ',' ),
1457
- $pin_info,
1458
- ''
1459
- );
1460
- $return .= $bubble;
1461
- }
1462
-
1463
- $return .= '<input name="' . $field['meta-name'] . '[]" type="hidden" class="wppb-map-marker" value="' . $marker . '" />';
1464
- }
1465
- }
1466
-
1467
- return $return;
1468
- }
1469
-
1470
-
1471
- /*
1472
- * Returns all the saved markers for a map field for a particular user
1473
- *
1474
- */
1475
- function wppb_get_user_map_markers( $user_id, $meta_name ) {
1476
-
1477
- global $wpdb;
1478
-
1479
- $meta_name_underlined = $meta_name . '_';
1480
-
1481
- $results = $wpdb->get_results( "SELECT meta_value, meta_key FROM {$wpdb->usermeta} WHERE user_id={$user_id} AND meta_key LIKE '%{$meta_name_underlined}%'", ARRAY_N );
1482
-
1483
- $markers = array();
1484
- $i = 0;
1485
-
1486
- foreach( $results as $key => $result ) {
1487
- $pattern = '/^' . $meta_name . '_[0-9]+$/';
1488
- preg_match( $pattern, $result[1], $matches );
1489
- if ( count ($matches) > 0 ) {
1490
- $markers[$i] = $result[0];
1491
- $i++;
1492
- }
1493
-
1494
- }
1495
- return $markers;
1496
-
1497
- }
1498
-
1499
- /*
1500
- * Deletes from the database all saved markers
1501
- *
1502
- */
1503
- function wppb_delete_user_map_markers( $user_id, $meta_name ) {
1504
-
1505
- global $wpdb;
1506
-
1507
- $meta_name .= '_';
1508
-
1509
- $delete = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id=%d AND meta_key LIKE %s", $user_id, '%' . $meta_name . '%' ) );
1510
-
1511
- wp_cache_delete( $user_id, 'user_meta' );
1512
-
1513
- }
1514
-
1515
- /**
1516
- * Disable the add button again after we added a field
1517
- */
1518
- add_action( 'wck_ajax_add_form_wppb_manage_fields', 'wppb_redisable_the_add_button' );
1519
- function wppb_redisable_the_add_button(){
1520
- ?>
1521
- <script>wppb_disable_add_entry_button ( '#wppb_manage_fields' );</script>
1522
- <?php
1523
- }
1524
-
1525
-
1526
- /**
1527
- * Function that updates the meta_key of a field in the usertmeta table when it was changed for a field. It is turned off by default
1528
- */
1529
- add_action( 'wck_before_update_meta', 'wppb_change_field_meta_key', 10, 4 );
1530
- function wppb_change_field_meta_key( $meta, $id, $values, $element_id ){
1531
- if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
1532
- if ($meta == 'wppb_manage_fields') {
1533
- global $wpdb;
1534
- $wppb_manage_fields = get_option('wppb_manage_fields');
1535
- if (!empty($wppb_manage_fields)) {
1536
- if (!empty($values['meta-name']) && $wppb_manage_fields[$element_id]['meta-name'] != $values['meta-name']) {
1537
- $wpdb->update(
1538
- $wpdb->usermeta,
1539
- array('meta_key' => sanitize_text_field($values['meta-name'])),
1540
- array('meta_key' => sanitize_text_field($wppb_manage_fields[$element_id]['meta-name']))
1541
- );
1542
- }
1543
- }
1544
- }
1545
- }
1546
- }
1547
-
1548
-
1549
-
1550
- if ( ! function_exists( 'wppb_prepare_key_value_options' ) ) {
1551
- /**
1552
- * Convert an array with keys and values into a usable option for the defined fields types.
1553
- *
1554
- * @param arrays $array List of options.
1555
- * @return array Usable options.
1556
- */
1557
- function wppb_prepare_key_value_options( $array = array() ) {
1558
- $result = array();
1559
- if ( ! empty( $array ) ) {
1560
- foreach ( $array as $name => $label ) {
1561
- $result[] = '%' . $label . '%' . $name;
1562
- }
1563
- }
1564
- return $result;
1565
- }
1566
- }
1567
-
1568
- if ( ! function_exists( 'wppb_filter_map_bubble_fields' ) ) {
1569
- /**
1570
- * Filter the map POI's bubble content.
1571
- *
1572
- * @param arrays $tags List of available tags.
1573
- * @return array Filtered and sorted tags.
1574
- */
1575
- function wppb_filter_map_bubble_fields( $tags ) {
1576
- // Attempt to preseve one tag example.
1577
- $maybe_avatar = ( ! empty( $tags['avatar_or_gravatar'] ) ) ? $tags['avatar_or_gravatar'] : false;
1578
-
1579
- // Remove some of the tags.
1580
- unset( $tags['meta_user_name'] );
1581
- unset( $tags['more_info_url'] );
1582
- unset( $tags['avatar_or_gravatar'] );
1583
-
1584
- if ( ! empty( $maybe_avatar ) ) {
1585
- // Perhaps preprend this to the list.
1586
- $tags = array_merge( array( 'avatar_or_gravatar' => $maybe_avatar ), $tags );
1587
- }
1588
-
1589
- return $tags;
1590
- }
1591
- }
1592
- add_filter( 'wppb_map_bubble_fields', 'wppb_filter_map_bubble_fields' );
1593
-
1
+ <?php
2
+ // Define the default values.
3
+ define( 'WPPB_DEFAULTS_MAP_LAT', 48 );
4
+ define( 'WPPB_DEFAULTS_MAP_LNG', 12 );
5
+ define( 'WPPB_DEFAULTS_MAP_ZOOM', 4 );
6
+
7
+ /**
8
+ * Function that creates the Manage Fields submenu and populates it with a repeater field form
9
+ *
10
+ * @since v.2.0
11
+ *
12
+ * @return void
13
+ */
14
+ function wppb_manage_fields_submenu(){
15
+ // create a new sub_menu page which holds the data for the default + extra fields
16
+ $args = array(
17
+ 'menu_title' => __('Form Fields', 'profile-builder'),
18
+ 'page_title' => __('Manage Form Fields', 'profile-builder'),
19
+ 'menu_slug' => 'manage-fields',
20
+ 'page_type' => 'submenu_page',
21
+ 'capability' => 'manage_options',
22
+ 'priority' => 5,
23
+ 'parent_slug' => 'profile-builder'
24
+ );
25
+ $manage_fields_page = new WCK_Page_Creator_PB($args);
26
+ }
27
+ add_action( 'admin_menu', 'wppb_manage_fields_submenu', 1 );
28
+
29
+ function wppb_populate_manage_fields(){
30
+
31
+ $manage_field_types = array(
32
+ 'optgroups' => array(
33
+ 'default' =>
34
+ array(
35
+ 'label' => __('Default'),
36
+ 'options' => array(
37
+ 'Default - Name (Heading)',
38
+ 'Default - Contact Info (Heading)',
39
+ 'Default - About Yourself (Heading)',
40
+ 'Default - Username',
41
+ 'Default - First Name',
42
+ 'Default - Last Name',
43
+ 'Default - Nickname',
44
+ 'Default - E-mail',
45
+ 'Default - Website',
46
+ 'Default - Password',
47
+ 'Default - Repeat Password',
48
+ 'Default - Biographical Info',
49
+ 'Default - Display name publicly as',
50
+ ),
51
+ ),
52
+ 'standard' =>
53
+ array(
54
+ 'label' => __('Standard'),
55
+ 'options' => array(),
56
+ ),
57
+ 'advanced' =>
58
+ array(
59
+ 'label' => __('Advanced'),
60
+ 'options' => array(),
61
+ ),
62
+ 'other' =>
63
+ array(
64
+ 'label' => __('Other'),
65
+ 'options' => array(
66
+ 'GDPR Checkbox', // since 2.8.2
67
+ 'GDPR Delete Button', // since 3.0.1
68
+ ),
69
+ ),
70
+ ),
71
+ );
72
+
73
+ // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
74
+ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
75
+ $manage_field_types['optgroups']['default']['options'][] = 'Default - AIM';
76
+ $manage_field_types['optgroups']['default']['options'][] = 'Default - Yahoo IM';
77
+ $manage_field_types['optgroups']['default']['options'][] = 'Default - Jabber / Google Talk';
78
+ }
79
+
80
+ if ( wppb_can_users_signup_blog() ) {
81
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Default - Blog Details';
82
+ }
83
+
84
+ if( PROFILE_BUILDER != 'Profile Builder Free' ) {
85
+ $manage_field_types['optgroups']['standard']['options'][] = 'Heading';
86
+ $manage_field_types['optgroups']['standard']['options'][] = 'Input';
87
+ $manage_field_types['optgroups']['standard']['options'][] = 'Number';
88
+ $manage_field_types['optgroups']['standard']['options'][] = 'Input (Hidden)';
89
+ $manage_field_types['optgroups']['standard']['options'][] = 'Textarea';
90
+ $manage_field_types['optgroups']['standard']['options'][] = 'WYSIWYG';
91
+ $manage_field_types['optgroups']['standard']['options'][] = 'Select';
92
+ $manage_field_types['optgroups']['standard']['options'][] = 'Select (Multiple)';
93
+ $manage_field_types['optgroups']['standard']['options'][] = 'Checkbox';
94
+ $manage_field_types['optgroups']['standard']['options'][] = 'Radio';
95
+ $manage_field_types['optgroups']['standard']['options'][] = 'HTML';
96
+ $manage_field_types['optgroups']['standard']['options'][] = 'Upload';
97
+ $manage_field_types['optgroups']['standard']['options'][] = 'Avatar';
98
+
99
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Phone';
100
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Country)';
101
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Timezone)';
102
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Select (Currency)';
103
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Select (CPT)';
104
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Checkbox (Terms and Conditions)';
105
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Datepicker';
106
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Timepicker';
107
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Colorpicker';
108
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Validation';
109
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Map';
110
+
111
+ $manage_field_types['optgroups']['other']['options'][] = 'Email';
112
+ $manage_field_types['optgroups']['other']['options'][] = 'URL';
113
+ }
114
+
115
+ /* added recaptcha and user role field since version 2.6.2 */
116
+ $manage_field_types['optgroups']['advanced']['options'][] = 'reCAPTCHA';
117
+ $manage_field_types['optgroups']['advanced']['options'][] = 'Select (User Role)';
118
+
119
+
120
+ $manage_field_types['optgroups']['other']['options'] = apply_filters( 'wppb_manage_fields_types', $manage_field_types['optgroups']['other']['options'] );
121
+
122
+ $manage_field_types = apply_filters( 'wppb_all_manage_fields_types', $manage_field_types );
123
+
124
+ //Free to Pro call to action on Manage Fields page
125
+ $field_description = __('Choose one of the supported field types','profile-builder');
126
+ if( PROFILE_BUILDER == 'Profile Builder Free' ) {
127
+ $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) );
128
+ }
129
+
130
+ //user roles
131
+ global $wp_roles;
132
+
133
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
134
+ $user_roles = array();
135
+ foreach( $wp_roles->roles as $user_role_slug => $user_role )
136
+ if( $user_role_slug !== 'administrator' )
137
+ array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug );
138
+
139
+
140
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
141
+ // country select
142
+ $default_country_array = wppb_country_select_options( 'back_end' );
143
+ foreach( $default_country_array as $iso_country_code => $country_name ) {
144
+ $default_country_options[] = '%'.$country_name.'%'.$iso_country_code;
145
+ }
146
+
147
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
148
+ // currency select
149
+ $default_currency_array = wppb_get_currencies( 'back_end' );
150
+ array_unshift( $default_currency_array, '' );
151
+ foreach( $default_currency_array as $iso_currency_code => $currency_name ) {
152
+ $default_currency_options[] = '%'.$currency_name.'%'.$iso_currency_code;
153
+ }
154
+
155
+ //cpt select
156
+ $post_types = get_post_types( array( 'public' => true ), 'names' );
157
+
158
+
159
+ if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
160
+ $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' );
161
+ }
162
+ else{
163
+ $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this will only affect subsequent entries', 'profile-builder' );
164
+ }
165
+
166
+ // Initiate the list of available tags for the pin bubble.
167
+ if( function_exists( 'wppb_generate_userlisting_merge_tags' ) ) {
168
+ $bubble_meta_tags = wppb_generate_userlisting_merge_tags('meta');
169
+ $bubble_meta_tags = wp_list_pluck($bubble_meta_tags, 'label', 'name');
170
+ }
171
+ else
172
+ $bubble_meta_tags = array();
173
+
174
+ // set up the fields array
175
+ $fields = apply_filters( 'wppb_manage_fields', array(
176
+
177
+ array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ),
178
+ array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profile-builder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => $field_description ),
179
+ array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => $meta_key_description ),
180
+ array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profile-builder' ), 'default' => wppb_get_unique_id(), 'description' => __( "A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder' ), 'readonly' => true ),
181
+ array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profile-builder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder') ),
182
+ array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profile-builder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder' ) ),
183
+ array( 'type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __( 'Allowed Image Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to: .jpg,.jpeg,.gif,.png (.*)', 'profile-builder' ) ),
184
+ array( 'type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __( 'Allowed Upload Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all WordPress allowed file extensions (.*)', 'profile-builder' ) ),
185
+ array( 'type' => 'text', 'slug' => 'avatar-size', 'title' => __( 'Avatar Size', 'profile-builder' ), 'default' => 100, 'description' => __( "Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profile-builder' ) ),
186
+ array( 'type' => 'text', 'slug' => 'date-format', 'title' => __( 'Date-format', 'profile-builder' ), 'default' => 'mm/dd/yy', 'description' => __( 'Specify the format of the date when using Datepicker<br/>Valid options: mm/dd/yy, mm/yy/dd, dd/yy/mm, dd/mm/yy, yy/dd/mm, yy/mm/dd, mm-dd-yy, yy-mm-dd, D, dd M yy, D, d M y, DD, dd-M-y, D, d M yy, @<br/>If not specified, defaults to mm/dd/yy', 'profile-builder' ) ),
187
+ array( 'type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __( 'Terms of Agreement', 'profile-builder' ), 'description' => __( 'Enter a detailed description of the temrs of agreement for the user to read.<br/>Links can be inserted by using standard HTML syntax: &lt;a href="custom_url"&gt;custom_text&lt;/a&gt;', 'profile-builder' ) ),
188
+ array( 'type' => 'text', 'slug' => 'options', 'title' => __( 'Options', 'profile-builder' ), 'description' => __( "Enter a comma separated list of values<br/>This can be anything, as it is hidden from the user, but should not contain special characters or apostrophes", 'profile-builder' ) ),
189
+ array( 'type' => 'text', 'slug' => 'labels', 'title' => __( 'Labels', 'profile-builder' ), 'description' => __( "Enter a comma separated list of labels<br/>Visible for the user", 'profile-builder' ) ),
190
+ array( 'type' => 'select', 'slug' => 'recaptcha-type', 'title' => __( 'reCAPTCHA Type', 'profile-builder' ), 'options' => array('%reCAPTCHA V2%v2', '%Invisible reCAPTCHA%invisible'), 'default' => 'v2', 'description' => __( 'Choose the <a href="https://developers.google.com/recaptcha/docs/versions" target="_blank">type of reCAPTCHA</a> you wish to add to this site.', 'profile-builder' ) ),
191
+ array( 'type' => 'text', 'slug' => 'public-key', 'title' => __( 'Site Key', 'profile-builder' ), 'description' => __( 'The site key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ),
192
+ array( 'type' => 'text', 'slug' => 'private-key', 'title' => __( 'Secret Key', 'profile-builder' ), 'description' => __( 'The secret key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ),
193
+ array( 'type' => 'checkbox', 'slug' => 'captcha-pb-forms', 'title' => __( 'Display on PB forms', 'profile-builder' ), 'options' => array( '%'.__('PB Login','profile-builder').'%'.'pb_login', '%'.__('PB Register','profile-builder').'%'.'pb_register', '%'.__('PB Recover Password','profile-builder').'%'.'pb_recover_password' ), 'default' => 'pb_register', 'description' => __( "Select on which Profile Builder forms to display reCAPTCHA", 'profile-builder' ) ),
194
+ array( 'type' => 'checkbox', 'slug' => 'captcha-wp-forms', 'title' => __( 'Display on default WP forms', 'profile-builder' ), 'options' => array( '%'.__('Default WP Login', 'profile-builder').'%'.'default_wp_login', '%'.__('Default WP Register', 'profile-builder').'%'.'default_wp_register', '%'.__('Default WP Recover Password', 'profile-builder').'%'.'default_wp_recover_password'), 'default' => 'default_wp_register', 'description' => __( "Select on which default WP forms to display reCAPTCHA", 'profile-builder' ) ),
195
+ array( 'type' => 'checkbox', 'slug' => 'user-roles', 'title' => __( 'User Roles', 'profile-builder' ), 'options' => $user_roles, 'description' => __( "Select which user roles to show to the user ( drag and drop to re-order )", 'profile-builder' ) ),
196
+ array( 'type' => 'text', 'slug' => 'user-roles-sort-order', 'title' => __( 'User Roles Order', 'profile-builder' ), 'description' => __( "Save the user role order from the user roles checkboxes", 'profile-builder' ) ),
197
+ array( 'type' => 'text', 'slug' => 'default-value', 'title' => __( 'Default Value', 'profile-builder' ), 'description' => __( "Default value of the field", 'profile-builder' ) ),
198
+ array( 'type' => 'text', 'slug' => 'default-option', 'title' => __( 'Default Option', 'profile-builder' ), 'description' => __( "Specify the option which should be selected by default", 'profile-builder' ) ),
199
+ array( 'type' => 'text', 'slug' => 'default-options', 'title' => __( 'Default Option(s)', 'profile-builder' ), 'description' => __( "Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profile-builder' ) ),
200
+ array( 'type' => 'select', 'slug' => 'default-option-country', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => ( isset( $default_country_options ) ) ? $default_country_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ),
201
+ array( 'type' => 'select', 'slug' => 'default-option-timezone', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => wppb_timezone_select_options( 'back_end' ), 'description' => __( "Default option of the field", 'profile-builder' ) ),
202
+ array( 'type' => 'select', 'slug' => 'default-option-currency', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => ( isset( $default_currency_options ) ) ? $default_currency_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ),
203
+ array( 'type' => 'select', 'slug' => 'show-currency-symbol', 'title' => __( 'Show Currency Symbol', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the currency symbol should be displayed after the currency name in the select option.', 'profile-builder' ) ),
204
+ array( 'type' => 'select', 'slug' => 'cpt', 'title' => __( 'Show Post Type', 'profile-builder' ), 'options' => $post_types, 'default' => 'post', 'description' => __( 'Posts from what post type will be displayed in the select.', 'profile-builder' ) ),
205
+ array( 'type' => 'text', 'slug' => 'validation-possible-values', 'title' => __( 'Allowable Values', 'profile-builder' ), 'description' => __( "Enter a comma separated list of possible values. Upon registration if the value provided by the user does not match one of these values, the user will not be registered.", 'profile-builder' ) ),
206
+ array( 'type' => 'text', 'slug' => 'custom-error-message', 'title' => __( 'Error Message', 'profile-builder' ), 'description' => __( "Set a custom error message that will be displayed to the user.", 'profile-builder' ) ),
207
+ array( 'type' => 'select', 'slug' => 'time-format', 'title' => __( 'Time Format', 'profile-builder' ), 'options' => array( '%12 Hours%12', '%24 Hours%24' ), 'description' => __( 'Specify the time format.', 'profile-builder' ) ),
208
+ array( 'type' => 'text', 'slug' => 'map-api-key', 'title' => __( 'Google Maps API Key', 'profile-builder' ), 'description' => __( 'Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder' ) ),
209
+
210
+ array(
211
+ 'type' => 'text',
212
+ 'slug' => 'map-default-lat',
213
+ 'title' => __( 'Default Latitude', 'profile-builder' ),
214
+ 'description' => __( 'The latitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
215
+ 'default' => WPPB_DEFAULTS_MAP_LAT,
216
+ ),
217
+ array(
218
+ 'type' => 'text',
219
+ 'slug' => 'map-default-lng',
220
+ 'title' => __( 'Default Longitude', 'profile-builder' ),
221
+ 'description' => __( 'The longitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
222
+ 'default' => WPPB_DEFAULTS_MAP_LNG,
223
+ ),
224
+ array(
225
+ 'type' => 'text',
226
+ 'slug' => 'map-default-zoom',
227
+ 'title' => __( 'Default Zoom Level', 'profile-builder' ),
228
+ 'description' => __( 'Add a number from 0 to 19. The higher the number the higher the zoom.', 'profile-builder' ),
229
+ 'default' => WPPB_DEFAULTS_MAP_ZOOM,
230
+ ),
231
+
232
+ array( 'type' => 'text', 'slug' => 'map-height', 'title' => __( 'Map Height', 'profile-builder' ), 'description' => __( "The height of the map.", 'profile-builder' ), 'default' => 400 ),
233
+ array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ),
234
+ array( 'type' => 'textarea', 'slug' => 'html-content', 'title' => __( 'HTML Content', 'profile-builder' ), 'description' => __( "Add your HTML (or text) content", 'profile-builder' ) ),
235
+ array( 'type' => 'text', 'slug' => 'phone-format', 'title' => __( 'Phone Format', 'profile-builder' ), 'default' => '(###) ###-####', 'description' => __( "You can use: # for numbers, parentheses ( ), - sign, + sign, dot . and spaces.", 'profile-builder' ) .'<br>'. __( "Eg. (###) ###-####", 'profile-builder' ) .'<br>'. __( "Empty field won't check for correct phone number.", 'profile-builder' ) ),
236
+ array( 'type' => 'select', 'slug' => 'heading-tag', 'title' => __( 'Heading Tag', 'profile-builder' ), 'options' => array( '%h1 - biggest size%h1', 'h2', 'h3', 'h4', 'h5', '%h6 - smallest size%h6' ), 'default' => 'h4', 'description' => __( 'Change heading field size on front-end forms', 'profile-builder' ) ),
237
+ array( 'type' => 'text', 'slug' => 'min-number-value', 'title' => __( 'Min Number Value', 'profile-builder' ), 'description' => __( "Min allowed number value (0 to allow only positive numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no min value", 'profile-builder' ) ),
238
+ array( 'type' => 'text', 'slug' => 'max-number-value', 'title' => __( 'Max Number Value', 'profile-builder' ), 'description' => __( "Max allowed number value (0 to allow only negative numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no max value", 'profile-builder' ) ),
239
+ array( 'type' => 'text', 'slug' => 'number-step-value', 'title' => __( 'Number Step Value', 'profile-builder' ), 'description' => __( "Step value 1 to allow only integers, 0.1 to allow integers and numbers with 1 decimal", 'profile-builder' ) .'<br>'. __( "To allow multiple decimals use for eg. 0.01 (for 2 deciamls) and so on", 'profile-builder' ) .'<br>'. __( "You can also use step value to specify the legal number intervals (eg. step value 2 will allow only -4, -2, 0, 2 and so on)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no restriction", 'profile-builder' ) ),
240
+ array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ),
241
+ array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ),
242
+
243
+ // Added the new option for the map field type, that allows to customize the POIs load type.
244
+ array(
245
+ 'type' => 'select',
246
+ 'slug' => 'map-pins-load-type',
247
+ 'title' => __( 'POIs Load Type', 'profile-builder' ),
248
+ 'options' => array(
249
+ '%' . __( 'POIs of the listed users (as filtered & paginated)', 'profile-builder' ) . '%',
250
+ '%' . __( 'POIs of all the users for the filter* (no pagination)', 'profile-builder' ) . '%all',
251
+ ),
252
+ 'default' => '',
253
+ 'description' => __( 'This option allows you to load on a single map the POIs for all users, or just these for the listed ones (this will take into account the filters and the faceted menus). *Please use this feature wisely, it will impact the performance.', 'profile-builder' ),
254
+ ),
255
+
256
+ // Added the new option for the map field type, that allows to customize the POI bubble content.
257
+ array(
258
+ 'type' => 'checkbox',
259
+ 'slug' => 'map-bubble-fields',
260
+ 'title' => __( 'POI Bubble Info', 'profile-builder' ),
261
+ 'options' => wppb_prepare_key_value_options( apply_filters( 'wppb_map_bubble_fields', $bubble_meta_tags ) ),
262
+ 'default' => 'avatar_or_gravatar, meta_display_name',
263
+ 'description' => __( 'Select the attributes to be listed inside the POI bubble.', 'profile-builder' ),
264
+ 'extra_attributes' => array(
265
+ 'dropdown_options' => true,
266
+ 'sortable_options' => true,
267
+ ),
268
+ ),
269
+
270
+ // Added the new option for the map field type, that allows to customize the number of users per iteration.
271
+ array(
272
+ 'type' => 'text',
273
+ 'slug' => 'map-pagination-number',
274
+ 'title' => __( 'Number of Users per Map Iteration', 'profile-builder' ),
275
+ 'description' => __( 'When loading the map of all users with no pagination, the map script will iterate multiple times and will expose gradually POIs on the map, until all the POIs for the users that match the criteria will be added on the map (think of this as of pagination for the map POIs). The smaller the number of users per iteration, the fastest the iteration response will be, but for a large number of users, the map script will iterate multiple times. Setting a higher limit will decrease the performance, but might produce a smaller number of iterations. <br><br><b>Please adjust this value to your hosting capabilities, and make sure that the value you set is the best for performance.</b> We recommend a <b>maximum</b> value of 300.', 'profile-builder' ),
276
+ 'default' => 50,
277
+ ),
278
+ ) );
279
+
280
+ // create the new submenu with the above options
281
+ $args = array(
282
+ 'metabox_id' => 'manage-fields',
283
+ 'metabox_title' => __( 'Form Field Properties', 'profile-builder' ),
284
+ 'post_type' => 'manage-fields',
285
+ 'meta_name' => 'wppb_manage_fields',
286
+ 'meta_array' => $fields,
287
+ 'context' => 'option'
288
+ );
289
+ new Wordpress_Creation_Kit_PB( $args );
290
+
291
+ /* this is redundant but it should have a very low impact and for comfort we leave it here as well */
292
+ wppb_prepopulate_fields();
293
+
294
+ // create the info side meta-box
295
+ $args = array(
296
+ 'metabox_id' => 'manage-fields-info',
297
+ 'metabox_title' => __( 'Registration & Edit Profile Forms', 'profile-builder' ),
298
+ 'post_type' => 'manage-fields',
299
+ 'meta_name' => 'wppb_manage_fields_info',
300
+ 'meta_array' => '',
301
+ 'context' => 'option',
302
+ 'mb_context' => 'side'
303
+ );
304
+ new Wordpress_Creation_Kit_PB( $args );
305
+ }
306
+ add_action( 'admin_init', 'wppb_populate_manage_fields', 1 );
307
+
308
+ /**
309
+ * Function that prepopulates the manage fields list with the default fields of WP
310
+ *
311
+ * @since v.2.0
312
+ *
313
+ * @return void
314
+ */
315
+ function wppb_prepopulate_fields(){
316
+ $prepopulated_fields[] = array( 'field' => 'Default - Name (Heading)', 'field-title' => __( 'Name', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '1', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
317
+ $prepopulated_fields[] = array( 'field' => 'Default - Username', 'field-title' => __( 'Username', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '2', 'description' => __( 'Usernames cannot be changed.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
318
+ $prepopulated_fields[] = array( 'field' => 'Default - First Name', 'field-title' => __( 'First Name', 'profile-builder' ), 'meta-name' => 'first_name', 'overwrite-existing' => 'No', 'id' => '3', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
319
+ $prepopulated_fields[] = array( 'field' => 'Default - Last Name', 'field-title' => __( 'Last Name', 'profile-builder' ), 'meta-name' => 'last_name', 'overwrite-existing' => 'No', 'id' => '4', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
320
+ $prepopulated_fields[] = array( 'field' => 'Default - Nickname', 'field-title' => __( 'Nickname', 'profile-builder' ), 'meta-name' => 'nickname', 'overwrite-existing' => 'No', 'id' => '5', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
321
+ $prepopulated_fields[] = array( 'field' => 'Default - Display name publicly as', 'field-title' => __( 'Display name publicly as', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '6', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
322
+ $prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '7', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
323
+ $prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '8', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
324
+ $prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '9', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
325
+
326
+ // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
327
+ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
328
+ $prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profile-builder' ), 'meta-name' => 'aim', 'overwrite-existing' => 'No', 'id' => '10', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
329
+ $prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profile-builder' ), 'meta-name' => 'yim', 'overwrite-existing' => 'No', 'id' => '11', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
330
+ $prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profile-builder' ), 'meta-name' => 'jabber', 'overwrite-existing' => 'No', 'id' => '12', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
331
+ }
332
+
333
+ $prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '13', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
334
+ $prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profile-builder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'required' => 'No' );
335
+ $prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
336
+ $prepopulated_fields[] = array( 'field' => 'Default - Repeat Password', 'field-title' => __( 'Repeat Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '16', 'description' => __( 'Type your password again. ', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
337
+ if ( wppb_can_users_signup_blog() ){
338
+ $prepopulated_fields[] = array( 'field' => 'Default - Blog Details', 'field-title' => __( 'Blog Details', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '17', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
339
+ }
340
+
341
+ add_option ( 'wppb_manage_fields', apply_filters ( 'wppb_prepopulated_fields', $prepopulated_fields ) );
342
+ }
343
+
344
+ /**
345
+ * Function that returns a unique meta-name
346
+ *
347
+ * @since v.2.0
348
+ *
349
+ * @return string
350
+ */
351
+ function wppb_get_meta_name( $option = 'wppb_manage_fields', $prefix = 'custom_field_' ){
352
+ $id = 1;
353
+
354
+ $wppb_manage_fields = get_option( $option, 'not_found' );
355
+
356
+ if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){
357
+ return $prefix . $id;
358
+ }
359
+ else{
360
+ $meta_names = array();
361
+ foreach( $wppb_manage_fields as $value ){
362
+ if ( strpos( $value['meta-name'], $prefix ) === 0 ){
363
+ $meta_names[] = $value['meta-name'];
364
+ }
365
+ }
366
+
367
+ if( !empty( $meta_names ) ){
368
+ $meta_numbers = array();
369
+ foreach( $meta_names as $meta_name ){
370
+ $number = str_replace( $prefix, '', $meta_name );
371
+ /* we should have an underscore present in custom_field_# so remove it */
372
+ $number = str_replace( '_', '', $number );
373
+
374
+ $meta_numbers[] = $number;
375
+ }
376
+ if( !empty( $meta_numbers ) ){
377
+ rsort( $meta_numbers );
378
+ $id = (int)$meta_numbers[0] + 1;
379
+ }
380
+ }
381
+
382
+ return $prefix . $id;
383
+ }
384
+ }
385
+
386
+
387
+ /**
388
+ * Function that returns an array with countries
389
+ *
390
+ * @since v.2.0
391
+ *
392
+ * @return array
393
+ */
394
+ function wppb_country_select_options( $form_location ) {
395
+ $country_array = apply_filters( 'wppb_'.$form_location.'_country_select_array',
396
+ array(
397
+ '' => __( 'Select a Country', 'profile-builder' ),
398
+ 'AF' => __( 'Afghanistan', 'profile-builder' ),
399
+ 'AX' => __( 'Aland Islands', 'profile-builder' ),
400
+ 'AL' => __( 'Albania', 'profile-builder' ),
401
+ 'DZ' => __( 'Algeria', 'profile-builder' ),
402
+ 'AS' => __( 'American Samoa', 'profile-builder' ),
403
+ 'AD' => __( 'Andorra', 'profile-builder' ),
404
+ 'AO' => __( 'Angola', 'profile-builder' ),
405
+ 'AI' => __( 'Anguilla', 'profile-builder' ),
406
+ 'AQ' => __( 'Antarctica', 'profile-builder' ),
407
+ 'AG' => __( 'Antigua and Barbuda', 'profile-builder' ),
408
+ 'AR' => __( 'Argentina', 'profile-builder' ),
409
+ 'AM' => __( 'Armenia', 'profile-builder' ),
410
+ 'AW' => __( 'Aruba', 'profile-builder' ),
411
+ 'AU' => __( 'Australia', 'profile-builder' ),
412
+ 'AT' => __( 'Austria', 'profile-builder' ),
413
+ 'AZ' => __( 'Azerbaijan', 'profile-builder' ),
414
+ 'BS' => __( 'Bahamas', 'profile-builder' ),
415
+ 'BH' => __( 'Bahrain', 'profile-builder' ),
416
+ 'BD' => __( 'Bangladesh', 'profile-builder' ),
417
+ 'BB' => __( 'Barbados', 'profile-builder' ),
418
+ 'BY' => __( 'Belarus', 'profile-builder' ),
419
+ 'BE' => __( 'Belgium', 'profile-builder' ),
420
+ 'BZ' => __( 'Belize', 'profile-builder' ),
421
+ 'BJ' => __( 'Benin', 'profile-builder' ),
422
+ 'BM' => __( 'Bermuda', 'profile-builder' ),
423
+ 'BT' => __( 'Bhutan', 'profile-builder' ),
424
+ 'BO' => __( 'Bolivia', 'profile-builder' ),
425
+ 'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'profile-builder' ),
426
+ 'BA' => __( 'Bosnia and Herzegovina', 'profile-builder' ),
427
+ 'BW' => __( 'Botswana', 'profile-builder' ),
428
+ 'BV' => __( 'Bouvet Island', 'profile-builder' ),
429
+ 'BR' => __( 'Brazil', 'profile-builder' ),
430
+ 'IO' => __( 'British Indian Ocean Territory', 'profile-builder' ),
431
+ 'VG' => __( 'British Virgin Islands', 'profile-builder' ),
432
+ 'BN' => __( 'Brunei', 'profile-builder' ),
433
+ 'BG' => __( 'Bulgaria', 'profile-builder' ),
434
+ 'BF' => __( 'Burkina Faso', 'profile-builder' ),
435
+ 'BI' => __( 'Burundi', 'profile-builder' ),
436
+ 'KH' => __( 'Cambodia', 'profile-builder' ),
437
+ 'CM' => __( 'Cameroon', 'profile-builder' ),
438
+ 'CA' => __( 'Canada', 'profile-builder' ),
439
+ 'CV' => __( 'Cape Verde', 'profile-builder' ),
440
+ 'KY' => __( 'Cayman Islands', 'profile-builder' ),
441
+ 'CF' => __( 'Central African Republic', 'profile-builder' ),
442
+ 'TD' => __( 'Chad', 'profile-builder' ),
443
+ 'CL' => __( 'Chile', 'profile-builder' ),
444
+ 'CN' => __( 'China', 'profile-builder' ),
445
+ 'CX' => __( 'Christmas Island', 'profile-builder' ),
446
+ 'CC' => __( 'Cocos Islands', 'profile-builder' ),
447
+ 'CO' => __( 'Colombia', 'profile-builder' ),
448
+ 'KM' => __( 'Comoros', 'profile-builder' ),
449
+ 'CK' => __( 'Cook Islands', 'profile-builder' ),
450
+ 'CR' => __( 'Costa Rica', 'profile-builder' ),
451
+ 'HR' => __( 'Croatia', 'profile-builder' ),
452
+ 'CU' => __( 'Cuba', 'profile-builder' ),
453
+ 'CW' => __( 'Curacao', 'profile-builder' ),
454
+ 'CY' => __( 'Cyprus', 'profile-builder' ),
455
+ 'CZ' => __( 'Czech Republic', 'profile-builder' ),
456
+ 'CD' => __( 'Democratic Republic of the Congo', 'profile-builder' ),
457
+ 'DK' => __( 'Denmark', 'profile-builder' ),
458
+ 'DJ' => __( 'Djibouti', 'profile-builder' ),
459
+ 'DM' => __( 'Dominica', 'profile-builder' ),
460
+ 'DO' => __( 'Dominican Republic', 'profile-builder' ),
461
+ 'TL' => __( 'East Timor', 'profile-builder' ),
462
+ 'EC' => __( 'Ecuador', 'profile-builder' ),
463
+ 'EG' => __( 'Egypt', 'profile-builder' ),
464
+ 'SV' => __( 'El Salvador', 'profile-builder' ),
465
+ 'GQ' => __( 'Equatorial Guinea', 'profile-builder' ),
466
+ 'ER' => __( 'Eritrea', 'profile-builder' ),
467
+ 'EE' => __( 'Estonia', 'profile-builder' ),
468
+ 'ET' => __( 'Ethiopia', 'profile-builder' ),
469
+ 'FK' => __( 'Falkland Islands', 'profile-builder' ),
470
+ 'FO' => __( 'Faroe Islands', 'profile-builder' ),
471
+ 'FJ' => __( 'Fiji', 'profile-builder' ),
472
+ 'FI' => __( 'Finland', 'profile-builder' ),
473
+ 'FR' => __( 'France', 'profile-builder' ),
474
+ 'GF' => __( 'French Guiana', 'profile-builder' ),
475
+ 'PF' => __( 'French Polynesia', 'profile-builder' ),
476
+ 'TF' => __( 'French Southern Territories', 'profile-builder' ),
477
+ 'GA' => __( 'Gabon', 'profile-builder' ),
478
+ 'GM' => __( 'Gambia', 'profile-builder' ),
479
+ 'GE' => __( 'Georgia', 'profile-builder' ),
480
+ 'DE' => __( 'Germany', 'profile-builder' ),
481
+ 'GH' => __( 'Ghana', 'profile-builder' ),
482
+ 'GI' => __( 'Gibraltar', 'profile-builder' ),
483
+ 'GR' => __( 'Greece', 'profile-builder' ),
484
+ 'GL' => __( 'Greenland', 'profile-builder' ),
485
+ 'GD' => __( 'Grenada', 'profile-builder' ),
486
+ 'GP' => __( 'Guadeloupe', 'profile-builder' ),
487
+ 'GU' => __( 'Guam', 'profile-builder' ),
488
+ 'GT' => __( 'Guatemala', 'profile-builder' ),
489
+ 'GG' => __( 'Guernsey', 'profile-builder' ),
490
+ 'GN' => __( 'Guinea', 'profile-builder' ),
491
+ 'GW' => __( 'Guinea-Bissau', 'profile-builder' ),
492
+ 'GY' => __( 'Guyana', 'profile-builder' ),
493
+ 'HT' => __( 'Haiti', 'profile-builder' ),
494
+ 'HM' => __( 'Heard Island and McDonald Islands', 'profile-builder' ),
495
+ 'HN' => __( 'Honduras', 'profile-builder' ),
496
+ 'HK' => __( 'Hong Kong', 'profile-builder' ),
497
+ 'HU' => __( 'Hungary', 'profile-builder' ),
498
+ 'IS' => __( 'Iceland', 'profile-builder' ),
499
+ 'IN' => __( 'India', 'profile-builder' ),
500
+ 'ID' => __( 'Indonesia', 'profile-builder' ),
501
+ 'IR' => __( 'Iran', 'profile-builder' ),
502
+ 'IQ' => __( 'Iraq', 'profile-builder' ),
503
+ 'IE' => __( 'Ireland', 'profile-builder' ),
504
+ 'IM' => __( 'Isle of Man', 'profile-builder' ),
505
+ 'IL' => __( 'Israel', 'profile-builder' ),
506
+ 'IT' => __( 'Italy', 'profile-builder' ),
507
+ 'CI' => __( 'Ivory Coast', 'profile-builder' ),
508
+ 'JM' => __( 'Jamaica', 'profile-builder' ),
509
+ 'JP' => __( 'Japan', 'profile-builder' ),
510
+ 'JE' => __( 'Jersey', 'profile-builder' ),
511
+ 'JO' => __( 'Jordan', 'profile-builder' ),
512
+ 'KZ' => __( 'Kazakhstan', 'profile-builder' ),
513
+ 'KE' => __( 'Kenya', 'profile-builder' ),
514
+ 'KI' => __( 'Kiribati', 'profile-builder' ),
515
+ 'XK' => __( 'Kosovo', 'profile-builder' ),
516
+ 'KW' => __( 'Kuwait', 'profile-builder' ),
517
+ 'KG' => __( 'Kyrgyzstan', 'profile-builder' ),
518
+ 'LA' => __( 'Laos', 'profile-builder' ),
519
+ 'LV' => __( 'Latvia', 'profile-builder' ),
520
+ 'LB' => __( 'Lebanon', 'profile-builder' ),
521
+ 'LS' => __( 'Lesotho', 'profile-builder' ),
522
+ 'LR' => __( 'Liberia', 'profile-builder' ),
523
+ 'LY' => __( 'Libya', 'profile-builder' ),
524
+ 'LI' => __( 'Liechtenstein', 'profile-builder' ),
525
+ 'LT' => __( 'Lithuania', 'profile-builder' ),
526
+ 'LU' => __( 'Luxembourg', 'profile-builder' ),
527
+ 'MO' => __( 'Macao', 'profile-builder' ),
528
+ 'MK' => __( 'Macedonia', 'profile-builder' ),
529
+ 'MG' => __( 'Madagascar', 'profile-builder' ),
530
+ 'MW' => __( 'Malawi', 'profile-builder' ),
531
+ 'MY' => __( 'Malaysia', 'profile-builder' ),
532
+ 'MV' => __( 'Maldives', 'profile-builder' ),
533
+ 'ML' => __( 'Mali', 'profile-builder' ),
534
+ 'MT' => __( 'Malta', 'profile-builder' ),
535
+ 'MH' => __( 'Marshall Islands', 'profile-builder' ),
536
+ 'MQ' => __( 'Martinique', 'profile-builder' ),
537
+ 'MR' => __( 'Mauritania', 'profile-builder' ),
538
+ 'MU' => __( 'Mauritius', 'profile-builder' ),
539
+ 'YT' => __( 'Mayotte', 'profile-builder' ),
540
+ 'MX' => __( 'Mexico', 'profile-builder' ),
541
+ 'FM' => __( 'Micronesia', 'profile-builder' ),
542
+ 'MD' => __( 'Moldova', 'profile-builder' ),
543
+ 'MC' => __( 'Monaco', 'profile-builder' ),
544
+ 'MN' => __( 'Mongolia', 'profile-builder' ),
545
+ 'ME' => __( 'Montenegro', 'profile-builder' ),
546
+ 'MS' => __( 'Montserrat', 'profile-builder' ),
547
+ 'MA' => __( 'Morocco', 'profile-builder' ),
548
+ 'MZ' => __( 'Mozambique', 'profile-builder' ),
549
+ 'MM' => __( 'Myanmar', 'profile-builder' ),
550
+ 'NA' => __( 'Namibia', 'profile-builder' ),
551
+ 'NR' => __( 'Nauru', 'profile-builder' ),
552
+ 'NP' => __( 'Nepal', 'profile-builder' ),
553
+ 'NL' => __( 'Netherlands', 'profile-builder' ),
554
+ 'NC' => __( 'New Caledonia', 'profile-builder' ),
555
+ 'NZ' => __( 'New Zealand', 'profile-builder' ),
556
+ 'NI' => __( 'Nicaragua', 'profile-builder' ),
557
+ 'NE' => __( 'Niger', 'profile-builder' ),
558
+ 'NG' => __( 'Nigeria', 'profile-builder' ),
559
+ 'NU' => __( 'Niue', 'profile-builder' ),
560
+ 'NF' => __( 'Norfolk Island', 'profile-builder' ),
561
+ 'KP' => __( 'North Korea', 'profile-builder' ),
562
+ 'MP' => __( 'Northern Mariana Islands', 'profile-builder' ),
563
+ 'NO' => __( 'Norway', 'profile-builder' ),
564
+ 'OM' => __( 'Oman', 'profile-builder' ),
565
+ 'PK' => __( 'Pakistan', 'profile-builder' ),
566
+ 'PW' => __( 'Palau', 'profile-builder' ),
567
+ 'PS' => __( 'Palestinian Territory', 'profile-builder' ),
568
+ 'PA' => __( 'Panama', 'profile-builder' ),
569
+ 'PG' => __( 'Papua New Guinea', 'profile-builder' ),
570
+ 'PY' => __( 'Paraguay', 'profile-builder' ),
571
+ 'PE' => __( 'Peru', 'profile-builder' ),
572
+ 'PH' => __( 'Philippines', 'profile-builder' ),
573
+ 'PN' => __( 'Pitcairn', 'profile-builder' ),
574
+ 'PL' => __( 'Poland', 'profile-builder' ),
575
+ 'PT' => __( 'Portugal', 'profile-builder' ),
576
+ 'PR' => __( 'Puerto Rico', 'profile-builder' ),
577
+ 'QA' => __( 'Qatar', 'profile-builder' ),
578
+ 'CG' => __( 'Republic of the Congo', 'profile-builder' ),
579
+ 'RE' => __( 'Reunion', 'profile-builder' ),
580
+ 'RO' => __( 'Romania', 'profile-builder' ),
581
+ 'RU' => __( 'Russia', 'profile-builder' ),
582
+ 'RW' => __( 'Rwanda', 'profile-builder' ),
583
+ 'BL' => __( 'Saint Barthelemy', 'profile-builder' ),
584
+ 'SH' => __( 'Saint Helena', 'profile-builder' ),
585
+ 'KN' => __( 'Saint Kitts and Nevis', 'profile-builder' ),
586
+ 'LC' => __( 'Saint Lucia', 'profile-builder' ),
587
+ 'MF' => __( 'Saint Martin', 'profile-builder' ),
588
+ 'PM' => __( 'Saint Pierre and Miquelon', 'profile-builder' ),
589
+ 'VC' => __( 'Saint Vincent and the Grenadines', 'profile-builder' ),
590
+ 'WS' => __( 'Samoa', 'profile-builder' ),
591
+ 'SM' => __( 'San Marino', 'profile-builder' ),
592
+ 'ST' => __( 'Sao Tome and Principe', 'profile-builder' ),
593
+ 'SA' => __( 'Saudi Arabia', 'profile-builder' ),
594
+ 'SN' => __( 'Senegal', 'profile-builder' ),
595
+ 'RS' => __( 'Serbia', 'profile-builder' ),
596
+ 'SC' => __( 'Seychelles', 'profile-builder' ),
597
+ 'SL' => __( 'Sierra Leone', 'profile-builder' ),
598
+ 'SG' => __( 'Singapore', 'profile-builder' ),
599
+ 'SX' => __( 'Sint Maarten', 'profile-builder' ),
600
+ 'SK' => __( 'Slovakia', 'profile-builder' ),
601
+ 'SI' => __( 'Slovenia', 'profile-builder' ),
602
+ 'SB' => __( 'Solomon Islands', 'profile-builder' ),
603
+ 'SO' => __( 'Somalia', 'profile-builder' ),
604
+ 'ZA' => __( 'South Africa', 'profile-builder' ),
605
+ 'GS' => __( 'South Georgia and the South Sandwich Islands', 'profile-builder' ),
606
+ 'KR' => __( 'South Korea', 'profile-builder' ),
607
+ 'SS' => __( 'South Sudan', 'profile-builder' ),
608
+ 'ES' => __( 'Spain', 'profile-builder' ),
609
+ 'LK' => __( 'Sri Lanka', 'profile-builder' ),
610
+ 'SD' => __( 'Sudan', 'profile-builder' ),
611
+ 'SR' => __( 'Suriname', 'profile-builder' ),
612
+ 'SJ' => __( 'Svalbard and Jan Mayen', 'profile-builder' ),
613
+ 'SZ' => __( 'Swaziland', 'profile-builder' ),
614
+ 'SE' => __( 'Sweden', 'profile-builder' ),
615
+ 'CH' => __( 'Switzerland', 'profile-builder' ),
616
+ 'SY' => __( 'Syria', 'profile-builder' ),
617
+ 'TW' => __( 'Taiwan', 'profile-builder' ),
618
+ 'TJ' => __( 'Tajikistan', 'profile-builder' ),
619
+ 'TZ' => __( 'Tanzania', 'profile-builder' ),
620
+ 'TH' => __( 'Thailand', 'profile-builder' ),
621
+ 'TG' => __( 'Togo', 'profile-builder' ),
622
+ 'TK' => __( 'Tokelau', 'profile-builder' ),
623
+ 'TO' => __( 'Tonga', 'profile-builder' ),
624
+ 'TT' => __( 'Trinidad and Tobago', 'profile-builder' ),
625
+ 'TN' => __( 'Tunisia', 'profile-builder' ),
626
+ 'TR' => __( 'Turkey', 'profile-builder' ),
627
+ 'TM' => __( 'Turkmenistan', 'profile-builder' ),
628
+ 'TC' => __( 'Turks and Caicos Islands', 'profile-builder' ),
629
+ 'TV' => __( 'Tuvalu', 'profile-builder' ),
630
+ 'VI' => __( 'U.S. Virgin Islands', 'profile-builder' ),
631
+ 'UG' => __( 'Uganda', 'profile-builder' ),
632
+ 'UA' => __( 'Ukraine', 'profile-builder' ),
633
+ 'AE' => __( 'United Arab Emirates', 'profile-builder' ),
634
+ 'GB' => __( 'United Kingdom', 'profile-builder' ),
635
+ 'US' => __( 'United States', 'profile-builder' ),
636
+ 'UM' => __( 'United States Minor Outlying Islands', 'profile-builder' ),
637
+ 'UY' => __( 'Uruguay', 'profile-builder' ),
638
+ 'UZ' => __( 'Uzbekistan', 'profile-builder' ),
639
+ 'VU' => __( 'Vanuatu', 'profile-builder' ),
640
+ 'VA' => __( 'Vatican', 'profile-builder' ),
641
+ 'VE' => __( 'Venezuela', 'profile-builder' ),
642
+ 'VN' => __( 'Vietnam', 'profile-builder' ),
643
+ 'WF' => __( 'Wallis and Futuna', 'profile-builder' ),
644
+ 'EH' => __( 'Western Sahara', 'profile-builder' ),
645
+ 'YE' => __( 'Yemen', 'profile-builder' ),
646
+ 'ZM' => __( 'Zambia', 'profile-builder' ),
647
+ 'ZW' => __( 'Zimbabwe', 'profile-builder' ),
648
+ )
649
+ );
650
+
651
+ return $country_array;
652
+ }
653
+
654
+
655
+ /**
656
+ * Function that returns an array with timezone options
657
+ *
658
+ * @since v.2.0
659
+ *
660
+ * @return array
661
+ */
662
+ function wppb_timezone_select_options( $form_location ) {
663
+ $timezone_array = apply_filters( 'wppb_'.$form_location.'_timezone_select_array', array ( '(GMT -12:00) Eniwetok, Kwajalein', '(GMT -11:00) Midway Island, Samoa', '(GMT -10:00) Hawaii', '(GMT -9:00) Alaska', '(GMT -8:00) Pacific Time (US & Canada)', '(GMT -7:00) Mountain Time (US & Canada)', '(GMT -6:00) Central Time (US & Canada), Mexico City', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '(GMT -3:30) Newfoundland', '(GMT -3:00) Brazil, Buenos Aires, Georgetown', '(GMT -2:00) Mid-Atlantic', '(GMT -1:00) Azores, Cape Verde Islands', '(GMT) Western Europe Time, London, Lisbon, Casablanca', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris', '(GMT +2:00) Kaliningrad, South Africa', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg', '(GMT +3:30) Tehran', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '(GMT +4:30) Kabul', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi', '(GMT +5:45) Kathmandu', '(GMT +6:00) Almaty, Dhaka, Colombo', '(GMT +7:00) Bangkok, Hanoi, Jakarta', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk', '(GMT +9:30) Adelaide, Darwin', '(GMT +10:00) Eastern Australia, Guam, Vladivostok', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka' ) );
664
+
665
+ return $timezone_array;
666
+ }
667
+
668
+
669
+ /*
670
+ * Array with the currency ISO code and associated currency name
671
+ *
672
+ * @param string $form_location
673
+ *
674
+ * @return array
675
+ *
676
+ */
677
+ function wppb_get_currencies( $form_location = '' ) {
678
+
679
+ $currencies = array(
680
+ 'ALL' => __( 'Albania Lek', 'profile-builder' ),
681
+ 'AFN' => __( 'Afghanistan Afghani', 'profile-builder' ),
682
+ 'ARS' => __( 'Argentina Peso', 'profile-builder' ),
683
+ 'AWG' => __( 'Aruba Guilder', 'wkc' ),
684
+ 'AUD' => __( 'Australia Dollar', 'profile-builder' ),
685
+ 'AZN' => __( 'Azerbaijan New Manat', 'profile-builder' ),
686
+ 'BSD' => __( 'Bahamas Dollar', 'profile-builder' ),
687
+ 'BBD' => __( 'Barbados Dollar','profile-builder' ),
688
+ 'BDT' => __( 'Bangladeshi taka','profile-builder' ),
689
+ 'BYR' => __( 'Belarus Ruble','profile-builder' ),
690
+ 'BZD' => __( 'Belize Dollar','profile-builder' ),
691
+ 'BMD' => __( 'Bermuda Dollar','profile-builder' ),
692
+ 'BOB' => __( 'Bolivia Boliviano','profile-builder' ),
693
+ 'BAM' => __( 'Bosnia and Herzegovina Convertible Marka','profile-builder' ),
694
+ 'BWP' => __( 'Botswana Pula','profile-builder' ),
695
+ 'BGN' => __( 'Bulgaria Lev','profile-builder' ),
696
+ 'BRL' => __( 'Brazil Real','profile-builder' ),
697
+ 'BND' => __( 'Brunei Darussalam Dollar','profile-builder' ),
698
+ 'KHR' => __( 'Cambodia Riel','profile-builder' ),
699
+ 'CAD' => __( 'Canada Dollar','profile-builder' ),
700
+ 'KYD' => __( 'Cayman Islands Dollar','profile-builder' ),
701
+ 'CLP' => __( 'Chile Peso','profile-builder' ),
702
+ 'CNY' => __( 'China Yuan Renminbi','profile-builder' ),
703
+ 'COP' => __( 'Colombia Peso','profile-builder' ),
704
+ 'CRC' => __( 'Costa Rica Colon','profile-builder' ),
705
+ 'HRK' => __( 'Croatia Kuna','profile-builder' ),
706
+ 'CUP' => __( 'Cuba Peso','profile-builder' ),
707
+ 'CZK' => __( 'Czech Republic Koruna','profile-builder' ),
708
+ 'DKK' => __( 'Denmark Krone','profile-builder' ),
709
+ 'DOP' => __( 'Dominican Republic Peso','profile-builder' ),
710
+ 'XCD' => __( 'East Caribbean Dollar','profile-builder' ),
711
+ 'EGP' => __( 'Egypt Pound','profile-builder' ),
712
+ 'SVC' => __( 'El Salvador Colon','profile-builder' ),
713
+ 'EEK' => __( 'Estonia Kroon','profile-builder' ),
714
+ 'EUR' => __( 'Euro','profile-builder' ),
715
+ 'FKP' => __( 'Falkland Islands (Malvinas) Pound','profile-builder' ),
716
+ 'FJD' => __( 'Fiji Dollar','profile-builder' ),
717
+ 'GHC' => __( 'Ghana Cedis','profile-builder' ),
718
+ 'GIP' => __( 'Gibraltar Pound','profile-builder' ),
719
+ 'GTQ' => __( 'Guatemala Quetzal','profile-builder' ),
720
+ 'GGP' => __( 'Guernsey Pound','profile-builder' ),
721
+ 'GYD' => __( 'Guyana Dollar','profile-builder' ),
722
+ 'HNL' => __( 'Honduras Lempira','profile-builder' ),
723
+ 'HKD' => __( 'Hong Kong Dollar','profile-builder' ),
724
+ 'HUF' => __( 'Hungary Forint','profile-builder' ),
725
+ 'ISK' => __( 'Iceland Krona','profile-builder' ),
726
+ 'INR' => __( 'India Rupee','profile-builder' ),
727
+ 'IDR' => __( 'Indonesia Rupiah','profile-builder' ),
728
+ 'IRR' => __( 'Iran Rial','profile-builder' ),
729
+ 'IMP' => __( 'Isle of Man Pound','profile-builder' ),
730
+ 'ILS' => __( 'Israel Shekel','profile-builder' ),
731
+ 'JMD' => __( 'Jamaica Dollar','profile-builder' ),
732
+ 'JPY' => __( 'Japan Yen','profile-builder' ),
733
+ 'JEP' => __( 'Jersey Pound','profile-builder' ),
734
+ 'KZT' => __( 'Kazakhstan Tenge','profile-builder' ),
735
+ 'KPW' => __( 'Korea (North) Won','profile-builder' ),
736
+ 'KRW' => __( 'Korea (South) Won','profile-builder' ),
737
+ 'KGS' => __( 'Kyrgyzstan Som','profile-builder' ),
738
+ 'LAK' => __( 'Laos Kip','profile-builder' ),
739
+ 'LVL' => __( 'Latvia Lat','profile-builder' ),
740
+ 'LBP' => __( 'Lebanon Pound','profile-builder' ),
741
+ 'LRD' => __( 'Liberia Dollar','profile-builder' ),
742
+ 'LTL' => __( 'Lithuania Litas','profile-builder' ),
743
+ 'MKD' => __( 'Macedonia Denar','profile-builder' ),
744
+ 'MYR' => __( 'Malaysia Ringgit','profile-builder' ),
745
+ 'MUR' => __( 'Mauritius Rupee','profile-builder' ),
746
+ 'MXN' => __( 'Mexico Peso','profile-builder' ),
747
+ 'MNT' => __( 'Mongolia Tughrik','profile-builder' ),
748
+ 'MZN' => __( 'Mozambique Metical','profile-builder' ),
749
+ 'NAD' => __( 'Namibia Dollar','profile-builder' ),
750
+ 'NPR' => __( 'Nepal Rupee','profile-builder' ),
751
+ 'ANG' => __( 'Netherlands Antilles Guilder','profile-builder' ),
752
+ 'NZD' => __( 'New Zealand Dollar','profile-builder' ),
753
+ 'NIO' => __( 'Nicaragua Cordoba','profile-builder' ),
754
+ 'NGN' => __( 'Nigeria Naira','profile-builder' ),
755
+ 'NOK' => __( 'Norway Krone','profile-builder' ),
756
+ 'OMR' => __( 'Oman Rial', 'profile-builder' ),
757
+ 'PKR' => __( 'Pakistan Rupee', 'profile-builder' ),
758
+ 'PAB' => __( 'Panama Balboa', 'profile-builder' ),
759
+ 'PYG' => __( 'Paraguay Guarani', 'profile-builder' ),
760
+ 'PEN' => __( 'Peru Nuevo Sol', 'profile-builder' ),
761
+ 'PHP' => __( 'Philippines Peso', 'profile-builder' ),
762
+ 'PLN' => __( 'Poland Zloty', 'profile-builder' ),
763
+ 'QAR' => __( 'Qatar Riyal', 'profile-builder' ),
764
+ 'RON' => __( 'Romania New Leu', 'profile-builder' ),
765
+ 'RUB' => __( 'Russia Ruble', 'profile-builder' ),
766
+ 'SHP' => __( 'Saint Helena Pound', 'profile-builder' ),
767
+ 'SAR' => __( 'Saudi Arabia Riyal', 'profile-builder' ),
768
+ 'RSD' => __( 'Serbia Dinar', 'profile-builder' ),
769
+ 'SCR' => __( 'Seychelles Rupee', 'profile-builder' ),
770
+ 'SGD' => __( 'Singapore Dollar', 'profile-builder' ),
771
+ 'SBD' => __( 'Solomon Islands Dollar', 'profile-builder' ),
772
+ 'SOS' => __( 'Somalia Shilling', 'profile-builder' ),
773
+ 'ZAR' => __( 'South Africa Rand', 'profile-builder' ),
774
+ 'LKR' => __( 'Sri Lanka Rupee', 'profile-builder' ),
775
+ 'SEK' => __( 'Sweden Krona', 'profile-builder' ),
776
+ 'CHF' => __( 'Switzerland Franc', 'profile-builder' ),
777
+ 'SRD' => __( 'Suriname Dollar', 'profile-builder' ),
778
+ 'SYP' => __( 'Syria Pound', 'profile-builder' ),
779
+ 'TWD' => __( 'Taiwan New Dollar', 'profile-builder' ),
780
+ 'THB' => __( 'Thailand Baht', 'profile-builder' ),
781
+ 'TTD' => __( 'Trinidad and Tobago Dollar', 'profile-builder' ),
782
+ 'TRY' => __( 'Turkey Lira', 'profile-builder' ),
783
+ 'TRL' => __( 'Turkey Lira', 'profile-builder' ),
784
+ 'TVD' => __( 'Tuvalu Dollar', 'profile-builder' ),
785
+ 'UAH' => __( 'Ukraine Hryvna', 'profile-builder' ),
786
+ 'GBP' => __( 'United Kingdom Pound', 'profile-builder' ),
787
+ 'UGX' => __( 'Uganda Shilling', 'profile-builder' ),
788
+ 'USD' => __( 'US Dollar', 'profile-builder' ),
789
+ 'UYU' => __( 'Uruguay Peso', 'profile-builder' ),
790
+ 'UZS' => __( 'Uzbekistan Som', 'profile-builder' ),
791
+ 'VEF' => __( 'Venezuela Bolivar', 'profile-builder' ),
792
+ 'VND' => __( 'Viet Nam Dong', 'profile-builder' ),
793
+ 'YER' => __( 'Yemen Rial', 'profile-builder' ),
794
+ 'ZWD' => __( 'Zimbabwe Dollar', 'profile-builder' )
795
+ );
796
+
797
+ $filter_name = ( empty( $form_location ) ? 'wppb_get_currencies' : 'wppb_get_currencies_' . $form_location );
798
+
799
+ return apply_filters( $filter_name, $currencies );
800
+
801
+ }
802
+
803
+
804
+ /*
805
+ * Returns the currency symbol for a given currency code
806
+ *
807
+ * @param string $currency_code
808
+ *
809
+ * @return string
810
+ *
811
+ */
812
+ function wppb_get_currency_symbol( $currency_code ) {
813
+
814
+ $currency_symbols = array(
815
+ 'AED' => '&#1583;.&#1573;', // ?
816
+ 'AFN' => '&#65;&#102;',
817
+ 'ALL' => '&#76;&#101;&#107;',
818
+ 'AMD' => '',
819
+ 'ANG' => '&#402;',
820
+ 'AOA' => '&#75;&#122;', // ?
821
+ 'ARS' => '&#36;',
822
+ 'AUD' => '&#36;',
823
+ 'AWG' => '&#402;',
824
+ 'AZN' => '&#1084;&#1072;&#1085;',
825
+ 'BAM' => '&#75;&#77;',
826
+ 'BBD' => '&#36;',
827
+ 'BDT' => '&#2547;', // ?
828
+ 'BGN' => '&#1083;&#1074;',
829
+ 'BHD' => '.&#1583;.&#1576;', // ?
830
+ 'BIF' => '&#70;&#66;&#117;', // ?
831
+ 'BMD' => '&#36;',
832
+ 'BND' => '&#36;',
833
+ 'BOB' => '&#36;&#98;',
834
+ 'BRL' => '&#82;&#36;',
835
+ 'BSD' => '&#36;',
836
+ 'BTN' => '&#78;&#117;&#46;', // ?
837
+ 'BWP' => '&#80;',
838
+ 'BYR' => '&#112;&#46;',
839
+ 'BZD' => '&#66;&#90;&#36;',
840
+ 'CAD' => '&#36;',
841
+ 'CDF' => '&#70;&#67;',
842
+ 'CHF' => '&#67;&#72;&#70;',
843
+ 'CLF' => '', // ?
844
+ 'CLP' => '&#36;',
845
+ 'CNY' => '&#165;',
846
+ 'COP' => '&#36;',
847
+ 'CRC' => '&#8353;',
848
+ 'CUP' => '&#8396;',
849
+ 'CVE' => '&#36;', // ?
850
+ 'CZK' => '&#75;&#269;',
851
+ 'DJF' => '&#70;&#100;&#106;', // ?
852
+ 'DKK' => '&#107;&#114;',
853
+ 'DOP' => '&#82;&#68;&#36;',
854
+ 'DZD' => '&#1583;&#1580;', // ?
855
+ 'EGP' => '&#163;',
856
+ 'ETB' => '&#66;&#114;',
857
+ 'EUR' => '&#8364;',
858
+ 'FJD' => '&#36;',
859
+ 'FKP' => '&#163;',
860
+ 'GBP' => '&#163;',
861
+ 'GEL' => '&#4314;', // ?
862
+ 'GHS' => '&#162;',
863
+ 'GIP' => '&#163;',
864
+ 'GMD' => '&#68;', // ?
865
+ 'GNF' => '&#70;&#71;', // ?
866
+ 'GTQ' => '&#81;',
867
+ 'GYD' => '&#36;',
868
+ 'HKD' => '&#36;',
869
+ 'HNL' => '&#76;',
870
+ 'HRK' => '&#107;&#110;',
871
+ 'HTG' => '&#71;', // ?
872
+ 'HUF' => '&#70;&#116;',
873
+ 'IDR' => '&#82;&#112;',
874
+ 'ILS' => '&#8362;',
875
+ 'INR' => '&#8377;',
876
+ 'IQD' => '&#1593;.&#1583;', // ?
877
+ 'IRR' => '&#65020;',
878
+ 'ISK' => '&#107;&#114;',
879
+ 'JEP' => '&#163;',
880
+ 'JMD' => '&#74;&#36;',
881
+ 'JOD' => '&#74;&#68;', // ?
882
+ 'JPY' => '&#165;',
883
+ 'KES' => '&#75;&#83;&#104;', // ?
884
+ 'KGS' => '&#1083;&#1074;',
885
+ 'KHR' => '&#6107;',
886
+ 'KMF' => '&#67;&#70;', // ?
887
+ 'KPW' => '&#8361;',
888
+ 'KRW' => '&#8361;',
889
+ 'KWD' => '&#1583;.&#1603;', // ?
890
+ 'KYD' => '&#36;',
891
+ 'KZT' => '&#1083;&#1074;',
892
+ 'LAK' => '&#8365;',
893
+ 'LBP' => '&#163;',
894
+ 'LKR' => '&#8360;',
895
+ 'LRD' => '&#36;',
896
+ 'LSL' => '&#76;', // ?
897
+ 'LTL' => '&#76;&#116;',
898
+ 'LVL' => '&#76;&#115;',
899
+ 'LYD' => '&#1604;.&#1583;', // ?
900
+ 'MAD' => '&#1583;.&#1605;.', //?
901
+ 'MDL' => '&#76;',
902
+ 'MGA' => '&#65;&#114;', // ?
903
+ 'MKD' => '&#1076;&#1077;&#1085;',
904
+ 'MMK' => '&#75;',
905
+ 'MNT' => '&#8366;',
906
+ 'MOP' => '&#77;&#79;&#80;&#36;', // ?
907
+ 'MRO' => '&#85;&#77;', // ?
908
+ 'MUR' => '&#8360;', // ?
909
+ 'MVR' => '.&#1923;', // ?
910
+ 'MWK' => '&#77;&#75;',
911
+ 'MXN' => '&#36;',
912
+ 'MYR' => '&#82;&#77;',
913
+ 'MZN' => '&#77;&#84;',
914
+ 'NAD' => '&#36;',
915
+ 'NGN' => '&#8358;',
916
+ 'NIO' => '&#67;&#36;',
917
+ 'NOK' => '&#107;&#114;',
918
+ 'NPR' => '&#8360;',
919
+ 'NZD' => '&#36;',
920
+ 'OMR' => '&#65020;',
921
+ 'PAB' => '&#66;&#47;&#46;',
922
+ 'PEN' => '&#83;&#47;&#46;',
923
+ 'PGK' => '&#75;', // ?
924
+ 'PHP' => '&#8369;',
925
+ 'PKR' => '&#8360;',
926
+ 'PLN' => '&#122;&#322;',
927
+ 'PYG' => '&#71;&#115;',
928
+ 'QAR' => '&#65020;',
929
+ 'RON' => '&#108;&#101;&#105;',
930
+ 'RSD' => '&#1044;&#1080;&#1085;&#46;',
931
+ 'RUB' => '&#1088;&#1091;&#1073;',
932
+ 'RWF' => '&#1585;.&#1587;',
933
+ 'SAR' => '&#65020;',
934
+ 'SBD' => '&#36;',
935
+ 'SCR' => '&#8360;',
936
+ 'SDG' => '&#163;', // ?
937
+ 'SEK' => '&#107;&#114;',
938
+ 'SGD' => '&#36;',
939
+ 'SHP' => '&#163;',
940
+ 'SLL' => '&#76;&#101;', // ?
941
+ 'SOS' => '&#83;',
942
+ 'SRD' => '&#36;',
943
+ 'STD' => '&#68;&#98;', // ?
944
+ 'SVC' => '&#36;',
945
+ 'SYP' => '&#163;',
946
+ 'SZL' => '&#76;', // ?
947
+ 'THB' => '&#3647;',
948
+ 'TJS' => '&#84;&#74;&#83;', // ? TJS (guess)
949
+ 'TMT' => '&#109;',
950
+ 'TND' => '&#1583;.&#1578;',
951
+ 'TOP' => '&#84;&#36;',
952
+ 'TRY' => '&#8356;', // New Turkey Lira (old symbol used)
953
+ 'TTD' => '&#36;',
954
+ 'TWD' => '&#78;&#84;&#36;',
955
+ 'TZS' => '',
956
+ 'UAH' => '&#8372;',
957
+ 'UGX' => '&#85;&#83;&#104;',
958
+ 'USD' => '&#36;',
959
+ 'UYU' => '&#36;&#85;',
960
+ 'UZS' => '&#1083;&#1074;',
961
+ 'VEF' => '&#66;&#115;',
962
+ 'VND' => '&#8363;',
963
+ 'VUV' => '&#86;&#84;',
964
+ 'WST' => '&#87;&#83;&#36;',
965
+ 'XAF' => '&#70;&#67;&#70;&#65;',
966
+ 'XCD' => '&#36;',
967
+ 'XDR' => '',
968
+ 'XOF' => '',
969
+ 'XPF' => '&#70;',
970
+ 'YER' => '&#65020;',
971
+ 'ZAR' => '&#82;',
972
+ 'ZMK' => '&#90;&#75;', // ?
973
+ 'ZWL' => '&#90;&#36;',
974
+ );
975
+
976
+ if( !empty( $currency_symbols[$currency_code] ) )
977
+ return $currency_symbols[$currency_code];
978
+ else
979
+ return '';
980
+
981
+ }
982
+
983
+
984
+ /**
985
+ * Function that returns a unique, incremented ID
986
+ *
987
+ * @since v.2.0
988
+ *
989
+ * @return integer id
990
+ */
991
+ function wppb_get_unique_id(){
992
+ $id = 1;
993
+ $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );
994
+ if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){
995
+ return $id;
996
+ }
997
+ else{
998
+ $ids_array = array();
999
+ foreach( $wppb_manage_fields as $value ){
1000
+ $ids_array[] = $value['id'];
1001
+ }
1002
+ if( !empty( $ids_array ) ){
1003
+ rsort( $ids_array );
1004
+ $id = $ids_array[0] + 1;
1005
+ }
1006
+ }
1007
+ return apply_filters( 'wppb_field_unique_id', $id, $ids_array, $wppb_manage_fields );
1008
+ }
1009
+
1010
+ /**
1011
+ * Function that checks to see if the id is unique when saving the new field
1012
+ *
1013
+ * @param array $values
1014
+ *
1015
+ * @return array
1016
+ */
1017
+ function wppb_check_unique_id_on_saving( $values ) {
1018
+ $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );
1019
+
1020
+ if( $wppb_manage_fields != 'not_found' ) {
1021
+
1022
+ $ids_array = array();
1023
+ foreach( $wppb_manage_fields as $field ){
1024
+ $ids_array[] = $field['id'];
1025
+ }
1026
+
1027
+ if( in_array( $values['id'], $ids_array ) ) {
1028
+ rsort( $ids_array );
1029
+ $values['id'] = $ids_array[0] + 1;
1030
+ }
1031
+
1032
+ }
1033
+ return $values;
1034
+ }
1035
+ add_filter( 'wck_add_meta_filter_values_wppb_manage_fields', 'wppb_check_unique_id_on_saving' );
1036
+
1037
+
1038
+ function wppb_return_unique_field_list( $only_default_fields = false ){
1039
+
1040
+ $unique_field_list[] = 'Default - Name (Heading)';
1041
+ $unique_field_list[] = 'Default - Contact Info (Heading)';
1042
+ $unique_field_list[] = 'Default - About Yourself (Heading)';
1043
+ $unique_field_list[] = 'Default - Username';
1044
+ $unique_field_list[] = 'Default - First Name';
1045
+ $unique_field_list[] = 'Default - Last Name';
1046
+ $unique_field_list[] = 'Default - Nickname';
1047
+ $unique_field_list[] = 'Default - E-mail';
1048
+ $unique_field_list[] = 'Default - Website';
1049
+
1050
+ // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
1051
+ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
1052
+ $unique_field_list[] = 'Default - AIM';
1053
+ $unique_field_list[] = 'Default - Yahoo IM';
1054
+ $unique_field_list[] = 'Default - Jabber / Google Talk';
1055
+ }
1056
+
1057
+ $unique_field_list[] = 'Default - Password';
1058
+ $unique_field_list[] = 'Default - Repeat Password';
1059
+ $unique_field_list[] = 'Default - Biographical Info';
1060
+ $unique_field_list[] = 'Default - Display name publicly as';
1061
+
1062
+ if ( wppb_can_users_signup_blog() ) {
1063
+ $unique_field_list[] = 'Default - Blog Details';
1064
+ }
1065
+
1066
+ if( !$only_default_fields ){
1067
+ $unique_field_list[] = 'Avatar';
1068
+ $unique_field_list[] = 'reCAPTCHA';
1069
+ $unique_field_list[] = 'Select (User Role)';
1070
+ $unique_field_list[] = 'Map';
1071
+ }
1072
+
1073
+ return apply_filters ( 'wppb_unique_field_list', $unique_field_list );
1074
+ }
1075
+
1076
+
1077
+ /**
1078
+ * Function that checks several things when adding/editing the fields
1079
+ *
1080
+ * @since v.2.0
1081
+ *
1082
+ * @param string $message - the message to be displayed
1083
+ * @param array $fields - the added fields
1084
+ * @param array $required_fields
1085
+ * @param string $meta - the meta-name of the option
1086
+ * @param string $values - The values entered for each option
1087
+ * @param integer $post_id
1088
+ * @return boolean
1089
+ */
1090
+ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $meta_name, $posted_values, $post_id ){
1091
+ global $wpdb;
1092
+
1093
+ if ( $meta_name == 'wppb_manage_fields' ){
1094
+
1095
+ // check for a valid field-type (fallback)
1096
+ if ( $posted_values['field'] == '' )
1097
+ $message .= __( "You must select a field\n", 'profile-builder' );
1098
+ // END check for a valid field-type (fallback)
1099
+
1100
+ $unique_field_list = wppb_return_unique_field_list();
1101
+ $all_fields = apply_filters( 'wppb_manage_fields_check_field_on_edit_add', get_option ( $meta_name, 'not_set' ), $posted_values );
1102
+
1103
+ // check if the unique fields are only added once
1104
+ if( $all_fields != 'not_set' ){
1105
+ foreach( $all_fields as $field ){
1106
+ if ( ( in_array ( $posted_values['field'], $unique_field_list ) ) && ( $posted_values['field'] == $field['field'] ) && ( $posted_values['id'] != $field['id'] ) ){
1107
+ $message .= __( "Please choose a different field type as this one already exists in your form (must be unique)\n", 'profile-builder' );
1108
+ break;
1109
+ }
1110
+ }
1111
+ }
1112
+ // END check if the unique fields are only added once
1113
+
1114
+ // check for avatar size
1115
+ if ( $posted_values['field'] == 'Avatar' ){
1116
+ if ( is_numeric( $posted_values['avatar-size'] ) ){
1117
+ if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) )
1118
+ $message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' );
1119
+
1120
+ }else
1121
+ $message .= __( "The entered avatar size is not numerical\n", 'profile-builder' );
1122
+
1123
+ }
1124
+ // END check for avatar size
1125
+
1126
+ // check for correct row value
1127
+ if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){
1128
+ if ( !is_numeric( $posted_values['row-count'] ) )
1129
+ $message .= __( "The entered row number is not numerical\n", 'profile-builder' );
1130
+
1131
+ elseif ( trim( $posted_values['row-count'] ) == '' )
1132
+ $message .= __( "You must enter a value for the row number\n", 'profile-builder' );
1133
+ }
1134
+ // END check for correct row value
1135
+
1136
+
1137
+ // check for the public and private keys
1138
+ if ( $posted_values['field'] == 'reCAPTCHA'){
1139
+ if ( trim( $posted_values['public-key'] ) == '' )
1140
+ $message .= __( "You must enter the site key\n", 'profile-builder' );
1141
+ if ( trim( $posted_values['private-key'] ) == '' )
1142
+ $message .= __( "You must enter the secret key\n", 'profile-builder' );
1143
+ }
1144
+ // END check for the public and private keys
1145
+
1146
+ // check for the correct the date-format
1147
+ if ( $posted_values['field'] == 'Datepicker' ){
1148
+ $date_format = strtolower( $posted_values['date-format'] );
1149
+ if ( trim( $date_format ) != 'mm/dd/yy' && trim( $date_format ) != 'mm/yy/dd' && trim( $date_format ) != 'dd/yy/mm' &&
1150
+ trim( $date_format ) != 'dd/mm/yy' && trim( $date_format ) != 'yy/dd/mm' && trim( $date_format ) != 'yy/mm/dd' &&
1151
+ trim( $date_format ) != 'yy-mm-dd' && trim( $date_format ) != 'DD, dd-M-y' && trim( $date_format ) != 'D, dd M yy' &&
1152
+ trim( $date_format ) != 'D, d M y' && trim( $date_format ) != 'D, d M yy' && trim( $date_format ) != 'mm-dd-yy' && trim( $date_format ) != '@' )
1153
+ $message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' );
1154
+
1155
+ elseif ( trim( $date_format ) == '' )
1156
+ $message .= __( "You must enter a value for the date-format\n", 'profile-builder' );
1157
+ }
1158
+ // END check for the correct the date-format
1159
+
1160
+ //check for empty meta-name and duplicate meta-name
1161
+ if ( $posted_values['overwrite-existing'] == 'No' ){
1162
+ $skip_check_for_fields = wppb_return_unique_field_list(true);
1163
+ $skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields );
1164
+
1165
+ if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){
1166
+ $unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' );
1167
+
1168
+ //check to see if meta-name is empty
1169
+ $skip_empty_check_for_fields = array( 'Heading', 'Select (User Role)', 'reCAPTCHA', 'HTML', 'GDPR Delete Button' );
1170
+
1171
+ if( !in_array( $posted_values['field'], $skip_empty_check_for_fields ) && empty( $posted_values['meta-name'] ) ) {
1172
+ $message .= __( "The meta-name cannot be empty\n", 'profile-builder' );
1173
+ }
1174
+
1175
+ // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
1176
+ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
1177
+ $unique_meta_name_list[] = 'aim';
1178
+ $unique_meta_name_list[] = 'yim';
1179
+ $unique_meta_name_list[] = 'jabber';
1180
+ }
1181
+
1182
+ // if the desired meta-name is one of the following, automatically give an error
1183
+ if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) )
1184
+ $message .= __( "That meta-name is already in use\n", 'profile-builder' );
1185
+
1186
+ else{
1187
+ $found_in_custom_fields = false;
1188
+
1189
+ if( $all_fields != 'not_set' )
1190
+ foreach( $all_fields as $field ){
1191
+ if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){
1192
+ $message .= __( "That meta-name is already in use\n", 'profile-builder' );
1193
+ $found_in_custom_fields = true;
1194
+
1195
+ }elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) )
1196
+ $found_in_custom_fields = true;
1197
+ }
1198
+
1199
+ if ( $found_in_custom_fields === false ){
1200
+ if( $posted_values['meta-name'] != '' ) {
1201
+ $found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name']));
1202
+ if ($found_meta_name != null)
1203
+ $message .= __("That meta-name is already in use\n", 'profile-builder');
1204
+ }
1205
+ }
1206
+ }
1207
+ }
1208
+ }
1209
+ //END check duplicate meta-name
1210
+
1211
+ // check for correct meta name on upload field
1212
+ if( $posted_values['field'] == 'Upload' ) {
1213
+ if( ! empty( $posted_values['meta-name'] ) && preg_match( '/([^a-z\d_-])/', $posted_values['meta-name'] ) ) {
1214
+ $message .= __( "The meta-name can only contain lowercase letters, numbers, _ , - and no spaces.\n", 'profile-builder' );
1215
+ }
1216
+ }
1217
+ // END check for correct meta name on upload field
1218
+
1219
+ // check for valid default option (checkbox, select, radio)
1220
+ if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) {
1221
+ $options = array_map( 'trim', explode( ',', $posted_values['options'] ) );
1222
+ $default_options = ( ( trim( $posted_values['default-options'] ) == '' ) ? array() : array_map( 'trim', explode( ',', $posted_values['default-options'] ) ) );
1223
+
1224
+ /* echo "<script>console.log( Posted options: " . print_r($options, true) . "' );</script>";
1225
+ echo "<script>console.log( Default options: " . print_r($default_options, true) . "' );</script>"; */
1226
+
1227
+ $not_found = '';
1228
+ foreach ( $default_options as $key => $value ){
1229
+ if ( !in_array( $value, $options ) )
1230
+ $not_found .= $value . ', ';
1231
+ }
1232
+
1233
+ if ( $not_found != '' )
1234
+ $message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) );
1235
+
1236
+ }elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){
1237
+ if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) )
1238
+ $message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] );
1239
+ }
1240
+ // END check for valid default option (checkbox, select, radio)
1241
+
1242
+ // check to see if any user role is selected (user-role field)
1243
+ if( $posted_values['field'] == 'Select (User Role)' ) {
1244
+ if( empty( $posted_values['user-roles'] ) ) {
1245
+ $message .= __( "Please select at least one user role\n", 'profile-builder' );
1246
+ }
1247
+ }
1248
+ // END check to see if Administrator user role has been selected (user-role field)
1249
+
1250
+ $message = apply_filters( 'wppb_check_extra_manage_fields', $message, $posted_values );
1251
+
1252
+ }elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){
1253
+ if ( $posted_values['field'] == '' ){
1254
+ $message .= __( "You must select a field\n", 'profile-builder' );
1255
+
1256
+ }else{
1257
+ $fields_so_far = get_post_meta ( $post_id, $meta_name, true );
1258
+
1259
+ foreach ( $fields_so_far as $key => $value ){
1260
+ if ( $value['id'] == $posted_values['id'] )
1261
+ $message .= __( "That field is already added in this form\n", 'profile-builder' );
1262
+ }
1263
+ }
1264
+ }
1265
+ return $message;
1266
+ }
1267
+ add_filter( 'wck_extra_message', 'wppb_check_field_on_edit_add', 10, 6 );
1268
+
1269
+
1270
+ /**
1271
+ * Function that calls the wppb_hide_properties_for_already_added_fields and wppb_enable_select2 after a field-update
1272
+ *
1273
+ * @since v.2.0
1274
+ *
1275
+ * @param void
1276
+ *
1277
+ * @return string
1278
+ */
1279
+ function wppb_manage_fields_after_refresh_list( $id ){
1280
+ echo "<script type=\"text/javascript\">wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' );</script>";
1281
+ echo "<script type=\"text/javascript\">wppb_enable_select2( '#wppb_manage_fields' );</script>";
1282
+
1283
+ }
1284
+ add_action( "wck_refresh_list_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" );
1285
+ add_action( "wck_refresh_entry_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" );
1286
+
1287
+ /**
1288
+ * Function that calls the wppb_hide_all and wppb_enable_select2
1289
+ *
1290
+ * @since v.2.0
1291
+ *
1292
+ * @param void
1293
+ *
1294
+ * @return string
1295
+ */
1296
+ function wppb_manage_fields_after_ajax_add_field( $id ){
1297
+ echo "<script type=\"text/javascript\">wppb_hide_all( '#wppb_manage_fields' );</script>";
1298
+ echo "<script type=\"text/javascript\">wppb_enable_select2( '#wppb_manage_fields' );</script>";
1299
+ }
1300
+ add_action("wck_ajax_add_form_wppb_manage_fields", "wppb_manage_fields_after_ajax_add_field" );
1301
+
1302
+ /**
1303
+ * Function that modifies the table header in Manage Fields to add Field Name, Field Type, Meta Key, Required
1304
+ *
1305
+ * @since v.2.0
1306
+ *
1307
+ * @param $list, $id
1308
+ *
1309
+ * @return string
1310
+ */
1311
+ function wppb_manage_fields_header( $list_header ){
1312
+ return '<thead><tr><th class="wck-number">#</th><th class="wck-content">'. __( '<pre>Title</pre><pre>Type</pre><pre>Meta Name</pre><pre class="wppb-mb-head-required">Required</pre>', 'profile-builder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'profile-builder' ) .'</th><th class="wck-delete">'. __( 'Delete', 'profile-builder' ) .'</th></tr></thead>';
1313
+ }
1314
+ add_action( 'wck_metabox_content_header_wppb_manage_fields', 'wppb_manage_fields_header' );
1315
+
1316
+ /**
1317
+ * Add contextual help to the side of manage fields for the shortcodes
1318
+ *
1319
+ * @since v.2.0
1320
+ *
1321
+ * @param $hook
1322
+ *
1323
+ * @return string
1324
+ */
1325
+ function wppb_add_content_before_manage_fields(){
1326
+ ?>
1327
+ <p><?php _e('Use these shortcodes on the pages you want the forms to be displayed:', 'profile-builder'); ?></p>
1328
+ <ul>
1329
+ <li><strong class="nowrap">[wppb-register]</strong></li>
1330
+ <li><strong class="nowrap">[wppb-edit-profile]</strong></li>
1331
+ <li><strong class="nowrap">[wppb-register role="author"]</strong></li>
1332
+ </ul>
1333
+ <p>
1334
+ <?php
1335
+ if( PROFILE_BUILDER == 'Profile Builder Pro' )
1336
+ _e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Modules.", 'profile-builder');
1337
+ else
1338
+ _e( "With Profile Builder Pro you can display different fields in the registration and edit profile forms, using the Multiple Registration & Edit Profile Forms module.", "profile-builder" )
1339
+ ?>
1340
+ </p>
1341
+ <?php
1342
+ }
1343
+ add_action('wck_metabox_content_wppb_manage_fields_info', 'wppb_add_content_before_manage_fields');
1344
+
1345
+
1346
+ /**
1347
+ * Function that calls the wppb_edit_form_properties
1348
+ *
1349
+ * @since v.2.0
1350
+ *
1351
+ * @param void
1352
+ *
1353
+ * @return string
1354
+ */
1355
+ function wppb_remove_properties_from_added_form( $meta_name, $id, $element_id ){
1356
+ if ( ( $meta_name == 'wppb_epf_fields' ) || ( $meta_name == 'wppb_rf_fields' ) )
1357
+ echo "<script type=\"text/javascript\">wppb_disable_delete_on_default_mandatory_fields();</script>";
1358
+
1359
+ if ( $meta_name == 'wppb_manage_fields' ) {
1360
+ echo "<script type=\"text/javascript\">wppb_edit_form_properties( '#container_wppb_manage_fields', 'update_container_wppb_manage_fields_" . $element_id . "' );</script>";
1361
+ echo "<script type=\"text/javascript\">wppb_enable_select2( '#container_wppb_manage_fields' );</script>";
1362
+ }
1363
+ }
1364
+ add_action("wck_after_adding_form", "wppb_remove_properties_from_added_form", 10, 3);
1365
+
1366
+ /*
1367
+ * WPML Support for dynamic strings in Profile Builder. Tags: WPML, fields, translate
1368
+ */
1369
+ add_filter( 'update_option_wppb_manage_fields', 'wppb_wpml_compat_with_fields', 10, 2 );
1370
+ function wppb_wpml_compat_with_fields( $oldvalue, $_newvalue ){
1371
+ $default_fields = array(
1372
+ 'Default - Name (Heading)',
1373
+ 'Default - Contact Info (Heading)',
1374
+ 'Default - About Yourself (Heading)',
1375
+ 'Default - Username',
1376
+ 'Default - First Name',
1377
+ 'Default - Last Name',
1378
+ 'Default - Nickname',
1379
+ 'Default - E-mail',
1380
+ 'Default - Website',
1381
+ 'Default - AIM',
1382
+ 'Default - Yahoo IM',
1383
+ 'Default - Jabber / Google Talk',
1384
+ 'Default - Password',
1385
+ 'Default - Repeat Password',
1386
+ 'Default - Biographical Info',
1387
+ 'Default - Blog Details',
1388
+ 'Default - Display name publicly as'
1389
+ );
1390
+
1391
+ if ( is_array( $_newvalue ) ){
1392
+ foreach ( $_newvalue as $field ){
1393
+ if ( in_array($field['field'], $default_fields) ){
1394
+ $prefix = 'default_field_';
1395
+ } else {
1396
+ $prefix = 'custom_field_';
1397
+ }
1398
+ if (function_exists('icl_register_string')){
1399
+ if( !empty( $field['field-title'] ) )
1400
+ icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_title_translation' , $field['field-title'] );
1401
+ if( !empty( $field['description'] ) )
1402
+ icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_description_translation', $field['description'] );
1403
+ if( !empty( $field['labels'] ) )
1404
+ icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_labels_translation', $field['labels'] );
1405
+ if( !empty( $field['default-value'] ) )
1406
+ icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_value_translation', $field['default-value'] );
1407
+ if( !empty( $field['default-content'] ) )
1408
+ icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_content_translation', $field['default-content'] );
1409
+ }
1410
+ }
1411
+ }
1412
+ }
1413
+
1414
+
1415
+ /*
1416
+ * Returns the HTML for a map given the field
1417
+ *
1418
+ */
1419
+ function wppb_get_map_output( $field, $args ) {
1420
+
1421
+ $defaults = array(
1422
+ 'markers' => array(),
1423
+ 'editable' => true,
1424
+ 'show_search' => true,
1425
+ 'extra_attr' => ''
1426
+ );
1427
+
1428
+ $args = wp_parse_args( $args, $defaults );
1429
+
1430
+ $return = '';
1431
+
1432
+ // Search box
1433
+ // The style:left=-99999px is set to hide the input from the viewport. It will be rewritten when the map gets initialised
1434
+ if ( $args['show_search'] ) {
1435
+ $return .= '<input style="left: -99999px" type="text" id="' . $field['meta-name'] . '-search-box" class="wppb-map-search-box" placeholder="' . __( 'Search Location', 'profile-builder' ) . '" />';
1436
+ }
1437
+
1438
+ $lng = ( ! empty( $field['map-default-lng'] ) ) ? (float) $field['map-default-lng'] : WPPB_DEFAULTS_MAP_LNG;
1439
+ $lat = ( ! empty( $field['map-default-lat'] ) ) ? (float) $field['map-default-lat'] : WPPB_DEFAULTS_MAP_LAT;
1440
+ $zoom = ( ! empty( $field['map-default-zoom'] ) ) ? (int) $field['map-default-zoom'] : WPPB_DEFAULTS_MAP_ZOOM;
1441
+
1442
+ // Get one time the settings.
1443
+ $settings = wppb_options_get_map_settings();
1444
+ $pin_info = ( ! empty( $args['user_id'] ) ) ? wppb_compute_simple_pin_content_for_user( $args['user_id'], $settings ) : '';
1445
+
1446
+ // Map container.
1447
+ $return .= '<div id="' . $field['meta-name'] . '" class="wppb-map-container" style="height: ' . $field['map-height'] . 'px;" data-editable="' . ( $args['editable'] ? 1 : 0 ) . '" data-default-zoom="' . $zoom . '" data-default-lat="' . $lat . '" data-default-lng="' . $lng . '" ' . $args['extra_attr'] . '></div>';
1448
+
1449
+ if ( ! empty( $args['markers'] ) ) {
1450
+ foreach ( $args['markers'] as $marker ) {
1451
+ if ( ! empty( $args['user_id'] ) ) {
1452
+ // Also compute the marker bubble content.
1453
+ $bubble = wppb_get_user_pin_bubble(
1454
+ $args['user_id'],
1455
+ strstr( $marker, ',', true ),
1456
+ ltrim( strstr( $marker, ',' ), ',' ),
1457
+ $pin_info,
1458
+ ''
1459
+ );
1460
+ $return .= $bubble;
1461
+ }
1462
+
1463
+ $return .= '<input name="' . $field['meta-name'] . '[]" type="hidden" class="wppb-map-marker" value="' . $marker . '" />';
1464
+ }
1465
+ }
1466
+
1467
+ return $return;
1468
+ }
1469
+
1470
+
1471
+ /*
1472
+ * Returns all the saved markers for a map field for a particular user
1473
+ *
1474
+ */
1475
+ function wppb_get_user_map_markers( $user_id, $meta_name ) {
1476
+
1477
+ global $wpdb;
1478
+
1479
+ $meta_name_underlined = $meta_name . '_';
1480
+
1481
+ $results = $wpdb->get_results( "SELECT meta_value, meta_key FROM {$wpdb->usermeta} WHERE user_id={$user_id} AND meta_key LIKE '%{$meta_name_underlined}%'", ARRAY_N );
1482
+
1483
+ $markers = array();
1484
+ $i = 0;
1485
+
1486
+ foreach( $results as $key => $result ) {
1487
+ $pattern = '/^' . $meta_name . '_[0-9]+$/';
1488
+ preg_match( $pattern, $result[1], $matches );
1489
+ if ( count ($matches) > 0 ) {
1490
+ $markers[$i] = $result[0];
1491
+ $i++;
1492
+ }
1493
+
1494
+ }
1495
+ return $markers;
1496
+
1497
+ }
1498
+
1499
+ /*
1500
+ * Deletes from the database all saved markers
1501
+ *
1502
+ */
1503
+ function wppb_delete_user_map_markers( $user_id, $meta_name ) {
1504
+
1505
+ global $wpdb;
1506
+
1507
+ $meta_name .= '_';
1508
+
1509
+ $delete = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id=%d AND meta_key LIKE %s", $user_id, '%' . $meta_name . '%' ) );
1510
+
1511
+ wp_cache_delete( $user_id, 'user_meta' );
1512
+
1513
+ }
1514
+
1515
+ /**
1516
+ * Disable the add button again after we added a field
1517
+ */
1518
+ add_action( 'wck_ajax_add_form_wppb_manage_fields', 'wppb_redisable_the_add_button' );
1519
+ function wppb_redisable_the_add_button(){
1520
+ ?>
1521
+ <script>wppb_disable_add_entry_button ( '#wppb_manage_fields' );</script>
1522
+ <?php
1523
+ }
1524
+
1525
+
1526
+ /**
1527
+ * Function that updates the meta_key of a field in the usertmeta table when it was changed for a field. It is turned off by default
1528
+ */
1529
+ add_action( 'wck_before_update_meta', 'wppb_change_field_meta_key', 10, 4 );
1530
+ function wppb_change_field_meta_key( $meta, $id, $values, $element_id ){
1531
+ if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
1532
+ if ($meta == 'wppb_manage_fields') {
1533
+ global $wpdb;
1534
+ $wppb_manage_fields = get_option('wppb_manage_fields');
1535
+ if (!empty($wppb_manage_fields)) {
1536
+ if (!empty($values['meta-name']) && $wppb_manage_fields[$element_id]['meta-name'] != $values['meta-name']) {
1537
+ $wpdb->update(
1538
+ $wpdb->usermeta,
1539
+ array('meta_key' => sanitize_text_field($values['meta-name'])),
1540
+ array('meta_key' => sanitize_text_field($wppb_manage_fields[$element_id]['meta-name']))
1541
+ );
1542
+ }
1543
+ }
1544
+ }
1545
+ }
1546
+ }
1547
+
1548
+
1549
+
1550
+ if ( ! function_exists( 'wppb_prepare_key_value_options' ) ) {
1551
+ /**
1552
+ * Convert an array with keys and values into a usable option for the defined fields types.
1553
+ *
1554
+ * @param arrays $array List of options.
1555
+ * @return array Usable options.
1556
+ */
1557
+ function wppb_prepare_key_value_options( $array = array() ) {
1558
+ $result = array();
1559
+ if ( ! empty( $array ) ) {
1560
+ foreach ( $array as $name => $label ) {
1561
+ $result[] = '%' . $label . '%' . $name;
1562
+ }
1563
+ }
1564
+ return $result;
1565
+ }
1566
+ }
1567
+
1568
+ if ( ! function_exists( 'wppb_filter_map_bubble_fields' ) ) {
1569
+ /**
1570
+ * Filter the map POI's bubble content.
1571
+ *
1572
+ * @param arrays $tags List of available tags.
1573
+ * @return array Filtered and sorted tags.
1574
+ */
1575
+ function wppb_filter_map_bubble_fields( $tags ) {
1576
+ // Attempt to preseve one tag example.
1577
+ $maybe_avatar = ( ! empty( $tags['avatar_or_gravatar'] ) ) ? $tags['avatar_or_gravatar'] : false;
1578
+
1579
+ // Remove some of the tags.
1580
+ unset( $tags['meta_user_name'] );
1581
+ unset( $tags['more_info_url'] );
1582
+ unset( $tags['avatar_or_gravatar'] );
1583
+
1584
+ if ( ! empty( $maybe_avatar ) ) {
1585
+ // Perhaps preprend this to the list.
1586
+ $tags = array_merge( array( 'avatar_or_gravatar' => $maybe_avatar ), $tags );
1587
+ }
1588
+
1589
+ return $tags;
1590
+ }
1591
+ }
1592
+ add_filter( 'wppb_map_bubble_fields', 'wppb_filter_map_bubble_fields' );
1593
+
admin/pms-cross-promotion.php CHANGED
@@ -1,243 +1,243 @@
1
- <?php
2
- /**
3
- * Function that creates the "Paid Accounts" submenu page
4
- *
5
- * @since v.2.0
6
- *
7
- * @return void
8
- */
9
- function wppb_register_pms_cross_promo() {
10
- add_submenu_page( 'null', __( 'Paid Accounts', 'profile-builder' ), __( 'Paid Accounts', 'profile-builder' ), 'manage_options', 'profile-builder-pms-promo', 'wppb_pms_cross_promo' );
11
- }
12
- add_action( 'admin_menu', 'wppb_register_pms_cross_promo', 2 );
13
-
14
- /**
15
- * Function that adds content to the "Paid Accounts" submenu page
16
- *
17
- * @since v.2.0
18
- *
19
- * @return string
20
- */
21
- function wppb_pms_cross_promo() {
22
- ?>
23
- <div class="wrap wppb-wrap wppb-info-wrap">
24
- <div class="wppb-badge wppb-pb-pms"></div>
25
- <h1>Users can pay for an account with<br/> <small style="font-size: 30px; letter-spacing: 0.008em;">Profile Builder and Paid Member Subscriptions</small></h1>
26
- <hr />
27
- <div class="wppb-row">
28
- <p>One of the most requested features in Profile Builder was for users to be able to pay for an account.</p>
29
- <p>Now that's possible using the free WordPress plugin - <a href="https://www.cozmoslabs.com/wordpress-paid-member-subscriptions/?utm_source=wpbackend&utm_medium=clientsite&utm_content=pb-pms-promo&utm_campaign=PBFree">Paid Member Subscriptions</a>.</p>
30
- </div>
31
-
32
-
33
- <h2 class="wppb-callout"><?php _e( 'Paid Member Subscriptions - a free WordPress plugin', 'profile-builder' ); ?></h2>
34
- <hr/>
35
- <div class="wppb-row wppb-2-col">
36
- <div>
37
- <p><?php _e( 'With the new Subscriptions Field in Profile Builder, your registration forms will allow your users to sign up for paid accounts.', 'profile-builder' ); ?></p>
38
- <p>Other features of Paid Member Subscriptions are:</p>
39
- <ul>
40
- <li><?php _e( 'Paid & Free Subscriptions', 'profile-builder' ); ?></li>
41
- <li><?php _e( 'Restrict Content', 'profile-builder' ); ?></li>
42
- <li><?php _e( 'Member Management', 'profile-builder' ); ?></li>
43
- <li><?php _e( 'Email Templates', 'profile-builder' ); ?> </li>
44
- <li><?php _e( 'Account Management', 'profile-builder' ); ?> </li>
45
- <li><?php _e( 'Subscription Management', 'profile-builder' ); ?> </li>
46
- <li><?php _e( 'Payment Management', 'profile-builder' ); ?> </li>
47
- </ul>
48
- </div>
49
- <div>
50
-
51
- <div>
52
- <?php
53
- $wppb_get_all_plugins = get_plugins();
54
- $wppb_get_active_plugins = get_option('active_plugins');
55
-
56
- $ajax_nonce = wp_create_nonce("wppb-activate-addon");
57
-
58
- $pms_add_on_exists = 0;
59
- $pms_add_on_is_active = 0;
60
- $pms_add_on_is_network_active = 0;
61
- // Check to see if add-on is in the plugins folder
62
- foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
63
- if( strtolower($wppb_plugin['Name']) == strtolower( 'Paid Member Subscriptions' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
64
- $pms_add_on_exists = 1;
65
- if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
66
- $pms_add_on_is_active = 1;
67
- }
68
- // Consider the add-on active if it's network active
69
- if (is_plugin_active_for_network($wppb_plugin_key)) {
70
- $pms_add_on_is_network_active = 1;
71
- $pms_add_on_is_active = 1;
72
- }
73
- $plugin_file = $wppb_plugin_key;
74
- }
75
- }
76
- ?>
77
-
78
- <span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Activate', 'profile-builder' ); ?></span>
79
-
80
- <span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Downloading and installing...', 'profile-builder' ); ?></span>
81
- <span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Installation complete', 'profile-builder' ); ?></span>
82
-
83
- <span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is Active', 'profile-builder' ); ?></span>
84
- <span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin has been activated', 'profile-builder' ) ?></span>
85
- <span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Retry Install', 'profile-builder' ) ?></span>
86
-
87
- <span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is <strong>active</strong>', 'profile-builder' ); ?></span>
88
- <span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is <strong>inactive</strong>', 'profile-builder' ); ?></span>
89
-
90
- <span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Deactivate', 'profile-builder' ) ?></span>
91
- <span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin has been deactivated.', 'profile-builder' ) ?></span>
92
-
93
-
94
- <div class="plugin-card wppb-recommended-plugin wppb-add-on" style="width: 111%;">
95
- <div class="plugin-card-top">
96
- <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">
97
- <img src="<?php echo plugins_url( '../assets/images/pms-recommended.png', __FILE__ ); ?>" width="100%">
98
- </a>
99
- <h3 class="wppb-add-on-title">
100
- <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">Paid Member Subscriptions</a>
101
- </h3>
102
- <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
103
- <p class="wppb-add-on-description">
104
- <?php _e( 'Accept user payments, create subscription plans and restrict content on your website.', 'profile-builder' ) ?>
105
- <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=paid-member-subscriptions&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about Paid Member Subscriptions - membership & content restriction" data-title="Paid Member Subscriptions - membership & content restriction"><?php _e( 'More Details' ); ?></a>
106
- </p>
107
- </div>
108
- <div class="plugin-card-bottom wppb-add-on-compatible">
109
- <?php
110
- if ($pms_add_on_exists) {
111
-
112
- // Display activate/deactivate buttons
113
- if (!$pms_add_on_is_active) {
114
- echo '<a class="wppb-add-on-activate right button button-primary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
115
-
116
- // If add-on is network activated don't allow deactivation
117
- } elseif (!$pms_add_on_is_network_active) {
118
- echo '<a class="wppb-add-on-deactivate right button button-primary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
119
- }
120
-
121
- // Display message to the user
122
- if( !$pms_add_on_is_active ){
123
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
124
- } else {
125
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
126
- }
127
-
128
- } else {
129
-
130
- // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
131
- // handles the in-page download
132
- if (is_multisite()) {
133
- $wppb_paid_link_class = 'button-primary';
134
- $wppb_paid_link_text = __('Download Now', 'profile-builder' );
135
- } else {
136
- $wppb_paid_link_class = 'button-primary wppb-add-on-download';
137
- $wppb_paid_link_text = __('Install Now', 'profile-builder');
138
- }
139
-
140
- echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
141
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
142
-
143
- }
144
- ?>
145
- <div class="spinner"></div>
146
- <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span>
147
- </div>
148
- </div>
149
- </div>
150
-
151
-
152
- </div>
153
- </div>
154
-
155
- <h2 class="wppb-callout"><?php _e( 'Step by Step Quick Setup', 'profile-builder' ); ?></h2>
156
- <hr/>
157
- <p>Setting up Paid Member Subscriptions opens the door to paid user accounts. </p>
158
- <div class="wrap wppb-wrap wppb-1-3-col">
159
- <div><h3>Create Subscription Plans</h3>
160
- <p>With Paid Member Subscriptions it’s fairly easy to create tiered subscription plans for your users. </p>
161
- <p>Adding a new subscription gives you access to the following options to set up: subscription name, description, duration, the price, status and user role.</p>
162
- </div>
163
- <div style="text-align: right">
164
- <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_all_subscriptions-600x336.jpg" alt="paid subscription plans"/></p>
165
- </div>
166
- </div>
167
- <div class="wrap wppb-wrap wppb-1-3-col">
168
- <div><h3>Add Subscriptions field to Profile Builder -> Manage Fields</h3>
169
- <p>The new Subscription Plans field will add a list of radio buttons with membership details to Profile Builder registration forms.</p>
170
- </div>
171
- <div style="text-align: right">
172
- <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_pb_add_subscription-600x471.png" alt="manage fields subscription plans"/></p>
173
- </div>
174
- </div>
175
- <div class="wrap wppb-wrap wppb-1-3-col">
176
- <div><h3>Start getting user payments</h3>
177
- <p>To finalize registration for a paid account, users will need to complete the payment.</p>
178
- <p>Members created with Profile Builder registration form will have the user role of the selected subscription.</p>
179
- </div>
180
- <div style="text-align: right">
181
- <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_pb_register_page-600x618.png" alt="register payed accounts"/></p>
182
- </div>
183
- </div>
184
-
185
-
186
- <div id="pms-bottom-install" class="wppb-add-on">
187
- <div class="plugin-card-bottom wppb-add-on-compatible">
188
- <?php
189
- if ($pms_add_on_exists) {
190
-
191
- // Display activate/deactivate buttons
192
- if (!$pms_add_on_is_active) {
193
- echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
194
-
195
- // If add-on is network activated don't allow deactivation
196
- } elseif (!$pms_add_on_is_network_active) {
197
- echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
198
- }
199
-
200
- // Display message to the user
201
- if( !$pms_add_on_is_active ){
202
- echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
203
- } else {
204
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
205
- }
206
-
207
- } else {
208
-
209
- // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
210
- // handles the in-page download
211
- if (is_multisite()) {
212
- $wppb_paid_link_class = 'button-secondary';
213
- $wppb_paid_link_text = __('Download Now', 'profile-builder' );
214
- } else {
215
- $wppb_paid_link_class = 'button-secondary wppb-add-on-download';
216
- $wppb_paid_link_text = __('Install Now', 'profile-builder');
217
- }
218
-
219
- echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
220
- echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
221
- }
222
- ?>
223
- <div class="spinner"></div>
224
- <?php /* <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span> */ ?>
225
- </div>
226
- </div>
227
-
228
-
229
- </div>
230
- <?php
231
- }
232
- /*
233
- * Instantiate a new notification for the PMS cross Promotion
234
- *
235
- * @Since 2.2.5
236
- */
237
- if ( !isset($_GET['page']) || $_GET['page'] != 'profile-builder-pms-promo'){
238
- new WPPB_Add_General_Notices('wppb_pms_cross_promo',
239
- sprintf(__('Allow your users to have <strong>paid accounts with Profile Builder</strong>. %1$sFind out how >%2$s %3$sDismiss%4$s', 'profile-builder'), "<a href='" . admin_url('options.php?page=profile-builder-pms-promo') . "'>", "</a>", "<a class='wppb-dismiss-notification' href='" . esc_url( add_query_arg('wppb_pms_cross_promo_dismiss_notification', '0') ) . "'>", "</a>"),
240
- 'pms-cross-promo');
241
- }
242
-
243
-
1
+ <?php
2
+ /**
3
+ * Function that creates the "Paid Accounts" submenu page
4
+ *
5
+ * @since v.2.0
6
+ *
7
+ * @return void
8
+ */
9
+ function wppb_register_pms_cross_promo() {
10
+ add_submenu_page( 'null', __( 'Paid Accounts', 'profile-builder' ), __( 'Paid Accounts', 'profile-builder' ), 'manage_options', 'profile-builder-pms-promo', 'wppb_pms_cross_promo' );
11
+ }
12
+ add_action( 'admin_menu', 'wppb_register_pms_cross_promo', 2 );
13
+
14
+ /**
15
+ * Function that adds content to the "Paid Accounts" submenu page
16
+ *
17
+ * @since v.2.0
18
+ *
19
+ * @return string
20
+ */
21
+ function wppb_pms_cross_promo() {
22
+ ?>
23
+ <div class="wrap wppb-wrap wppb-info-wrap">
24
+ <div class="wppb-badge wppb-pb-pms"></div>
25
+ <h1>Users can pay for an account with<br/> <small style="font-size: 30px; letter-spacing: 0.008em;">Profile Builder and Paid Member Subscriptions</small></h1>
26
+ <hr />
27
+ <div class="wppb-row">
28
+ <p>One of the most requested features in Profile Builder was for users to be able to pay for an account.</p>
29
+ <p>Now that's possible using the free WordPress plugin - <a href="https://www.cozmoslabs.com/wordpress-paid-member-subscriptions/?utm_source=wpbackend&utm_medium=clientsite&utm_content=pb-pms-promo&utm_campaign=PBFree">Paid Member Subscriptions</a>.</p>
30
+ </div>
31
+
32
+
33
+ <h2 class="wppb-callout"><?php _e( 'Paid Member Subscriptions - a free WordPress plugin', 'profile-builder' ); ?></h2>
34
+ <hr/>
35
+ <div class="wppb-row wppb-2-col">
36
+ <div>
37
+ <p><?php _e( 'With the new Subscriptions Field in Profile Builder, your registration forms will allow your users to sign up for paid accounts.', 'profile-builder' ); ?></p>
38
+ <p>Other features of Paid Member Subscriptions are:</p>
39
+ <ul>
40
+ <li><?php _e( 'Paid & Free Subscriptions', 'profile-builder' ); ?></li>
41
+ <li><?php _e( 'Restrict Content', 'profile-builder' ); ?></li>
42
+ <li><?php _e( 'Member Management', 'profile-builder' ); ?></li>
43
+ <li><?php _e( 'Email Templates', 'profile-builder' ); ?> </li>
44
+ <li><?php _e( 'Account Management', 'profile-builder' ); ?> </li>
45
+ <li><?php _e( 'Subscription Management', 'profile-builder' ); ?> </li>
46
+ <li><?php _e( 'Payment Management', 'profile-builder' ); ?> </li>
47
+ </ul>
48
+ </div>
49
+ <div>
50
+
51
+ <div>
52
+ <?php
53
+ $wppb_get_all_plugins = get_plugins();
54
+ $wppb_get_active_plugins = get_option('active_plugins');
55
+
56
+ $ajax_nonce = wp_create_nonce("wppb-activate-addon");
57
+
58
+ $pms_add_on_exists = 0;
59
+ $pms_add_on_is_active = 0;
60
+ $pms_add_on_is_network_active = 0;
61
+ // Check to see if add-on is in the plugins folder
62
+ foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) {
63
+ if( strtolower($wppb_plugin['Name']) == strtolower( 'Paid Member Subscriptions' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) {
64
+ $pms_add_on_exists = 1;
65
+ if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) {
66
+ $pms_add_on_is_active = 1;
67
+ }
68
+ // Consider the add-on active if it's network active
69
+ if (is_plugin_active_for_network($wppb_plugin_key)) {
70
+ $pms_add_on_is_network_active = 1;
71
+ $pms_add_on_is_active = 1;
72
+ }
73
+ $plugin_file = $wppb_plugin_key;
74
+ }
75
+ }
76
+ ?>
77
+
78
+ <span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Activate', 'profile-builder' ); ?></span>
79
+
80
+ <span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Downloading and installing...', 'profile-builder' ); ?></span>
81
+ <span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Installation complete', 'profile-builder' ); ?></span>
82
+
83
+ <span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is Active', 'profile-builder' ); ?></span>
84
+ <span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin has been activated', 'profile-builder' ) ?></span>
85
+ <span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Retry Install', 'profile-builder' ) ?></span>
86
+
87
+ <span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is <strong>active</strong>', 'profile-builder' ); ?></span>
88
+ <span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin is <strong>inactive</strong>', 'profile-builder' ); ?></span>
89
+
90
+ <span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Deactivate', 'profile-builder' ) ?></span>
91
+ <span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Plugin has been deactivated.', 'profile-builder' ) ?></span>
92
+
93
+
94
+ <div class="plugin-card wppb-recommended-plugin wppb-add-on" style="width: 111%;">
95
+ <div class="plugin-card-top">
96
+ <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">
97
+ <img src="<?php echo plugins_url( '../assets/images/pms-recommended.png', __FILE__ ); ?>" width="100%">
98
+ </a>
99
+ <h3 class="wppb-add-on-title">
100
+ <a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">Paid Member Subscriptions</a>
101
+ </h3>
102
+ <h3 class="wppb-add-on-price"><?php _e( 'Free', 'profile-builder' ) ?></h3>
103
+ <p class="wppb-add-on-description">
104
+ <?php _e( 'Accept user payments, create subscription plans and restrict content on your website.', 'profile-builder' ) ?>
105
+ <a href="<?php admin_url();?>plugin-install.php?tab=plugin-information&plugin=paid-member-subscriptions&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about Paid Member Subscriptions - membership & content restriction" data-title="Paid Member Subscriptions - membership & content restriction"><?php _e( 'More Details' ); ?></a>
106
+ </p>
107
+ </div>
108
+ <div class="plugin-card-bottom wppb-add-on-compatible">
109
+ <?php
110
+ if ($pms_add_on_exists) {
111
+
112
+ // Display activate/deactivate buttons
113
+ if (!$pms_add_on_is_active) {
114
+ echo '<a class="wppb-add-on-activate right button button-primary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
115
+
116
+ // If add-on is network activated don't allow deactivation
117
+ } elseif (!$pms_add_on_is_network_active) {
118
+ echo '<a class="wppb-add-on-deactivate right button button-primary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
119
+ }
120
+
121
+ // Display message to the user
122
+ if( !$pms_add_on_is_active ){
123
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
124
+ } else {
125
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
126
+ }
127
+
128
+ } else {
129
+
130
+ // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
131
+ // handles the in-page download
132
+ if (is_multisite()) {
133
+ $wppb_paid_link_class = 'button-primary';
134
+ $wppb_paid_link_text = __('Download Now', 'profile-builder' );
135
+ } else {
136
+ $wppb_paid_link_class = 'button-primary wppb-add-on-download';
137
+ $wppb_paid_link_text = __('Install Now', 'profile-builder');
138
+ }
139
+
140
+ echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
141
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
142
+
143
+ }
144
+ ?>
145
+ <div class="spinner"></div>
146
+ <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+
152
+ </div>
153
+ </div>
154
+
155
+ <h2 class="wppb-callout"><?php _e( 'Step by Step Quick Setup', 'profile-builder' ); ?></h2>
156
+ <hr/>
157
+ <p>Setting up Paid Member Subscriptions opens the door to paid user accounts. </p>
158
+ <div class="wrap wppb-wrap wppb-1-3-col">
159
+ <div><h3>Create Subscription Plans</h3>
160
+ <p>With Paid Member Subscriptions it’s fairly easy to create tiered subscription plans for your users. </p>
161
+ <p>Adding a new subscription gives you access to the following options to set up: subscription name, description, duration, the price, status and user role.</p>
162
+ </div>
163
+ <div style="text-align: right">
164
+ <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_all_subscriptions-600x336.jpg" alt="paid subscription plans"/></p>
165
+ </div>
166
+ </div>
167
+ <div class="wrap wppb-wrap wppb-1-3-col">
168
+ <div><h3>Add Subscriptions field to Profile Builder -> Manage Fields</h3>
169
+ <p>The new Subscription Plans field will add a list of radio buttons with membership details to Profile Builder registration forms.</p>
170
+ </div>
171
+ <div style="text-align: right">
172
+ <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_pb_add_subscription-600x471.png" alt="manage fields subscription plans"/></p>
173
+ </div>
174
+ </div>
175
+ <div class="wrap wppb-wrap wppb-1-3-col">
176
+ <div><h3>Start getting user payments</h3>
177
+ <p>To finalize registration for a paid account, users will need to complete the payment.</p>
178
+ <p>Members created with Profile Builder registration form will have the user role of the selected subscription.</p>
179
+ </div>
180
+ <div style="text-align: right">
181
+ <p><img src="<?php echo WPPB_PLUGIN_URL; ?>assets/images/pms_pb_register_page-600x618.png" alt="register payed accounts"/></p>
182
+ </div>
183
+ </div>
184
+
185
+
186
+ <div id="pms-bottom-install" class="wppb-add-on">
187
+ <div class="plugin-card-bottom wppb-add-on-compatible">
188
+ <?php
189
+ if ($pms_add_on_exists) {
190
+
191
+ // Display activate/deactivate buttons
192
+ if (!$pms_add_on_is_active) {
193
+ echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Activate', 'profile-builder') . '</a>';
194
+
195
+ // If add-on is network activated don't allow deactivation
196
+ } elseif (!$pms_add_on_is_network_active) {
197
+ echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $plugin_file . '" data-nonce="' . $ajax_nonce . '">' . __('Deactivate', 'profile-builder') . '</a>';
198
+ }
199
+
200
+ // Display message to the user
201
+ if( !$pms_add_on_is_active ){
202
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>';
203
+ } else {
204
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Plugin is <strong>active</strong>', 'profile-builder') . '</span>';
205
+ }
206
+
207
+ } else {
208
+
209
+ // If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that
210
+ // handles the in-page download
211
+ if (is_multisite()) {
212
+ $wppb_paid_link_class = 'button-secondary';
213
+ $wppb_paid_link_text = __('Download Now', 'profile-builder' );
214
+ } else {
215
+ $wppb_paid_link_class = 'button-secondary wppb-add-on-download';
216
+ $wppb_paid_link_text = __('Install Now', 'profile-builder');
217
+ }
218
+
219
+ echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . $ajax_nonce . '">' . $wppb_paid_link_text . '</a>';
220
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>';
221
+ }
222
+ ?>
223
+ <div class="spinner"></div>
224
+ <?php /* <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span> */ ?>
225
+ </div>
226
+ </div>
227
+
228
+
229
+ </div>
230
+ <?php
231
+ }
232
+ /*
233
+ * Instantiate a new notification for the PMS cross Promotion
234
+ *
235
+ * @Since 2.2.5
236
+ */
237
+ if ( !isset($_GET['page']) || $_GET['page'] != 'profile-builder-pms-promo'){
238
+ new WPPB_Add_General_Notices('wppb_pms_cross_promo',
239
+ sprintf(__('Allow your users to have <strong>paid accounts with Profile Builder</strong>. %1$sFind out how >%2$s %3$sDismiss%4$s', 'profile-builder'), "<a href='" . admin_url('options.php?page=profile-builder-pms-promo') . "'>", "</a>", "<a class='wppb-dismiss-notification' href='" . esc_url( add_query_arg('wppb_pms_cross_promo_dismiss_notification', '0') ) . "'>", "</a>"),
240
+ 'pms-cross-promo');
241
+ }
242
+
243
+
admin/private-website.php CHANGED
@@ -1,135 +1,135 @@
1
- <?php
2
-
3
- /**
4
- * Function that creates the "Private Website" submenu page
5
- *
6
- * @since v.2.0
7
- *
8
- * @return void
9
- */
10
- function wppb_private_website_submenu_page() {
11
- add_submenu_page( null, __( 'Private Website', 'profile-builder' ), __( 'Private Website', 'profile-builder' ), 'manage_options', 'profile-builder-private-website', 'wppb_private_website_content' );
12
- }
13
- add_action( 'admin_menu', 'wppb_private_website_submenu_page' );
14
-
15
-
16
- /**
17
- * Function that generates the default settings for private page
18
- */
19
- function wppb_private_website_settings_defaults() {
20
-
21
- add_option( 'wppb_private_website_settings',
22
- array(
23
- 'private_website' => 'no',
24
- 'redirect_to' => '',
25
- 'allowed_pages' => array(),
26
- 'hide_menus' => 'no',
27
- )
28
- );
29
-
30
- }
31
-
32
- /**
33
- * Function that generates the content for the settings page
34
- */
35
- function wppb_private_website_content() {
36
-
37
- wppb_private_website_settings_defaults();
38
-
39
- $wppb_private_website_settings = get_option( 'wppb_private_website_settings', 'not_found' );
40
- $all_pages = get_pages();
41
- ?>
42
- <div class="wrap wppb-wrap wppb-private-website">
43
- <h2><?php _e( 'Private Website Settings', 'profile-builder' );?></h2>
44
-
45
- <?php settings_errors(); ?>
46
-
47
- <?php wppb_generate_settings_tabs() ?>
48
-
49
- <form method="post" action="options.php">
50
- <?php settings_fields( 'wppb_private_website_settings' ); ?>
51
-
52
- <table class="form-table">
53
- <tbody>
54
-
55
- <tr>
56
- <th><?php _e( 'Enable Private Website', 'profile-builder' ); ?></th>
57
- <td>
58
- <select id="private-website-enable" class="wppb-select" name="wppb_private_website_settings[private_website]">
59
- <option value="no" <?php echo ( ( $wppb_private_website_settings != 'not_found' && $wppb_private_website_settings['private_website'] == 'no' ) ? 'selected' : '' ); ?>><?php _e( 'No', 'profile-builder' ); ?></option>
60
- <option value="yes" <?php echo ( ( $wppb_private_website_settings != 'not_found' && $wppb_private_website_settings['private_website'] == 'yes' ) ? 'selected' : '' ); ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
61
- </select>
62
- <ul>
63
- <li class="description"><?php _e( 'Activate Private Website. It will restrict the content, RSS and REST API for your website', 'profile-builder' ); ?></li>
64
- </ul>
65
- </td>
66
- </tr>
67
-
68
- <tr>
69
- <th><?php _e( 'Redirect to', 'profile-builder' ); ?></th>
70
- <td>
71
- <select id="private-website-redirect-to-login" class="wppb-select" name="wppb_private_website_settings[redirect_to]">
72
- <option value=""><?php _e( 'Default WordPress login page', 'profile-builder' ); ?></option>
73
- <?php
74
- if( !empty( $all_pages ) ){
75
- foreach ($all_pages as $page){
76
- ?>
77
- <option value="<?php echo $page->ID ?>" <?php echo ( ( $wppb_private_website_settings != 'not_found' && isset( $wppb_private_website_settings['redirect_to'] ) && $wppb_private_website_settings['redirect_to'] == $page->ID ) ? 'selected' : '' ); ?>><?php echo $page->post_title ?></option>
78
- <?php
79
- }
80
- }
81
- ?>
82
-
83
- </select>
84
- <ul>
85
- <li class="description"><?php _e( 'Redirects to this page if not logged in. We recommend this page contains the [wppb-login] shortcode.', 'profile-builder' ); ?></li>
86
- <li class="description"><?php _e( 'You can force access to wp-login.php so you don\'t get locked out of the site by accessing the link:', 'profile-builder' ); ?> <a href="<?php echo wp_login_url().'?wppb_force_wp_login=true' ?>"><?php echo wp_login_url().'?wppb_force_wp_login=true' ?></a></li>
87
- </ul>
88
- </td>
89
- </tr>
90
-
91
- <tr>
92
- <th><?php _e( 'Allowed Pages', 'profile-builder' ); ?></th>
93
- <td>
94
- <select id="private-website-allowed-pages" class="wppb-select" name="wppb_private_website_settings[allowed_pages][]" multiple="multiple">
95
- <?php
96
- if( !empty( $all_pages ) ){
97
- foreach ($all_pages as $page){
98
- ?>
99
- <option value="<?php echo $page->ID ?>" <?php echo ( ( $wppb_private_website_settings != 'not_found' && isset( $wppb_private_website_settings['allowed_pages'] ) && in_array( $page->ID, $wppb_private_website_settings['allowed_pages'] ) ) ? 'selected' : '' ); ?>><?php echo $page->post_title ?></option>
100
- <?php
101
- }
102
- }
103
- ?>
104
-
105
- </select>
106
- <ul>
107
- <li class="description"><?php _e( 'Allow these pages to be accessed even if you are not logged in', 'profile-builder' ); ?></li>
108
- </ul>
109
- </td>
110
- </tr>
111
-
112
- <tr>
113
- <th><?php _e( 'Hide all Menus', 'profile-builder' ); ?></th>
114
- <td>
115
- <select id="private-website-menu-hide" class="wppb-select" name="wppb_private_website_settings[hide_menus]">
116
- <option value="no" <?php echo ( ( $wppb_private_website_settings != 'not_found' && !empty($wppb_private_website_settings['hide_menus']) && $wppb_private_website_settings['hide_menus'] == 'no' ) ? 'selected' : '' ); ?>><?php _e( 'No', 'profile-builder' ); ?></option>
117
- <option value="yes" <?php echo ( ( $wppb_private_website_settings != 'not_found' && !empty($wppb_private_website_settings['hide_menus']) && $wppb_private_website_settings['hide_menus'] == 'yes' ) ? 'selected' : '' ); ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
118
- </select>
119
- <ul>
120
- <li class="description"><?php _e( 'Hide all menu items if you are not logged in.', 'profile-builder' ); ?></li>
121
- <li class="description"><?php printf( __( 'We recommend "<a href="%s" target="_blank">Custom Profile Menus</a>" addon if you need different menu items for logged in / logged out users.', 'profile-builder' ), 'https://www.cozmoslabs.com/add-ons/custom-profile-menus/' ); ?></li>
122
- </ul>
123
- </td>
124
- </tr>
125
-
126
- </tbody>
127
- </table>
128
-
129
- <?php submit_button( __( 'Save Changes', 'profile-builder' ) ); ?>
130
- </form>
131
-
132
-
133
- </div>
134
- <?php
135
  }
1
+ <?php
2
+
3
+ /**
4
+ * Function that creates the "Private Website" submenu page
5
+ *
6
+ * @since v.2.0
7
+ *
8
+ * @return void
9
+ */
10
+ function wppb_private_website_submenu_page() {
11
+ add_submenu_page( null, __( 'Private Website', 'profile-builder' ), __( 'Private Website', 'profile-builder' ), 'manage_options', 'profile-builder-private-website', 'wppb_private_website_content' );
12
+ }
13
+ add_action( 'admin_menu', 'wppb_private_website_submenu_page' );
14
+
15
+
16
+ /**
17
+ * Function that generates the default settings for private page
18
+ */
19
+ function wppb_private_website_settings_defaults() {
20
+
21
+ add_option( 'wppb_private_website_settings',
22
+ array(
23
+ 'private_website' => 'no',
24
+ 'redirect_to' => '',
25
+ 'allowed_pages' => array(),
26
+ 'hide_menus' => 'no',
27
+ )
28
+ );
29
+
30
+ }
31
+
32
+ /**
33
+ * Function that generates the content for the settings page
34
+ */
35
+ function wppb_private_website_content() {
36
+
37
+ wppb_private_website_settings_defaults();
38
+
39
+ $wppb_private_website_settings = get_option( 'wppb_private_website_settings', 'not_found' );
40
+ $all_pages = get_pages();
41
+ ?>
42
+ <div class="wrap wppb-wrap wppb-private-website">
43
+ <h2><?php _e( 'Private Website Settings', 'profile-builder' );?></h2>
44
+
45
+ <?php settings_errors(); ?>
46
+
47
+ <?php wppb_generate_settings_tabs() ?>
48
+
49
+ <form method="post" action="options.php">
50
+ <?php settings_fields( 'wppb_private_website_settings' ); ?>
51
+
52
+ <table class="form-table">
53
+ <tbody>
54
+
55
+ <tr>
56
+ <th><?php _e( 'Enable Private Website', 'profile-builder' ); ?></th>
57
+ <td>
58
+ <select id="private-website-enable" class="wppb-select" name="wppb_private_website_settings[private_website]">
59
+ <option value="no" <?php echo ( ( $wppb_private_website_settings != 'not_found' && $wppb_private_website_settings['private_website'] == 'no' ) ? 'selected' : '' ); ?>><?php _e( 'No', 'profile-builder' ); ?></option>
60
+ <option value="yes" <?php echo ( ( $wppb_private_website_settings != 'not_found' && $wppb_private_website_settings['private_website'] == 'yes' ) ? 'selected' : '' ); ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
61
+ </select>
62
+ <ul>
63
+ <li class="description"><?php _e( 'Activate Private Website. It will restrict the content, RSS and REST API for your website', 'profile-builder' ); ?></li>
64
+ </ul>
65
+ </td>
66
+ </tr>
67
+
68
+ <tr>
69
+ <th><?php _e( 'Redirect to', 'profile-builder' ); ?></th>
70
+ <td>
71
+ <select id="private-website-redirect-to-login" class="wppb-select" name="wppb_private_website_settings[redirect_to]">
72
+ <option value=""><?php _e( 'Default WordPress login page', 'profile-builder' ); ?></option>
73
+ <?php
74
+ if( !empty( $all_pages ) ){
75
+ foreach ($all_pages as $page){
76
+ ?>
77
+ <option value="<?php echo $page->ID ?>" <?php echo ( ( $wppb_private_website_settings != 'not_found' && isset( $wppb_private_website_settings['redirect_to'] ) && $wppb_private_website_settings['redirect_to'] == $page->ID ) ? 'selected' : '' ); ?>><?php echo $page->post_title ?></option>
78
+ <?php
79
+ }
80
+ }
81
+ ?>
82
+
83
+ </select>
84
+ <ul>
85
+ <li class="description"><?php _e( 'Redirects to this page if not logged in. We recommend this page contains the [wppb-login] shortcode.', 'profile-builder' ); ?></li>
86
+ <li class="description"><?php _e( 'You can force access to wp-login.php so you don\'t get locked out of the site by accessing the link:', 'profile-builder' ); ?> <a href="<?php echo wp_login_url().'?wppb_force_wp_login=true' ?>"><?php echo wp_login_url().'?wppb_force_wp_login=true' ?></a></li>
87
+ </ul>
88
+ </td>
89
+ </tr>
90
+
91
+ <tr>
92
+ <th><?php _e( 'Allowed Pages', 'profile-builder' ); ?></th>
93
+ <td>
94
+ <select id="private-website-allowed-pages" class="wppb-select" name="wppb_private_website_settings[allowed_pages][]" multiple="multiple">
95
+ <?php
96
+ if( !empty( $all_pages ) ){
97
+ foreach ($all_pages as $page){
98
+ ?>
99
+ <option value="<?php echo $page->ID ?>" <?php echo ( ( $wppb_private_website_settings != 'not_found' && isset( $wppb_private_website_settings['allowed_pages'] ) && in_array( $page->ID, $wppb_private_website_settings['allowed_pages'] ) ) ? 'selected' : '' ); ?>><?php echo $page->post_title ?></option>
100
+ <?php
101
+ }
102
+ }
103
+ ?>
104
+
105
+ </select>
106
+ <ul>
107
+ <li class="description"><?php _e( 'Allow these pages to be accessed even if you are not logged in', 'profile-builder' ); ?></li>
108
+ </ul>
109
+ </td>
110
+ </tr>
111
+
112
+ <tr>
113
+ <th><?php _e( 'Hide all Menus', 'profile-builder' ); ?></th>
114
+ <td>
115
+ <select id="private-website-menu-hide" class="wppb-select" name="wppb_private_website_settings[hide_menus]">
116
+ <option value="no" <?php echo ( ( $wppb_private_website_settings != 'not_found' && !empty($wppb_private_website_settings['hide_menus']) && $wppb_private_website_settings['hide_menus'] == 'no' ) ? 'selected' : '' ); ?>><?php _e( 'No', 'profile-builder' ); ?></option>
117
+ <option value="yes" <?php echo ( ( $wppb_private_website_settings != 'not_found' && !empty($wppb_private_website_settings['hide_menus']) && $wppb_private_website_settings['hide_menus'] == 'yes' ) ? 'selected' : '' ); ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
118
+ </select>
119
+ <ul>
120
+ <li class="description"><?php _e( 'Hide all menu items if you are not logged in.', 'profile-builder' ); ?></li>
121
+ <li class="description"><?php printf( __( 'We recommend "<a href="%s" target="_blank">Custom Profile Menus</a>" addon if you need different menu items for logged in / logged out users.', 'profile-builder' ), 'https://www.cozmoslabs.com/add-ons/custom-profile-menus/' ); ?></li>
122
+ </ul>
123
+ </td>
124
+ </tr>
125
+
126
+ </tbody>
127
+ </table>
128
+
129
+ <?php submit_button( __( 'Save Changes', 'profile-builder' ) ); ?>
130
+ </form>
131
+
132
+
133
+ </div>
134
+ <?php
135
  }
admin/register-version.php CHANGED
@@ -1,269 +1,269 @@
1
- <?php
2
- /**
3
- * Function that creates the "Register your version" submenu page
4
- *
5
- * @since v.2.0
6
- *
7
- * @return void
8
- */
9
-
10
- if( !is_multisite() ){
11
- function wppb_register_your_version_submenu_page()
12
- {
13
- if (PROFILE_BUILDER != 'Profile Builder Free')
14
- add_submenu_page('profile-builder', __('Register Your Version', 'profile-builder'), __('Register Version', 'profile-builder'), 'manage_options', 'profile-builder-register', 'wppb_register_your_version_content');
15
- }
16
- add_action('admin_menu', 'wppb_register_your_version_submenu_page', 20);
17
- }
18
- else{
19
- function wppb_multisite_register_your_version_page()
20
- {
21
- if (PROFILE_BUILDER != 'Profile Builder Free')
22
- add_menu_page(__('Profile Builder Register', 'profile-builder'), __('Profile Builder Register', 'profile-builder'), 'manage_options', 'profile-builder-register', 'wppb_register_your_version_content', WPPB_PLUGIN_URL . 'assets/images/pb-menu-icon.png');
23
- }
24
- add_action('network_admin_menu', 'wppb_multisite_register_your_version_page', 20);
25
- }
26
-
27
-
28
- /**
29
- * Function that adds content to the "Register your Version" submenu page
30
- *
31
- * @since v.2.0
32
- *
33
- * @return string
34
- */
35
- function wppb_register_your_version_content() {
36
-
37
- ?>
38
- <div class="wrap wppb-wrap">
39
- <?php
40
- if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
41
- wppb_serial_form('pro', 'Profile Builder Pro');
42
- }elseif ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ){
43
- wppb_serial_form('hobbyist', 'Profile Builder Hobbyist');
44
- }
45
- ?>
46
-
47
- </div>
48
- <?php
49
- }
50
-
51
- /**
52
- * Function that creates the "Register your version" form depending on Pro or Hobbyist version
53
- *
54
- * @since v.2.0
55
- *
56
- * @return void
57
- */
58
- function wppb_serial_form($version, $fullname){
59
- ?>
60
-
61
- <h2><?php printf( __( "Register your version of %s", 'profile-builder' ), $fullname ); ?></h2>
62
-
63
- <form method="post" action="<?php echo get_admin_url( 1, 'options.php' ) ?>">
64
-
65
- <?php $wppb_profile_builder_serial = get_option( 'wppb_profile_builder_'.$version.'_serial' ); ?>
66
- <?php $wppb_profile_builder_serial_status = get_option( 'wppb_profile_builder_'.$version.'_serial_status' ); ?>
67
- <?php settings_fields( 'wppb_profile_builder_'.$version.'_serial' ); ?>
68
-
69
- <p><?php printf( __( "Now that you acquired a copy of %s, you should take the time and register it with the serial number you received", 'profile-builder'), $fullname);?></p>
70
- <p><?php _e( "If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support.", 'profile-builder' );?></p>
71
- <p class="wppb-serial-wrap">
72
- <label for="wppb_profile_builder_<?php echo $version; ?>_serial"><?php _e(' Serial Number:', 'profile-builder' );?></label>
73
- <input type="password" size="50" name="wppb_profile_builder_<?php echo $version; ?>_serial" id="wppb_profile_builder_<?php echo $version; ?>_serial" class="regular-text" <?php if ( $wppb_profile_builder_serial != ''){ echo ' value="'.$wppb_profile_builder_serial.'"';} ?>/>
74
-
75
- <?php
76
- if( $wppb_profile_builder_serial_status == 'found' )
77
- echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/accept.png" title="'.__( 'The serial number was successfully validated!', 'profile-builder' ).'"/></span>';
78
- elseif ( $wppb_profile_builder_serial_status == 'notFound' )
79
- echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number entered couldn\'t be validated!','profile-builder' ).'"/></span>';
80
- elseif ( strpos( $wppb_profile_builder_serial_status, 'aboutToExpire') !== false )//instead of aboutToExpire if the client has autobbiling on then he will receive 'found' instead
81
- echo '<span class="validateStatus"><img src="' . WPPB_PLUGIN_URL . '/assets/images/icon_error.png" title="' . __('The serial number is about to expire soon!', 'profile-builder') . '"/>'. sprintf( __(' Your serial number is about to expire, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
82
- elseif ( $wppb_profile_builder_serial_status == 'expired' )
83
- echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number couldn\'t be validated because it expired!','profile-builder' ).'"/>'. sprintf( __(' Your serial number is expired, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
84
- elseif ( $wppb_profile_builder_serial_status == 'serverDown' )
85
- echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number couldn\'t be validated because process timed out. This is possible due to the server being down. Please try again later!','profile-builder' ).'"/></span>';
86
- ?>
87
- <span class="wppb-serialnumber-descr"><?php _e( '(e.g. CLPB-15-SN-253a55baa4fbe7bf595b2aabb8d72985)', 'profile-builder' );?></span>
88
- </p>
89
-
90
-
91
- <div id="wppb_submit_button_div">
92
- <input type="hidden" name="action" value="update" />
93
- <p class="submit">
94
- <?php wp_nonce_field( 'wppb_register_version_nonce', 'wppb_register_version_nonce' ); ?>
95
- <input type="submit" name="wppb_serial_number_activate" class="button-primary" value="<?php _e('Save Changes') ?>" />
96
- </p>
97
- </div>
98
-
99
- </form>
100
- <?php
101
- }
102
-
103
-
104
- //the function to check the validity of the serial number and save a variable in the DB; purely visual
105
- function wppb_check_serial_number($oldVal, $newVal){
106
-
107
- $serial_number_set = $newVal;
108
-
109
-
110
- $response = wp_remote_get( 'http://updatemetadata.cozmoslabs.com/checkserial/?serialNumberSent='.$serial_number_set );
111
- if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
112
- wppb_update_serial_status($response, 'pro');
113
- wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-pro-update" );
114
- } else {
115
- wppb_update_serial_status($response, 'hobbyist');
116
- wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-hobbyist-update" );
117
- }
118
- $user_ID = get_current_user_id();
119
- delete_user_meta( $user_ID, 'wppb_dismiss_notification' );
120
-
121
- }
122
-
123
- add_action( 'update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
124
- add_action( 'update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
125
-
126
- add_action( 'add_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
127
- add_action( 'add_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
128
-
129
- /**
130
- * @param $response
131
- */
132
- function wppb_update_serial_status($response, $version)
133
- {
134
- if (is_wp_error($response)) {
135
- update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //server down
136
- } elseif ((trim($response['body']) != 'notFound') && (trim($response['body']) != 'found') && (trim($response['body']) != 'expired') && (strpos( $response['body'], 'aboutToExpire' ) === false)) {
137
- update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //unknown response parameter
138
- update_option('wppb_profile_builder_'.$version.'_serial', ''); //reset the entered password, since the user will need to try again later
139
-
140
- } else {
141
- update_option('wppb_profile_builder_'.$version.'_serial_status', trim($response['body'])); //either found, notFound or expired
142
- }
143
- }
144
-
145
- //the update didn't work when the old value = new value, so we need to apply a filter on get_option (that is run before update_option), that resets the old value
146
- function wppb_check_serial_number_fix($newvalue, $oldvalue){
147
-
148
- if ( $newvalue == $oldvalue )
149
- wppb_check_serial_number( $oldvalue, $newvalue );
150
-
151
- return $newvalue;
152
- }
153
- add_filter( 'pre_update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number_fix', 10, 2 );
154
- add_filter( 'pre_update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number_fix', 10, 2 );
155
-
156
-
157
- /**
158
- * Class that adds a notice when either the serial number wasn't found, or it has expired
159
- *
160
- * @since v.2.0
161
- *
162
- * @return void
163
- */
164
- class WPPB_add_notices{
165
- public $pluginPrefix = '';
166
- public $pluginName = '';
167
- public $notificaitonMessage = '';
168
- public $pluginSerialStatus = '';
169
-
170
- function __construct( $pluginPrefix, $pluginName, $notificaitonMessage, $pluginSerialStatus ){
171
- $this->pluginPrefix = $pluginPrefix;
172
- $this->pluginName = $pluginName;
173
- $this->notificaitonMessage = $notificaitonMessage;
174
- $this->pluginSerialStatus = $pluginSerialStatus;
175
-
176
- add_action( 'admin_notices', array( $this, 'add_admin_notice' ) );
177
- add_action( 'admin_init', array( $this, 'dismiss_notification' ) );
178
- }
179
-
180
-
181
- // Display a notice that can be dismissed in case the serial number is inactive
182
- function add_admin_notice() {
183
- global $current_user ;
184
- global $pagenow;
185
-
186
- $user_id = $current_user->ID;
187
-
188
- do_action( $this->pluginPrefix.'_before_notification_displayed', $current_user, $pagenow );
189
-
190
- if ( current_user_can( 'manage_options' ) ){
191
-
192
- $plugin_serial_status = get_option( $this->pluginSerialStatus );
193
- if ( $plugin_serial_status != 'found' ){
194
-
195
- //we want to show the expiration notice on our plugin pages even if the user dismissed it on the rest of the site
196
- $force_show = false;
197
- if ( $plugin_serial_status == 'expired' ) {
198
- $notification_instance = WPPB_Plugin_Notifications::get_instance();
199
- if ($notification_instance->is_plugin_page()){
200
- $force_show = true;
201
- }
202
- }
203
-
204
- // Check that the user hasn't already clicked to ignore the message
205
- if ( ! get_user_meta($user_id, $this->pluginPrefix.'_dismiss_notification' ) || $force_show ) {
206
- echo $finalMessage = apply_filters($this->pluginPrefix.'_notification_message','<div class="error wppb-serial-notification" >'.$this->notificaitonMessage.'</div>', $this->notificaitonMessage);
207
- }
208
- }
209
-
210
- do_action( $this->pluginPrefix.'_notification_displayed', $current_user, $pagenow, $plugin_serial_status );
211
-
212
- }
213
-
214
- do_action( $this->pluginPrefix.'_after_notification_displayed', $current_user, $pagenow );
215
-
216
- }
217
-
218
- function dismiss_notification() {
219
- global $current_user;
220
-
221
- $user_id = $current_user->ID;
222
-
223
- do_action( $this->pluginPrefix.'_before_notification_dismissed', $current_user );
224
-
225
- // If user clicks to ignore the notice, add that to their user meta
226
- if ( isset( $_GET[$this->pluginPrefix.'_dismiss_notification']) && '0' == $_GET[$this->pluginPrefix.'_dismiss_notification'] )
227
- add_user_meta( $user_id, $this->pluginPrefix.'_dismiss_notification', 'true', true );
228
-
229
- do_action( $this->pluginPrefix.'_after_notification_dismissed', $current_user );
230
- }
231
- }
232
-
233
- if( is_multisite() && function_exists( 'switch_to_blog' ) )
234
- switch_to_blog(1);
235
-
236
- if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
237
- $wppb_profile_builder_pro_hobbyist_serial_status = get_option( 'wppb_profile_builder_pro_serial_status', 'empty' );
238
- $version = 'pro';
239
-
240
- } elseif( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) {
241
- $wppb_profile_builder_pro_hobbyist_serial_status = get_option( 'wppb_profile_builder_hobbyist_serial_status', 'empty' );
242
- $version = 'hobbyist';
243
- }
244
- if( is_multisite() && function_exists( 'restore_current_blog' ) )
245
- restore_current_blog();
246
-
247
- if ( $wppb_profile_builder_pro_hobbyist_serial_status == 'notFound' || $wppb_profile_builder_pro_hobbyist_serial_status == 'empty' ){
248
- if( !is_multisite() )
249
- $register_url = 'admin.php?page=profile-builder-register';
250
- else
251
- $register_url = network_admin_url( 'admin.php?page=profile-builder-register' );
252
-
253
- new WPPB_add_notices( 'wppb', 'profile_builder_pro', sprintf( __( '<p>Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s</p>', 'profile-builder'), "<a href='". $register_url ."'>", "</a>", "<a href='https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-SN-Purchase' target='_blank' class='button-primary'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
254
- }
255
- elseif ( $wppb_profile_builder_pro_hobbyist_serial_status == 'expired' ){
256
- /* on our plugin pages do not add the dismiss button for the expired notification*/
257
- $notification_instance = WPPB_Plugin_Notifications::get_instance();
258
- if( $notification_instance->is_plugin_page() )
259
- $message = __( '<p>Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s</p>', 'profile-builder');
260
- else
261
- $message = __( '<p>Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s</p>', 'profile-builder');
262
-
263
- new WPPB_add_notices( 'wppb_expired', 'profile_builder_pro', sprintf( $message, "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", "<a href='". esc_url( add_query_arg( 'wppb_expired_dismiss_notification', '0' ) ) ."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
264
- }
265
- elseif( strpos( $wppb_profile_builder_pro_hobbyist_serial_status, 'aboutToExpire' ) === 0 ){
266
- $serial_status_parts = explode( '#', $wppb_profile_builder_pro_hobbyist_serial_status );
267
- $date = $serial_status_parts[1];
268
- new WPPB_add_notices( 'wppb_about_to_expire', 'profile_builder_pro', sprintf( __( '<p>Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s</p>', 'profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", $date, "<a href='". esc_url( add_query_arg( 'wppb_about_to_expire_dismiss_notification', '0' ) )."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
269
- }
1
+ <?php
2
+ /**
3
+ * Function that creates the "Register your version" submenu page
4
+ *
5
+ * @since v.2.0
6
+ *
7
+ * @return void
8
+ */
9
+
10
+ if( !is_multisite() ){
11
+ function wppb_register_your_version_submenu_page()
12
+ {
13
+ if (PROFILE_BUILDER != 'Profile Builder Free')
14
+ add_submenu_page('profile-builder', __('Register Your Version', 'profile-builder'), __('Register Version', 'profile-builder'), 'manage_options', 'profile-builder-register', 'wppb_register_your_version_content');
15
+ }
16
+ add_action('admin_menu', 'wppb_register_your_version_submenu_page', 20);
17
+ }
18
+ else{
19
+ function wppb_multisite_register_your_version_page()
20
+ {
21
+ if (PROFILE_BUILDER != 'Profile Builder Free')
22
+ add_menu_page(__('Profile Builder Register', 'profile-builder'), __('Profile Builder Register', 'profile-builder'), 'manage_options', 'profile-builder-register', 'wppb_register_your_version_content', WPPB_PLUGIN_URL . 'assets/images/pb-menu-icon.png');
23
+ }
24
+ add_action('network_admin_menu', 'wppb_multisite_register_your_version_page', 20);
25
+ }
26
+
27
+
28
+ /**
29
+ * Function that adds content to the "Register your Version" submenu page
30
+ *
31
+ * @since v.2.0
32
+ *
33
+ * @return string
34
+ */
35
+ function wppb_register_your_version_content() {
36
+
37
+ ?>
38
+ <div class="wrap wppb-wrap">
39
+ <?php
40
+ if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
41
+ wppb_serial_form('pro', 'Profile Builder Pro');
42
+ }elseif ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ){
43
+ wppb_serial_form('hobbyist', 'Profile Builder Hobbyist');
44
+ }
45
+ ?>
46
+
47
+ </div>
48
+ <?php
49
+ }
50
+
51
+ /**
52
+ * Function that creates the "Register your version" form depending on Pro or Hobbyist version
53
+ *
54
+ * @since v.2.0
55
+ *
56
+ * @return void
57
+ */
58
+ function wppb_serial_form($version, $fullname){
59
+ ?>
60
+
61
+ <h2><?php printf( __( "Register your version of %s", 'profile-builder' ), $fullname ); ?></h2>
62
+
63
+ <form method="post" action="<?php echo get_admin_url( 1, 'options.php' ) ?>">
64
+
65
+ <?php $wppb_profile_builder_serial = get_option( 'wppb_profile_builder_'.$version.'_serial' ); ?>
66
+ <?php $wppb_profile_builder_serial_status = get_option( 'wppb_profile_builder_'.$version.'_serial_status' ); ?>
67
+ <?php settings_fields( 'wppb_profile_builder_'.$version.'_serial' ); ?>
68
+
69
+ <p><?php printf( __( "Now that you acquired a copy of %s, you should take the time and register it with the serial number you received", 'profile-builder'), $fullname);?></p>
70
+ <p><?php _e( "If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support.", 'profile-builder' );?></p>
71
+ <p class="wppb-serial-wrap">
72
+ <label for="wppb_profile_builder_<?php echo $version; ?>_serial"><?php _e(' Serial Number:', 'profile-builder' );?></label>
73
+ <input type="password" size="50" name="wppb_profile_builder_<?php echo $version; ?>_serial" id="wppb_profile_builder_<?php echo $version; ?>_serial" class="regular-text" <?php if ( $wppb_profile_builder_serial != ''){ echo ' value="'.$wppb_profile_builder_serial.'"';} ?>/>
74
+
75
+ <?php
76
+ if( $wppb_profile_builder_serial_status == 'found' )
77
+ echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/accept.png" title="'.__( 'The serial number was successfully validated!', 'profile-builder' ).'"/></span>';
78
+ elseif ( $wppb_profile_builder_serial_status == 'notFound' )
79
+ echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number entered couldn\'t be validated!','profile-builder' ).'"/></span>';
80
+ elseif ( strpos( $wppb_profile_builder_serial_status, 'aboutToExpire') !== false )//instead of aboutToExpire if the client has autobbiling on then he will receive 'found' instead
81
+ echo '<span class="validateStatus"><img src="' . WPPB_PLUGIN_URL . '/assets/images/icon_error.png" title="' . __('The serial number is about to expire soon!', 'profile-builder') . '"/>'. sprintf( __(' Your serial number is about to expire, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
82
+ elseif ( $wppb_profile_builder_serial_status == 'expired' )
83
+ echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number couldn\'t be validated because it expired!','profile-builder' ).'"/>'. sprintf( __(' Your serial number is expired, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
84
+ elseif ( $wppb_profile_builder_serial_status == 'serverDown' )
85
+ echo '<span class="validateStatus"><img src="'.WPPB_PLUGIN_URL.'/assets/images/icon_error.png" title="'.__( 'The serial number couldn\'t be validated because process timed out. This is possible due to the server being down. Please try again later!','profile-builder' ).'"/></span>';
86
+ ?>
87
+ <span class="wppb-serialnumber-descr"><?php _e( '(e.g. CLPB-15-SN-253a55baa4fbe7bf595b2aabb8d72985)', 'profile-builder' );?></span>
88
+ </p>
89
+
90
+
91
+ <div id="wppb_submit_button_div">
92
+ <input type="hidden" name="action" value="update" />
93
+ <p class="submit">
94
+ <?php wp_nonce_field( 'wppb_register_version_nonce', 'wppb_register_version_nonce' ); ?>
95
+ <input type="submit" name="wppb_serial_number_activate" class="button-primary" value="<?php _e('Save Changes') ?>" />
96
+ </p>
97
+ </div>
98
+
99
+ </form>
100
+ <?php
101
+ }
102
+
103
+
104
+ //the function to check the validity of the serial number and save a variable in the DB; purely visual
105
+ function wppb_check_serial_number($oldVal, $newVal){
106
+
107
+ $serial_number_set = $newVal;
108
+
109
+
110
+ $response = wp_remote_get( 'http://updatemetadata.cozmoslabs.com/checkserial/?serialNumberSent='.$serial_number_set );
111
+ if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
112
+ wppb_update_serial_status($response, 'pro');
113
+ wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-pro-update" );
114
+ } else {
115
+ wppb_update_serial_status($response, 'hobbyist');
116
+ wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-hobbyist-update" );
117
+ }
118
+ $user_ID = get_current_user_id();
119
+ delete_user_meta( $user_ID, 'wppb_dismiss_notification' );
120
+
121
+ }
122
+
123
+ add_action( 'update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
124
+ add_action( 'update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
125
+
126
+ add_action( 'add_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
127
+ add_action( 'add_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
128
+
129
+ /**
130
+ * @param $response
131
+ */
132
+ function wppb_update_serial_status($response, $version)
133
+ {
134
+ if (is_wp_error($response)) {
135
+ update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //server down
136
+ } elseif ((trim($response['body']) != 'notFound') && (trim($response['body']) != 'found') && (trim($response['body']) != 'expired') && (strpos( $response['body'], 'aboutToExpire' ) === false)) {
137
+ update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //unknown response parameter
138
+ update_option('wppb_profile_builder_'.$version.'_serial', ''); //reset the entered password, since the user will need to try again later
139
+
140
+ } else {
141
+ update_option('wppb_profile_builder_'.$version.'_serial_status', trim($response['body'])); //either found, notFound or expired
142
+ }
143
+ }
144
+
145
+ //the update didn't work when the old value = new value, so we need to apply a filter on get_option (that is run before update_option), that resets the old value
146
+ function wppb_check_serial_number_fix($newvalue, $oldvalue){
147
+
148
+ if ( $newvalue == $oldvalue )
149
+ wppb_check_serial_number( $oldvalue, $newvalue );
150
+
151
+ return $newvalue;
152
+ }
153
+ add_filter( 'pre_update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number_fix', 10, 2 );
154
+ add_filter( 'pre_update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number_fix', 10, 2 );
155
+
156
+
157
+ /**
158
+ * Class that adds a notice when either the serial number wasn't found, or it has expired
159
+ *
160
+ * @since v.2.0
161
+ *
162
+ * @return void
163
+ */
164
+ class WPPB_add_notices{
165
+ public $pluginPrefix = '';
166
+ public $pluginName = '';
167
+ public $notificaitonMessage = '';
168
+ public $pluginSerialStatus = '';
169
+
170
+ function __construct( $pluginPrefix, $pluginName, $notificaitonMessage, $pluginSerialStatus ){
171
+ $this->pluginPrefix = $pluginPrefix;
172
+ $this->pluginName = $pluginName;
173
+ $this->notificaitonMessage = $notificaitonMessage;
174
+ $this->pluginSerialStatus = $pluginSerialStatus;
175
+
176
+ add_action( 'admin_notices', array( $this, 'add_admin_notice' ) );
177
+ add_action( 'admin_init', array( $this, 'dismiss_notification' ) );
178
+ }
179
+
180
+
181
+ // Display a notice that can be dismissed in case the serial number is inactive
182
+ function add_admin_notice() {
183
+ global $current_user ;
184
+ global $pagenow;
185
+
186
+ $user_id = $current_user->ID;
187
+
188
+ do_action( $this->pluginPrefix.'_before_notification_displayed', $current_user, $pagenow );
189
+
190
+ if ( current_user_can( 'manage_options' ) ){
191
+
192
+ $plugin_serial_status = get_option( $this->pluginSerialStatus );
193
+ if ( $plugin_serial_status != 'found' ){
194
+
195
+ //we want to show the expiration notice on our plugin pages even if the user dismissed it on the rest of the site
196
+ $force_show = false;
197
+ if ( $plugin_serial_status == 'expired' ) {
198
+ $notification_instance = WPPB_Plugin_Notifications::get_instance();
199
+ if ($notification_instance->is_plugin_page()){
200
+ $force_show = true;
201
+ }
202
+ }
203
+
204
+ // Check that the user hasn't already clicked to ignore the message
205
+ if ( ! get_user_meta($user_id, $this->pluginPrefix.'_dismiss_notification' ) || $force_show ) {
206
+ echo $finalMessage = apply_filters($this->pluginPrefix.'_notification_message','<div class="error wppb-serial-notification" >'.$this->notificaitonMessage.'</div>', $this->notificaitonMessage);
207
+ }
208
+ }
209
+
210
+ do_action( $this->pluginPrefix.'_notification_displayed', $current_user, $pagenow, $plugin_serial_status );
211
+
212
+ }
213
+
214
+ do_action( $this->pluginPrefix.'_after_notification_displayed', $current_user, $pagenow );
215
+
216
+ }
217
+
218
+ function dismiss_notification() {
219
+ global $current_user;
220
+
221
+ $user_id = $current_user->ID;
222
+
223
+ do_action( $this->pluginPrefix.'_before_notification_dismissed', $current_user );
224
+
225
+ // If user clicks to ignore the notice, add that to their user meta
226
+ if ( isset( $_GET[$this->pluginPrefix.'_dismiss_notification']) && '0' == $_GET[$this->pluginPrefix.'_dismiss_notification'] )
227
+ add_user_meta( $user_id, $this->pluginPrefix.'_dismiss_notification', 'true', true );
228
+
229
+ do_action( $this->pluginPrefix.'_after_notification_dismissed', $current_user );
230
+ }
231
+ }
232
+
233
+ if( is_multisite() && function_exists( 'switch_to_blog' ) )
234
+ switch_to_blog(1);
235
+
236
+ if ( PROFILE_BUILDER == 'Profile Builder Pro' ){
237
+ $wppb_profile_builder_pro_hobbyist_serial_status = get_option( 'wppb_profile_builder_pro_serial_status', 'empty' );
238
+ $version = 'pro';
239
+
240
+ } elseif( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) {
241
+ $wppb_profile_builder_pro_hobbyist_serial_status = get_option( 'wppb_profile_builder_hobbyist_serial_status', 'empty' );
242
+ $version = 'hobbyist';
243
+ }
244
+ if( is_multisite() && function_exists( 'restore_current_blog' ) )
245
+ restore_current_blog();
246
+
247
+ if ( $wppb_profile_builder_pro_hobbyist_serial_status == 'notFound' || $wppb_profile_builder_pro_hobbyist_serial_status == 'empty' ){
248
+ if( !is_multisite() )
249
+ $register_url = 'admin.php?page=profile-builder-register';
250
+ else
251
+ $register_url = network_admin_url( 'admin.php?page=profile-builder-register' );
252
+
253
+ new WPPB_add_notices( 'wppb', 'profile_builder_pro', sprintf( __( '<p>Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s</p>', 'profile-builder'), "<a href='". $register_url ."'>", "</a>", "<a href='https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-SN-Purchase' target='_blank' class='button-primary'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
254
+ }
255
+ elseif ( $wppb_profile_builder_pro_hobbyist_serial_status == 'expired' ){
256
+ /* on our plugin pages do not add the dismiss button for the expired notification*/
257
+ $notification_instance = WPPB_Plugin_Notifications::get_instance();
258
+ if( $notification_instance->is_plugin_page() )
259
+ $message = __( '<p>Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s</p>', 'profile-builder');
260
+ else
261
+ $message = __( '<p>Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s</p>', 'profile-builder');
262
+
263
+ new WPPB_add_notices( 'wppb_expired', 'profile_builder_pro', sprintf( $message, "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", "<a href='". esc_url( add_query_arg( 'wppb_expired_dismiss_notification', '0' ) ) ."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
264
+ }
265
+ elseif( strpos( $wppb_profile_builder_pro_hobbyist_serial_status, 'aboutToExpire' ) === 0 ){
266
+ $serial_status_parts = explode( '#', $wppb_profile_builder_pro_hobbyist_serial_status );
267
+ $date = $serial_status_parts[1];
268
+ new WPPB_add_notices( 'wppb_about_to_expire', 'profile_builder_pro', sprintf( __( '<p>Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s</p>', 'profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", $date, "<a href='". esc_url( add_query_arg( 'wppb_about_to_expire_dismiss_notification', '0' ) )."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
269
+ }
assets/css/rtl.css CHANGED
@@ -1,60 +1,60 @@
1
- .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap {
2
- float:right;
3
- }
4
- #wppb-search-fields{
5
- float:right;
6
- }
7
- .wppb-form-field label,
8
- #wppb-login-wrap .login-username label,
9
- #wppb-login-wrap .login-password label{
10
- float:right;
11
- }
12
- .wppb-form-field input,
13
- .wppb-form-field input[type="text"], .wppb-form-field input[type="email"], .wppb-form-field input[type="url"], .wppb-form-field input[type="password"], .wppb-form-field input[type="search"],
14
- .wppb-form-field select,
15
- .wppb-form-field textarea,
16
- .wppb-checkboxes,
17
- .wppb-radios,
18
- #wppb-login-wrap .login-username input,
19
- #wppb-login-wrap .login-password input{
20
- float:right;
21
- }
22
- .wppb-table th{
23
- text-align: right;
24
- }
25
- ul.wppb-profile li label{
26
- float:right;
27
- }
28
- ul.wppb-profile li span{
29
- float:right;
30
- }
31
-
32
- @media screen and ( max-width: 720px ) {
33
- .wppb-table td {
34
- text-align: right;
35
- }
36
- .wppb-table .wppb-posts,
37
- .wppb-table .wppb-moreinfo{
38
- text-align: left;
39
- }
40
- .wppb-table td:before {
41
- float: right;
42
- }
43
- }
44
-
45
- @media screen and (max-width: 400px) {
46
- .wppb-form-field input,
47
- .wppb-form-field select,
48
- .wppb-form-field textarea,
49
- .wppb-checkboxes,
50
- .wppb-radios,
51
- #wppb-login-wrap .login-username input,
52
- #wppb-login-wrap .login-password input,
53
- ul.wppb-profile li span{
54
- float:right;
55
- }
56
- }
57
-
58
- #pass-strength-result {
59
- float: right;
60
  }
1
+ .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap {
2
+ float:right;
3
+ }
4
+ #wppb-search-fields{
5
+ float:right;
6
+ }
7
+ .wppb-form-field label,
8
+ #wppb-login-wrap .login-username label,
9
+ #wppb-login-wrap .login-password label{
10
+ float:right;
11
+ }
12
+ .wppb-form-field input,
13
+ .wppb-form-field input[type="text"], .wppb-form-field input[type="email"], .wppb-form-field input[type="url"], .wppb-form-field input[type="password"], .wppb-form-field input[type="search"],
14
+ .wppb-form-field select,
15
+ .wppb-form-field textarea,
16
+ .wppb-checkboxes,
17
+ .wppb-radios,
18
+ #wppb-login-wrap .login-username input,
19
+ #wppb-login-wrap .login-password input{
20
+ float:right;
21
+ }
22
+ .wppb-table th{
23
+ text-align: right;
24
+ }
25
+ ul.wppb-profile li label{
26
+ float:right;
27
+ }
28
+ ul.wppb-profile li span{
29
+ float:right;
30
+ }
31
+
32
+ @media screen and ( max-width: 720px ) {
33
+ .wppb-table td {
34
+ text-align: right;
35
+ }
36
+ .wppb-table .wppb-posts,
37
+ .wppb-table .wppb-moreinfo{
38
+ text-align: left;
39
+ }
40
+ .wppb-table td:before {
41
+ float: right;
42
+ }
43
+ }
44
+
45
+ @media screen and (max-width: 400px) {
46
+ .wppb-form-field input,
47
+ .wppb-form-field select,
48
+ .wppb-form-field textarea,
49
+ .wppb-checkboxes,
50
+ .wppb-radios,
51
+ #wppb-login-wrap .login-username input,
52
+ #wppb-login-wrap .login-password input,
53
+ ul.wppb-profile li span{
54
+ float:right;
55
+ }
56
+ }
57
+
58
+ #pass-strength-result {
59
+ float: right;
60
  }
assets/css/select2/select2.min.css CHANGED
@@ -1 +1 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
assets/css/serial-notice.css CHANGED
@@ -1,51 +1,51 @@
1
- .wppb-serial-wrap{
2
- margin:40px 0;
3
- }
4
-
5
- .wppb-dismiss-notification{
6
- position:absolute;
7
- right:0px;
8
- top:50%;
9
- margin-top:-7px;
10
- }
11
- .pms-cross-promo .wppb-dismiss-notification{
12
- right: 10px;
13
- margin-top:-10px;
14
- }
15
-
16
- div.wppb-serial-notification p{
17
- padding-right: 50px;
18
- position:relative;
19
- }
20
- .pms-cross-promo{
21
- position: relative;
22
- background-color: #fff;
23
- border-left: 4px solid #d54e21;
24
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
25
- display: block;
26
- font-size: 14px;
27
- line-height: 19px;
28
- margin: 35px 20px 0 2px;
29
- padding: 11px 15px;
30
- text-align: left;
31
-
32
- color: #fff;
33
- background: #5693d3;
34
- }
35
- .pms-cross-promo a{
36
- padding: 0 3px;
37
- color:#fff;
38
- border-radius: 2px;
39
- }
40
- .pms-cross-promo a:hover{
41
- background: #fff;
42
- color: #5693d3;
43
- text-decoration: none;
44
- }
45
-
46
-
47
- /* hide menu items */
48
- .wp-submenu a[href="admin.php?page=profile-builder-admin-bar-settings"], .wp-submenu a[href="admin.php?page=profile-builder-content_restriction"],
49
- .wp-submenu a[href="admin.php?page=admin-email-customizer"], .wp-submenu a[href="admin.php?page=user-email-customizer"]{
50
- display:none !important;
51
  }
1
+ .wppb-serial-wrap{
2
+ margin:40px 0;
3
+ }
4
+
5
+ .wppb-dismiss-notification{
6
+ position:absolute;
7
+ right:0px;
8
+ top:50%;
9
+ margin-top:-7px;
10
+ }
11
+ .pms-cross-promo .wppb-dismiss-notification{
12
+ right: 10px;
13
+ margin-top:-10px;
14
+ }
15
+
16
+ div.wppb-serial-notification p{
17
+ padding-right: 50px;
18
+ position:relative;
19
+ }
20
+ .pms-cross-promo{
21
+ position: relative;
22
+ background-color: #fff;
23
+ border-left: 4px solid #d54e21;
24
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
25
+ display: block;
26
+ font-size: 14px;
27
+ line-height: 19px;
28
+ margin: 35px 20px 0 2px;
29
+ padding: 11px 15px;
30
+ text-align: left;
31
+
32
+ color: #fff;
33
+ background: #5693d3;
34
+ }
35
+ .pms-cross-promo a{
36
+ padding: 0 3px;
37
+ color:#fff;
38
+ border-radius: 2px;
39
+ }
40
+ .pms-cross-promo a:hover{
41
+ background: #fff;
42
+ color: #5693d3;
43
+ text-decoration: none;
44
+ }
45
+
46
+
47
+ /* hide menu items */
48
+ .wp-submenu a[href="admin.php?page=profile-builder-admin-bar-settings"], .wp-submenu a[href="admin.php?page=profile-builder-content_restriction"],
49
+ .wp-submenu a[href="admin.php?page=admin-email-customizer"], .wp-submenu a[href="admin.php?page=user-email-customizer"]{
50
+ display:none !important;
51
  }
assets/css/style-back-end.css CHANGED
@@ -1,835 +1,835 @@
1
- .wppb-wrap{
2
- clear: both;
3
- margin: 10px 0px 0 2px;
4
- }
5
- .wppb-wrap,
6
- .wppb-wrap p{
7
- font-size: 15px;
8
- max-width: 1050px;
9
- }
10
- .wppb-info-wrap{
11
- max-width:1050px;
12
- margin:25px 40px 0 20px;
13
- }
14
-
15
- .wppb-wrap h1 {
16
- color: #333333;
17
- font-size: 2.8em;
18
- font-weight: 400;
19
- line-height: 1.2em;
20
- margin:0;
21
- padding-top:35px;
22
- }
23
-
24
- .wppb-wrap .wppb-callout{
25
- font-size: 2em;
26
- font-weight: 300;
27
- line-height: 1.3;
28
- margin:1.1em 0 0.2em 0;
29
- }
30
-
31
- .wppb-wrap hr{
32
- display:block;
33
- clear:both;
34
- margin:20px 0;
35
- }
36
-
37
- .wppb-text{
38
- font-size:1.1em;
39
- margin-top:0;
40
- }
41
-
42
- .wppb-wrap ul{
43
- list-style-type:circle;
44
- list-style-position:inside;
45
- }
46
-
47
- .wppb-wrap li.description{
48
- font-style: italic;
49
- }
50
-
51
- .wppb-badge{
52
- float: right;
53
- color: #fff;
54
- display: inline-block;
55
- font-size: 14px;
56
- font-weight: 600;
57
- width: 150px;
58
- height: 150px;
59
- margin-bottom: 25px;
60
- text-align: center;
61
- text-rendering: optimizelegibility;
62
- }
63
-
64
- .wppb-badge.Pro{
65
- background:url(../images/pb-logo-pro.png) center no-repeat;
66
- }
67
-
68
- .wppb-badge.Hobbyist{
69
- background:url(../images/pb-logo-hobbyist.png) center no-repeat;
70
- }
71
-
72
- .wppb-badge.Free{
73
- background:url(../images/pb-logo-free.png) center no-repeat;
74
- }
75
-
76
- .wppb-badge.wppb-pb-pms{
77
- background:url(../images/pb-pms-cross-promotion-icon.png) center center no-repeat;
78
- }
79
-
80
- .wppb-badge {
81
- background-size: cover !important;
82
- }
83
-
84
- .wppb-badge span {
85
- display: inline-block;
86
- text-transform: uppercase;
87
- color: #fff;
88
- margin-top: 110px;
89
- font-size: 90%;
90
- }
91
-
92
- /* Userlist page */
93
- .wppb-ul-templates > textarea,
94
- .wppb-single-ul-templates > textarea {
95
- float: left;
96
- width: 60%;
97
- max-width: 100%;
98
- height: 400px;
99
- }
100
-
101
- .update_container_wppb_ul_faceted_settings .row-facet-behaviour,
102
- .update_container_wppb_ul_faceted_settings .row-facet-limit,
103
- #container_wppb_ul_faceted_settings .row-facet-behaviour,
104
- #container_wppb_ul_faceted_settings .row-facet-behaviour,
105
- #container_wppb_ul_faceted_settings .row-facet-limit{
106
- display:none;
107
- }
108
-
109
- #container_wppb_ul_faceted_settings .facet_type_checkboxes .row-facet-behaviour,
110
- #container_wppb_ul_faceted_settings .facet_type_checkboxes .row-facet-limit,
111
- #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_checkboxes .row-facet-behaviour,
112
- #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_checkboxes .row-facet-limit,
113
- #container_wppb_ul_faceted_settings .facet_type_select_multiple .row-facet-behaviour,
114
- #container_wppb_ul_faceted_settings .facet_type_select_multiple .row-facet-limit,
115
- #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_select_multiple .row-facet-behaviour,
116
- #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_select_multiple .row-facet-limit{
117
- display:block;
118
- }
119
-
120
-
121
- /* Extra Stuff */
122
- .nowrap {
123
- white-space: nowrap;
124
- }
125
-
126
- .wppb-fields-image{
127
- margin-top:60px;
128
- }
129
-
130
-
131
- /* Shortcode */
132
- .wppb-shortcode {
133
- display: inline-block;
134
- font-size: 13px;
135
- font-weight: bold;
136
- background: #fff !important;
137
- padding: 5px 10px;
138
- margin-top: 5px;
139
- border: 1px solid #e1e1e1;
140
- box-shadow: none !important;
141
- font-family: 'Arial';
142
- }
143
-
144
- .wppb-shortcode.textarea {
145
- width: 100%;
146
- height: 1px;
147
- resize: none;
148
- }
149
-
150
- .wppb-shortcode:focus {
151
- border-color: #e1e1e1 !important;
152
- }
153
-
154
- .wppb-shortcode-temp {
155
- display: inline-block;
156
- font-size: 13px;
157
- font-weight: bold;
158
- padding: 11px;
159
- font-family: 'Arial';
160
- }
161
-
162
-
163
- /* Manage Fields page */
164
- .profile-builder_page_manage-fields .metabox-holder .column-1{
165
- /* margin-right:0; */
166
- }
167
-
168
- #container_wppb_manage_fields li strong{
169
- display:none !important;
170
- }
171
-
172
- #container_wppb_manage_fields li .description strong {
173
- display: inline !important;
174
- }
175
-
176
- #container_wppb_manage_fields .added_fields_list li.row-meta-name{
177
- display:list-item !important;
178
- }
179
-
180
- #container_wppb_manage_fields li.row-field-title pre,
181
- #container_wppb_manage_fields li.row-meta-name pre{
182
- min-height:10px;
183
- }
184
-
185
- #wppb_manage_fields .ui-sortable label,
186
- #container_wppb_manage_fields .ui-sortable label {
187
- background: #fff;
188
- }
189
-
190
- #wppb_manage_fields .sortable-handle,
191
- #container_wppb_manage_fields .sortable-handle {
192
- display: inline-block;
193
- width: 16px;
194
- height: 16px;
195
- background: url('../images/sorting-icon-dots.png') no-repeat center center;;
196
- vertical-align: middle;
197
- margin-right: 7px;
198
- cursor: move;
199
- margin-top: -1px;
200
- }
201
-
202
- #container_wppb_manage_fields pre{
203
- display:block;
204
- float:left;
205
- width:27%;
206
- font-family:"Open Sans", Arial, sans-serif;
207
- font-size:14px;
208
- }
209
-
210
- #container_wppb_manage_fields pre.wppb-mb-head-required,
211
- #container_wppb_manage_fields li.row-required pre{
212
- width:auto;
213
- text-align: center;
214
- }
215
-
216
- #container_wppb_manage_fields thead tr{
217
- background:#f1f1f1;
218
- }
219
-
220
- #container_wppb_manage_fields thead tr:hover {
221
- background: #f1f1f1;
222
- }
223
-
224
- #container_wppb_manage_fields tr.update_container_wppb_manage_fields:hover{
225
- background:#fff;
226
- }
227
-
228
- #container_wppb_manage_fields tr:hover{
229
- background:#def6ff;
230
- }
231
-
232
- #wppb_manage_fields_info{
233
- display: none;
234
- }
235
-
236
- /* Extra Registration and Edit Profile fields */
237
- #container_wppb_epf_fields li strong,
238
- #container_wppb_rf_fields li strong{
239
- display:none !important;
240
- }
241
-
242
- #container_wppb_epf_fields pre,
243
- #container_wppb_rf_fields pre{
244
- display:block;
245
- font-family:"Open Sans", Arial, sans-serif;
246
- font-size:14px;
247
- margin-top: 5px;
248
- }
249
-
250
- #container_wppb_epf_fields thead tr,
251
- #container_wppb_rf_fields thead tr {
252
- background: #f1f1f1;
253
- }
254
- #container_wppb_epf_fields thead tr:hover,
255
- #container_wppb_rf_fields thead tr:hover {
256
- background: #f1f1f1;
257
- }
258
- #container_wppb_epf_fields thead .wppb-delete-all-fields,
259
- #container_wppb_rf_fields thead .wppb-delete-all-fields {
260
- color: #333;
261
- text-decoration: underline;
262
- }
263
-
264
- #container_wppb_epf_fields tbody .wck-delete,
265
- #container_wppb_rf_fields tbody .wck-delete {
266
- padding: 8px 16px;
267
- }
268
-
269
- #container_wppb_epf_fields tr.update_container_wppb_epf_fields:hover,
270
- #container_wppb_rf_fields tr.update_container_wppb_rf_fields:hover{
271
- background:none;
272
- }
273
-
274
- #container_wppb_epf_fields tr:hover,
275
- #container_wppb_rf_fields tr:hover{
276
- background:#def6ff;
277
- }
278
- #container_wppb_epf_fields .wck-content{
279
- content: "" !important;
280
- }
281
-
282
- #wppb_rf_page_settings .row-url, #wppb_rf_page_settings .row-display-messages, .update_container_wppb_rf_page_settings.redirect_ .row-url,
283
- .update_container_wppb_rf_page_settings.redirect_ .row-display-messages, .update_container_wppb_rf_page_settings.redirect_no .row-url,
284
- .update_container_wppb_rf_page_settings.redirect_no .row-display-messages{
285
- display:none;
286
- }
287
-
288
- #wppb_rf_page_settings.update_container_wppb_rf_page_settings.redirect_yes .row-url, #wppb_rf_page_settings.update_container_wppb_rf_page_settings.redirect_yes .row-display-messages{
289
- display: block;
290
- }
291
-
292
- #wppb_epf_page_settings .row-url, #wppb_epf_page_settings .row-display-messages, .update_container_wppb_epf_page_settings.redirect_ .row-url,
293
- .update_container_wppb_epf_page_settings.redirect_ .row-display-messages, .update_container_wppb_epf_page_settings.redirect_no .row-url,
294
- .update_container_wppb_epf_page_settings.redirect_no .row-display-messages{
295
- display:none;
296
- }
297
-
298
- #wppb_epf_page_settings.update_container_wppb_epf_page_settings.redirect_yes .row-url, #wppb_epf_page_settings.update_container_wppb_epf_page_settings.redirect_yes .row-display-messages{
299
- display: block;
300
- }
301
-
302
- /* Columns :) */
303
- .wppb-row{
304
- overflow:hidden;
305
- }
306
-
307
- .wppb-3-col > div {
308
- float:left;
309
- width:28%;
310
- margin-right:5%;
311
- }
312
-
313
- .wppb-2-col > div {
314
- float:left;
315
- width:45%;
316
- margin-right:5%;
317
- }
318
-
319
- .wppb-3-col > div:last-child,
320
- .wppb-2-col > div:last-child{
321
- margin:0;
322
- }
323
-
324
- .wppb-1-3-col > div {
325
- float:left;
326
- width:28%;
327
- margin-right:5%;
328
- }
329
- .wppb-1-3-col > div:last-child{
330
- float:right;
331
- width: 67%;
332
- margin:0;
333
- }
334
-
335
- .wppb-2-1-col > div {
336
- float:left;
337
- width:67%;
338
- margin-right:5%;
339
- }
340
- .wppb-2-1-col > div:last-child{
341
- float:right;
342
- width: 28%;
343
- margin:0;
344
- }
345
- /* Extra Form Styles */
346
- .wppb-text{
347
- min-width: 16.4em;
348
- }
349
- .wppb-select {
350
- min-width:18em;
351
- }
352
-
353
- .wppb-select.wppb-disabled, .wppb-disabled .select2-selection--single, .wppb-disabled .select2-selection--multiple{
354
- background-color: #eee;
355
- }
356
-
357
- .wppb-wrap .form-table th {
358
- width: 330px;
359
- }
360
-
361
- .wppb-metabox label{
362
- display:inline-block;
363
- min-width:15em;
364
- }
365
-
366
- /* Admin Bar Page */
367
- .wppb-admin-bar label{
368
- margin-right:30px;
369
- padding:5px;
370
- }
371
-
372
- /* modules Page */
373
- .wppb-modules label{
374
- margin-right:30px;
375
- padding:5px;
376
- }
377
-
378
- /* Metabox Clone. We need this in various places to simulate the css of a normal metabox. */
379
- .wppb-side{
380
- width:300px;
381
- float:right;
382
- clear:both;
383
- }
384
-
385
- .wppb-metabox h3{
386
- font-size: 14px;
387
- line-height: 1.4;
388
- margin: 0;
389
- padding:8px 12px;
390
- cursor:default !important;
391
- }
392
-
393
- .wppb-normal{
394
- margin-right:320px;
395
- }
396
-
397
- .wppb-metabox textarea{
398
- resize:vertical;
399
- background-color: #ecf8fd;
400
- font-family: Consolas,Monaco,monospace;
401
- font-size: 13px;
402
- }
403
-
404
- .wppb-metabox .inline-wrap{
405
- width:280px;
406
- float:left;
407
- }
408
- .wppb-highlight{
409
- background:#333333;
410
- background:#222222;
411
- background:#fff;
412
- padding:20px;
413
- }
414
- .wppb-userlisting-slider, .wppb-list-users-slider{
415
- display:block;
416
- padding:10px;
417
- border:1px solid #ccc;
418
- font-family: Consolas,Monaco,monospace;
419
- font-size: 13px;
420
- margin-top:20px;
421
- }
422
- #wppb_manage_fields .mb-list-entry-fields .field-label{
423
- max-width: 179px;
424
- }
425
-
426
- #container_wppb_epf_fields .row-id,
427
- #wppb_epf_fields .row-id,
428
- #container_wppb_rf_fields .row-id,
429
- #wppb_rf_fields .row-id{
430
- display:none;
431
- }
432
-
433
- .wppb-wrap #serial_number{
434
- font-weight: 600;
435
- line-height: 1.3;
436
- padding: 20px 10px 20px 0;
437
- text-align: left;
438
- color: #222222;
439
- font-size:14px;
440
- }
441
-
442
- #wppb_profile_builder_pro_serial{
443
- width:460px;
444
- padding: 5px;
445
- }
446
-
447
- .wppb-wrap .wppb-serialnumber-descr{
448
- display: block;
449
- padding: 0px 0px 0px 95px
450
- }
451
-
452
- .wppb-backend-notice{
453
- display: inline-block;
454
- line-height: 16px;
455
- padding: 11px;
456
- font-size: 14px;
457
- text-align: left;
458
- margin: 0 0 5px 0;
459
- background-color: #fff9e8;
460
- border:1px solid #ffba00;
461
- border-radius:3px;
462
- }
463
-
464
- /* hide "View post" link from update messages on internal post types */
465
- .post-type-wppb-ul-cpt #message.updated a, .post-type-wppb-rf-cpt #message.updated a, .post-type-wppb-epf-cpt #message.updated a{
466
- display:none;
467
- }
468
-
469
-
470
- #wppb_ul_page_settings .row-visible-to-following-roles, .update_container_wppb_ul_page_settings.visible_to_logged_ .row-visible-to-following-roles{
471
- display:none;
472
- }
473
-
474
- #wppb_ul_page_settings.update_container_wppb_ul_page_settings.visible_to_logged_yes .row-visible-to-following-roles{
475
- display: block;
476
- }
477
-
478
- /* Add-Ons page */
479
- .wppb-add-on-user-messages{ display: none; }
480
-
481
- .wppb-add-on-wrap .plugin-card-bottom:after {
482
- display: block;
483
- content: '';
484
- clear: both;
485
- }
486
-
487
- .wppb-add-on .spinner {
488
- visibility: visible;
489
- }
490
-
491
- .wppb-add-on a:focus {
492
- box-shadow: none;
493
- }
494
-
495
- .wppb-add-on img {
496
- max-width: 100%;
497
- height: auto;
498
- }
499
-
500
- .wppb-add-on .wppb-add-on-title {
501
- letter-spacing: -0.7px;
502
- margin-bottom: 7px;
503
- margin-top: 7px;
504
- }
505
-
506
- .wppb-add-on .wppb-add-on-title a {
507
- text-decoration: none;
508
- color: inherit;
509
- }
510
-
511
- .wppb-add-on .wppb-add-on-price {
512
- font-size: 1.1em;
513
- letter-spacing: -0.7px;
514
- margin-top: 7px;
515
- }
516
-
517
- .wppb-add-on-compatible span {
518
- line-height: 28px;
519
- }
520
-
521
- .wppb-add-on-not-compatible {
522
- position: relative;
523
- }
524
-
525
- .wppb-add-on-not-compatible:before {
526
- display: block;
527
- content: '';
528
- position: absolute;
529
- width: 4px;
530
- height: 100%;
531
- background: #d54e21;
532
- top: 0;
533
- left: 0;
534
- }
535
-
536
- .wppb-add-on .button {
537
- position: relative;
538
- }
539
-
540
- .wppb-add-on .button.wppb-add-on-deactivate {
541
- opacity: 0;
542
- }
543
-
544
- .wppb-add-on .spinner {
545
- display: block;
546
- margin-top: 4px;
547
- opacity: 0;
548
- }
549
-
550
- .wppb-add-on-spinner {
551
- opacity: 0;
552
- position: absolute;
553
- top: 50%;
554
- left: 50%;
555
- margin-top: -10px;
556
- margin-left: -10px;
557
- display: block;
558
- width: 20px;
559
- height: 20px;
560
- background: url('../images/spinner.gif') no-repeat center;
561
- }
562
-
563
- .wppb-recommended-plugin{
564
- width:49%;
565
- margin:0 0 16px 0;
566
- }
567
-
568
- .wppb-recommended-plugin.plugin-card:nth-child(odd){
569
- clear:none;
570
- float:right;
571
- margin-right: 0;
572
- }
573
-
574
- .wppb-recommended-plugin.plugin-card:nth-child(even){
575
- clear:none;
576
- }
577
-
578
- .wppb-recommended-plugin .wppb-add-on-description{
579
- min-height: 38px;
580
- }
581
-
582
- @media screen and (max-width: 768px){
583
- .wppb-recommended-plugin{
584
- width:100%;
585
- }
586
- }
587
-
588
- .wppb-confirmation-success {
589
- color: #27ae60;
590
- }
591
-
592
- .wppb-confirmation-error {
593
- color: #c0392b;
594
- }
595
-
596
- /* Manage Fields Responsive CSS */
597
- @media screen and ( max-width: 1125px ) {
598
- /* Manage Fields Responsive */
599
- #container_wppb_manage_fields th.wck-content pre{
600
- display:none;
601
- }
602
- #container_wppb_manage_fields li strong{
603
- display: inline-block !important;
604
- font-size: 14px;
605
- font-family: "Open Sans",Arial,sans-serif;
606
- }
607
- #container_wppb_manage_fields pre{
608
- display: inline;
609
- float:none;
610
- width:auto;
611
- }
612
- #container_wppb_manage_fields li strong{
613
- width:100px !important;
614
- }
615
- }
616
- /* Basic Information Buttons - for Free to Pro upgrade*/
617
- .wppb-button-free {
618
- border-radius: 3px;
619
- border-style: solid;
620
- border-width: 1px;
621
- box-sizing: border-box;
622
- cursor: pointer;
623
- display: inline-block;
624
- font-size: 13px;
625
- height: 29px;
626
- line-height: 26px;
627
- margin: 0;
628
- padding: 0 10px 1px;
629
- text-decoration: none;
630
- white-space: nowrap;
631
- background: none repeat scroll 0 0 #e14d43;
632
- border-color: #b2401b;
633
- -webkit-box-shadow: 0 1px 0 #ba281e !important;
634
- box-shadow: 0 1px 0 #ba281e !important;
635
- color: #fff !important;
636
- vertical-align:top;
637
- text-shadow: 0 -1px 1px #ba281e,1px 0 1px #ba281e,0 1px 1px #ba281e,-1px 0 1px #ba281e !important;
638
- }
639
- p .wppb-button-free {
640
- vertical-align: baseline;
641
- }
642
- .wppb-button-free:hover {
643
- background: #e14d43;
644
- border-color: #ba281e;
645
- color: #fff;
646
- }
647
-
648
- /* PMS Compatibility page */
649
- #pms-bottom-install .plugin-card-bottom{
650
- border:none;
651
- background: #e86054;
652
- color:#fff;
653
- }
654
-
655
- #pms-bottom-install .plugin-card-bottom span{
656
- display: inline-block;
657
- margin-top:7px;
658
- }
659
-
660
- #pms-bottom-install .wppb-add-on-download, #pms-bottom-install a{
661
- font-size: 130%;
662
- padding: 10px 20px;
663
- height: auto;
664
- color: #e86054;
665
- text-decoration: none;
666
- }
667
-
668
- #pms-bottom-install a:hover{
669
- background: #fff;
670
- text-decoration: none;
671
- }
672
-
673
- #pms-bottom-install .wppb-confirmation-success{
674
- color:#FFFFFF;
675
- }
676
-
677
- #wppb_ul_search_settings .wck-checkboxes > div{
678
- display: inline-block;
679
- margin-left:7px;
680
- }
681
-
682
- .mb-table-container .wck-state-highlight{
683
- height:45px;
684
- }
685
-
686
- /**************************************************/
687
- /* Extra styling for admin notices
688
- /**************************************************/
689
- div.wppb-notice {
690
- position: relative;
691
- }
692
-
693
- div.wppb-notice:after {
694
- display: block;
695
- content: '';
696
- clear: both;
697
- }
698
-
699
- div.wppb-notice.wppb-narrow {
700
- max-width: 825px;
701
- }
702
-
703
- div.wppb-notice .notice-dismiss {
704
- text-decoration: none;
705
- }
706
-
707
- .wrap div.wppb-admin-notice {
708
- margin-bottom: 0;
709
- }
710
-
711
-
712
- /**************************************************/
713
- /* Extra styling for select 2 manage fields
714
- /**************************************************/
715
-
716
- .profile-builder_page_manage-fields select#field{
717
- width: 100%;
718
- }
719
- /* maybe take this out after a while. we need to keep it because of translatepress but after the tp update it is not required */
720
- .profile-builder_page_manage-fields span.select2-container{
721
- width:100% !important;
722
- }
723
-
724
- .profile-builder_page_manage-fields .select2-selection.select2-selection--single{
725
- outline: 0;
726
- }
727
-
728
- #wppb_select2_overlay{
729
- display: none;
730
- position: fixed;
731
- top: 0;
732
- left: 0;
733
- width: 100%;
734
- height: 100%;
735
- background-color: #000;
736
- filter:alpha(opacity=50);
737
- -moz-opacity:0.5;
738
- -khtml-opacity: 0.5;
739
- opacity: 0.5;
740
- z-index: 1000;
741
- }
742
-
743
- .profile-builder_page_manage-fields .select2-container{
744
- z-index: 1051;
745
- }
746
-
747
- .profile-builder_page_manage-fields .select2-container--default .select2-selection--single .select2-selection__placeholder{
748
- color: #111;
749
- font-size: 15px;
750
- }
751
- .profile-builder_page_manage-fields .select2-container .select2-selection--single{
752
- height: 38px;
753
- }
754
- .profile-builder_page_manage-fields .select2-container .select2-selection--single .select2-selection__rendered{
755
- line-height: 38px;
756
- }
757
- .profile-builder_page_manage-fields .select2-container--default .select2-selection--single .select2-selection__arrow{
758
- height: 38px;
759
- }
760
-
761
- @media screen and ( min-width: 800px ) {
762
-
763
- .profile-builder_page_manage-fields .select2-results__option[role="group"] {
764
- width: 48%;
765
- margin: 0 1%;
766
- float: left;
767
- }
768
-
769
- .profile-builder_page_manage-fields .select2-container--default .select2-results > .select2-results__options,
770
- .profile-builder_page_manage-fields .select2-results{
771
- max-height: 800px;
772
- }
773
- }
774
- @media screen and ( min-width: 1280px ) {
775
-
776
- .profile-builder_page_manage-fields .select2-results__option[role="group"] {
777
- width: 23%;
778
- margin: 0 1%;
779
- float: left;
780
- }
781
-
782
- .profile-builder_page_manage-fields .select2-container--default .select2-results > .select2-results__options,
783
- .profile-builder_page_manage-fields .select2-results{
784
- max-height: 800px;
785
- }
786
- }
787
-
788
- .wppb-auto-form-creation{
789
- margin:50px 0 30px;
790
- padding:20px;
791
- background-color: #fff9e8;
792
- border: 1px solid #ffba00;
793
- border-radius: 3px;
794
- overflow: hidden;
795
- }
796
-
797
- .wppb-auto-form-creation.wppb-forms-created{
798
- background-color: #edffe8;
799
- border: 1px solid #46b450;
800
- }
801
-
802
- .wppb-auto-form-creation a.button{
803
- margin-top: 5px;
804
- }
805
-
806
- .wppb-subtabs{
807
- padding:7px 0 8px;
808
- float:none;
809
- }
810
-
811
- .wppb-subtabs li{
812
- padding:0 5px;
813
- border-right:1px solid #ddd;
814
- }
815
-
816
- .wppb-subtabs li:last-child{
817
- border-right:none;
818
- }
819
-
820
- .wppb-subtabs a{
821
- letter-spacing:0 !important;
822
- font-size:14px;
823
- }
824
-
825
- .profile-builder_page_user-email-customizer #poststuff, .profile-builder_page_admin-email-customizer #poststuff{
826
- padding:0;
827
- }
828
-
829
- /* Sortable options */
830
- .wppb_manage_fields_sortables {display: block; border: 1px solid #EEE; margin: 0px 0px 5px 32px; padding: 5px;}
831
- .wppb_manage_fields_sortables:hover {cursor: pointer; background-color: #EEE;}
832
- .wppb_manage_fields_sortables label {background: transparent !important;}
833
- .wppb_manage_fields_sortables > .dashicons {color: #f4f4f4; position: absolute; margin-left: -32px;}
834
- .wppb_manage_fields_sortables:hover > .dashicons {color: #000;}
835
- .wppb_selector_for_sortable_checkbox {margin-left: 32px; width: calc(100% - 32px);}
1
+ .wppb-wrap{
2
+ clear: both;
3
+ margin: 10px 0px 0 2px;
4
+ }
5
+ .wppb-wrap,
6
+ .wppb-wrap p{
7
+ font-size: 15px;
8
+ max-width: 1050px;
9
+ }
10
+ .wppb-info-wrap{
11
+ max-width:1050px;
12
+ margin:25px 40px 0 20px;
13
+ }
14
+
15
+ .wppb-wrap h1 {
16
+ color: #333333;
17
+ font-size: 2.8em;
18
+ font-weight: 400;
19
+ line-height: 1.2em;
20
+ margin:0;
21
+ padding-top:35px;
22
+ }
23
+
24
+ .wppb-wrap .wppb-callout{
25
+ font-size: 2em;
26
+ font-weight: 300;
27
+ line-height: 1.3;
28
+ margin:1.1em 0 0.2em 0;
29
+ }
30
+
31
+ .wppb-wrap hr{
32
+ display:block;
33
+ clear:both;
34
+ margin:20px 0;
35
+ }
36
+
37
+ .wppb-text{
38
+ font-size:1.1em;
39
+ margin-top:0;
40
+ }
41
+
42
+ .wppb-wrap ul{
43
+ list-style-type:circle;
44
+ list-style-position:inside;
45
+ }
46
+
47
+ .wppb-wrap li.description{
48
+ font-style: italic;
49
+ }
50
+
51
+ .wppb-badge{
52
+ float: right;
53
+ color: #fff;
54
+ display: inline-block;
55
+ font-size: 14px;
56
+ font-weight: 600;
57
+ width: 150px;
58
+ height: 150px;
59
+ margin-bottom: 25px;
60
+ text-align: center;
61
+ text-rendering: optimizelegibility;
62
+ }
63
+
64
+ .wppb-badge.Pro{
65
+ background:url(../images/pb-logo-pro.png) center no-repeat;
66
+ }
67
+
68
+ .wppb-badge.Hobbyist{
69
+ background:url(../images/pb-logo-hobbyist.png) center no-repeat;
70
+ }
71
+
72
+ .wppb-badge.Free{
73
+ background:url(../images/pb-logo-free.png) center no-repeat;
74
+ }
75
+
76
+ .wppb-badge.wppb-pb-pms{
77
+ background:url(../images/pb-pms-cross-promotion-icon.png) center center no-repeat;
78
+ }
79
+
80
+ .wppb-badge {
81
+ background-size: cover !important;
82
+ }
83
+
84
+ .wppb-badge span {
85
+ display: inline-block;
86
+ text-transform: uppercase;
87
+ color: #fff;
88
+ margin-top: 110px;
89
+ font-size: 90%;
90
+ }
91
+
92
+ /* Userlist page */
93
+ .wppb-ul-templates > textarea,
94
+ .wppb-single-ul-templates > textarea {
95
+ float: left;
96
+ width: 60%;
97
+ max-width: 100%;
98
+ height: 400px;
99
+ }
100
+
101
+ .update_container_wppb_ul_faceted_settings .row-facet-behaviour,
102
+ .update_container_wppb_ul_faceted_settings .row-facet-limit,
103
+ #container_wppb_ul_faceted_settings .row-facet-behaviour,
104
+ #container_wppb_ul_faceted_settings .row-facet-behaviour,
105
+ #container_wppb_ul_faceted_settings .row-facet-limit{
106
+ display:none;
107
+ }
108
+
109
+ #container_wppb_ul_faceted_settings .facet_type_checkboxes .row-facet-behaviour,
110
+ #container_wppb_ul_faceted_settings .facet_type_checkboxes .row-facet-limit,
111
+ #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_checkboxes .row-facet-behaviour,
112
+ #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_checkboxes .row-facet-limit,
113
+ #container_wppb_ul_faceted_settings .facet_type_select_multiple .row-facet-behaviour,
114
+ #container_wppb_ul_faceted_settings .facet_type_select_multiple .row-facet-limit,
115
+ #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_select_multiple .row-facet-behaviour,
116
+ #container_wppb_ul_faceted_settings .update_container_wppb_ul_faceted_settings.facet_select_multiple .row-facet-limit{
117
+ display:block;
118
+ }
119
+
120
+
121
+ /* Extra Stuff */
122
+ .nowrap {
123
+ white-space: nowrap;
124
+ }
125
+
126
+ .wppb-fields-image{
127
+ margin-top:60px;
128
+ }
129
+
130
+
131
+ /* Shortcode */
132
+ .wppb-shortcode {
133
+ display: inline-block;
134
+ font-size: 13px;
135
+ font-weight: bold;
136
+ background: #fff !important;
137
+ padding: 5px 10px;
138
+ margin-top: 5px;
139
+ border: 1px solid #e1e1e1;
140
+ box-shadow: none !important;
141
+ font-family: 'Arial';
142
+ }
143
+
144
+ .wppb-shortcode.textarea {
145
+ width: 100%;
146
+ height: 1px;
147
+ resize: none;
148
+ }
149
+
150
+ .wppb-shortcode:focus {
151
+ border-color: #e1e1e1 !important;
152
+ }
153
+
154
+ .wppb-shortcode-temp {
155
+ display: inline-block;
156
+ font-size: 13px;
157
+ font-weight: bold;
158
+ padding: 11px;
159
+ font-family: 'Arial';
160
+ }
161
+
162
+
163
+ /* Manage Fields page */
164
+ .profile-builder_page_manage-fields .metabox-holder .column-1{
165
+ /* margin-right:0; */
166
+ }
167
+
168
+ #container_wppb_manage_fields li strong{
169
+ display:none !important;
170
+ }
171
+
172
+ #container_wppb_manage_fields li .description strong {
173
+ display: inline !important;
174
+ }
175
+
176
+ #container_wppb_manage_fields .added_fields_list li.row-meta-name{
177
+ display:list-item !important;
178
+ }
179
+
180
+ #container_wppb_manage_fields li.row-field-title pre,
181
+ #container_wppb_manage_fields li.row-meta-name pre{
182
+ min-height:10px;
183
+ }
184
+
185
+ #wppb_manage_fields .ui-sortable label,
186
+ #container_wppb_manage_fields .ui-sortable label {
187
+ background: #fff;
188
+ }
189
+
190
+ #wppb_manage_fields .sortable-handle,
191
+ #container_wppb_manage_fields .sortable-handle {
192
+ display: inline-block;
193
+ width: 16px;
194
+ height: 16px;
195
+ background: url('../images/sorting-icon-dots.png') no-repeat center center;;
196
+ vertical-align: middle;
197
+ margin-right: 7px;
198
+ cursor: move;
199
+ margin-top: -1px;
200
+ }
201
+
202
+ #container_wppb_manage_fields pre{
203
+ display:block;
204
+ float:left;
205
+ width:27%;
206
+ font-family:"Open Sans", Arial, sans-serif;
207
+ font-size:14px;
208
+ }
209
+
210
+ #container_wppb_manage_fields pre.wppb-mb-head-required,
211
+ #container_wppb_manage_fields li.row-required pre{
212
+ width:auto;
213
+ text-align: center;
214
+ }
215
+
216
+ #container_wppb_manage_fields thead tr{
217
+ background:#f1f1f1;
218
+ }
219
+
220
+ #container_wppb_manage_fields thead tr:hover {
221
+ background: #f1f1f1;
222
+ }
223
+
224
+ #container_wppb_manage_fields tr.update_container_wppb_manage_fields:hover{
225
+ background:#fff;
226
+ }
227
+
228
+ #container_wppb_manage_fields tr:hover{
229
+ background:#def6ff;
230
+ }
231
+
232
+ #wppb_manage_fields_info{
233
+ display: none;
234
+ }
235
+
236
+ /* Extra Registration and Edit Profile fields */
237
+ #container_wppb_epf_fields li strong,
238
+ #container_wppb_rf_fields li strong{
239
+ display:none !important;
240
+ }
241
+
242
+ #container_wppb_epf_fields pre,
243
+ #container_wppb_rf_fields pre{
244
+ display:block;
245
+ font-family:"Open Sans", Arial, sans-serif;
246
+ font-size:14px;
247
+ margin-top: 5px;
248
+ }
249
+
250
+ #container_wppb_epf_fields thead tr,
251
+ #container_wppb_rf_fields thead tr {
252
+ background: #f1f1f1;
253
+ }
254
+ #container_wppb_epf_fields thead tr:hover,
255
+ #container_wppb_rf_fields thead tr:hover {
256
+ background: #f1f1f1;
257
+ }
258
+ #container_wppb_epf_fields thead .wppb-delete-all-fields,
259
+ #container_wppb_rf_fields thead .wppb-delete-all-fields {
260
+ color: #333;
261
+ text-decoration: underline;
262
+ }
263
+
264
+ #container_wppb_epf_fields tbody .wck-delete,
265
+ #container_wppb_rf_fields tbody .wck-delete {
266
+ padding: 8px 16px;
267
+ }
268
+
269
+ #container_wppb_epf_fields tr.update_container_wppb_epf_fields:hover,
270
+ #container_wppb_rf_fields tr.update_container_wppb_rf_fields:hover{
271
+ background:none;
272
+ }
273
+
274
+ #container_wppb_epf_fields tr:hover,
275
+ #container_wppb_rf_fields tr:hover{
276
+ background:#def6ff;
277
+ }
278
+ #container_wppb_epf_fields .wck-content{
279
+ content: "" !important;
280
+ }
281
+
282
+ #wppb_rf_page_settings .row-url, #wppb_rf_page_settings .row-display-messages, .update_container_wppb_rf_page_settings.redirect_ .row-url,
283
+ .update_container_wppb_rf_page_settings.redirect_ .row-display-messages, .update_container_wppb_rf_page_settings.redirect_no .row-url,
284
+ .update_container_wppb_rf_page_settings.redirect_no .row-display-messages{
285
+ display:none;
286
+ }
287
+
288
+ #wppb_rf_page_settings.update_container_wppb_rf_page_settings.redirect_yes .row-url, #wppb_rf_page_settings.update_container_wppb_rf_page_settings.redirect_yes .row-display-messages{
289
+ display: block;
290
+ }
291
+
292
+ #wppb_epf_page_settings .row-url, #wppb_epf_page_settings .row-display-messages, .update_container_wppb_epf_page_settings.redirect_ .row-url,
293
+ .update_container_wppb_epf_page_settings.redirect_ .row-display-messages, .update_container_wppb_epf_page_settings.redirect_no .row-url,
294
+ .update_container_wppb_epf_page_settings.redirect_no .row-display-messages{
295
+ display:none;
296
+ }
297
+
298
+ #wppb_epf_page_settings.update_container_wppb_epf_page_settings.redirect_yes .row-url, #wppb_epf_page_settings.update_container_wppb_epf_page_settings.redirect_yes .row-display-messages{
299
+ display: block;
300
+ }
301
+
302
+ /* Columns :) */
303
+ .wppb-row{
304
+ overflow:hidden;
305
+ }
306
+
307
+ .wppb-3-col > div {
308
+ float:left;
309
+ width:28%;
310
+ margin-right:5%;
311
+ }
312
+
313
+ .wppb-2-col > div {
314
+ float:left;
315
+ width:45%;
316
+ margin-right:5%;
317
+ }
318
+
319
+ .wppb-3-col > div:last-child,
320
+ .wppb-2-col > div:last-child{
321
+ margin:0;
322
+ }
323
+
324
+ .wppb-1-3-col > div {
325
+ float:left;
326
+ width:28%;
327
+ margin-right:5%;
328
+ }
329
+ .wppb-1-3-col > div:last-child{
330
+ float:right;
331
+ width: 67%;
332
+ margin:0;
333
+ }
334
+
335
+ .wppb-2-1-col > div {
336
+ float:left;
337
+ width:67%;
338
+ margin-right:5%;
339
+ }
340
+ .wppb-2-1-col > div:last-child{
341
+ float:right;
342
+ width: 28%;
343
+ margin:0;
344
+ }
345
+ /* Extra Form Styles */
346
+ .wppb-text{
347
+ min-width: 16.4em;
348
+ }
349
+ .wppb-select {
350
+ min-width:18em;
351
+ }
352
+
353
+ .wppb-select.wppb-disabled, .wppb-disabled .select2-selection--single, .wppb-disabled .select2-selection--multiple{
354
+ background-color: #eee;
355
+ }
356
+
357
+ .wppb-wrap .form-table th {
358
+ width: 330px;
359
+ }
360
+
361
+ .wppb-metabox label{
362
+ display:inline-block;
363
+ min-width:15em;
364
+ }
365
+
366
+ /* Admin Bar Page */
367
+ .wppb-admin-bar label{
368
+ margin-right:30px;
369
+ padding:5px;
370
+ }
371
+
372
+ /* modules Page */
373
+ .wppb-modules label{
374
+ margin-right:30px;
375
+ padding:5px;
376
+ }
377
+
378
+ /* Metabox Clone. We need this in various places to simulate the css of a normal metabox. */
379
+ .wppb-side{
380
+ width:300px;
381
+ float:right;
382
+ clear:both;
383
+ }
384
+
385
+ .wppb-metabox h3{
386
+ font-size: 14px;
387
+ line-height: 1.4;
388
+ margin: 0;
389
+ padding:8px 12px;
390
+ cursor:default !important;
391
+ }
392
+
393
+ .wppb-normal{
394
+ margin-right:320px;
395
+ }
396
+
397
+ .wppb-metabox textarea{
398
+ resize:vertical;
399
+ background-color: #ecf8fd;
400
+ font-family: Consolas,Monaco,monospace;
401
+ font-size: 13px;
402
+ }
403
+
404
+ .wppb-metabox .inline-wrap{
405
+ width:280px;
406
+ float:left;
407
+ }
408
+ .wppb-highlight{
409
+ background:#333333;
410
+ background:#222222;
411
+ background:#fff;
412
+ padding:20px;
413
+ }
414
+ .wppb-userlisting-slider, .wppb-list-users-slider{
415
+ display:block;
416
+ padding:10px;
417
+ border:1px solid #ccc;
418
+ font-family: Consolas,Monaco,monospace;
419
+ font-size: 13px;
420
+ margin-top:20px;
421
+ }
422
+ #wppb_manage_fields .mb-list-entry-fields .field-label{
423
+ max-width: 179px;
424
+ }
425
+
426
+ #container_wppb_epf_fields .row-id,
427
+ #wppb_epf_fields .row-id,
428
+ #container_wppb_rf_fields .row-id,
429
+ #wppb_rf_fields .row-id{
430
+ display:none;
431
+ }
432
+
433
+ .wppb-wrap #serial_number{
434
+ font-weight: 600;
435
+ line-height: 1.3;
436
+ padding: 20px 10px 20px 0;
437
+ text-align: left;
438
+ color: #222222;
439
+ font-size:14px;
440
+ }
441
+
442
+ #wppb_profile_builder_pro_serial{
443
+ width:460px;
444
+ padding: 5px;
445
+ }
446
+
447
+ .wppb-wrap .wppb-serialnumber-descr{
448
+ display: block;
449
+ padding: 0px 0px 0px 95px
450
+ }
451
+
452
+ .wppb-backend-notice{
453
+ display: inline-block;
454
+ line-height: 16px;
455
+ padding: 11px;
456
+ font-size: 14px;
457
+ text-align: left;
458
+ margin: 0 0 5px 0;
459
+ background-color: #fff9e8;
460
+ border:1px solid #ffba00;
461
+ border-radius:3px;
462
+ }
463
+
464
+ /* hide "View post" link from update messages on internal post types */
465
+ .post-type-wppb-ul-cpt #message.updated a, .post-type-wppb-rf-cpt #message.updated a, .post-type-wppb-epf-cpt #message.updated a{
466
+ display:none;
467
+ }
468
+
469
+
470
+ #wppb_ul_page_settings .row-visible-to-following-roles, .update_container_wppb_ul_page_settings.visible_to_logged_ .row-visible-to-following-roles{
471
+ display:none;
472
+ }
473
+
474
+ #wppb_ul_page_settings.update_container_wppb_ul_page_settings.visible_to_logged_yes .row-visible-to-following-roles{
475
+ display: block;
476
+ }
477
+
478
+ /* Add-Ons page */
479
+ .wppb-add-on-user-messages{ display: none; }
480
+
481
+ .wppb-add-on-wrap .plugin-card-bottom:after {
482
+ display: block;
483
+ content: '';
484
+ clear: both;
485
+ }
486
+
487
+ .wppb-add-on .spinner {
488
+ visibility: visible;
489
+ }
490
+
491
+ .wppb-add-on a:focus {
492
+ box-shadow: none;
493
+ }
494
+
495
+ .wppb-add-on img {
496
+ max-width: 100%;
497
+ height: auto;
498
+ }
499
+
500
+ .wppb-add-on .wppb-add-on-title {
501
+ letter-spacing: -0.7px;
502
+ margin-bottom: 7px;
503
+ margin-top: 7px;
504
+ }
505
+
506
+ .wppb-add-on .wppb-add-on-title a {
507
+ text-decoration: none;
508
+ color: inherit;
509
+ }
510
+
511
+ .wppb-add-on .wppb-add-on-price {
512
+ font-size: 1.1em;
513
+ letter-spacing: -0.7px;
514
+ margin-top: 7px;
515
+ }
516
+
517
+ .wppb-add-on-compatible span {
518
+ line-height: 28px;
519
+ }
520
+
521
+ .wppb-add-on-not-compatible {
522
+ position: relative;
523
+ }
524
+
525
+ .wppb-add-on-not-compatible:before {
526
+ display: block;
527
+ content: '';
528
+ position: absolute;
529
+ width: 4px;
530
+ height: 100%;
531
+ background: #d54e21;
532
+ top: 0;
533
+ left: 0;
534
+ }
535
+
536
+ .wppb-add-on .button {
537
+ position: relative;
538
+ }
539
+
540
+ .wppb-add-on .button.wppb-add-on-deactivate {
541
+ opacity: 0;
542
+ }
543
+
544
+ .wppb-add-on .spinner {
545
+ display: block;
546
+ margin-top: 4px;
547
+ opacity: 0;
548
+ }
549
+
550
+ .wppb-add-on-spinner {
551
+ opacity: 0;
552
+ position: absolute;
553
+ top: 50%;
554
+ left: 50%;
555
+ margin-top: -10px;
556
+ margin-left: -10px;
557
+ display: block;
558
+ width: 20px;
559
+ height: 20px;
560
+ background: url('../images/spinner.gif') no-repeat center;
561
+ }
562
+
563
+ .wppb-recommended-plugin{
564
+ width:49%;
565
+ margin:0 0 16px 0;
566
+ }
567
+
568
+ .wppb-recommended-plugin.plugin-card:nth-child(odd){
569
+ clear:none;
570
+ float:right;
571
+ margin-right: 0;
572
+ }
573
+
574
+ .wppb-recommended-plugin.plugin-card:nth-child(even){
575
+ clear:none;
576
+ }
577
+
578
+ .wppb-recommended-plugin .wppb-add-on-description{
579
+ min-height: 38px;
580
+ }
581
+
582
+ @media screen and (max-width: 768px){
583
+ .wppb-recommended-plugin{
584
+ width:100%;
585
+ }
586
+ }
587
+
588
+ .wppb-confirmation-success {
589
+ color: #27ae60;
590
+ }
591
+
592
+ .wppb-confirmation-error {
593
+ color: #c0392b;
594
+ }
595
+
596
+ /* Manage Fields Responsive CSS */
597
+ @media screen and ( max-width: 1125px ) {
598
+ /* Manage Fields Responsive */
599
+ #container_wppb_manage_fields th.wck-content pre{
600
+ display:none;
601
+ }
602
+ #container_wppb_manage_fields li strong{
603
+ display: inline-block !important;
604
+ font-size: 14px;
605
+ font-family: "Open Sans",Arial,sans-serif;
606
+ }
607
+ #container_wppb_manage_fields pre{
608
+ display: inline;
609
+ float:none;
610
+ width:auto;
611
+ }
612
+ #container_wppb_manage_fields li strong{
613
+ width:100px !important;
614
+ }
615
+ }
616
+ /* Basic Information Buttons - for Free to Pro upgrade*/
617
+ .wppb-button-free {
618
+ border-radius: 3px;
619
+ border-style: solid;
620
+ border-width: 1px;
621
+ box-sizing: border-box;
622
+ cursor: pointer;
623
+ display: inline-block;
624
+ font-size: 13px;
625
+ height: 29px;
626
+ line-height: 26px;
627
+ margin: 0;
628
+ padding: 0 10px 1px;
629
+ text-decoration: none;
630
+ white-space: nowrap;
631
+ background: none repeat scroll 0 0 #e14d43;
632
+ border-color: #b2401b;
633
+ -webkit-box-shadow: 0 1px 0 #ba281e !important;
634
+ box-shadow: 0 1px 0 #ba281e !important;
635
+ color: #fff !important;
636
+ vertical-align:top;
637
+ text-shadow: 0 -1px 1px #ba281e,1px 0 1px #ba281e,0 1px 1px #ba281e,-1px 0 1px #ba281e !important;
638
+ }
639
+ p .wppb-button-free {
640
+ vertical-align: baseline;
641
+ }
642
+ .wppb-button-free:hover {
643
+ background: #e14d43;
644
+ border-color: #ba281e;
645
+ color: #fff;
646
+ }
647
+
648
+ /* PMS Compatibility page */
649
+ #pms-bottom-install .plugin-card-bottom{
650
+ border:none;
651
+ background: #e86054;
652
+ color:#fff;
653
+ }
654
+
655
+ #pms-bottom-install .plugin-card-bottom span{
656
+ display: inline-block;
657
+ margin-top:7px;
658
+ }
659
+
660
+ #pms-bottom-install .wppb-add-on-download, #pms-bottom-install a{
661
+ font-size: 130%;
662
+ padding: 10px 20px;
663
+ height: auto;
664
+ color: #e86054;
665
+ text-decoration: none;
666
+ }
667
+
668
+ #pms-bottom-install a:hover{
669
+ background: #fff;
670
+ text-decoration: none;
671
+ }
672
+
673
+ #pms-bottom-install .wppb-confirmation-success{
674
+ color:#FFFFFF;
675
+ }
676
+
677
+ #wppb_ul_search_settings .wck-checkboxes > div{
678
+ display: inline-block;
679
+ margin-left:7px;
680
+ }
681
+
682
+ .mb-table-container .wck-state-highlight{
683
+ height:45px;
684
+ }
685
+
686
+ /**************************************************/
687
+ /* Extra styling for admin notices
688
+ /**************************************************/
689
+ div.wppb-notice {
690
+ position: relative;
691
+ }
692
+
693
+ div.wppb-notice:after {
694
+ display: block;
695
+ content: '';
696
+ clear: both;
697
+ }
698
+
699
+ div.wppb-notice.wppb-narrow {
700
+ max-width: 825px;
701
+ }
702
+
703
+ div.wppb-notice .notice-dismiss {
704
+ text-decoration: none;
705
+ }
706
+
707
+ .wrap div.wppb-admin-notice {
708
+ margin-bottom: 0;
709
+ }
710
+
711
+
712
+ /**************************************************/
713
+ /* Extra styling for select 2 manage fields
714
+ /**************************************************/
715
+
716
+ .profile-builder_page_manage-fields select#field{
717
+ width: 100%;
718
+ }
719
+ /* maybe take this out after a while. we need to keep it because of translatepress but after the tp update it is not required */
720
+ .profile-builder_page_manage-fields span.select2-container{
721
+ width:100% !important;
722
+ }
723
+
724
+ .profile-builder_page_manage-fields .select2-selection.select2-selection--single{
725
+ outline: 0;
726
+ }
727
+
728
+ #wppb_select2_overlay{
729
+ display: none;
730
+ position: fixed;
731
+ top: 0;
732
+ left: 0;
733
+ width: 100%;
734
+ height: 100%;
735
+ background-color: #000;
736
+ filter:alpha(opacity=50);
737
+ -moz-opacity:0.5;
738
+ -khtml-opacity: 0.5;
739
+ opacity: 0.5;
740
+ z-index: 1000;
741
+ }
742
+
743
+ .profile-builder_page_manage-fields .select2-container{
744
+ z-index: 1051;
745
+ }
746
+
747
+ .profile-builder_page_manage-fields .select2-container--default .select2-selection--single .select2-selection__placeholder{
748
+ color: #111;
749
+ font-size: 15px;
750
+ }
751
+ .profile-builder_page_manage-fields .select2-container .select2-selection--single{
752
+ height: 38px;
753
+ }
754
+ .profile-builder_page_manage-fields .select2-container .select2-selection--single .select2-selection__rendered{
755
+ line-height: 38px;
756
+ }
757
+ .profile-builder_page_manage-fields .select2-container--default .select2-selection--single .select2-selection__arrow{
758
+ height: 38px;
759
+ }
760
+
761
+ @media screen and ( min-width: 800px ) {
762
+
763
+ .profile-builder_page_manage-fields .select2-results__option[role="group"] {
764
+ width: 48%;
765
+ margin: 0 1%;
766
+ float: left;
767
+ }
768
+
769
+ .profile-builder_page_manage-fields .select2-container--default .select2-results > .select2-results__options,
770
+ .profile-builder_page_manage-fields .select2-results{
771
+ max-height: 800px;
772
+ }
773
+ }
774
+ @media screen and ( min-width: 1280px ) {
775
+
776
+ .profile-builder_page_manage-fields .select2-results__option[role="group"] {
777
+ width: 23%;
778
+ margin: 0 1%;
779
+ float: left;
780
+ }
781
+
782
+ .profile-builder_page_manage-fields .select2-container--default .select2-results > .select2-results__options,
783
+ .profile-builder_page_manage-fields .select2-results{
784
+ max-height: 800px;
785
+ }
786
+ }
787
+
788
+ .wppb-auto-form-creation{
789
+ margin:50px 0 30px;
790
+ padding:20px;
791
+ background-color: #fff9e8;
792
+ border: 1px solid #ffba00;
793
+ border-radius: 3px;
794
+ overflow: hidden;
795
+ }
796
+
797
+ .wppb-auto-form-creation.wppb-forms-created{
798
+ background-color: #edffe8;
799
+ border: 1px solid #46b450;
800
+ }
801
+
802
+ .wppb-auto-form-creation a.button{
803
+ margin-top: 5px;
804
+ }
805
+
806
+ .wppb-subtabs{
807
+ padding:7px 0 8px;
808
+ float:none;
809
+ }
810
+
811
+ .wppb-subtabs li{
812
+ padding:0 5px;
813
+ border-right:1px solid #ddd;
814
+ }
815
+
816
+ .wppb-subtabs li:last-child{
817
+ border-right:none;
818
+ }
819
+
820
+ .wppb-subtabs a{
821
+ letter-spacing:0 !important;
822
+ font-size:14px;
823
+ }
824
+
825
+ .profile-builder_page_user-email-customizer #poststuff, .profile-builder_page_admin-email-customizer #poststuff{
826
+ padding:0;
827
+ }
828
+
829
+ /* Sortable options */
830
+ .wppb_manage_fields_sortables {display: block; border: 1px solid #EEE; margin: 0px 0px 5px 32px; padding: 5px;}
831
+ .wppb_manage_fields_sortables:hover {cursor: pointer; background-color: #EEE;}
832
+ .wppb_manage_fields_sortables label {background: transparent !important;}
833
+ .wppb_manage_fields_sortables > .dashicons {color: #f4f4f4; position: absolute; margin-left: -32px;}
834
+ .wppb_manage_fields_sortables:hover > .dashicons {color: #000;}
835
+ .wppb_selector_for_sortable_checkbox {margin-left: 32px; width: calc(100% - 32px);}
assets/css/style-front-end.css CHANGED
@@ -1,832 +1,832 @@
1
- /* Register & Edit Profile Forms*/
2
-
3
- /*--------------------------------------------------------------
4
- >>> TABLE OF CONTENTS:
5
- ----------------------------------------------------------------
6
- 1.0 - Reset
7
- 2.0 - Forms
8
- 3.0 - Alignments
9
- 4.0 - Errors & Notices
10
- 5.0 - User Listing
11
- 6.0 - Media Queries
12
- --------------------------------------------------------------*/
13
-
14
- /*--------------------------------------------------------------
15
- 1.0 Reset
16
- --------------------------------------------------------------*/
17
- .wppb-user-forms,
18
- .wppb-user-forms *{
19
- -webkit-box-sizing: border-box !important; /* Safari/Chrome, other WebKit */
20
- -moz-box-sizing: border-box !important; /* Firefox, other Gecko */
21
- box-sizing: border-box !important; /* Opera/IE 8+ */
22
- }
23
-
24
- /*--------------------------------------------------------------
25
- 2.0 Forms
26
- --------------------------------------------------------------*/
27
- .wppb-user-forms input:not([type="button"]):not([type="reset"]):not([type="submit"]),
28
- .wppb-user-forms select,
29
- .wppb-user-forms textarea{
30
- font-size: 100%; /* Corrects font size not being inherited in all browsers */
31
- margin: 0; /* Addresses margins set differently in IE6/7, F3/4, S5, Chrome */
32
- vertical-align: baseline; /* Improves appearance and consistency in all browsers */
33
- }
34
- .wppb-user-forms input[type="checkbox"],
35
- .wppb-user-forms input[type="radio"] {
36
- padding: 0; /* Addresses excess padding in IE8/9 */
37
- }
38
- .wppb-user-forms input[type="search"] {
39
- -webkit-appearance: textfield; /* Addresses appearance set to searchfield in S5, Chrome */
40
- -webkit-box-sizing: content-box; /* Addresses box sizing set to border-box in S5, Chrome (include -moz to future-proof) */
41
- -moz-box-sizing: content-box;
42
- box-sizing: content-box;
43
- }
44
- .wppb-user-forms input[type="search"]::-webkit-search-decoration { /* Corrects inner padding displayed oddly in S5, Chrome on OSX */
45
- -webkit-appearance: none;
46
- }
47
- .wppb-user-forms button::-moz-focus-inner,
48
- .wppb-user-forms input::-moz-focus-inner { /* Corrects inner padding and border displayed oddly in FF3/4 www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ */
49
- border: 0;
50
- padding: 0;
51
- }
52
- .wppb-user-forms input[type="text"],
53
- .wppb-user-forms input[type="number"],
54
- .wppb-user-forms input[type="email"],
55
- .wppb-user-forms input[type="url"],
56
- .wppb-user-forms input[type="password"],
57
- .wppb-user-forms input[type="search"],
58
- .wppb-user-forms textarea{
59
- color: #666;
60
- border: 1px solid #ccc;
61
- border-radius: 3px;
62
- }
63
- .wppb-user-forms input[type="text"]:focus,
64
- .wppb-user-forms input[type="number"]:focus,
65
- .wppb-user-forms input[type="email"]:focus,
66
- .wppb-user-forms input[type="url"]:focus,
67
- .wppb-user-forms input[type="password"]:focus,
68
- .wppb-user-forms input[type="search"]:focus,
69
- .wppb-user-forms textarea:focus {
70
- color: #111;
71
- }
72
- .wppb-user-forms input[type="text"],
73
- .wppb-user-forms input[type="number"],
74
- .wppb-user-forms input[type="email"],
75
- .wppb-user-forms input[type="url"],
76
- .wppb-user-forms input[type="password"],
77
- .wppb-user-forms input[type="search"] {
78
- padding: 3px;
79
- }
80
- .wppb-user-forms textarea {
81
- overflow: auto; /* Removes default vertical scrollbar in IE6/7/8/9 */
82
- padding-left: 3px;
83
- vertical-align: top; /* Improves readability and alignment in all browsers */
84
- width: 100%;
85
- }
86
- .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap { /* properly align wysiwyg editor among form fields */
87
- float:left;
88
- width:69.9%;
89
- }
90
- .wppb-user-forms .wppb-wysiwyg button:hover{ /* wysiwyg - overwrite the theme inherited background color on hover*/
91
- background: none;
92
- }
93
- .wppb-user-forms .wppb-wysiwyg div.mce-tinymce.mce-panel{ /*Display the borders for the TinyMCE editor - Visual tab*/
94
- border: 1px solid #ccc !important;
95
- color: #666 !important;
96
- }
97
- .wppb-user-forms .wppb-wysiwyg div.mce-panel.mce-first{
98
- border-width: 0 0 1px 0 !important;
99
- }
100
- .wppb-user-forms .wppb-wysiwyg div.mce-panel.mce-last{
101
- border-width: 1px 0 !important;
102
- }
103
- .wppb-user-forms .wppb-wysiwyg .quicktags-toolbar { /*Display the borders for the TinyMCE editor - Text tab*/
104
- border: 1px solid #dedede;
105
- border-bottom: 0;
106
- }
107
- #wp-link label input[type="text"] { /*Fix the looks of the Add Link window for TinyMCE editor*/
108
- padding: 0px;
109
- }
110
-
111
- #wppb-search-fields{
112
- min-width: 250px;
113
- float:left;
114
- margin-right:20px;
115
- }
116
-
117
- .wppb-user-forms .wppb-search-button{
118
- margin-right:10px;
119
- padding:7px 20px;
120
- line-height: 24px;
121
- }
122
-
123
- .wppb-search-users-wrap{
124
- margin-bottom: 20px;
125
- }
126
-
127
- .wppb-user-forms .extra_field_heading {
128
- margin-bottom: 0;
129
- }
130
-
131
- .wppb-gdpr-delete-button .wppb-delete-account {
132
- width: 110px;
133
- }
134
-
135
- /*--------------------------------------------------------------
136
- 3.0 Alignments
137
- --------------------------------------------------------------*/
138
- .wppb-user-forms ul{
139
- max-width:900px;
140
- list-style:none;
141
- margin-left:0;
142
- margin-right:0;
143
- padding-left:0;
144
- padding-right:0;
145
- }
146
-
147
- .wppb-user-forms ul li{
148
- list-style:none;
149
- }
150
-
151
- #wppb-login-wrap p,
152
- #select_user_to_edit_form p{
153
- overflow:hidden;
154
- margin:0;
155
- padding-bottom:14px;
156
- }
157
-
158
- .wppb-user-forms ul li{
159
- margin:0;
160
- padding-bottom:14px;
161
- }
162
-
163
- .wppb-user-forms ul li:after{
164
- content: "";
165
- clear: both;
166
- display: block;
167
- }
168
-
169
- .wppb-user-forms .wppb-input-hidden {
170
- padding-bottom: 0;
171
- }
172
-
173
- .wppb-user-forms.wppb-user-role-administrator .wppb-input-hidden {
174
- padding-bottom: 14px;
175
- }
176
-
177
- .wppb-user-forms .wppb-form-field > ul {
178
- margin-left: 0;
179
- }
180
-
181
- .wppb-form-field label,
182
- #wppb-login-wrap .login-username label,
183
- #wppb-login-wrap .login-password label{
184
- width:30%;
185
- float:left;
186
- min-height:1px;
187
- }
188
- .wppb-form-field input,
189
- .wppb-form-field input[type="text"], .wppb-form-field input[type="number"], .wppb-form-field input[type="email"], .wppb-form-field input[type="url"], .wppb-form-field input[type="password"], .wppb-form-field input[type="search"],
190
- .wppb-form-field select,
191
- .wppb-form-field textarea,
192
- .wppb-checkboxes,
193
- .wppb-radios,
194
- #wppb-login-wrap .login-username input,
195
- #wppb-login-wrap .login-password input{
196
- width:69.9%;
197
- float:left;
198
- }
199
-
200
- .wppb-form-field.wppb-timepicker select {
201
- width: auto;
202
- margin-right: 5px;
203
- }
204
-
205
- .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap .wp-editor-tabs *{
206
- box-sizing: content-box !important;
207
- }
208
-
209
- .wppb-user-forms .wp-editor-wrap input {
210
- float: none;
211
- width: auto;
212
- }
213
-
214
- input#send_credentials_via_email{
215
- float:none;
216
- width:auto;
217
- margin-right:10px
218
- }
219
-
220
- .wppb-send-credentials-checkbox label{
221
- width:auto;
222
- }
223
-
224
- .wppb-form-field > span{
225
- display:block;
226
- clear:both;
227
- margin-left:30%;
228
- font-size:80%;
229
- font-style:italic;
230
- }
231
-
232
- .wppb-form-field > span.custom_field_html {
233
- font-style: normal;
234
- font-size: 100%;
235
- }
236
-
237
- .wppb-form-field > span.select2-container {
238
- font-style: normal;
239
- font-size: 100%;
240
- clear:none;
241
- }
242
-
243
- .wppb-repeater .wppb-select-cpt span.select2-container{
244
- width:auto !important;
245
- }
246
-
247
- .wppb-form-field.wppb-timepicker > span.wppb-timepicker-separator {
248
- display: inline-block;
249
- float: left;
250
- clear: none;
251
- margin-left: 0;
252
- margin-right: 5px;
253
- font-size: 100%;
254
- font-style: normal;
255
- }
256
-
257
- .wppb_upload_button{
258
- display:inline-block;
259
- }
260
-
261
- .wppb-user-forms .wppb-checkboxes li,
262
- .wppb-user-forms .wppb-radios li{
263
- display:inline-block;
264
- padding:0 20px 0 0;
265
- }
266
-
267
- .wppb-user-forms .wppb-checkboxes li.wppb-hidden{
268
- padding: 0;
269
- }
270
-
271
- .wppb-form-field .wppb-checkboxes label,
272
- .wppb-form-field .wppb-radios label{
273
- float:none;
274
- min-width:0;
275
- padding-left:5px;
276
- width:auto;
277
- display:inline-block;
278
- }
279
-
280
- .wppb-checkbox-terms-and-conditions input,
281
- .wppb-checkboxes li input,
282
- .wppb-radios li input{
283
- min-width:0;
284
- float:none;
285
- width:auto;
286
- }
287
-
288
- .wppb-edit-user .wppb-checkbox-terms-and-conditions {
289
- display:none;
290
- }
291
-
292
- .wppb-form-field.wppb-heading span,
293
- .wppb-default-about-yourself-heading span,
294
- .wppb-default-contact-info-heading span,
295
- .wppb-default-name-heading span,
296
- .wppb-checkbox-terms-and-conditions span{
297
- margin-left:0;
298
- }
299
-
300
- .wppb-checkbox-terms-and-conditions label {
301
- width: 100%;
302
- }
303
-
304
- .wppb-form-field.wppb-checkbox-terms-and-conditions input[type="checkbox"].custom_field_toa {
305
- float:none;
306
- width:auto;
307
- margin-right:10px
308
- }
309
-
310
-
311
- .wppb-recaptcha-element{
312
- display: inline-block;
313
- }
314
- .wppb-recaptcha-element.wppb-invisible-recaptcha {
315
- display: block !important;
316
- }
317
- .wppb-recaptcha-element iframe{
318
- margin-bottom: 0;
319
- }
320
-
321
- .wppb-form-field input.wppb-map-search-box {
322
- position: absolute;
323
- top: 10px !important;
324
- height: 34px;
325
- width: 50%;
326
- min-width: 250px;
327
- background: #fff;
328
- border: 0;
329
- border-radius: 1px;
330
- padding: 0 10px;
331
- box-shadow: 0 1px 1px 0 #c1c1c1;
332
- font-family: 'Roboto', sans-serif;
333
- }
334
-
335
- .wppb-create-new-site{
336
- width: 100%;
337
- }
338
- input#wppb_create_new_site_checkbox{
339
- width: auto;
340
- margin-right: 10px;
341
- float: none;
342
- }
343
- label[for=wppb_create_new_site_checkbox]{
344
- width:100%;
345
- }
346
- label[for=blog-privacy]{
347
- width:100%;
348
- }
349
-
350
-
351
- /* GDPR checkbox */
352
- .wppb-gdpr-checkbox.wppb-form-field label{
353
- width:100%;
354
- float:none;
355
- }
356
-
357
- .wppb-gdpr-checkbox.wppb-form-field #user_consent_gdpr{
358
- float:none;
359
- width:auto;
360
- margin:0 10px 0 0;
361
- }
362
-
363
-
364
- /*--------------------------------------------------------------
365
- 4.0 Errors & Notices
366
- --------------------------------------------------------------*/
367
-
368
- .wppb-error,
369
- .wppb-warning {
370
- padding: 6px 9px;
371
- margin: 0 auto 25px;
372
- display: block;
373
- width: 100%;
374
- box-sizing: border-box;
375
- background: #ffebe8;
376
- border: 1px solid #C00;
377
- }
378
-
379
- .wppb-error,
380
- .wppb-warning{
381
- color:#222222 !important;
382
- }
383
-
384
- .wppb-error a,
385
- .wppb-warning a{
386
- color:#007acc !important;
387
- }
388
-
389
- .admin-bar #wppb_form_general_message{
390
- padding-top:32px;
391
- }
392
-
393
- .wppb-error a:hover,
394
- .wppb-warning a:hover{
395
- color:#007acc !important;
396
- text-decoration: underline;
397
- }
398
-
399
- .wppb-required{
400
- color: red;
401
- }
402
-
403
- .wppb-required,
404
- .wppb-checkbox-terms-and-conditions span.wppb-required{
405
- margin-left:5px;
406
- }
407
-
408
- .wppb-success {
409
- padding: 6px 9px;
410
- margin: 0 auto 25px;
411
- display: block;
412
- width: 100%;
413
- box-sizing: border-box;
414
- background: #e7f7d3;
415
- border: 1px solid #6c3;
416
- }
417
-
418
- .wppb-register-user .wppb-field-error,
419
- .wppb-edit-user .wppb-field-error,
420
- #wppb-recover-password .wppb-field-error{
421
- background-color: #FFDFDF;
422
- border: 1px dotted #C89797;
423
- margin-bottom: 6px !important;
424
- padding: 6px !important;
425
- }
426
-
427
- .wppb-field-error > input,
428
- .wppb-field-error > select,
429
- .wppb-field-error > textarea,
430
- .wppb-field-error > label{
431
- margin-bottom: 10px;
432
- }
433
-
434
- .wppb-field-error img{
435
- box-shadow: none;
436
- -webkit-box-shadow:none;
437
- border:none;
438
- border-radius:0px;
439
- vertical-align: middle;
440
- margin-top: -3px;
441
- padding-left:5px;
442
- width: auto;
443
- height: auto;
444
- }
445
-
446
- .wppb-form-field > span.wppb-form-error{
447
- margin-top:10px;
448
- padding-top: 5px;
449
- border-top:1px dotted #c89797;
450
- font-size:100%;
451
- margin-left: 0;
452
- }
453
-
454
- /* Remove global Blog Details Field error */
455
- #wppb-register-user .wppb-default-blog-details.wppb-field-error{
456
- background-color: transparent !important;
457
- border: 0px !important;
458
- }
459
- .wppb-default-blog-details > span.wppb-form-error{
460
- display:none;
461
- }
462
- .wppb-blog-details-heading span {
463
- margin-left: 0;
464
- }
465
-
466
-
467
-
468
-
469
- /*--------------------------------------------------------------
470
- 5.0 User Listing
471
- --------------------------------------------------------------*/
472
- .wppb-table *{
473
- -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
474
- }
475
- .wppb-table{
476
- -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
477
- border-spacing: 0.5rem;
478
- border-collapse: collapse;
479
- width: 100%;
480
- }
481
-
482
- .wppb-table th{
483
- background: #f4f4f4;
484
- padding: 7px;
485
- border:1px solid #e1e1e1;
486
- text-align: left;
487
- }
488
-
489
- .wppb-table thead tr:hover{
490
- background: none;
491
- }
492
-
493
- .wppb-table .wppb-sorting .wppb-sorting-default {
494
- display: inline-block;
495
- width: 16px;
496
- height: 16px;
497
- background: url('../images/sorting-default.png') no-repeat center center;
498
- vertical-align: middle;
499
- }
500
-
501
- .wppb-table .wppb-sorting .wppb-sorting-ascending {
502
- background-image: url('../images/sorting-ascending.png');
503
- }
504
-
505
- .wppb-table .wppb-sorting .wppb-sorting-descending {
506
- background-image: url('../images/sorting-descending.png');
507
- }
508
-
509
- .wppb-table tr:hover{
510
- background: #f1fcff;
511
- }
512
- .wppb-table td{
513
- padding: 7px;
514
- border:1px solid #e1e1e1;
515
- }
516
-
517
- .wppb-table .wppb-posts,
518
- .wppb-table .wppb-moreinfo{
519
- text-align: center;
520
- }
521
-
522
- .wppb-avatar img {
523
- max-width: none;
524
- }
525
-
526
- ul.wppb-profile{
527
- list-style-type: none;
528
- margin-left: 0;
529
- margin-right: 0;
530
- padding-left:0;
531
- padding-right: 0;
532
- }
533
-
534
- ul.wppb-profile li{
535
- margin-left: 0;
536
- margin-right: 0;
537
- overflow: hidden;
538
- }
539
-
540
- ul.wppb-profile li label{
541
- display: block;
542
- width:30%;
543
- float:left;
544
- min-height:1px;
545
- font-weight: bold;
546
- }
547
-
548
- ul.wppb-profile li span{
549
- display: block;
550
- width:69.9%;
551
- float:left;
552
- }
553
-
554
- ul.wppb-profile li h3,
555
- ul.wppb-profile li h3:first-child{
556
- margin:20px 0;
557
- padding-top:20px;
558
- border-top:1px solid #d2d2d2;
559
- }
560
-
561
- ul.wppb-faceted-list{
562
- list-style: none;
563
- margin:0 0 20px;
564
- }
565
-
566
- ul.wppb-faceted-list:after{
567
- visibility: hidden;
568
- display: block;
569
- font-size: 0;
570
- content: " ";
571
- clear: both;
572
- height: 0;
573
- }
574
-
575
- ul.wppb-faceted-list > li{
576
- float:left;
577
- margin-right: 15px;
578
- max-width: 300px;
579
- }
580
-
581
- ul.wppb-faceted-list > li:first-child{
582
- float:none;
583
- clear:both;
584
- }
585
-
586
- .wppb-userlisting-container .wppb-faceted-list li h5{
587
- margin-top: 20px;
588
- margin-bottom: 5px;
589
- }
590
-
591
- ul.wppb-faceted-list label > *{
592
- vertical-align: middle;
593
- }
594
-
595
- ul.wppb-faceted-list input[type="checkbox"]{
596
- margin-right: 5px;
597
- }
598
-
599
- .wppb-userlisting-container.wppb-spinner{
600
- position:relative;
601
- opacity: 0.5
602
- }
603
-
604
- .wppb-userlisting-container.wppb-spinner:after{
605
- content: '';
606
- position: absolute;
607
- top: 50%;
608
- left: 50%;
609
- margin-top: -16px;
610
- margin-left: -16px;
611
- display: block;
612
- width: 32px;
613
- height: 32px;
614
- /*background: url('../images/ajax-loader.gif') no-repeat center;*/
615
- z-index: 1000;
616
- }
617
-
618
- ul.wppb-faceted-list .hide-this{
619
- display:none;
620
- }
621
-
622
- #wppb-remove-facets-container{
623
- list-style: none;
624
- margin: 0;
625
- }
626
-
627
- .wppb-remove-facet:before, .wppb-remove-all-facets:before {
628
- content: "x";
629
- display: inline-block;
630
- border-right: 1px dotted #D3CCC9;
631
- border-right: 1px dotted #6F6F6F;
632
- padding-right: 5px;
633
- margin-right: 5px;
634
- }
635
-
636
- .wppb-userlisting-container .wppb-ul-range-values{
637
- padding: 5px 0;
638
- }
639
-
640
- .wppb-userlisting-container .wppb-facet-select-multiple{
641
- height:auto;
642
- }
643
-
644
- .wppb-userlisting-container:after {
645
- visibility: hidden;
646
- display: block;
647
- font-size: 0;
648
- content: " ";
649
- clear: both;
650
- height: 0;
651
- }
652
-
653
- .wppb-float-left{
654
- float:left;
655
- }
656
-
657
- .wppb-float-right{
658
- float:right;
659
- }
660
-
661
- .wppb-facet-float-left{
662
- float:left;
663
- max-width:300px;
664
- }
665
-
666
- .wppb-facet-float-right{
667
- float:right;
668
- max-width:300px;
669
- }
670
-
671
-
672
- @media screen and ( max-width: 720px ) {
673
-
674
- .wppb-table {
675
- border: 0;
676
- }
677
-
678
- .wppb-table thead {
679
- display: none
680
- }
681
-
682
- .wppb-table tr {
683
- display: block;
684
- margin-bottom: 30px;
685
- }
686
-
687
- .wppb-table td {
688
- display: block;
689
- text-align: right;
690
- border-bottom: 0;
691
- }
692
-
693
- .wppb-table td:last-of-type {
694
- border-bottom: 1px solid #e1e1e1;
695
- }
696
-
697
- .wppb-table .wppb-posts,
698
- .wppb-table .wppb-moreinfo{
699
- text-align: right;
700
- }
701
-
702
- .wppb-table td:before {
703
- content: attr(data-label);
704
- float: left;
705
- }
706
-
707
- .wppb-table td:after {
708
- content: '';
709
- display: block;
710
- clear: both;
711
- }
712
-
713
- }
714
-
715
- /*--------------------------------------------------------------
716
- 6.0 Media Queries
717
- --------------------------------------------------------------*/
718
-
719
- @media screen and (max-width: 400px) {
720
-
721
- .wppb-form-field label,
722
- #wppb-login-wrap .login-username label,
723
- #wppb-login-wrap .login-password label,
724
- ul.wppb-profile li label{
725
- width:100%;
726
- display:block;
727
- float:none;
728
- }
729
-
730
- .wppb-form-field input,
731
- .wppb-form-field select,
732
- .wppb-form-field textarea,
733
- .wppb-checkboxes,
734
- .wppb-radios,
735
- #wppb-login-wrap .login-username input,
736
- #wppb-login-wrap .login-password input,
737
- ul.wppb-profile li span{
738
- width:100%;
739
- float:left;
740
- }
741
-
742
- .wppb-form-field > span{
743
- margin-left:0;
744
- }
745
-
746
- .wppb-checkboxes li label,
747
- .wppb-radios li label{
748
- display:inline;
749
- }
750
-
751
- .wppb-form-field .wppb-avatar-nofile,
752
- .wppb-form-field .wppb-avatar-file,
753
- .wppb-form-field .wppb-upload-nofile,
754
- .wppb-form-field .wppb-upload-file{
755
- margin-left:0;
756
- }
757
-
758
- }
759
-
760
- /*--------------------------------------------------------------
761
- 7.0 Password Strength
762
- --------------------------------------------------------------*/
763
- #pass-strength-result {
764
- background-color: #eee;
765
- border: 1px solid #ddd;
766
- display: none;
767
- float: left;
768
- margin: 13px 5px 5px 30%;
769
- padding: 3px 5px;
770
- text-align: center;
771
- width: 200px;
772
- height:28px;
773
- }
774
- #pass-strength-result.short {
775
- background-color: #ffa0a0;
776
- border-color: #f04040;
777
- }
778
- #pass-strength-result.bad {
779
- background-color: #ffb78c;
780
- border-color: #ff853c;
781
- }
782
- #pass-strength-result.good {
783
- background-color: #ffec8b;
784
- border-color: #fc0;
785
- }
786
- #pass-strength-result.strong {
787
- background-color: #c3ff88;
788
- border-color: #8dff1c;
789
- }
790
-
791
- /**************************************************/
792
- /* Profile Builder Subscription Plans Field
793
- /**************************************************/
794
- .wppb-form-field.wppb-subscription-plans label {
795
- width: 100%;
796
- float: none;
797
- }
798
-
799
- .wppb-form-field.wppb-subscription-plans input {
800
- display: inline-block;
801
- width: auto;
802
- float: none;
803
- margin-right: 10px !important;
804
- }
805
-
806
- .wppb-form-field.wppb-subscription-plans span.description {
807
- display: block;
808
- font-size: 100%;
809
- font-style: italic;
810
- margin-left: 0;
811
- margin-bottom: 1.5em;
812
- }
813
-
814
- /**************************************************/
815
- /* This is very weird: if in the css there is a rule on table of border-collapse:collapse; then on FFox and Edge the Media upload won't open
816
- /**************************************************/
817
- .wppb-user-forms table{
818
- border-collapse:separate;
819
- }
820
-
821
- /**************************************************/
822
- /* Private Website CSS
823
- /**************************************************/
824
- .wppb-private-website.wppb-private-website-hide-menus .main-navigation{
825
- display:none;
826
- }
827
-
828
-
829
- /* Map markers info */
830
- .marker-content-info {position: absolute; top: -400px; left: -400px; display: none;}
831
- .wppb-map-container .marker-content {min-width: 320px; max-width: 100%;}
832
- .wppb-map-container .marker-content .marker-info-avatar_or_gravatar {float: left; margin-right: 10px;}
1
+ /* Register & Edit Profile Forms*/
2
+
3
+ /*--------------------------------------------------------------
4
+ >>> TABLE OF CONTENTS:
5
+ ----------------------------------------------------------------
6
+ 1.0 - Reset
7
+ 2.0 - Forms
8
+ 3.0 - Alignments
9
+ 4.0 - Errors & Notices
10
+ 5.0 - User Listing
11
+ 6.0 - Media Queries
12
+ --------------------------------------------------------------*/
13
+
14
+ /*--------------------------------------------------------------
15
+ 1.0 Reset
16
+ --------------------------------------------------------------*/
17
+ .wppb-user-forms,
18
+ .wppb-user-forms *{
19
+ -webkit-box-sizing: border-box !important; /* Safari/Chrome, other WebKit */
20
+ -moz-box-sizing: border-box !important; /* Firefox, other Gecko */
21
+ box-sizing: border-box !important; /* Opera/IE 8+ */
22
+ }
23
+
24
+ /*--------------------------------------------------------------
25
+ 2.0 Forms
26
+ --------------------------------------------------------------*/
27
+ .wppb-user-forms input:not([type="button"]):not([type="reset"]):not([type="submit"]),
28
+ .wppb-user-forms select,
29
+ .wppb-user-forms textarea{
30
+ font-size: 100%; /* Corrects font size not being inherited in all browsers */
31
+ margin: 0; /* Addresses margins set differently in IE6/7, F3/4, S5, Chrome */
32
+ vertical-align: baseline; /* Improves appearance and consistency in all browsers */
33
+ }
34
+ .wppb-user-forms input[type="checkbox"],
35
+ .wppb-user-forms input[type="radio"] {
36
+ padding: 0; /* Addresses excess padding in IE8/9 */
37
+ }
38
+ .wppb-user-forms input[type="search"] {
39
+ -webkit-appearance: textfield; /* Addresses appearance set to searchfield in S5, Chrome */
40
+ -webkit-box-sizing: content-box; /* Addresses box sizing set to border-box in S5, Chrome (include -moz to future-proof) */
41
+ -moz-box-sizing: content-box;
42
+ box-sizing: content-box;
43
+ }
44
+ .wppb-user-forms input[type="search"]::-webkit-search-decoration { /* Corrects inner padding displayed oddly in S5, Chrome on OSX */
45
+ -webkit-appearance: none;
46
+ }
47
+ .wppb-user-forms button::-moz-focus-inner,
48
+ .wppb-user-forms input::-moz-focus-inner { /* Corrects inner padding and border displayed oddly in FF3/4 www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ */
49
+ border: 0;
50
+ padding: 0;
51
+ }
52
+ .wppb-user-forms input[type="text"],
53
+ .wppb-user-forms input[type="number"],
54
+ .wppb-user-forms input[type="email"],
55
+ .wppb-user-forms input[type="url"],
56
+ .wppb-user-forms input[type="password"],
57
+ .wppb-user-forms input[type="search"],
58
+ .wppb-user-forms textarea{
59
+ color: #666;
60
+ border: 1px solid #ccc;
61
+ border-radius: 3px;
62
+ }
63
+ .wppb-user-forms input[type="text"]:focus,
64
+ .wppb-user-forms input[type="number"]:focus,
65
+ .wppb-user-forms input[type="email"]:focus,
66
+ .wppb-user-forms input[type="url"]:focus,
67
+ .wppb-user-forms input[type="password"]:focus,
68
+ .wppb-user-forms input[type="search"]:focus,
69
+ .wppb-user-forms textarea:focus {
70
+ color: #111;
71
+ }
72
+ .wppb-user-forms input[type="text"],
73
+ .wppb-user-forms input[type="number"],
74
+ .wppb-user-forms input[type="email"],
75
+ .wppb-user-forms input[type="url"],
76
+ .wppb-user-forms input[type="password"],
77
+ .wppb-user-forms input[type="search"] {
78
+ padding: 3px;
79
+ }
80
+ .wppb-user-forms textarea {
81
+ overflow: auto; /* Removes default vertical scrollbar in IE6/7/8/9 */
82
+ padding-left: 3px;
83
+ vertical-align: top; /* Improves readability and alignment in all browsers */
84
+ width: 100%;
85
+ }
86
+ .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap { /* properly align wysiwyg editor among form fields */
87
+ float:left;
88
+ width:69.9%;
89
+ }
90
+ .wppb-user-forms .wppb-wysiwyg button:hover{ /* wysiwyg - overwrite the theme inherited background color on hover*/
91
+ background: none;
92
+ }
93
+ .wppb-user-forms .wppb-wysiwyg div.mce-tinymce.mce-panel{ /*Display the borders for the TinyMCE editor - Visual tab*/
94
+ border: 1px solid #ccc !important;
95
+ color: #666 !important;
96
+ }
97
+ .wppb-user-forms .wppb-wysiwyg div.mce-panel.mce-first{
98
+ border-width: 0 0 1px 0 !important;
99
+ }
100
+ .wppb-user-forms .wppb-wysiwyg div.mce-panel.mce-last{
101
+ border-width: 1px 0 !important;
102
+ }
103
+ .wppb-user-forms .wppb-wysiwyg .quicktags-toolbar { /*Display the borders for the TinyMCE editor - Text tab*/
104
+ border: 1px solid #dedede;
105
+ border-bottom: 0;
106
+ }
107
+ #wp-link label input[type="text"] { /*Fix the looks of the Add Link window for TinyMCE editor*/
108
+ padding: 0px;
109
+ }
110
+
111
+ #wppb-search-fields{
112
+ min-width: 250px;
113
+ float:left;
114
+ margin-right:20px;
115
+ }
116
+
117
+ .wppb-user-forms .wppb-search-button{
118
+ margin-right:10px;
119
+ padding:7px 20px;
120
+ line-height: 24px;
121
+ }
122
+
123
+ .wppb-search-users-wrap{
124
+ margin-bottom: 20px;
125
+ }
126
+
127
+ .wppb-user-forms .extra_field_heading {
128
+ margin-bottom: 0;
129
+ }
130
+
131
+ .wppb-gdpr-delete-button .wppb-delete-account {
132
+ width: 110px;
133
+ }
134
+
135
+ /*--------------------------------------------------------------
136
+ 3.0 Alignments
137
+ --------------------------------------------------------------*/
138
+ .wppb-user-forms ul{
139
+ max-width:900px;
140
+ list-style:none;
141
+ margin-left:0;
142
+ margin-right:0;
143
+ padding-left:0;
144
+ padding-right:0;
145
+ }
146
+
147
+ .wppb-user-forms ul li{
148
+ list-style:none;
149
+ }
150
+
151
+ #wppb-login-wrap p,
152
+ #select_user_to_edit_form p{
153
+ overflow:hidden;
154
+ margin:0;
155
+ padding-bottom:14px;
156
+ }
157
+
158
+ .wppb-user-forms ul li{
159
+ margin:0;
160
+ padding-bottom:14px;
161
+ }
162
+
163
+ .wppb-user-forms ul li:after{
164
+ content: "";
165
+ clear: both;
166
+ display: block;
167
+ }
168
+
169
+ .wppb-user-forms .wppb-input-hidden {
170
+ padding-bottom: 0;
171
+ }
172
+
173
+ .wppb-user-forms.wppb-user-role-administrator .wppb-input-hidden {
174
+ padding-bottom: 14px;
175
+ }
176
+
177
+ .wppb-user-forms .wppb-form-field > ul {
178
+ margin-left: 0;
179
+ }
180
+
181
+ .wppb-form-field label,
182
+ #wppb-login-wrap .login-username label,
183
+ #wppb-login-wrap .login-password label{
184
+ width:30%;
185
+ float:left;
186
+ min-height:1px;
187
+ }
188
+ .wppb-form-field input,
189
+ .wppb-form-field input[type="text"], .wppb-form-field input[type="number"], .wppb-form-field input[type="email"], .wppb-form-field input[type="url"], .wppb-form-field input[type="password"], .wppb-form-field input[type="search"],
190
+ .wppb-form-field select,
191
+ .wppb-form-field textarea,
192
+ .wppb-checkboxes,
193
+ .wppb-radios,
194
+ #wppb-login-wrap .login-username input,
195
+ #wppb-login-wrap .login-password input{
196
+ width:69.9%;
197
+ float:left;
198
+ }
199
+
200
+ .wppb-form-field.wppb-timepicker select {
201
+ width: auto;
202
+ margin-right: 5px;
203
+ }
204
+
205
+ .wppb-user-forms .wppb-wysiwyg .wp-editor-wrap .wp-editor-tabs *{
206
+ box-sizing: content-box !important;
207
+ }
208
+
209
+ .wppb-user-forms .wp-editor-wrap input {
210
+ float: none;
211
+ width: auto;
212
+ }
213
+
214
+ input#send_credentials_via_email{
215
+ float:none;
216
+ width:auto;
217
+ margin-right:10px
218
+ }
219
+
220
+ .wppb-send-credentials-checkbox label{
221
+ width:auto;
222
+ }
223
+
224
+ .wppb-form-field > span{
225
+ display:block;
226
+ clear:both;
227
+ margin-left:30%;
228
+ font-size:80%;
229
+ font-style:italic;
230
+ }
231
+
232
+ .wppb-form-field > span.custom_field_html {
233
+ font-style: normal;
234
+ font-size: 100%;
235
+ }
236
+
237
+ .wppb-form-field > span.select2-container {
238
+ font-style: normal;
239
+ font-size: 100%;
240
+ clear:none;
241
+ }
242
+
243
+ .wppb-repeater .wppb-select-cpt span.select2-container{
244
+ width:auto !important;
245
+ }
246
+
247
+ .wppb-form-field.wppb-timepicker > span.wppb-timepicker-separator {
248
+ display: inline-block;
249
+ float: left;
250
+ clear: none;
251
+ margin-left: 0;
252
+ margin-right: 5px;
253
+ font-size: 100%;
254
+ font-style: normal;
255
+ }
256
+
257
+ .wppb_upload_button{
258
+ display:inline-block;
259
+ }
260
+
261
+ .wppb-user-forms .wppb-checkboxes li,
262
+ .wppb-user-forms .wppb-radios li{
263
+ display:inline-block;
264
+ padding:0 20px 0 0;
265
+ }
266
+
267
+ .wppb-user-forms .wppb-checkboxes li.wppb-hidden{
268
+ padding: 0;
269
+ }
270
+
271
+ .wppb-form-field .wppb-checkboxes label,
272
+ .wppb-form-field .wppb-radios label{
273
+ float:none;
274
+ min-width:0;
275
+ padding-left:5px;
276
+ width:auto;
277
+ display:inline-block;
278
+ }
279
+
280
+ .wppb-checkbox-terms-and-conditions input,
281
+ .wppb-checkboxes li input,
282
+ .wppb-radios li input{
283
+ min-width:0;
284
+ float:none;
285
+ width:auto;
286
+ }
287
+
288
+ .wppb-edit-user .wppb-checkbox-terms-and-conditions {
289
+ display:none;
290
+ }
291
+
292
+ .wppb-form-field.wppb-heading span,
293
+ .wppb-default-about-yourself-heading span,
294
+ .wppb-default-contact-info-heading span,
295
+ .wppb-default-name-heading span,
296
+ .wppb-checkbox-terms-and-conditions span{
297
+ margin-left:0;
298
+ }
299
+
300
+ .wppb-checkbox-terms-and-conditions label {
301
+ width: 100%;
302
+ }
303
+
304
+ .wppb-form-field.wppb-checkbox-terms-and-conditions input[type="checkbox"].custom_field_toa {
305
+ float:none;
306
+ width:auto;
307
+ margin-right:10px
308
+ }
309
+
310
+
311
+ .wppb-recaptcha-element{
312
+ display: inline-block;
313
+ }
314
+ .wppb-recaptcha-element.wppb-invisible-recaptcha {
315
+ display: block !important;
316
+ }
317
+ .wppb-recaptcha-element iframe{
318
+ margin-bottom: 0;
319
+ }
320
+
321
+ .wppb-form-field input.wppb-map-search-box {
322
+ position: absolute;
323
+ top: 10px !important;
324
+ height: 34px;
325
+ width: 50%;
326
+ min-width: 250px;
327
+ background: #fff;
328
+ border: 0;
329
+ border-radius: 1px;
330
+ padding: 0 10px;
331
+ box-shadow: 0 1px 1px 0 #c1c1c1;
332
+ font-family: 'Roboto', sans-serif;
333
+ }
334
+
335
+ .wppb-create-new-site{
336
+ width: 100%;
337
+ }
338
+ input#wppb_create_new_site_checkbox{
339
+ width: auto;
340
+ margin-right: 10px;
341
+ float: none;
342
+ }
343
+ label[for=wppb_create_new_site_checkbox]{
344
+ width:100%;
345
+ }
346
+ label[for=blog-privacy]{
347
+ width:100%;
348
+ }
349
+
350
+
351
+ /* GDPR checkbox */
352
+ .wppb-gdpr-checkbox.wppb-form-field label{
353
+ width:100%;
354
+ float:none;
355
+ }
356
+
357
+ .wppb-gdpr-checkbox.wppb-form-field #user_consent_gdpr{
358
+ float:none;
359
+ width:auto;
360
+ margin:0 10px 0 0;
361
+ }
362
+
363
+
364
+ /*--------------------------------------------------------------
365
+ 4.0 Errors & Notices
366
+ --------------------------------------------------------------*/
367
+
368
+ .wppb-error,
369
+ .wppb-warning {
370
+ padding: 6px 9px;
371
+ margin: 0 auto 25px;
372
+ display: block;
373
+ width: 100%;
374
+ box-sizing: border-box;
375
+ background: #ffebe8;
376
+ border: 1px solid #C00;
377
+ }
378
+
379
+ .wppb-error,
380
+ .wppb-warning{
381
+ color:#222222 !important;
382
+ }
383
+
384
+ .wppb-error a,
385
+ .wppb-warning a{
386
+ color:#007acc !important;
387
+ }
388
+
389
+ .admin-bar #wppb_form_general_message{
390
+ padding-top:32px;
391
+ }
392
+
393
+ .wppb-error a:hover,
394
+ .wppb-warning a:hover{
395
+ color:#007acc !important;
396
+ text-decoration: underline;
397
+ }
398
+
399
+ .wppb-required{
400
+ color: red;
401
+ }
402
+
403
+ .wppb-required,
404
+ .wppb-checkbox-terms-and-conditions span.wppb-required{
405
+ margin-left:5px;
406
+ }
407
+
408
+ .wppb-success {
409
+ padding: 6px 9px;
410
+ margin: 0 auto 25px;
411
+ display: block;
412
+ width: 100%;
413
+ box-sizing: border-box;
414
+ background: #e7f7d3;
415
+ border: 1px solid #6c3;
416
+ }
417
+
418
+ .wppb-register-user .wppb-field-error,
419
+ .wppb-edit-user .wppb-field-error,
420
+ #wppb-recover-password .wppb-field-error{
421
+ background-color: #FFDFDF;
422
+ border: 1px dotted #C89797;
423
+ margin-bottom: 6px !important;
424
+ padding: 6px !important;
425
+ }
426
+
427
+ .wppb-field-error > input,
428
+ .wppb-field-error > select,
429
+ .wppb-field-error > textarea,
430
+ .wppb-field-error > label{
431
+ margin-bottom: 10px;
432
+ }
433
+
434
+ .wppb-field-error img{
435
+ box-shadow: none;
436
+ -webkit-box-shadow:none;
437
+ border:none;
438
+ border-radius:0px;
439
+ vertical-align: middle;
440
+ margin-top: -3px;
441
+ padding-left:5px;
442
+ width: auto;
443
+ height: auto;
444
+ }
445
+
446
+ .wppb-form-field > span.wppb-form-error{
447
+ margin-top:10px;
448
+ padding-top: 5px;
449
+ border-top:1px dotted #c89797;
450
+ font-size:100%;
451
+ margin-left: 0;
452
+ }
453
+
454
+ /* Remove global Blog Details Field error */
455
+ #wppb-register-user .wppb-default-blog-details.wppb-field-error{
456
+ background-color: transparent !important;
457
+ border: 0px !important;
458
+ }
459
+ .wppb-default-blog-details > span.wppb-form-error{
460
+ display:none;
461
+ }
462
+ .wppb-blog-details-heading span {
463
+ margin-left: 0;
464
+ }
465
+
466
+
467
+
468
+
469
+ /*--------------------------------------------------------------
470
+ 5.0 User Listing
471
+ --------------------------------------------------------------*/
472
+ .wppb-table *{
473
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
474
+ }
475
+ .wppb-table{
476
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
477
+ border-spacing: 0.5rem;
478
+ border-collapse: collapse;
479
+ width: 100%;
480
+ }
481
+
482
+ .wppb-table th{
483
+ background: #f4f4f4;
484
+ padding: 7px;
485
+ border:1px solid #e1e1e1;
486
+ text-align: left;
487
+ }
488
+
489
+ .wppb-table thead tr:hover{
490
+ background: none;
491
+ }
492
+
493
+ .wppb-table .wppb-sorting .wppb-sorting-default {
494
+ display: inline-block;
495
+ width: 16px;
496
+ height: 16px;
497
+ background: url('../images/sorting-default.png') no-repeat center center;
498
+ vertical-align: middle;
499
+ }
500
+
501
+ .wppb-table .wppb-sorting .wppb-sorting-ascending {
502
+ background-image: url('../images/sorting-ascending.png');
503
+ }
504
+
505
+ .wppb-table .wppb-sorting .wppb-sorting-descending {
506
+ background-image: url('../images/sorting-descending.png');
507
+ }
508
+
509
+ .wppb-table tr:hover{
510
+ background: #f1fcff;
511
+ }
512
+ .wppb-table td{
513
+ padding: 7px;
514
+ border:1px solid #e1e1e1;
515
+ }
516
+
517
+ .wppb-table .wppb-posts,
518
+ .wppb-table .wppb-moreinfo{
519
+ text-align: center;
520
+ }
521
+
522
+ .wppb-avatar img {
523
+ max-width: none;
524
+ }
525
+
526
+ ul.wppb-profile{
527
+ list-style-type: none;
528
+ margin-left: 0;
529
+ margin-right: 0;
530
+ padding-left:0;
531
+ padding-right: 0;
532
+ }
533
+
534
+ ul.wppb-profile li{
535
+ margin-left: 0;
536
+ margin-right: 0;
537
+ overflow: hidden;
538
+ }
539
+
540
+ ul.wppb-profile li label{
541
+ display: block;
542
+ width:30%;
543
+ float:left;
544
+ min-height:1px;
545
+ font-weight: bold;
546
+ }
547
+
548
+ ul.wppb-profile li span{
549
+ display: block;
550
+ width:69.9%;
551
+ float:left;
552
+ }
553
+
554
+ ul.wppb-profile li h3,
555
+ ul.wppb-profile li h3:first-child{
556
+ margin:20px 0;
557
+ padding-top:20px;
558
+ border-top:1px solid #d2d2d2;
559
+ }
560
+
561
+ ul.wppb-faceted-list{
562
+ list-style: none;
563
+ margin:0 0 20px;
564
+ }
565
+
566
+ ul.wppb-faceted-list:after{
567
+ visibility: hidden;
568
+ display: block;
569
+ font-size: 0;
570
+ content: " ";
571
+ clear: both;
572
+ height: 0;
573
+ }
574
+
575
+ ul.wppb-faceted-list > li{
576
+ float:left;
577
+ margin-right: 15px;
578
+ max-width: 300px;
579
+ }
580
+
581
+ ul.wppb-faceted-list > li:first-child{
582
+ float:none;
583
+ clear:both;
584
+ }
585
+
586
+ .wppb-userlisting-container .wppb-faceted-list li h5{
587
+ margin-top: 20px;
588
+ margin-bottom: 5px;
589
+ }
590
+
591
+ ul.wppb-faceted-list label > *{
592
+ vertical-align: middle;
593
+ }
594
+
595
+ ul.wppb-faceted-list input[type="checkbox"]{
596
+ margin-right: 5px;
597
+ }
598
+
599
+ .wppb-userlisting-container.wppb-spinner{
600
+ position:relative;
601
+ opacity: 0.5
602
+ }
603
+
604
+ .wppb-userlisting-container.wppb-spinner:after{
605
+ content: '';
606
+ position: absolute;
607
+ top: 50%;
608
+ left: 50%;
609
+ margin-top: -16px;
610
+ margin-left: -16px;
611
+ display: block;
612
+ width: 32px;
613
+ height: 32px;
614
+ /*background: url('../images/ajax-loader.gif') no-repeat center;*/
615
+ z-index: 1000;
616
+ }
617
+
618
+ ul.wppb-faceted-list .hide-this{
619
+ display:none;
620
+ }
621
+
622
+ #wppb-remove-facets-container{
623
+ list-style: none;
624
+ margin: 0;
625
+ }
626
+
627
+ .wppb-remove-facet:before, .wppb-remove-all-facets:before {
628
+ content: "x";
629
+ display: inline-block;
630
+ border-right: 1px dotted #D3CCC9;
631
+ border-right: 1px dotted #6F6F6F;
632
+ padding-right: 5px;
633
+ margin-right: 5px;
634
+ }
635
+
636
+ .wppb-userlisting-container .wppb-ul-range-values{
637
+ padding: 5px 0;
638
+ }
639
+
640
+ .wppb-userlisting-container .wppb-facet-select-multiple{
641
+ height:auto;
642
+ }
643
+
644
+ .wppb-userlisting-container:after {
645
+ visibility: hidden;
646
+ display: block;
647
+ font-size: 0;
648
+ content: " ";
649
+ clear: both;
650
+ height: 0;
651
+ }
652
+
653
+ .wppb-float-left{
654
+ float:left;
655
+ }
656
+
657
+ .wppb-float-right{
658
+ float:right;
659
+ }
660
+
661
+ .wppb-facet-float-left{
662
+ float:left;
663
+ max-width:300px;
664
+ }
665
+
666
+ .wppb-facet-float-right{
667
+ float:right;
668
+ max-width:300px;
669
+ }
670
+
671
+
672
+ @media screen and ( max-width: 720px ) {
673
+
674
+ .wppb-table {
675
+ border: 0;
676
+ }
677
+
678
+ .wppb-table thead {
679
+ display: none
680
+ }
681
+
682
+ .wppb-table tr {
683
+ display: block;
684
+ margin-bottom: 30px;
685
+ }
686
+
687
+ .wppb-table td {
688
+ display: block;
689
+ text-align: right;
690
+ border-bottom: 0;
691
+ }
692
+
693
+ .wppb-table td:last-of-type {
694
+ border-bottom: 1px solid #e1e1e1;
695
+ }
696
+
697
+ .wppb-table .wppb-posts,
698
+ .wppb-table .wppb-moreinfo{
699
+ text-align: right;
700
+ }
701
+
702
+ .wppb-table td:before {
703
+ content: attr(data-label);
704
+ float: left;
705
+ }
706
+
707
+ .wppb-table td:after {
708
+ content: '';
709
+ display: block;
710
+ clear: both;
711
+ }
712
+
713
+ }
714
+
715
+ /*--------------------------------------------------------------
716
+ 6.0 Media Queries
717
+ --------------------------------------------------------------*/
718
+
719
+ @media screen and (max-width: 400px) {
720
+
721
+ .wppb-form-field label,
722
+ #wppb-login-wrap .login-username label,
723
+ #wppb-login-wrap .login-password label,
724
+ ul.wppb-profile li label{
725
+ width:100%;
726
+ display:block;
727
+ float:none;
728
+ }
729
+
730
+ .wppb-form-field input,
731
+ .wppb-form-field select,
732
+ .wppb-form-field textarea,
733
+ .wppb-checkboxes,
734
+ .wppb-radios,
735
+ #wppb-login-wrap .login-username input,
736
+ #wppb-login-wrap .login-password input,
737
+ ul.wppb-profile li span{
738
+ width:100%;
739
+ float:left;
740
+ }
741
+
742
+ .wppb-form-field > span{
743
+ margin-left:0;
744
+ }
745
+
746
+ .wppb-checkboxes li label,
747
+ .wppb-radios li label{
748
+ display:inline;
749
+ }
750
+
751
+ .wppb-form-field .wppb-avatar-nofile,
752
+ .wppb-form-field .wppb-avatar-file,
753
+ .wppb-form-field .wppb-upload-nofile,
754
+ .wppb-form-field .wppb-upload-file{
755
+ margin-left:0;
756
+ }
757
+
758
+ }
759
+
760
+ /*--------------------------------------------------------------
761
+ 7.0 Password Strength
762
+ --------------------------------------------------------------*/
763
+ #pass-strength-result {
764
+ background-color: #eee;
765
+ border: 1px solid #ddd;
766
+ display: none;
767
+ float: left;
768
+ margin: 13px 5px 5px 30%;
769
+ padding: 3px 5px;
770
+ text-align: center;
771
+ width: 200px;
772
+ height:28px;
773
+ }
774
+ #pass-strength-result.short {
775
+ background-color: #ffa0a0;
776
+ border-color: #f04040;
777
+ }
778
+ #pass-strength-result.bad {
779
+ background-color: #ffb78c;
780
+ border-color: #ff853c;
781
+ }
782
+ #pass-strength-result.good {
783
+ background-color: #ffec8b;
784
+ border-color: #fc0;
785
+ }
786
+ #pass-strength-result.strong {
787
+ background-color: #c3ff88;
788
+ border-color: #8dff1c;
789
+ }
790
+
791
+ /**************************************************/
792
+ /* Profile Builder Subscription Plans Field
793
+ /**************************************************/
794
+ .wppb-form-field.wppb-subscription-plans label {
795
+ width: 100%;
796
+ float: none;
797
+ }
798
+
799
+ .wppb-form-field.wppb-subscription-plans input {
800
+ display: inline-block;
801
+ width: auto;
802
+ float: none;
803
+ margin-right: 10px !important;
804
+ }
805
+
806
+ .wppb-form-field.wppb-subscription-plans span.description {
807
+ display: block;
808
+ font-size: 100%;
809
+ font-style: italic;
810
+ margin-left: 0;
811
+ margin-bottom: 1.5em;
812
+ }
813
+
814
+ /**************************************************/
815
+ /* This is very weird: if in the css there is a rule on table of border-collapse:collapse; then on FFox and Edge the Media upload won't open
816
+ /**************************************************/
817
+ .wppb-user-forms table{
818
+ border-collapse:separate;
819
+ }
820
+
821
+ /**************************************************/
822
+ /* Private Website CSS
823
+ /**************************************************/
824
+ .wppb-private-website.wppb-private-website-hide-menus .main-navigation{
825
+ display:none;
826
+ }
827
+
828
+
829
+ /* Map markers info */
830
+ .marker-content-info {position: absolute; top: -400px; left: -400px; display: none;}
831
+ .wppb-map-container .marker-content {min-width: 320px; max-width: 100%;}
832
+ .wppb-map-container .marker-content .marker-info-avatar_or_gravatar {float: left; margin-right: 10px;}
assets/js/jquery-edit-profile.js DELETED
@@ -1,16 +0,0 @@
1
- function confirmDelete( nonceField, currentUser, customFieldID, customFieldName, returnTo, ajaxurl, what, fileName, text ) {
2
- if (confirm(text)) {
3
- jQuery.post( ajaxurl , { action:"hook_wppb_delete", currentUser:currentUser, customFieldID:customFieldID, customFieldName:customFieldName, what:what, _ajax_nonce:nonceField }, function( response ) {
4
- if( jQuery.trim(response)=="done" ){
5
- if ( what == 'avatar' ){
6
- alert( ep.avatar );
7
- }else{
8
- alert( ep.attachment +' '+ fileName );
9
- }
10
- window.location=returnTo;
11
- }else{
12
- alert(jQuery.trim(response));
13
- }
14
- });
15
- }
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/jquery-email-confirmation.js CHANGED
@@ -1,67 +1,67 @@
1
- function wppb_display_page_select( value ){
2
- if ( value == 'yes' ){
3
- jQuery ( '#wppb-settings-activation-page' ).show();
4
- jQuery ( '.dynamic1' ).show();
5
-
6
- }else{
7
- jQuery ( '#wppb-settings-activation-page' ).hide();
8
- jQuery ( '.dynamic1' ).hide();
9
- }
10
- }
11
-
12
-
13
- function wppb_display_page_select_aa( value ){
14
- if ( value == 'yes' )
15
- jQuery ( '.dynamic2' ).show();
16
-
17
- else
18
- jQuery ( '.dynamic2' ).hide();
19
- }
20
-
21
- function wppb_display_page_select_re( value ){
22
- if ( value == 'yes' )
23
- jQuery ( '.dynamic3' ).show();
24
-
25
- else
26
- jQuery ( '.dynamic3' ).hide();
27
- }
28
-
29
- function wppb_display_page_select_cr( value ){
30
- if ( value == 'yes' )
31
- jQuery ( '.dynamic4' ).show();
32
-
33
- else
34
- jQuery ( '.dynamic4' ).hide();
35
- }
36
-
37
-
38
- jQuery(function() {
39
- if ( ( jQuery( '#wppb_settings_email_confirmation' ).val() == 'yes' ) || ( jQuery( '#wppb_general_settings_hidden' ).val() == 'multisite' ) ){
40
- jQuery ( '#wppb-settings-activation-page' ).show();
41
- jQuery ( '.dynamic1' ).show();
42
-
43
- }else{
44
- jQuery ( '#wppb-settings-activation-page' ).hide();
45
- jQuery ( '.dynamic1' ).hide();
46
- }
47
-
48
-
49
- if ( jQuery( '#adminApprovalSelect' ).val() == 'yes' )
50
- jQuery ( '.dynamic2' ).show();
51
-
52
- else
53
- jQuery ( '.dynamic2' ).hide();
54
-
55
-
56
- if ( jQuery( '#rolesEditorSelect' ).val() == 'yes' )
57
- jQuery ( '.dynamic3' ).show();
58
-
59
- else
60
- jQuery ( '.dynamic3' ).hide();
61
-
62
- if ( jQuery( '#contentRestrictionSelect' ).val() == 'yes' )
63
- jQuery ( '.dynamic4' ).show();
64
-
65
- else
66
- jQuery ( '.dynamic4' ).hide();
67
  });
1
+ function wppb_display_page_select( value ){
2
+ if ( value == 'yes' ){
3
+ jQuery ( '#wppb-settings-activation-page' ).show();
4
+ jQuery ( '.dynamic1' ).show();
5
+
6
+ }else{
7
+ jQuery ( '#wppb-settings-activation-page' ).hide();
8
+ jQuery ( '.dynamic1' ).hide();
9
+ }
10
+ }
11
+
12
+
13
+ function wppb_display_page_select_aa( value ){
14
+ if ( value == 'yes' )
15
+ jQuery ( '.dynamic2' ).show();
16
+
17
+ else
18
+ jQuery ( '.dynamic2' ).hide();
19
+ }
20
+
21
+ function wppb_display_page_select_re( value ){
22
+ if ( value == 'yes' )
23
+ jQuery ( '.dynamic3' ).show();
24
+
25
+ else
26
+ jQuery ( '.dynamic3' ).hide();
27
+ }
28
+
29
+ function wppb_display_page_select_cr( value ){
30
+ if ( value == 'yes' )
31
+ jQuery ( '.dynamic4' ).show();
32
+
33
+ else
34
+ jQuery ( '.dynamic4' ).hide();
35
+ }
36
+
37
+
38
+ jQuery(function() {
39
+ if ( ( jQuery( '#wppb_settings_email_confirmation' ).val() == 'yes' ) || ( jQuery( '#wppb_general_settings_hidden' ).val() == 'multisite' ) ){
40
+ jQuery ( '#wppb-settings-activation-page' ).show();
41
+ jQuery ( '.dynamic1' ).show();
42
+
43
+ }else{
44
+ jQuery ( '#wppb-settings-activation-page' ).hide();
45
+ jQuery ( '.dynamic1' ).hide();
46
+ }
47
+
48
+
49
+ if ( jQuery( '#adminApprovalSelect' ).val() == 'yes' )
50
+ jQuery ( '.dynamic2' ).show();
51
+
52
+ else
53
+ jQuery ( '.dynamic2' ).hide();
54
+
55
+
56
+ if ( jQuery( '#rolesEditorSelect' ).val() == 'yes' )
57
+ jQuery ( '.dynamic3' ).show();
58
+
59
+ else
60
+ jQuery ( '.dynamic3' ).hide();
61
+
62
+ if ( jQuery( '#contentRestrictionSelect' ).val() == 'yes' )
63
+ jQuery ( '.dynamic4' ).show();
64
+
65
+ else
66
+ jQuery ( '.dynamic4' ).hide();
67
  });
assets/js/jquery-epf-rf.js CHANGED
@@ -1,166 +1,166 @@
1
- function wppb_epf_rf_disable_live_select ( selector ){
2
- jQuery( selector ).attr( 'disabled', true );
3
- }
4
-
5
- function wppb_rf_epf_change_id( field, container_name, fieldObj ) {
6
- var buttonInContainer = jQuery( '.button-primary', fieldObj.parent().parent().parent() );
7
- buttonInContainer.attr('disabled',true);
8
- buttonInContainer.attr('tempclick', buttonInContainer.attr("onclick") );
9
- buttonInContainer.removeAttr('onclick');
10
-
11
- jQuery.post( ajaxurl , { action:"wppb_handle_rf_epf_id_change", field:field }, function(response) {
12
-
13
- /**
14
- * since version 2.0.2 we have the id directly on the option in the select so this ajax function is a little
15
- redundant but can't be sure of the impact on other features so we will just add this
16
- */
17
- id = fieldObj.find(":selected").attr( 'data-id' );
18
- if( !id ){
19
- id = response;
20
- }
21
-
22
- jQuery( '#id', fieldObj.parent().parent().parent() ).val( id );
23
- buttonInContainer.attr('onclick', buttonInContainer.attr("tempclick") );
24
- buttonInContainer.removeAttr('tempclick');
25
-
26
- if( ( fieldObj.parents('.update_container_wppb_rf_fields').length || fieldObj.parents('.update_container_wppb_epf_fields').length ) && buttonInContainer.attr('disabled') ) {
27
- buttonInContainer.text('Save Changes');
28
- }
29
-
30
- buttonInContainer.removeAttr('disabled');
31
- });
32
- }
33
-
34
- jQuery(function(){
35
- wppb_disable_delete_on_default_mandatory_fields();
36
- wppb_disable_select_field_options();
37
-
38
- jQuery(document).on( 'change', '#wppb_rf_fields .mb-list-entry-fields #field', function () {
39
- wppb_rf_epf_change_id( jQuery(this).val(), '#wppb_rf_fields', jQuery(this) );
40
- });
41
- jQuery(document).on( 'change', '.update_container_wppb_rf_fields .mb-list-entry-fields #field', function () {
42
- wppb_rf_epf_change_id( jQuery(this).val(), '.update_container_wppb_rf_fields', jQuery(this) );
43
- });
44
-
45
- jQuery(document).on( 'change', '#wppb_epf_fields .mb-list-entry-fields #field', function () {
46
- wppb_rf_epf_change_id( jQuery(this).val(), '#wppb_epf_fields', jQuery(this) );
47
- });
48
-
49
- jQuery(document).on( 'change', '.update_container_wppb_epf_fields .mb-list-entry-fields #field', function () {
50
- wppb_rf_epf_change_id( jQuery(this).val(), '.update_container_wppb_epf_fields', jQuery(this) );
51
- });
52
- });
53
-
54
- /* function that removes the delete button and disables changing the field type on edit for username,password and email default fields */
55
- function wppb_disable_delete_on_default_mandatory_fields(){
56
- jQuery( '#container_wppb_rf_fields [class$="default-username added_fields_list"] .mbdelete, #container_wppb_rf_fields [class$="default-e-mail added_fields_list"] .mbdelete, #container_wppb_rf_fields [class$="default-password added_fields_list"] .mbdelete' ).hide(); // PB specific line
57
- jQuery( '[class$="default-username"] #field, [class$="default-e-mail"] #field, [class$="default-password"] #field' ).attr( 'disabled', true ); // PB specific line
58
- }
59
-
60
- /* Disables the options in the field select drop-down that are also present in the table below */
61
- function wppb_disable_select_field_options() {
62
- jQuery('#field option').each( function() {
63
- $optionField = jQuery(this);
64
- $optionField.removeAttr('disabled');
65
-
66
- var optionFieldId = jQuery(this).attr('data-id');
67
-
68
- jQuery('#container_wppb_rf_fields .row-id pre, #container_wppb_epf_fields .row-id pre').each( function() {
69
- if( jQuery(this).text() == optionFieldId ) {
70
- $optionField.attr('disabled', true);
71
- }
72
- });
73
- });
74
-
75
- wppb_check_options_disabled_add_field();
76
- }
77
-
78
- /*
79
- * Check to see if the selected field in the add new field to the list select drop-down is disabled
80
- * We don't want this to happen, so select the first option instead
81
- */
82
- function wppb_check_options_disabled_add_field() {
83
- if( jQuery('#wppb_rf_fields #field option:selected, #wppb_epf_fields #field option:selected').is(':disabled') ) {
84
- jQuery('#wppb_rf_fields #field option, #wppb_epf_fields #field option').first().attr('selected', true);
85
- }
86
- }
87
-
88
- /*
89
- * Run through all the field drop-downs, in edit mode, and check if the selected option is disabled
90
- * If it is, disable the save button and if the date-id of the selected option matches the id of the field
91
- * change the text of the button
92
- */
93
- function wppb_check_options_disabled_edit_field() {
94
- jQuery('.update_container_wppb_rf_fields #field, .update_container_wppb_epf_fields #field').each( function() {
95
-
96
- $selectedOption = jQuery(this).children('option:selected');
97
- $primaryButton = jQuery(this).parents('.mb-list-entry-fields').find('.button-primary');
98
-
99
- if( $selectedOption.is(':disabled') ) {
100
- $rowId = parseInt( jQuery(this).parents('tr').prev().find('.row-id pre').text() );
101
-
102
- $primaryButton.attr('disabled', true);
103
- $primaryButton[0].onclick = null;
104
-
105
- if( $rowId != parseInt( $selectedOption.attr('data-id') ) ) {
106
- $primaryButton.text('This field has already been added to the form');
107
- }
108
- } else {
109
- $primaryButton.attr('disabled', false);
110
-
111
- var tempBtnOnClick = $primaryButton.attr('onclick');
112
- $primaryButton.text('Save Changes').removeAttr('onclick').attr('onclick', tempBtnOnClick);
113
- }
114
-
115
- });
116
- }
117
-
118
- /*
119
- * Check to see if the selected field in the edit field select drop-down is disabled
120
- * If it is we want to disable saving, because no changes have been made
121
- */
122
- function wppb_check_update_field_options_disabled() {
123
- jQuery('.update_container_wppb_rf_fields #field, .update_container_wppb_epf_fields #field').each( function() {
124
- if( jQuery(this).find('option:selected').is(':disabled') ) {
125
- jQuery(this).parents('.mb-list-entry-fields').find('.button-primary').attr('disabled', true);
126
- jQuery(this).parents('.mb-list-entry-fields').find('.button-primary')[0].onclick = null;
127
- }
128
- });
129
- }
130
-
131
- /*
132
- * Function that sends an ajax request to delete all items(fields) from a form
133
- *
134
- */
135
- function wppb_rf_epf_delete_all_fields(event, delete_all_button_id, nonce) {
136
- event.preventDefault();
137
- $deleteButton = jQuery('#' + delete_all_button_id);
138
-
139
- var response = confirm( "Are you sure you want to delete all items ?" );
140
-
141
- if( response == true ) {
142
- $tableParent = $deleteButton.parents('table');
143
-
144
- var meta = $tableParent.attr('id').replace('container_', '');
145
- var post_id = parseInt( $tableParent.attr('post') );
146
-
147
- $tableParent.parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
148
-
149
- jQuery.post( ajaxurl, { action: "wppb_rf_epf_delete_all_fields", meta: meta, id: post_id, _ajax_nonce: nonce }, function(response) {
150
-
151
- /* refresh the list */
152
- jQuery.post( wppbWckAjaxurl, { action: "wck_refresh_list"+meta, meta: meta, id: post_id}, function(response) {
153
- jQuery('#container_'+meta).replaceWith(response);
154
- $tableParent = jQuery('#container_'+meta);
155
-
156
- $tableParent.find('tbody td').css('width', function(){ return jQuery(this).width() });
157
-
158
- mb_sortable_elements();
159
- $tableParent.parent().css('opacity','1');
160
-
161
- jQuery('#mb-ajax-loading').remove();
162
- });
163
-
164
- });
165
- }
166
  }
1
+ function wppb_epf_rf_disable_live_select ( selector ){
2
+ jQuery( selector ).attr( 'disabled', true );
3
+ }
4
+
5
+ function wppb_rf_epf_change_id( field, container_name, fieldObj ) {
6
+ var buttonInContainer = jQuery( '.button-primary', fieldObj.parent().parent().parent() );
7
+ buttonInContainer.attr('disabled',true);
8
+ buttonInContainer.attr('tempclick', buttonInContainer.attr("onclick") );
9
+ buttonInContainer.removeAttr('onclick');
10
+
11
+ jQuery.post( ajaxurl , { action:"wppb_handle_rf_epf_id_change", field:field }, function(response) {
12
+
13
+ /**
14
+ * since version 2.0.2 we have the id directly on the option in the select so this ajax function is a little
15
+ redundant but can't be sure of the impact on other features so we will just add this
16
+ */
17
+ id = fieldObj.find(":selected").attr( 'data-id' );
18
+ if( !id ){
19
+ id = response;
20
+ }
21
+
22
+ jQuery( '#id', fieldObj.parent().parent().parent() ).val( id );
23
+ buttonInContainer.attr('onclick', buttonInContainer.attr("tempclick") );
24
+ buttonInContainer.removeAttr('tempclick');
25
+
26
+ if( ( fieldObj.parents('.update_container_wppb_rf_fields').length || fieldObj.parents('.update_container_wppb_epf_fields').length ) && buttonInContainer.attr('disabled') ) {
27
+ buttonInContainer.text('Save Changes');
28
+ }
29
+
30
+ buttonInContainer.removeAttr('disabled');
31
+ });
32
+ }
33
+
34
+ jQuery(function(){
35
+ wppb_disable_delete_on_default_mandatory_fields();
36
+ wppb_disable_select_field_options();
37
+
38
+ jQuery(document).on( 'change', '#wppb_rf_fields .mb-list-entry-fields #field', function () {
39
+ wppb_rf_epf_change_id( jQuery(this).val(), '#wppb_rf_fields', jQuery(this) );
40
+ });
41
+ jQuery(document).on( 'change', '.update_container_wppb_rf_fields .mb-list-entry-fields #field', function () {
42
+ wppb_rf_epf_change_id( jQuery(this).val(), '.update_container_wppb_rf_fields', jQuery(this) );
43
+ });
44
+
45
+ jQuery(document).on( 'change', '#wppb_epf_fields .mb-list-entry-fields #field', function () {
46
+ wppb_rf_epf_change_id( jQuery(this).val(), '#wppb_epf_fields', jQuery(this) );
47
+ });
48
+
49
+ jQuery(document).on( 'change', '.update_container_wppb_epf_fields .mb-list-entry-fields #field', function () {
50
+ wppb_rf_epf_change_id( jQuery(this).val(), '.update_container_wppb_epf_fields', jQuery(this) );
51
+ });
52
+ });
53
+
54
+ /* function that removes the delete button and disables changing the field type on edit for username,password and email default fields */
55
+ function wppb_disable_delete_on_default_mandatory_fields(){
56
+ jQuery( '#container_wppb_rf_fields [class$="default-username added_fields_list"] .mbdelete, #container_wppb_rf_fields [class$="default-e-mail added_fields_list"] .mbdelete, #container_wppb_rf_fields [class$="default-password added_fields_list"] .mbdelete' ).hide(); // PB specific line
57
+ jQuery( '[class$="default-username"] #field, [class$="default-e-mail"] #field, [class$="default-password"] #field' ).attr( 'disabled', true ); // PB specific line
58
+ }
59
+
60
+ /* Disables the options in the field select drop-down that are also present in the table below */
61
+ function wppb_disable_select_field_options() {
62
+ jQuery('#field option').each( function() {
63
+ $optionField = jQuery(this);
64
+ $optionField.removeAttr('disabled');
65
+
66
+ var optionFieldId = jQuery(this).attr('data-id');
67
+
68
+ jQuery('#container_wppb_rf_fields .row-id pre, #container_wppb_epf_fields .row-id pre').each( function() {
69
+ if( jQuery(this).text() == optionFieldId ) {
70
+ $optionField.attr('disabled', true);
71
+ }
72
+ });
73
+ });
74
+
75
+ wppb_check_options_disabled_add_field();
76
+ }
77
+
78
+ /*
79
+ * Check to see if the selected field in the add new field to the list select drop-down is disabled
80
+ * We don't want this to happen, so select the first option instead
81
+ */
82
+ function wppb_check_options_disabled_add_field() {
83
+ if( jQuery('#wppb_rf_fields #field option:selected, #wppb_epf_fields #field option:selected').is(':disabled') ) {
84
+ jQuery('#wppb_rf_fields #field option, #wppb_epf_fields #field option').first().attr('selected', true);
85
+ }
86
+ }
87
+
88
+ /*
89
+ * Run through all the field drop-downs, in edit mode, and check if the selected option is disabled
90
+ * If it is, disable the save button and if the date-id of the selected option matches the id of the field
91
+ * change the text of the button
92
+ */
93
+ function wppb_check_options_disabled_edit_field() {
94
+ jQuery('.update_container_wppb_rf_fields #field, .update_container_wppb_epf_fields #field').each( function() {
95
+
96
+ $selectedOption = jQuery(this).children('option:selected');
97
+ $primaryButton = jQuery(this).parents('.mb-list-entry-fields').find('.button-primary');
98
+
99
+ if( $selectedOption.is(':disabled') ) {
100
+ $rowId = parseInt( jQuery(this).parents('tr').prev().find('.row-id pre').text() );
101
+
102
+ $primaryButton.attr('disabled', true);
103
+ $primaryButton[0].onclick = null;
104
+
105
+ if( $rowId != parseInt( $selectedOption.attr('data-id') ) ) {
106
+ $primaryButton.text('This field has already been added to the form');
107
+ }
108
+ } else {
109
+ $primaryButton.attr('disabled', false);
110
+
111
+ var tempBtnOnClick = $primaryButton.attr('onclick');
112
+ $primaryButton.text('Save Changes').removeAttr('onclick').attr('onclick', tempBtnOnClick);
113
+ }
114
+
115
+ });
116
+ }
117
+
118
+ /*
119
+ * Check to see if the selected field in the edit field select drop-down is disabled
120
+ * If it is we want to disable saving, because no changes have been made
121
+ */
122
+ function wppb_check_update_field_options_disabled() {
123
+ jQuery('.update_container_wppb_rf_fields #field, .update_container_wppb_epf_fields #field').each( function() {
124
+ if( jQuery(this).find('option:selected').is(':disabled') ) {
125
+ jQuery(this).parents('.mb-list-entry-fields').find('.button-primary').attr('disabled', true);
126
+ jQuery(this).parents('.mb-list-entry-fields').find('.button-primary')[0].onclick = null;
127
+ }
128
+ });
129
+ }
130
+
131
+ /*
132
+ * Function that sends an ajax request to delete all items(fields) from a form
133
+ *
134
+ */
135
+ function wppb_rf_epf_delete_all_fields(event, delete_all_button_id, nonce) {
136
+ event.preventDefault();
137
+ $deleteButton = jQuery('#' + delete_all_button_id);
138
+
139
+ var response = confirm( "Are you sure you want to delete all items ?" );
140
+
141
+ if( response == true ) {
142
+ $tableParent = $deleteButton.parents('table');
143
+
144
+ var meta = $tableParent.attr('id').replace('container_', '');
145
+ var post_id = parseInt( $tableParent.attr('post') );
146
+
147
+ $tableParent.parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
148
+
149
+ jQuery.post( ajaxurl, { action: "wppb_rf_epf_delete_all_fields", meta: meta, id: post_id, _ajax_nonce: nonce }, function(response) {
150
+
151
+ /* refresh the list */
152
+ jQuery.post( wppbWckAjaxurl, { action: "wck_refresh_list"+meta, meta: meta, id: post_id}, function(response) {
153
+ jQuery('#container_'+meta).replaceWith(response);
154
+ $tableParent = jQuery('#container_'+meta);
155
+
156
+ $tableParent.find('tbody td').css('width', function(){ return jQuery(this).width() });
157
+
158
+ mb_sortable_elements();
159
+ $tableParent.parent().css('opacity','1');
160
+
161
+ jQuery('#mb-ajax-loading').remove();
162
+ });
163
+
164
+ });
165
+ }
166
  }
assets/js/jquery-manage-fields-live-change.js CHANGED
@@ -1,902 +1,902 @@
1
- var fields = {
2
- 'Default - Name (Heading)': { 'show_rows' : [
3
- '.row-field-title',
4
- '.row-description',
5
- ],
6
- 'properties': {
7
- 'meta_name_value' : ''
8
- }
9
- },
10
-
11
- 'Default - Contact Info (Heading)': { 'show_rows' : [
12
- '.row-field-title',
13
- '.row-description',
14
- ],
15
- 'properties': {
16
- 'meta_name_value' : ''
17
- }
18
- },
19
-
20
- 'Default - About Yourself (Heading)': { 'show_rows' : [
21
- '.row-field-title',
22
- '.row-description',
23
- ],
24
- 'properties': {
25
- 'meta_name_value' : ''
26
- }
27
- },
28
-
29
- 'Default - Username': { 'show_rows' : [
30
- '.row-field-title',
31
- '.row-description',
32
- '.row-default-value',
33
- '.row-required'
34
- ],
35
- 'properties': {
36
- 'meta_name_value' : ''
37
- },
38
- 'required' : [
39
- true
40
- ]
41
- },
42
-
43
- 'Default - First Name': { 'show_rows' : [
44
- '.row-field-title',
45
- '.row-meta-name',
46
- '.row-description',
47
- '.row-default-value',
48
- '.row-required'
49
- ],
50
- 'properties': {
51
- 'meta_name_value' : 'first_name'
52
- }
53
- },
54
-
55
- 'Default - Last Name': { 'show_rows' : [
56
- '.row-field-title',
57
- '.row-meta-name',
58
- '.row-description',
59
- '.row-default-value',
60
- '.row-required'
61
- ],
62
- 'properties': {
63
- 'meta_name_value' : 'last_name'
64
- }
65
- },
66
-
67
- 'Default - Nickname': { 'show_rows' : [
68
- '.row-field-title',
69
- '.row-meta-name',
70
- '.row-description',
71
- '.row-default-value',
72
- '.row-required'
73
- ],
74
- 'properties': {
75
- 'meta_name_value' : 'nickname'
76
- },
77
- 'required' : [
78
- true
79
- ]
80
- },
81
-
82
- 'Default - E-mail': { 'show_rows' : [
83
- '.row-field-title',
84
- '.row-description',
85
- '.row-default-value',
86
- '.row-required'
87
- ],
88
- 'properties': {
89
- 'meta_name_value' : ''
90
- },
91
- 'required' : [
92
- true
93
- ]
94
- },
95
-
96
- 'Default - Website': { 'show_rows' : [
97
- '.row-field-title',
98
- '.row-description',
99
- '.row-default-value',
100
- '.row-required'
101
- ],
102
- 'properties': {
103
- 'meta_name_value' : ''
104
- }
105
- },
106
-
107
- 'Default - AIM': { 'show_rows' : [
108
- '.row-field-title',
109
- '.row-meta-name',
110
- '.row-description',
111
- '.row-default-value',
112
- '.row-required'
113
- ],
114
- 'properties': {
115
- 'meta_name_value' : 'aim'
116
- }
117
- },
118
-
119
- 'Default - Yahoo IM': { 'show_rows' : [
120
- '.row-field-title',
121
- '.row-meta-name',
122
- '.row-description',
123
- '.row-default-value',
124
- '.row-required'
125
- ],
126
- 'properties': {
127
- 'meta_name_value' : 'yim'
128
- }
129
- },
130
-
131
- 'Default - Jabber / Google Talk': { 'show_rows' : [
132
- '.row-field-title',
133
- '.row-meta-name',
134
- '.row-description',
135
- '.row-default-value',
136
- '.row-required'
137
- ],
138
- 'properties': {
139
- 'meta_name_value' : 'jabber'
140
- }
141
- },
142
-
143
- 'Default - Password': { 'show_rows' : [
144
- '.row-field-title',
145
- '.row-description',
146
- '.row-required'
147
- ],
148
- 'properties': {
149
- 'meta_name_value' : ''
150
- },
151
- 'required' : [
152
- true
153
- ]
154
- },
155
-
156
- 'Default - Repeat Password': { 'show_rows' : [
157
- '.row-field-title',
158
- '.row-description',
159
- '.row-required'
160
- ],
161
- 'properties': {
162
- 'meta_name_value' : ''
163
- },
164
- 'required' : [
165
- true
166
- ]
167
- },
168
-
169
- 'Default - Biographical Info': { 'show_rows' : [
170
- '.row-field-title',
171
- '.row-meta-name',
172
- '.row-description',
173
- '.row-row-count',
174
- '.row-default-content',
175
- '.row-required'
176
- ],
177
- 'properties': {
178
- 'meta_name_value' : 'description'
179
- }
180
- },
181
-
182
- 'Default - Display name publicly as': { 'show_rows' : [
183
- '.row-field-title',
184
- '.row-description',
185
- '.row-default-value',
186
- '.row-required'
187
- ],
188
- 'properties': {
189
- 'meta_name_value' : ''
190
- }
191
- },
192
-
193
- 'Default - Blog Details': { 'show_rows' : [
194
- '.row-field-title',
195
- '.row-description'
196
- ],
197
- 'properties': {
198
- 'meta_name_value' : ''
199
- }
200
- },
201
-
202
- 'GDPR Checkbox': { 'show_rows' : [
203
- '.row-field-title',
204
- '.row-meta-name',
205
- '.row-description',
206
- '.row-required',
207
- '.row-overwrite-existing'
208
- ],
209
- 'properties': {
210
- 'meta_name_value' : 'user_consent_gdpr',
211
- 'field_title' : wppb_fields_strings.gdpr_title,
212
- 'description' : wppb_fields_strings.gdpr_description
213
- },
214
- 'required' : [
215
- true
216
- ]
217
- },
218
- 'GDPR Delete Button': { 'show_rows' : [
219
- '.row-field-title',
220
- '.row-description',
221
- ],
222
- 'properties': {
223
- 'meta_name_value' : ''
224
- }
225
- },
226
-
227
- 'Heading': { 'show_rows' : [
228
- '.row-field-title',
229
- '.row-description',
230
- '.row-heading-tag'
231
- ],
232
- 'properties': {
233
- 'meta_name_value' : ''
234
- }
235
- },
236
-
237
- 'Input': { 'show_rows' : [
238
- '.row-field-title',
239
- '.row-meta-name',
240
- '.row-description',
241
- '.row-default-value',
242
- '.row-required',
243
- '.row-overwrite-existing'
244
- ]
245
- },
246
-
247
- 'Email': { 'show_rows' : [
248
- '.row-field-title',
249
- '.row-meta-name',
250
- '.row-description',
251
- '.row-default-value',
252
- '.row-required',
253
- '.row-overwrite-existing'
254
- ]
255
- },
256
-
257
- 'URL': { 'show_rows' : [
258
- '.row-field-title',
259
- '.row-meta-name',
260
- '.row-description',
261
- '.row-default-value',
262
- '.row-required',
263
- '.row-overwrite-existing'
264
- ]
265
- },
266
-
267
- 'Number': { 'show_rows' : [
268
- '.row-field-title',
269
- '.row-meta-name',
270
- '.row-description',
271
- '.row-default-value',
272
- '.row-min-number-value',
273
- '.row-max-number-value',
274
- '.row-number-step-value',
275
- '.row-required',
276
- '.row-overwrite-existing'
277
- ]
278
- },
279
- 'Input (Hidden)': { 'show_rows' : [
280
- '.row-field-title',
281
- '.row-meta-name',
282
- '.row-description',
283
- '.row-default-value',
284
- '.row-overwrite-existing'
285
- ]
286
- },
287
-
288
- 'Textarea': { 'show_rows' : [
289
- '.row-field-title',
290
- '.row-meta-name',
291
- '.row-description',
292
- '.row-default-content',
293
- '.row-required',
294
- '.row-row-count',
295
- '.row-overwrite-existing'
296
- ]
297
- },
298
- 'WYSIWYG': { 'show_rows' : [
299
- '.row-field-title',
300
- '.row-meta-name',
301
- '.row-description',
302
- '.row-default-content',
303
- '.row-required',
304
- '.row-overwrite-existing'
305
- ]
306
- },
307
- 'Phone': { 'show_rows' : [
308
- '.row-field-title',
309
- '.row-meta-name',
310
- '.row-description',
311
- '.row-phone-format',
312
- '.row-required',
313
- '.row-overwrite-existing'
314
- ]
315
- },
316
- 'Select': { 'show_rows' : [
317
- '.row-field-title',
318
- '.row-meta-name',
319
- '.row-description',
320
- '.row-default-option',
321
- '.row-required',
322
- '.row-overwrite-existing',
323
- '.row-options',
324
- '.row-labels'
325
- ]
326
- },
327
- 'Select (Multiple)': { 'show_rows' : [
328
- '.row-field-title',
329
- '.row-meta-name',
330
- '.row-description',
331
- '.row-default-options',
332
- '.row-required',
333
- '.row-overwrite-existing',
334
- '.row-options',
335
- '.row-labels'
336
- ]
337
- },
338
-
339
- 'Select (Country)': { 'show_rows' : [
340
- '.row-field-title',
341
- '.row-meta-name',
342
- '.row-description',
343
- '.row-default-option-country',
344
- '.row-required',
345
- '.row-overwrite-existing'
346
- ]
347
- },
348
-
349
- 'Select (Currency)': { 'show_rows' : [
350
- '.row-field-title',
351
- '.row-meta-name',
352
- '.row-description',
353
- '.row-show-currency-symbol',
354
- '.row-default-option-currency',
355
- '.row-required',
356
- '.row-overwrite-existing'
357
- ]
358
- },
359
-
360
- 'Select (Timezone)': { 'show_rows' : [
361
- '.row-field-title',
362
- '.row-meta-name',
363
- '.row-description',
364
- '.row-default-option-timezone',
365
- '.row-required',
366
- '.row-overwrite-existing'
367
- ]
368
- },
369
- 'Select (CPT)': { 'show_rows' : [
370
- '.row-field-title',
371
- '.row-meta-name',
372
- '.row-description',
373
- '.row-default-option',
374
- '.row-cpt',
375
- '.row-required',
376
- '.row-overwrite-existing'
377
- ]
378
- },
379
-
380
- 'Checkbox': { 'show_rows' : [
381
- '.row-field-title',
382
- '.row-meta-name',
383
- '.row-description',
384
- '.row-default-options',
385
- '.row-required',
386
- '.row-overwrite-existing',
387
- '.row-options',
388
- '.row-labels'
389
- ]
390
- },
391
-
392
- 'Checkbox (Terms and Conditions)': { 'show_rows' : [
393
- '.row-field-title',
394
- '.row-meta-name',
395
- '.row-description',
396
- '.row-required',
397
- '.row-overwrite-existing'
398
- ],
399
- 'required' : [
400
- true
401
- ]
402
- },
403
-
404
- 'Radio': { 'show_rows' : [
405
- '.row-field-title',
406
- '.row-meta-name',
407
- '.row-description',
408
- '.row-default-option',
409
- '.row-required',
410
- '.row-overwrite-existing',
411
- '.row-options',
412
- '.row-labels'
413
- ]
414
- },
415
-
416
- 'Upload': { 'show_rows' : [
417
- '.row-field-title',
418
- '.row-meta-name',
419
- '.row-description',
420
- '.row-allowed-extensions',
421
- '.row-required',
422
- '.row-allowed-upload-extensions'
423
- ]
424
- },
425
-
426
- 'Avatar': { 'show_rows' : [
427
- '.row-field-title',
428
- '.row-meta-name',
429
- '.row-description',
430
- '.row-allowed-image-extensions',
431
- '.row-avatar-size',
432
- '.row-required',
433
- '.row-overwrite-existing'
434
- ]
435
- },
436
-
437
- 'Datepicker': { 'show_rows' : [
438
- '.row-field-title',
439
- '.row-meta-name',
440
- '.row-description',
441
- '.row-default-value',
442
- '.row-required',
443
- '.row-date-format',
444
- '.row-overwrite-existing'
445
- ]
446
- },
447
-
448
-
449
- 'Timepicker': { 'show_rows' : [
450
- '.row-field-title',
451
- '.row-meta-name',
452
- '.row-description',
453
- '.row-required',
454
- '.row-time-format',
455
- '.row-overwrite-existing'
456
- ]
457
- },
458
-
459
- 'Colorpicker': { 'show_rows' : [
460
- '.row-field-title',
461
- '.row-meta-name',
462
- '.row-description',
463
- '.row-required',
464
- '.row-overwrite-existing'
465
- ]
466
- },
467
-
468
-
469
- 'Validation': { 'show_rows' : [
470
- '.row-field-title',
471
- '.row-meta-name',
472
- '.row-description',
473
- '.row-validation-possible-values',
474
- '.row-custom-error-message',
475
- '.row-required'
476
- ],
477
- 'required' : [
478
- true
479
- ]
480
- },
481
-
482
- 'reCAPTCHA': { 'show_rows' : [
483
- '.row-field-title',
484
- '.row-description',
485
- '.row-recaptcha-type',
486
- '.row-public-key',
487
- '.row-private-key',
488
- '.row-captcha-pb-forms',
489
- '.row-captcha-wp-forms',
490
- '.row-required'
491
- ],
492
- 'required' : [
493
- true
494
- ],
495
- 'properties': {
496
- 'meta_name_value' : ''
497
- }
498
- },
499
-
500
- 'Select (User Role)': { 'show_rows' : [
501
- '.row-field-title',
502
- '.row-description',
503
- '.row-user-roles',
504
- '.row-required'
505
- ],
506
- 'properties': {
507
- 'meta_name_value' : ''
508
- }
509
- },
510
-
511
- 'Map': { 'show_rows' : [
512
- '.row-field-title',
513
- '.row-meta-name',
514
- '.row-description',
515
- '.row-map-api-key',
516
- '.row-map-default-lat',
517
- '.row-map-default-lng',
518
- '.row-map-default-zoom',
519
- '.row-map-height',
520
- '.row-map-pins-load-type',
521
- '.row-map-pagination-number',
522
- '.row-map-bubble-fields',
523
- '.row-required'
524
- ]
525
- },
526
- 'HTML': { 'show_rows' : [
527
- '.row-field-title',
528
- '.row-description',
529
- '.row-html-content'
530
- ],
531
- 'properties': {
532
- 'meta_name_value' : ''
533
- }
534
- }
535
- }
536
- var fields_to_show = [
537
- '.row-field-title',
538
- '.row-field',
539
- '.row-meta-name',
540
- '.row-required'
541
- ]
542
-
543
- function wppb_hide_properties_for_already_added_fields( container_name ){
544
-
545
- jQuery( container_name + ' tr:not(.update_container_wppb_manage_fields)' ).each(function() {
546
-
547
- field = jQuery('.row-field pre', this).text();
548
-
549
- jQuery( 'li', this ).each(function() {
550
- var class_name = '';
551
-
552
- class_name = jQuery(this).attr('class');
553
- jQuery(this).hide();
554
-
555
- if ( ( field in fields ) ){
556
- var to_show = fields[field]['show_rows'];
557
- for (var key in to_show) {
558
- if ('.'+class_name == fields_to_show[key]){
559
- jQuery(this).show();
560
- }
561
- }
562
- }
563
-
564
- });
565
- });
566
-
567
- /* hide the delete button for username,password and email fields */
568
- jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line
569
- }
570
-
571
-
572
-
573
- function wppb_hide_all ( container_name ){
574
- jQuery( container_name + ' ' + '.mb-list-entry-fields > li' ).each(function() {
575
- if ( !( ( jQuery(this).hasClass('row-field') ) || ( jQuery(this).children().hasClass('button-primary') ) ) ){
576
- jQuery(this).hide();
577
- }
578
- });
579
-
580
- jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).attr( 'disabled', true );
581
-
582
- jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line
583
- jQuery( container_name + ' ' + '.element_type_default-e-mail #field' + ', ' + container_name + ' ' + '.element_type_default-password #field' + ', ' + container_name + ' ' + '.element_type_default-username #field' + ', ' + container_name + ' ' + '.element_type_default-e-mail #required' + ', ' + container_name + ' ' + '.element_type_default-password #required,' + container_name + ' ' + '.element_type_default-username #required,' + container_name + ' ' + '.element_type_checkbox-terms-and-conditions #required,' + container_name + ' ' + '.element_type_recaptcha #required,' + container_name + ' ' + '.element_type_woocommerce-customer-billing-address #field, ' + container_name + ' ' + '.element_type_woocommerce-customer-shipping-address #field').attr( 'disabled', true ); // PB specific line
584
-
585
- }
586
-
587
-
588
- function wppb_disable_add_entry_button( container_name ){
589
- jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).each( function(){
590
-
591
- //jQuery(this).data('myclick', this.onclick );
592
- this.onclick = function(event) {
593
- if ( jQuery(this).attr( 'disabled' ) ) {
594
- return false;
595
- }
596
- /* changed this in version 2.5.0 because the commented line generated stack exceeded error when multiple fields were opened with edit */
597
- if ( typeof( event.currentTarget ) == 'undefined' ){
598
- // Repeater field triggered the click event of the "Add Field" / "Save changes" buttons, so the onclick attribute is in the target, not currentTarget
599
- eval(event.target.getAttribute('onclick'));
600
- }else {
601
- // normal Manage Fields Add Field button press
602
- eval(event.currentTarget.getAttribute('onclick'));
603
- }
604
-
605
- //jQuery(this).data('myclick').call(this, event || window.event);
606
- };
607
- });
608
-
609
- }
610
-
611
-
612
- function wppb_edit_form_properties( container_name, element_id ){
613
- wppb_hide_all ( container_name );
614
- wppb_disable_add_entry_button ( container_name );
615
-
616
- field = jQuery( container_name + ' #' + element_id + ' ' + '#field' ).val();
617
-
618
- if ( ( field in fields ) ){
619
- var to_show = fields[jQuery.trim(field)]['show_rows'];
620
- for (var key in to_show)
621
- jQuery( container_name + ' #' + element_id + ' ' + to_show[key] ).show();
622
-
623
- var properties = fields[ jQuery.trim(field) ]['properties'];
624
- if( typeof properties !== 'undefined' && properties ) {
625
- for( var key in properties ) {
626
- if( typeof properties['meta_name_value'] !== 'undefined' ) {
627
- jQuery( container_name + ' ' + '#meta-name').attr( 'readonly', true );
628
- }
629
- }
630
- }
631
-
632
- jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' );
633
-
634
- //Handle user role sorting
635
- wppb_handle_user_role_field( container_name );
636
- }
637
- }
638
-
639
-
640
- function wppb_display_needed_fields( index, container_name, current_field_select ){
641
- var show_rows = fields[jQuery.trim(index)]['show_rows'];
642
- for (var key in show_rows) {
643
- jQuery( show_rows[key], jQuery( current_field_select ).parents( '.mb-list-entry-fields' ) ).show();
644
- }
645
-
646
- var properties = fields[jQuery.trim(index)]['properties'];
647
- if ( ( ( typeof properties !== 'undefined' ) && ( properties ) ) ) { //the extra (second) condition is a particular case since only the username is defined in our global array that has no meta-name
648
- for (var key in properties) {
649
- if ( ( typeof properties['meta_name_value'] !== 'undefined' ) ){
650
- jQuery( container_name + ' ' + '#meta-name' ).val( properties['meta_name_value'] );
651
- jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', true );
652
- }
653
- if ( ( typeof properties['field_title'] !== 'undefined' ) ){
654
- jQuery( container_name + ' ' + '#field-title' ).val( properties['field_title'] );
655
- }
656
- if ( ( typeof properties['description'] !== 'undefined' ) ){
657
- jQuery( container_name + ' ' + '#description' ).val( properties['description'] );
658
- }
659
- }
660
-
661
- }else{
662
- /* meta value when editing a field shouldn't change so we take it from the current entered value which is displayed above the edit form */
663
- if( jQuery( current_field_select).parents('.update_container_wppb_manage_fields').length != 0 ){
664
- meta_value = jQuery( '.row-meta-name pre', jQuery( current_field_select).parents( '.update_container_wppb_manage_fields' ).prev() ).text();
665
- }
666
- /* for the add form it should change */
667
- else{
668
-
669
- // Repeater fields have different meta name prefixes, stored in the GET parameter 'wppb_field_metaname_prefix'.
670
- var get_parameter_prefix = wppb_get_parameter_by_name( 'wppb_field_metaname_prefix' );
671
- var field_metaname_prefix = ( get_parameter_prefix == null ) ? 'custom_field' : get_parameter_prefix;
672
-
673
- numbers = new Array();
674
- jQuery( '#container_wppb_manage_fields .row-meta-name pre').each(function(){
675
- meta_name = jQuery(this).text();
676
- if( meta_name.indexOf( field_metaname_prefix ) !== -1 ){
677
- var meta_name = meta_name.replace(field_metaname_prefix, '' );
678
- /* we should have an underscore present in custom_field_# so remove it */
679
- meta_name = meta_name.replace('_', '' );
680
-
681
- if( isNaN( meta_name ) ){
682
- meta_name = Math.floor((Math.random() * 200) + 100);
683
- }
684
- numbers.push( parseInt(meta_name) );
685
- }
686
-
687
- });
688
- if( numbers.length > 0 ){
689
- numbers.sort( function(a, b){return a-b} );
690
- numbers.reverse();
691
- meta_number = parseInt(numbers[0])+1;
692
- }
693
- else
694
- meta_number = 1;
695
-
696
- meta_value = field_metaname_prefix + '_' + meta_number;
697
- }
698
-
699
- jQuery( container_name + ' ' + '#meta-name' ).val( meta_value );
700
- jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', false );
701
- }
702
-
703
- //Handle user role sorting
704
- wppb_handle_user_role_field( container_name );
705
-
706
- var set_required = fields[jQuery.trim(index)]['required'];
707
- if ( ( typeof set_required !== 'undefined' ) && ( set_required ) ){
708
- jQuery( container_name + ' ' + '#required' ).val( 'Yes' );
709
- jQuery( container_name + ' ' + '#required' ).attr( 'disabled', true );
710
-
711
- }else{
712
- jQuery( container_name + ' ' + '#required' ).val( 'No' );
713
- jQuery( container_name + ' ' + '#required' ).attr( 'disabled', false );
714
- }
715
-
716
- jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' );
717
- }
718
-
719
-
720
- function wppb_get_parameter_by_name(name, url) {
721
- if (!url) url = window.location.href;
722
- name = name.replace(/[\[\]]/g, "\\$&");
723
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
724
- results = regex.exec(url);
725
- if (!results) return null;
726
- if (!results[2]) return null;
727
- return decodeURIComponent(results[2].replace(/\+/g, " "));
728
- }
729
-
730
- /*
731
- * Function that handles the sorting of the user roles from the Select (User Role)
732
- * extra field
733
- *
734
- */
735
- function wppb_handle_user_role_field( container_name ) {
736
-
737
- jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').sortable({
738
-
739
- //Assign a custom handle for the drag and drop
740
- handle: '.sortable-handle',
741
-
742
- create: function( event, ui ) {
743
-
744
- //Add the custom handle for drag and drop
745
- jQuery(this).find('div').each( function() {
746
- jQuery(this).prepend('<span class="sortable-handle"></span>');
747
- });
748
-
749
- $sortOrderInput = jQuery(this).parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]');
750
-
751
- if( $sortOrderInput.val() == '' ) {
752
- jQuery(this).find('input[type=checkbox]').each( function() {
753
- $sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() );
754
- });
755
- } else {
756
- sortOrderElements = $sortOrderInput.val().split(', ');
757
- sortOrderElements.shift();
758
-
759
- for( var i=0; i < sortOrderElements.length; i++ ) {
760
- jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').append( jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes input[value="' + sortOrderElements[i] + '"]').parent().parent().get(0) );
761
- }
762
- }
763
- },
764
-
765
- update: function( event, ui ) {
766
- $sortOrderInput = ui.item.parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]');
767
- $sortOrderInput.val('');
768
-
769
- ui.item.parent().find('input[type=checkbox]').each( function() {
770
- $sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() );
771
- });
772
- }
773
- });
774
- }
775
-
776
- function wppb_initialize_live_select( container_name ){
777
- wppb_hide_all( container_name );
778
- jQuery(document).on( 'change', container_name + ' ' + '.mb-list-entry-fields #field', function () {
779
- field = jQuery(this).val();
780
-
781
- if ( field != ''){
782
- wppb_hide_all( container_name );
783
- wppb_display_needed_fields( field, container_name, this );
784
- }else{
785
- wppb_hide_all( container_name );
786
- }
787
- });
788
- }
789
-
790
-
791
- function wppb_enable_select2(container_name){
792
- // Select2 initialization on manage fields.
793
-
794
- jQuery( container_name + ' #field').select2({
795
- placeholder: 'Select an option',
796
- allowClear: true
797
- })
798
-
799
- var $eventSelect = jQuery( container_name + ' #field');
800
- $eventSelect.on("select2:open", function (e) {
801
- jQuery('#wppb_select2_overlay').fadeIn('100')
802
- });
803
- $eventSelect.on("select2:close", function (e) {
804
- jQuery('#wppb_select2_overlay').hide();
805
- });
806
- }
807
-
808
-
809
- jQuery(function(){
810
- wppb_initialize_live_select ( '#wppb_manage_fields' );
811
- wppb_initialize_live_select ( '#container_wppb_manage_fields' );
812
-
813
- wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' );
814
- wppb_disable_add_entry_button ( '#wppb_manage_fields' );
815
-
816
- var overlay = jQuery('<div id="wppb_select2_overlay"> </div>')
817
- overlay.appendTo(document.body)
818
-
819
- wppb_enable_select2('#wppb_manage_fields');
820
-
821
- });
822
-
823
- // Custom functionality for sorting options (see the Map POIs attributes).
824
- (function ($) {
825
- window.SortSelCheck = {
826
- // Initiate the events and triggers.
827
- init: function () {
828
- SortSelCheck.assess();
829
- SortSelCheck.listen();
830
- },
831
-
832
- // Listen for events.
833
- listen: function () {
834
- // Listen for the new element setup and trigger the expected custom event.
835
- $('.wck-add-form').on('change', function() {
836
- SortSelCheck.assess('wck-add-form');
837
- });
838
- },
839
-
840
- // Assess the potential elements and configure these when possible.
841
- assess: function (elem) {
842
- var $elem = $('.wppb_sortable_checkboxes_wrap');
843
- // console.log('assess triggerer ' + elem, $elem);
844
- $elem.each(function() {
845
- $rows = SortSelCheck.remake($(this));
846
- SortSelCheck.attach($(this), $rows);
847
- });
848
- },
849
-
850
- // Configure the elements that form the sortable checkboxes options.
851
- remake: function ($field) {
852
- var $rows = $field.children('.wck-checkboxes');
853
- if (!$rows.length) {
854
- $field.prepend('<div class="wck-checkboxes"> </div>');
855
- var $rows = $field.children('.wck-checkboxes');
856
- }
857
- if ($rows.length) {
858
- SortSelCheck.sortable($rows);
859
- }
860
- return $rows;
861
- },
862
-
863
- // Attach the custom dropdown options as sortable checkboxes options.
864
- attach: function ($field, $rows) {
865
- var $ddwn = $field.children('.wppb_selector_for_sortable_checkbox');
866
- if ($ddwn.length) {
867
- $ddwn.on('change', function() {
868
- var val = $(this).val();
869
- if ('' !== val) {
870
- $rows.append('<div><label><input type="checkbox" name="' + $(this).data('list') + '" id="' + $(this).data('list') + '_' + val + '" value="' + val + '" checked="checked" class="mb-checkbox mb-field">' + $(this).children('option').filter(':selected').text() + '</label></div>');
871
- $(this).children('option').filter(':selected').remove();
872
- SortSelCheck.sortable($rows);
873
- }
874
- });
875
- }
876
- },
877
-
878
- // Make sortable items from the list.
879
- sortable: function ($list) {
880
- var $items = $list.children('div');
881
- $items.addClass('wppb_manage_fields_sortables');
882
- $items.remove('em');
883
- $items.prepend('<em class="dashicons dashicons-menu"></em> ');
884
- $list.sortable({
885
- items: '> div',
886
- classes: {'ui-sortable': 'highlight'}
887
- });
888
- },
889
-
890
- };
891
-
892
- $(document).ready(function () {
893
- // Initialize the custom functionality.
894
- SortSelCheck.init('init');
895
-
896
- // Bind the event to the custom functionality.
897
- $('html').on('wpbFormMetaLoaded', function(e, elem) {
898
- SortSelCheck.assess(elem);
899
- });
900
- });
901
-
902
- })(jQuery);
1
+ var fields = {
2
+ 'Default - Name (Heading)': { 'show_rows' : [
3
+ '.row-field-title',
4
+ '.row-description',
5
+ ],
6
+ 'properties': {
7
+ 'meta_name_value' : ''
8
+ }
9
+ },
10
+
11
+ 'Default - Contact Info (Heading)': { 'show_rows' : [
12
+ '.row-field-title',
13
+ '.row-description',
14
+ ],
15
+ 'properties': {
16
+ 'meta_name_value' : ''
17
+ }
18
+ },
19
+
20
+ 'Default - About Yourself (Heading)': { 'show_rows' : [
21
+ '.row-field-title',
22
+ '.row-description',
23
+ ],
24
+ 'properties': {
25
+ 'meta_name_value' : ''
26
+ }
27
+ },
28
+
29
+ 'Default - Username': { 'show_rows' : [
30
+ '.row-field-title',
31
+ '.row-description',
32
+ '.row-default-value',
33
+ '.row-required'
34
+ ],
35
+ 'properties': {
36
+ 'meta_name_value' : ''
37
+ },
38
+ 'required' : [
39
+ true
40
+ ]
41
+ },
42
+
43
+ 'Default - First Name': { 'show_rows' : [
44
+ '.row-field-title',
45
+ '.row-meta-name',
46
+ '.row-description',
47
+ '.row-default-value',
48
+ '.row-required'
49
+ ],
50
+ 'properties': {
51
+ 'meta_name_value' : 'first_name'
52
+ }
53
+ },
54
+
55
+ 'Default - Last Name': { 'show_rows' : [
56
+ '.row-field-title',
57
+ '.row-meta-name',
58
+ '.row-description',
59
+ '.row-default-value',
60
+ '.row-required'
61
+ ],
62
+ 'properties': {
63
+ 'meta_name_value' : 'last_name'
64
+ }
65
+ },
66
+
67
+ 'Default - Nickname': { 'show_rows' : [
68
+ '.row-field-title',
69
+ '.row-meta-name',
70
+ '.row-description',
71
+ '.row-default-value',
72
+ '.row-required'
73
+ ],
74
+ 'properties': {
75
+ 'meta_name_value' : 'nickname'
76
+ },
77
+ 'required' : [
78
+ true
79
+ ]
80
+ },
81
+
82
+ 'Default - E-mail': { 'show_rows' : [
83
+ '.row-field-title',
84
+ '.row-description',
85
+ '.row-default-value',
86
+ '.row-required'
87
+ ],
88
+ 'properties': {
89
+ 'meta_name_value' : ''
90
+ },
91
+ 'required' : [
92
+ true
93
+ ]
94
+ },
95
+
96
+ 'Default - Website': { 'show_rows' : [
97
+ '.row-field-title',
98
+ '.row-description',
99
+ '.row-default-value',
100
+ '.row-required'
101
+ ],
102
+ 'properties': {
103
+ 'meta_name_value' : ''
104
+ }
105
+ },
106
+
107
+ 'Default - AIM': { 'show_rows' : [
108
+ '.row-field-title',
109
+ '.row-meta-name',
110
+ '.row-description',
111
+ '.row-default-value',
112
+ '.row-required'
113
+ ],
114
+ 'properties': {
115
+ 'meta_name_value' : 'aim'
116
+ }
117
+ },
118
+
119
+ 'Default - Yahoo IM': { 'show_rows' : [
120
+ '.row-field-title',
121
+ '.row-meta-name',
122
+ '.row-description',
123
+ '.row-default-value',
124
+ '.row-required'
125
+ ],
126
+ 'properties': {
127
+ 'meta_name_value' : 'yim'
128
+ }
129
+ },
130
+
131
+ 'Default - Jabber / Google Talk': { 'show_rows' : [
132
+ '.row-field-title',
133
+ '.row-meta-name',
134
+ '.row-description',
135
+ '.row-default-value',
136
+ '.row-required'
137
+ ],
138
+ 'properties': {
139
+ 'meta_name_value' : 'jabber'
140
+ }
141
+ },
142
+
143
+ 'Default - Password': { 'show_rows' : [
144
+ '.row-field-title',
145
+ '.row-description',
146
+ '.row-required'
147
+ ],
148
+ 'properties': {
149
+ 'meta_name_value' : ''
150
+ },
151
+ 'required' : [
152
+ true
153
+ ]
154
+ },
155
+
156
+ 'Default - Repeat Password': { 'show_rows' : [
157
+ '.row-field-title',
158
+ '.row-description',
159
+ '.row-required'
160
+ ],
161
+ 'properties': {
162
+ 'meta_name_value' : ''
163
+ },
164
+ 'required' : [
165
+ true
166
+ ]
167
+ },
168
+
169
+ 'Default - Biographical Info': { 'show_rows' : [
170
+ '.row-field-title',
171
+ '.row-meta-name',
172
+ '.row-description',
173
+ '.row-row-count',
174
+ '.row-default-content',
175
+ '.row-required'
176
+ ],
177
+ 'properties': {
178
+ 'meta_name_value' : 'description'
179
+ }
180
+ },
181
+
182
+ 'Default - Display name publicly as': { 'show_rows' : [
183
+ '.row-field-title',
184
+ '.row-description',
185
+ '.row-default-value',
186
+ '.row-required'
187
+ ],
188
+ 'properties': {
189
+ 'meta_name_value' : ''
190
+ }
191
+ },
192
+
193
+ 'Default - Blog Details': { 'show_rows' : [
194
+ '.row-field-title',
195
+ '.row-description'
196
+ ],
197
+ 'properties': {
198
+ 'meta_name_value' : ''
199
+ }
200
+ },
201
+
202
+ 'GDPR Checkbox': { 'show_rows' : [
203
+ '.row-field-title',
204
+ '.row-meta-name',
205
+ '.row-description',
206
+ '.row-required',
207
+ '.row-overwrite-existing'
208
+ ],
209
+ 'properties': {
210
+ 'meta_name_value' : 'user_consent_gdpr',
211
+ 'field_title' : wppb_fields_strings.gdpr_title,
212
+ 'description' : wppb_fields_strings.gdpr_description
213
+ },
214
+ 'required' : [
215
+ true
216
+ ]
217
+ },
218
+ 'GDPR Delete Button': { 'show_rows' : [
219
+ '.row-field-title',
220
+ '.row-description',
221
+ ],
222
+ 'properties': {
223
+ 'meta_name_value' : ''
224
+ }
225
+ },
226
+
227
+ 'Heading': { 'show_rows' : [
228
+ '.row-field-title',
229
+ '.row-description',
230
+ '.row-heading-tag'
231
+ ],
232
+ 'properties': {
233
+ 'meta_name_value' : ''
234
+ }
235
+ },
236
+
237
+ 'Input': { 'show_rows' : [
238
+ '.row-field-title',
239
+ '.row-meta-name',
240
+ '.row-description',
241
+ '.row-default-value',
242
+ '.row-required',
243
+ '.row-overwrite-existing'
244
+ ]
245
+ },
246
+
247
+ 'Email': { 'show_rows' : [
248
+ '.row-field-title',
249
+ '.row-meta-name',
250
+ '.row-description',
251
+ '.row-default-value',
252
+ '.row-required',
253
+ '.row-overwrite-existing'
254
+ ]
255
+ },
256
+
257
+ 'URL': { 'show_rows' : [
258
+ '.row-field-title',
259
+ '.row-meta-name',
260
+ '.row-description',
261
+ '.row-default-value',
262
+ '.row-required',
263
+ '.row-overwrite-existing'
264
+ ]
265
+ },
266
+
267
+ 'Number': { 'show_rows' : [
268
+ '.row-field-title',
269
+ '.row-meta-name',
270
+ '.row-description',
271
+ '.row-default-value',
272
+ '.row-min-number-value',
273
+ '.row-max-number-value',
274
+ '.row-number-step-value',
275
+ '.row-required',
276
+ '.row-overwrite-existing'
277
+ ]
278
+ },
279
+ 'Input (Hidden)': { 'show_rows' : [
280
+ '.row-field-title',
281
+ '.row-meta-name',
282
+ '.row-description',
283
+ '.row-default-value',
284
+ '.row-overwrite-existing'
285
+ ]
286
+ },
287
+
288
+ 'Textarea': { 'show_rows' : [
289
+ '.row-field-title',
290
+ '.row-meta-name',
291
+ '.row-description',
292
+ '.row-default-content',
293
+ '.row-required',
294
+ '.row-row-count',
295
+ '.row-overwrite-existing'
296
+ ]
297
+ },
298
+ 'WYSIWYG': { 'show_rows' : [
299
+ '.row-field-title',
300
+ '.row-meta-name',
301
+ '.row-description',
302
+ '.row-default-content',
303
+ '.row-required',
304
+ '.row-overwrite-existing'
305
+ ]
306
+ },
307
+ 'Phone': { 'show_rows' : [
308
+ '.row-field-title',
309
+ '.row-meta-name',
310
+ '.row-description',
311
+ '.row-phone-format',
312
+ '.row-required',
313
+ '.row-overwrite-existing'
314
+ ]
315
+ },
316
+ 'Select': { 'show_rows' : [
317
+ '.row-field-title',
318
+ '.row-meta-name',
319
+ '.row-description',
320
+ '.row-default-option',
321
+ '.row-required',
322
+ '.row-overwrite-existing',
323
+ '.row-options',
324
+ '.row-labels'
325
+ ]
326
+ },
327
+ 'Select (Multiple)': { 'show_rows' : [
328
+ '.row-field-title',
329
+ '.row-meta-name',
330
+ '.row-description',
331
+ '.row-default-options',
332
+ '.row-required',
333
+ '.row-overwrite-existing',
334
+ '.row-options',
335
+ '.row-labels'
336
+ ]
337
+ },
338
+
339
+ 'Select (Country)': { 'show_rows' : [
340
+ '.row-field-title',
341
+ '.row-meta-name',
342
+ '.row-description',
343
+ '.row-default-option-country',
344
+ '.row-required',
345
+ '.row-overwrite-existing'
346
+ ]
347
+ },
348
+
349
+ 'Select (Currency)': { 'show_rows' : [
350
+ '.row-field-title',
351
+ '.row-meta-name',
352
+ '.row-description',
353
+ '.row-show-currency-symbol',
354
+ '.row-default-option-currency',
355
+ '.row-required',
356
+ '.row-overwrite-existing'
357
+ ]
358
+ },
359
+
360
+ 'Select (Timezone)': { 'show_rows' : [
361
+ '.row-field-title',
362
+ '.row-meta-name',
363
+ '.row-description',
364
+ '.row-default-option-timezone',
365
+ '.row-required',
366
+ '.row-overwrite-existing'
367
+ ]
368
+ },
369
+ 'Select (CPT)': { 'show_rows' : [
370
+ '.row-field-title',
371
+ '.row-meta-name',
372
+ '.row-description',
373
+ '.row-default-option',
374
+ '.row-cpt',
375
+ '.row-required',
376
+ '.row-overwrite-existing'
377
+ ]
378
+ },
379
+
380
+ 'Checkbox': { 'show_rows' : [
381
+ '.row-field-title',
382
+ '.row-meta-name',
383
+ '.row-description',
384
+ '.row-default-options',
385
+ '.row-required',
386
+ '.row-overwrite-existing',
387
+ '.row-options',
388
+ '.row-labels'
389
+ ]
390
+ },
391
+
392
+ 'Checkbox (Terms and Conditions)': { 'show_rows' : [
393
+ '.row-field-title',
394
+ '.row-meta-name',
395
+ '.row-description',
396
+ '.row-required',
397
+ '.row-overwrite-existing'
398
+ ],
399
+ 'required' : [
400
+ true
401
+ ]
402
+ },
403
+
404
+ 'Radio': { 'show_rows' : [
405
+ '.row-field-title',
406
+ '.row-meta-name',
407
+ '.row-description',
408
+ '.row-default-option',
409
+ '.row-required',
410
+ '.row-overwrite-existing',
411
+ '.row-options',
412
+ '.row-labels'
413
+ ]
414
+ },
415
+
416
+ 'Upload': { 'show_rows' : [
417
+ '.row-field-title',
418
+ '.row-meta-name',
419
+ '.row-description',
420
+ '.row-allowed-extensions',
421
+ '.row-required',
422
+ '.row-allowed-upload-extensions'
423
+ ]
424
+ },
425
+
426
+ 'Avatar': { 'show_rows' : [
427
+ '.row-field-title',
428
+ '.row-meta-name',
429
+ '.row-description',
430
+ '.row-allowed-image-extensions',
431
+ '.row-avatar-size',
432
+ '.row-required',
433
+ '.row-overwrite-existing'
434
+ ]
435
+ },
436
+
437
+ 'Datepicker': { 'show_rows' : [
438
+ '.row-field-title',
439
+ '.row-meta-name',
440
+ '.row-description',
441
+ '.row-default-value',
442
+ '.row-required',
443
+ '.row-date-format',
444
+ '.row-overwrite-existing'
445
+ ]
446
+ },
447
+
448
+
449
+ 'Timepicker': { 'show_rows' : [
450
+ '.row-field-title',
451
+ '.row-meta-name',
452
+ '.row-description',
453
+ '.row-required',
454
+ '.row-time-format',
455
+ '.row-overwrite-existing'
456
+ ]
457
+ },
458
+
459
+ 'Colorpicker': { 'show_rows' : [
460
+ '.row-field-title',
461
+ '.row-meta-name',
462
+ '.row-description',
463
+ '.row-required',
464
+ '.row-overwrite-existing'
465
+ ]
466
+ },
467
+
468
+
469
+ 'Validation': { 'show_rows' : [
470
+ '.row-field-title',
471
+ '.row-meta-name',
472
+ '.row-description',
473
+ '.row-validation-possible-values',
474
+ '.row-custom-error-message',
475
+ '.row-required'
476
+ ],
477
+ 'required' : [
478
+ true
479
+ ]
480
+ },
481
+
482
+ 'reCAPTCHA': { 'show_rows' : [
483
+ '.row-field-title',
484
+ '.row-description',
485
+ '.row-recaptcha-type',
486
+ '.row-public-key',
487
+ '.row-private-key',
488
+ '.row-captcha-pb-forms',
489
+ '.row-captcha-wp-forms',
490
+ '.row-required'
491
+ ],
492
+ 'required' : [
493
+ true
494
+ ],
495
+ 'properties': {
496
+ 'meta_name_value' : ''
497
+ }
498
+ },
499
+
500
+ 'Select (User Role)': { 'show_rows' : [
501
+ '.row-field-title',
502
+ '.row-description',
503
+ '.row-user-roles',
504
+ '.row-required'
505
+ ],
506
+ 'properties': {
507
+ 'meta_name_value' : ''
508
+ }
509
+ },
510
+
511
+ 'Map': { 'show_rows' : [
512
+ '.row-field-title',
513
+ '.row-meta-name',
514
+ '.row-description',
515
+ '.row-map-api-key',
516
+ '.row-map-default-lat',
517
+ '.row-map-default-lng',
518
+ '.row-map-default-zoom',
519
+ '.row-map-height',
520
+ '.row-map-pins-load-type',
521
+ '.row-map-pagination-number',
522
+ '.row-map-bubble-fields',
523
+ '.row-required'
524
+ ]
525
+ },
526
+ 'HTML': { 'show_rows' : [
527
+ '.row-field-title',
528
+ '.row-description',
529
+ '.row-html-content'
530
+ ],
531
+ 'properties': {
532
+ 'meta_name_value' : ''
533
+ }
534
+ }
535
+ }
536
+ var fields_to_show = [
537
+ '.row-field-title',
538
+ '.row-field',
539
+ '.row-meta-name',
540
+ '.row-required'
541
+ ]
542
+
543
+ function wppb_hide_properties_for_already_added_fields( container_name ){
544
+
545
+ jQuery( container_name + ' tr:not(.update_container_wppb_manage_fields)' ).each(function() {
546
+
547
+ field = jQuery('.row-field pre', this).text();
548
+
549
+ jQuery( 'li', this ).each(function() {
550
+ var class_name = '';
551
+
552
+ class_name = jQuery(this).attr('class');
553
+ jQuery(this).hide();
554
+
555
+ if ( ( field in fields ) ){
556
+ var to_show = fields[field]['show_rows'];
557
+ for (var key in to_show) {
558
+ if ('.'+class_name == fields_to_show[key]){
559
+ jQuery(this).show();
560
+ }
561
+ }
562
+ }
563
+
564
+ });
565
+ });
566
+
567
+ /* hide the delete button for username,password and email fields */
568
+ jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line
569
+ }
570
+
571
+
572
+
573
+ function wppb_hide_all ( container_name ){
574
+ jQuery( container_name + ' ' + '.mb-list-entry-fields > li' ).each(function() {
575
+ if ( !( ( jQuery(this).hasClass('row-field') ) || ( jQuery(this).children().hasClass('button-primary') ) ) ){
576
+ jQuery(this).hide();
577
+ }
578
+ });
579
+
580
+ jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).attr( 'disabled', true );
581
+
582
+ jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line
583
+ jQuery( container_name + ' ' + '.element_type_default-e-mail #field' + ', ' + container_name + ' ' + '.element_type_default-password #field' + ', ' + container_name + ' ' + '.element_type_default-username #field' + ', ' + container_name + ' ' + '.element_type_default-e-mail #required' + ', ' + container_name + ' ' + '.element_type_default-password #required,' + container_name + ' ' + '.element_type_default-username #required,' + container_name + ' ' + '.element_type_checkbox-terms-and-conditions #required,' + container_name + ' ' + '.element_type_recaptcha #required,' + container_name + ' ' + '.element_type_woocommerce-customer-billing-address #field, ' + container_name + ' ' + '.element_type_woocommerce-customer-shipping-address #field').attr( 'disabled', true ); // PB specific line
584
+
585
+ }
586
+
587
+
588
+ function wppb_disable_add_entry_button( container_name ){
589
+ jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).each( function(){
590
+
591
+ //jQuery(this).data('myclick', this.onclick );
592
+ this.onclick = function(event) {
593
+ if ( jQuery(this).attr( 'disabled' ) ) {
594
+ return false;
595
+ }
596
+ /* changed this in version 2.5.0 because the commented line generated stack exceeded error when multiple fields were opened with edit */
597
+ if ( typeof( event.currentTarget ) == 'undefined' ){
598
+ // Repeater field triggered the click event of the "Add Field" / "Save changes" buttons, so the onclick attribute is in the target, not currentTarget
599
+ eval(event.target.getAttribute('onclick'));
600
+ }else {
601
+ // normal Manage Fields Add Field button press
602
+ eval(event.currentTarget.getAttribute('onclick'));
603
+ }
604
+
605
+ //jQuery(this).data('myclick').call(this, event || window.event);
606
+ };
607
+ });
608
+
609
+ }
610
+
611
+
612
+ function wppb_edit_form_properties( container_name, element_id ){
613
+ wppb_hide_all ( container_name );
614
+ wppb_disable_add_entry_button ( container_name );
615
+
616
+ field = jQuery( container_name + ' #' + element_id + ' ' + '#field' ).val();
617
+
618
+ if ( ( field in fields ) ){
619
+ var to_show = fields[jQuery.trim(field)]['show_rows'];
620
+ for (var key in to_show)
621
+ jQuery( container_name + ' #' + element_id + ' ' + to_show[key] ).show();
622
+
623
+ var properties = fields[ jQuery.trim(field) ]['properties'];
624
+ if( typeof properties !== 'undefined' && properties ) {
625
+ for( var key in properties ) {
626
+ if( typeof properties['meta_name_value'] !== 'undefined' ) {
627
+ jQuery( container_name + ' ' + '#meta-name').attr( 'readonly', true );
628
+ }
629
+ }
630
+ }
631
+
632
+ jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' );
633
+
634
+ //Handle user role sorting
635
+ wppb_handle_user_role_field( container_name );
636
+ }
637
+ }
638
+
639
+
640
+ function wppb_display_needed_fields( index, container_name, current_field_select ){
641
+ var show_rows = fields[jQuery.trim(index)]['show_rows'];
642
+ for (var key in show_rows) {
643
+ jQuery( show_rows[key], jQuery( current_field_select ).parents( '.mb-list-entry-fields' ) ).show();
644
+ }
645
+
646
+ var properties = fields[jQuery.trim(index)]['properties'];
647
+ if ( ( ( typeof properties !== 'undefined' ) && ( properties ) ) ) { //the extra (second) condition is a particular case since only the username is defined in our global array that has no meta-name
648
+ for (var key in properties) {
649
+ if ( ( typeof properties['meta_name_value'] !== 'undefined' ) ){
650
+ jQuery( container_name + ' ' + '#meta-name' ).val( properties['meta_name_value'] );
651
+ jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', true );
652
+ }
653
+ if ( ( typeof properties['field_title'] !== 'undefined' ) ){
654
+ jQuery( container_name + ' ' + '#field-title' ).val( properties['field_title'] );
655
+ }
656
+ if ( ( typeof properties['description'] !== 'undefined' ) ){
657
+ jQuery( container_name + ' ' + '#description' ).val( properties['description'] );
658
+ }
659
+ }
660
+
661
+ }else{
662
+ /* meta value when editing a field shouldn't change so we take it from the current entered value which is displayed above the edit form */
663
+ if( jQuery( current_field_select).parents('.update_container_wppb_manage_fields').length != 0 ){
664
+ meta_value = jQuery( '.row-meta-name pre', jQuery( current_field_select).parents( '.update_container_wppb_manage_fields' ).prev() ).text();
665
+ }
666
+ /* for the add form it should change */
667
+ else{
668
+
669
+ // Repeater fields have different meta name prefixes, stored in the GET parameter 'wppb_field_metaname_prefix'.
670
+ var get_parameter_prefix = wppb_get_parameter_by_name( 'wppb_field_metaname_prefix' );
671
+ var field_metaname_prefix = ( get_parameter_prefix == null ) ? 'custom_field' : get_parameter_prefix;
672
+
673
+ numbers = new Array();
674
+ jQuery( '#container_wppb_manage_fields .row-meta-name pre').each(function(){
675
+ meta_name = jQuery(this).text();
676
+ if( meta_name.indexOf( field_metaname_prefix ) !== -1 ){
677
+ var meta_name = meta_name.replace(field_metaname_prefix, '' );
678
+ /* we should have an underscore present in custom_field_# so remove it */
679
+ meta_name = meta_name.replace('_', '' );
680
+
681
+ if( isNaN( meta_name ) ){
682
+ meta_name = Math.floor((Math.random() * 200) + 100);
683
+ }
684
+ numbers.push( parseInt(meta_name) );
685
+ }
686
+
687
+ });
688
+ if( numbers.length > 0 ){
689
+ numbers.sort( function(a, b){return a-b} );
690
+ numbers.reverse();
691
+ meta_number = parseInt(numbers[0])+1;
692
+ }
693
+ else
694
+ meta_number = 1;
695
+
696
+ meta_value = field_metaname_prefix + '_' + meta_number;
697
+ }
698
+
699
+ jQuery( container_name + ' ' + '#meta-name' ).val( meta_value );
700
+ jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', false );
701
+ }
702
+
703
+ //Handle user role sorting
704
+ wppb_handle_user_role_field( container_name );
705
+
706
+ var set_required = fields[jQuery.trim(index)]['required'];
707
+ if ( ( typeof set_required !== 'undefined' ) && ( set_required ) ){
708
+ jQuery( container_name + ' ' + '#required' ).val( 'Yes' );
709
+ jQuery( container_name + ' ' + '#required' ).attr( 'disabled', true );
710
+
711
+ }else{
712
+ jQuery( container_name + ' ' + '#required' ).val( 'No' );
713
+ jQuery( container_name + ' ' + '#required' ).attr( 'disabled', false );
714
+ }
715
+
716
+ jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' );
717
+ }
718
+
719
+
720
+ function wppb_get_parameter_by_name(name, url) {
721
+ if (!url) url = window.location.href;
722
+ name = name.replace(/[\[\]]/g, "\\$&");
723
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
724
+ results = regex.exec(url);
725
+ if (!results) return null;
726
+ if (!results[2]) return null;
727
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
728
+ }
729
+
730
+ /*
731
+ * Function that handles the sorting of the user roles from the Select (User Role)
732
+ * extra field
733
+ *
734
+ */
735
+ function wppb_handle_user_role_field( container_name ) {
736
+
737
+ jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').sortable({
738
+
739
+ //Assign a custom handle for the drag and drop
740
+ handle: '.sortable-handle',
741
+
742
+ create: function( event, ui ) {
743
+
744
+ //Add the custom handle for drag and drop
745
+ jQuery(this).find('div').each( function() {
746
+ jQuery(this).prepend('<span class="sortable-handle"></span>');
747
+ });
748
+
749
+ $sortOrderInput = jQuery(this).parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]');
750
+
751
+ if( $sortOrderInput.val() == '' ) {
752
+ jQuery(this).find('input[type=checkbox]').each( function() {
753
+ $sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() );
754
+ });
755
+ } else {
756
+ sortOrderElements = $sortOrderInput.val().split(', ');
757
+ sortOrderElements.shift();
758
+
759
+ for( var i=0; i < sortOrderElements.length; i++ ) {
760
+ jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').append( jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes input[value="' + sortOrderElements[i] + '"]').parent().parent().get(0) );
761
+ }
762
+ }
763
+ },
764
+
765
+ update: function( event, ui ) {
766
+ $sortOrderInput = ui.item.parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]');
767
+ $sortOrderInput.val('');
768
+
769
+ ui.item.parent().find('input[type=checkbox]').each( function() {
770
+ $sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() );
771
+ });
772
+ }
773
+ });
774
+ }
775
+
776
+ function wppb_initialize_live_select( container_name ){
777
+ wppb_hide_all( container_name );
778
+ jQuery(document).on( 'change', container_name + ' ' + '.mb-list-entry-fields #field', function () {
779
+ field = jQuery(this).val();
780
+
781
+ if ( field != ''){
782
+ wppb_hide_all( container_name );
783
+ wppb_display_needed_fields( field, container_name, this );
784
+ }else{
785
+ wppb_hide_all( container_name );
786
+ }
787
+ });
788
+ }
789
+
790
+
791
+ function wppb_enable_select2(container_name){
792
+ // Select2 initialization on manage fields.
793
+
794
+ jQuery( container_name + ' #field').select2({
795
+ placeholder: 'Select an option',
796
+ allowClear: true
797
+ })
798
+
799
+ var $eventSelect = jQuery( container_name + ' #field');
800
+ $eventSelect.on("select2:open", function (e) {
801
+ jQuery('#wppb_select2_overlay').fadeIn('100')
802
+ });
803
+ $eventSelect.on("select2:close", function (e) {
804
+ jQuery('#wppb_select2_overlay').hide();
805
+ });
806
+ }
807
+
808
+
809
+ jQuery(function(){
810
+ wppb_initialize_live_select ( '#wppb_manage_fields' );
811
+ wppb_initialize_live_select ( '#container_wppb_manage_fields' );
812
+
813
+ wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' );
814
+ wppb_disable_add_entry_button ( '#wppb_manage_fields' );
815
+
816
+ var overlay = jQuery('<div id="wppb_select2_overlay"> </div>')
817
+ overlay.appendTo(document.body)
818
+
819
+ wppb_enable_select2('#wppb_manage_fields');
820
+
821
+ });
822
+
823
+ // Custom functionality for sorting options (see the Map POIs attributes).
824
+ (function ($) {
825
+ window.SortSelCheck = {
826
+ // Initiate the events and triggers.
827
+ init: function () {
828
+ SortSelCheck.assess();
829
+ SortSelCheck.listen();
830
+ },
831
+
832
+ // Listen for events.
833
+ listen: function () {
834
+ // Listen for the new element setup and trigger the expected custom event.
835
+ $('.wck-add-form').on('change', function() {
836
+ SortSelCheck.assess('wck-add-form');
837
+ });
838
+ },
839
+
840
+ // Assess the potential elements and configure these when possible.
841
+ assess: function (elem) {
842
+ var $elem = $('.wppb_sortable_checkboxes_wrap');
843
+ // console.log('assess triggerer ' + elem, $elem);
844
+ $elem.each(function() {
845
+ $rows = SortSelCheck.remake($(this));
846
+ SortSelCheck.attach($(this), $rows);
847
+ });
848
+ },
849
+
850
+ // Configure the elements that form the sortable checkboxes options.
851
+ remake: function ($field) {
852
+ var $rows = $field.children('.wck-checkboxes');
853
+ if (!$rows.length) {
854
+ $field.prepend('<div class="wck-checkboxes"> </div>');
855
+ var $rows = $field.children('.wck-checkboxes');
856
+ }
857
+ if ($rows.length) {
858
+ SortSelCheck.sortable($rows);
859
+ }
860
+ return $rows;
861
+ },
862
+
863
+ // Attach the custom dropdown options as sortable checkboxes options.
864
+ attach: function ($field, $rows) {
865
+ var $ddwn = $field.children('.wppb_selector_for_sortable_checkbox');
866
+ if ($ddwn.length) {
867
+ $ddwn.on('change', function() {
868
+ var val = $(this).val();
869
+ if ('' !== val) {
870
+ $rows.append('<div><label><input type="checkbox" name="' + $(this).data('list') + '" id="' + $(this).data('list') + '_' + val + '" value="' + val + '" checked="checked" class="mb-checkbox mb-field">' + $(this).children('option').filter(':selected').text() + '</label></div>');
871
+ $(this).children('option').filter(':selected').remove();
872
+ SortSelCheck.sortable($rows);
873
+ }
874
+ });
875
+ }
876
+ },
877
+
878
+ // Make sortable items from the list.
879
+ sortable: function ($list) {
880
+ var $items = $list.children('div');
881
+ $items.addClass('wppb_manage_fields_sortables');
882
+ $items.remove('em');
883
+ $items.prepend('<em class="dashicons dashicons-menu"></em> ');
884
+ $list.sortable({
885
+ items: '> div',
886
+ classes: {'ui-sortable': 'highlight'}
887
+ });
888
+ },
889
+
890
+ };
891
+
892
+ $(document).ready(function () {
893
+ // Initialize the custom functionality.
894
+ SortSelCheck.init('init');
895
+
896
+ // Bind the event to the custom functionality.
897
+ $('html').on('wpbFormMetaLoaded', function(e, elem) {
898
+ SortSelCheck.assess(elem);
899
+ });
900
+ });
901
+
902
+ })(jQuery);
assets/js/jquery-pb-add-ons.js CHANGED
@@ -1,237 +1,237 @@
1
-
2
- /*
3
- * Function to download/activate add-ons on button click
4
- */
5
- jQuery('.wppb-add-on .button').on( 'click', function(e) {
6
- if( jQuery(this).attr('disabled') ) {
7
- return false;
8
- }
9
-
10
- // Activate add-on
11
- if( jQuery(this).hasClass('wppb-add-on-activate') ) {
12
- e.preventDefault();
13
- wppb_add_on_activate( jQuery(this) );
14
- }
15
-
16
- // Deactivate add-on
17
- if( jQuery(this).hasClass('wppb-add-on-deactivate') ) {
18
- e.preventDefault();
19
- wppb_add_on_deactivate( jQuery(this) );
20
- }
21
- });
22
-
23
-
24
- /*
25
- * Make deactivate button from Add-On is Active message button
26
- */
27
- jQuery('.wppb-add-on').on( 'hover', function() {
28
-
29
- $button = jQuery(this).find('.wppb-add-on-deactivate');
30
-
31
- if( $button.length > 0 ) {
32
- $button
33
- .animate({
34
- opacity: 1
35
- }, 100);
36
- }
37
- });
38
-
39
- /*
40
- * Make Add-On is Active message button from deactivate button
41
- */
42
- jQuery('.wppb-add-on').on( 'mouseleave', function() {
43
-
44
- $button = jQuery(this).find('.wppb-add-on-deactivate');
45
-
46
- if( $button.length > 0 ) {
47
- $button
48
- .animate({
49
- opacity: 0
50
- }, 100);
51
- }
52
- });
53
-
54
-
55
- /*
56
- * Function that activates the add-on
57
- */
58
- function wppb_add_on_activate( $button ) {
59
- $activate_button = $button;
60
-
61
- var fade_in_out_speed = 300;
62
- var plugin = $activate_button.attr('href');
63
- var add_on_index = $activate_button.parents('.wppb-add-on').index('.wppb-add-on');
64
- var nonce = $activate_button.data('nonce');
65
-
66
- $activate_button
67
- .attr('disabled', true);
68
-
69
- $spinner = $activate_button.siblings('.spinner');
70
-
71
- $spinner.animate({
72
- opacity: 0.7
73
- }, 100);
74
-
75
- // Remove the current displayed message
76
- wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed);
77
-
78
- jQuery.post( ajaxurl, { action: 'wppb_add_on_activate', wppb_add_on_to_activate: plugin, wppb_add_on_index: add_on_index, nonce: nonce }, function( response ) {
79
-
80
- add_on_index = response;
81
-
82
- $activate_button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
83
-
84
- $activate_button
85
- .blur()
86
- .removeClass('wppb-add-on-activate')
87
- .addClass('wppb-add-on-deactivate')
88
- .removeAttr('disabled')
89
- .text( jQuery('#wppb-add-on-deactivate-button-text').text() );
90
-
91
- $spinner = $activate_button.siblings('.spinner');
92
-
93
- $spinner.animate({
94
- opacity: 0
95
- }, 0);
96
-
97
- // Set status confirmation message
98
- wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-activated-message-text').text(), fade_in_out_speed, 0, true );
99
- wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed, 2000 );
100
-
101
- // Set is active message
102
- wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-is-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
103
- });
104
- }
105
-
106
-
107
-
108
- /*
109
- * Function that deactivates the add-on
110
- */
111
- function wppb_add_on_deactivate( $button ) {
112
-
113
- var fade_in_out_speed = 300;
114
- var plugin = $button.attr('href');
115
- var add_on_index = $button.parents('.wppb-add-on').index('.wppb-add-on');
116
- var nonce = $button.data('nonce');
117
-
118
- $button
119
- .removeClass('wppb-add-on-deactivate')
120
- .attr('disabled', true);
121
-
122
- $spinner = $button.siblings('.spinner');
123
-
124
- $spinner.animate({
125
- opacity: 0.7
126
- }, 100);
127
-
128
- // Remove the current displayed message
129
- wppb_add_on_remove_status_message( $button, fade_in_out_speed );
130
-
131
- jQuery.post( ajaxurl, { action: 'wppb_add_on_deactivate', wppb_add_on_to_deactivate: plugin, wppb_add_on_index: add_on_index, nonce: nonce }, function( response ) {
132
-
133
- add_on_index = response;
134
-
135
- $button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
136
-
137
- $button
138
- .blur()
139
- .removeClass('wppb-add-on-is-active')
140
- .addClass('wppb-add-on-activate')
141
- .attr( 'disabled', false )
142
- .text( jQuery('#wppb-add-on-activate-button-text').text() );
143
-
144
- $spinner = $button.siblings('.spinner');
145
-
146
- $spinner.animate({
147
- opacity: 0
148
- }, 0);
149
-
150
- // Set status confirmation message
151
- wppb_add_on_set_status_message( $button, 'dashicons-yes', jQuery('#wppb-add-on-deactivated-message-text').text(), fade_in_out_speed, 0, true );
152
- wppb_add_on_remove_status_message( $button, fade_in_out_speed, 2000 );
153
-
154
- // Set is active message
155
- wppb_add_on_set_status_message( $button, 'dashicons-no-alt', jQuery('#wppb-add-on-is-not-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
156
-
157
- });
158
- }
159
-
160
-
161
- /*
162
- * Function used to remove the status message of an add-on
163
- *
164
- * @param object $button - The jQuery object of the add-on box button that was pressed
165
- * @param int fade_in_out_speed - The speed of the fade in and out animations
166
- * @param int delay - Delay removing of the message
167
- *
168
- */
169
- function wppb_add_on_remove_status_message( $button, fade_in_out_speed, delay ) {
170
-
171
- if( typeof( delay ) == 'undefined' ) {
172
- delay = 0;
173
- }
174
-
175
- setTimeout( function() {
176
-
177
- $button.siblings('.dashicons')
178
- .animate({
179
- opacity: 0
180
- }, fade_in_out_speed );
181
-
182
- $button.siblings('.wppb-add-on-message')
183
- .animate({
184
- opacity: 0
185
- }, fade_in_out_speed );
186
-
187
- }, delay);
188
-
189
- }
190
-
191
- /*
192
- * Function used to remove the status message of an add-on
193
- *
194
- * @param object $button - The jQuery object of the add-on box button that was pressed
195
- * @param string message_icon_class - The string name of the class we want the icon to have
196
- * @param string message_text - The text we want the user to see
197
- * @param int fade_in_out_speed - The speed of the fade in and out animations
198
- * @param bool success - If true adds a class to style the message as a success one, if false adds a class to style the message as a failure
199
- *
200
- */
201
- function wppb_add_on_set_status_message( $button, message_icon_class, message_text, fade_in_out_speed, delay, success ) {
202
-
203
- if( typeof( delay ) == 'undefined' ) {
204
- delay = 0;
205
- }
206
-
207
- setTimeout(function() {
208
-
209
- $button.siblings('.dashicons')
210
- .css('opacity', 0)
211
- .attr('class', 'dashicons')
212
- .addClass( message_icon_class )
213
- .animate({ opacity: 1}, fade_in_out_speed);
214
-
215
- $button.siblings('.wppb-add-on-message')
216
- .css('opacity', 0)
217
- .attr( 'class', 'wppb-add-on-message' )
218
- .html( message_text )
219
- .animate({ opacity: 1}, fade_in_out_speed);
220
-
221
- if( typeof( success ) != 'undefined' ) {
222
- if( success == true ) {
223
- $button.siblings('.dashicons')
224
- .addClass('wppb-confirmation-success');
225
- $button.siblings('.wppb-add-on-message')
226
- .addClass('wppb-confirmation-success');
227
- } else if( success == false ) {
228
- $button.siblings('.dashicons')
229
- .addClass('wppb-confirmation-error');
230
- $button.siblings('.wppb-add-on-message')
231
- .addClass('wppb-confirmation-error');
232
- }
233
- }
234
-
235
- }, delay );
236
-
237
  }
1
+
2
+ /*
3
+ * Function to download/activate add-ons on button click
4
+ */
5
+ jQuery('.wppb-add-on .button').on( 'click', function(e) {
6
+ if( jQuery(this).attr('disabled') ) {
7
+ return false;
8
+ }
9
+
10
+ // Activate add-on
11
+ if( jQuery(this).hasClass('wppb-add-on-activate') ) {
12
+ e.preventDefault();
13
+ wppb_add_on_activate( jQuery(this) );
14
+ }
15
+
16
+ // Deactivate add-on
17
+ if( jQuery(this).hasClass('wppb-add-on-deactivate') ) {
18
+ e.preventDefault();
19
+ wppb_add_on_deactivate( jQuery(this) );
20
+ }
21
+ });
22
+
23
+
24
+ /*
25
+ * Make deactivate button from Add-On is Active message button
26
+ */
27
+ jQuery('.wppb-add-on').on( 'hover', function() {
28
+
29
+ $button = jQuery(this).find('.wppb-add-on-deactivate');
30
+
31
+ if( $button.length > 0 ) {
32
+ $button
33
+ .animate({
34
+ opacity: 1
35
+ }, 100);
36
+ }
37
+ });
38
+
39
+ /*
40
+ * Make Add-On is Active message button from deactivate button
41
+ */
42
+ jQuery('.wppb-add-on').on( 'mouseleave', function() {
43
+
44
+ $button = jQuery(this).find('.wppb-add-on-deactivate');
45
+
46
+ if( $button.length > 0 ) {
47
+ $button
48
+ .animate({
49
+ opacity: 0
50
+ }, 100);
51
+ }
52
+ });
53
+
54
+
55
+ /*
56
+ * Function that activates the add-on
57
+ */
58
+ function wppb_add_on_activate( $button ) {
59
+ $activate_button = $button;
60
+
61
+ var fade_in_out_speed = 300;
62
+ var plugin = $activate_button.attr('href');
63
+ var add_on_index = $activate_button.parents('.wppb-add-on').index('.wppb-add-on');
64
+ var nonce = $activate_button.data('nonce');
65
+
66
+ $activate_button
67
+ .attr('disabled', true);
68
+
69
+ $spinner = $activate_button.siblings('.spinner');
70
+
71
+ $spinner.animate({
72
+ opacity: 0.7
73
+ }, 100);
74
+
75
+ // Remove the current displayed message
76
+ wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed);
77
+
78
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_activate', wppb_add_on_to_activate: plugin, wppb_add_on_index: add_on_index, nonce: nonce }, function( response ) {
79
+
80
+ add_on_index = response;
81
+
82
+ $activate_button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
83
+
84
+ $activate_button
85
+ .blur()
86
+ .removeClass('wppb-add-on-activate')
87
+ .addClass('wppb-add-on-deactivate')
88
+ .removeAttr('disabled')
89
+ .text( jQuery('#wppb-add-on-deactivate-button-text').text() );
90
+
91
+ $spinner = $activate_button.siblings('.spinner');
92
+
93
+ $spinner.animate({
94
+ opacity: 0
95
+ }, 0);
96
+
97
+ // Set status confirmation message
98
+ wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-activated-message-text').text(), fade_in_out_speed, 0, true );
99
+ wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed, 2000 );
100
+
101
+ // Set is active message
102
+ wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-is-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
103
+ });
104
+ }
105
+
106
+
107
+
108
+ /*
109
+ * Function that deactivates the add-on
110
+ */
111
+ function wppb_add_on_deactivate( $button ) {
112
+
113
+ var fade_in_out_speed = 300;
114
+ var plugin = $button.attr('href');
115
+ var add_on_index = $button.parents('.wppb-add-on').index('.wppb-add-on');
116
+ var nonce = $button.data('nonce');
117
+
118
+ $button
119
+ .removeClass('wppb-add-on-deactivate')
120
+ .attr('disabled', true);
121
+
122
+ $spinner = $button.siblings('.spinner');
123
+
124
+ $spinner.animate({
125
+ opacity: 0.7
126
+ }, 100);
127
+
128
+ // Remove the current displayed message
129
+ wppb_add_on_remove_status_message( $button, fade_in_out_speed );
130
+
131
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_deactivate', wppb_add_on_to_deactivate: plugin, wppb_add_on_index: add_on_index, nonce: nonce }, function( response ) {
132
+
133
+ add_on_index = response;
134
+
135
+ $button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
136
+
137
+ $button
138
+ .blur()
139
+ .removeClass('wppb-add-on-is-active')
140
+ .addClass('wppb-add-on-activate')
141
+ .attr( 'disabled', false )
142
+ .text( jQuery('#wppb-add-on-activate-button-text').text() );
143
+
144
+ $spinner = $button.siblings('.spinner');
145
+
146
+ $spinner.animate({
147
+ opacity: 0
148
+ }, 0);
149
+
150
+ // Set status confirmation message
151
+ wppb_add_on_set_status_message( $button, 'dashicons-yes', jQuery('#wppb-add-on-deactivated-message-text').text(), fade_in_out_speed, 0, true );
152
+ wppb_add_on_remove_status_message( $button, fade_in_out_speed, 2000 );
153
+
154
+ // Set is active message
155
+ wppb_add_on_set_status_message( $button, 'dashicons-no-alt', jQuery('#wppb-add-on-is-not-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
156
+
157
+ });
158
+ }
159
+
160
+
161
+ /*
162
+ * Function used to remove the status message of an add-on
163
+ *
164
+ * @param object $button - The jQuery object of the add-on box button that was pressed
165
+ * @param int fade_in_out_speed - The speed of the fade in and out animations
166
+ * @param int delay - Delay removing of the message
167
+ *
168
+ */
169
+ function wppb_add_on_remove_status_message( $button, fade_in_out_speed, delay ) {
170
+
171
+ if( typeof( delay ) == 'undefined' ) {
172
+ delay = 0;
173
+ }
174
+
175
+ setTimeout( function() {
176
+
177
+ $button.siblings('.dashicons')
178
+ .animate({
179
+ opacity: 0
180
+ }, fade_in_out_speed );
181
+
182
+ $button.siblings('.wppb-add-on-message')
183
+ .animate({
184
+ opacity: 0
185
+ }, fade_in_out_speed );
186
+
187
+ }, delay);
188
+
189
+ }
190
+
191
+ /*
192
+ * Function used to remove the status message of an add-on
193
+ *
194
+ * @param object $button - The jQuery object of the add-on box button that was pressed
195
+ * @param string message_icon_class - The string name of the class we want the icon to have
196
+ * @param string message_text - The text we want the user to see
197
+ * @param int fade_in_out_speed - The speed of the fade in and out animations
198
+ * @param bool success - If true adds a class to style the message as a success one, if false adds a class to style the message as a failure
199
+ *
200
+ */
201
+ function wppb_add_on_set_status_message( $button, message_icon_class, message_text, fade_in_out_speed, delay, success ) {
202
+
203
+ if( typeof( delay ) == 'undefined' ) {
204
+ delay = 0;
205
+ }
206
+
207
+ setTimeout(function() {
208
+
209
+ $button.siblings('.dashicons')
210
+ .css('opacity', 0)
211
+ .attr('class', 'dashicons')
212
+ .addClass( message_icon_class )
213
+ .animate({ opacity: 1}, fade_in_out_speed);
214
+
215
+ $button.siblings('.wppb-add-on-message')
216
+ .css('opacity', 0)
217
+ .attr( 'class', 'wppb-add-on-message' )
218
+ .html( message_text )
219
+ .animate({ opacity: 1}, fade_in_out_speed);
220
+
221
+ if( typeof( success ) != 'undefined' ) {
222
+ if( success == true ) {
223
+ $button.siblings('.dashicons')
224
+ .addClass('wppb-confirmation-success');
225
+ $button.siblings('.wppb-add-on-message')
226
+ .addClass('wppb-confirmation-success');
227
+ } else if( success == false ) {
228
+ $button.siblings('.dashicons')
229
+ .addClass('wppb-confirmation-error');
230
+ $button.siblings('.wppb-add-on-message')
231
+ .addClass('wppb-confirmation-error');
232
+ }
233
+ }
234
+
235
+ }, delay );
236
+
237
  }
assets/js/jquery-pb-sitewide.js CHANGED
@@ -1,166 +1,166 @@
1
- /**
2
- * Add a negative letter spacing to Profile Builder email customizer menus.
3
- */
4
-
5
- jQuery( document ).ready(function(){
6
- jQuery('li a[href$="admin-email-customizer"]').css("letter-spacing", "-0.7px");
7
- jQuery('li a[href$="user-email-customizer"]').css("letter-spacing", "-0.7px");
8
- });
9
-
10
- /*
11
- * Set the width of the shortcode input based on an element that
12
- * has the width of its contents
13
- */
14
- function setShortcodeInputWidth( $inputField ) {
15
- var tempSpan = document.createElement('span');
16
- tempSpan.className = "wppb-shortcode-temp";
17
- tempSpan.innerHTML = $inputField.val();
18
- document.body.appendChild(tempSpan);
19
- var tempWidth = tempSpan.scrollWidth;
20
- document.body.removeChild(tempSpan);
21
-
22
- $inputField.outerWidth( tempWidth );
23
- }
24
-
25
- jQuery( document ).ready( function() {
26
-
27
- jQuery('.wppb-shortcode.input').each( function() {
28
- setShortcodeInputWidth( jQuery(this) );
29
- });
30
-
31
- jQuery('.wppb-shortcode.textarea').each( function() {
32
- jQuery(this).outerHeight( jQuery(this)[0].scrollHeight + parseInt( jQuery(this).css('border-top-width') ) * 2 );
33
- });
34
-
35
- jQuery('.wppb-shortcode').click( function() {
36
- this.select();
37
- });
38
- });
39
-
40
-
41
- /* make sure that we don;t leave the page without having a title in the Post Title field, otherwise we loose data */
42
- jQuery( function(){
43
- if( jQuery( 'body').hasClass('post-new-php') ){
44
-
45
- if( jQuery( 'body').hasClass('post-type-wppb-rf-cpt') || jQuery( 'body').hasClass('post-type-wppb-epf-cpt') || jQuery( 'body').hasClass('post-type-wppb-ul-cpt') ){
46
-
47
- if( jQuery('#title').val() == '' ){
48
- jQuery(window).bind('beforeunload',function() {
49
- return "This page is asking you to confirm that you want to leave - data you have entered may not be saved";
50
- });
51
- }
52
-
53
- /* remove beforeunload event when entering a title or pressing the puclish button */
54
- jQuery( '#title').keypress(function() {
55
- jQuery(window).unbind('beforeunload');
56
- });
57
- jQuery( '#publish').click( function() {
58
- jQuery(window).unbind('beforeunload');
59
- });
60
- }
61
- }
62
- });
63
-
64
-
65
- /* show hide fields based on selected options */
66
- jQuery( function(){
67
- jQuery( '#wppb-rf-settings-args').on('change', '#redirect', function(){
68
- if( jQuery(this).val() == 'Yes' ){
69
- jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
70
- }
71
- else{
72
- jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
73
- }
74
- });
75
-
76
- jQuery( '#wppb-epf-settings-args').on('change', '#redirect', function(){
77
- if( jQuery(this).val() == 'Yes' ){
78
- jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
79
- }
80
- else{
81
- jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
82
- }
83
- });
84
-
85
-
86
- jQuery( '#wppb-ul-settings-args').on('click', '#visible-only-to-logged-in-users_yes', function(){
87
- jQuery( '.row-visible-to-following-roles', jQuery(this).parent().parent().parent().parent().parent().parent()).toggle();
88
- });
89
-
90
- jQuery( '#wppb-ul-faceted-args').on('change', '#facet-type', function(){
91
- if( jQuery(this).val() == 'checkboxes' ){
92
- jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).show();
93
- }else if( jQuery(this).val() == 'select_multiple' ){
94
- jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).show();
95
- }
96
- else{
97
- jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).hide();
98
- jQuery( '.row-facet-behaviour #facet-behaviour', jQuery(this).parent().parent().parent()).val('narrow');
99
- }
100
- if( jQuery(this).val() == 'search' ){
101
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').hide();
102
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').hide();
103
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').hide();
104
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').hide();
105
- }
106
- else {
107
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').show();
108
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').show();
109
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').show();
110
- jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').show()
111
- }
112
-
113
- });
114
-
115
- });
116
-
117
- /*
118
- * Dialog boxes throughout Profile Builder
119
- */
120
- jQuery( function() {
121
- if ( jQuery.fn.dialog ) {
122
- jQuery('.wppb-modal-box').dialog({
123
- autoOpen: false,
124
- modal: true,
125
- draggable: false,
126
- minWidth: 450,
127
- minHeight: 450
128
- });
129
-
130
- jQuery('.wppb-open-modal-box').click(function (e) {
131
- e.preventDefault();
132
- jQuery('#' + jQuery(this).attr('href')).dialog('open');
133
- });
134
- }
135
- });
136
-
137
- /*
138
- * Private Website Settings page
139
- */
140
-
141
- jQuery( function() {
142
- if( jQuery( '.wppb-private-website' ).length != 0 ) {
143
- jQuery('#private-website-redirect-to-login').select2();
144
- jQuery('#private-website-allowed-pages').select2();
145
-
146
- wppbDisablePrivatePageOptions(jQuery('#private-website-enable').val());
147
-
148
- jQuery('#private-website-enable').change(function () {
149
- wppbDisablePrivatePageOptions(jQuery(this).val());
150
- });
151
-
152
-
153
- function wppbDisablePrivatePageOptions(value) {
154
- if (value == 'no') {
155
- jQuery('#private-website-redirect-to-login').closest('tr').addClass("wppb-disabled");
156
- jQuery('#private-website-allowed-pages').closest('tr').addClass("wppb-disabled");
157
- jQuery('#private-website-menu-hide').addClass("wppb-disabled");
158
- }
159
- else if (value == 'yes') {
160
- jQuery('#private-website-redirect-to-login').closest('tr').removeClass("wppb-disabled");
161
- jQuery('#private-website-allowed-pages').closest('tr').removeClass("wppb-disabled");
162
- jQuery('#private-website-menu-hide').removeClass("wppb-disabled");
163
- }
164
- }
165
- }
166
- });
1
+ /**
2
+ * Add a negative letter spacing to Profile Builder email customizer menus.
3
+ */
4
+
5
+ jQuery( document ).ready(function(){
6
+ jQuery('li a[href$="admin-email-customizer"]').css("letter-spacing", "-0.7px");
7
+ jQuery('li a[href$="user-email-customizer"]').css("letter-spacing", "-0.7px");
8
+ });
9
+
10
+ /*
11
+ * Set the width of the shortcode input based on an element that
12
+ * has the width of its contents
13
+ */
14
+ function setShortcodeInputWidth( $inputField ) {
15
+ var tempSpan = document.createElement('span');
16
+ tempSpan.className = "wppb-shortcode-temp";
17
+ tempSpan.innerHTML = $inputField.val();
18
+ document.body.appendChild(tempSpan);
19
+ var tempWidth = tempSpan.scrollWidth;
20
+ document.body.removeChild(tempSpan);
21
+
22
+ $inputField.outerWidth( tempWidth );
23
+ }
24
+
25
+ jQuery( document ).ready( function() {
26
+
27
+ jQuery('.wppb-shortcode.input').each( function() {
28
+ setShortcodeInputWidth( jQuery(this) );
29
+ });
30
+
31
+ jQuery('.wppb-shortcode.textarea').each( function() {
32
+ jQuery(this).outerHeight( jQuery(this)[0].scrollHeight + parseInt( jQuery(this).css('border-top-width') ) * 2 );
33
+ });
34
+
35
+ jQuery('.wppb-shortcode').click( function() {
36
+ this.select();
37
+ });
38
+ });
39
+
40
+
41
+ /* make sure that we don;t leave the page without having a title in the Post Title field, otherwise we loose data */
42
+ jQuery( function(){
43
+ if( jQuery( 'body').hasClass('post-new-php') ){
44
+
45
+ if( jQuery( 'body').hasClass('post-type-wppb-rf-cpt') || jQuery( 'body').hasClass('post-type-wppb-epf-cpt') || jQuery( 'body').hasClass('post-type-wppb-ul-cpt') ){
46
+
47
+ if( jQuery('#title').val() == '' ){
48
+ jQuery(window).bind('beforeunload',function() {
49
+ return "This page is asking you to confirm that you want to leave - data you have entered may not be saved";
50
+ });
51
+ }
52
+
53
+ /* remove beforeunload event when entering a title or pressing the puclish button */
54
+ jQuery( '#title').keypress(function() {
55
+ jQuery(window).unbind('beforeunload');
56
+ });
57
+ jQuery( '#publish').click( function() {
58
+ jQuery(window).unbind('beforeunload');
59
+ });
60
+ }
61
+ }
62
+ });
63
+
64
+
65
+ /* show hide fields based on selected options */
66
+ jQuery( function(){
67
+ jQuery( '#wppb-rf-settings-args').on('change', '#redirect', function(){
68
+ if( jQuery(this).val() == 'Yes' ){
69
+ jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
70
+ }
71
+ else{
72
+ jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
73
+ }
74
+ });
75
+
76
+ jQuery( '#wppb-epf-settings-args').on('change', '#redirect', function(){
77
+ if( jQuery(this).val() == 'Yes' ){
78
+ jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
79
+ }
80
+ else{
81
+ jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
82
+ }
83
+ });
84
+
85
+
86
+ jQuery( '#wppb-ul-settings-args').on('click', '#visible-only-to-logged-in-users_yes', function(){
87
+ jQuery( '.row-visible-to-following-roles', jQuery(this).parent().parent().parent().parent().parent().parent()).toggle();
88
+ });
89
+
90
+ jQuery( '#wppb-ul-faceted-args').on('change', '#facet-type', function(){
91
+ if( jQuery(this).val() == 'checkboxes' ){
92
+ jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).show();
93
+ }else if( jQuery(this).val() == 'select_multiple' ){
94
+ jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).show();
95
+ }
96
+ else{
97
+ jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).hide();
98
+ jQuery( '.row-facet-behaviour #facet-behaviour', jQuery(this).parent().parent().parent()).val('narrow');
99
+ }
100
+ if( jQuery(this).val() == 'search' ){
101
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').hide();
102
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').hide();
103
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').hide();
104
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').hide();
105
+ }
106
+ else {
107
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').show();
108
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').show();
109
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').show();
110
+ jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').show()
111
+ }
112
+
113
+ });
114
+
115
+ });
116
+
117
+ /*
118
+ * Dialog boxes throughout Profile Builder
119
+ */
120
+ jQuery( function() {
121
+ if ( jQuery.fn.dialog ) {
122
+ jQuery('.wppb-modal-box').dialog({
123
+ autoOpen: false,
124
+ modal: true,
125
+ draggable: false,
126
+ minWidth: 450,
127
+ minHeight: 450
128
+ });
129
+
130
+ jQuery('.wppb-open-modal-box').click(function (e) {
131
+ e.preventDefault();
132
+ jQuery('#' + jQuery(this).attr('href')).dialog('open');
133
+ });
134
+ }
135
+ });
136
+
137
+ /*
138
+ * Private Website Settings page
139
+ */
140
+
141
+ jQuery( function() {
142
+ if( jQuery( '.wppb-private-website' ).length != 0 ) {
143
+ jQuery('#private-website-redirect-to-login').select2();
144
+ jQuery('#private-website-allowed-pages').select2();
145
+
146
+ wppbDisablePrivatePageOptions(jQuery('#private-website-enable').val());
147
+
148
+ jQuery('#private-website-enable').change(function () {
149
+ wppbDisablePrivatePageOptions(jQuery(this).val());
150
+ });
151
+
152
+
153
+ function wppbDisablePrivatePageOptions(value) {
154
+ if (value == 'no') {
155
+ jQuery('#private-website-redirect-to-login').closest('tr').addClass("wppb-disabled");
156
+ jQuery('#private-website-allowed-pages').closest('tr').addClass("wppb-disabled");
157
+ jQuery('#private-website-menu-hide').addClass("wppb-disabled");
158
+ }
159
+ else if (value == 'yes') {
160
+ jQuery('#private-website-redirect-to-login').closest('tr').removeClass("wppb-disabled");
161
+ jQuery('#private-website-allowed-pages').closest('tr').removeClass("wppb-disabled");
162
+ jQuery('#private-website-menu-hide').removeClass("wppb-disabled");
163
+ }
164
+ }
165
+ }
166
+ });
assets/js/select2/i18n/ar.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/az.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/bg.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ca.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/cs.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/da.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/de.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/el.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/en.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/es.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/et.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/eu.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/fa.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/fi.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/fr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/gl.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/he.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/hi.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/hr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/hu.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/id.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/is.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/it.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ja.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/km.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ko.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/lt.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/lv.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/mk.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ms.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/nb.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/nl.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/pl.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/pt-BR.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/pt.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ro.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+"sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+"sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/ru.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/sk.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/sr-Cyrl.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/sr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/sv.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/th.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/tr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/uk.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/vi.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/zh-CN.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/i18n/zh-TW.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})();
assets/js/select2/select2.min.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
2
- if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
3
  },e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
1
+ /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
2
+ if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
3
  },e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
assets/lib/Mustache/Autoloader.php CHANGED
@@ -1,75 +1,75 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache class autoloader.
14
- */
15
- class Mustache_Autoloader
16
- {
17
-
18
- private $baseDir;
19
-
20
- /**
21
- * Autoloader constructor.
22
- *
23
- * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
24
- */
25
- public function __construct($baseDir = null)
26
- {
27
- if ($baseDir === null) {
28
- $baseDir = dirname(__FILE__).'/..';
29
- }
30
-
31
- // realpath doesn't always work, for example, with stream URIs
32
- $realDir = realpath($baseDir);
33
- if (is_dir($realDir)) {
34
- $this->baseDir = $realDir;
35
- } else {
36
- $this->baseDir = $baseDir;
37
- }
38
- }
39
-
40
- /**
41
- * Register a new instance as an SPL autoloader.
42
- *
43
- * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
44
- *
45
- * @return Mustache_Autoloader Registered Autoloader instance
46
- */
47
- public static function register($baseDir = null)
48
- {
49
- $loader = new self($baseDir);
50
- spl_autoload_register(array($loader, 'autoload'));
51
-
52
- return $loader;
53
- }
54
-
55
- /**
56
- * Autoload Mustache classes.
57
- *
58
- * @param string $class
59
- */
60
- public function autoload($class)
61
- {
62
- if ($class[0] === '\\') {
63
- $class = substr($class, 1);
64
- }
65
-
66
- if (strpos($class, 'Mustache') !== 0) {
67
- return;
68
- }
69
-
70
- $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class));
71
- if (is_file($file)) {
72
- require $file;
73
- }
74
- }
75
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache class autoloader.
14
+ */
15
+ class Mustache_Autoloader
16
+ {
17
+
18
+ private $baseDir;
19
+
20
+ /**
21
+ * Autoloader constructor.
22
+ *
23
+ * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
24
+ */
25
+ public function __construct($baseDir = null)
26
+ {
27
+ if ($baseDir === null) {
28
+ $baseDir = dirname(__FILE__).'/..';
29
+ }
30
+
31
+ // realpath doesn't always work, for example, with stream URIs
32
+ $realDir = realpath($baseDir);
33
+ if (is_dir($realDir)) {
34
+ $this->baseDir = $realDir;
35
+ } else {
36
+ $this->baseDir = $baseDir;
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Register a new instance as an SPL autoloader.
42
+ *
43
+ * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
44
+ *
45
+ * @return Mustache_Autoloader Registered Autoloader instance
46
+ */
47
+ public static function register($baseDir = null)
48
+ {
49
+ $loader = new self($baseDir);
50
+ spl_autoload_register(array($loader, 'autoload'));
51
+
52
+ return $loader;
53
+ }
54
+
55
+ /**
56
+ * Autoload Mustache classes.
57
+ *
58
+ * @param string $class
59
+ */
60
+ public function autoload($class)
61
+ {
62
+ if ($class[0] === '\\') {
63
+ $class = substr($class, 1);
64
+ }
65
+
66
+ if (strpos($class, 'Mustache') !== 0) {
67
+ return;
68
+ }
69
+
70
+ $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class));
71
+ if (is_file($file)) {
72
+ require $file;
73
+ }
74
+ }
75
+ }
assets/lib/Mustache/Compiler.php CHANGED
@@ -1,476 +1,476 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Compiler class.
14
- *
15
- * This class is responsible for turning a Mustache token parse tree into normal PHP source code.
16
- */
17
- class Mustache_Compiler
18
- {
19
-
20
- private $sections;
21
- private $source;
22
- private $indentNextLine;
23
- private $customEscape;
24
- private $entityFlags;
25
- private $charset;
26
- private $strictCallables;
27
- private $pragmas;
28
-
29
- /**
30
- * Compile a Mustache token parse tree into PHP source code.
31
- *
32
- * @param string $source Mustache Template source code
33
- * @param string $tree Parse tree of Mustache tokens
34
- * @param string $name Mustache Template class name
35
- * @param bool $customEscape (default: false)
36
- * @param int $entityFlags (default: ENT_COMPAT)
37
- * @param string $charset (default: 'UTF-8')
38
- * @param bool $strictCallables (default: false)
39
- *
40
- * @return string Generated PHP source code
41
- */
42
- public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
43
- {
44
- $this->pragmas = array();
45
- $this->sections = array();
46
- $this->source = $source;
47
- $this->indentNextLine = true;
48
- $this->customEscape = $customEscape;
49
- $this->entityFlags = $entityFlags;
50
- $this->charset = $charset;
51
- $this->strictCallables = $strictCallables;
52
-
53
- return $this->writeCode($tree, $name);
54
- }
55
-
56
- /**
57
- * Helper function for walking the Mustache token parse tree.
58
- *
59
- * @throws Mustache_Exception_SyntaxException upon encountering unknown token types.
60
- *
61
- * @param array $tree Parse tree of Mustache tokens
62
- * @param int $level (default: 0)
63
- *
64
- * @return string Generated PHP source code
65
- */
66
- private function walk(array $tree, $level = 0)
67
- {
68
- $code = '';
69
- $level++;
70
- foreach ($tree as $node) {
71
- switch ($node[Mustache_Tokenizer::TYPE]) {
72
- case Mustache_Tokenizer::T_PRAGMA:
73
- $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true;
74
- break;
75
-
76
- case Mustache_Tokenizer::T_SECTION:
77
- $code .= $this->section(
78
- $node[Mustache_Tokenizer::NODES],
79
- $node[Mustache_Tokenizer::NAME],
80
- $node[Mustache_Tokenizer::INDEX],
81
- $node[Mustache_Tokenizer::END],
82
- $node[Mustache_Tokenizer::OTAG],
83
- $node[Mustache_Tokenizer::CTAG],
84
- $level
85
- );
86
- break;
87
-
88
- case Mustache_Tokenizer::T_INVERTED:
89
- $code .= $this->invertedSection(
90
- $node[Mustache_Tokenizer::NODES],
91
- $node[Mustache_Tokenizer::NAME],
92
- $level
93
- );
94
- break;
95
-
96
- case Mustache_Tokenizer::T_PARTIAL:
97
- case Mustache_Tokenizer::T_PARTIAL_2:
98
- $code .= $this->partial(
99
- $node[Mustache_Tokenizer::NAME],
100
- isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
101
- $level
102
- );
103
- break;
104
-
105
- case Mustache_Tokenizer::T_UNESCAPED:
106
- case Mustache_Tokenizer::T_UNESCAPED_2:
107
- $code .= $this->variable($node[Mustache_Tokenizer::NAME], false, $level);
108
- break;
109
-
110
- case Mustache_Tokenizer::T_COMMENT:
111
- break;
112
-
113
- case Mustache_Tokenizer::T_ESCAPED:
114
- $code .= $this->variable($node[Mustache_Tokenizer::NAME], true, $level);
115
- break;
116
-
117
- case Mustache_Tokenizer::T_TEXT:
118
- $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level);
119
- break;
120
-
121
- default:
122
- throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node);
123
- }
124
- }
125
-
126
- return $code;
127
- }
128
-
129
- const KLASS = '<?php
130
-
131
- class %s extends Mustache_Template
132
- {
133
- private $lambdaHelper;%s
134
-
135
- public function renderInternal(Mustache_Context $context, $indent = \'\')
136
- {
137
- $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
138
- $buffer = \'\';
139
- %s
140
-
141
- return $buffer;
142
- }
143
- %s
144
- }';
145
-
146
- const KLASS_NO_LAMBDAS = '<?php
147
-
148
- class %s extends Mustache_Template
149
- {%s
150
- public function renderInternal(Mustache_Context $context, $indent = \'\')
151
- {
152
- $buffer = \'\';
153
- %s
154
-
155
- return $buffer;
156
- }
157
- }';
158
-
159
- const STRICT_CALLABLE = 'protected $strictCallables = true;';
160
-
161
- /**
162
- * Generate Mustache Template class PHP source.
163
- *
164
- * @param array $tree Parse tree of Mustache tokens
165
- * @param string $name Mustache Template class name
166
- *
167
- * @return string Generated PHP source code
168
- */
169
- private function writeCode($tree, $name)
170
- {
171
- $code = $this->walk($tree);
172
- $sections = implode("\n", $this->sections);
173
- $klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS;
174
- $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';
175
-
176
- return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections);
177
- }
178
-
179
- const SECTION_CALL = '
180
- // %s section
181
- $buffer .= $this->section%s($context, $indent, $context->%s(%s));
182
- ';
183
-
184
- const SECTION = '
185
- private function section%s(Mustache_Context $context, $indent, $value)
186
- {
187
- $buffer = \'\';
188
- if (%s) {
189
- $source = %s;
190
- $buffer .= $this->mustache
191
- ->loadLambda((string) call_user_func($value, $source, $this->lambdaHelper)%s)
192
- ->renderInternal($context);
193
- } elseif (!empty($value)) {
194
- $values = $this->isIterable($value) ? $value : array($value);
195
- foreach ($values as $value) {
196
- $context->push($value);%s
197
- $context->pop();
198
- }
199
- }
200
-
201
- return $buffer;
202
- }';
203
-
204
- /**
205
- * Generate Mustache Template section PHP source.
206
- *
207
- * @param array $nodes Array of child tokens
208
- * @param string $id Section name
209
- * @param int $start Section start offset
210
- * @param int $end Section end offset
211
- * @param string $otag Current Mustache opening tag
212
- * @param string $ctag Current Mustache closing tag
213
- * @param int $level
214
- *
215
- * @return string Generated section PHP source code
216
- */
217
- private function section($nodes, $id, $start, $end, $otag, $ctag, $level)
218
- {
219
- $method = $this->getFindMethod($id);
220
- $id = var_export($id, true);
221
- $source = var_export(substr($this->source, $start, $end - $start), true);
222
- $callable = $this->getCallable();
223
-
224
- if ($otag !== '{{' || $ctag !== '}}') {
225
- $delims = ', '.var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
226
- } else {
227
- $delims = '';
228
- }
229
-
230
- $key = ucfirst(md5($delims."\n".$source));
231
-
232
- if (!isset($this->sections[$key])) {
233
- $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2));
234
- }
235
-
236
- return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $key, $method, $id);
237
- }
238
-
239
- const INVERTED_SECTION = '
240
- // %s inverted section
241
- $value = $context->%s(%s);
242
- if (empty($value)) {
243
- %s
244
- }';
245
-
246
- /**
247
- * Generate Mustache Template inverted section PHP source.
248
- *
249
- * @param array $nodes Array of child tokens
250
- * @param string $id Section name
251
- * @param int $level
252
- *
253
- * @return string Generated inverted section PHP source code
254
- */
255
- private function invertedSection($nodes, $id, $level)
256
- {
257
- $method = $this->getFindMethod($id);
258
- $id = var_export($id, true);
259
-
260
- return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $this->walk($nodes, $level));
261
- }
262
-
263
- const PARTIAL = '
264
- if ($partial = $this->mustache->loadPartial(%s)) {
265
- $buffer .= $partial->renderInternal($context, %s);
266
- }
267
- ';
268
-
269
- /**
270
- * Generate Mustache Template partial call PHP source.
271
- *
272
- * @param string $id Partial name
273
- * @param string $indent Whitespace indent to apply to partial
274
- * @param int $level
275
- *
276
- * @return string Generated partial call PHP source code
277
- */
278
- private function partial($id, $indent, $level)
279
- {
280
- return sprintf(
281
- $this->prepare(self::PARTIAL, $level),
282
- var_export($id, true),
283
- var_export($indent, true)
284
- );
285
- }
286
-
287
- const VARIABLE = '
288
- $value = $this->resolveValue($context->%s(%s), $context, $indent);%s
289
- $buffer .= %s%s;
290
- ';
291
-
292
- /**
293
- * Generate Mustache Template variable interpolation PHP source.
294
- *
295
- * @param string $id Variable name
296
- * @param boolean $escape Escape the variable value for output?
297
- * @param int $level
298
- *
299
- * @return string Generated variable interpolation PHP source
300
- */
301
- private function variable($id, $escape, $level)
302
- {
303
- $filters = '';
304
-
305
- if (isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS])) {
306
- list($id, $filters) = $this->getFilters($id, $level);
307
- }
308
-
309
- $method = $this->getFindMethod($id);
310
- $id = ($method !== 'last') ? var_export($id, true) : '';
311
- $value = $escape ? $this->getEscape() : '$value';
312
-
313
- return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value);
314
- }
315
-
316
- /**
317
- * Generate Mustache Template variable filtering PHP source.
318
- *
319
- * @param string $id Variable name
320
- * @param int $level
321
- *
322
- * @return string Generated variable filtering PHP source
323
- */
324
- private function getFilters($id, $level)
325
- {
326
- $filters = array_map('trim', explode('|', $id));
327
- $id = array_shift($filters);
328
-
329
- return array($id, $this->getFilter($filters, $level));
330
- }
331
-
332
- const FILTER = '
333
- $filter = $context->%s(%s);
334
- if (!(%s)) {
335
- throw new Mustache_Exception_UnknownFilterException(%s);
336
- }
337
- $value = call_user_func($filter, $value);%s
338
- ';
339
-
340
- /**
341
- * Generate PHP source for a single filter.
342
- *
343
- * @param array $filters
344
- * @param int $level
345
- *
346
- * @return string Generated filter PHP source
347
- */
348
- private function getFilter(array $filters, $level)
349
- {
350
- if (empty($filters)) {
351
- return '';
352
- }
353
-
354
- $name = array_shift($filters);
355
- $method = $this->getFindMethod($name);
356
- $filter = ($method !== 'last') ? var_export($name, true) : '';
357
- $callable = $this->getCallable('$filter');
358
- $msg = var_export($name, true);
359
-
360
- return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilter($filters, $level));
361
- }
362
-
363
- const LINE = '$buffer .= "\n";';
364
- const TEXT = '$buffer .= %s%s;';
365
-
366
- /**
367
- * Generate Mustache Template output Buffer call PHP source.
368
- *
369
- * @param string $text
370
- * @param int $level
371
- *
372
- * @return string Generated output Buffer call PHP source
373
- */
374
- private function text($text, $level)
375
- {
376
- $indentNextLine = (substr($text, -1) === "\n");
377
- $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
378
- $this->indentNextLine = $indentNextLine;
379
-
380
- return $code;
381
- }
382
-
383
- /**
384
- * Prepare PHP source code snippet for output.
385
- *
386
- * @param string $text
387
- * @param int $bonus Additional indent level (default: 0)
388
- * @param boolean $prependNewline Prepend a newline to the snippet? (default: true)
389
- * @param boolean $appendNewline Append a newline to the snippet? (default: false)
390
- *
391
- * @return string PHP source code snippet
392
- */
393
- private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
394
- {
395
- $text = ($prependNewline ? "\n" : '').trim($text);
396
- if ($prependNewline) {
397
- $bonus++;
398
- }
399
- if ($appendNewline) {
400
- $text .= "\n";
401
- }
402
-
403
- return preg_replace("/\n( {8})?/", "\n".str_repeat(" ", $bonus * 4), $text);
404
- }
405
-
406
- const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
407
- const CUSTOM_ESCAPE = 'call_user_func($this->mustache->getEscape(), %s)';
408
-
409
- /**
410
- * Get the current escaper.
411
- *
412
- * @param string $value (default: '$value')
413
- *
414
- * @return string Either a custom callback, or an inline call to `htmlspecialchars`
415
- */
416
- private function getEscape($value = '$value')
417
- {
418
- if ($this->customEscape) {
419
- return sprintf(self::CUSTOM_ESCAPE, $value);
420
- } else {
421
- return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
422
- }
423
- }
424
-
425
- /**
426
- * Select the appropriate Context `find` method for a given $id.
427
- *
428
- * The return value will be one of `find`, `findDot` or `last`.
429
- *
430
- * @see Mustache_Context::find
431
- * @see Mustache_Context::findDot
432
- * @see Mustache_Context::last
433
- *
434
- * @param string $id Variable name
435
- *
436
- * @return string `find` method name
437
- */
438
- private function getFindMethod($id)
439
- {
440
- if ($id === '.') {
441
- return 'last';
442
- } elseif (strpos($id, '.') === false) {
443
- return 'find';
444
- } else {
445
- return 'findDot';
446
- }
447
- }
448
-
449
- const IS_CALLABLE = '!is_string(%s) && is_callable(%s)';
450
- const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)';
451
-
452
- private function getCallable($variable = '$value')
453
- {
454
- $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
455
-
456
- return sprintf($tpl, $variable, $variable);
457
- }
458
-
459
- const LINE_INDENT = '$indent . ';
460
-
461
- /**
462
- * Get the current $indent prefix to write to the buffer.
463
- *
464
- * @return string "$indent . " or ""
465
- */
466
- private function flushIndent()
467
- {
468
- if (!$this->indentNextLine) {
469
- return '';
470
- }
471
-
472
- $this->indentNextLine = false;
473
-
474
- return self::LINE_INDENT;
475
- }
476
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Compiler class.
14
+ *
15
+ * This class is responsible for turning a Mustache token parse tree into normal PHP source code.
16
+ */
17
+ class Mustache_Compiler
18
+ {
19
+
20
+ private $sections;
21
+ private $source;
22
+ private $indentNextLine;
23
+ private $customEscape;
24
+ private $entityFlags;
25
+ private $charset;
26
+ private $strictCallables;
27
+ private $pragmas;
28
+
29
+ /**
30
+ * Compile a Mustache token parse tree into PHP source code.
31
+ *
32
+ * @param string $source Mustache Template source code
33
+ * @param string $tree Parse tree of Mustache tokens
34
+ * @param string $name Mustache Template class name
35
+ * @param bool $customEscape (default: false)
36
+ * @param int $entityFlags (default: ENT_COMPAT)
37
+ * @param string $charset (default: 'UTF-8')
38
+ * @param bool $strictCallables (default: false)
39
+ *
40
+ * @return string Generated PHP source code
41
+ */
42
+ public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
43
+ {
44
+ $this->pragmas = array();
45
+ $this->sections = array();
46
+ $this->source = $source;
47
+ $this->indentNextLine = true;
48
+ $this->customEscape = $customEscape;
49
+ $this->entityFlags = $entityFlags;
50
+ $this->charset = $charset;
51
+ $this->strictCallables = $strictCallables;
52
+
53
+ return $this->writeCode($tree, $name);
54
+ }
55
+
56
+ /**
57
+ * Helper function for walking the Mustache token parse tree.
58
+ *
59
+ * @throws Mustache_Exception_SyntaxException upon encountering unknown token types.
60
+ *
61
+ * @param array $tree Parse tree of Mustache tokens
62
+ * @param int $level (default: 0)
63
+ *
64
+ * @return string Generated PHP source code
65
+ */
66
+ private function walk(array $tree, $level = 0)
67
+ {
68
+ $code = '';
69
+ $level++;
70
+ foreach ($tree as $node) {
71
+ switch ($node[Mustache_Tokenizer::TYPE]) {
72
+ case Mustache_Tokenizer::T_PRAGMA:
73
+ $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true;
74
+ break;
75
+
76
+ case Mustache_Tokenizer::T_SECTION:
77
+ $code .= $this->section(
78
+ $node[Mustache_Tokenizer::NODES],
79
+ $node[Mustache_Tokenizer::NAME],
80
+ $node[Mustache_Tokenizer::INDEX],
81
+ $node[Mustache_Tokenizer::END],
82
+ $node[Mustache_Tokenizer::OTAG],
83
+ $node[Mustache_Tokenizer::CTAG],
84
+ $level
85
+ );
86
+ break;
87
+
88
+ case Mustache_Tokenizer::T_INVERTED:
89
+ $code .= $this->invertedSection(
90
+ $node[Mustache_Tokenizer::NODES],
91
+ $node[Mustache_Tokenizer::NAME],
92
+ $level
93
+ );
94
+ break;
95
+
96
+ case Mustache_Tokenizer::T_PARTIAL:
97
+ case Mustache_Tokenizer::T_PARTIAL_2:
98
+ $code .= $this->partial(
99
+ $node[Mustache_Tokenizer::NAME],
100
+ isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
101
+ $level
102
+ );
103
+ break;
104
+
105
+ case Mustache_Tokenizer::T_UNESCAPED:
106
+ case Mustache_Tokenizer::T_UNESCAPED_2:
107
+ $code .= $this->variable($node[Mustache_Tokenizer::NAME], false, $level);
108
+ break;
109
+
110
+ case Mustache_Tokenizer::T_COMMENT:
111
+ break;
112
+
113
+ case Mustache_Tokenizer::T_ESCAPED:
114
+ $code .= $this->variable($node[Mustache_Tokenizer::NAME], true, $level);
115
+ break;
116
+
117
+ case Mustache_Tokenizer::T_TEXT:
118
+ $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level);
119
+ break;
120
+
121
+ default:
122
+ throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node);
123
+ }
124
+ }
125
+
126
+ return $code;
127
+ }
128
+
129
+ const KLASS = '<?php
130
+
131
+ class %s extends Mustache_Template
132
+ {
133
+ private $lambdaHelper;%s
134
+
135
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
136
+ {
137
+ $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
138
+ $buffer = \'\';
139
+ %s
140
+
141
+ return $buffer;
142
+ }
143
+ %s
144
+ }';
145
+
146
+ const KLASS_NO_LAMBDAS = '<?php
147
+
148
+ class %s extends Mustache_Template
149
+ {%s
150
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
151
+ {
152
+ $buffer = \'\';
153
+ %s
154
+
155
+ return $buffer;
156
+ }
157
+ }';
158
+
159
+ const STRICT_CALLABLE = 'protected $strictCallables = true;';
160
+
161
+ /**
162
+ * Generate Mustache Template class PHP source.
163
+ *
164
+ * @param array $tree Parse tree of Mustache tokens
165
+ * @param string $name Mustache Template class name
166
+ *
167
+ * @return string Generated PHP source code
168
+ */
169
+ private function writeCode($tree, $name)
170
+ {
171
+ $code = $this->walk($tree);
172
+ $sections = implode("\n", $this->sections);
173
+ $klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS;
174
+ $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';
175
+
176
+ return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections);
177
+ }
178
+
179
+ const SECTION_CALL = '
180
+ // %s section
181
+ $buffer .= $this->section%s($context, $indent, $context->%s(%s));
182
+ ';
183
+
184
+ const SECTION = '
185
+ private function section%s(Mustache_Context $context, $indent, $value)
186
+ {
187
+ $buffer = \'\';
188
+ if (%s) {
189
+ $source = %s;
190
+ $buffer .= $this->mustache
191
+ ->loadLambda((string) call_user_func($value, $source, $this->lambdaHelper)%s)
192
+ ->renderInternal($context);
193
+ } elseif (!empty($value)) {
194
+ $values = $this->isIterable($value) ? $value : array($value);
195
+ foreach ($values as $value) {
196
+ $context->push($value);%s
197
+ $context->pop();
198
+ }
199
+ }
200
+
201
+ return $buffer;
202
+ }';
203
+
204
+ /**
205
+ * Generate Mustache Template section PHP source.
206
+ *
207
+ * @param array $nodes Array of child tokens
208
+ * @param string $id Section name
209
+ * @param int $start Section start offset
210
+ * @param int $end Section end offset
211
+ * @param string $otag Current Mustache opening tag
212
+ * @param string $ctag Current Mustache closing tag
213
+ * @param int $level
214
+ *
215
+ * @return string Generated section PHP source code
216
+ */
217
+ private function section($nodes, $id, $start, $end, $otag, $ctag, $level)
218
+ {
219
+ $method = $this->getFindMethod($id);
220
+ $id = var_export($id, true);
221
+ $source = var_export(substr($this->source, $start, $end - $start), true);
222
+ $callable = $this->getCallable();
223
+
224
+ if ($otag !== '{{' || $ctag !== '}}') {
225
+ $delims = ', '.var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
226
+ } else {
227
+ $delims = '';
228
+ }
229
+
230
+ $key = ucfirst(md5($delims."\n".$source));
231
+
232
+ if (!isset($this->sections[$key])) {
233
+ $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2));
234
+ }
235
+
236
+ return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $key, $method, $id);
237
+ }
238
+
239
+ const INVERTED_SECTION = '
240
+ // %s inverted section
241
+ $value = $context->%s(%s);
242
+ if (empty($value)) {
243
+ %s
244
+ }';
245
+
246
+ /**
247
+ * Generate Mustache Template inverted section PHP source.
248
+ *
249
+ * @param array $nodes Array of child tokens
250
+ * @param string $id Section name
251
+ * @param int $level
252
+ *
253
+ * @return string Generated inverted section PHP source code
254
+ */
255
+ private function invertedSection($nodes, $id, $level)
256
+ {
257
+ $method = $this->getFindMethod($id);
258
+ $id = var_export($id, true);
259
+
260
+ return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $this->walk($nodes, $level));
261
+ }
262
+
263
+ const PARTIAL = '
264
+ if ($partial = $this->mustache->loadPartial(%s)) {
265
+ $buffer .= $partial->renderInternal($context, %s);
266
+ }
267
+ ';
268
+
269
+ /**
270
+ * Generate Mustache Template partial call PHP source.
271
+ *
272
+ * @param string $id Partial name
273
+ * @param string $indent Whitespace indent to apply to partial
274
+ * @param int $level
275
+ *
276
+ * @return string Generated partial call PHP source code
277
+ */
278
+ private function partial($id, $indent, $level)
279
+ {
280
+ return sprintf(
281
+ $this->prepare(self::PARTIAL, $level),
282
+ var_export($id, true),
283
+ var_export($indent, true)
284
+ );
285
+ }
286
+
287
+ const VARIABLE = '
288
+ $value = $this->resolveValue($context->%s(%s), $context, $indent);%s
289
+ $buffer .= %s%s;
290
+ ';
291
+
292
+ /**
293
+ * Generate Mustache Template variable interpolation PHP source.
294
+ *
295
+ * @param string $id Variable name
296
+ * @param boolean $escape Escape the variable value for output?
297
+ * @param int $level
298
+ *
299
+ * @return string Generated variable interpolation PHP source
300
+ */
301
+ private function variable($id, $escape, $level)
302
+ {
303
+ $filters = '';
304
+
305
+ if (isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS])) {
306
+ list($id, $filters) = $this->getFilters($id, $level);
307
+ }
308
+
309
+ $method = $this->getFindMethod($id);
310
+ $id = ($method !== 'last') ? var_export($id, true) : '';
311
+ $value = $escape ? $this->getEscape() : '$value';
312
+
313
+ return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value);
314
+ }
315
+
316
+ /**
317
+ * Generate Mustache Template variable filtering PHP source.
318
+ *
319
+ * @param string $id Variable name
320
+ * @param int $level
321
+ *
322
+ * @return string Generated variable filtering PHP source
323
+ */
324
+ private function getFilters($id, $level)
325
+ {
326
+ $filters = array_map('trim', explode('|', $id));
327
+ $id = array_shift($filters);
328
+
329
+ return array($id, $this->getFilter($filters, $level));
330
+ }
331
+
332
+ const FILTER = '
333
+ $filter = $context->%s(%s);
334
+ if (!(%s)) {
335
+ throw new Mustache_Exception_UnknownFilterException(%s);
336
+ }
337
+ $value = call_user_func($filter, $value);%s
338
+ ';
339
+
340
+ /**
341
+ * Generate PHP source for a single filter.
342
+ *
343
+ * @param array $filters
344
+ * @param int $level
345
+ *
346
+ * @return string Generated filter PHP source
347
+ */
348
+ private function getFilter(array $filters, $level)
349
+ {
350
+ if (empty($filters)) {
351
+ return '';
352
+ }
353
+
354
+ $name = array_shift($filters);
355
+ $method = $this->getFindMethod($name);
356
+ $filter = ($method !== 'last') ? var_export($name, true) : '';
357
+ $callable = $this->getCallable('$filter');
358
+ $msg = var_export($name, true);
359
+
360
+ return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilter($filters, $level));
361
+ }
362
+
363
+ const LINE = '$buffer .= "\n";';
364
+ const TEXT = '$buffer .= %s%s;';
365
+
366
+ /**
367
+ * Generate Mustache Template output Buffer call PHP source.
368
+ *
369
+ * @param string $text
370
+ * @param int $level
371
+ *
372
+ * @return string Generated output Buffer call PHP source
373
+ */
374
+ private function text($text, $level)
375
+ {
376
+ $indentNextLine = (substr($text, -1) === "\n");
377
+ $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
378
+ $this->indentNextLine = $indentNextLine;
379
+
380
+ return $code;
381
+ }
382
+
383
+ /**
384
+ * Prepare PHP source code snippet for output.
385
+ *
386
+ * @param string $text
387
+ * @param int $bonus Additional indent level (default: 0)
388
+ * @param boolean $prependNewline Prepend a newline to the snippet? (default: true)
389
+ * @param boolean $appendNewline Append a newline to the snippet? (default: false)
390
+ *
391
+ * @return string PHP source code snippet
392
+ */
393
+ private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
394
+ {
395
+ $text = ($prependNewline ? "\n" : '').trim($text);
396
+ if ($prependNewline) {
397
+ $bonus++;
398
+ }
399
+ if ($appendNewline) {
400
+ $text .= "\n";
401
+ }
402
+
403
+ return preg_replace("/\n( {8})?/", "\n".str_repeat(" ", $bonus * 4), $text);
404
+ }
405
+
406
+ const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
407
+ const CUSTOM_ESCAPE = 'call_user_func($this->mustache->getEscape(), %s)';
408
+
409
+ /**
410
+ * Get the current escaper.
411
+ *
412
+ * @param string $value (default: '$value')
413
+ *
414
+ * @return string Either a custom callback, or an inline call to `htmlspecialchars`
415
+ */
416
+ private function getEscape($value = '$value')
417
+ {
418
+ if ($this->customEscape) {
419
+ return sprintf(self::CUSTOM_ESCAPE, $value);
420
+ } else {
421
+ return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
422
+ }
423
+ }
424
+
425
+ /**
426
+ * Select the appropriate Context `find` method for a given $id.
427
+ *
428
+ * The return value will be one of `find`, `findDot` or `last`.
429
+ *
430
+ * @see Mustache_Context::find
431
+ * @see Mustache_Context::findDot
432
+ * @see Mustache_Context::last
433
+ *
434
+ * @param string $id Variable name
435
+ *
436
+ * @return string `find` method name
437
+ */
438
+ private function getFindMethod($id)
439
+ {
440
+ if ($id === '.') {
441
+ return 'last';
442
+ } elseif (strpos($id, '.') === false) {
443
+ return 'find';
444
+ } else {
445
+ return 'findDot';
446
+ }
447
+ }
448
+
449
+ const IS_CALLABLE = '!is_string(%s) && is_callable(%s)';
450
+ const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)';
451
+
452
+ private function getCallable($variable = '$value')
453
+ {
454
+ $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
455
+
456
+ return sprintf($tpl, $variable, $variable);
457
+ }
458
+
459
+ const LINE_INDENT = '$indent . ';
460
+
461
+ /**
462
+ * Get the current $indent prefix to write to the buffer.
463
+ *
464
+ * @return string "$indent . " or ""
465
+ */
466
+ private function flushIndent()
467
+ {
468
+ if (!$this->indentNextLine) {
469
+ return '';
470
+ }
471
+
472
+ $this->indentNextLine = false;
473
+
474
+ return self::LINE_INDENT;
475
+ }
476
+ }
assets/lib/Mustache/Context.php CHANGED
@@ -1,149 +1,149 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template rendering Context.
14
- */
15
- class Mustache_Context
16
- {
17
- private $stack = array();
18
-
19
- /**
20
- * Mustache rendering Context constructor.
21
- *
22
- * @param mixed $context Default rendering context (default: null)
23
- */
24
- public function __construct($context = null)
25
- {
26
- if ($context !== null) {
27
- $this->stack = array($context);
28
- }
29
- }
30
-
31
- /**
32
- * Push a new Context frame onto the stack.
33
- *
34
- * @param mixed $value Object or array to use for context
35
- */
36
- public function push($value)
37
- {
38
- array_push($this->stack, $value);
39
- }
40
-
41
- /**
42
- * Pop the last Context frame from the stack.
43
- *
44
- * @return mixed Last Context frame (object or array)
45
- */
46
- public function pop()
47
- {
48
- return array_pop($this->stack);
49
- }
50
-
51
- /**
52
- * Get the last Context frame.
53
- *
54
- * @return mixed Last Context frame (object or array)
55
- */
56
- public function last()
57
- {
58
- return end($this->stack);
59
- }
60
-
61
- /**
62
- * Find a variable in the Context stack.
63
- *
64
- * Starting with the last Context frame (the context of the innermost section), and working back to the top-level
65
- * rendering context, look for a variable with the given name:
66
- *
67
- * * If the Context frame is an associative array which contains the key $id, returns the value of that element.
68
- * * If the Context frame is an object, this will check first for a public method, then a public property named
69
- * $id. Failing both of these, it will try `__isset` and `__get` magic methods.
70
- * * If a value named $id is not found in any Context frame, returns an empty string.
71
- *
72
- * @param string $id Variable name
73
- *
74
- * @return mixed Variable value, or '' if not found
75
- */
76
- public function find($id)
77
- {
78
- return $this->findVariableInStack($id, $this->stack);
79
- }
80
-
81
- /**
82
- * Find a 'dot notation' variable in the Context stack.
83
- *
84
- * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding
85
- * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous
86
- * result. For example, given the following context stack:
87
- *
88
- * $data = array(
89
- * 'name' => 'Fred',
90
- * 'child' => array(
91
- * 'name' => 'Bob'
92
- * ),
93
- * );
94
- *
95
- * ... and the Mustache following template:
96
- *
97
- * {{ child.name }}
98
- *
99
- * ... the `name` value is only searched for within the `child` value of the global Context, not within parent
100
- * Context frames.
101
- *
102
- * @param string $id Dotted variable selector
103
- *
104
- * @return mixed Variable value, or '' if not found
105
- */
106
- public function findDot($id)
107
- {
108
- $chunks = explode('.', $id);
109
- $first = array_shift($chunks);
110
- $value = $this->findVariableInStack($first, $this->stack);
111
-
112
- foreach ($chunks as $chunk) {
113
- if ($value === '') {
114
- return $value;
115
- }
116
-
117
- $value = $this->findVariableInStack($chunk, array($value));
118
- }
119
-
120
- return $value;
121
- }
122
-
123
- /**
124
- * Helper function to find a variable in the Context stack.
125
- *
126
- * @see Mustache_Context::find
127
- *
128
- * @param string $id Variable name
129
- * @param array $stack Context stack
130
- *
131
- * @return mixed Variable value, or '' if not found
132
- */
133
- private function findVariableInStack($id, array $stack)
134
- {
135
- for ($i = count($stack) - 1; $i >= 0; $i--) {
136
- if (is_object($stack[$i]) && !$stack[$i] instanceof Closure) {
137
- if (method_exists($stack[$i], $id)) {
138
- return $stack[$i]->$id();
139
- } elseif (isset($stack[$i]->$id)) {
140
- return $stack[$i]->$id;
141
- }
142
- } elseif (is_array($stack[$i]) && array_key_exists($id, $stack[$i])) {
143
- return $stack[$i][$id];
144
- }
145
- }
146
-
147
- return '';
148
- }
149
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template rendering Context.
14
+ */
15
+ class Mustache_Context
16
+ {
17
+ private $stack = array();
18
+
19
+ /**
20
+ * Mustache rendering Context constructor.
21
+ *
22
+ * @param mixed $context Default rendering context (default: null)
23
+ */
24
+ public function __construct($context = null)
25
+ {
26
+ if ($context !== null) {
27
+ $this->stack = array($context);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Push a new Context frame onto the stack.
33
+ *
34
+ * @param mixed $value Object or array to use for context
35
+ */
36
+ public function push($value)
37
+ {
38
+ array_push($this->stack, $value);
39
+ }
40
+
41
+ /**
42
+ * Pop the last Context frame from the stack.
43
+ *
44
+ * @return mixed Last Context frame (object or array)
45
+ */
46
+ public function pop()
47
+ {
48
+ return array_pop($this->stack);
49
+ }
50
+
51
+ /**
52
+ * Get the last Context frame.
53
+ *
54
+ * @return mixed Last Context frame (object or array)
55
+ */
56
+ public function last()
57
+ {
58
+ return end($this->stack);
59
+ }
60
+
61
+ /**
62
+ * Find a variable in the Context stack.
63
+ *
64
+ * Starting with the last Context frame (the context of the innermost section), and working back to the top-level
65
+ * rendering context, look for a variable with the given name:
66
+ *
67
+ * * If the Context frame is an associative array which contains the key $id, returns the value of that element.
68
+ * * If the Context frame is an object, this will check first for a public method, then a public property named
69
+ * $id. Failing both of these, it will try `__isset` and `__get` magic methods.
70
+ * * If a value named $id is not found in any Context frame, returns an empty string.
71
+ *
72
+ * @param string $id Variable name
73
+ *
74
+ * @return mixed Variable value, or '' if not found
75
+ */
76
+ public function find($id)
77
+ {
78
+ return $this->findVariableInStack($id, $this->stack);
79
+ }
80
+
81
+ /**
82
+ * Find a 'dot notation' variable in the Context stack.
83
+ *
84
+ * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding
85
+ * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous
86
+ * result. For example, given the following context stack:
87
+ *
88
+ * $data = array(
89
+ * 'name' => 'Fred',
90
+ * 'child' => array(
91
+ * 'name' => 'Bob'
92
+ * ),
93
+ * );
94
+ *
95
+ * ... and the Mustache following template:
96
+ *
97
+ * {{ child.name }}
98
+ *
99
+ * ... the `name` value is only searched for within the `child` value of the global Context, not within parent
100
+ * Context frames.
101
+ *
102
+ * @param string $id Dotted variable selector
103
+ *
104
+ * @return mixed Variable value, or '' if not found
105
+ */
106
+ public function findDot($id)
107
+ {
108
+ $chunks = explode('.', $id);
109
+ $first = array_shift($chunks);
110
+ $value = $this->findVariableInStack($first, $this->stack);
111
+
112
+ foreach ($chunks as $chunk) {
113
+ if ($value === '') {
114
+ return $value;
115
+ }
116
+
117
+ $value = $this->findVariableInStack($chunk, array($value));
118
+ }
119
+
120
+ return $value;
121
+ }
122
+
123
+ /**
124
+ * Helper function to find a variable in the Context stack.
125
+ *
126
+ * @see Mustache_Context::find
127
+ *
128
+ * @param string $id Variable name
129
+ * @param array $stack Context stack
130
+ *
131
+ * @return mixed Variable value, or '' if not found
132
+ */
133
+ private function findVariableInStack($id, array $stack)
134
+ {
135
+ for ($i = count($stack) - 1; $i >= 0; $i--) {
136
+ if (is_object($stack[$i]) && !$stack[$i] instanceof Closure) {
137
+ if (method_exists($stack[$i], $id)) {
138
+ return $stack[$i]->$id();
139
+ } elseif (isset($stack[$i]->$id)) {
140
+ return $stack[$i]->$id;
141
+ }
142
+ } elseif (is_array($stack[$i]) && array_key_exists($id, $stack[$i])) {
143
+ return $stack[$i][$id];
144
+ }
145
+ }
146
+
147
+ return '';
148
+ }
149
+ }
assets/lib/Mustache/Engine.php CHANGED
@@ -1,748 +1,748 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A Mustache implementation in PHP.
14
- *
15
- * {@link http://defunkt.github.com/mustache}
16
- *
17
- * Mustache is a framework-agnostic logic-less templating language. It enforces separation of view
18
- * logic from template files. In fact, it is not even possible to embed logic in the template.
19
- *
20
- * This is very, very rad.
21
- *
22
- * @author Justin Hileman {@link http://justinhileman.com}
23
- */
24
- class Mustache_Engine
25
- {
26
- const VERSION = '2.4.1';
27
- const SPEC_VERSION = '1.1.2';
28
-
29
- const PRAGMA_FILTERS = 'FILTERS';
30
-
31
- // Template cache
32
- private $templates = array();
33
-
34
- // Environment
35
- private $templateClassPrefix = '__Mustache_';
36
- private $cache = null;
37
- private $cacheFileMode = null;
38
- private $loader;
39
- private $partialsLoader;
40
- private $helpers;
41
- private $escape;
42
- private $entityFlags = ENT_COMPAT;
43
- private $charset = 'UTF-8';
44
- private $logger;
45
- private $strictCallables = false;
46
-
47
- /**
48
- * Mustache class constructor.
49
- *
50
- * Passing an $options array allows overriding certain Mustache options during instantiation:
51
- *
52
- * $options = array(
53
- * // The class prefix for compiled templates. Defaults to '__Mustache_'.
54
- * 'template_class_prefix' => '__MyTemplates_',
55
- *
56
- * // A cache directory for compiled templates. Mustache will not cache templates unless this is set
57
- * 'cache' => dirname(__FILE__).'/tmp/cache/mustache',
58
- *
59
- * // Override default permissions for cache files. Defaults to using the system-defined umask. It is
60
- * // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
61
- * 'cache_file_mode' => 0666,
62
- *
63
- * // A Mustache template loader instance. Uses a StringLoader if not specified.
64
- * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
65
- *
66
- * // A Mustache loader instance for partials.
67
- * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
68
- *
69
- * // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as
70
- * // efficient or lazy as a Filesystem (or database) loader.
71
- * 'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')),
72
- *
73
- * // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order
74
- * // sections), or any other valid Mustache context value. They will be prepended to the context stack,
75
- * // so they will be available in any template loaded by this Mustache instance.
76
- * 'helpers' => array('i18n' => function($text) {
77
- * // do something translatey here...
78
- * }),
79
- *
80
- * // An 'escape' callback, responsible for escaping double-mustache variables.
81
- * 'escape' => function($value) {
82
- * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
83
- * },
84
- *
85
- * // Type argument for `htmlspecialchars`. Defaults to ENT_COMPAT. You may prefer ENT_QUOTES.
86
- * 'entity_flags' => ENT_QUOTES,
87
- *
88
- * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'.
89
- * 'charset' => 'ISO-8859-1',
90
- *
91
- * // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible
92
- * // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is
93
- * // available as well:
94
- * 'logger' => new Mustache_Logger_StreamLogger('php://stderr'),
95
- *
96
- * // Only treat Closure instances and invokable classes as callable. If true, values like
97
- * // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally
98
- * // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This
99
- * // helps protect against arbitrary code execution when user input is passed directly into the template.
100
- * // This currently defaults to false, but will default to true in v3.0.
101
- * 'strict_callables' => true,
102
- * );
103
- *
104
- * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable.
105
- *
106
- * @param array $options (default: array())
107
- */
108
- public function __construct(array $options = array())
109
- {
110
- if (isset($options['template_class_prefix'])) {
111
- $this->templateClassPrefix = $options['template_class_prefix'];
112
- }
113
-
114
- if (isset($options['cache'])) {
115
- $this->cache = $options['cache'];
116
- }
117
-
118
- if (isset($options['cache_file_mode'])) {
119
- $this->cacheFileMode = $options['cache_file_mode'];
120
- }
121
-
122
- if (isset($options['loader'])) {
123
- $this->setLoader($options['loader']);
124
- }
125
-
126
- if (isset($options['partials_loader'])) {
127
- $this->setPartialsLoader($options['partials_loader']);
128
- }
129
-
130
- if (isset($options['partials'])) {
131
- $this->setPartials($options['partials']);
132
- }
133
-
134
- if (isset($options['helpers'])) {
135
- $this->setHelpers($options['helpers']);
136
- }
137
-
138
- if (isset($options['escape'])) {
139
- if (!is_callable($options['escape'])) {
140
- throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable');
141
- }
142
-
143
- $this->escape = $options['escape'];
144
- }
145
-
146
- if (isset($options['entity_flags'])) {
147
- $this->entityFlags = $options['entity_flags'];
148
- }
149
-
150
- if (isset($options['charset'])) {
151
- $this->charset = $options['charset'];
152
- }
153
-
154
- if (isset($options['logger'])) {
155
- $this->setLogger($options['logger']);
156
- }
157
-
158
- if (isset($options['strict_callables'])) {
159
- $this->strictCallables = $options['strict_callables'];
160
- }
161
- }
162
-
163
- /**
164
- * Shortcut 'render' invocation.
165
- *
166
- * Equivalent to calling `$mustache->loadTemplate($template)->render($context);`
167
- *
168
- * @see Mustache_Engine::loadTemplate
169
- * @see Mustache_Template::render
170
- *
171
- * @param string $template
172
- * @param mixed $context (default: array())
173
- *
174
- * @return string Rendered template
175
- */
176
- public function render($template, $context = array())
177
- {
178
- return $this->loadTemplate($template)->render($context);
179
- }
180
-
181
- /**
182
- * Get the current Mustache escape callback.
183
- *
184
- * @return mixed Callable or null
185
- */
186
- public function getEscape()
187
- {
188
- return $this->escape;
189
- }
190
-
191
- /**
192
- * Get the current Mustache entitity type to escape.
193
- *
194
- * @return int
195
- */
196
- public function getEntityFlags()
197
- {
198
- return $this->entityFlags;
199
- }
200
-
201
- /**
202
- * Get the current Mustache character set.
203
- *
204
- * @return string
205
- */
206
- public function getCharset()
207
- {
208
- return $this->charset;
209
- }
210
-
211
- /**
212
- * Set the Mustache template Loader instance.
213
- *
214
- * @param Mustache_Loader $loader
215
- */
216
- public function setLoader(Mustache_Loader $loader)
217
- {
218
- $this->loader = $loader;
219
- }
220
-
221
- /**
222
- * Get the current Mustache template Loader instance.
223
- *
224
- * If no Loader instance has been explicitly specified, this method will instantiate and return
225
- * a StringLoader instance.
226
- *
227
- * @return Mustache_Loader
228
- */
229
- public function getLoader()
230
- {
231
- if (!isset($this->loader)) {
232
- $this->loader = new Mustache_Loader_StringLoader;
233
- }
234
-
235
- return $this->loader;
236
- }
237
-
238
- /**
239
- * Set the Mustache partials Loader instance.
240
- *
241
- * @param Mustache_Loader $partialsLoader
242
- */
243
- public function setPartialsLoader(Mustache_Loader $partialsLoader)
244
- {
245
- $this->partialsLoader = $partialsLoader;
246
- }
247
-
248
- /**
249
- * Get the current Mustache partials Loader instance.
250
- *
251
- * If no Loader instance has been explicitly specified, this method will instantiate and return
252
- * an ArrayLoader instance.
253
- *
254
- * @return Mustache_Loader
255
- */
256
- public function getPartialsLoader()
257
- {
258
- if (!isset($this->partialsLoader)) {
259
- $this->partialsLoader = new Mustache_Loader_ArrayLoader;
260
- }
261
-
262
- return $this->partialsLoader;
263
- }
264
-
265
- /**
266
- * Set partials for the current partials Loader instance.
267
- *
268
- * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable
269
- *
270
- * @param array $partials (default: array())
271
- */
272
- public function setPartials(array $partials = array())
273
- {
274
- if (!isset($this->partialsLoader)) {
275
- $this->partialsLoader = new Mustache_Loader_ArrayLoader;
276
- }
277
-
278
- if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
279
- throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
280
- }
281
-
282
- $this->partialsLoader->setTemplates($partials);
283
- }
284
-
285
- /**
286
- * Set an array of Mustache helpers.
287
- *
288
- * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or
289
- * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in
290
- * any template loaded by this Mustache instance.
291
- *
292
- * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable
293
- *
294
- * @param array|Traversable $helpers
295
- */
296
- public function setHelpers($helpers)
297
- {
298
- if (!is_array($helpers) && !$helpers instanceof Traversable) {
299
- throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
300
- }
301
-
302
- $this->getHelpers()->clear();
303
-
304
- foreach ($helpers as $name => $helper) {
305
- $this->addHelper($name, $helper);
306
- }
307
- }
308
-
309
- /**
310
- * Get the current set of Mustache helpers.
311
- *
312
- * @see Mustache_Engine::setHelpers
313
- *
314
- * @return Mustache_HelperCollection
315
- */
316
- public function getHelpers()
317
- {
318
- if (!isset($this->helpers)) {
319
- $this->helpers = new Mustache_HelperCollection;
320
- }
321
-
322
- return $this->helpers;
323
- }
324
-
325
- /**
326
- * Add a new Mustache helper.
327
- *
328
- * @see Mustache_Engine::setHelpers
329
- *
330
- * @param string $name
331
- * @param mixed $helper
332
- */
333
- public function addHelper($name, $helper)
334
- {
335
- $this->getHelpers()->add($name, $helper);
336
- }
337
-
338
- /**
339
- * Get a Mustache helper by name.
340
- *
341
- * @see Mustache_Engine::setHelpers
342
- *
343
- * @param string $name
344
- *
345
- * @return mixed Helper
346
- */
347
- public function getHelper($name)
348
- {
349
- return $this->getHelpers()->get($name);
350
- }
351
-
352
- /**
353
- * Check whether this Mustache instance has a helper.
354
- *
355
- * @see Mustache_Engine::setHelpers
356
- *
357
- * @param string $name
358
- *
359
- * @return boolean True if the helper is present
360
- */
361
- public function hasHelper($name)
362
- {
363
- return $this->getHelpers()->has($name);
364
- }
365
-
366
- /**
367
- * Remove a helper by name.
368
- *
369
- * @see Mustache_Engine::setHelpers
370
- *
371
- * @param string $name
372
- */
373
- public function removeHelper($name)
374
- {
375
- $this->getHelpers()->remove($name);
376
- }
377
-
378
- /**
379
- * Set the Mustache Logger instance.
380
- *
381
- * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface.
382
- *
383
- * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
384
- */
385
- public function setLogger($logger = null)
386
- {
387
- if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
388
- throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
389
- }
390
-
391
- $this->logger = $logger;
392
- }
393
-
394
- /**
395
- * Get the current Mustache Logger instance.
396
- *
397
- * @return Mustache_Logger|Psr\Log\LoggerInterface
398
- */
399
- public function getLogger()
400
- {
401
- return $this->logger;
402
- }
403
-
404
- /**
405
- * Set the Mustache Tokenizer instance.
406
- *
407
- * @param Mustache_Tokenizer $tokenizer
408
- */
409
- public function setTokenizer(Mustache_Tokenizer $tokenizer)
410
- {
411
- $this->tokenizer = $tokenizer;
412
- }
413
-
414
- /**
415
- * Get the current Mustache Tokenizer instance.
416
- *
417
- * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one.
418
- *
419
- * @return Mustache_Tokenizer
420
- */
421
- public function getTokenizer()
422
- {
423
- if (!isset($this->tokenizer)) {
424
- $this->tokenizer = new Mustache_Tokenizer;
425
- }
426
-
427
- return $this->tokenizer;
428
- }
429
-
430
- /**
431
- * Set the Mustache Parser instance.
432
- *
433
- * @param Mustache_Parser $parser
434
- */
435
- public function setParser(Mustache_Parser $parser)
436
- {
437
- $this->parser = $parser;
438
- }
439
-
440
- /**
441
- * Get the current Mustache Parser instance.
442
- *
443
- * If no Parser instance has been explicitly specified, this method will instantiate and return a new one.
444
- *
445
- * @return Mustache_Parser
446
- */
447
- public function getParser()
448
- {
449
- if (!isset($this->parser)) {
450
- $this->parser = new Mustache_Parser;
451
- }
452
-
453
- return $this->parser;
454
- }
455
-
456
- /**
457
- * Set the Mustache Compiler instance.
458
- *
459
- * @param Mustache_Compiler $compiler
460
- */
461
- public function setCompiler(Mustache_Compiler $compiler)
462
- {
463
- $this->compiler = $compiler;
464
- }
465
-
466
- /**
467
- * Get the current Mustache Compiler instance.
468
- *
469
- * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one.
470
- *
471
- * @return Mustache_Compiler
472
- */
473
- public function getCompiler()
474
- {
475
- if (!isset($this->compiler)) {
476
- $this->compiler = new Mustache_Compiler;
477
- }
478
-
479
- return $this->compiler;
480
- }
481
-
482
- /**
483
- * Helper method to generate a Mustache template class.
484
- *
485
- * @param string $source
486
- *
487
- * @return string Mustache Template class name
488
- */
489
- public function getTemplateClassName($source)
490
- {
491
- return $this->templateClassPrefix . md5(sprintf(
492
- 'version:%s,escape:%s,entity_flags:%i,charset:%s,strict_callables:%s,source:%s',
493
- self::VERSION,
494
- isset($this->escape) ? 'custom' : 'default',
495
- $this->entityFlags,
496
- $this->charset,
497
- $this->strictCallables ? 'true' : 'false',
498
- $source
499
- ));
500
- }
501
-
502
- /**
503
- * Load a Mustache Template by name.
504
- *
505
- * @param string $name
506
- *
507
- * @return Mustache_Template
508
- */
509
- public function loadTemplate($name)
510
- {
511
- return $this->loadSource($this->getLoader()->load($name));
512
- }
513
-
514
- /**
515
- * Load a Mustache partial Template by name.
516
- *
517
- * This is a helper method used internally by Template instances for loading partial templates. You can most likely
518
- * ignore it completely.
519
- *
520
- * @param string $name
521
- *
522
- * @return Mustache_Template
523
- */
524
- public function loadPartial($name)
525
- {
526
- try {
527
- if (isset($this->partialsLoader)) {
528
- $loader = $this->partialsLoader;
529
- } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
530
- $loader = $this->loader;
531
- } else {
532
- throw new Mustache_Exception_UnknownTemplateException($name);
533
- }
534
-
535
- return $this->loadSource($loader->load($name));
536
- } catch (Mustache_Exception_UnknownTemplateException $e) {
537
- // If the named partial cannot be found, log then return null.
538
- $this->log(
539
- Mustache_Logger::WARNING,
540
- 'Partial not found: "{name}"',
541
- array('name' => $e->getTemplateName())
542
- );
543
- }
544
- }
545
-
546
- /**
547
- * Load a Mustache lambda Template by source.
548
- *
549
- * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most
550
- * likely ignore it completely.
551
- *
552
- * @param string $source
553
- * @param string $delims (default: null)
554
- *
555
- * @return Mustache_Template
556
- */
557
- public function loadLambda($source, $delims = null)
558
- {
559
- if ($delims !== null) {
560
- $source = $delims . "\n" . $source;
561
- }
562
-
563
- return $this->loadSource($source);
564
- }
565
-
566
- /**
567
- * Instantiate and return a Mustache Template instance by source.
568
- *
569
- * @see Mustache_Engine::loadTemplate
570
- * @see Mustache_Engine::loadPartial
571
- * @see Mustache_Engine::loadLambda
572
- *
573
- * @param string $source
574
- *
575
- * @return Mustache_Template
576
- */
577
- private function loadSource($source)
578
- {
579
- $className = $this->getTemplateClassName($source);
580
-
581
- if (!isset($this->templates[$className])) {
582
- if (!class_exists($className, false)) {
583
- if ($fileName = $this->getCacheFilename($source)) {
584
- if (!is_file($fileName)) {
585
- $this->log(
586
- Mustache_Logger::DEBUG,
587
- 'Writing "{className}" class to template cache: "{fileName}"',
588
- array('className' => $className, 'fileName' => $fileName)
589
- );
590
-
591
- $this->writeCacheFile($fileName, $this->compile($source));
592
- }
593
-
594
- require_once $fileName;
595
- } else {
596
- $this->log(
597
- Mustache_Logger::WARNING,
598
- 'Template cache disabled, evaluating "{className}" class at runtime',
599
- array('className' => $className)
600
- );
601
-
602
- eval('?>'.$this->compile($source));
603
- }
604
- }
605
-
606
- $this->log(
607
- Mustache_Logger::DEBUG,
608
- 'Instantiating template: "{className}"',
609
- array('className' => $className)
610
- );
611
-
612
- $this->templates[$className] = new $className($this);
613
- }
614
-
615
- return $this->templates[$className];
616
- }
617
-
618
- /**
619
- * Helper method to tokenize a Mustache template.
620
- *
621
- * @see Mustache_Tokenizer::scan
622
- *
623
- * @param string $source
624
- *
625
- * @return array Tokens
626
- */
627
- private function tokenize($source)
628
- {
629
- return $this->getTokenizer()->scan($source);
630
- }
631
-
632
- /**
633
- * Helper method to parse a Mustache template.
634
- *
635
- * @see Mustache_Parser::parse
636
- *
637
- * @param string $source
638
- *
639
- * @return array Token tree
640
- */
641
- private function parse($source)
642
- {
643
- return $this->getParser()->parse($this->tokenize($source));
644
- }
645
-
646
- /**
647
- * Helper method to compile a Mustache template.
648
- *
649
- * @see Mustache_Compiler::compile
650
- *
651
- * @param string $source
652
- *
653
- * @return string generated Mustache template class code
654
- */
655
- private function compile($source)
656
- {
657
- $tree = $this->parse($source);
658
- $name = $this->getTemplateClassName($source);
659
-
660
- $this->log(
661
- Mustache_Logger::INFO,
662
- 'Compiling template to "{className}" class',
663
- array('className' => $name)
664
- );
665
-
666
- return $this->getCompiler()->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags);
667
- }
668
-
669
- /**
670
- * Helper method to generate a Mustache Template class cache filename.
671
- *
672
- * @param string $source
673
- *
674
- * @return string Mustache Template class cache filename
675
- */
676
- private function getCacheFilename($source)
677
- {
678
- if ($this->cache) {
679
- return sprintf('%s/%s.php', $this->cache, $this->getTemplateClassName($source));
680
- }
681
- }
682
-
683
- /**
684
- * Helper method to dump a generated Mustache Template subclass to the file cache.
685
- *
686
- * @throws Mustache_Exception_RuntimeException if unable to create the cache directory or write to $fileName.
687
- *
688
- * @param string $fileName
689
- * @param string $source
690
- *
691
- * @codeCoverageIgnore
692
- */
693
- private function writeCacheFile($fileName, $source)
694
- {
695
- $dirName = dirname($fileName);
696
- if (!is_dir($dirName)) {
697
- $this->log(
698
- Mustache_Logger::INFO,
699
- 'Creating Mustache template cache directory: "{dirName}"',
700
- array('dirName' => $dirName)
701
- );
702
-
703
- @mkdir($dirName, 0777, true);
704
- if (!is_dir($dirName)) {
705
- throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
706
- }
707
-
708
- }
709
-
710
- $this->log(
711
- Mustache_Logger::DEBUG,
712
- 'Caching compiled template to "{fileName}"',
713
- array('fileName' => $fileName)
714
- );
715
-
716
- $tempFile = tempnam($dirName, basename($fileName));
717
- if (false !== @file_put_contents($tempFile, $source)) {
718
- if (@rename($tempFile, $fileName)) {
719
- $mode = isset($this->cacheFileMode) ? $this->cacheFileMode : (0666 & ~umask());
720
- @chmod($fileName, $mode);
721
-
722
- return;
723
- }
724
-
725
- $this->log(
726
- Mustache_Logger::ERROR,
727
- 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
728
- array('tempName' => $tempFile, 'fileName' => $fileName)
729
- );
730
- }
731
-
732
- throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
733
- }
734
-
735
- /**
736
- * Add a log record if logging is enabled.
737
- *
738
- * @param integer $level The logging level
739
- * @param string $message The log message
740
- * @param array $context The log context
741
- */
742
- private function log($level, $message, array $context = array())
743
- {
744
- if (isset($this->logger)) {
745
- $this->logger->log($level, $message, $context);
746
- }
747
- }
748
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache implementation in PHP.
14
+ *
15
+ * {@link http://defunkt.github.com/mustache}
16
+ *
17
+ * Mustache is a framework-agnostic logic-less templating language. It enforces separation of view
18
+ * logic from template files. In fact, it is not even possible to embed logic in the template.
19
+ *
20
+ * This is very, very rad.
21
+ *
22
+ * @author Justin Hileman {@link http://justinhileman.com}
23
+ */
24
+ class Mustache_Engine
25
+ {
26
+ const VERSION = '2.4.1';
27
+ const SPEC_VERSION = '1.1.2';
28
+
29
+ const PRAGMA_FILTERS = 'FILTERS';
30
+
31
+ // Template cache
32
+ private $templates = array();
33
+
34
+ // Environment
35
+ private $templateClassPrefix = '__Mustache_';
36
+ private $cache = null;
37
+ private $cacheFileMode = null;
38
+ private $loader;
39
+ private $partialsLoader;
40
+ private $helpers;
41
+ private $escape;
42
+ private $entityFlags = ENT_COMPAT;
43
+ private $charset = 'UTF-8';
44
+ private $logger;
45
+ private $strictCallables = false;
46
+
47
+ /**
48
+ * Mustache class constructor.
49
+ *
50
+ * Passing an $options array allows overriding certain Mustache options during instantiation:
51
+ *
52
+ * $options = array(
53
+ * // The class prefix for compiled templates. Defaults to '__Mustache_'.
54
+ * 'template_class_prefix' => '__MyTemplates_',
55
+ *
56
+ * // A cache directory for compiled templates. Mustache will not cache templates unless this is set
57
+ * 'cache' => dirname(__FILE__).'/tmp/cache/mustache',
58
+ *
59
+ * // Override default permissions for cache files. Defaults to using the system-defined umask. It is
60
+ * // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
61
+ * 'cache_file_mode' => 0666,
62
+ *
63
+ * // A Mustache template loader instance. Uses a StringLoader if not specified.
64
+ * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
65
+ *
66
+ * // A Mustache loader instance for partials.
67
+ * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
68
+ *
69
+ * // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as
70
+ * // efficient or lazy as a Filesystem (or database) loader.
71
+ * 'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')),
72
+ *
73
+ * // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order
74
+ * // sections), or any other valid Mustache context value. They will be prepended to the context stack,
75
+ * // so they will be available in any template loaded by this Mustache instance.
76
+ * 'helpers' => array('i18n' => function($text) {
77
+ * // do something translatey here...
78
+ * }),
79
+ *
80
+ * // An 'escape' callback, responsible for escaping double-mustache variables.
81
+ * 'escape' => function($value) {
82
+ * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
83
+ * },
84
+ *
85
+ * // Type argument for `htmlspecialchars`. Defaults to ENT_COMPAT. You may prefer ENT_QUOTES.
86
+ * 'entity_flags' => ENT_QUOTES,
87
+ *
88
+ * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'.
89
+ * 'charset' => 'ISO-8859-1',
90
+ *
91
+ * // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible
92
+ * // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is
93
+ * // available as well:
94
+ * 'logger' => new Mustache_Logger_StreamLogger('php://stderr'),
95
+ *
96
+ * // Only treat Closure instances and invokable classes as callable. If true, values like
97
+ * // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally
98
+ * // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This
99
+ * // helps protect against arbitrary code execution when user input is passed directly into the template.
100
+ * // This currently defaults to false, but will default to true in v3.0.
101
+ * 'strict_callables' => true,
102
+ * );
103
+ *
104
+ * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable.
105
+ *
106
+ * @param array $options (default: array())
107
+ */
108
+ public function __construct(array $options = array())
109
+ {
110
+ if (isset($options['template_class_prefix'])) {
111
+ $this->templateClassPrefix = $options['template_class_prefix'];
112
+ }
113
+
114
+ if (isset($options['cache'])) {
115
+ $this->cache = $options['cache'];
116
+ }
117
+
118
+ if (isset($options['cache_file_mode'])) {
119
+ $this->cacheFileMode = $options['cache_file_mode'];
120
+ }
121
+
122
+ if (isset($options['loader'])) {
123
+ $this->setLoader($options['loader']);
124
+ }
125
+
126
+ if (isset($options['partials_loader'])) {
127
+ $this->setPartialsLoader($options['partials_loader']);
128
+ }
129
+
130
+ if (isset($options['partials'])) {
131
+ $this->setPartials($options['partials']);
132
+ }
133
+
134
+ if (isset($options['helpers'])) {
135
+ $this->setHelpers($options['helpers']);
136
+ }
137
+
138
+ if (isset($options['escape'])) {
139
+ if (!is_callable($options['escape'])) {
140
+ throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable');
141
+ }
142
+
143
+ $this->escape = $options['escape'];
144
+ }
145
+
146
+ if (isset($options['entity_flags'])) {
147
+ $this->entityFlags = $options['entity_flags'];
148
+ }
149
+
150
+ if (isset($options['charset'])) {
151
+ $this->charset = $options['charset'];
152
+ }
153
+
154
+ if (isset($options['logger'])) {
155
+ $this->setLogger($options['logger']);
156
+ }
157
+
158
+ if (isset($options['strict_callables'])) {
159
+ $this->strictCallables = $options['strict_callables'];
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Shortcut 'render' invocation.
165
+ *
166
+ * Equivalent to calling `$mustache->loadTemplate($template)->render($context);`
167
+ *
168
+ * @see Mustache_Engine::loadTemplate
169
+ * @see Mustache_Template::render
170
+ *
171
+ * @param string $template
172
+ * @param mixed $context (default: array())
173
+ *
174
+ * @return string Rendered template
175
+ */
176
+ public function render($template, $context = array())
177
+ {
178
+ return $this->loadTemplate($template)->render($context);
179
+ }
180
+
181
+ /**
182
+ * Get the current Mustache escape callback.
183
+ *
184
+ * @return mixed Callable or null
185
+ */
186
+ public function getEscape()
187
+ {
188
+ return $this->escape;
189
+ }
190
+
191
+ /**
192
+ * Get the current Mustache entitity type to escape.
193
+ *
194
+ * @return int
195
+ */
196
+ public function getEntityFlags()
197
+ {
198
+ return $this->entityFlags;
199
+ }
200
+
201
+ /**
202
+ * Get the current Mustache character set.
203
+ *
204
+ * @return string
205
+ */
206
+ public function getCharset()
207
+ {
208
+ return $this->charset;
209
+ }
210
+
211
+ /**
212
+ * Set the Mustache template Loader instance.
213
+ *
214
+ * @param Mustache_Loader $loader
215
+ */
216
+ public function setLoader(Mustache_Loader $loader)
217
+ {
218
+ $this->loader = $loader;
219
+ }
220
+
221
+ /**
222
+ * Get the current Mustache template Loader instance.
223
+ *
224
+ * If no Loader instance has been explicitly specified, this method will instantiate and return
225
+ * a StringLoader instance.
226
+ *
227
+ * @return Mustache_Loader
228
+ */
229
+ public function getLoader()
230
+ {
231
+ if (!isset($this->loader)) {
232
+ $this->loader = new Mustache_Loader_StringLoader;
233
+ }
234
+
235
+ return $this->loader;
236
+ }
237
+
238
+ /**
239
+ * Set the Mustache partials Loader instance.
240
+ *
241
+ * @param Mustache_Loader $partialsLoader
242
+ */
243
+ public function setPartialsLoader(Mustache_Loader $partialsLoader)
244
+ {
245
+ $this->partialsLoader = $partialsLoader;
246
+ }
247
+
248
+ /**
249
+ * Get the current Mustache partials Loader instance.
250
+ *
251
+ * If no Loader instance has been explicitly specified, this method will instantiate and return
252
+ * an ArrayLoader instance.
253
+ *
254
+ * @return Mustache_Loader
255
+ */
256
+ public function getPartialsLoader()
257
+ {
258
+ if (!isset($this->partialsLoader)) {
259
+ $this->partialsLoader = new Mustache_Loader_ArrayLoader;
260
+ }
261
+
262
+ return $this->partialsLoader;
263
+ }
264
+
265
+ /**
266
+ * Set partials for the current partials Loader instance.
267
+ *
268
+ * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable
269
+ *
270
+ * @param array $partials (default: array())
271
+ */
272
+ public function setPartials(array $partials = array())
273
+ {
274
+ if (!isset($this->partialsLoader)) {
275
+ $this->partialsLoader = new Mustache_Loader_ArrayLoader;
276
+ }
277
+
278
+ if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
279
+ throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
280
+ }
281
+
282
+ $this->partialsLoader->setTemplates($partials);
283
+ }
284
+
285
+ /**
286
+ * Set an array of Mustache helpers.
287
+ *
288
+ * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or
289
+ * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in
290
+ * any template loaded by this Mustache instance.
291
+ *
292
+ * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable
293
+ *
294
+ * @param array|Traversable $helpers
295
+ */
296
+ public function setHelpers($helpers)
297
+ {
298
+ if (!is_array($helpers) && !$helpers instanceof Traversable) {
299
+ throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
300
+ }
301
+
302
+ $this->getHelpers()->clear();
303
+
304
+ foreach ($helpers as $name => $helper) {
305
+ $this->addHelper($name, $helper);
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Get the current set of Mustache helpers.
311
+ *
312
+ * @see Mustache_Engine::setHelpers
313
+ *
314
+ * @return Mustache_HelperCollection
315
+ */
316
+ public function getHelpers()
317
+ {
318
+ if (!isset($this->helpers)) {
319
+ $this->helpers = new Mustache_HelperCollection;
320
+ }
321
+
322
+ return $this->helpers;
323
+ }
324
+
325
+ /**
326
+ * Add a new Mustache helper.
327
+ *
328
+ * @see Mustache_Engine::setHelpers
329
+ *
330
+ * @param string $name
331
+ * @param mixed $helper
332
+ */
333
+ public function addHelper($name, $helper)
334
+ {
335
+ $this->getHelpers()->add($name, $helper);
336
+ }
337
+
338
+ /**
339
+ * Get a Mustache helper by name.
340
+ *
341
+ * @see Mustache_Engine::setHelpers
342
+ *
343
+ * @param string $name
344
+ *
345
+ * @return mixed Helper
346
+ */
347
+ public function getHelper($name)
348
+ {
349
+ return $this->getHelpers()->get($name);
350
+ }
351
+
352
+ /**
353
+ * Check whether this Mustache instance has a helper.
354
+ *
355
+ * @see Mustache_Engine::setHelpers
356
+ *
357
+ * @param string $name
358
+ *
359
+ * @return boolean True if the helper is present
360
+ */
361
+ public function hasHelper($name)
362
+ {
363
+ return $this->getHelpers()->has($name);
364
+ }
365
+
366
+ /**
367
+ * Remove a helper by name.
368
+ *
369
+ * @see Mustache_Engine::setHelpers
370
+ *
371
+ * @param string $name
372
+ */
373
+ public function removeHelper($name)
374
+ {
375
+ $this->getHelpers()->remove($name);
376
+ }
377
+
378
+ /**
379
+ * Set the Mustache Logger instance.
380
+ *
381
+ * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface.
382
+ *
383
+ * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
384
+ */
385
+ public function setLogger($logger = null)
386
+ {
387
+ if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
388
+ throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
389
+ }
390
+
391
+ $this->logger = $logger;
392
+ }
393
+
394
+ /**
395
+ * Get the current Mustache Logger instance.
396
+ *
397
+ * @return Mustache_Logger|Psr\Log\LoggerInterface
398
+ */
399
+ public function getLogger()
400
+ {
401
+ return $this->logger;
402
+ }
403
+
404
+ /**
405
+ * Set the Mustache Tokenizer instance.
406
+ *
407
+ * @param Mustache_Tokenizer $tokenizer
408
+ */
409
+ public function setTokenizer(Mustache_Tokenizer $tokenizer)
410
+ {
411
+ $this->tokenizer = $tokenizer;
412
+ }
413
+
414
+ /**
415
+ * Get the current Mustache Tokenizer instance.
416
+ *
417
+ * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one.
418
+ *
419
+ * @return Mustache_Tokenizer
420
+ */
421
+ public function getTokenizer()
422
+ {
423
+ if (!isset($this->tokenizer)) {
424
+ $this->tokenizer = new Mustache_Tokenizer;
425
+ }
426
+
427
+ return $this->tokenizer;
428
+ }
429
+
430
+ /**
431
+ * Set the Mustache Parser instance.
432
+ *
433
+ * @param Mustache_Parser $parser
434
+ */
435
+ public function setParser(Mustache_Parser $parser)
436
+ {
437
+ $this->parser = $parser;
438
+ }
439
+
440
+ /**
441
+ * Get the current Mustache Parser instance.
442
+ *
443
+ * If no Parser instance has been explicitly specified, this method will instantiate and return a new one.
444
+ *
445
+ * @return Mustache_Parser
446
+ */
447
+ public function getParser()
448
+ {
449
+ if (!isset($this->parser)) {
450
+ $this->parser = new Mustache_Parser;
451
+ }
452
+
453
+ return $this->parser;
454
+ }
455
+
456
+ /**
457
+ * Set the Mustache Compiler instance.
458
+ *
459
+ * @param Mustache_Compiler $compiler
460
+ */
461
+ public function setCompiler(Mustache_Compiler $compiler)
462
+ {
463
+ $this->compiler = $compiler;
464
+ }
465
+
466
+ /**
467
+ * Get the current Mustache Compiler instance.
468
+ *
469
+ * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one.
470
+ *
471
+ * @return Mustache_Compiler
472
+ */
473
+ public function getCompiler()
474
+ {
475
+ if (!isset($this->compiler)) {
476
+ $this->compiler = new Mustache_Compiler;
477
+ }
478
+
479
+ return $this->compiler;
480
+ }
481
+
482
+ /**
483
+ * Helper method to generate a Mustache template class.
484
+ *
485
+ * @param string $source
486
+ *
487
+ * @return string Mustache Template class name
488
+ */
489
+ public function getTemplateClassName($source)
490
+ {
491
+ return $this->templateClassPrefix . md5(sprintf(
492
+ 'version:%s,escape:%s,entity_flags:%i,charset:%s,strict_callables:%s,source:%s',
493
+ self::VERSION,
494
+ isset($this->escape) ? 'custom' : 'default',
495
+ $this->entityFlags,
496
+ $this->charset,
497
+ $this->strictCallables ? 'true' : 'false',
498
+ $source
499
+ ));
500
+ }
501
+
502
+ /**
503
+ * Load a Mustache Template by name.
504
+ *
505
+ * @param string $name
506
+ *
507
+ * @return Mustache_Template
508
+ */
509
+ public function loadTemplate($name)
510
+ {
511
+ return $this->loadSource($this->getLoader()->load($name));
512
+ }
513
+
514
+ /**
515
+ * Load a Mustache partial Template by name.
516
+ *
517
+ * This is a helper method used internally by Template instances for loading partial templates. You can most likely
518
+ * ignore it completely.
519
+ *
520
+ * @param string $name
521
+ *
522
+ * @return Mustache_Template
523
+ */
524
+ public function loadPartial($name)
525
+ {
526
+ try {
527
+ if (isset($this->partialsLoader)) {
528
+ $loader = $this->partialsLoader;
529
+ } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
530
+ $loader = $this->loader;
531
+ } else {
532
+ throw new Mustache_Exception_UnknownTemplateException($name);
533
+ }
534
+
535
+ return $this->loadSource($loader->load($name));
536
+ } catch (Mustache_Exception_UnknownTemplateException $e) {
537
+ // If the named partial cannot be found, log then return null.
538
+ $this->log(
539
+ Mustache_Logger::WARNING,
540
+ 'Partial not found: "{name}"',
541
+ array('name' => $e->getTemplateName())
542
+ );
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Load a Mustache lambda Template by source.
548
+ *
549
+ * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most
550
+ * likely ignore it completely.
551
+ *
552
+ * @param string $source
553
+ * @param string $delims (default: null)
554
+ *
555
+ * @return Mustache_Template
556
+ */
557
+ public function loadLambda($source, $delims = null)
558
+ {
559
+ if ($delims !== null) {
560
+ $source = $delims . "\n" . $source;
561
+ }
562
+
563
+ return $this->loadSource($source);
564
+ }
565
+
566
+ /**
567
+ * Instantiate and return a Mustache Template instance by source.
568
+ *
569
+ * @see Mustache_Engine::loadTemplate
570
+ * @see Mustache_Engine::loadPartial
571
+ * @see Mustache_Engine::loadLambda
572
+ *
573
+ * @param string $source
574
+ *
575
+ * @return Mustache_Template
576
+ */
577
+ private function loadSource($source)
578
+ {
579
+ $className = $this->getTemplateClassName($source);
580
+
581
+ if (!isset($this->templates[$className])) {
582
+ if (!class_exists($className, false)) {
583
+ if ($fileName = $this->getCacheFilename($source)) {
584
+ if (!is_file($fileName)) {
585
+ $this->log(
586
+ Mustache_Logger::DEBUG,
587
+ 'Writing "{className}" class to template cache: "{fileName}"',
588
+ array('className' => $className, 'fileName' => $fileName)
589
+ );
590
+
591
+ $this->writeCacheFile($fileName, $this->compile($source));
592
+ }
593
+
594
+ require_once $fileName;
595
+ } else {
596
+ $this->log(
597
+ Mustache_Logger::WARNING,
598
+ 'Template cache disabled, evaluating "{className}" class at runtime',
599
+ array('className' => $className)
600
+ );
601
+
602
+ eval('?>'.$this->compile($source));
603
+ }
604
+ }
605
+
606
+ $this->log(
607
+ Mustache_Logger::DEBUG,
608
+ 'Instantiating template: "{className}"',
609
+ array('className' => $className)
610
+ );
611
+
612
+ $this->templates[$className] = new $className($this);
613
+ }
614
+
615
+ return $this->templates[$className];
616
+ }
617
+
618
+ /**
619
+ * Helper method to tokenize a Mustache template.
620
+ *
621
+ * @see Mustache_Tokenizer::scan
622
+ *
623
+ * @param string $source
624
+ *
625
+ * @return array Tokens
626
+ */
627
+ private function tokenize($source)
628
+ {
629
+ return $this->getTokenizer()->scan($source);
630
+ }
631
+
632
+ /**
633
+ * Helper method to parse a Mustache template.
634
+ *
635
+ * @see Mustache_Parser::parse
636
+ *
637
+ * @param string $source
638
+ *
639
+ * @return array Token tree
640
+ */
641
+ private function parse($source)
642
+ {
643
+ return $this->getParser()->parse($this->tokenize($source));
644
+ }
645
+
646
+ /**
647
+ * Helper method to compile a Mustache template.
648
+ *
649
+ * @see Mustache_Compiler::compile
650
+ *
651
+ * @param string $source
652
+ *
653
+ * @return string generated Mustache template class code
654
+ */
655
+ private function compile($source)
656
+ {
657
+ $tree = $this->parse($source);
658
+ $name = $this->getTemplateClassName($source);
659
+
660
+ $this->log(
661
+ Mustache_Logger::INFO,
662
+ 'Compiling template to "{className}" class',
663
+ array('className' => $name)
664
+ );
665
+
666
+ return $this->getCompiler()->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags);
667
+ }
668
+
669
+ /**
670
+ * Helper method to generate a Mustache Template class cache filename.
671
+ *
672
+ * @param string $source
673
+ *
674
+ * @return string Mustache Template class cache filename
675
+ */
676
+ private function getCacheFilename($source)
677
+ {
678
+ if ($this->cache) {
679
+ return sprintf('%s/%s.php', $this->cache, $this->getTemplateClassName($source));
680
+ }
681
+ }
682
+
683
+ /**
684
+ * Helper method to dump a generated Mustache Template subclass to the file cache.
685
+ *
686
+ * @throws Mustache_Exception_RuntimeException if unable to create the cache directory or write to $fileName.
687
+ *
688
+ * @param string $fileName
689
+ * @param string $source
690
+ *
691
+ * @codeCoverageIgnore
692
+ */
693
+ private function writeCacheFile($fileName, $source)
694
+ {
695
+ $dirName = dirname($fileName);
696
+ if (!is_dir($dirName)) {
697
+ $this->log(
698
+ Mustache_Logger::INFO,
699
+ 'Creating Mustache template cache directory: "{dirName}"',
700
+ array('dirName' => $dirName)
701
+ );
702
+
703
+ @mkdir($dirName, 0777, true);
704
+ if (!is_dir($dirName)) {
705
+ throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
706
+ }
707
+
708
+ }
709
+
710
+ $this->log(
711
+ Mustache_Logger::DEBUG,
712
+ 'Caching compiled template to "{fileName}"',
713
+ array('fileName' => $fileName)
714
+ );
715
+
716
+ $tempFile = tempnam($dirName, basename($fileName));
717
+ if (false !== @file_put_contents($tempFile, $source)) {
718
+ if (@rename($tempFile, $fileName)) {
719
+ $mode = isset($this->cacheFileMode) ? $this->cacheFileMode : (0666 & ~umask());
720
+ @chmod($fileName, $mode);
721
+
722
+ return;
723
+ }
724
+
725
+ $this->log(
726
+ Mustache_Logger::ERROR,
727
+ 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
728
+ array('tempName' => $tempFile, 'fileName' => $fileName)
729
+ );
730
+ }
731
+
732
+ throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
733
+ }
734
+
735
+ /**
736
+ * Add a log record if logging is enabled.
737
+ *
738
+ * @param integer $level The logging level
739
+ * @param string $message The log message
740
+ * @param array $context The log context
741
+ */
742
+ private function log($level, $message, array $context = array())
743
+ {
744
+ if (isset($this->logger)) {
745
+ $this->logger->log($level, $message, $context);
746
+ }
747
+ }
748
+ }
assets/lib/Mustache/Exception.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A Mustache Exception interface.
14
- */
15
- interface Mustache_Exception
16
- {
17
- // This space intentionally left blank.
18
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Exception interface.
14
+ */
15
+ interface Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
assets/lib/Mustache/Exception/InvalidArgumentException.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Invalid argument exception.
14
- */
15
- class Mustache_Exception_InvalidArgumentException extends InvalidArgumentException implements Mustache_Exception
16
- {
17
- // This space intentionally left blank.
18
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Invalid argument exception.
14
+ */
15
+ class Mustache_Exception_InvalidArgumentException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
assets/lib/Mustache/Exception/LogicException.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Logic exception.
14
- */
15
- class Mustache_Exception_LogicException extends LogicException implements Mustache_Exception
16
- {
17
- // This space intentionally left blank.
18
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Logic exception.
14
+ */
15
+ class Mustache_Exception_LogicException extends LogicException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
assets/lib/Mustache/Exception/RuntimeException.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Runtime exception.
14
- */
15
- class Mustache_Exception_RuntimeException extends RuntimeException implements Mustache_Exception
16
- {
17
- // This space intentionally left blank.
18
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Runtime exception.
14
+ */
15
+ class Mustache_Exception_RuntimeException extends RuntimeException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
assets/lib/Mustache/Exception/SyntaxException.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache syntax exception.
14
- */
15
- class Mustache_Exception_SyntaxException extends LogicException implements Mustache_Exception
16
- {
17
- protected $token;
18
-
19
- public function __construct($msg, array $token)
20
- {
21
- $this->token = $token;
22
- parent::__construct($msg);
23
- }
24
-
25
- public function getToken()
26
- {
27
- return $this->token;
28
- }
29
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache syntax exception.
14
+ */
15
+ class Mustache_Exception_SyntaxException extends LogicException implements Mustache_Exception
16
+ {
17
+ protected $token;
18
+
19
+ public function __construct($msg, array $token)
20
+ {
21
+ $this->token = $token;
22
+ parent::__construct($msg);
23
+ }
24
+
25
+ public function getToken()
26
+ {
27
+ return $this->token;
28
+ }
29
+ }
assets/lib/Mustache/Exception/UnknownFilterException.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Unknown filter exception.
14
- */
15
- class Mustache_Exception_UnknownFilterException extends UnexpectedValueException implements Mustache_Exception
16
- {
17
- protected $filterName;
18
-
19
- public function __construct($filterName)
20
- {
21
- $this->filterName = $filterName;
22
- parent::__construct(sprintf('Unknown filter: %s', $filterName));
23
- }
24
-
25
- public function getFilterName()
26
- {
27
- return $this->filterName;
28
- }
29
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown filter exception.
14
+ */
15
+ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException implements Mustache_Exception
16
+ {
17
+ protected $filterName;
18
+
19
+ public function __construct($filterName)
20
+ {
21
+ $this->filterName = $filterName;
22
+ parent::__construct(sprintf('Unknown filter: %s', $filterName));
23
+ }
24
+
25
+ public function getFilterName()
26
+ {
27
+ return $this->filterName;
28
+ }
29
+ }
assets/lib/Mustache/Exception/UnknownHelperException.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Unknown helper exception.
14
- */
15
- class Mustache_Exception_UnknownHelperException extends InvalidArgumentException implements Mustache_Exception
16
- {
17
- protected $helperName;
18
-
19
- public function __construct($helperName)
20
- {
21
- $this->helperName = $helperName;
22
- parent::__construct(sprintf('Unknown helper: %s', $helperName));
23
- }
24
-
25
- public function getHelperName()
26
- {
27
- return $this->helperName;
28
- }
29
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown helper exception.
14
+ */
15
+ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ protected $helperName;
18
+
19
+ public function __construct($helperName)
20
+ {
21
+ $this->helperName = $helperName;
22
+ parent::__construct(sprintf('Unknown helper: %s', $helperName));
23
+ }
24
+
25
+ public function getHelperName()
26
+ {
27
+ return $this->helperName;
28
+ }
29
+ }
assets/lib/Mustache/Exception/UnknownTemplateException.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Unknown template exception.
14
- */
15
- class Mustache_Exception_UnknownTemplateException extends InvalidArgumentException implements Mustache_Exception
16
- {
17
- protected $templateName;
18
-
19
- public function __construct($templateName)
20
- {
21
- $this->templateName = $templateName;
22
- parent::__construct(sprintf('Unknown template: %s', $templateName));
23
- }
24
-
25
- public function getTemplateName()
26
- {
27
- return $this->templateName;
28
- }
29
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown template exception.
14
+ */
15
+ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ protected $templateName;
18
+
19
+ public function __construct($templateName)
20
+ {
21
+ $this->templateName = $templateName;
22
+ parent::__construct(sprintf('Unknown template: %s', $templateName));
23
+ }
24
+
25
+ public function getTemplateName()
26
+ {
27
+ return $this->templateName;
28
+ }
29
+ }
assets/lib/Mustache/HelperCollection.php CHANGED
@@ -1,170 +1,170 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A collection of helpers for a Mustache instance.
14
- */
15
- class Mustache_HelperCollection
16
- {
17
- private $helpers = array();
18
-
19
- /**
20
- * Helper Collection constructor.
21
- *
22
- * Optionally accepts an array (or Traversable) of `$name => $helper` pairs.
23
- *
24
- * @throws Mustache_Exception_InvalidArgumentException if the $helpers argument isn't an array or Traversable
25
- *
26
- * @param array|Traversable $helpers (default: null)
27
- */
28
- public function __construct($helpers = null)
29
- {
30
- if ($helpers !== null) {
31
- if (!is_array($helpers) && !$helpers instanceof Traversable) {
32
- throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers');
33
- }
34
-
35
- foreach ($helpers as $name => $helper) {
36
- $this->add($name, $helper);
37
- }
38
- }
39
- }
40
-
41
- /**
42
- * Magic mutator.
43
- *
44
- * @see Mustache_HelperCollection::add
45
- *
46
- * @param string $name
47
- * @param mixed $helper
48
- */
49
- public function __set($name, $helper)
50
- {
51
- $this->add($name, $helper);
52
- }
53
-
54
- /**
55
- * Add a helper to this collection.
56
- *
57
- * @param string $name
58
- * @param mixed $helper
59
- */
60
- public function add($name, $helper)
61
- {
62
- $this->helpers[$name] = $helper;
63
- }
64
-
65
- /**
66
- * Magic accessor.
67
- *
68
- * @see Mustache_HelperCollection::get
69
- *
70
- * @param string $name
71
- *
72
- * @return mixed Helper
73
- */
74
- public function __get($name)
75
- {
76
- return $this->get($name);
77
- }
78
-
79
- /**
80
- * Get a helper by name.
81
- *
82
- * @throws Mustache_Exception_UnknownHelperException If helper does not exist.
83
- *
84
- * @param string $name
85
- *
86
- * @return mixed Helper
87
- */
88
- public function get($name)
89
- {
90
- if (!$this->has($name)) {
91
- throw new Mustache_Exception_UnknownHelperException($name);
92
- }
93
-
94
- return $this->helpers[$name];
95
- }
96
-
97
- /**
98
- * Magic isset().
99
- *
100
- * @see Mustache_HelperCollection::has
101
- *
102
- * @param string $name
103
- *
104
- * @return boolean True if helper is present
105
- */
106
- public function __isset($name)
107
- {
108
- return $this->has($name);
109
- }
110
-
111
- /**
112
- * Check whether a given helper is present in the collection.
113
- *
114
- * @param string $name
115
- *
116
- * @return boolean True if helper is present
117
- */
118
- public function has($name)
119
- {
120
- return array_key_exists($name, $this->helpers);
121
- }
122
-
123
- /**
124
- * Magic unset().
125
- *
126
- * @see Mustache_HelperCollection::remove
127
- *
128
- * @param string $name
129
- */
130
- public function __unset($name)
131
- {
132
- $this->remove($name);
133
- }
134
-
135
- /**
136
- * Check whether a given helper is present in the collection.
137
- *
138
- * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present.
139
- *
140
- * @param string $name
141
- */
142
- public function remove($name)
143
- {
144
- if (!$this->has($name)) {
145
- throw new Mustache_Exception_UnknownHelperException($name);
146
- }
147
-
148
- unset($this->helpers[$name]);
149
- }
150
-
151
- /**
152
- * Clear the helper collection.
153
- *
154
- * Removes all helpers from this collection
155
- */
156
- public function clear()
157
- {
158
- $this->helpers = array();
159
- }
160
-
161
- /**
162
- * Check whether the helper collection is empty.
163
- *
164
- * @return boolean True if the collection is empty
165
- */
166
- public function isEmpty()
167
- {
168
- return empty($this->helpers);
169
- }
170
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A collection of helpers for a Mustache instance.
14
+ */
15
+ class Mustache_HelperCollection
16
+ {
17
+ private $helpers = array();
18
+
19
+ /**
20
+ * Helper Collection constructor.
21
+ *
22
+ * Optionally accepts an array (or Traversable) of `$name => $helper` pairs.
23
+ *
24
+ * @throws Mustache_Exception_InvalidArgumentException if the $helpers argument isn't an array or Traversable
25
+ *
26
+ * @param array|Traversable $helpers (default: null)
27
+ */
28
+ public function __construct($helpers = null)
29
+ {
30
+ if ($helpers !== null) {
31
+ if (!is_array($helpers) && !$helpers instanceof Traversable) {
32
+ throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers');
33
+ }
34
+
35
+ foreach ($helpers as $name => $helper) {
36
+ $this->add($name, $helper);
37
+ }
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Magic mutator.
43
+ *
44
+ * @see Mustache_HelperCollection::add
45
+ *
46
+ * @param string $name
47
+ * @param mixed $helper
48
+ */
49
+ public function __set($name, $helper)
50
+ {
51
+ $this->add($name, $helper);
52
+ }
53
+
54
+ /**
55
+ * Add a helper to this collection.
56
+ *
57
+ * @param string $name
58
+ * @param mixed $helper
59
+ */
60
+ public function add($name, $helper)
61
+ {
62
+ $this->helpers[$name] = $helper;
63
+ }
64
+
65
+ /**
66
+ * Magic accessor.
67
+ *
68
+ * @see Mustache_HelperCollection::get
69
+ *
70
+ * @param string $name
71
+ *
72
+ * @return mixed Helper
73
+ */
74
+ public function __get($name)
75
+ {
76
+ return $this->get($name);
77
+ }
78
+
79
+ /**
80
+ * Get a helper by name.
81
+ *
82
+ * @throws Mustache_Exception_UnknownHelperException If helper does not exist.
83
+ *
84
+ * @param string $name
85
+ *
86
+ * @return mixed Helper
87
+ */
88
+ public function get($name)
89
+ {
90
+ if (!$this->has($name)) {
91
+ throw new Mustache_Exception_UnknownHelperException($name);
92
+ }
93
+
94
+ return $this->helpers[$name];
95
+ }
96
+
97
+ /**
98
+ * Magic isset().
99
+ *
100
+ * @see Mustache_HelperCollection::has
101
+ *
102
+ * @param string $name
103
+ *
104
+ * @return boolean True if helper is present
105
+ */
106
+ public function __isset($name)
107
+ {
108
+ return $this->has($name);
109
+ }
110
+
111
+ /**
112
+ * Check whether a given helper is present in the collection.
113
+ *
114
+ * @param string $name
115
+ *
116
+ * @return boolean True if helper is present
117
+ */
118
+ public function has($name)
119
+ {
120
+ return array_key_exists($name, $this->helpers);
121
+ }
122
+
123
+ /**
124
+ * Magic unset().
125
+ *
126
+ * @see Mustache_HelperCollection::remove
127
+ *
128
+ * @param string $name
129
+ */
130
+ public function __unset($name)
131
+ {
132
+ $this->remove($name);
133
+ }
134
+
135
+ /**
136
+ * Check whether a given helper is present in the collection.
137
+ *
138
+ * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present.
139
+ *
140
+ * @param string $name
141
+ */
142
+ public function remove($name)
143
+ {
144
+ if (!$this->has($name)) {
145
+ throw new Mustache_Exception_UnknownHelperException($name);
146
+ }
147
+
148
+ unset($this->helpers[$name]);
149
+ }
150
+
151
+ /**
152
+ * Clear the helper collection.
153
+ *
154
+ * Removes all helpers from this collection
155
+ */
156
+ public function clear()
157
+ {
158
+ $this->helpers = array();
159
+ }
160
+
161
+ /**
162
+ * Check whether the helper collection is empty.
163
+ *
164
+ * @return boolean True if the collection is empty
165
+ */
166
+ public function isEmpty()
167
+ {
168
+ return empty($this->helpers);
169
+ }
170
+ }
assets/lib/Mustache/LambdaHelper.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Lambda Helper.
14
- *
15
- * Passed as the second argument to section lambdas (higher order sections),
16
- * giving them access to a `render` method for rendering a string with the
17
- * current context.
18
- */
19
- class Mustache_LambdaHelper
20
- {
21
- private $mustache;
22
- private $context;
23
-
24
- /**
25
- * Mustache Lambda Helper constructor.
26
- *
27
- * @param Mustache_Engine $mustache Mustache engine instance.
28
- * @param Mustache_Context $context Rendering context.
29
- */
30
- public function __construct(Mustache_Engine $mustache, Mustache_Context $context)
31
- {
32
- $this->mustache = $mustache;
33
- $this->context = $context;
34
- }
35
-
36
- /**
37
- * Render a string as a Mustache template with the current rendering context.
38
- *
39
- * @param string $string
40
- *
41
- * @return Rendered template.
42
- */
43
- public function render($string)
44
- {
45
- return $this->mustache
46
- ->loadLambda((string) $string)
47
- ->renderInternal($this->context);
48
- }
49
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Lambda Helper.
14
+ *
15
+ * Passed as the second argument to section lambdas (higher order sections),
16
+ * giving them access to a `render` method for rendering a string with the
17
+ * current context.
18
+ */
19
+ class Mustache_LambdaHelper
20
+ {
21
+ private $mustache;
22
+ private $context;
23
+
24
+ /**
25
+ * Mustache Lambda Helper constructor.
26
+ *
27
+ * @param Mustache_Engine $mustache Mustache engine instance.
28
+ * @param Mustache_Context $context Rendering context.
29
+ */
30
+ public function __construct(Mustache_Engine $mustache, Mustache_Context $context)
31
+ {
32
+ $this->mustache = $mustache;
33
+ $this->context = $context;
34
+ }
35
+
36
+ /**
37
+ * Render a string as a Mustache template with the current rendering context.
38
+ *
39
+ * @param string $string
40
+ *
41
+ * @return Rendered template.
42
+ */
43
+ public function render($string)
44
+ {
45
+ return $this->mustache
46
+ ->loadLambda((string) $string)
47
+ ->renderInternal($this->context);
48
+ }
49
+ }
assets/lib/Mustache/Loader.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template Loader interface.
14
- */
15
- interface Mustache_Loader
16
- {
17
-
18
- /**
19
- * Load a Template by name.
20
- *
21
- * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
22
- *
23
- * @param string $name
24
- *
25
- * @return string Mustache Template source
26
- */
27
- public function load($name);
28
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template Loader interface.
14
+ */
15
+ interface Mustache_Loader
16
+ {
17
+
18
+ /**
19
+ * Load a Template by name.
20
+ *
21
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
22
+ *
23
+ * @param string $name
24
+ *
25
+ * @return string Mustache Template source
26
+ */
27
+ public function load($name);
28
+ }
assets/lib/Mustache/Loader/ArrayLoader.php CHANGED
@@ -1,78 +1,78 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template array Loader implementation.
14
- *
15
- * An ArrayLoader instance loads Mustache Template source by name from an initial array:
16
- *
17
- * $loader = new ArrayLoader(
18
- * 'foo' => '{{ bar }}',
19
- * 'baz' => 'Hey {{ qux }}!'
20
- * );
21
- *
22
- * $tpl = $loader->load('foo'); // '{{ bar }}'
23
- *
24
- * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials
25
- * is set. It can also be used as a quick-and-dirty Template loader.
26
- */
27
- class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader
28
- {
29
-
30
- /**
31
- * ArrayLoader constructor.
32
- *
33
- * @param array $templates Associative array of Template source (default: array())
34
- */
35
- public function __construct(array $templates = array())
36
- {
37
- $this->templates = $templates;
38
- }
39
-
40
- /**
41
- * Load a Template.
42
- *
43
- * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
44
- *
45
- * @param string $name
46
- *
47
- * @return string Mustache Template source
48
- */
49
- public function load($name)
50
- {
51
- if (!isset($this->templates[$name])) {
52
- throw new Mustache_Exception_UnknownTemplateException($name);
53
- }
54
-
55
- return $this->templates[$name];
56
- }
57
-
58
- /**
59
- * Set an associative array of Template sources for this loader.
60
- *
61
- * @param array $templates
62
- */
63
- public function setTemplates(array $templates)
64
- {
65
- $this->templates = $templates;
66
- }
67
-
68
- /**
69
- * Set a Template source by name.
70
- *
71
- * @param string $name
72
- * @param string $template Mustache Template source
73
- */
74
- public function setTemplate($name, $template)
75
- {
76
- $this->templates[$name] = $template;
77
- }
78
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template array Loader implementation.
14
+ *
15
+ * An ArrayLoader instance loads Mustache Template source by name from an initial array:
16
+ *
17
+ * $loader = new ArrayLoader(
18
+ * 'foo' => '{{ bar }}',
19
+ * 'baz' => 'Hey {{ qux }}!'
20
+ * );
21
+ *
22
+ * $tpl = $loader->load('foo'); // '{{ bar }}'
23
+ *
24
+ * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials
25
+ * is set. It can also be used as a quick-and-dirty Template loader.
26
+ */
27
+ class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader
28
+ {
29
+
30
+ /**
31
+ * ArrayLoader constructor.
32
+ *
33
+ * @param array $templates Associative array of Template source (default: array())
34
+ */
35
+ public function __construct(array $templates = array())
36
+ {
37
+ $this->templates = $templates;
38
+ }
39
+
40
+ /**
41
+ * Load a Template.
42
+ *
43
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
44
+ *
45
+ * @param string $name
46
+ *
47
+ * @return string Mustache Template source
48
+ */
49
+ public function load($name)
50
+ {
51
+ if (!isset($this->templates[$name])) {
52
+ throw new Mustache_Exception_UnknownTemplateException($name);
53
+ }
54
+
55
+ return $this->templates[$name];
56
+ }
57
+
58
+ /**
59
+ * Set an associative array of Template sources for this loader.
60
+ *
61
+ * @param array $templates
62
+ */
63
+ public function setTemplates(array $templates)
64
+ {
65
+ $this->templates = $templates;
66
+ }
67
+
68
+ /**
69
+ * Set a Template source by name.
70
+ *
71
+ * @param string $name
72
+ * @param string $template Mustache Template source
73
+ */
74
+ public function setTemplate($name, $template)
75
+ {
76
+ $this->templates[$name] = $template;
77
+ }
78
+ }
assets/lib/Mustache/Loader/CascadingLoader.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A Mustache Template cascading loader implementation, which delegates to other
14
- * Loader instances.
15
- */
16
- class Mustache_Loader_CascadingLoader implements Mustache_Loader
17
- {
18
- private $loaders;
19
-
20
- /**
21
- * Construct a CascadingLoader with an array of loaders:
22
- *
23
- * $loader = new Mustache_Loader_CascadingLoader(array(
24
- * new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
25
- * new Mustache_Loader_FilesystemLoader(__DIR__.'/templates')
26
- * ));
27
- *
28
- * @param array $loaders An array of Mustache Loader instances
29
- */
30
- public function __construct(array $loaders = array())
31
- {
32
- $this->loaders = array();
33
- foreach ($loaders as $loader) {
34
- $this->addLoader($loader);
35
- }
36
- }
37
-
38
- /**
39
- * Add a Loader instance.
40
- *
41
- * @param Mustache_Loader $loader A Mustache Loader instance
42
- */
43
- public function addLoader(Mustache_Loader $loader)
44
- {
45
- $this->loaders[] = $loader;
46
- }
47
-
48
- /**
49
- * Load a Template by name.
50
- *
51
- * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
52
- *
53
- * @param string $name
54
- *
55
- * @return string Mustache Template source
56
- */
57
- public function load($name)
58
- {
59
- foreach ($this->loaders as $loader) {
60
- try {
61
- return $loader->load($name);
62
- } catch (Mustache_Exception_UnknownTemplateException $e) {
63
- // do nothing, check the next loader.
64
- }
65
- }
66
-
67
- throw new Mustache_Exception_UnknownTemplateException($name);
68
- }
69
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Template cascading loader implementation, which delegates to other
14
+ * Loader instances.
15
+ */
16
+ class Mustache_Loader_CascadingLoader implements Mustache_Loader
17
+ {
18
+ private $loaders;
19
+
20
+ /**
21
+ * Construct a CascadingLoader with an array of loaders:
22
+ *
23
+ * $loader = new Mustache_Loader_CascadingLoader(array(
24
+ * new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
25
+ * new Mustache_Loader_FilesystemLoader(__DIR__.'/templates')
26
+ * ));
27
+ *
28
+ * @param array $loaders An array of Mustache Loader instances
29
+ */
30
+ public function __construct(array $loaders = array())
31
+ {
32
+ $this->loaders = array();
33
+ foreach ($loaders as $loader) {
34
+ $this->addLoader($loader);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Add a Loader instance.
40
+ *
41
+ * @param Mustache_Loader $loader A Mustache Loader instance
42
+ */
43
+ public function addLoader(Mustache_Loader $loader)
44
+ {
45
+ $this->loaders[] = $loader;
46
+ }
47
+
48
+ /**
49
+ * Load a Template by name.
50
+ *
51
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
52
+ *
53
+ * @param string $name
54
+ *
55
+ * @return string Mustache Template source
56
+ */
57
+ public function load($name)
58
+ {
59
+ foreach ($this->loaders as $loader) {
60
+ try {
61
+ return $loader->load($name);
62
+ } catch (Mustache_Exception_UnknownTemplateException $e) {
63
+ // do nothing, check the next loader.
64
+ }
65
+ }
66
+
67
+ throw new Mustache_Exception_UnknownTemplateException($name);
68
+ }
69
+ }
assets/lib/Mustache/Loader/FilesystemLoader.php CHANGED
@@ -1,124 +1,124 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template filesystem Loader implementation.
14
- *
15
- * A FilesystemLoader instance loads Mustache Template source from the filesystem by name:
16
- *
17
- * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
18
- * $tpl = $loader->load('foo'); // equivalent to `file_get_contents(dirname(__FILE__).'/views/foo.mustache');
19
- *
20
- * This is probably the most useful Mustache Loader implementation. It can be used for partials and normal Templates:
21
- *
22
- * $m = new Mustache(array(
23
- * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
24
- * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
25
- * ));
26
- */
27
- class Mustache_Loader_FilesystemLoader implements Mustache_Loader
28
- {
29
- private $baseDir;
30
- private $extension = '.mustache';
31
- private $templates = array();
32
-
33
- /**
34
- * Mustache filesystem Loader constructor.
35
- *
36
- * Passing an $options array allows overriding certain Loader options during instantiation:
37
- *
38
- * $options = array(
39
- * // The filename extension used for Mustache templates. Defaults to '.mustache'
40
- * 'extension' => '.ms',
41
- * );
42
- *
43
- * @throws Mustache_Exception_RuntimeException if $baseDir does not exist.
44
- *
45
- * @param string $baseDir Base directory containing Mustache template files.
46
- * @param array $options Array of Loader options (default: array())
47
- */
48
- public function __construct($baseDir, array $options = array())
49
- {
50
- $this->baseDir = $baseDir;
51
-
52
- if (strpos($this->baseDir, '://') === -1) {
53
- $this->baseDir = realpath($this->baseDir);
54
- }
55
-
56
- if (!is_dir($this->baseDir)) {
57
- throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
58
- }
59
-
60
- if (array_key_exists('extension', $options)) {
61
- if (empty($options['extension'])) {
62
- $this->extension = '';
63
- } else {
64
- $this->extension = '.' . ltrim($options['extension'], '.');
65
- }
66
- }
67
- }
68
-
69
- /**
70
- * Load a Template by name.
71
- *
72
- * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
73
- * $loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache";
74
- *
75
- * @param string $name
76
- *
77
- * @return string Mustache Template source
78
- */
79
- public function load($name)
80
- {
81
- if (!isset($this->templates[$name])) {
82
- $this->templates[$name] = $this->loadFile($name);
83
- }
84
-
85
- return $this->templates[$name];
86
- }
87
-
88
- /**
89
- * Helper function for loading a Mustache file by name.
90
- *
91
- * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
92
- *
93
- * @param string $name
94
- *
95
- * @return string Mustache Template source
96
- */
97
- protected function loadFile($name)
98
- {
99
- $fileName = $this->getFileName($name);
100
-
101
- if (!file_exists($fileName)) {
102
- throw new Mustache_Exception_UnknownTemplateException($name);
103
- }
104
-
105
- return file_get_contents($fileName);
106
- }
107
-
108
- /**
109
- * Helper function for getting a Mustache template file name.
110
- *
111
- * @param string $name
112
- *
113
- * @return string Template file name
114
- */
115
- protected function getFileName($name)
116
- {
117
- $fileName = $this->baseDir . '/' . $name;
118
- if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) {
119
- $fileName .= $this->extension;
120
- }
121
-
122
- return $fileName;
123
- }
124
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template filesystem Loader implementation.
14
+ *
15
+ * A FilesystemLoader instance loads Mustache Template source from the filesystem by name:
16
+ *
17
+ * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
18
+ * $tpl = $loader->load('foo'); // equivalent to `file_get_contents(dirname(__FILE__).'/views/foo.mustache');
19
+ *
20
+ * This is probably the most useful Mustache Loader implementation. It can be used for partials and normal Templates:
21
+ *
22
+ * $m = new Mustache(array(
23
+ * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
24
+ * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
25
+ * ));
26
+ */
27
+ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
28
+ {
29
+ private $baseDir;
30
+ private $extension = '.mustache';
31
+ private $templates = array();
32
+
33
+ /**
34
+ * Mustache filesystem Loader constructor.
35
+ *
36
+ * Passing an $options array allows overriding certain Loader options during instantiation:
37
+ *
38
+ * $options = array(
39
+ * // The filename extension used for Mustache templates. Defaults to '.mustache'
40
+ * 'extension' => '.ms',
41
+ * );
42
+ *
43
+ * @throws Mustache_Exception_RuntimeException if $baseDir does not exist.
44
+ *
45
+ * @param string $baseDir Base directory containing Mustache template files.
46
+ * @param array $options Array of Loader options (default: array())
47
+ */
48
+ public function __construct($baseDir, array $options = array())
49
+ {
50
+ $this->baseDir = $baseDir;
51
+
52
+ if (strpos($this->baseDir, '://') === -1) {
53
+ $this->baseDir = realpath($this->baseDir);
54
+ }
55
+
56
+ if (!is_dir($this->baseDir)) {
57
+ throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
58
+ }
59
+
60
+ if (array_key_exists('extension', $options)) {
61
+ if (empty($options['extension'])) {
62
+ $this->extension = '';
63
+ } else {
64
+ $this->extension = '.' . ltrim($options['extension'], '.');
65
+ }
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Load a Template by name.
71
+ *
72
+ * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
73
+ * $loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache";
74
+ *
75
+ * @param string $name
76
+ *
77
+ * @return string Mustache Template source
78
+ */
79
+ public function load($name)
80
+ {
81
+ if (!isset($this->templates[$name])) {
82
+ $this->templates[$name] = $this->loadFile($name);
83
+ }
84
+
85
+ return $this->templates[$name];
86
+ }
87
+
88
+ /**
89
+ * Helper function for loading a Mustache file by name.
90
+ *
91
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
92
+ *
93
+ * @param string $name
94
+ *
95
+ * @return string Mustache Template source
96
+ */
97
+ protected function loadFile($name)
98
+ {
99
+ $fileName = $this->getFileName($name);
100
+
101
+ if (!file_exists($fileName)) {
102
+ throw new Mustache_Exception_UnknownTemplateException($name);
103
+ }
104
+
105
+ return file_get_contents($fileName);
106
+ }
107
+
108
+ /**
109
+ * Helper function for getting a Mustache template file name.
110
+ *
111
+ * @param string $name
112
+ *
113
+ * @return string Template file name
114
+ */
115
+ protected function getFileName($name)
116
+ {
117
+ $fileName = $this->baseDir . '/' . $name;
118
+ if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) {
119
+ $fileName .= $this->extension;
120
+ }
121
+
122
+ return $fileName;
123
+ }
124
+ }
assets/lib/Mustache/Loader/InlineLoader.php CHANGED
@@ -1,123 +1,123 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2013 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A Mustache Template loader for inline templates.
14
- *
15
- * With the InlineLoader, templates can be defined at the end of any PHP source
16
- * file:
17
- *
18
- * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
19
- * $hello = $loader->load('hello');
20
- * $goodbye = $loader->load('goodbye');
21
- *
22
- * __halt_compiler();
23
- *
24
- * @@ hello
25
- * Hello, {{ planet }}!
26
- *
27
- * @@ goodbye
28
- * Goodbye, cruel {{ planet }}
29
- *
30
- * Templates are deliniated by lines containing only `@@ name`.
31
- *
32
- * The InlineLoader is well-suited to micro-frameworks such as Silex:
33
- *
34
- * $app->register(new MustacheServiceProvider, array(
35
- * 'mustache.loader' => new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__)
36
- * ));
37
- *
38
- * $app->get('/{name}', function($name) use ($app) {
39
- * return $app['mustache']->render('hello', compact('name'));
40
- * })
41
- * ->value('name', 'world');
42
- *
43
- * // ...
44
- *
45
- * __halt_compiler();
46
- *
47
- * @@ hello
48
- * Hello, {{ name }}!
49
- *
50
- */
51
- class Mustache_Loader_InlineLoader implements Mustache_Loader
52
- {
53
- protected $fileName;
54
- protected $offset;
55
- protected $templates;
56
-
57
- /**
58
- * The InlineLoader requires a filename and offset to process templates.
59
- * The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
60
- * perfectly suited to the job:
61
- *
62
- * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
63
- *
64
- * Note that this only works if the loader is instantiated inside the same
65
- * file as the inline templates. If the templates are located in another
66
- * file, it would be necessary to manually specify the filename and offset.
67
- *
68
- * @param string $fileName The file to parse for inline templates
69
- * @param int $offset A string offset for the start of the templates.
70
- * This usually coincides with the `__halt_compiler`
71
- * call, and the `__COMPILER_HALT_OFFSET__`.
72
- */
73
- public function __construct($fileName, $offset)
74
- {
75
- if (!is_file($fileName)) {
76
- throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid filename.');
77
- }
78
-
79
- if (!is_int($offset) || $offset < 0) {
80
- throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid file offset.');
81
- }
82
-
83
- $this->fileName = $fileName;
84
- $this->offset = $offset;
85
- }
86
-
87
- /**
88
- * Load a Template by name.
89
- *
90
- * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
91
- *
92
- * @param string $name
93
- *
94
- * @return string Mustache Template source
95
- */
96
- public function load($name)
97
- {
98
- $this->loadTemplates();
99
-
100
- if (!array_key_exists($name, $this->templates)) {
101
- throw new Mustache_Exception_UnknownTemplateException($name);
102
- }
103
-
104
- return $this->templates[$name];
105
- }
106
-
107
- /**
108
- * Parse and load templates from the end of a source file.
109
- */
110
- protected function loadTemplates()
111
- {
112
- if ($this->templates === null) {
113
- $this->templates = array();
114
- $data = file_get_contents($this->fileName, false, null, $this->offset);
115
- foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) {
116
- if (trim($chunk)) {
117
- list($name, $content) = explode("\n", $chunk, 2);
118
- $this->templates[trim($name)] = trim($content);
119
- }
120
- }
121
- }
122
- }
123
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2013 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Template loader for inline templates.
14
+ *
15
+ * With the InlineLoader, templates can be defined at the end of any PHP source
16
+ * file:
17
+ *
18
+ * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
19
+ * $hello = $loader->load('hello');
20
+ * $goodbye = $loader->load('goodbye');
21
+ *
22
+ * __halt_compiler();
23
+ *
24
+ * @@ hello
25
+ * Hello, {{ planet }}!
26
+ *
27
+ * @@ goodbye
28
+ * Goodbye, cruel {{ planet }}
29
+ *
30
+ * Templates are deliniated by lines containing only `@@ name`.
31
+ *
32
+ * The InlineLoader is well-suited to micro-frameworks such as Silex:
33
+ *
34
+ * $app->register(new MustacheServiceProvider, array(
35
+ * 'mustache.loader' => new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__)
36
+ * ));
37
+ *
38
+ * $app->get('/{name}', function($name) use ($app) {
39
+ * return $app['mustache']->render('hello', compact('name'));
40
+ * })
41
+ * ->value('name', 'world');
42
+ *
43
+ * // ...
44
+ *
45
+ * __halt_compiler();
46
+ *
47
+ * @@ hello
48
+ * Hello, {{ name }}!
49
+ *
50
+ */
51
+ class Mustache_Loader_InlineLoader implements Mustache_Loader
52
+ {
53
+ protected $fileName;
54
+ protected $offset;
55
+ protected $templates;
56
+
57
+ /**
58
+ * The InlineLoader requires a filename and offset to process templates.
59
+ * The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
60
+ * perfectly suited to the job:
61
+ *
62
+ * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
63
+ *
64
+ * Note that this only works if the loader is instantiated inside the same
65
+ * file as the inline templates. If the templates are located in another
66
+ * file, it would be necessary to manually specify the filename and offset.
67
+ *
68
+ * @param string $fileName The file to parse for inline templates
69
+ * @param int $offset A string offset for the start of the templates.
70
+ * This usually coincides with the `__halt_compiler`
71
+ * call, and the `__COMPILER_HALT_OFFSET__`.
72
+ */
73
+ public function __construct($fileName, $offset)
74
+ {
75
+ if (!is_file($fileName)) {
76
+ throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid filename.');
77
+ }
78
+
79
+ if (!is_int($offset) || $offset < 0) {
80
+ throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid file offset.');
81
+ }
82
+
83
+ $this->fileName = $fileName;
84
+ $this->offset = $offset;
85
+ }
86
+
87
+ /**
88
+ * Load a Template by name.
89
+ *
90
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
91
+ *
92
+ * @param string $name
93
+ *
94
+ * @return string Mustache Template source
95
+ */
96
+ public function load($name)
97
+ {
98
+ $this->loadTemplates();
99
+
100
+ if (!array_key_exists($name, $this->templates)) {
101
+ throw new Mustache_Exception_UnknownTemplateException($name);
102
+ }
103
+
104
+ return $this->templates[$name];
105
+ }
106
+
107
+ /**
108
+ * Parse and load templates from the end of a source file.
109
+ */
110
+ protected function loadTemplates()
111
+ {
112
+ if ($this->templates === null) {
113
+ $this->templates = array();
114
+ $data = file_get_contents($this->fileName, false, null, $this->offset);
115
+ foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) {
116
+ if (trim($chunk)) {
117
+ list($name, $content) = explode("\n", $chunk, 2);
118
+ $this->templates[trim($name)] = trim($content);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
assets/lib/Mustache/Loader/MutableLoader.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template mutable Loader interface.
14
- */
15
- interface Mustache_Loader_MutableLoader
16
- {
17
-
18
- /**
19
- * Set an associative array of Template sources for this loader.
20
- *
21
- * @param array $templates
22
- */
23
- public function setTemplates(array $templates);
24
-
25
- /**
26
- * Set a Template source by name.
27
- *
28
- * @param string $name
29
- * @param string $template Mustache Template source
30
- */
31
- public function setTemplate($name, $template);
32
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template mutable Loader interface.
14
+ */
15
+ interface Mustache_Loader_MutableLoader
16
+ {
17
+
18
+ /**
19
+ * Set an associative array of Template sources for this loader.
20
+ *
21
+ * @param array $templates
22
+ */
23
+ public function setTemplates(array $templates);
24
+
25
+ /**
26
+ * Set a Template source by name.
27
+ *
28
+ * @param string $name
29
+ * @param string $template Mustache Template source
30
+ */
31
+ public function setTemplate($name, $template);
32
+ }
assets/lib/Mustache/Loader/StringLoader.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Template string Loader implementation.
14
- *
15
- * A StringLoader instance is essentially a noop. It simply passes the 'name' argument straight through:
16
- *
17
- * $loader = new StringLoader;
18
- * $tpl = $loader->load('{{ foo }}'); // '{{ foo }}'
19
- *
20
- * This is the default Template Loader instance used by Mustache:
21
- *
22
- * $m = new Mustache;
23
- * $tpl = $m->loadTemplate('{{ foo }}');
24
- * echo $tpl->render(array('foo' => 'bar')); // "bar"
25
- */
26
- class Mustache_Loader_StringLoader implements Mustache_Loader
27
- {
28
-
29
- /**
30
- * Load a Template by source.
31
- *
32
- * @param string $name Mustache Template source
33
- *
34
- * @return string Mustache Template source
35
- */
36
- public function load($name)
37
- {
38
- return $name;
39
- }
40
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template string Loader implementation.
14
+ *
15
+ * A StringLoader instance is essentially a noop. It simply passes the 'name' argument straight through:
16
+ *
17
+ * $loader = new StringLoader;
18
+ * $tpl = $loader->load('{{ foo }}'); // '{{ foo }}'
19
+ *
20
+ * This is the default Template Loader instance used by Mustache:
21
+ *
22
+ * $m = new Mustache;
23
+ * $tpl = $m->loadTemplate('{{ foo }}');
24
+ * echo $tpl->render(array('foo' => 'bar')); // "bar"
25
+ */
26
+ class Mustache_Loader_StringLoader implements Mustache_Loader
27
+ {
28
+
29
+ /**
30
+ * Load a Template by source.
31
+ *
32
+ * @param string $name Mustache Template source
33
+ *
34
+ * @return string Mustache Template source
35
+ */
36
+ public function load($name)
37
+ {
38
+ return $name;
39
+ }
40
+ }
assets/lib/Mustache/Logger.php CHANGED
@@ -1,135 +1,135 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Describes a Mustache logger instance
14
- *
15
- * This is identical to the Psr\Log\LoggerInterface.
16
- *
17
- * The message MUST be a string or object implementing __toString().
18
- *
19
- * The message MAY contain placeholders in the form: {foo} where foo
20
- * will be replaced by the context data in key "foo".
21
- *
22
- * The context array can contain arbitrary data, the only assumption that
23
- * can be made by implementors is that if an Exception instance is given
24
- * to produce a stack trace, it MUST be in a key named "exception".
25
- *
26
- * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
27
- * for the full interface specification.
28
- */
29
- interface Mustache_Logger
30
- {
31
- /**
32
- * Psr\Log compatible log levels
33
- */
34
- const EMERGENCY = 'emergency';
35
- const ALERT = 'alert';
36
- const CRITICAL = 'critical';
37
- const ERROR = 'error';
38
- const WARNING = 'warning';
39
- const NOTICE = 'notice';
40
- const INFO = 'info';
41
- const DEBUG = 'debug';
42
-
43
- /**
44
- * System is unusable.
45
- *
46
- * @param string $message
47
- * @param array $context
48
- * @return null
49
- */
50
- public function emergency($message, array $context = array());
51
-
52
- /**
53
- * Action must be taken immediately.
54
- *
55
- * Example: Entire website down, database unavailable, etc. This should
56
- * trigger the SMS alerts and wake you up.
57
- *
58
- * @param string $message
59
- * @param array $context
60
- * @return null
61
- */
62
- public function alert($message, array $context = array());
63
-
64
- /**
65
- * Critical conditions.
66
- *
67
- * Example: Application component unavailable, unexpected exception.
68
- *
69
- * @param string $message
70
- * @param array $context
71
- * @return null
72
- */
73
- public function critical($message, array $context = array());
74
-
75
- /**
76
- * Runtime errors that do not require immediate action but should typically
77
- * be logged and monitored.
78
- *
79
- * @param string $message
80
- * @param array $context
81
- * @return null
82
- */
83
- public function error($message, array $context = array());
84
-
85
- /**
86
- * Exceptional occurrences that are not errors.
87
- *
88
- * Example: Use of deprecated APIs, poor use of an API, undesirable things
89
- * that are not necessarily wrong.
90
- *
91
- * @param string $message
92
- * @param array $context
93
- * @return null
94
- */
95
- public function warning($message, array $context = array());
96
-
97
- /**
98
- * Normal but significant events.
99
- *
100
- * @param string $message
101
- * @param array $context
102
- * @return null
103
- */
104
- public function notice($message, array $context = array());
105
-
106
- /**
107
- * Interesting events.
108
- *
109
- * Example: User logs in, SQL logs.
110
- *
111
- * @param string $message
112
- * @param array $context
113
- * @return null
114
- */
115
- public function info($message, array $context = array());
116
-
117
- /**
118
- * Detailed debug information.
119
- *
120
- * @param string $message
121
- * @param array $context
122
- * @return null
123
- */
124
- public function debug($message, array $context = array());
125
-
126
- /**
127
- * Logs with an arbitrary level.
128
- *
129
- * @param mixed $level
130
- * @param string $message
131
- * @param array $context
132
- * @return null
133
- */
134
- public function log($level, $message, array $context = array());
135
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Describes a Mustache logger instance
14
+ *
15
+ * This is identical to the Psr\Log\LoggerInterface.
16
+ *
17
+ * The message MUST be a string or object implementing __toString().
18
+ *
19
+ * The message MAY contain placeholders in the form: {foo} where foo
20
+ * will be replaced by the context data in key "foo".
21
+ *
22
+ * The context array can contain arbitrary data, the only assumption that
23
+ * can be made by implementors is that if an Exception instance is given
24
+ * to produce a stack trace, it MUST be in a key named "exception".
25
+ *
26
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
27
+ * for the full interface specification.
28
+ */
29
+ interface Mustache_Logger
30
+ {
31
+ /**
32
+ * Psr\Log compatible log levels
33
+ */
34
+ const EMERGENCY = 'emergency';
35
+ const ALERT = 'alert';
36
+ const CRITICAL = 'critical';
37
+ const ERROR = 'error';
38
+ const WARNING = 'warning';
39
+ const NOTICE = 'notice';
40
+ const INFO = 'info';
41
+ const DEBUG = 'debug';
42
+
43
+ /**
44
+ * System is unusable.
45
+ *
46
+ * @param string $message
47
+ * @param array $context
48
+ * @return null
49
+ */
50
+ public function emergency($message, array $context = array());
51
+
52
+ /**
53
+ * Action must be taken immediately.
54
+ *
55
+ * Example: Entire website down, database unavailable, etc. This should
56
+ * trigger the SMS alerts and wake you up.
57
+ *
58
+ * @param string $message
59
+ * @param array $context
60
+ * @return null
61
+ */
62
+ public function alert($message, array $context = array());
63
+
64
+ /**
65
+ * Critical conditions.
66
+ *
67
+ * Example: Application component unavailable, unexpected exception.
68
+ *
69
+ * @param string $message
70
+ * @param array $context
71
+ * @return null
72
+ */
73
+ public function critical($message, array $context = array());
74
+
75
+ /**
76
+ * Runtime errors that do not require immediate action but should typically
77
+ * be logged and monitored.
78
+ *
79
+ * @param string $message
80
+ * @param array $context
81
+ * @return null
82
+ */
83
+ public function error($message, array $context = array());
84
+
85
+ /**
86
+ * Exceptional occurrences that are not errors.
87
+ *
88
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
89
+ * that are not necessarily wrong.
90
+ *
91
+ * @param string $message
92
+ * @param array $context
93
+ * @return null
94
+ */
95
+ public function warning($message, array $context = array());
96
+
97
+ /**
98
+ * Normal but significant events.
99
+ *
100
+ * @param string $message
101
+ * @param array $context
102
+ * @return null
103
+ */
104
+ public function notice($message, array $context = array());
105
+
106
+ /**
107
+ * Interesting events.
108
+ *
109
+ * Example: User logs in, SQL logs.
110
+ *
111
+ * @param string $message
112
+ * @param array $context
113
+ * @return null
114
+ */
115
+ public function info($message, array $context = array());
116
+
117
+ /**
118
+ * Detailed debug information.
119
+ *
120
+ * @param string $message
121
+ * @param array $context
122
+ * @return null
123
+ */
124
+ public function debug($message, array $context = array());
125
+
126
+ /**
127
+ * Logs with an arbitrary level.
128
+ *
129
+ * @param mixed $level
130
+ * @param string $message
131
+ * @param array $context
132
+ * @return null
133
+ */
134
+ public function log($level, $message, array $context = array());
135
+ }
assets/lib/Mustache/Logger/AbstractLogger.php CHANGED
@@ -1,121 +1,121 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * This is a simple Logger implementation that other Loggers can inherit from.
14
- *
15
- * This is identical to the Psr\Log\AbstractLogger.
16
- *
17
- * It simply delegates all log-level-specific methods to the `log` method to
18
- * reduce boilerplate code that a simple Logger that does the same thing with
19
- * messages regardless of the error level has to implement.
20
- */
21
- abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
22
- {
23
- /**
24
- * System is unusable.
25
- *
26
- * @param string $message
27
- * @param array $context
28
- */
29
- public function emergency($message, array $context = array())
30
- {
31
- $this->log(Mustache_Logger::EMERGENCY, $message, $context);
32
- }
33
-
34
- /**
35
- * Action must be taken immediately.
36
- *
37
- * Example: Entire website down, database unavailable, etc. This should
38
- * trigger the SMS alerts and wake you up.
39
- *
40
- * @param string $message
41
- * @param array $context
42
- */
43
- public function alert($message, array $context = array())
44
- {
45
- $this->log(Mustache_Logger::ALERT, $message, $context);
46
- }
47
-
48
- /**
49
- * Critical conditions.
50
- *
51
- * Example: Application component unavailable, unexpected exception.
52
- *
53
- * @param string $message
54
- * @param array $context
55
- */
56
- public function critical($message, array $context = array())
57
- {
58
- $this->log(Mustache_Logger::CRITICAL, $message, $context);
59
- }
60
-
61
- /**
62
- * Runtime errors that do not require immediate action but should typically
63
- * be logged and monitored.
64
- *
65
- * @param string $message
66
- * @param array $context
67
- */
68
- public function error($message, array $context = array())
69
- {
70
- $this->log(Mustache_Logger::ERROR, $message, $context);
71
- }
72
-
73
- /**
74
- * Exceptional occurrences that are not errors.
75
- *
76
- * Example: Use of deprecated APIs, poor use of an API, undesirable things
77
- * that are not necessarily wrong.
78
- *
79
- * @param string $message
80
- * @param array $context
81
- */
82
- public function warning($message, array $context = array())
83
- {
84
- $this->log(Mustache_Logger::WARNING, $message, $context);
85
- }
86
-
87
- /**
88
- * Normal but significant events.
89
- *
90
- * @param string $message
91
- * @param array $context
92
- */
93
- public function notice($message, array $context = array())
94
- {
95
- $this->log(Mustache_Logger::NOTICE, $message, $context);
96
- }
97
-
98
- /**
99
- * Interesting events.
100
- *
101
- * Example: User logs in, SQL logs.
102
- *
103
- * @param string $message
104
- * @param array $context
105
- */
106
- public function info($message, array $context = array())
107
- {
108
- $this->log(Mustache_Logger::INFO, $message, $context);
109
- }
110
-
111
- /**
112
- * Detailed debug information.
113
- *
114
- * @param string $message
115
- * @param array $context
116
- */
117
- public function debug($message, array $context = array())
118
- {
119
- $this->log(Mustache_Logger::DEBUG, $message, $context);
120
- }
121
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * This is a simple Logger implementation that other Loggers can inherit from.
14
+ *
15
+ * This is identical to the Psr\Log\AbstractLogger.
16
+ *
17
+ * It simply delegates all log-level-specific methods to the `log` method to
18
+ * reduce boilerplate code that a simple Logger that does the same thing with
19
+ * messages regardless of the error level has to implement.
20
+ */
21
+ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
22
+ {
23
+ /**
24
+ * System is unusable.
25
+ *
26
+ * @param string $message
27
+ * @param array $context
28
+ */
29
+ public function emergency($message, array $context = array())
30
+ {
31
+ $this->log(Mustache_Logger::EMERGENCY, $message, $context);
32
+ }
33
+
34
+ /**
35
+ * Action must be taken immediately.
36
+ *
37
+ * Example: Entire website down, database unavailable, etc. This should
38
+ * trigger the SMS alerts and wake you up.
39
+ *
40
+ * @param string $message
41
+ * @param array $context
42
+ */
43
+ public function alert($message, array $context = array())
44
+ {
45
+ $this->log(Mustache_Logger::ALERT, $message, $context);
46
+ }
47
+
48
+ /**
49
+ * Critical conditions.
50
+ *
51
+ * Example: Application component unavailable, unexpected exception.
52
+ *
53
+ * @param string $message
54
+ * @param array $context
55
+ */
56
+ public function critical($message, array $context = array())
57
+ {
58
+ $this->log(Mustache_Logger::CRITICAL, $message, $context);
59
+ }
60
+
61
+ /**
62
+ * Runtime errors that do not require immediate action but should typically
63
+ * be logged and monitored.
64
+ *
65
+ * @param string $message
66
+ * @param array $context
67
+ */
68
+ public function error($message, array $context = array())
69
+ {
70
+ $this->log(Mustache_Logger::ERROR, $message, $context);
71
+ }
72
+
73
+ /**
74
+ * Exceptional occurrences that are not errors.
75
+ *
76
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
77
+ * that are not necessarily wrong.
78
+ *
79
+ * @param string $message
80
+ * @param array $context
81
+ */
82
+ public function warning($message, array $context = array())
83
+ {
84
+ $this->log(Mustache_Logger::WARNING, $message, $context);
85
+ }
86
+
87
+ /**
88
+ * Normal but significant events.
89
+ *
90
+ * @param string $message
91
+ * @param array $context
92
+ */
93
+ public function notice($message, array $context = array())
94
+ {
95
+ $this->log(Mustache_Logger::NOTICE, $message, $context);
96
+ }
97
+
98
+ /**
99
+ * Interesting events.
100
+ *
101
+ * Example: User logs in, SQL logs.
102
+ *
103
+ * @param string $message
104
+ * @param array $context
105
+ */
106
+ public function info($message, array $context = array())
107
+ {
108
+ $this->log(Mustache_Logger::INFO, $message, $context);
109
+ }
110
+
111
+ /**
112
+ * Detailed debug information.
113
+ *
114
+ * @param string $message
115
+ * @param array $context
116
+ */
117
+ public function debug($message, array $context = array())
118
+ {
119
+ $this->log(Mustache_Logger::DEBUG, $message, $context);
120
+ }
121
+ }
assets/lib/Mustache/Logger/StreamLogger.php CHANGED
@@ -1,193 +1,193 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * A Mustache Stream Logger.
14
- *
15
- * The Stream Logger wraps a file resource instance (such as a stream) or a
16
- * stream URL. All log messages over the threshold level will be appended to
17
- * this stream.
18
- *
19
- * Hint: Try `php://stderr` for your stream URL.
20
- */
21
- class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
22
- {
23
- protected static $levels = array(
24
- self::DEBUG => 100,
25
- self::INFO => 200,
26
- self::NOTICE => 250,
27
- self::WARNING => 300,
28
- self::ERROR => 400,
29
- self::CRITICAL => 500,
30
- self::ALERT => 550,
31
- self::EMERGENCY => 600,
32
- );
33
-
34
- protected $stream = null;
35
- protected $url = null;
36
-
37
- /**
38
- * @throws InvalidArgumentException if the logging level is unknown.
39
- *
40
- * @param string $stream Resource instance or URL
41
- * @param integer $level The minimum logging level at which this handler will be triggered
42
- */
43
- public function __construct($stream, $level = Mustache_Logger::ERROR)
44
- {
45
- $this->setLevel($level);
46
-
47
- if (is_resource($stream)) {
48
- $this->stream = $stream;
49
- } else {
50
- $this->url = $stream;
51
- }
52
- }
53
-
54
- /**
55
- * Close stream resources.
56
- */
57
- public function __destruct()
58
- {
59
- if (is_resource($this->stream)) {
60
- fclose($this->stream);
61
- }
62
- }
63
-
64
- /**
65
- * Set the minimum logging level.
66
- *
67
- * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
68
- *
69
- * @param integer $level The minimum logging level which will be written
70
- */
71
- public function setLevel($level)
72
- {
73
- if (!array_key_exists($level, self::$levels)) {
74
- throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
75
- }
76
-
77
- $this->level = $level;
78
- }
79
-
80
- /**
81
- * Get the current minimum logging level.
82
- *
83
- * @return integer
84
- */
85
- public function getLevel()
86
- {
87
- return $this->level;
88
- }
89
-
90
- /**
91
- * Logs with an arbitrary level.
92
- *
93
- * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
94
- *
95
- * @param mixed $level
96
- * @param string $message
97
- * @param array $context
98
- */
99
- public function log($level, $message, array $context = array())
100
- {
101
- if (!array_key_exists($level, self::$levels)) {
102
- throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
103
- }
104
-
105
- if (self::$levels[$level] >= self::$levels[$this->level]) {
106
- $this->writeLog($level, $message, $context);
107
- }
108
- }
109
-
110
- /**
111
- * Write a record to the log.
112
- *
113
- * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present.
114
- * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened.
115
- *
116
- * @param integer $level The logging level
117
- * @param string $message The log message
118
- * @param array $context The log context
119
- */
120
- protected function writeLog($level, $message, array $context = array())
121
- {
122
- if (!is_resource($this->stream)) {
123
- if (!isset($this->url)) {
124
- throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
125
- }
126
-
127
- $this->stream = fopen($this->url, 'a');
128
- if (!is_resource($this->stream)) {
129
- // @codeCoverageIgnoreStart
130
- throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url));
131
- // @codeCoverageIgnoreEnd
132
- }
133
- }
134
-
135
- fwrite($this->stream, self::formatLine($level, $message, $context));
136
- }
137
-
138
- /**
139
- * Gets the name of the logging level.
140
- *
141
- * @throws InvalidArgumentException if the logging level is unknown.
142
- *
143
- * @param integer $level
144
- *
145
- * @return string
146
- */
147
- protected static function getLevelName($level)
148
- {
149
- return strtoupper($level);
150
- }
151
-
152
- /**
153
- * Format a log line for output.
154
- *
155
- * @param integer $level The logging level
156
- * @param string $message The log message
157
- * @param array $context The log context
158
- *
159
- * @return string
160
- */
161
- protected static function formatLine($level, $message, array $context = array())
162
- {
163
- return sprintf(
164
- "%s: %s\n",
165
- self::getLevelName($level),
166
- self::interpolateMessage($message, $context)
167
- );
168
- }
169
-
170
- /**
171
- * Interpolate context values into the message placeholders.
172
- *
173
- * @param string $message
174
- * @param array $context
175
- *
176
- * @return string
177
- */
178
- protected static function interpolateMessage($message, array $context = array())
179
- {
180
- if (strpos($message, '{') === false) {
181
- return $message;
182
- }
183
-
184
- // build a replacement array with braces around the context keys
185
- $replace = array();
186
- foreach ($context as $key => $val) {
187
- $replace['{' . $key . '}'] = $val;
188
- }
189
-
190
- // interpolate replacement values into the the message and return
191
- return strtr($message, $replace);
192
- }
193
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Stream Logger.
14
+ *
15
+ * The Stream Logger wraps a file resource instance (such as a stream) or a
16
+ * stream URL. All log messages over the threshold level will be appended to
17
+ * this stream.
18
+ *
19
+ * Hint: Try `php://stderr` for your stream URL.
20
+ */
21
+ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
22
+ {
23
+ protected static $levels = array(
24
+ self::DEBUG => 100,
25
+ self::INFO => 200,
26
+ self::NOTICE => 250,
27
+ self::WARNING => 300,
28
+ self::ERROR => 400,
29
+ self::CRITICAL => 500,
30
+ self::ALERT => 550,
31
+ self::EMERGENCY => 600,
32
+ );
33
+
34
+ protected $stream = null;
35
+ protected $url = null;
36
+
37
+ /**
38
+ * @throws InvalidArgumentException if the logging level is unknown.
39
+ *
40
+ * @param string $stream Resource instance or URL
41
+ * @param integer $level The minimum logging level at which this handler will be triggered
42
+ */
43
+ public function __construct($stream, $level = Mustache_Logger::ERROR)
44
+ {
45
+ $this->setLevel($level);
46
+
47
+ if (is_resource($stream)) {
48
+ $this->stream = $stream;
49
+ } else {
50
+ $this->url = $stream;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Close stream resources.
56
+ */
57
+ public function __destruct()
58
+ {
59
+ if (is_resource($this->stream)) {
60
+ fclose($this->stream);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Set the minimum logging level.
66
+ *
67
+ * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
68
+ *
69
+ * @param integer $level The minimum logging level which will be written
70
+ */
71
+ public function setLevel($level)
72
+ {
73
+ if (!array_key_exists($level, self::$levels)) {
74
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
75
+ }
76
+
77
+ $this->level = $level;
78
+ }
79
+
80
+ /**
81
+ * Get the current minimum logging level.
82
+ *
83
+ * @return integer
84
+ */
85
+ public function getLevel()
86
+ {
87
+ return $this->level;
88
+ }
89
+
90
+ /**
91
+ * Logs with an arbitrary level.
92
+ *
93
+ * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
94
+ *
95
+ * @param mixed $level
96
+ * @param string $message
97
+ * @param array $context
98
+ */
99
+ public function log($level, $message, array $context = array())
100
+ {
101
+ if (!array_key_exists($level, self::$levels)) {
102
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
103
+ }
104
+
105
+ if (self::$levels[$level] >= self::$levels[$this->level]) {
106
+ $this->writeLog($level, $message, $context);
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Write a record to the log.
112
+ *
113
+ * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present.
114
+ * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened.
115
+ *
116
+ * @param integer $level The logging level
117
+ * @param string $message The log message
118
+ * @param array $context The log context
119
+ */
120
+ protected function writeLog($level, $message, array $context = array())
121
+ {
122
+ if (!is_resource($this->stream)) {
123
+ if (!isset($this->url)) {
124
+ throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
125
+ }
126
+
127
+ $this->stream = fopen($this->url, 'a');
128
+ if (!is_resource($this->stream)) {
129
+ // @codeCoverageIgnoreStart
130
+ throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url));
131
+ // @codeCoverageIgnoreEnd
132
+ }
133
+ }
134
+
135
+ fwrite($this->stream, self::formatLine($level, $message, $context));
136
+ }
137
+
138
+ /**
139
+ * Gets the name of the logging level.
140
+ *
141
+ * @throws InvalidArgumentException if the logging level is unknown.
142
+ *
143
+ * @param integer $level
144
+ *
145
+ * @return string
146
+ */
147
+ protected static function getLevelName($level)
148
+ {
149
+ return strtoupper($level);
150
+ }
151
+
152
+ /**
153
+ * Format a log line for output.
154
+ *
155
+ * @param integer $level The logging level
156
+ * @param string $message The log message
157
+ * @param array $context The log context
158
+ *
159
+ * @return string
160
+ */
161
+ protected static function formatLine($level, $message, array $context = array())
162
+ {
163
+ return sprintf(
164
+ "%s: %s\n",
165
+ self::getLevelName($level),
166
+ self::interpolateMessage($message, $context)
167
+ );
168
+ }
169
+
170
+ /**
171
+ * Interpolate context values into the message placeholders.
172
+ *
173
+ * @param string $message
174
+ * @param array $context
175
+ *
176
+ * @return string
177
+ */
178
+ protected static function interpolateMessage($message, array $context = array())
179
+ {
180
+ if (strpos($message, '{') === false) {
181
+ return $message;
182
+ }
183
+
184
+ // build a replacement array with braces around the context keys
185
+ $replace = array();
186
+ foreach ($context as $key => $val) {
187
+ $replace['{' . $key . '}'] = $val;
188
+ }
189
+
190
+ // interpolate replacement values into the the message and return
191
+ return strtr($message, $replace);
192
+ }
193
+ }
assets/lib/Mustache/Parser.php CHANGED
@@ -1,194 +1,194 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Mustache Parser class.
14
- *
15
- * This class is responsible for turning a set of Mustache tokens into a parse tree.
16
- */
17
- class Mustache_Parser
18
- {
19
- private $lineNum;
20
- private $lineTokens;
21
-
22
- /**
23
- * Process an array of Mustache tokens and convert them into a parse tree.
24
- *
25
- * @param array $tokens Set of Mustache tokens
26
- *
27
- * @return array Mustache token parse tree
28
- */
29
- public function parse(array $tokens = array())
30
- {
31
- $this->lineNum = -1;
32
- $this->lineTokens = 0;
33
-
34
- return $this->buildTree($tokens);
35
- }
36
-
37
- /**
38
- * Helper method for recursively building a parse tree.
39
- *
40
- * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered.
41
- *
42
- * @param array &$tokens Set of Mustache tokens
43
- * @param array $parent Parent token (default: null)
44
- *
45
- * @return array Mustache Token parse tree
46
- */
47
- private function buildTree(array &$tokens, array $parent = null)
48
- {
49
- $nodes = array();
50
-
51
- while (!empty($tokens)) {
52
- $token = array_shift($tokens);
53
-
54
- if ($token[Mustache_Tokenizer::LINE] === $this->lineNum) {
55
- $this->lineTokens++;
56
- } else {
57
- $this->lineNum = $token[Mustache_Tokenizer::LINE];
58
- $this->lineTokens = 0;
59
- }
60
-
61
- switch ($token[Mustache_Tokenizer::TYPE]) {
62
- case Mustache_Tokenizer::T_DELIM_CHANGE:
63
- $this->clearStandaloneLines($nodes, $tokens);
64
- break;
65
-
66
- case Mustache_Tokenizer::T_SECTION:
67
- case Mustache_Tokenizer::T_INVERTED:
68
- $this->clearStandaloneLines($nodes, $tokens);
69
- $nodes[] = $this->buildTree($tokens, $token);
70
- break;
71
-
72
- case Mustache_Tokenizer::T_END_SECTION:
73
- if (!isset($parent)) {
74
- $msg = sprintf('Unexpected closing tag: /%s', $token[Mustache_Tokenizer::NAME]);
75
- throw new Mustache_Exception_SyntaxException($msg, $token);
76
- }
77
-
78
- if ($token[Mustache_Tokenizer::NAME] !== $parent[Mustache_Tokenizer::NAME]) {
79
- $msg = sprintf('Nesting error: %s vs. %s', $parent[Mustache_Tokenizer::NAME], $token[Mustache_Tokenizer::NAME]);
80
- throw new Mustache_Exception_SyntaxException($msg, $token);
81
- }
82
-
83
- $this->clearStandaloneLines($nodes, $tokens);
84
- $parent[Mustache_Tokenizer::END] = $token[Mustache_Tokenizer::INDEX];
85
- $parent[Mustache_Tokenizer::NODES] = $nodes;
86
-
87
- return $parent;
88
- break;
89
-
90
- case Mustache_Tokenizer::T_PARTIAL:
91
- case Mustache_Tokenizer::T_PARTIAL_2:
92
- // store the whitespace prefix for laters!
93
- if ($indent = $this->clearStandaloneLines($nodes, $tokens)) {
94
- $token[Mustache_Tokenizer::INDENT] = $indent[Mustache_Tokenizer::VALUE];
95
- }
96
- $nodes[] = $token;
97
- break;
98
-
99
- case Mustache_Tokenizer::T_PRAGMA:
100
- case Mustache_Tokenizer::T_COMMENT:
101
- $this->clearStandaloneLines($nodes, $tokens);
102
- $nodes[] = $token;
103
- break;
104
-
105
- default:
106
- $nodes[] = $token;
107
- break;
108
- }
109
- }
110
-
111
- if (isset($parent)) {
112
- $msg = sprintf('Missing closing tag: %s', $parent[Mustache_Tokenizer::NAME]);
113
- throw new Mustache_Exception_SyntaxException($msg, $parent);
114
- }
115
-
116
- return $nodes;
117
- }
118
-
119
- /**
120
- * Clear standalone line tokens.
121
- *
122
- * Returns a whitespace token for indenting partials, if applicable.
123
- *
124
- * @param array $nodes Parsed nodes.
125
- * @param array $tokens Tokens to be parsed.
126
- *
127
- * @return array Resulting indent token, if any.
128
- */
129
- private function clearStandaloneLines(array &$nodes, array &$tokens)
130
- {
131
- if ($this->lineTokens > 1) {
132
- // this is the third or later node on this line, so it can't be standalone
133
- return;
134
- }
135
-
136
- $prev = null;
137
- if ($this->lineTokens === 1) {
138
- // this is the second node on this line, so it can't be standalone
139
- // unless the previous node is whitespace.
140
- if ($prev = end($nodes)) {
141
- if (!$this->tokenIsWhitespace($prev)) {
142
- return;
143
- }
144
- }
145
- }
146
-
147
- $next = null;
148
- if ($next = reset($tokens)) {
149
- // If we're on a new line, bail.
150
- if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
151
- return;
152
- }
153
-
154
- // If the next token isn't whitespace, bail.
155
- if (!$this->tokenIsWhitespace($next)) {
156
- return;
157
- }
158
-
159
- if (count($tokens) !== 1) {
160
- // Unless it's the last token in the template, the next token
161
- // must end in newline for this to be standalone.
162
- if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
163
- return;
164
- }
165
- }
166
-
167
- // Discard the whitespace suffix
168
- array_shift($tokens);
169
- }
170
-
171
- if ($prev) {
172
- // Return the whitespace prefix, if any
173
- return array_pop($nodes);
174
- }
175
- }
176
-
177
- /**
178
- * Check whether token is a whitespace token.
179
- *
180
- * True if token type is T_TEXT and value is all whitespace characters.
181
- *
182
- * @param array $token
183
- *
184
- * @return boolean True if token is a whitespace token
185
- */
186
- private function tokenIsWhitespace(array $token)
187
- {
188
- if ($token[Mustache_Tokenizer::TYPE] == Mustache_Tokenizer::T_TEXT) {
189
- return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]);
190
- }
191
-
192
- return false;
193
- }
194
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2012 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Parser class.
14
+ *
15
+ * This class is responsible for turning a set of Mustache tokens into a parse tree.
16
+ */
17
+ class Mustache_Parser
18
+ {
19
+ private $lineNum;
20
+ private $lineTokens;
21
+
22
+ /**
23
+ * Process an array of Mustache tokens and convert them into a parse tree.
24
+ *
25
+ * @param array $tokens Set of Mustache tokens
26
+ *
27
+ * @return array Mustache token parse tree
28
+ */
29
+ public function parse(array $tokens = array())
30
+ {
31
+ $this->lineNum = -1;
32
+ $this->lineTokens = 0;
33
+
34
+ return $this->buildTree($tokens);
35
+ }
36
+
37
+ /**
38
+ * Helper method for recursively building a parse tree.
39
+ *
40
+ * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered.
41
+ *
42
+ * @param array &$tokens Set of Mustache tokens
43
+ * @param array $parent Parent token (default: null)
44
+ *
45
+ * @return array Mustache Token parse tree
46
+ */
47
+ private function buildTree(array &$tokens, array $parent = null)
48
+ {
49
+ $nodes = array();
50
+
51
+ while (!empty($tokens)) {
52
+ $token = array_shift($tokens);
53
+
54
+ if ($token[Mustache_Tokenizer::LINE] === $this->lineNum) {
55
+ $this->lineTokens++;
56
+ } else {
57
+ $this->lineNum = $token[Mustache_Tokenizer::LINE];
58
+ $this->lineTokens = 0;
59
+ }
60
+
61
+ switch ($token[Mustache_Tokenizer::TYPE]) {
62
+ case Mustache_Tokenizer::T_DELIM_CHANGE:
63
+ $this->clearStandaloneLines($nodes, $tokens);
64
+ break;
65
+
66
+ case Mustache_Tokenizer::T_SECTION:
67
+ case Mustache_Tokenizer::T_INVERTED:
68
+ $this->clearStandaloneLines($nodes, $tokens);
69
+ $nodes[] = $this->buildTree($tokens, $token);
70
+ break;
71
+
72
+ case Mustache_Tokenizer::T_END_SECTION:
73
+ if (!isset($parent)) {
74
+ $msg = sprintf('Unexpected closing tag: /%s', $token[Mustache_Tokenizer::NAME]);
75
+ throw new Mustache_Exception_SyntaxException($msg, $token);
76
+ }
77
+
78
+ if ($token[Mustache_Tokenizer::NAME] !== $parent[Mustache_Tokenizer::NAME]) {
79
+ $msg = sprintf('Nesting error: %s vs. %s', $parent[Mustache_Tokenizer::NAME], $token[Mustache_Tokenizer::NAME]);
80
+ throw new Mustache_Exception_SyntaxException($msg, $token);
81
+ }
82
+
83
+ $this->clearStandaloneLines($nodes, $tokens);
84
+ $parent[Mustache_Tokenizer::END] = $token[Mustache_Tokenizer::INDEX];
85
+ $parent[Mustache_Tokenizer::NODES] = $nodes;
86
+
87
+ return $parent;
88
+ break;
89
+
90
+ case Mustache_Tokenizer::T_PARTIAL:
91
+ case Mustache_Tokenizer::T_PARTIAL_2:
92
+ // store the whitespace prefix for laters!
93
+ if ($indent = $this->clearStandaloneLines($nodes, $tokens)) {
94
+ $token[Mustache_Tokenizer::INDENT] = $indent[Mustache_Tokenizer::VALUE];
95
+ }
96
+ $nodes[] = $token;
97
+ break;
98
+
99
+ case Mustache_Tokenizer::T_PRAGMA:
100
+ case Mustache_Tokenizer::T_COMMENT:
101
+ $this->clearStandaloneLines($nodes, $tokens);
102
+ $nodes[] = $token;
103
+ break;
104
+
105
+ default:
106
+ $nodes[] = $token;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (isset($parent)) {
112
+ $msg = sprintf('Missing closing tag: %s', $parent[Mustache_Tokenizer::NAME]);
113
+ throw new Mustache_Exception_SyntaxException($msg, $parent);
114
+ }
115
+
116
+ return $nodes;
117
+ }
118
+
119
+ /**
120
+ * Clear standalone line tokens.
121
+ *
122
+ * Returns a whitespace token for indenting partials, if applicable.
123
+ *
124
+ * @param array $nodes Parsed nodes.
125
+ * @param array $tokens Tokens to be parsed.
126
+ *
127
+ * @return array Resulting indent token, if any.
128
+ */
129
+ private function clearStandaloneLines(array &$nodes, array &$tokens)
130
+ {
131
+ if ($this->lineTokens > 1) {
132
+ // this is the third or later node on this line, so it can't be standalone
133
+ return;
134
+ }
135
+
136
+ $prev = null;
137
+ if ($this->lineTokens === 1) {
138
+ // this is the second node on this line, so it can't be standalone
139
+ // unless the previous node is whitespace.
140
+ if ($prev = end($nodes)) {
141
+ if (!$this->tokenIsWhitespace($prev)) {
142
+ return;
143
+ }
144
+ }
145
+ }
146
+
147
+ $next = null;
148
+ if ($next = reset($tokens)) {
149
+ // If we're on a new line, bail.
150
+ if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
151
+ return;
152
+ }
153
+
154
+ // If the next token isn't whitespace, bail.
155
+ if (!$this->tokenIsWhitespace($next)) {
156
+ return;
157
+ }
158
+
159
+ if (count($tokens) !== 1) {
160
+ // Unless it's the last token in the template, the next token
161
+ // must end in newline for this to be standalone.
162
+ if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
163
+ return;
164
+ }
165
+ }
166
+
167
+ // Discard the whitespace suffix
168
+ array_shift($tokens);
169
+ }
170
+
171
+ if ($prev) {
172
+ // Return the whitespace prefix, if any
173
+ return array_pop($nodes);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Check whether token is a whitespace token.
179
+ *
180
+ * True if token type is T_TEXT and value is all whitespace characters.
181
+ *
182
+ * @param array $token
183
+ *
184
+ * @return boolean True if token is a whitespace token
185
+ */
186
+ private function tokenIsWhitespace(array $token)
187
+ {
188
+ if ($token[Mustache_Tokenizer::TYPE] == Mustache_Tokenizer::T_TEXT) {
189
+ return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]);
190
+ }
191
+
192
+ return false;
193
+ }
194
+ }
assets/lib/Mustache/Template.php CHANGED
@@ -1,177 +1,177 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Mustache.php.
5
- *
6
- * (c) 2012 Justin Hileman
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- /**
13
- * Abstract Mustache Template class.
14
- *
15
- * @abstract
16
- */
17
- abstract class Mustache_Template
18
- {
19
-
20
- /**
21
- * @var Mustache_Engine
22
- */
23
- protected $mustache;
24
-
25
- /**
26
- * @var boolean
27
- */
28
- protected $strictCallables = false;
29
-
30
- /**
31
- * Mustache Template constructor.
32
- *
33
- * @param Mustache_Engine $mustache
34
- */
35
- public function __construct(Mustache_Engine $mustache)
36
- {
37
- $this->mustache = $mustache;
38
- }
39
-
40
- /**
41
- * Mustache Template instances can be treated as a function and rendered by simply calling them:
42
- *
43
- * $m = new Mustache_Engine;
44
- * $tpl = $m->loadTemplate('Hello, {{ name }}!');
45
- * echo $tpl(array('name' => 'World')); // "Hello, World!"
46
- *
47
- * @see Mustache_Template::render
48
- *
49
- * @param mixed $context Array or object rendering context (default: array())
50
- *
51
- * @return string Rendered template
52
- */
53
- public function __invoke($context = array())
54
- {
55
- return $this->render($context);
56
- }
57
-
58
- /**
59
- * Render this template given the rendering context.
60
- *
61
- * @param mixed $context Array or object rendering context (default: array())
62
- *
63
- * @return string Rendered template
64
- */
65
- public function render($context = array())
66
- {
67
- return $this->renderInternal($this->prepareContextStack($context));
68
- }
69
-
70
- /**
71
- * Internal rendering method implemented by Mustache Template concrete subclasses.
72
- *
73
- * This is where the magic happens :)
74
- *
75
- * NOTE: This method is not part of the Mustache.php public API.
76
- *
77
- * @param Mustache_Context $context
78
- * @param string $indent (default: '')
79
- *
80
- * @return string Rendered template
81
- */
82
- abstract public function renderInternal(Mustache_Context $context, $indent = '');
83
-
84
- /**
85
- * Tests whether a value should be iterated over (e.g. in a section context).
86
- *
87
- * In most languages there are two distinct array types: list and hash (or whatever you want to call them). Lists
88
- * should be iterated, hashes should be treated as objects. Mustache follows this paradigm for Ruby, Javascript,
89
- * Java, Python, etc.
90
- *
91
- * PHP, however, treats lists and hashes as one primitive type: array. So Mustache.php needs a way to distinguish
92
- * between between a list of things (numeric, normalized array) and a set of variab