PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | assets/lib/wck-api/fields/select.php +50 -51 2.0.24.0.3 View file →
@@ -1,51 +1,50 @@
1 -<?php
2 - /* @param string $meta Meta name.
3 - * @param array $details Contains the details for the field.
4 - * @param string $value Contains input value;
5 - * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6 - * @return string $element input element html string. */
7 -
8 -$element .= '<select name="'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" id="';
9 -if( !empty( $frontend_prefix ) )
10 - $element .= $frontend_prefix;
11 -$element .= esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" class="mb-select mb-field" >';
12 -
13 -if( !empty( $details['default-option'] ) && $details['default-option'] )
14 - $element .= '<option value="">'. __('...Chose', 'wck') .'</option>';
15 -
16 -$field_name = Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details );
17 -
18 -$options = '';
19 -if( !empty( $details['options'] ) ){
20 - $i = 0;
21 - foreach( $details['options'] as $option ){
22 -
23 - if( strpos( $option, '%' ) === false ){
24 - $label = $option;
25 - if( !empty( $details['values'] ) )
26 - $value_attr = $details['values'][$i];
27 - else
28 - $value_attr = $option;
29 - }
30 - else{
31 - $option_parts = explode( '%', $option );
32 - if( !empty( $option_parts ) ){
33 - if( empty( $option_parts[0] ) && count( $option_parts ) == 3 ){
34 - $label = $option_parts[1];
35 - if( !empty( $details['values'] ) )
36 - $value_attr = $details['values'][$i];
37 - else
38 - $value_attr = $option_parts[2];
39 - }
40 - }
41 - }
42 -
43 - $optionOutput = '<option value="'. esc_attr( $value_attr ) .'" '. selected( $value_attr, $value, false ) .' >'. esc_html( $label ) .'</option>';
44 - $options .= apply_filters( "wck_select_{$meta}_{$field_name}_option_{$i}", $optionOutput, $i);
45 -
46 - $i++;
47 - }
48 -}
49 -$element .= apply_filters( "wck_select_{$meta}_{$field_name}_options", $options );
50 -$element .= '</select>';
51 -?>
1 +<?php
2 +/* @param string $meta Meta name.
3 + * @param array $details Contains the details for the field.
4 + * @param string $value Contains input value;
5 + * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6 + * @return string $element input element html string. */
7 +
8 +$element .= '<select name="'. $single_prefix . esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" id="';
9 +if( !empty( $frontend_prefix ) )
10 + $element .= $frontend_prefix;
11 +$element .= esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" class="mb-select mb-field" >';
12 +
13 +if( !empty( $details['default-option'] ) && $details['default-option'] )
14 + $element .= '<option value="">'. __('...Choose', 'profile-builder') .'</option>';
15 +
16 +$field_name = Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details );
17 +
18 +// we're passing this further to a function. Need to make sure it exists so we don't get a notice.
19 +if( empty( $details['value'] ) ){
20 + $details['value'] = false;
21 +}
22 +
23 +$options = '';
24 +if( !empty( $details['options'] ) && !Wordpress_Creation_Kit_PB::wck_is_multi( $details['options'] ) ){
25 + $i = 0;
26 + foreach( $details['options'] as $option ){
27 + $optionOutput = Wordpress_Creation_Kit_PB::wck_generate_select_option($option, $details['value'], $i, $value);
28 + $options .= apply_filters( "wck_select_{$meta}_{$field_name}_option_{$i}", $optionOutput, $i);
29 +
30 + $i++;
31 + }
32 +} elseif( !empty( $details['options'] ) ){
33 + $i = 0;
34 + foreach($details['options']['optgroups'] as $optgroup){
35 + if(!empty($optgroup['options'])) {
36 + $options .= '<optgroup label="' . $optgroup['label'] . '">';
37 + foreach($optgroup['options'] as $option ){
38 + $optionOutput = Wordpress_Creation_Kit_PB::wck_generate_select_option($option, $details['value'], $i, $value);
39 + $options .= apply_filters( "wck_select_{$meta}_{$field_name}_option_{$i}", $optionOutput, $i);
40 +
41 + $i++;
42 + }
43 + $options .= '</optgroup>';
44 + }
45 + }
46 +}
47 +
48 +$element .= apply_filters( "wck_select_{$meta}_{$field_name}_options", $options );
49 +$element .= '</select>';
50 +