User registration & user profile – Profile Builder - Version 2.6.2

Version Description

  • Added Role Editor which grants you control over roles and capabilities on your site.
  • Added reacaptcha field for Profile Builder forms and WordPress default forms
  • Added User Role select field
  • We now prevent our forms from executing in the header on the wp_head hook to prevent conflicts with other plugins like Yoast SEO
  • Improved WPML compatibility with login forms
  • Now checkboxes retain their value on edit profile forms if the form errors out
  • Changed the way we set the default settings that was sometimes not adding them properly
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 2.6.2
Comparing to
See all releases

Code changes from version 2.6.1 to 2.6.2

Files changed (69) hide show
  1. admin/general-settings.php +20 -4
  2. admin/manage-fields.php +5 -2
  3. assets/css/select2/select2.min.css +1 -0
  4. assets/js/jquery-email-confirmation.js +15 -0
  5. assets/js/select2/i18n/ar.js +3 -0
  6. assets/js/select2/i18n/az.js +3 -0
  7. assets/js/select2/i18n/bg.js +3 -0
  8. assets/js/select2/i18n/ca.js +3 -0
  9. assets/js/select2/i18n/cs.js +3 -0
  10. assets/js/select2/i18n/da.js +3 -0
  11. assets/js/select2/i18n/de.js +3 -0
  12. assets/js/select2/i18n/el.js +3 -0
  13. assets/js/select2/i18n/en.js +3 -0
  14. assets/js/select2/i18n/es.js +3 -0
  15. assets/js/select2/i18n/et.js +3 -0
  16. assets/js/select2/i18n/eu.js +3 -0
  17. assets/js/select2/i18n/fa.js +3 -0
  18. assets/js/select2/i18n/fi.js +3 -0
  19. assets/js/select2/i18n/fr.js +3 -0
  20. assets/js/select2/i18n/gl.js +3 -0
  21. assets/js/select2/i18n/he.js +3 -0
  22. assets/js/select2/i18n/hi.js +3 -0
  23. assets/js/select2/i18n/hr.js +3 -0
  24. assets/js/select2/i18n/hu.js +3 -0
  25. assets/js/select2/i18n/id.js +3 -0
  26. assets/js/select2/i18n/is.js +3 -0
  27. assets/js/select2/i18n/it.js +3 -0
  28. assets/js/select2/i18n/ja.js +3 -0
  29. assets/js/select2/i18n/km.js +3 -0
  30. assets/js/select2/i18n/ko.js +3 -0
  31. assets/js/select2/i18n/lt.js +3 -0
  32. assets/js/select2/i18n/lv.js +3 -0
  33. assets/js/select2/i18n/mk.js +3 -0
  34. assets/js/select2/i18n/ms.js +3 -0
  35. assets/js/select2/i18n/nb.js +3 -0
  36. assets/js/select2/i18n/nl.js +3 -0
  37. assets/js/select2/i18n/pl.js +3 -0
  38. assets/js/select2/i18n/pt-BR.js +3 -0
  39. assets/js/select2/i18n/pt.js +3 -0
  40. assets/js/select2/i18n/ro.js +3 -0
  41. assets/js/select2/i18n/ru.js +3 -0
  42. assets/js/select2/i18n/sk.js +3 -0
  43. assets/js/select2/i18n/sr-Cyrl.js +3 -0
  44. assets/js/select2/i18n/sr.js +3 -0
  45. assets/js/select2/i18n/sv.js +3 -0
  46. assets/js/select2/i18n/th.js +3 -0
  47. assets/js/select2/i18n/tr.js +3 -0
  48. assets/js/select2/i18n/uk.js +3 -0
  49. assets/js/select2/i18n/vi.js +3 -0
  50. assets/js/select2/i18n/zh-CN.js +3 -0
  51. assets/js/select2/i18n/zh-TW.js +3 -0
  52. assets/js/select2/select2.min.js +3 -0
  53. assets/misc/plugin-compatibilities.php +11 -2
  54. features/roles-editor/assets/css/roles-editor.css +480 -0
  55. features/roles-editor/assets/font/wppb_re_font.eot +0 -0
  56. features/roles-editor/assets/font/wppb_re_font.svg +18 -0
  57. features/roles-editor/assets/font/wppb_re_font.ttf +0 -0
  58. features/roles-editor/assets/font/wppb_re_font.woff +0 -0
  59. features/roles-editor/assets/font/wppb_re_font.woff2 +0 -0
  60. features/roles-editor/assets/js/roles-editor.js +510 -0
  61. features/roles-editor/roles-editor.php +1042 -0
  62. front-end/class-formbuilder.php +11 -0
  63. front-end/default-fields/default-fields.php +4 -0
  64. front-end/default-fields/recaptcha/recaptcha.php +478 -0
  65. front-end/default-fields/user-role/user-role.php +137 -0
  66. index.php +8 -6
  67. readme.txt +17 -4
  68. screenshot-11.png +0 -0
  69. screenshot-12.png +0 -0
admin/general-settings.php CHANGED
@@ -13,10 +13,7 @@ add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
13
 
14
 
15
  function wppb_generate_default_settings_defaults(){
16
- $wppb_general_settings = get_option( 'wppb_general_settings', 'not_found' );
17
-
18
- if ( $wppb_general_settings == 'not_found' )
19
- update_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail' ) );
20
  }
21
 
22
 
@@ -141,6 +138,25 @@ function wppb_general_settings_content() {
141
 
142
  <?php } ?>
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  <?php
145
  if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
146
  ?>
13
 
14
 
15
  function wppb_generate_default_settings_defaults(){
16
+ add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no' ) );
 
 
 
17
  }
18
 
19
 
138
 
139
  <?php } ?>
140
 
141
+ <?php
142
+ if( file_exists( WPPB_PLUGIN_DIR.'/features/roles-editor/roles-editor.php' ) ) {
143
+ ?>
144
+ <tr>
145
+ <th scope="row">
146
+ <?php _e( '"Roles Editor" Activated:', 'profile-builder' ); ?>
147
+ </th>
148
+ <td>
149
+ <select id="rolesEditorSelect" name="wppb_general_settings[rolesEditor]" class="wppb-select" onchange="wppb_display_page_select_re(this.value)">
150
+ <option value="no" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profile-builder' ); ?></option>
151
+ <option value="yes" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profile-builder' ); ?></option>
152
+ </select>
153
+ <ul>
154
+ <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>
155
+ <ul>
156
+ </td>
157
+ </tr>
158
+ <?php } ?>
159
+
160
  <?php
161
  if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
162
  ?>
admin/manage-fields.php CHANGED
@@ -46,6 +46,10 @@ function wppb_manage_fields_submenu(){
46
  $manage_field_types[] = 'Default - Blog Details';
47
  }
48
 
 
 
 
 
49
  if( PROFILE_BUILDER != 'Profile Builder Free' ) {
50
  $manage_field_types[] = 'Heading';
51
  $manage_field_types[] = 'Input';
@@ -58,7 +62,6 @@ function wppb_manage_fields_submenu(){
58
  $manage_field_types[] = 'Select (Multiple)';
59
  $manage_field_types[] = 'Select (Country)';
60
  $manage_field_types[] = 'Select (Timezone)';
61
- $manage_field_types[] = 'Select (User Role)';
62
  $manage_field_types[] = 'Select (Currency)';
63
  $manage_field_types[] = 'Select (CPT)';
64
  $manage_field_types[] = 'Checkbox';
@@ -69,7 +72,6 @@ function wppb_manage_fields_submenu(){
69
  $manage_field_types[] = 'Datepicker';
70
  $manage_field_types[] = 'Timepicker';
71
  $manage_field_types[] = 'Colorpicker';
72
- $manage_field_types[] = 'reCAPTCHA';
73
  $manage_field_types[] = 'Validation';
74
  $manage_field_types[] = 'Map';
75
  $manage_field_types[] = 'HTML';
@@ -170,6 +172,7 @@ function wppb_manage_fields_submenu(){
170
  );
171
  new Wordpress_Creation_Kit_PB( $args );
172
 
 
173
  wppb_prepopulate_fields();
174
 
175
  // create the info side meta-box
46
  $manage_field_types[] = 'Default - Blog Details';
47
  }
48
 
49
+ /* added recaptcha and user role field since version 2.6.2 */
50
+ $manage_field_types[] = 'reCAPTCHA';
51
+ $manage_field_types[] = 'Select (User Role)';
52
+
53
  if( PROFILE_BUILDER != 'Profile Builder Free' ) {
54
  $manage_field_types[] = 'Heading';
55
  $manage_field_types[] = 'Input';
62
  $manage_field_types[] = 'Select (Multiple)';
63
  $manage_field_types[] = 'Select (Country)';
64
  $manage_field_types[] = 'Select (Timezone)';
 
65
  $manage_field_types[] = 'Select (Currency)';
66
  $manage_field_types[] = 'Select (CPT)';
67
  $manage_field_types[] = 'Checkbox';
72
  $manage_field_types[] = 'Datepicker';
73
  $manage_field_types[] = 'Timepicker';
74
  $manage_field_types[] = 'Colorpicker';
 
75
  $manage_field_types[] = 'Validation';
76
  $manage_field_types[] = 'Map';
77
  $manage_field_types[] = 'HTML';
172
  );
173
  new Wordpress_Creation_Kit_PB( $args );
174
 
175
+ /* this is redundant but it should have a very low impact and for comfort we leave it here as well */
176
  wppb_prepopulate_fields();
177
 
178
  // create the info side meta-box
assets/css/select2/select2.min.css ADDED
@@ -0,0 +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}
assets/js/jquery-email-confirmation.js CHANGED
@@ -18,6 +18,14 @@ function wppb_display_page_select_aa( value ){
18
  jQuery ( '.dynamic2' ).hide();
19
  }
20
 
 
 
 
 
 
 
 
 
21
 
22
  jQuery(function() {
23
  if ( ( jQuery( '#wppb_settings_email_confirmation' ).val() == 'yes' ) || ( jQuery( '#wppb_general_settings_hidden' ).val() == 'multisite' ) ){
@@ -35,4 +43,11 @@ jQuery(function() {
35
 
36
  else
37
  jQuery ( '.dynamic2' ).hide();
 
 
 
 
 
 
 
38
  });
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
 
30
  jQuery(function() {
31
  if ( ( jQuery( '#wppb_settings_email_confirmation' ).val() == 'yes' ) || ( jQuery( '#wppb_general_settings_hidden' ).val() == 'multisite' ) ){
43
 
44
  else
45
  jQuery ( '.dynamic2' ).hide();
46
+
47
+
48
+ if ( jQuery( '#rolesEditorSelect' ).val() == 'yes' )
49
+ jQuery ( '.dynamic3' ).show();
50
+
51
+ else
52
+ jQuery ( '.dynamic3' ).hide();
53
  });
assets/js/select2/i18n/ar.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/az.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/bg.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ca.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/cs.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/da.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/de.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/el.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/en.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/es.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/et.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/eu.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/fa.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/fi.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/fr.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/gl.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/he.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/hi.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/hr.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/hu.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/id.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/is.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/it.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ja.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/km.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ko.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/lt.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/lv.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/mk.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ms.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/nb.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/nl.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/pl.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/pt-BR.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/pt.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ro.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/ru.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/sk.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/sr-Cyrl.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/sr.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/sv.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/th.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/tr.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/uk.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/vi.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/zh-CN.js ADDED
@@ -0,0 +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}})();
assets/js/select2/i18n/zh-TW.js ADDED
@@ -0,0 +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}})();
assets/js/select2/select2.min.js ADDED
@@ -0,0 +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});
assets/misc/plugin-compatibilities.php CHANGED
@@ -285,8 +285,17 @@
285
  if( $path == 'wp-login.php' ) {
286
  if( !empty( $_GET['lang'] ) )
287
  $url = add_query_arg('lang', ICL_LANGUAGE_CODE, $url);
288
- else
289
- $url = get_home_url() . '/' . $path;
 
 
 
 
 
 
 
 
 
290
  }
291
  }
292
  return $url;
285
  if( $path == 'wp-login.php' ) {
286
  if( !empty( $_GET['lang'] ) )
287
  $url = add_query_arg('lang', ICL_LANGUAGE_CODE, $url);
288
+ else{
289
+ /* let's see if the directory structure exists for wp-login.php */
290
+ stream_context_set_default( array( 'http' => array( 'method' => 'HEAD' ) ) );
291
+ $headers = get_headers( get_home_url() . '/' . $path );
292
+ if( strpos( $headers[0], '200') !== false ){
293
+ $url = get_home_url() . '/' . $path;
294
+ }
295
+ else {
296
+ $url = add_query_arg('lang', ICL_LANGUAGE_CODE, $url);
297
+ }
298
+ }
299
  }
300
  }
301
  return $url;
features/roles-editor/assets/css/roles-editor.css ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'wppb_re_font';
3
+ src: url('../font/wppb_re_font.eot?45804157');
4
+ src: url('../font/wppb_re_font.eot?45804157#iefix') format('embedded-opentype'),
5
+ url('../font/wppb_re_font.woff2?45804157') format('woff2'),
6
+ url('../font/wppb_re_font.woff?45804157') format('woff'),
7
+ url('../font/wppb_re_font.ttf?45804157') format('truetype'),
8
+ url('../font/wppb_re_font.svg?45804157#wppb_re_font') format('svg');
9
+ font-weight: normal;
10
+ font-style: normal;
11
+ }
12
+ /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
13
+ /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
14
+ /*
15
+ @media screen and (-webkit-min-device-pixel-ratio:0) {
16
+ @font-face {
17
+ font-family: 'wppb_re_font';
18
+ src: url('../font/wppb_re_font.svg?45804157#wppb_re_font') format('svg');
19
+ }
20
+ }
21
+ */
22
+
23
+ [class^="icon-wppb-re-"]:before, [class*=" icon-wppb-re-"]:before {
24
+ font-family: "wppb_re_font";
25
+ font-style: normal;
26
+ font-weight: normal;
27
+ speak: none;
28
+
29
+ display: inline-block;
30
+ text-decoration: inherit;
31
+ width: 1em;
32
+ margin-right: .2em;
33
+ text-align: center;
34
+ /* opacity: .8; */
35
+
36
+ /* For safety - reset parent styles, that can break glyph codes*/
37
+ font-variant: normal;
38
+ text-transform: none;
39
+
40
+ /* fix buttons height, for twitter bootstrap */
41
+ line-height: 1em;
42
+
43
+ /* Animation center compensation - margins should be symmetric */
44
+ /* remove if not needed */
45
+ margin-left: .2em;
46
+
47
+ /* you can be more comfortable with increased icons size */
48
+ /* font-size: 120%; */
49
+
50
+ /* Font smoothing. That was taken from TWBS */
51
+ -webkit-font-smoothing: antialiased;
52
+ -moz-osx-font-smoothing: grayscale;
53
+
54
+ /* Uncomment for 3D effect */
55
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
56
+ }
57
+
58
+ .icon-wppb-re-users:before { content: '\e801'; } /* '' */
59
+ .icon-wppb-re-slug:before { content: '\e802'; } /* '' */
60
+ .icon-wppb-re-caps:before { content: '\e803'; } /* '' */
61
+ .icon-wppb-re-spinner:before { content: '\e838'; } /* '' */
62
+
63
+ .post-type-wppb-roles-editor .table-role-info {
64
+ font-size: 13px;
65
+ }
66
+
67
+ .post-type-wppb-roles-editor #post-query-submit {
68
+ display: none;
69
+ }
70
+
71
+ .post-type-wppb-roles-editor .column-role {
72
+ width: 25%;
73
+ }
74
+
75
+ .post-type-wppb-roles-editor .column-capabilities {
76
+ width: 15%;
77
+ text-align: center;
78
+ }
79
+
80
+ .post-type-wppb-roles-editor .column-users {
81
+ width: 10%;
82
+ text-align: center;
83
+ }
84
+
85
+ .post-type-wppb-roles-editor .wppb-delete-capability-disabled,
86
+ .post-type-wppb-roles-editor .row-actions span.delete_notify {
87
+ color: #a00;
88
+ cursor: not-allowed;
89
+ }
90
+
91
+ .post-type-wppb-roles-editor .misc-pub-section .icon-wppb-re-users,
92
+ .post-type-wppb-roles-editor .misc-pub-section .icon-wppb-re-slug,
93
+ .post-type-wppb-roles-editor .misc-pub-section .icon-wppb-re-caps {
94
+ font-size: 20px;
95
+ }
96
+
97
+ .post-type-wppb-roles-editor #wppb-role-edit-add-caps {
98
+ height: 100px;
99
+ }
100
+
101
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities .select2 .select2-container {
102
+ padding: 0 5px 5px 0 !important;
103
+ }
104
+
105
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities a.button-primary {
106
+ vertical-align: top;
107
+ margin: 1px 0 0 10px;
108
+ height: 32px;
109
+ line-height: 30px;
110
+ }
111
+
112
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities #wppb-add-new-cap-link {
113
+ margin: 10px 5px;
114
+ }
115
+
116
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities #wppb-add-new-cap-link a:link,
117
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities #wppb-add-new-cap-link a:hover,
118
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities #wppb-add-new-cap-link a:visited,
119
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities #wppb-add-new-cap-link a:active {
120
+ text-decoration: none;
121
+ box-shadow: none;
122
+ }
123
+
124
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities .wppb-add-new-cap-input {
125
+ display: none;
126
+ vertical-align: middle;
127
+ width: 40%;
128
+ line-height: 20px;
129
+ padding-bottom: 10px;
130
+ border: 1px solid #AAAAAA;
131
+ border-radius: 4px;
132
+ outline: none;
133
+ box-shadow: none;
134
+ font-size: 13px;
135
+ margin: 0;
136
+ }
137
+
138
+ .post-type-wppb-roles-editor #wppb_edit_role_capabilities .wppb-add-new-cap-input:focus {
139
+ border: 1px solid #000;
140
+ outline: none;
141
+ box-shadow: none;
142
+ }
143
+
144
+ .post-type-wppb-roles-editor #wppb-duplicate-capability-error,
145
+ .post-type-wppb-roles-editor #wppb-hidden-capability-error,
146
+ .post-type-wppb-roles-editor #wppb-add-capability-error {
147
+ border-left: 3px solid #a00;
148
+ display: none;
149
+ color: #a00;
150
+ font-size: 14px;
151
+ margin-left: 6px;
152
+ padding: 5px 10px;
153
+ line-height: 35px;
154
+ vertical-align: top;
155
+ }
156
+
157
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs {
158
+ float: left;
159
+ width: 11%;
160
+ min-width: 150px;
161
+ padding: 20px 0 0 5px;
162
+ margin: 0;
163
+ }
164
+
165
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title {
166
+ margin: 5px 0.5% 5px 0.5%;
167
+ /*padding: 10px 0 10px 10px;*/
168
+ background-color: #f7f7f7;
169
+ }
170
+
171
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title i {
172
+ margin-right: 10px;
173
+ line-height: 25px;
174
+ }
175
+
176
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title a {
177
+ text-decoration: none;
178
+ color: inherit;
179
+ display: block;
180
+ padding: 10px 0 10px 10px;
181
+ height: 24px;
182
+ line-height: 24px;
183
+ }
184
+
185
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title a:active,
186
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title a:focus,
187
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title a:hover {
188
+ text-decoration: none;
189
+ color: #a00;
190
+ box-shadow: none;
191
+ }
192
+
193
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title.wppb-role-editor-tab-active {
194
+ color: #a00;
195
+ font-weight: bold;
196
+ }
197
+
198
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
199
+ padding: 20px 5px 0 5px;
200
+ float: right;
201
+ width: 84%;
202
+ }
203
+
204
+ .post-type-wppb-roles-editor .wppb-re-spinner-container {
205
+ margin: 5px 3px 0 2px;
206
+ padding: 11px 0;
207
+ width: 100%;
208
+ }
209
+
210
+ .post-type-wppb-roles-editor .wppb-re-spinner-container i.icon-wppb-re-spinner {
211
+ font-size: 35px;
212
+ margin-left: 45%;
213
+ }
214
+
215
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry {
216
+ width: 32.3%;
217
+ float: left;
218
+ margin: 5px 3px 0 2px;
219
+ padding: 6px 0;
220
+ background-color: #f7f7f7;
221
+ display: block;
222
+ height: 32px;
223
+ }
224
+
225
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry.wppb-new-capability-highlight {
226
+ background-color: #e6e6e6;
227
+ }
228
+
229
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-capability {
230
+ padding: 0 10px;
231
+ width: 70%;
232
+ overflow-wrap: break-word;
233
+ word-wrap: break-word;
234
+ -ms-word-break: break-all;
235
+ word-break: break-all;
236
+ word-break: break-word;
237
+ -ms-hyphens: auto;
238
+ -moz-hyphens: auto;
239
+ -webkit-hyphens: auto;
240
+ hyphens: auto;
241
+ display: inline-block;
242
+ }
243
+
244
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-capability.wppb-new-capability {
245
+ color: #0085ba;
246
+ }
247
+
248
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-delete-capability {
249
+ float: right;
250
+ padding-right: 5px;
251
+ display: inline-block;
252
+ width: 15%;
253
+ }
254
+
255
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-delete-capability a:link {
256
+ text-decoration: none;
257
+ color: #a00;
258
+ }
259
+
260
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-delete-capability a:active,
261
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-delete-capability a:hover,
262
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry .wppb-delete-capability a:visited {
263
+ text-decoration: none;
264
+ color: #FF0000;
265
+ }
266
+
267
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry.wppb-role-edit-no-cap {
268
+ background-color: inherit;
269
+ }
270
+
271
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry.wppb-role-edit-no-cap span {
272
+ color: #a00;
273
+ }
274
+
275
+ .post-type-wppb-roles-editor #wppb-role-edit-table #wppb-role-edit-caps-clear,
276
+ .post-type-wppb-roles-editor #wppb-role-edit-caps-div #wppb-role-edit-divs-clear {
277
+ width: 100%;
278
+ clear: both;
279
+ }
280
+
281
+ .post-type-wppb-roles-editor .misc-pub-section #wppb-role-slug {
282
+ width: 59%;
283
+ margin-left: 5px;
284
+ text-transform: lowercase;
285
+ }
286
+
287
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-users,
288
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-capabilities,
289
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-edit-slug {
290
+ padding-top: 10px;
291
+ margin: 5px 0;
292
+ }
293
+
294
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-users span,
295
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-capabilities span,
296
+ .post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-edit-slug span {
297
+ font-size: 14px;
298
+ bottom: 1px;
299
+ position: relative;
300
+ }
301
+
302
+ .post-type-wppb-roles-editor .wppb-re-cap-perm-delete {
303
+ color: #a00;
304
+ font-size: 13px;
305
+ float: right;
306
+ position: relative;
307
+ z-index: 1;
308
+ }
309
+
310
+ .post-type-wppb-roles-editor .wppb-re-cap-perm-delete:active,
311
+ .post-type-wppb-roles-editor .wppb-re-cap-perm-delete:focus,
312
+ .post-type-wppb-roles-editor .wppb-re-cap-perm-delete:hover {
313
+ color: #000000;
314
+ cursor: pointer;
315
+ }
316
+
317
+ @media screen and ( max-width: 1600px ) {
318
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry {
319
+ width: 49%;
320
+ }
321
+
322
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
323
+ width: 80%;
324
+ }
325
+ }
326
+
327
+ @media screen and ( max-width: 1400px ) {
328
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
329
+ width: 76%;
330
+ }
331
+ }
332
+
333
+ @media screen and ( max-width: 1350px ) {
334
+ .post-type-wppb-roles-editor #wppb-role-edit-table .wppb-role-edit-table-entry {
335
+ width: 100%;
336
+ }
337
+ }
338
+
339
+ @media screen and ( max-width: 1250px ) {
340
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
341
+ width: 72%;
342
+ }
343
+ }
344
+
345
+ @media screen and ( max-width: 1150px ) {
346
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
347
+ width: 68%;
348
+ }
349
+ }
350
+
351
+ @media screen and ( max-width: 1100px ) {
352
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
353
+ width: 62%;
354
+ }
355
+ }
356
+
357
+ @media screen and ( max-width: 850px ) {
358
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
359
+ width: 70%;
360
+ }
361
+ }
362
+
363
+ @media screen and ( max-width: 782px ) {
364
+ .post-type-wppb-roles-editor .column-role input.wppb-role-slug-input {
365
+ height: 25px;
366
+ }
367
+
368
+ .post-type-wppb-roles-editor .column-capabilities,
369
+ .post-type-wppb-roles-editor .column-users {
370
+ text-align: inherit;
371
+ }
372
+ }
373
+
374
+ @media screen and ( max-width: 650px ) {
375
+ .post-type-wppb-roles-editor #wppb-role-edit-table {
376
+ width: 100%;
377
+ }
378
+
379
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs {
380
+ width: 100%;
381
+ padding: 20px 0 0 0;
382
+ }
383
+
384
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title {
385
+ padding: 0 25px 0 5px;
386
+ margin: 2px 0;
387
+ display: inline-block;
388
+ min-width: 40%;
389
+ }
390
+ }
391
+
392
+ @media screen and ( max-width: 450px ) {
393
+ .post-type-wppb-roles-editor #wppb-capabilities-tabs .wppb-role-editor-tab-title {
394
+ min-width: 91%;
395
+ }
396
+ }
397
+
398
+ .post-type-wppb-roles-editor .wppb-re-spin {
399
+ -moz-animation: wppb_re_spin 2s infinite linear;
400
+ -o-animation: wppb_re_spin 2s infinite linear;
401
+ -webkit-animation: wppb_re_spin 2s infinite linear;
402
+ animation: wppb_re_spin 2s infinite linear;
403
+ display: inline-block;
404
+ }
405
+ @-moz-keyframes wppb_re_spin {
406
+ 0% {
407
+ -moz-transform: rotate(0deg);
408
+ -o-transform: rotate(0deg);
409
+ -webkit-transform: rotate(0deg);
410
+ transform: rotate(0deg);
411
+ }
412
+
413
+ 100% {
414
+ -moz-transform: rotate(359deg);
415
+ -o-transform: rotate(359deg);
416
+ -webkit-transform: rotate(359deg);
417
+ transform: rotate(359deg);
418
+ }
419
+ }
420
+ @-webkit-keyframes wppb_re_spin {
421
+ 0% {
422
+ -moz-transform: rotate(0deg);
423
+ -o-transform: rotate(0deg);
424
+ -webkit-transform: rotate(0deg);
425
+ transform: rotate(0deg);
426
+ }
427
+
428
+ 100% {
429
+ -moz-transform: rotate(359deg);
430
+ -o-transform: rotate(359deg);
431
+ -webkit-transform: rotate(359deg);
432
+ transform: rotate(359deg);
433
+ }
434
+ }
435
+ @-o-keyframes wppb_re_spin {
436
+ 0% {
437
+ -moz-transform: rotate(0deg);
438
+ -o-transform: rotate(0deg);
439
+ -webkit-transform: rotate(0deg);
440
+ transform: rotate(0deg);
441
+ }
442
+
443
+ 100% {
444
+ -moz-transform: rotate(359deg);
445
+ -o-transform: rotate(359deg);
446
+ -webkit-transform: rotate(359deg);
447
+ transform: rotate(359deg);
448
+ }
449
+ }
450
+ @-ms-keyframes wppb_re_spin {
451
+ 0% {
452
+ -moz-transform: rotate(0deg);
453
+ -o-transform: rotate(0deg);
454
+ -webkit-transform: rotate(0deg);
455
+ transform: rotate(0deg);
456
+ }
457
+
458
+ 100% {
459
+ -moz-transform: rotate(359deg);
460
+ -o-transform: rotate(359deg);
461
+ -webkit-transform: rotate(359deg);
462
+ transform: rotate(359deg);
463
+ }
464
+ }
465
+ @keyframes wppb_re_spin {
466
+ 0% {
467
+ -moz-transform: rotate(0deg);
468
+ -o-transform: rotate(0deg);
469
+ -webkit-transform: rotate(0deg);
470
+ transform: rotate(0deg);
471
+ }
472
+
473
+ 100% {
474
+ -moz-transform: rotate(359deg);
475
+ -o-transform: rotate(359deg);
476
+ -webkit-transform: rotate(359deg);
477
+ transform: rotate(359deg);
478
+ }
479
+ }
480
+
features/roles-editor/assets/font/wppb_re_font.eot ADDED
Binary file
features/roles-editor/assets/font/wppb_re_font.svg ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="wppb_re_font" horiz-adv-x="1000" >
7
+ <font-face font-family="wppb_re_font" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="wppb-re-users" unicode="&#xe801;" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
10
+
11
+ <glyph glyph-name="wppb-re-slug" unicode="&#xe802;" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
12
+
13
+ <glyph glyph-name="wppb-re-caps" unicode="&#xe803;" d="M717 440q0 16-10 26l-51 50q-11 11-25 11t-25-11l-228-227-126 126q-11 11-25 11t-25-11l-51-50q-10-10-10-26 0-15 10-25l202-202q10-10 25-10 15 0 26 10l303 303q10 10 10 25z m140-90q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
14
+
15
+ <glyph glyph-name="wppb-re-spinner" unicode="&#xe838;" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
16
+ </font>
17
+ </defs>
18
+ </svg>
features/roles-editor/assets/font/wppb_re_font.ttf ADDED
Binary file
features/roles-editor/assets/font/wppb_re_font.woff ADDED
Binary file
features/roles-editor/assets/font/wppb_re_font.woff2 ADDED
Binary file
features/roles-editor/assets/js/roles-editor.js ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var wppb_re_capabilities_group = [];
2
+ var wppb_re_new_capabilities = {};
3
+ var wppb_re_current_role_capabilities = jQuery.extend( {}, wppb_roles_editor_data.current_role_capabilities );
4
+ var wppb_re_unsaved_capabilities = {};
5
+ var wppb_re_capabilities_to_delete = {};
6
+
7
+ jQuery( document ).ready( function() {
8
+ // Disable Enter key
9
+ jQuery( window ).keydown( function( e ) {
10
+ if( e.keyCode == 13 ) {
11
+ event.preventDefault();
12
+ return false;
13
+ }
14
+ } );
15
+
16
+ // Disable the role title field when editing a role
17
+ if( wppb_roles_editor_data.current_screen_action != 'add' ) {
18
+ jQuery( '.post-type-wppb-roles-editor input#title' ).attr( 'disabled', 'disabled' );
19
+ }
20
+
21
+ var table_roles = jQuery( '.post-type-wppb-roles-editor .wp-list-table.posts tr .row-actions' );
22
+ if( jQuery( table_roles ).find( '.default_role' ) ) {
23
+ jQuery( '<span class="table-role-info"> — ' + wppb_roles_editor_data.default_role_text + '</span>' ).insertAfter( jQuery( table_roles ).find( '.default_role' ).parent().parent().find( 'strong .row-title' ) );
24
+ }
25
+ if( jQuery( table_roles ).find( '.delete_notify.your_role' ) ) {
26
+ jQuery( '<span class="table-role-info"> — ' + wppb_roles_editor_data.your_role_text + '</span>' ).insertAfter( jQuery( table_roles ).find( '.delete_notify.your_role' ).parent().parent().find( 'strong .row-title' ) );
27
+ }
28
+
29
+ // Dynamically change value of the Role Slug field
30
+ jQuery( '.post-type-wppb-roles-editor #titlewrap' ).find( '#title' ).change( function() {
31
+ if( ! jQuery( '.post-type-wppb-roles-editor #wppb-role-slug' ).val() ) {
32
+ jQuery( '.post-type-wppb-roles-editor #wppb-role-slug' ).val( jQuery( this ).val().toLowerCase() );
33
+ }
34
+ } );
35
+
36
+ // Create an object with grouped capabilities for the Add Capability select2
37
+ var counter = 1;
38
+ jQuery.each( wppb_roles_editor_data.capabilities, function( key, value ) {
39
+ var capabilities_single_group = {};
40
+ if( key != 'post_types' ) {
41
+ capabilities_single_group = wppb_re_create_capabilities_group( key, value, counter );
42
+ wppb_re_capabilities_group.push( capabilities_single_group );
43
+ counter++;
44
+ } else if( key == 'post_types' ) {
45
+ jQuery.each( value, function( key, value ) {
46
+ capabilities_single_group = wppb_re_create_capabilities_group( key, value, counter );
47
+ wppb_re_capabilities_group.push( capabilities_single_group );
48
+ counter++;
49
+ } );
50
+ }
51
+ } );
52
+
53
+ // Display the current role capabilities (on single role page)
54
+ wppb_re_display_capabilities( 'all' );
55
+
56
+ // Check for already added capabilities and disable them before select2 initialization
57
+ wppb_re_disable_select_capabilities( wppb_re_capabilities_group, wppb_roles_editor_data.current_role_capabilities, 'add' );
58
+
59
+ if( wppb_re_getParameterByName( 'wppb_re_clone' ) ) {
60
+ var data = {
61
+ 'action' : 'get_role_capabilities',
62
+ 'security' : jQuery( '.post-type-wppb-roles-editor #wppb-re-ajax-nonce' ).val(),
63
+ 'role' : wppb_re_getParameterByName( 'wppb_re_clone' )
64
+ };
65
+
66
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-no-cap' ).remove();
67
+
68
+ jQuery.post( wppb_roles_editor_data.ajaxUrl, data, function( response ) {
69
+ if( response != 'no_caps' ) {
70
+ jQuery( '.post-type-wppb-roles-editor .wppb-re-spinner-container' ).hide();
71
+ wppb_re_current_role_capabilities = jQuery.extend( wppb_re_current_role_capabilities, JSON.parse( response ) );
72
+ wppb_re_display_capabilities( 'all' );
73
+ wppb_re_disable_select_capabilities( wppb_re_capabilities_group, wppb_re_current_role_capabilities, 'add' );
74
+ } else {
75
+ jQuery( '.wppb-re-spinner-container' ).hide();
76
+ wppb_re_no_capabilities_found();
77
+ }
78
+ } );
79
+ }
80
+
81
+ // Delete a capability
82
+ jQuery( '.post-type-wppb-roles-editor #wppb-role-edit-table' ).on( 'click', 'a.wppb-delete-capability-link', function() {
83
+ if( ( wppb_roles_editor_data.current_user_role && jQuery.inArray( jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text(), wppb_roles_editor_data.admin_capabilities ) === -1 ) || ! wppb_roles_editor_data.current_user_role ) {
84
+ jQuery( this ).closest( 'div.wppb-role-edit-table-entry' ).remove();
85
+
86
+ var deleted_capability = {};
87
+ deleted_capability[jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text()] = jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text();
88
+ wppb_re_capabilities_to_delete[jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text()] = jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text();
89
+
90
+ delete wppb_re_current_role_capabilities[jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text()];
91
+ delete wppb_re_new_capabilities[jQuery( this ).closest( 'span.wppb-delete-capability' ).siblings( 'span.wppb-capability' ).text()];
92
+
93
+ if( jQuery( '.wppb-add-new-cap-input' ).is( ':visible' ) ) {
94
+ wppb_re_change_select_to_input();
95
+ }
96
+
97
+ wppb_re_disable_select_capabilities( wppb_re_capabilities_group, deleted_capability, 'delete' );
98
+
99
+ if( jQuery( '.wppb-role-edit-table-entry' ).length < 1 ) {
100
+ wppb_re_no_capabilities_found();
101
+ }
102
+
103
+ wppb_re_number_of_capabilities();
104
+ }
105
+ } );
106
+
107
+ // Change between select2 with all existing capabilities and input to add a new capability
108
+ jQuery( '.post-type-wppb-roles-editor a.wppb-add-new-cap-link' ).click( function() {
109
+ wppb_re_change_select_to_input();
110
+ } );
111
+
112
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-editor-tab' ).click( function() {
113
+ wppb_re_tabs_handler( jQuery( this ) );
114
+ } );
115
+
116
+ wppb_re_form_submit();
117
+
118
+ wppb_re_number_of_capabilities();
119
+
120
+ // Display number of users for current role
121
+ if( wppb_roles_editor_data.current_role_users_count !== null ) {
122
+ jQuery( '.post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-users span' ).find( 'strong' ).text( wppb_roles_editor_data.current_role_users_count );
123
+ }
124
+
125
+ // Check if role has a title or return an error if not
126
+ jQuery( 'body' ).on( 'submit.edit-post', '#post', function() {
127
+ if( jQuery( '.post-type-wppb-roles-editor #title' ).val().replace( / /g, '' ).length === 0 ) {
128
+ window.alert( wppb_roles_editor_data.role_name_required_error_text );
129
+ jQuery( '.post-type-wppb-roles-editor #major-publishing-actions .spinner' ).hide();
130
+ jQuery( '.post-type-wppb-roles-editor #major-publishing-actions' ).find( ':button, :submit, a.submitdelete, #post-preview' ).removeClass( 'disabled' );
131
+ jQuery( '.post-type-wppb-roles-editor #title' ).focus();
132
+
133
+ wppb_re_form_submit();
134
+
135
+ return false;
136
+ } else {
137
+ jQuery( '.post-type-wppb-roles-editor #major-publishing-actions .spinner' ).show();
138
+ }
139
+ } );
140
+ } );
141
+
142
+ function wppb_re_form_submit() {
143
+ jQuery( '.post-type-wppb-roles-editor #publishing-action #publish' ).unbind( 'click' ).one( 'click', function( e ) {
144
+ e.preventDefault();
145
+ jQuery( this ).addClass( 'disabled' );
146
+ jQuery( this ).siblings( '.spinner' ).addClass( 'is-active' );
147
+ wppb_re_update_role_capabilities();
148
+ } );
149
+ }
150
+
151
+ function wppb_re_no_capabilities_found() {
152
+ jQuery( '.post-type-wppb-roles-editor #wppb-role-edit-table' ).find( '#wppb-role-edit-caps-clear' ).after(
153
+ '<div class="wppb-role-edit-table-entry wppb-role-edit-no-cap">' +
154
+ '<span class="wppb-capability wppb-role-edit-not-capability">' + wppb_roles_editor_data.no_capabilities_found_text + '</span>' +
155
+ '</div>'
156
+ );
157
+ }
158
+
159
+ function wppb_re_number_of_capabilities() {
160
+ var count = 0;
161
+ var i;
162
+
163
+ for( i in wppb_re_current_role_capabilities ) {
164
+ if( wppb_re_current_role_capabilities.hasOwnProperty( i ) ) {
165
+ count++;
166
+ }
167
+ }
168
+
169
+ jQuery( '.post-type-wppb-roles-editor .misc-pub-section.misc-pub-section-capabilities span' ).find( 'strong' ).text( count );
170
+ }
171
+
172
+ function wppb_re_tabs_handler( tab ) {
173
+ wppb_re_display_capabilities( jQuery( tab ).data( 'wppb-re-tab' ) );
174
+
175
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-editor-tab-title.wppb-role-editor-tab-active' ).removeClass( 'wppb-role-editor-tab-active' );
176
+ jQuery( tab ).closest( '.wppb-role-editor-tab-title' ).addClass( 'wppb-role-editor-tab-active' );
177
+ }
178
+
179
+ function wppb_re_disable_select_capabilities( wppb_re_capabilities_group, capabilities, action ) {
180
+ if( capabilities != null ) {
181
+ jQuery.each( wppb_re_capabilities_group, function( key, value ) {
182
+ jQuery.each( value['children'], function( key, value ) {
183
+ if( value['text'] in capabilities ) {
184
+ if( action == 'add' ) {
185
+ value['disabled'] = true;
186
+ } else if( action == 'delete' ) {
187
+ value['disabled'] = false;
188
+ }
189
+ }
190
+ } );
191
+ } );
192
+ }
193
+
194
+ wppb_re_initialize_select2( wppb_re_capabilities_group );
195
+ }
196
+
197
+ function wppb_re_initialize_select2( wppb_re_capabilities_group ) {
198
+ var capabilities_select = jQuery( '.wppb-capabilities-select' );
199
+
200
+ capabilities_select.empty();
201
+ capabilities_select.select2( {
202
+ placeholder: wppb_roles_editor_data.select2_placeholder_text,
203
+ allowClear: true,
204
+ data: wppb_re_capabilities_group,
205
+ templateResult: function( data ) {
206
+ if( data.id == null || jQuery.inArray( data.text, wppb_roles_editor_data.capabilities['custom']['capabilities'] ) === -1 ) {
207
+ return data.text;
208
+ }
209
+
210
+ var option = jQuery( '<span></span>' );
211
+ var delete_cap = jQuery( '<a class="wppb-re-cap-perm-delete">' + wppb_roles_editor_data.delete_permanently_text + '</a>' );
212
+
213
+ delete_cap.on( 'mouseup', function( event ) {
214
+ event.stopPropagation();
215
+ } );
216
+
217
+ delete_cap.on( 'click', function( event ) {
218
+ if( confirm( wppb_roles_editor_data.capability_text + ': ' + jQuery( this ).siblings( 'span' ).text() + '\n\n' + wppb_roles_editor_data.capability_perm_delete_text ) ) {
219
+ wppb_re_delete_capability_permanently( jQuery( this ).siblings( 'span' ).text() );
220
+ }
221
+ } );
222
+
223
+ option.text( data.text );
224
+ option = option.add( delete_cap );
225
+
226
+ return option;
227
+ }
228
+ } );
229
+ }
230
+
231
+ function wppb_re_delete_capability_permanently( capability ) {
232
+ var data = {
233
+ 'action' : 'delete_capability_permanently',
234
+ 'security' : jQuery( '.post-type-wppb-roles-editor #wppb-re-ajax-nonce' ).val(),
235
+ 'capability' : capability
236
+ };
237
+
238
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-table-entry' ).remove();
239
+ jQuery( '.post-type-wppb-roles-editor .wppb-re-spinner-container' ).show();
240
+
241
+ jQuery.post( wppb_roles_editor_data.ajaxUrl, data, function( response ) {
242
+ window.location.reload();
243
+ } );
244
+ }
245
+
246
+ function wppb_re_create_capabilities_group( key, value, counter ) {
247
+ var capabilities_single_group_caps = {};
248
+ var capabilities_single_group_caps_array = [];
249
+
250
+ jQuery.each( value['capabilities'], function( key, value ) {
251
+ capabilities_single_group_caps = {
252
+ id: value + '_' + counter,
253
+ text: value
254
+ };
255
+
256
+ capabilities_single_group_caps_array.push( capabilities_single_group_caps );
257
+ } );
258
+
259
+ return {
260
+ category: key,
261
+ text: value['label'],
262
+ children: capabilities_single_group_caps_array
263
+ };
264
+ }
265
+
266
+ function wppb_re_display_capabilities( action ) {
267
+ jQuery( '.post-type-wppb-roles-editor .wppb-re-spinner-container' ).hide();
268
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-table-entry' ).remove();
269
+
270
+ var capabilities;
271
+ if( action == 'all' ) {
272
+ capabilities = wppb_re_current_role_capabilities;
273
+ } else {
274
+ capabilities = wppb_re_capabilities_group;
275
+ }
276
+
277
+ jQuery.each( capabilities, function( key, value ) {
278
+ var table = jQuery( '#wppb-role-edit-table' );
279
+
280
+ if( action == 'all' ) {
281
+ wppb_re_display_capability( key );
282
+ } else {
283
+ if( value['category'] == action ) {
284
+ jQuery.each( value['children'], function( key, value ) {
285
+ if( wppb_re_current_role_capabilities != null && value['text'] in wppb_re_current_role_capabilities ) {
286
+ wppb_re_display_capability( value['text'] );
287
+ }
288
+ } );
289
+ }
290
+
291
+ if( value['category'] == action && action == 'custom' ) {
292
+ if( ! jQuery.isEmptyObject( wppb_re_new_capabilities ) ) {
293
+ jQuery.each( wppb_re_new_capabilities, function( key, value ) {
294
+ if( ! ( value in wppb_roles_editor_data.all_capabilities ) ) {
295
+ var new_capability_check = 0;
296
+ jQuery.each( wppb_roles_editor_data.capabilities, function( key2, value2 ) {
297
+ if( value2['label'] && value2['label'] != 'Custom' && jQuery.inArray( value, value2['capabilities'] ) !== -1 ) {
298
+ new_capability_check++;
299
+ }
300
+ } );
301
+
302
+ if( new_capability_check == 0 ) {
303
+ wppb_re_display_capability( value );
304
+ }
305
+ }
306
+ } );
307
+ }
308
+ }
309
+ }
310
+ } );
311
+
312
+ if( jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-table-entry' ).length ) {
313
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-no-cap' ).remove();
314
+ } else {
315
+ wppb_re_no_capabilities_found();
316
+ }
317
+ }
318
+
319
+ function wppb_re_display_capability( capability ) {
320
+ var title = '';
321
+ var wppb_capability_class = 'wppb-capability';
322
+ if( ! wppb_roles_editor_data.current_role_capabilities || ( wppb_roles_editor_data.current_role_capabilities && ! ( capability in wppb_roles_editor_data.current_role_capabilities ) ) ) {
323
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
324
+ title = 'title = "' + wppb_roles_editor_data.new_cap_update_title_text + '"';
325
+ } else if( wppb_re_getParameterByName( 'wppb_re_clone' ) && ! wppb_roles_editor_data.current_role_capabilities ) {
326
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
327
+ title = 'title = "' + wppb_roles_editor_data.new_cap_publish_title_text + '"';
328
+ }
329
+
330
+ var delete_link = '<a class="wppb-delete-capability-link" href="javascript:void(0)">Delete</a>';
331
+ if( wppb_roles_editor_data.current_user_role && jQuery.inArray( capability, wppb_roles_editor_data.admin_capabilities ) !== -1 ) {
332
+ delete_link = '<span class="wppb-delete-capability-disabled" title="' + wppb_roles_editor_data.cap_no_delete_text + '">' + wppb_roles_editor_data.delete_text + '</span>';
333
+ }
334
+
335
+ jQuery( '.post-type-wppb-roles-editor #wppb-role-edit-table' ).find( '#wppb-role-edit-caps-clear' ).after(
336
+ '<div class="wppb-role-edit-table-entry" ' + title + '>' +
337
+ '<span class="' + wppb_capability_class + '">' + capability + '</span>' +
338
+ '<span class="wppb-delete-capability">' + delete_link + '</span>' +
339
+ '</div>'
340
+ );
341
+ }
342
+
343
+ function wppb_re_add_capability() {
344
+ var capabilities_select = jQuery( '.post-type-wppb-roles-editor .wppb-capabilities-select' );
345
+ var new_capability_input = jQuery( '.post-type-wppb-roles-editor .wppb-add-new-cap-input' );
346
+ var table = jQuery( '.post-type-wppb-roles-editor #wppb-role-edit-table' );
347
+ var capabilities = {};
348
+ var no_duplicates = {};
349
+
350
+ if( jQuery( '.post-type-wppb-roles-editor .select2.select2-container' ).is( ':visible' ) && jQuery( capabilities_select ).val() != null ) {
351
+ jQuery( capabilities_select ).find( 'option:selected' ).each( function() {
352
+ if( ! no_duplicates[jQuery( this ).text()] ) {
353
+ if( ! jQuery( '.post-type-wppb-roles-editor .wppb-role-editor-tab.wppb-role-editor-all' ).closest( 'li.wppb-role-editor-tab-title' ).hasClass( 'wppb-role-editor-tab-active' ) ) {
354
+ wppb_re_tabs_handler( jQuery( '.post-type-wppb-roles-editor .wppb-role-editor-tab.wppb-role-editor-all' ) );
355
+ }
356
+
357
+ var title = '';
358
+ var wppb_capability_class = 'wppb-capability';
359
+ if( ! wppb_roles_editor_data.current_role_capabilities || ( wppb_roles_editor_data.current_role_capabilities && ! ( jQuery( this ).text() in wppb_roles_editor_data.current_role_capabilities ) ) ) {
360
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
361
+ wppb_re_unsaved_capabilities[jQuery( this ).text()] = jQuery( this ).text();
362
+ title = 'title = "' + wppb_roles_editor_data.new_cap_update_title_text + '"';
363
+ } else if( wppb_re_getParameterByName( 'wppb_re_clone' ) && ! wppb_roles_editor_data.current_role_capabilities ) {
364
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
365
+ title = 'title = "' + wppb_roles_editor_data.new_cap_publish_title_text + '"';
366
+ }
367
+
368
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-no-cap' ).remove();
369
+
370
+ jQuery( table ).find( '#wppb-role-edit-caps-clear' ).after(
371
+ '<div class="wppb-role-edit-table-entry wppb-new-capability-highlight" ' + title + '>' +
372
+ '<span class="' + wppb_capability_class + '">' + jQuery( this ).text() + '</span>' +
373
+ '<span class="wppb-delete-capability"><a class="wppb-delete-capability-link" href="javascript:void(0)">' + wppb_roles_editor_data.delete_text + '</a></span>' +
374
+ '</div>' );
375
+
376
+ capabilities[jQuery( this ).text()] = jQuery( this ).text();
377
+ no_duplicates[jQuery( this ).text()] = jQuery( this ).text();
378
+
379
+ delete wppb_re_capabilities_to_delete[jQuery( this ).text()];
380
+ }
381
+ } );
382
+
383
+ wppb_re_new_capability( capabilities );
384
+
385
+ wppb_re_disable_select_capabilities( wppb_re_capabilities_group, capabilities, 'add' );
386
+
387
+ jQuery( capabilities_select ).val( null ).trigger( 'change' );
388
+
389
+ wppb_re_number_of_capabilities();
390
+
391
+ setTimeout( function() {
392
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-table-entry' ).removeClass( 'wppb-new-capability-highlight' );
393
+ }, 500 );
394
+ } else if( jQuery( new_capability_input ).is( ':visible' ) && jQuery( new_capability_input ).val().length != 0 ) {
395
+ var new_capability_value = jQuery( new_capability_input ).val();
396
+ new_capability_value = new_capability_value.trim().replace( /<.*?>/g, '' ).replace( /\s/g, '_' ).replace( /[^a-zA-Z0-9_]/g, '' );
397
+
398
+ if( new_capability_value && ( ! wppb_roles_editor_data.hidden_capabilities || ! ( new_capability_value in wppb_roles_editor_data.hidden_capabilities ) ) ) {
399
+ if( ! ( new_capability_value in wppb_re_current_role_capabilities ) && ! ( new_capability_value in wppb_re_new_capabilities ) ) {
400
+ wppb_re_tabs_handler( jQuery( '.post-type-wppb-roles-editor .wppb-role-editor-tab.wppb-role-editor-all' ) );
401
+
402
+ var title = '';
403
+ var wppb_capability_class = 'wppb-capability';
404
+ if( ! wppb_roles_editor_data.current_role_capabilities || ( wppb_roles_editor_data.current_role_capabilities && ! ( new_capability_value in wppb_roles_editor_data.current_role_capabilities ) ) ) {
405
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
406
+ wppb_re_unsaved_capabilities[new_capability_value] = new_capability_value;
407
+ title = 'title = "' + wppb_roles_editor_data.new_cap_update_title_text + '"';
408
+ } else if( wppb_re_getParameterByName( 'wppb_re_clone' ) && ! wppb_roles_editor_data.current_role_capabilities ) {
409
+ wppb_capability_class = wppb_capability_class + ' wppb-new-capability';
410
+ title = 'title = "' + wppb_roles_editor_data.new_cap_publish_title_text + '"';
411
+ }
412
+
413
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-no-cap' ).remove();
414
+
415
+ jQuery( table ).find( '#wppb-role-edit-caps-clear' ).after(
416
+ '<div class="wppb-role-edit-table-entry wppb-new-capability-highlight" ' + title + '>' +
417
+ '<span class="' + wppb_capability_class + '">' + new_capability_value + '</span>' +
418
+ '<span class="wppb-delete-capability"><a class="wppb-delete-capability-link" href="javascript:void(0)">' + wppb_roles_editor_data.delete_text + '</a></span>' +
419
+ '</div>' );
420
+
421
+ capabilities[new_capability_value] = new_capability_value;
422
+ delete wppb_re_capabilities_to_delete[new_capability_value];
423
+
424
+ wppb_re_change_select_to_input();
425
+
426
+ wppb_re_new_capability( capabilities );
427
+
428
+ wppb_re_disable_select_capabilities( wppb_re_capabilities_group, capabilities, 'add' );
429
+
430
+ jQuery( new_capability_input ).val( '' );
431
+
432
+ wppb_re_number_of_capabilities();
433
+
434
+ setTimeout( function() {
435
+ jQuery( '.post-type-wppb-roles-editor .wppb-role-edit-table-entry' ).removeClass( 'wppb-new-capability-highlight' );
436
+ }, 500 );
437
+ } else {
438
+ jQuery( new_capability_input ).val( '' );
439
+
440
+ jQuery( '.post-type-wppb-roles-editor #wppb-duplicate-capability-error' ).show().delay( 3000 ).fadeOut();
441
+ }
442
+ } else if( wppb_roles_editor_data.hidden_capabilities && new_capability_value in wppb_roles_editor_data.hidden_capabilities ) {
443
+ jQuery( '.post-type-wppb-roles-editor #wppb-hidden-capability-error' ).show().delay( 3000 ).fadeOut();
444
+ } else {
445
+ jQuery( '.post-type-wppb-roles-editor #wppb-add-capability-error' ).show().delay( 3000 ).fadeOut();
446
+ }
447
+ } else {
448
+ jQuery( '.post-type-wppb-roles-editor #wppb-add-capability-error' ).show().delay( 3000 ).fadeOut();
449
+ }
450
+ }
451
+
452
+ function wppb_re_new_capability( capabilities ) {
453
+ jQuery.each( capabilities, function( key, value ) {
454
+ if( ! ( value in wppb_roles_editor_data.all_capabilities ) || ! ( value in wppb_re_current_role_capabilities ) ) {
455
+ wppb_re_new_capabilities[value] = value;
456
+ }
457
+ } );
458
+
459
+ jQuery.extend( wppb_re_current_role_capabilities, wppb_re_new_capabilities );
460
+ }
461
+
462
+ function wppb_re_update_role_capabilities() {
463
+ jQuery( '.post-type-wppb-roles-editor #wppb-role-slug-hidden' ).val( jQuery( '#wppb-role-slug' ).val() );
464
+
465
+ var data = {
466
+ 'action' : 'update_role_capabilities',
467
+ 'security' : jQuery( '.post-type-wppb-roles-editor #wppb-re-ajax-nonce' ).val(),
468
+ 'role_display_name' : jQuery( '.post-type-wppb-roles-editor #titlediv' ).find( '#title' ).val(),
469
+ 'role' : jQuery( '.post-type-wppb-roles-editor #wppb-role-slug' ).val(),
470
+ 'new_capabilities' : wppb_re_unsaved_capabilities,
471
+ 'all_capabilities' : wppb_re_current_role_capabilities,
472
+ 'capabilities_to_delete' : wppb_re_capabilities_to_delete
473
+ };
474
+
475
+ jQuery.post( wppb_roles_editor_data.ajaxUrl, data, function( response ) {
476
+ jQuery( '.post-type-wppb-roles-editor #publishing-action #publish' ).removeClass( 'disabled' ).trigger( 'click' );
477
+ } );
478
+ }
479
+
480
+ function wppb_re_change_select_to_input() {
481
+ if( jQuery( '.post-type-wppb-roles-editor .select2.select2-container' ).is( ':visible' ) ) {
482
+ jQuery( '.post-type-wppb-roles-editor .select2.select2-container' ).hide();
483
+ jQuery( '.post-type-wppb-roles-editor .wppb-add-new-cap-input' ).show();
484
+ jQuery( '.post-type-wppb-roles-editor a.wppb-add-new-cap-link' ).text( wppb_roles_editor_data.cancel_text );
485
+ } else {
486
+ jQuery( '.post-type-wppb-roles-editor .select2.select2-container' ).show();
487
+ jQuery( '.post-type-wppb-roles-editor .wppb-add-new-cap-input' ).hide();
488
+ jQuery( '.post-type-wppb-roles-editor a.wppb-add-new-cap-link' ).text( wppb_roles_editor_data.add_new_capability_text );
489
+ }
490
+ }
491
+
492
+ function wppb_re_getParameterByName( name, url ) {
493
+ if( ! url ) {
494
+ url = window.location.href;
495
+ }
496
+
497
+ name = name.replace( /[\[\]]/g, "\\$&" );
498
+
499
+ var regex = new RegExp( "[?&]" + name + "(=([^&#]*)|&|#|$)" ), results = regex.exec( url );
500
+
501
+ if( ! results ) {
502
+ return null;
503
+ }
504
+
505
+ if( ! results[2] ) {
506
+ return '';
507
+ }
508
+
509
+ return decodeURIComponent( results[2].replace( /\+/g, " " ) );
510
+ }
features/roles-editor/roles-editor.php ADDED
@@ -0,0 +1,1042 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPPB_Roles_Editor {
4
+
5
+ function __construct() {
6
+
7
+ // Create Roles Editor CPT
8
+ add_action( 'init', array( $this, 'create_roles_editor_cpt' ) );
9
+
10
+ // Create a Roles Editor CPT post for every existing role
11
+ add_action( 'current_screen', array( $this, 'create_post_for_role' ) );
12
+
13
+ // Edit CPT page
14
+ add_filter( 'manage_wppb-roles-editor_posts_columns', array( $this, 'add_extra_column_for_roles_editor_cpt' ) );
15
+ add_action( 'manage_wppb-roles-editor_posts_custom_column', array( $this, 'custom_column_content_for_roles_editor_cpt' ), 10, 2 );
16
+
17
+ // Add and remove meta boxes
18
+ add_action( 'add_meta_boxes', array( $this, 'register_meta_boxes' ), 1 );
19
+
20
+ // Edit Publish meta box
21
+ add_action( 'post_submitbox_misc_actions', array( $this, 'edit_publish_meta_box' ) );
22
+
23
+ // Enqueue scripts and styles
24
+ add_action( 'admin_enqueue_scripts', array( $this, 'scripts_admin' ) );
25
+
26
+ // Add role slug to the created post
27
+ add_action( 'save_post', array( $this, 'add_post_meta' ), 10, 3 );
28
+
29
+ add_filter( 'wp_insert_post_data', array( $this, 'modify_post_title'), '99', 1 );
30
+
31
+ add_action( 'wp_ajax_delete_capability_permanently', array( $this, 'delete_capability_permanently' ) );
32
+ add_action( 'wp_ajax_update_role_capabilities', array( $this, 'update_role_capabilities' ) );
33
+ add_action( 'wp_ajax_get_role_capabilities', array( $this, 'get_role_capabilities' ) );
34
+
35
+ add_filter( 'months_dropdown_results', array( $this, 'remove_filter_by_month_dropdown' ), 10, 2 );
36
+ add_filter( 'post_row_actions', array( $this, 'modify_list_row_actions' ), 10, 2 );
37
+
38
+ add_action( 'before_delete_post', array( $this, 'delete_role_permanently' ), 10 );
39
+
40
+ add_filter( 'bulk_actions-edit-wppb-roles-editor', '__return_empty_array' );
41
+ add_filter( 'views_edit-wppb-roles-editor', array( $this, 'edit_cpt_quick_links' ) );
42
+
43
+ add_filter( 'enter_title_here', array( $this, 'change_title_text' ) );
44
+ add_filter( 'post_updated_messages', array( $this, 'change_post_updated_messages' ) );
45
+
46
+ }
47
+
48
+ function scripts_admin() {
49
+
50
+ global $post_type;
51
+ global $current_screen;
52
+ global $post;
53
+ global $wp_scripts;
54
+ global $wp_styles;
55
+
56
+ if( $post_type == 'wppb-roles-editor' ) {
57
+
58
+ $wp_default_scripts = $this->wp_default_scripts();
59
+ foreach( $wp_scripts->registered as $key => $value ) {
60
+ if( ! in_array( $key, $wp_default_scripts ) && $key != 'wppb-sitewide' ) {
61
+ wp_deregister_script( $key );
62
+ }
63
+ }
64
+
65
+ $wp_default_styles = $this->wp_default_styles();
66
+ foreach( $wp_styles->registered as $key => $value ) {
67
+ if( ! in_array( $key, $wp_default_styles ) && $key != 'wppb-serial-notice-css' ) {
68
+ wp_deregister_style( $key );
69
+ }
70
+ }
71
+
72
+ wp_enqueue_script( 'wppb_select2_js', WPPB_PLUGIN_URL .'assets/js/select2/select2.min.js', array( 'jquery' ), PROFILE_BUILDER_VERSION );
73
+ wp_enqueue_style( 'wppb_select2_css', WPPB_PLUGIN_URL .'assets/css/select2/select2.min.css', array(), PROFILE_BUILDER_VERSION );
74
+
75
+ wp_enqueue_script( 'wppb_roles_editor_js', plugin_dir_url( __FILE__ ) .'assets/js/roles-editor.js', array( 'jquery', 'wppb_select2_js' ), PROFILE_BUILDER_VERSION );
76
+ wp_enqueue_style( 'wppb_roles_editor_css', plugin_dir_url( __FILE__ ) .'assets/css/roles-editor.css', array(), PROFILE_BUILDER_VERSION );
77
+
78
+ if( $current_screen->id == 'wppb-roles-editor' ) {
79
+ $role_slug = $this->sanitize_role( get_post_meta( $post->ID, 'wppb_role_slug', true ) );
80
+ $current_role = get_role( $role_slug );
81
+ $current_user = wp_get_current_user();
82
+
83
+ if( isset( $current_role ) && is_array( $current_role->capabilities ) ) {
84
+ $role_capabilities = $current_role->capabilities;
85
+
86
+ // True if current user got this role
87
+ if( isset( $role_slug ) && in_array( $role_slug, $current_user->roles ) ) {
88
+ $current_user_role = TRUE;
89
+ } else {
90
+ $current_user_role = FALSE;
91
+ }
92
+
93
+ // Get current role users count
94
+ $current_role_users_count = $this->count_role_users( $current_role->name );
95
+ } else {
96
+ $role_capabilities = NULL;
97
+ $current_role_users_count = NULL;
98
+ $current_user_role = FALSE;
99
+ }
100
+ } else {
101
+ $role_capabilities = NULL;
102
+ $current_role_users_count = NULL;
103
+ $current_user_role = FALSE;
104
+ }
105
+
106
+ // Remove old WordPress levels system
107
+ // Use filter and return FALSE if you need the old levels capability system
108
+ $remove_old_levels = apply_filters( 'wppb_remove_old_levels', TRUE );
109
+ if( $remove_old_levels === TRUE ) {
110
+ $role_capabilities = $this->remove_old_labels( $role_capabilities );
111
+ }
112
+
113
+ $admin_capabilities = array(
114
+ 'manage_options',
115
+ 'activate_plugins',
116
+ 'delete_plugins',
117
+ 'install_plugins',
118
+ 'manage_network_options',
119
+ 'manage_network',
120
+ 'manage_network_plugins',
121
+ 'upload_plugins'
122
+ );
123
+
124
+ $group_capabilities = $this->group_capabilities();
125
+ $hidden_capabilities = NULL;
126
+
127
+ $remove_hidden_capabilities = apply_filters( 'wppb_re_remove_hidden_caps', TRUE );
128
+ if( $remove_hidden_capabilities === TRUE ) {
129
+ $group_capabilities['general']['capabilities'] = array_diff( $group_capabilities['general']['capabilities'], $this->get_hidden_capabilities() );
130
+ $group_capabilities['appearance']['capabilities'] = array_diff( $group_capabilities['appearance']['capabilities'], $this->get_hidden_capabilities() );
131
+ $group_capabilities['plugins']['capabilities'] = array_diff( $group_capabilities['plugins']['capabilities'], $this->get_hidden_capabilities() );
132
+ $group_capabilities['post_types']['attachment']['capabilities'] = array_diff( $group_capabilities['post_types']['attachment']['capabilities'], $this->get_hidden_capabilities() );
133
+
134
+ if( $role_capabilities !== NULL ) {
135
+ $role_capabilities = array_diff_key( $role_capabilities, $this->get_hidden_capabilities() );
136
+ }
137
+
138
+ $hidden_capabilities = $this->get_hidden_capabilities();
139
+ if( empty( $hidden_capabilities ) ) {
140
+ $hidden_capabilities = NULL;
141
+ }
142
+ }
143
+
144
+ $vars_array = array(
145
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
146
+ 'current_screen_action' => $current_screen->action,
147
+ 'capabilities' => $group_capabilities,
148
+ 'current_role_capabilities' => $role_capabilities,
149
+ 'current_role_users_count' => $current_role_users_count,
150
+ 'all_capabilities' => $this->get_all_capabilities(),
151
+ 'current_user_role' => $current_user_role,
152
+ 'admin_capabilities' => $admin_capabilities,
153
+ 'hidden_capabilities' => $hidden_capabilities,
154
+ 'default_role_text' => esc_html__( 'Default Role', 'profile_builder' ),
155
+ 'your_role_text' => esc_html__( 'Your Role', 'profile_builder' ),
156
+ 'role_name_required_error_text' => esc_html__( 'Role name is required.', 'profile_builder' ),
157
+ 'no_capabilities_found_text' => esc_html__( 'No capabilities found.', 'profile_builder' ),
158
+ 'select2_placeholder_text' => esc_html__( 'Select capabilities', 'profile_builder' ),
159
+ 'delete_permanently_text' => esc_html__( 'Delete Permanently', 'profile_builder' ),
160
+ 'capability_perm_delete_text' => esc_html__( "This will permanently delete the capability from your site and from every user role.\n\nIt can't be undone!", 'profile_builder' ),
161
+ 'new_cap_update_title_text' => esc_html__( 'This capability is not saved until you click Update!', 'profile_builder' ),
162
+ 'new_cap_publish_title_text' => esc_html__( 'This capability is not saved until you click Publish!', 'profile_builder' ),
163
+ 'delete_text' => esc_html__( 'Delete', 'profile-builder' ),
164
+ 'cancel_text' => esc_html__( 'Cancel', 'profile_builder' ),
165
+ 'add_new_capability_text' => esc_html__( 'Add New Capability', 'profile_builder' ),
166
+ 'capability_text' => esc_html__( 'Capability', 'profile-builder' ),
167
+ 'cap_no_delete_text' => esc_html__( 'You can\'t delete this capability from your role.', 'profile-builder' )
168
+ );
169
+
170
+ wp_localize_script( 'wppb_roles_editor_js', 'wppb_roles_editor_data', $vars_array );
171
+ }
172
+
173
+ }
174
+
175
+ function count_role_users( $current_role_name ) {
176
+
177
+ // Get current role users count
178
+ $user_count = count_users();
179
+
180
+ if( isset( $user_count['avail_roles'][$current_role_name] ) ) {
181
+ $current_role_users_count = $user_count['avail_roles'][$current_role_name];
182
+ } else {
183
+ $current_role_users_count = NULL;
184
+ }
185
+
186
+ return $current_role_users_count;
187
+ }
188
+
189
+ function get_role_capabilities() {
190
+
191
+ if( ! current_user_can( 'manage_options' ) ) {
192
+ die();
193
+ }
194
+
195
+ check_ajax_referer( 'wppb-re-ajax-nonce', 'security' );
196
+
197
+ $role = get_role( sanitize_text_field( $_POST['role'] ) );
198
+
199
+ if( isset( $role ) && ! empty( $role->capabilities ) ) {
200
+ $role_capabilities = $role->capabilities;
201
+
202
+ // Remove old WordPress levels system
203
+ // Use filter and return FALSE if you need the old levels capability system
204
+ $remove_old_levels = apply_filters( 'wppb_remove_old_levels', TRUE );
205
+ if( $remove_old_levels === TRUE ) {
206
+ $role_capabilities = $this->remove_old_labels( $role_capabilities );
207
+ }
208
+
209
+ die( json_encode( $role_capabilities ) );
210
+ }
211
+
212
+ die( 'no_caps' );
213
+ }
214
+
215
+ function edit_cpt_quick_links( $views ) {
216
+
217
+ $edited_views = array();
218
+ $edited_views['all'] = $views['all'];
219
+
220
+ return $edited_views;
221
+
222
+ }
223
+
224
+ function create_roles_editor_cpt(){
225
+
226
+ $labels = array(
227
+ 'name' => esc_html__( 'Roles Editor', 'profile-builder' ),
228
+ 'singular_name' => esc_html__( 'Roles Editor', 'profile-builder' ),
229
+ 'add_new' => esc_html__( 'Add New Role', 'profile-builder' ),
230
+ 'add_new_item' => esc_html__( 'Add New Role', 'profile-builder' ),
231
+ 'edit_item' => esc_html__( 'Edit Role', 'profile-builder' ),
232
+ 'new_item' => esc_html__( 'New Role', 'profile-builder' ),
233
+ 'all_items' => esc_html__( 'Roles Editor', 'profile-builder' ),
234
+ 'view_item' => esc_html__( 'View Role', 'profile-builder' ),
235
+ 'search_items' => esc_html__( 'Search the Roles Editor', 'profile-builder' ),
236
+ 'not_found' => esc_html__( 'No roles found', 'profile-builder' ),
237
+ 'not_found_in_trash' => esc_html__( 'No roles found in trash', 'profile-builder' ),
238
+ 'name_admin_bar' => esc_html__( 'Role', 'profile-builder' ),
239
+ 'parent_item_colon' => '',
240
+ 'menu_name' => esc_html__( 'Roles Editor', 'profile-builder' )
241
+ );
242
+
243
+ $args = array(
244
+ 'labels' => $labels,
245
+ 'public' => false,
246
+ 'publicly_queryable' => false,
247
+ 'show_ui' => true,
248
+ 'query_var' => true,
249
+ 'show_in_menu' => 'users.php',
250
+ 'has_archive' => false,
251
+ 'hierarchical' => false,
252
+ 'capability_type' => 'post',
253
+ 'supports' => array( 'title' )
254
+ );
255
+
256
+ register_post_type( 'wppb-roles-editor', $args );
257
+
258
+ }
259
+
260
+ function change_title_text( $title ) {
261
+
262
+ $screen = get_current_screen();
263
+
264
+ if( $screen->post_type == 'wppb-roles-editor' ) {
265
+ $title = esc_html__( 'Enter role name here', 'profile_builder' );
266
+ }
267
+
268
+ return $title;
269
+
270
+ }
271
+
272
+ function change_post_updated_messages( $messages ) {
273
+
274
+ global $post;
275
+
276
+ $messages['wppb-roles-editor'] = array(
277
+ 0 => '',
278
+ 1 => esc_html__( 'Role updated.', 'profile-builder' ),
279
+ 2 => esc_html__( 'Custom field updated.', 'profile-builder' ),
280
+ 3 => esc_html__( 'Custom field deleted.', 'profile-builder' ),
281
+ 4 => esc_html__( 'Role updated.', 'profile-builder' ),
282
+ 5 => isset( $_GET['revision'] ) ? sprintf( esc_html__( 'Role restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
283
+ 6 => esc_html__( 'Role created.', 'profile-builder' ),
284
+ 7 => esc_html__( 'Role saved.', 'profile-builder' ),
285
+ 8 => esc_html__( 'Role submitted.', 'profile-builder' ),
286
+ 9 => sprintf( esc_html__( 'Role scheduled for: <strong>%1$s</strong>', 'profile-builder' ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ),
287
+ 10 => esc_html__( 'Role draft updated.', 'profile-builder' ),
288
+ );
289
+
290
+ return $messages;
291
+
292
+ }
293
+
294
+ function create_post_for_role() {
295
+
296
+ $screen = get_current_screen();
297
+
298
+ if( $screen->id == 'edit-wppb-roles-editor' ) {
299
+ global $wpdb;
300
+ global $wp_roles;
301
+
302
+ $added_posts = array();
303
+
304
+ $args = array(
305
+ 'numberposts' => -1,
306
+ 'post_type' => 'wppb-roles-editor'
307
+ );
308
+ $posts = get_posts( $args );
309
+
310
+ foreach( $posts as $key => $value ) {
311
+ $post_id = intval( $value->ID );
312
+ $role_slug_meta = $this->sanitize_role( get_post_meta( $post_id, 'wppb_role_slug', true ) );
313
+ if( ! empty( $role_slug_meta ) ) {
314
+ if( ! array_key_exists( $role_slug_meta, $wp_roles->role_names ) ) {
315
+ $post_meta = get_post_meta( $post_id );
316
+ foreach( $post_meta as $post_meta_key => $post_meta_value ) {
317
+ delete_post_meta( $post_id, $post_meta_key );
318
+ }
319
+
320
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE post_type = %s AND ID = %d", "wppb-roles-editor", $post_id ) );
321
+ } else {
322
+ $added_posts[] = $role_slug_meta;
323
+ }
324
+ }
325
+ }
326
+
327
+ foreach( $wp_roles->role_names as $role_slug => $role_display_name ) {
328
+ if( ! in_array( $role_slug, $added_posts ) ) {
329
+ $id = wp_insert_post( array(
330
+ 'post_title' => $role_display_name,
331
+ 'post_type' => 'wppb-roles-editor',
332
+ 'post_content' => '',
333
+ 'post_status' => 'publish'
334
+ ) );
335
+
336
+ update_post_meta( $id, 'wppb_role_slug', $role_slug );
337
+ }
338
+ }
339
+ }
340
+
341
+ }
342
+
343
+ function add_extra_column_for_roles_editor_cpt( $columns ) {
344
+
345
+ $columns = array(
346
+ 'title' => esc_html__( 'Role Name', 'profile-builder' ),
347
+ 'role' => esc_html__( 'Role Slug', 'profile-builder' ),
348
+ 'capabilities' => esc_html__( 'Capabilities', 'profile-builder' ),
349
+ 'users' => esc_html__( 'Users', 'profile-builder' )
350
+ );
351
+
352
+ return apply_filters( 'wppb_manage_roles_columns', $columns );
353
+
354
+ }
355
+
356
+ function custom_column_content_for_roles_editor_cpt( $column_name, $post_id ) {
357
+
358
+ $role_slug = $this->sanitize_role( get_post_meta( $post_id, 'wppb_role_slug', true ) );
359
+
360
+ if( isset( $role_slug ) ) {
361
+ $role = get_role( $role_slug );
362
+
363
+ if( $column_name == 'role' ) {
364
+ echo '<input readonly spellcheck="false" type="text" class="wppb-role-slug-input input" value="'. $role_slug .'" />';
365
+ }
366
+
367
+ if( $column_name == 'capabilities' && isset( $role ) ) {
368
+ // Remove old WordPress levels system
369
+ // Use filter and return FALSE if you need the old levels capability system
370
+ $remove_old_levels = apply_filters( 'wppb_remove_old_levels', TRUE );
371
+ if( $remove_old_levels === TRUE ) {
372
+ $role_capabilities = $this->remove_old_labels( $role->capabilities );
373
+ } else {
374
+ $role_capabilities = $role->capabilities;
375
+ }
376
+
377
+ echo count( $role_capabilities );
378
+ }
379
+
380
+ if( $column_name == 'users' && isset( $role ) ) {
381
+ $role_users_count = $this->count_role_users( $role->name );
382
+
383
+ if( ! isset( $role_users_count ) ) {
384
+ $role_users_count = 0;
385
+ }
386
+
387
+ echo $role_users_count;
388
+ }
389
+ }
390
+ }
391
+
392
+ function register_meta_boxes() {
393
+
394
+ remove_meta_box( 'slugdiv', 'wppb-roles-editor', 'normal' );
395
+ add_meta_box( 'wppb_edit_role_capabilities', esc_html__( 'Edit Role Capabilities', 'profile_builder' ), array( $this, 'edit_role_capabilities_meta_box_callback' ), 'wppb-roles-editor', 'normal', 'high' );
396
+
397
+ }
398
+
399
+ function edit_role_capabilities_meta_box_callback() {
400
+
401
+ ?>
402
+ <div id="wppb-role-edit-caps-div" style="margin: 15px 0 5px; 0;">
403
+ <div id="wppb-role-edit-add-caps">
404
+ <select style="width: 40%; display: none;" class="wppb-capabilities-select" multiple="multiple"></select>
405
+
406
+ <input class="wppb-add-new-cap-input" type="text" placeholder="<?php esc_html_e( 'Add a new capability', 'profile_builder' ) ?>">
407
+
408
+ <a href="javascript:void(0)" class="button-primary" onclick="wppb_re_add_capability()">
409
+ <span><?php esc_html_e( 'Add Capability', 'profile_builder' ) ?></span>
410
+ </a>
411
+
412
+ <div id="wppb-add-new-cap-link">
413
+ <a class="wppb-add-new-cap-link" href="javascript:void(0)"><?php esc_html_e( 'Add New Capability', 'profile_builder' ) ?></a>
414
+ </div>
415
+
416
+ <span id="wppb-add-capability-error"><?php esc_html_e( 'Please select an existing capability or add a new one!', 'profile_builder' ) ?></span>
417
+ <span id="wppb-hidden-capability-error"><?php esc_html_e( 'You can\'t add a hidden capability!', 'profile_builder' ) ?></span>
418
+ <span id="wppb-duplicate-capability-error"><?php esc_html_e( 'This capability already exists!', 'profile_builder' ) ?></span>
419
+ </div>
420
+
421
+ <div class="wppb-role-edit-caps">
422
+ <ul id="wppb-capabilities-tabs">
423
+ <li class="wppb-role-editor-tab-title wppb-role-editor-tab-active">
424
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-all" data-wppb-re-tab="all"><i class="dashicons dashicons-plus"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'All', 'profile_builder' ) ?></span></a>
425
+ </li>
426
+
427
+ <li class="wppb-role-editor-tab-title">
428
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-general" data-wppb-re-tab="general"><i class="dashicons dashicons-wordpress"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'General', 'profile_builder' ) ?></span></a>
429
+ </li>
430
+
431
+ <li class="wppb-role-editor-tab-title">
432
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-posts" data-wppb-re-tab="post"><i class="dashicons dashicons-admin-post"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Posts', 'profile_builder' ) ?></span></a>
433
+ </li>
434
+
435
+ <li class="wppb-role-editor-tab-title">
436
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-pages" data-wppb-re-tab="page"><i class="dashicons dashicons-admin-page"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Pages', 'profile_builder' ) ?></span></a>
437
+ </li>
438
+
439
+ <li class="wppb-role-editor-tab-title">
440
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-media" data-wppb-re-tab="attachment"><i class="dashicons dashicons-admin-media"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Media', 'profile_builder' ) ?></span></a>
441
+ </li>
442
+
443
+ <li class="wppb-role-editor-tab-title">
444
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-taxonomies" data-wppb-re-tab="taxonomies"><i class="dashicons dashicons-tag"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Taxonomies', 'profile_builder' ) ?></span></a>
445
+ </li>
446
+
447
+ <li class="wppb-role-editor-tab-title">
448
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-appearance" data-wppb-re-tab="appearance"><i class="dashicons dashicons-admin-appearance"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Appearance', 'profile_builder' ) ?></span></a>
449
+ </li>
450
+
451
+ <li class="wppb-role-editor-tab-title">
452
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-plugins" data-wppb-re-tab="plugins"><i class="dashicons dashicons-admin-plugins"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Plugins', 'profile_builder' ) ?></span></a>
453
+ </li>
454
+
455
+ <li class="wppb-role-editor-tab-title">
456
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-users" data-wppb-re-tab="users"><i class="dashicons dashicons-admin-users"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Users', 'profile_builder' ) ?></span></a>
457
+ </li>
458
+
459
+ <li class="wppb-role-editor-tab-title">
460
+ <a href="javascript:void(0)" class="wppb-role-editor-tab wppb-role-editor-custom" data-wppb-re-tab="custom"><i class="dashicons dashicons-admin-generic"></i> <span class="wppb-role-editor-tab-label"><?php esc_html_e( 'Custom', 'profile_builder' ) ?></span></a>
461
+ </li>
462
+ </ul>
463
+
464
+ <div id="wppb-role-edit-table">
465
+ <div class="wppb-re-spinner-container"><i class="icon-wppb-re-spinner wppb-re-spin"></i></div>
466
+ <div id="wppb-role-edit-caps-clear"></div>
467
+ </div>
468
+ <div id="wppb-role-edit-divs-clear"></div>
469
+ </div>
470
+
471
+ <input type="hidden" id="wppb-role-slug-hidden" name="wppb-role-slug-hidden" value="">
472
+ <input type="hidden" name="wppb-re-ajax-nonce" id="wppb-re-ajax-nonce" value="<?php echo wp_create_nonce( 'wppb-re-ajax-nonce' ) ?>" />
473
+ </div>
474
+ <?php
475
+
476
+ }
477
+
478
+ function edit_publish_meta_box( $post ) {
479
+
480
+ global $current_screen;
481
+
482
+ $post_type = 'wppb-roles-editor';
483
+
484
+ if( $post->post_type == $post_type ) {
485
+ $role_slug = $this->sanitize_role( get_post_meta( $post->ID, 'wppb_role_slug', true ) );
486
+
487
+ ?>
488
+ <style type="text/css">
489
+ .misc-pub-section.misc-pub-post-status,
490
+ .misc-pub-section.misc-pub-visibility,
491
+ .misc-pub-section.curtime.misc-pub-curtime,
492
+ #minor-publishing-actions,
493
+ #major-publishing-actions #delete-action {
494
+ display: none;
495
+ }
496
+ </style>
497
+
498
+ <div class="misc-pub-section misc-pub-section-users">
499
+ <i class="icon-wppb-re-users"></i>
500
+ <span><?php esc_html_e( 'Users', 'profile_builder' ) ?>: <strong>0</strong></span>
501
+ </div>
502
+
503
+ <div class="misc-pub-section misc-pub-section-capabilities">
504
+ <i class="icon-wppb-re-caps"></i>
505
+ <span><?php esc_html_e( 'Capabilities', 'profile_builder' ) ?>: <strong>0</strong></span>
506
+ </div>
507
+
508
+ <div class="misc-pub-section misc-pub-section-edit-slug">
509
+ <i class="icon-wppb-re-slug"></i>
510
+ <span>
511
+ <label for="wppb-role-slug"><?php esc_html_e( 'Role Slug', 'profile_builder' ) ?>: </label>
512
+ <input type="text" id="wppb-role-slug" value="<?php echo $current_screen->action == 'add' ? '' : $role_slug ?>" <?php echo $current_screen->action == 'add' ? '' : 'disabled'; ?>>
513
+ </span>
514
+ </div>
515
+ <?php
516
+ }
517
+
518
+ }
519
+
520
+ function remove_old_labels( $capabilities ) {
521
+
522
+ $old_levels = array( 'level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', 'level_6', 'level_7', 'level_8', 'level_9', 'level_10' );
523
+
524
+ foreach( $old_levels as $key => $value ) {
525
+ unset( $capabilities[$value] );
526
+ }
527
+
528
+ return $capabilities;
529
+
530
+ }
531
+
532
+ function modify_post_title( $data ) {
533
+
534
+ if( 'wppb-roles-editor' != $data['post_type'] || $data['post_status'] == 'auto-draft' ) {
535
+ return $data;
536
+ }
537
+
538
+ if( ! current_user_can( 'manage_options' ) ) {
539
+ return $data;
540
+ }
541
+
542
+ if( isset( $data['post_title'] ) ) {
543
+ $data['post_title'] = wp_strip_all_tags( $data['post_title'] );
544
+ }
545
+
546
+ return $data;
547
+
548
+ }
549
+
550
+ function add_post_meta( $post_id, $post, $update ) {
551
+
552
+ $post_type = get_post_type( $post_id );
553
+
554
+ if( 'wppb-roles-editor' != $post_type || $post->post_status == 'auto-draft' ) {
555
+ return;
556
+ }
557
+
558
+ if( ! current_user_can( 'manage_options' ) ) {
559
+ return;
560
+ }
561
+
562
+ if( isset( $_POST['wppb-role-slug-hidden'] ) ) {
563
+ $role_slug = trim( $_POST['wppb-role-slug-hidden'] );
564
+ $role_slug = $this->sanitize_role( $role_slug );
565
+
566
+ update_post_meta( $post_id, 'wppb_role_slug', $role_slug );
567
+ }
568
+
569
+ }
570
+
571
+ function update_role_capabilities() {
572
+
573
+ if( ! current_user_can( 'manage_options' ) ) {
574
+ die();
575
+ }
576
+
577
+ check_ajax_referer( 'wppb-re-ajax-nonce', 'security' );
578
+
579
+ $role_slug = $this->sanitize_role( $_POST['role'] );
580
+
581
+ $role = get_role( $role_slug );
582
+
583
+ if( $role ) {
584
+ if( isset( $_POST['new_capabilities'] ) ) {
585
+ foreach( $_POST['new_capabilities'] as $key => $value ) {
586
+ $role->add_cap( sanitize_text_field( $key ) );
587
+ }
588
+ }
589
+
590
+ if( isset( $_POST['capabilities_to_delete'] ) ) {
591
+ foreach( $_POST['capabilities_to_delete'] as $key => $value ) {
592
+ $role->remove_cap( sanitize_text_field( $key ) );
593
+ }
594
+ }
595
+ } else {
596
+ $capabilities = array();
597
+
598
+ if( isset( $_POST['all_capabilities'] ) ) {
599
+ foreach( $_POST['all_capabilities'] as $key => $value ) {
600
+ $capabilities[sanitize_text_field( $key )] = true;
601
+ };
602
+ }
603
+
604
+ $role_display_name = sanitize_text_field( $_POST['role_display_name'] );
605
+
606
+ add_role( $role_slug, $role_display_name, $capabilities );
607
+ }
608
+
609
+ die( 'role_capabilities_updated' );
610
+
611
+ }
612
+
613
+ function group_capabilities() {
614
+
615
+ $capabilities = get_option( 'wppb_roles_editor_capabilities', 'not_set' );
616
+
617
+ if( $capabilities == 'not_set' ) {
618
+ // We remove non-custom capabilities from this array later on
619
+ $custom_capabilities = $this->get_all_capabilities();
620
+ $custom_capabilities = $this->remove_old_labels( $custom_capabilities );
621
+
622
+ // General capabilities
623
+ $general_capabilities = array(
624
+ 'label' => 'General',
625
+ 'icon' => 'dashicons-wordpress',
626
+ 'capabilities' => array( 'edit_dashboard', 'edit_files', 'export', 'import', 'manage_links', 'manage_options', 'moderate_comments', 'read', 'unfiltered_html', 'update_core' )
627
+ );
628
+
629
+ // Themes management capabilities
630
+ $appearance_capabilities = array(
631
+ 'label' => 'Appearance',
632
+ 'icon' => 'dashicons-admin-appearance',
633
+ 'capabilities' => array( 'delete_themes', 'edit_theme_options', 'edit_themes', 'install_themes', 'switch_themes', 'update_themes' )
634
+ );
635
+
636
+ // Plugins management capabilities
637
+ $plugins_capabilities = array(
638
+ 'label' => 'Plugins',
639
+ 'icon' => 'dashicons-admin-plugins',
640
+ 'capabilities' => array( 'activate_plugins', 'delete_plugins', 'edit_plugins', 'install_plugins', 'update_plugins' )
641
+ );
642
+
643
+ // Users management capabilities
644
+ $users_capabilities = array(
645
+ 'label' => 'Users',
646
+ 'icon' => 'dashicons-admin-users',
647
+ 'capabilities' => array( 'add_users', 'create_roles', 'create_users', 'delete_roles', 'delete_users', 'edit_roles', 'edit_users', 'list_roles', 'list_users', 'promote_users', 'remove_users' )
648
+ );
649
+
650
+ // Taxonomies capabilities - part 1
651
+ $taxonomies_capabilities = array();
652
+ $taxonomies = get_taxonomies( array(), 'objects' );
653
+ foreach( $taxonomies as $taxonomy ) {
654
+ $taxonomies_capabilities = array_merge( $taxonomies_capabilities, array_values( (array) $taxonomy->cap ) );
655
+ }
656
+
657
+ // Post types capabilities
658
+ $post_types_capabilities = array();
659
+ foreach( get_post_types( array(), 'objects' ) as $type ) {
660
+
661
+ if( in_array( $type->name, array( 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'wppb-rf-cpt', 'wppb-epf-cpt', 'wppb-roles-editor' ) ) ) {
662
+ continue;
663
+ }
664
+
665
+ $post_type_capabilities = $this->post_type_group_capabilities( $type->name );
666
+ if( empty( $post_type_capabilities ) ) {
667
+ continue;
668
+ }
669
+
670
+ $post_type_icon = $type->hierarchical ? 'dashicons-admin-page' : 'dashicons-admin-post';
671
+ if( is_string( $type->menu_icon ) && preg_match( '/dashicons-/i', $type->menu_icon ) ) {
672
+ $post_type_icon = $type->menu_icon;
673
+ } else if( 'attachment' === $type->name ) {
674
+ $post_type_icon = 'dashicons-admin-media';
675
+ } else if( 'download' === $type->name ) {
676
+ $post_type_icon = 'dashicons-download';
677
+ } else if( 'product' === $type->name ) {
678
+ $post_type_icon = 'dashicons-cart';
679
+ }
680
+
681
+ $post_types_capabilities[$type->name] = array(
682
+ 'label' => $type->labels->name,
683
+ 'icon' => $post_type_icon,
684
+ 'capabilities' => $post_type_capabilities
685
+ );
686
+
687
+ $taxonomies_capabilities = array_diff( $taxonomies_capabilities, $post_type_capabilities );
688
+ $custom_capabilities = array_diff( $custom_capabilities, $post_type_capabilities );
689
+ }
690
+
691
+ // Taxonomies capabilities - part 2
692
+ $taxonomies_capabilities = array_diff( $taxonomies_capabilities, $general_capabilities['capabilities'], $appearance_capabilities['capabilities'], $plugins_capabilities['capabilities'], $users_capabilities['capabilities'] );
693
+ $taxonomies_capabilities = array(
694
+ 'label' => 'Taxonomies',
695
+ 'icon' => '',
696
+ 'capabilities' => array_unique( $taxonomies_capabilities )
697
+ );
698
+
699
+ // Custom capabilities
700
+ $custom_capabilities = array_diff( $custom_capabilities, $general_capabilities['capabilities'], $appearance_capabilities['capabilities'], $appearance_capabilities['capabilities'], $plugins_capabilities['capabilities'], $users_capabilities['capabilities'], $taxonomies_capabilities['capabilities'] );
701
+ $custom_capabilities = array_values( $custom_capabilities );
702
+ $custom_capabilities = array(
703
+ 'label' => 'Custom',
704
+ 'icon' => '',
705
+ 'capabilities' => array_unique( $custom_capabilities )
706
+ );
707
+
708
+ // Create capabilities array
709
+ $capabilities = array(
710
+ 'general' => $general_capabilities,
711
+ 'post_types' => $post_types_capabilities,
712
+ 'taxonomies' => $taxonomies_capabilities,
713
+ 'appearance' => $appearance_capabilities,
714
+ 'plugins' => $plugins_capabilities,
715
+ 'users' => $users_capabilities,
716
+ 'custom' => $custom_capabilities
717
+ );
718
+
719
+ update_option( 'wppb_roles_editor_capabilities', $capabilities );
720
+ } else {
721
+ $custom_capabilities = $this->get_all_capabilities();
722
+ $custom_capabilities = $this->remove_old_labels( $custom_capabilities );
723
+
724
+ foreach( $capabilities['post_types'] as $key => $value ) {
725
+ $custom_capabilities = array_diff( $custom_capabilities, $value['capabilities'] );
726
+ }
727
+
728
+ foreach( $capabilities as $key => $value ) {
729
+ if( $key != 'post_types' && $key != 'custom' ) {
730
+ $custom_capabilities = array_diff( $custom_capabilities, $value['capabilities'] );
731
+ }
732
+ }
733
+
734
+ $custom_capabilities = array_values( $custom_capabilities );
735
+ $custom_capabilities = array_unique( $custom_capabilities );
736
+ $custom_capabilities = array_diff( $custom_capabilities, $capabilities['custom']['capabilities'] );
737
+
738
+ if( ! empty( $custom_capabilities ) ) {
739
+ $capabilities['custom']['capabilities'] = array_merge( $capabilities['custom']['capabilities'], $custom_capabilities );
740
+
741
+ update_option( 'wppb_roles_editor_capabilities', $capabilities );
742
+ }
743
+ }
744
+
745
+ return $capabilities;
746
+
747
+ }
748
+
749
+ function post_type_group_capabilities( $post_type = 'post' ) {
750
+
751
+ $capabilities = (array) get_post_type_object( $post_type )->cap;
752
+
753
+ unset( $capabilities['edit_post'] );
754
+ unset( $capabilities['read_post'] );
755
+ unset( $capabilities['delete_post'] );
756
+
757
+ $capabilities = array_values( $capabilities );
758
+
759
+ if( ! in_array( $post_type, array( 'post', 'page' ) ) ) {
760
+ // Get the post and page capabilities
761
+ $post_caps = array_values( (array) get_post_type_object( 'post' )->cap );
762
+ $page_caps = array_values( (array) get_post_type_object( 'page' )->cap );
763
+
764
+ // Remove post/page capabilities from the current post type capabilities
765
+ $capabilities = array_diff( $capabilities, $post_caps, $page_caps );
766
+ }
767
+
768
+ if( 'attachment' === $post_type ) {
769
+ $capabilities[] = 'unfiltered_upload';
770
+ }
771
+
772
+ return array_unique( $capabilities );
773
+
774
+ }
775
+
776
+ function get_all_capabilities() {
777
+
778
+ global $wp_roles;
779
+
780
+ $capabilities = array();
781
+
782
+ foreach( $wp_roles->role_objects as $key => $role ) {
783
+ if( is_array( $role->capabilities ) ) {
784
+ foreach( $role->capabilities as $capability => $granted ) {
785
+ $capabilities[$capability] = $capability;
786
+ }
787
+ }
788
+ }
789
+
790
+ return array_unique( $capabilities );
791
+
792
+ }
793
+
794
+ function delete_capability_permanently() {
795
+
796
+ if( ! current_user_can( 'manage_options' ) ) {
797
+ die();
798
+ }
799
+
800
+ check_ajax_referer( 'wppb-re-ajax-nonce', 'security' );
801
+
802
+ global $wp_roles;
803
+
804
+ foreach( $wp_roles->role_names as $role_slug => $role_display_name ) {
805
+ $role = get_role( $role_slug );
806
+ $role->remove_cap( sanitize_text_field( $_POST['capability'] ) );
807
+ }
808
+
809
+ $capabilities = get_option( 'wppb_roles_editor_capabilities', 'not_set' );
810
+
811
+ if( $capabilities != 'not_set' && ( $key = array_search( sanitize_text_field( $_POST['capability'] ), $capabilities['custom']['capabilities'] ) ) !== false ) {
812
+ unset( $capabilities['custom']['capabilities'][$key] );
813
+ $capabilities['custom']['capabilities'] = array_values( $capabilities['custom']['capabilities'] );
814
+
815
+ update_option( 'wppb_roles_editor_capabilities', $capabilities );
816
+ }
817
+
818
+ die();
819
+
820
+ }
821
+
822
+ function remove_filter_by_month_dropdown( $months, $post_type ) {
823
+
824
+ if( $post_type == 'wppb-roles-editor' ) {
825
+ return __return_empty_array();
826
+ } else {
827
+ return $months;
828
+ }
829
+
830
+ }
831
+
832
+ function modify_list_row_actions( $actions, $post ) {
833
+ global $wp_roles;
834
+
835
+ if( $post->post_type == 'wppb-roles-editor' ) {
836
+ $current_user = wp_get_current_user();
837
+ $default_role = get_option( 'default_role' );
838
+ $role_slug = get_post_meta( $post->ID, 'wppb_role_slug', true );
839
+
840
+ $url = admin_url( 'post.php?post=' . $post->ID );
841
+
842
+ $edit_link = add_query_arg( array( 'action' => 'edit' ), $url );
843
+
844
+ $actions = array(
845
+ 'edit' => sprintf(
846
+ '<a href="%1$s">%2$s</a>',
847
+ esc_url( $edit_link ),
848
+ esc_html__( 'Edit', 'profile-builder' )
849
+ )
850
+ );
851
+
852
+ $clone_url = admin_url( 'post-new.php?post_type=wppb-roles-editor' );
853
+ $clone_link = add_query_arg( array( 'action' => 'wppb_re_clone', 'wppb_re_clone' => $this->sanitize_role( $role_slug ) ), $clone_url );
854
+
855
+ $actions = array_merge( $actions, array(
856
+ 'clone' => sprintf(
857
+ '<a href="%1$s">%2$s</a>',
858
+ esc_url( $clone_link ),
859
+ esc_html__( 'Clone', 'profile-builder' )
860
+ )
861
+ )
862
+ );
863
+
864
+ if( in_array( $role_slug, $current_user->roles ) && ( ! is_multisite() || ( is_multisite() && ! is_super_admin() ) ) && ( !empty( $wp_roles->roles[$role_slug]['capabilities'] ) && array_key_exists( 'manage_options', $wp_roles->roles[$role_slug]['capabilities'] ) ) ) {
865
+ $actions = array_merge( $actions, array(
866
+ 'delete_notify your_role' => '<span title="'. esc_html__( 'You can\'t delete your role.', 'profile-builder' ) .'">'. esc_html__( 'Delete', 'profile-builder' ) .'</span>'
867
+ )
868
+ );
869
+ } elseif( $role_slug == $default_role ) {
870
+ $actions = array_merge( $actions, array(
871
+ 'default_role' => sprintf(
872
+ '<a href="%s">%s</a>',
873
+ esc_url( admin_url( 'options-general.php#default_role' ) ),
874
+ esc_html__( 'Change Default', 'profile-builder' ) ),
875
+ 'delete_notify' => '<span title="'. esc_html__( 'You can\'t delete the default role. Change it first.', 'profile-builder' ) .'">'. esc_html__( 'Delete', 'profile-builder' ) .'</span>'
876
+ )
877
+ );
878
+ } else {
879
+ $delete_link = wp_nonce_url( add_query_arg( array( 'action' => 'delete' ), $url ), 'delete-post_'. $post->ID );
880
+
881
+ $actions = array_merge( $actions, array(
882
+ 'delete' => sprintf(
883
+ '<a href="%1$s" onclick="return confirm( \'%2$s\' );">%3$s</a>',
884
+ esc_url( $delete_link ),
885
+ esc_html__( 'Are you sure?\nThis will permanently delete the role and cannot be undone!\nUsers assigned only on this role will be moved to the default role.', 'profile_builder' ),
886
+ esc_html__( 'Delete', 'profile-builder' )
887
+ )
888
+ )
889
+ );
890
+ }
891
+ }
892
+
893
+ return $actions;
894
+
895
+ }
896
+
897
+ function sanitize_role( $role ) {
898
+
899
+ $role = strtolower( $role );
900
+ $role = wp_strip_all_tags( $role );
901
+ $role = preg_replace( '/[^a-z0-9_\-\s]/', '', $role );
902
+ $role = str_replace( ' ', '_', $role );
903
+
904
+ return $role;
905
+
906
+ }
907
+
908
+ function delete_role_permanently( $post_id ) {
909
+
910
+ check_admin_referer( 'delete-post_'. $post_id );
911
+
912
+ global $post_type;
913
+
914
+ if( $post_type != 'wppb-roles-editor' ) {
915
+ return;
916
+ }
917
+
918
+ $role_slug = get_post_meta( $post_id, 'wppb_role_slug', true );
919
+ $role_slug = $this->sanitize_role( $role_slug );
920
+
921
+ $default_role = get_option( 'default_role' );
922
+
923
+ if( $role_slug == $default_role ) {
924
+ return;
925
+ }
926
+
927
+ $users = get_users( array( 'role' => $role_slug ) );
928
+
929
+ if( is_array( $users ) ) {
930
+ foreach( $users as $user ) {
931
+ if( $user->has_cap( $role_slug ) && count( $user->roles ) <= 1 ) {
932
+ $user->set_role( $default_role );
933
+ } elseif( $user->has_cap( $role_slug ) ) {
934
+ $user->remove_role( $role_slug );
935
+ }
936
+ }
937
+ }
938
+
939
+ remove_role( $role_slug );
940
+
941
+ }
942
+
943
+ function wp_default_scripts() {
944
+
945
+ $wp_default_scripts = array(
946
+ 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
947
+ 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
948
+ 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
949
+ 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
950
+ 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
951
+ 'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone', 'utils', 'common',
952
+ 'wp-a11y', 'sack', 'quicktags', 'colorpicker', 'editor', 'wp-fullscreen-stub', 'wp-ajax-response',
953
+ 'wp-pointer', 'heartbeat', 'wp-auth-check', 'wp-lists', 'prototype', 'scriptaculous-root',
954
+ 'scriptaculous-builder', 'scriptaculous-dragdrop', 'scriptaculous-effects', 'scriptaculous-slider',
955
+ 'scriptaculous-sound', 'scriptaculous-controls', 'scriptaculous', 'cropper', 'jquery-effects-core',
956
+ 'jquery-effects-blind', 'jquery-effects-bounce', 'jquery-effects-clip', 'jquery-effects-drop',
957
+ 'jquery-effects-explode', 'jquery-effects-fade', 'jquery-effects-fold', 'jquery-effects-highlight',
958
+ 'jquery-effects-puff', 'jquery-effects-pulsate', 'jquery-effects-scale', 'jquery-effects-shake',
959
+ 'jquery-effects-size', 'jquery-effects-slide', 'jquery-effects-transfer', 'jquery-ui-selectmenu',
960
+ 'jquery-form', 'jquery-color', 'schedule', 'jquery-query', 'jquery-serialize-object', 'jquery-hotkeys',
961
+ 'jquery-table-hotkeys', 'jquery-touch-punch', 'suggest', 'imagesloaded', 'masonry', 'jquery-masonry',
962
+ 'thickbox', 'jcrop', 'swfobject', 'plupload', 'plupload-all', 'plupload-html5', 'plupload-flash',
963
+ 'plupload-silverlight', 'plupload-html4', 'plupload-handlers', 'wp-plupload', 'swfupload', 'swfupload-swfobject',
964
+ 'swfupload-queue', 'swfupload-speed', 'swfupload-all', 'swfupload-handlers', 'comment-reply', 'json2',
965
+ 'underscore', 'backbone', 'wp-util', 'wp-backbone', 'revisions', 'imgareaselect', 'mediaelement',
966
+ 'wp-mediaelement', 'froogaloop', 'wp-playlist', 'zxcvbn-async', 'password-strength-meter', 'user-profile',
967
+ 'language-chooser', 'user-suggest', 'admin-bar', 'wplink', 'wpdialogs', 'word-count', 'media-upload',
968
+ 'hoverIntent', 'customize-base', 'customize-loader', 'customize-preview', 'customize-models', 'customize-views',
969
+ 'customize-controls', 'customize-selective-refresh', 'customize-widgets', 'customize-preview-widgets',
970
+ 'customize-preview-nav-menus', 'wp-custom-header', 'accordion', 'shortcode', 'media-models', 'wp-embed',
971
+ 'media-views', 'media-editor', 'media-audiovideo', 'mce-view', 'wp-api', 'admin-tags', 'admin-comments', 'xfn',
972
+ 'postbox', 'tags-box', 'tags-suggest', 'post', 'press-this', 'editor-expand', 'link', 'comment', 'admin-gallery',
973
+ 'admin-widgets', 'theme', 'inline-edit-post', 'inline-edit-tax', 'plugin-install', 'updates', 'farbtastic', 'iris',
974
+ 'wp-color-picker', 'dashboard', 'list-revisions', 'media-grid', 'media', 'image-edit', 'set-post-thumbnail',
975
+ 'nav-menu', 'custom-header', 'custom-background', 'media-gallery', 'svg-painter', 'customize-nav-menus',
976
+ );
977
+
978
+ return $wp_default_scripts;
979
+
980
+ }
981
+
982
+ function wp_default_styles() {
983
+
984
+ $wp_default_styles = array(
985
+ 'admin-bar', 'colors', 'ie', 'wp-auth-check', 'wp-jquery-ui-dialog', 'wppb-serial-notice-css',
986
+ 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media',
987
+ 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n', 'wp-admin', 'login', 'install',
988
+ 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'press-this',
989
+ 'buttons', 'dashicons', 'editor-buttons', 'media-views', 'wp-pointer', 'customize-preview',
990
+ 'wp-embed-template-ie', 'imgareaselect', 'mediaelement', 'wp-mediaelement', 'thickbox',
991
+ 'deprecated-media', 'farbtastic', 'jcrop', 'colors-fresh', 'open-sans',
992
+ );
993
+
994
+ return $wp_default_styles;
995
+
996
+ }
997
+
998
+ function get_hidden_capabilities() {
999
+
1000
+ $capabilities = array();
1001
+
1002
+ if( is_multisite() || ! defined( 'ALLOW_UNFILTERED_UPLOADS' ) || ! ALLOW_UNFILTERED_UPLOADS ) {
1003
+ $capabilities['unfiltered_upload'] = 'unfiltered_upload';
1004
+ }
1005
+
1006
+ if( is_multisite() || ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) ) {
1007
+ $capabilities['unfiltered_html'] = 'unfiltered_html';
1008
+ }
1009
+
1010
+ if( is_multisite() || ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) ) {
1011
+ $capabilities['edit_files'] = 'edit_files';
1012
+ $capabilities['edit_plugins'] = 'edit_plugins';
1013
+ $capabilities['edit_themes'] = 'edit_themes';
1014
+ }
1015
+
1016
+ if( is_multisite() || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) ) {
1017
+ $capabilities['edit_files'] = 'edit_files';
1018
+ $capabilities['edit_plugins'] = 'edit_plugins';
1019
+ $capabilities['edit_themes'] = 'edit_themes';
1020
+ $capabilities['update_plugins'] = 'update_plugins';
1021
+ $capabilities['delete_plugins'] = 'delete_plugins';
1022
+ $capabilities['install_plugins'] = 'install_plugins';
1023
+ $capabilities['upload_plugins'] = 'upload_plugins';
1024
+ $capabilities['update_themes'] = 'update_themes';
1025
+ $capabilities['delete_themes'] = 'delete_themes';
1026
+ $capabilities['install_themes'] = 'install_themes';
1027
+ $capabilities['upload_themes'] = 'upload_themes';
1028
+ $capabilities['update_core'] = 'update_core';
1029
+ }
1030
+
1031
+ return array_unique( $capabilities );
1032
+
1033
+ }
1034
+
1035
+ }
1036
+
1037
+ $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' );
1038
+ if( $wppb_generalSettings != 'not_found' ) {
1039
+ if( ! empty( $wppb_generalSettings['rolesEditor'] ) && ( $wppb_generalSettings['rolesEditor'] == 'yes' ) ) {
1040
+ $wppb_role_editor_instance = new WPPB_Roles_Editor();
1041
+ }
1042
+ }
front-end/class-formbuilder.php CHANGED
@@ -15,6 +15,17 @@ class Profile_Builder_Form_Creator{
15
 
16
  // Constructor method for the class
17
  function __construct( $args ) {
 
 
 
 
 
 
 
 
 
 
 
18
  // Merge the input arguments and the defaults
19
  $this->args = wp_parse_args( $args, $this->defaults );
20
 
15
 
16
  // Constructor method for the class
17
  function __construct( $args ) {
18
+
19
+ /* we should stop the execution of the forms if they are in the wp_head hook because it should not be there.
20
+ SEO plugins can execute shortcodes in the auto generated descriptions */
21
+ global $wp_current_filter;
22
+ if( !empty( $wp_current_filter ) && is_array( $wp_current_filter ) ){
23
+ foreach( $wp_current_filter as $filter ){
24
+ if( $filter == 'wp_head' )
25
+ return;
26
+ }
27
+ }
28
+
29
  // Merge the input arguments and the defaults
30
  $this->args = wp_parse_args( $args, $this->defaults );
31
 
front-end/default-fields/default-fields.php CHANGED
@@ -37,5 +37,9 @@ function wppb_include_default_fields_files() {
37
  if ( wppb_can_users_signup_blog() ) {
38
  include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/blog-details/blog-details.php');
39
  }
 
 
 
 
40
  }
41
  wppb_include_default_fields_files();
37
  if ( wppb_can_users_signup_blog() ) {
38
  include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/blog-details/blog-details.php');
39
  }
40
+
41
+ /* added recaptcha and user role field since version 2.6.2 */
42
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/recaptcha/recaptcha.php' );
43
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/user-role/user-role.php' );
44
  }
45
  wppb_include_default_fields_files();
front-end/default-fields/recaptcha/recaptcha.php ADDED
@@ -0,0 +1,478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Encodes the given data into a query string format
4
+ * @param $data - array of string elements to be encoded
5
+ * @return string - encoded request
6
+ */
7
+ function _wppb_encodeQS($data)
8
+ {
9
+ $req = "";
10
+ foreach ($data as $key => $value) {
11
+ $req .= $key . '=' . urlencode(stripslashes($value)) . '&';
12
+ }
13
+ // Cut the last '&'
14
+ $req=substr($req, 0, strlen($req)-1);
15
+ return $req;
16
+ }
17
+
18
+
19
+
20
+ /**
21
+ * Submits an HTTP GET to a reCAPTCHA server
22
+ * @param string $path
23
+ * @param array $data
24
+ */
25
+ function _wppb_submitHTTPGet($path, $data)
26
+ {
27
+ $req = _wppb_encodeQS($data);
28
+ $response = wp_remote_get($path . $req);
29
+
30
+ if ( ! is_wp_error( $response ))
31
+ return $response["body"];
32
+ }
33
+
34
+ /**
35
+ * Gets the challenge HTML (javascript and non-javascript version).
36
+ * This is called from the browser, and the resulting reCAPTCHA HTML widget
37
+ * is embedded within the HTML form it was called from.
38
+ * @param string $pubkey A public key for reCAPTCHA
39
+ * @param string $error The error given by reCAPTCHA (optional, default is null)
40
+ * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
41
+
42
+ * @return string - The HTML to be embedded in the user's form.
43
+ */
44
+ function wppb_recaptcha_get_html ( $pubkey, $form_name='' ){
45
+ global $wppb_recaptcha_forms; // will contain the name of all PB forms containing reCAPTCHA which are loaded on a certain page
46
+
47
+ if ( empty($pubkey) )
48
+ echo $errorMessage = '<span class="error">'. __("To use reCAPTCHA you must get an API key from", "profile-builder"). " <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a></span><br/><br/>";
49
+
50
+ // we add this number to the form name to differentiate between 2 different forms of the same type (e.g. PB Login widget + PB Login page form) which both have reCAPTCHA
51
+ $length = strval(strlen($wppb_recaptcha_forms));
52
+
53
+ if ($form_name != '') {
54
+ if ($wppb_recaptcha_forms != '') $wppb_recaptcha_forms .= ','.trim($form_name).$length;
55
+ else $wppb_recaptcha_forms = trim($form_name).$length;
56
+
57
+ // reCAPTCHA html for PB forms
58
+ return '
59
+ <div id="recaptcha_'.$form_name.$length.'" class="g-recaptcha" data-sitekey="'.$pubkey.'" data-theme="'.apply_filters('wppb_recaptcha_theme_select','light').'" ></div>
60
+ ';
61
+ }
62
+ else { //reCAPTCHA html and scripts for default WP forms (backend)
63
+ return '
64
+ <script src="https://www.google.com/recaptcha/api.js" async defer></script>
65
+ <div id="recaptcha_'.$form_name.$length.'" class="g-recaptcha" data-sitekey="'.$pubkey.'" data-theme="'.apply_filters('wppb_recaptcha_theme_select','light').'" ></div>
66
+ ';
67
+ }
68
+
69
+ }
70
+
71
+ // For PB forms (not default WP ones) containing reCAPTCHA we'll make sure to add the script in the page's header and footer, in order to allow multiple reCAPTCHAs on the same page.
72
+ function wppb_recaptcha_script_header() {
73
+ global $wppb_recaptcha_forms;
74
+ //initialize the $wppb_recaptcha_forms global var
75
+ $wppb_recaptcha_forms = '';
76
+ }
77
+ add_action('wp_head', 'wppb_recaptcha_script_header');
78
+
79
+
80
+
81
+ function wppb_recaptcha_script_footer(){
82
+ global $wppb_recaptcha_forms;
83
+ if( !empty( $wppb_recaptcha_forms ) ) {
84
+ echo '<script src="https://www.google.com/recaptcha/api.js?onload=wppbRecaptchaCallBack&render=explicit" async defer></script>';
85
+
86
+ $forms = explode(',',$wppb_recaptcha_forms);
87
+
88
+ $field = wppb_get_recaptcha_field();
89
+
90
+ $pubkey = '';
91
+ if( isset( $field['public-key'] ) ) {
92
+ $pubkey = trim( $field['public-key'] );
93
+ }
94
+
95
+ echo '<script type="text/javascript">
96
+ var wppbRecaptchaCallBack = function() {';
97
+ if( !empty( $pubkey ) ) {
98
+ foreach ($forms as $form_name) {
99
+ echo '
100
+ var recaptcha_' . $form_name . ' = grecaptcha.render("recaptcha_' . $form_name . '", {
101
+ "sitekey" : "' . $pubkey . '",
102
+ });';
103
+ }
104
+ }
105
+ echo '};
106
+ </script>';
107
+ }
108
+ }
109
+ add_action('wp_footer','wppb_recaptcha_script_footer');
110
+
111
+
112
+
113
+ /**
114
+ * A wppb_ReCaptchaResponse is returned from wppb_recaptcha_check_answer()
115
+ */
116
+ class wppb_ReCaptchaResponse {
117
+ var $is_valid;
118
+ }
119
+
120
+
121
+ /**
122
+ * Calls an HTTP POST function to verify if the user's answer was correct
123
+ * @param string $privkey
124
+ * @param string $remoteip
125
+ * @param string $response
126
+ * @return wppb_ReCaptchaResponse
127
+ */
128
+ function wppb_recaptcha_check_answer ( $privkey, $remoteip, $response ){
129
+
130
+ if ( $remoteip == null || $remoteip == '' )
131
+ echo '<span class="error">'. __("For security reasons, you must pass the remote ip to reCAPTCHA!", "profile-builder") .'</span><br/><br/>';
132
+
133
+ // Discard empty solution submissions
134
+ if ($response == null || strlen($response) == 0) {
135
+ $recaptchaResponse = new wppb_ReCaptchaResponse();
136
+ $recaptchaResponse->is_valid = false;
137
+
138
+ return $recaptchaResponse;
139
+ }
140
+ $getResponse = _wppb_submitHTTPGet(
141
+ "https://www.google.com/recaptcha/api/siteverify?",
142
+ array (
143
+ 'secret' => $privkey,
144
+ 'remoteip' => $remoteip,
145
+ 'response' => $response
146
+ )
147
+ );
148
+
149
+ $answers = json_decode($getResponse, true);
150
+ $recaptchaResponse = new wppb_ReCaptchaResponse();
151
+ if (trim($answers ['success']) == true) {
152
+ $recaptchaResponse->is_valid = true;
153
+ } else {
154
+ $recaptchaResponse->is_valid = false;
155
+ }
156
+ return $recaptchaResponse;
157
+
158
+ }
159
+
160
+ /* the function to display error message on the registration page */
161
+ function wppb_validate_captcha_response( $publickey, $privatekey ){
162
+ if (isset($_POST['g-recaptcha-response'])){
163
+ $recaptcha_response_field = $_POST['g-recaptcha-response'];
164
+ }
165
+ else {
166
+ $recaptcha_response_field = '';
167
+ }
168
+
169
+ $resp = wppb_recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $recaptcha_response_field );
170
+
171
+ if ( !empty( $_POST ) )
172
+ return ( ( !$resp->is_valid ) ? false : true );
173
+ }
174
+
175
+ /* the function to add reCAPTCHA to the registration form of PB */
176
+ function wppb_recaptcha_handler ( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){
177
+ if ( $field['field'] == 'reCAPTCHA' ){
178
+ $item_title = apply_filters( 'wppb_'.$form_location.'_recaptcha_custom_field_'.$field['id'].'_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title'] ) );
179
+ $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_description_translation', $field['description'] );
180
+
181
+ wppb_recaptcha_set_default_values();
182
+ if ( ($form_location == 'register') && ( isset($field['captcha-pb-forms']) ) && (strpos($field['captcha-pb-forms'],'pb_register') !== false) ) {
183
+ $error_mark = ( ( $field['required'] == 'Yes' ) ? '<span class="wppb-required" title="'.wppb_required_field_error($field["field-title"]).'">*</span>' : '' );
184
+
185
+ if ( array_key_exists( $field['id'], $field_check_errors ) )
186
+ $error_mark = '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.wppb_required_field_error($field["field-title"]).'"/>';
187
+
188
+ $publickey = trim( $field['public-key'] );
189
+ $privatekey = trim( $field['private-key'] );
190
+
191
+ if ( empty( $publickey ) || empty( $privatekey ) )
192
+ return '<span class="custom_field_recaptcha_error_message" id="'.$field['meta-name'].'_error_message">'.apply_filters( 'wppb_'.$form_location.'_recaptcha_custom_field_'.$field['id'].'_error_message', __("To use reCAPTCHA you must get an API public key from:", "profile-builder"). '<a href="https://www.google.com/recaptcha/admin/create">https://www.google.com/recaptcha/admin/create</a>' ).'</span>';
193
+
194
+ $output = '<label for="recaptcha_response_field">'.$item_title.$error_mark.'</label>'.wppb_recaptcha_get_html( $publickey , 'pb_register');
195
+ if( !empty( $item_description ) )
196
+ $output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
197
+
198
+ return $output;
199
+
200
+ }
201
+ }
202
+ }
203
+ add_filter( 'wppb_output_form_field_recaptcha', 'wppb_recaptcha_handler', 10, 6 );
204
+
205
+
206
+ /* handle reCAPTCHA field validation on PB Register form */
207
+ function wppb_check_recaptcha_value( $message, $field, $request_data, $form_location ){
208
+ if( $field['field'] == 'reCAPTCHA' ){
209
+ if ( ( $form_location == 'register' ) && ( isset($field['captcha-pb-forms']) ) && (strpos($field['captcha-pb-forms'],'pb_register') !== false) ) {
210
+ if ( ( wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) ) == false ) && ( $field['required'] == 'Yes' ) ){
211
+ return wppb_required_field_error($field["field-title"]);
212
+ }
213
+ }
214
+ }
215
+ return $message;
216
+ }
217
+ add_filter( 'wppb_check_form_field_recaptcha', 'wppb_check_recaptcha_value', 10, 4 );
218
+
219
+ // Get the reCAPTCHA field information
220
+ function wppb_get_recaptcha_field(){
221
+ $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );
222
+ $field = '';
223
+ if ( $wppb_manage_fields != 'not_found' ) {
224
+ foreach ($wppb_manage_fields as $value) {
225
+ if ($value['field'] == 'reCAPTCHA')
226
+ $field = $value;
227
+ }
228
+ }
229
+ return $field;
230
+ }
231
+
232
+ /* Display reCAPTCHA on PB Recover Password form */
233
+ function wppb_display_recaptcha_recover_password( $output ){
234
+ $field = wppb_get_recaptcha_field();
235
+
236
+ if ( !empty($field) ) {
237
+ $publickey = trim($field['public-key']);
238
+ $item_title = apply_filters('wppb_recover_password_recaptcha_custom_field_' . $field['id'] . '_item_title', wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_title_translation', $field['field-title']));
239
+ $item_description = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_description_translation', $field['description']);
240
+
241
+ // check where reCAPCHA should display and add reCAPTCHA html
242
+ if ( isset($field['captcha-pb-forms']) && ( strpos( $field['captcha-pb-forms'],'pb_recover_password' ) !== false ) ) {
243
+ $recaptcha_output = '<label for="recaptcha_response_field">' . $item_title . '</label>' . wppb_recaptcha_get_html($publickey, 'pb_recover_password');
244
+ if (!empty($item_description))
245
+ $recaptcha_output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
246
+
247
+ $output = str_replace('</ul>', '<li class="wppb-form-field wppb-recaptcha">' . $recaptcha_output . '</li>' . '</ul>', $output);
248
+ }
249
+ }
250
+ return $output;
251
+ }
252
+ add_filter('wppb_recover_password_generate_password_input','wppb_display_recaptcha_recover_password');
253
+
254
+ /* Function that changes the messageNo from the Recover Password form */
255
+ function wppb_recaptcha_change_recover_password_message_no($messageNo) {
256
+
257
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'recover_password') {
258
+ $field = wppb_get_recaptcha_field();
259
+ if (!empty($field)) {
260
+
261
+ global $wppb_recaptcha_response;
262
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
263
+
264
+ if ( isset($field['captcha-pb-forms']) && (strpos($field['captcha-pb-forms'], 'pb_recover_password') !== false) ) {
265
+
266
+ if ( ($wppb_recaptcha_response == false ) && ( $field['required'] == 'Yes' ) )
267
+ $messageNo = '';
268
+ }
269
+ }
270
+ }
271
+
272
+ return $messageNo;
273
+ }
274
+ add_filter('wppb_recover_password_message_no', 'wppb_recaptcha_change_recover_password_message_no');
275
+
276
+ /* Function that adds the reCAPTCHA error message on the Recover Password form */
277
+ function wppb_recaptcha_recover_password_displayed_message1( $message ) {
278
+ $field = wppb_get_recaptcha_field();
279
+
280
+ if ( !empty($field) ){
281
+ global $wppb_recaptcha_response;
282
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
283
+
284
+ if ( isset($field['captcha-pb-forms']) && ( strpos( $field['captcha-pb-forms'],'pb_recover_password' ) !== false ) && ( $wppb_recaptcha_response == false )) {
285
+
286
+ // This message is also altered by the plugin-compatibilities.php file, in regards to Captcha plugin ( function wppb_captcha_recover_password_displayed_message1 )
287
+ if (($message == '<p class="wppb-warning">wppb_recaptcha_error</p>') || ($message == '<p class="wppb-warning">wppb_captcha_error</p>'))
288
+ $message = '<p class="wppb-warning">' . wppb_recaptcha_field_error($field["field-title"]) . '</p>';
289
+ else
290
+ $message = $message . '<p class="wppb-warning">' . wppb_recaptcha_field_error($field["field-title"]) . '</p>';
291
+
292
+ }
293
+ }
294
+
295
+ return $message;
296
+ }
297
+ add_filter('wppb_recover_password_displayed_message1', 'wppb_recaptcha_recover_password_displayed_message1');
298
+
299
+ /* Function that changes the default success message to wppb_recaptcha_error if the reCAPTCHA doesn't validate
300
+ so that we can change the message displayed with the wppb_recover_password_displayed_message1 filter */
301
+ function wppb_recaptcha_recover_password_sent_message_1($message) {
302
+
303
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'recover_password') {
304
+ $field = wppb_get_recaptcha_field();
305
+
306
+ if (!empty($field)) {
307
+ global $wppb_recaptcha_response;
308
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
309
+
310
+ if ( isset($field['captcha-pb-forms']) && ( strpos($field['captcha-pb-forms'], 'pb_recover_password') !== false ) && ( $wppb_recaptcha_response == false ) ){
311
+ $message = 'wppb_recaptcha_error';
312
+ }
313
+ }
314
+
315
+ }
316
+
317
+ return $message;
318
+ }
319
+ add_filter('wppb_recover_password_sent_message1', 'wppb_recaptcha_recover_password_sent_message_1');
320
+
321
+ /* Display reCAPTCHA html on PB Login form */
322
+ function wppb_display_recaptcha_login_form($form_part, $args) {
323
+ $field = wppb_get_recaptcha_field();
324
+
325
+ if ( !empty($field) ) {
326
+ $item_title = apply_filters('wppb_login_recaptcha_custom_field_' . $field['id'] . '_item_title', wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_title_translation', $field['field-title']));
327
+ $item_description = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_description_translation', $field['description']);
328
+
329
+ if ( isset($field['captcha-pb-forms']) && ( strpos( $field['captcha-pb-forms'],'pb_login' ) !== false ) ) { // check where reCAPTCHA should display and add reCAPTCHA html
330
+ $recaptcha_output = '<label for="recaptcha_response_field">' . $item_title . '</label>' . wppb_recaptcha_get_html( trim($field['public-key']), 'pb_login' );
331
+ if (!empty($item_description))
332
+ $recaptcha_output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
333
+
334
+ $form_part .= '<div class="wppb-form-field wppb-recaptcha">'. $recaptcha_output .'</div>';
335
+ }
336
+ }
337
+
338
+ return $form_part;
339
+ }
340
+ add_filter('login_form_middle', 'wppb_display_recaptcha_login_form', 10, 2);
341
+
342
+ /* Display reCAPTCHA html on default WP Login form */
343
+ function wppb_display_recaptcha_wp_login_form(){
344
+ $field = wppb_get_recaptcha_field();
345
+
346
+ if ( !empty($field) ) {
347
+ $item_title = apply_filters('wppb_login_recaptcha_custom_field_' . $field['id'] . '_item_title', wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_title_translation', $field['field-title']));
348
+ $item_description = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_description_translation', $field['description']);
349
+
350
+ if ( isset($field['captcha-wp-forms']) && (strpos( $field['captcha-wp-forms'],'default_wp_login' ) !== false) ) { // check where reCAPTCHA should display and add reCAPTCHA html
351
+
352
+ $recaptcha_output = '<label for="recaptcha_response_field" style="padding-left:15px; padding-bottom:7px;">' . $item_title . '</label>' . wppb_recaptcha_get_html( trim($field['public-key']) );
353
+ if (!empty($item_description))
354
+ $recaptcha_output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
355
+
356
+ echo '<div class="wppb-form-field wppb-recaptcha" style="margin-left:-14px; margin-bottom: 15px;">'. $recaptcha_output .'</div>';
357
+ }
358
+ }
359
+ }
360
+ add_action( 'login_form', 'wppb_display_recaptcha_wp_login_form' );
361
+
362
+ //Show reCAPTCHA error on Login form (both default and PB one)
363
+ function wppb_recaptcha_login_wp_error_message($user){
364
+ //make sure you're on a Login form (WP or PB)
365
+ if ( (isset($_POST['wp-submit'])) && (!is_wp_error($user)) ) {
366
+
367
+ $field = wppb_get_recaptcha_field();
368
+ if ( !empty($field) ){
369
+ global $wppb_recaptcha_response;
370
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
371
+
372
+ //reCAPTCHA error for displaying on the PB login form
373
+ if ( isset($_POST['wppb_login']) && ($_POST['wppb_login'] == true) && (isset($field['captcha-pb-forms'])) && ( strpos( $field['captcha-pb-forms'],'pb_login' ) !== false ) && ( $wppb_recaptcha_response == false ) ) {
374
+ $user = new WP_Error('wppb_recaptcha_error', __('Please enter a (valid) reCAPTCHA value','profile-builder'));
375
+ }
376
+
377
+ //reCAPTCHA error for displaying on the default WP login form
378
+ if ( isset($field['captcha-wp-forms']) && (strpos( $field['captcha-wp-forms'],'default_wp_login' ) !== false) && ($wppb_recaptcha_response == false) ) {
379
+ $user = new WP_Error('wppb_recaptcha_error', __('Please enter a (valid) reCAPTCHA value','profile-builder'));
380
+ }
381
+ }
382
+ }
383
+ return $user;
384
+ }
385
+ add_filter('authenticate','wppb_recaptcha_login_wp_error_message', 22);
386
+
387
+ // Display reCAPTCHA html on default WP Recover Password form
388
+ function wppb_display_recaptcha_default_wp_recover_password() {
389
+ $field = wppb_get_recaptcha_field();
390
+
391
+ if (!empty($field)) {
392
+ $publickey = trim($field['public-key']);
393
+ $item_title = apply_filters('wppb_recover_password_recaptcha_custom_field_' . $field['id'] . '_item_title', wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_title_translation', $field['field-title']));
394
+ $item_description = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_description_translation', $field['description']);
395
+
396
+ if ( isset($field['captcha-wp-forms']) && (strpos( $field['captcha-wp-forms'], 'default_wp_recover_password') !== false) ) { // check where reCAPTCHA should display and add reCAPTCHA html
397
+ $recaptcha_output = '<label for="recaptcha_response_field" style="padding-left:15px; padding-bottom:7px;">' . $item_title . '</label>' . wppb_recaptcha_get_html($publickey);
398
+ if (!empty($item_description))
399
+ $recaptcha_output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
400
+
401
+ echo '<div class="wppb-form-field wppb-recaptcha" style="margin-left:-14px; margin-bottom: 15px;">'. $recaptcha_output .'</div>';
402
+ }
403
+ }
404
+ }
405
+ add_action('lostpassword_form','wppb_display_recaptcha_default_wp_recover_password');
406
+
407
+ // Verify and show reCAPTCHA errors for default WP Recover Password
408
+ function wppb_verify_recaptcha_default_wp_recover_password(){
409
+
410
+ // If field 'username or email' is empty - return
411
+ if( isset( $_REQUEST['user_login'] ) && "" == $_REQUEST['user_login'] )
412
+ return;
413
+
414
+ $field = wppb_get_recaptcha_field();
415
+ if ( !empty($field) ){
416
+ global $wppb_recaptcha_response;
417
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
418
+
419
+ // If reCAPTCHA not entered or incorrect reCAPTCHA answer
420
+ if ( isset( $_REQUEST['g-recaptcha-response'] ) && ( ( "" == $_REQUEST['g-recaptcha-response'] ) || ( $wppb_recaptcha_response == false ) ) ) {
421
+ wp_die( __('Please enter a (valid) reCAPTCHA value','profile-builder') . '<br />' . __( "Click the BACK button on your browser, and try again.", 'profile-builder' ) ) ;
422
+ }
423
+ }
424
+ }
425
+ add_action('lostpassword_post','wppb_verify_recaptcha_default_wp_recover_password');
426
+
427
+ /* Display reCAPTCHA html on default WP Register form */
428
+ function wppb_display_recaptcha_default_wp_register(){
429
+ $field = wppb_get_recaptcha_field();
430
+
431
+ if (!empty($field)) {
432
+ $publickey = trim($field['public-key']);
433
+ $item_title = apply_filters('wppb_register_recaptcha_custom_field_' . $field['id'] . '_item_title', wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_title_translation', $field['field-title']));
434
+ $item_description = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $field['id'] . '_description_translation', $field['description']);
435
+
436
+ wppb_recaptcha_set_default_values();
437
+ if ( isset($field['captcha-wp-forms']) && (strpos( $field['captcha-wp-forms'], 'default_wp_register') !== false) ) { // check where reCAPTCHA should display and add reCAPTCHA html
438
+ $recaptcha_output = '<label for="recaptcha_response_field" style="padding-left:15px; padding-bottom:7px;">' . $item_title . '</label>' . wppb_recaptcha_get_html($publickey);
439
+ if (!empty($item_description))
440
+ $recaptcha_output .= '<span class="wppb-description-delimiter">' . $item_description . '</span>';
441
+
442
+ echo '<div class="wppb-form-field wppb-recaptcha" style="margin-left:-14px; margin-bottom: 15px;">' . $recaptcha_output . '</div>';
443
+ }
444
+ }
445
+ }
446
+ add_action( 'register_form', 'wppb_display_recaptcha_default_wp_register' );
447
+
448
+ // Verify and show reCAPTCHA errors for default WP Register form
449
+ function wppb_verify_recaptcha_default_wp_register( $errors ){
450
+
451
+ $field = wppb_get_recaptcha_field();
452
+ if ( !empty($field) ){
453
+ global $wppb_recaptcha_response;
454
+ if (!isset($wppb_recaptcha_response)) $wppb_recaptcha_response = wppb_validate_captcha_response( trim( $field['public-key'] ), trim( $field['private-key'] ) );
455
+
456
+ // If reCAPTCHA not entered or incorrect reCAPTCHA answer
457
+ if ( isset( $_REQUEST['g-recaptcha-response'] ) && ( ( "" == $_REQUEST['g-recaptcha-response'] ) || ( $wppb_recaptcha_response == false ) ) ) {
458
+ $errors->add( 'wppb_recaptcha_error', __('Please enter a (valid) reCAPTCHA value','profile-builder') );
459
+ }
460
+ }
461
+
462
+ return $errors;
463
+ }
464
+ add_filter('registration_errors','wppb_verify_recaptcha_default_wp_register');
465
+
466
+ // set default "Display on which forms?" values in case there's already an existing reCAPTCHA field in Manage fields (when upgrading)
467
+ function wppb_recaptcha_set_default_values() {
468
+ $manage_fields = get_option('wppb_manage_fields', 'not_set');
469
+ if ($manage_fields != 'not_set') {
470
+ foreach ($manage_fields as $key => $value) {
471
+ if ($value['field'] == 'reCAPTCHA') {
472
+ if ( !isset($value['captcha-pb-forms']) ) $manage_fields[$key]['captcha-pb-forms'] = 'pb_register';
473
+ if ( !isset($value['captcha-wp-forms']) ) $manage_fields[$key]['captcha-wp-forms'] = 'default_wp_register';
474
+ }
475
+ }
476
+ update_option('wppb_manage_fields', $manage_fields);
477
+ }
478
+ }
front-end/default-fields/user-role/user-role.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* handle field output */
3
+ function wppb_user_role_handler( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){
4
+ if ( $field['field'] == 'Select (User Role)' ){
5
+
6
+ $user_role = '';
7
+ $user_can_manage_options = false;
8
+
9
+ // Get user data, set user's role and check to see if user can manage options
10
+ if( $user_id != 0 ) {
11
+ $user_data = get_userdata( $user_id );
12
+ $user_role = $user_data->roles[0];
13
+
14
+ if( isset( $user_data->allcaps['manage_options'] ) && $user_data->allcaps['manage_options'] == 1 ) {
15
+ $user_can_manage_options = true;
16
+ }
17
+ }
18
+
19
+ $input_value = isset( $request_data['custom_field_user_role'] ) ? $request_data['custom_field_user_role'] : $user_role;
20
+
21
+ $item_title = apply_filters( 'wppb_'.$form_location.'_user_role_custom_field_'.$field['id'].'_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title'] ) );
22
+ $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_description_translation', $field['description'] );
23
+
24
+ //get user roles
25
+ if( !empty( $field['user-roles'] ) ) {
26
+ global $wp_roles;
27
+
28
+ $available_user_roles = explode( ', ', $field['user-roles'] );
29
+
30
+ foreach( $available_user_roles as $key => $role_slug ) {
31
+ if( isset( $wp_roles->roles[$role_slug]['name'] ) ) {
32
+ $available_user_roles[$key] = array(
33
+ 'slug' => $role_slug,
34
+ 'name' => $wp_roles->roles[$role_slug]['name']
35
+ );
36
+ } else {
37
+ unset( $available_user_roles[$key] );
38
+ }
39
+ }
40
+ }
41
+
42
+ $extra_attr = apply_filters( 'wppb_extra_attribute', '', $field, $form_location );
43
+
44
+ if( $form_location == 'register' || ( $form_location == 'edit_profile' && current_user_can('manage_options') && $user_can_manage_options == false ) ) {
45
+ $error_mark = ( ( $field['required'] == 'Yes' ) ? '<span class="wppb-required" title="'.wppb_required_field_error($field["field-title"]).'">*</span>' : '' );
46
+
47
+ if ( array_key_exists( $field['id'], $field_check_errors ) )
48
+ $error_mark = '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.wppb_required_field_error($field["field-title"]).'"/>';
49
+
50
+ $output = '
51
+ <label for="custom_field_user_role">'.$item_title.$error_mark.'</label>
52
+ <select name="custom_field_user_role" id="'.$field['meta-name'].'" class="custom_field_user_role '. apply_filters( 'wppb_fields_extra_css_class', '', $field ) .'" '. $extra_attr .'>';
53
+
54
+ $extra_select_option = apply_filters( 'wppb_extra_select_option', '', $field, $item_title );
55
+ if( ! empty( $extra_select_option ) ) {
56
+ $output .= $extra_select_option;
57
+ }
58
+
59
+ if( !empty( $available_user_roles ) ) {
60
+ foreach( $available_user_roles as $user_role ){
61
+ $output .= '<option value="'. $user_role['slug'] .'"';
62
+
63
+ $output .= selected( $input_value, $user_role['slug'], false );
64
+
65
+ $output .= '>'. $user_role['name'] .'</option>';
66
+ }
67
+ }
68
+
69
+ $output .= '</select>';
70
+
71
+ if( $form_location == 'edit_profile' )
72
+ $output .= '<span class="wppb-description-delimiter">'. __( 'Only administrators can see this field on edit profile forms.', 'profile-builder' ) .'</span>';
73
+
74
+ if( !empty( $item_description ) )
75
+ $output .= '<span class="wppb-description-delimiter">'.$item_description.'</span>';
76
+
77
+ } elseif( $form_location == 'edit_profile' && current_user_can('manage_options') && $user_can_manage_options == true ) {
78
+
79
+ $output = '
80
+ <label for="custom_field_user_role">'.$item_title.'</label>
81
+ <p>' . __( 'As an administrator you cannot change your role.', 'profile-builder' ) . '</p>';
82
+
83
+ $output .= '</select>';
84
+
85
+ $output .= '<span class="wppb-description-delimiter">'. __( 'Only administrators can see this field on edit profile forms.', 'profile-builder' ) .'</span>';
86
+
87
+ if( !empty( $item_description ) )
88
+ $output .= '<span class="wppb-description-delimiter">'.$item_description.'</span>';
89
+
90
+ }
91
+
92
+ return apply_filters( 'wppb_'.$form_location.'_user_role_custom_field_'.$field['id'], $output, $form_location, $field, $user_id, $field_check_errors, $request_data, $input_value );
93
+ }
94
+ }
95
+ add_filter( 'wppb_output_form_field_select-user-role', 'wppb_user_role_handler', 10, 6 );
96
+
97
+
98
+ /* handle field validation */
99
+ function wppb_check_user_role_value( $message, $field, $request_data, $form_location ) {
100
+
101
+ if( $form_location == 'back_end' )
102
+ return $message;
103
+
104
+ $field['meta-name'] = 'custom_field_user_role';
105
+
106
+ if( $field['field'] == 'Select (User Role)' ){
107
+
108
+ if( $form_location == 'register' && $field['required'] == 'Yes' && current_user_can( 'manage_options' ) === false ) {
109
+ if( ( isset( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) && ( trim( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) == '' ) ) || !isset( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) ){
110
+ return wppb_required_field_error($field["field-title"]);
111
+ }
112
+ }
113
+
114
+ if( isset( $field['user-roles'] ) && isset( $request_data['custom_field_user_role'] ) ) {
115
+ $available_user_roles = explode(', ', $field['user-roles'] );
116
+
117
+ if( !in_array( $request_data['custom_field_user_role'], $available_user_roles ) ) {
118
+ return __( 'You cannot register this user role', 'profile-builder');
119
+ }
120
+ }
121
+
122
+ }
123
+
124
+ return $message;
125
+ }
126
+ add_filter( 'wppb_check_form_field_select-user-role', 'wppb_check_user_role_value', 10, 4 );
127
+
128
+
129
+ /* handle field save */
130
+ function wppb_userdata_add_user_role( $userdata, $global_request ){
131
+
132
+ if ( isset( $global_request['custom_field_user_role'] ) )
133
+ $userdata['role'] = sanitize_text_field( trim( $global_request['custom_field_user_role'] ) );
134
+
135
+ return $userdata;
136
+ }
137
+ add_filter( 'wppb_build_userdata', 'wppb_userdata_add_user_role', 10, 2 );
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
- Version: 2.6.1
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: https://www.cozmoslabs.com/
9
  License: GPL2
@@ -73,7 +73,7 @@ function wppb_free_plugin_init() {
73
  *
74
  *
75
  */
76
- define('PROFILE_BUILDER_VERSION', '2.6.1' );
77
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
@@ -137,6 +137,7 @@ function wppb_free_plugin_init() {
137
  include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
138
  }
139
  include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
 
140
 
141
  if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
142
  include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
@@ -166,8 +167,9 @@ function wppb_free_plugin_init() {
166
 
167
  include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
168
  include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
169
- if ( PROFILE_BUILDER != 'Profile Builder Free' )
170
- include_once(WPPB_PLUGIN_DIR . '/front-end/extra-fields/recaptcha/recaptcha.php'); //need to load this here for displaying reCAPTCHA on Login and Recover Password forms
 
171
 
172
 
173
  /**
@@ -188,8 +190,8 @@ function wppb_free_plugin_init() {
188
 
189
 
190
  // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
191
- register_activation_hook(__FILE__, 'wppb_generate_default_settings_defaults'); //prepoulate general settings
192
- register_activation_hook(__FILE__, 'wppb_prepopulate_fields'); //prepopulate manage fields list
193
 
194
  }
195
  } //end wppb_free_plugin_init
3
  Plugin Name: Profile Builder
4
  Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
+ Version: 2.6.2
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: https://www.cozmoslabs.com/
9
  License: GPL2
73
  *
74
  *
75
  */
76
+ define('PROFILE_BUILDER_VERSION', '2.6.2' );
77
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
137
  include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
138
  }
139
  include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
140
+ include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
141
 
142
  if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
143
  include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
167
 
168
  include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
169
  include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
170
+
171
+ /* added recaptcha and user role field since version 2.6.2 */
172
+ include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/recaptcha/recaptcha.php'); //need to load this here for displaying reCAPTCHA on Login and Recover Password forms
173
 
174
 
175
  /**
190
 
191
 
192
  // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
193
+ add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
194
+ add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
195
 
196
  }
197
  } //end wppb_free_plugin_init
readme.txt CHANGED
@@ -4,12 +4,12 @@ Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
4
  Tags: user registration, user profile, user registration form, user fields, extra user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form
5
 
6
  Requires at least: 3.1
7
- Tested up to: 4.7.3
8
- Stable tag: 2.6.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Simple to use profile plugin allowing front-end login, user registration and edit profile by using shortcodes.
13
 
14
  == Description ==
15
 
@@ -48,6 +48,9 @@ Users with administrator rights have access to the following features:
48
  * chose which user roles view the admin bar in the front-end of the website (Admin Bar Settings page).
49
  * select which profile fields users can use in frontend.
50
  * extended functionality available via [Add-ons](http://www.cozmoslabs.com/profile-builder-add-ons/?utm_source=wp.org&utm_medium=pb-description-page&utm_campaign=PBFree)
 
 
 
51
 
52
  **PROFILE BUILDER PRO**
53
 
@@ -63,7 +66,6 @@ The [Pro version](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_sourc
63
  * Multiple Edit Profile Forms
64
  * Admin Approval
65
  * Email Customizer (Personalize all emails sent to your users or admins; customize default WordPress registration email)
66
- * reCAPTCHA on user registration form
67
  * Advanced Modules (e.g. custom redirects, user listing, multiple registration forms etc.)
68
  * Access to support forums and documentation
69
  * 1 Year of Updates / Priority Support
@@ -148,8 +150,19 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
148
  8. Edit User Profile Page
149
  9. Recover Password Page
150
  10. Profile Builder Login Widget
 
 
151
 
152
  == Changelog ==
 
 
 
 
 
 
 
 
 
153
  = 2.6.1 =
154
  * Updated translation files
155
  * Added a filter for already logged in message on recover password form: wppb_recover_password_already_logged_in
4
  Tags: user registration, user profile, user registration form, user fields, extra user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form
5
 
6
  Requires at least: 3.1
7
+ Tested up to: 4.7.5
8
+ Stable tag: 2.6.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Simple to use profile plugin allowing front-end login, user registration and edit profile by using shortcodes. Also has built in Role Editor which grants you control over roles and capabilities on your site.
13
 
14
  == Description ==
15
 
48
  * chose which user roles view the admin bar in the front-end of the website (Admin Bar Settings page).
49
  * select which profile fields users can use in frontend.
50
  * extended functionality available via [Add-ons](http://www.cozmoslabs.com/profile-builder-add-ons/?utm_source=wp.org&utm_medium=pb-description-page&utm_campaign=PBFree)
51
+ * role editor: add, remove, clone and edit roles and also capabilities for these roles.
52
+ * reacaptcha for Profile Builder forms and WordPress default forms
53
+ * user role select field on register and edit profile forms
54
 
55
  **PROFILE BUILDER PRO**
56
 
66
  * Multiple Edit Profile Forms
67
  * Admin Approval
68
  * Email Customizer (Personalize all emails sent to your users or admins; customize default WordPress registration email)
 
69
  * Advanced Modules (e.g. custom redirects, user listing, multiple registration forms etc.)
70
  * Access to support forums and documentation
71
  * 1 Year of Updates / Priority Support
150
  8. Edit User Profile Page
151
  9. Recover Password Page
152
  10. Profile Builder Login Widget
153
+ 11. Role Editor Listing
154
+ 12. Role Editor
155
 
156
  == Changelog ==
157
+ = 2.6.2 =
158
+ * Added Role Editor which grants you control over roles and capabilities on your site.
159
+ * Added reacaptcha field for Profile Builder forms and WordPress default forms
160
+ * Added User Role select field
161
+ * We now prevent our forms from executing in the header on the wp_head hook to prevent conflicts with other plugins like Yoast SEO
162
+ * Improved WPML compatibility with login forms
163
+ * Now checkboxes retain their value on edit profile forms if the form errors out
164
+ * Changed the way we set the default settings that was sometimes not adding them properly
165
+
166
  = 2.6.1 =
167
  * Updated translation files
168
  * Added a filter for already logged in message on recover password form: wppb_recover_password_already_logged_in
screenshot-11.png ADDED
Binary file
screenshot-12.png ADDED
Binary file