PluginProbe
WP Bottom Menu / trunk
WP Bottom Menu vtrunk
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.1.1 1.1.2 1.2 1.3 1.3.2 1.4 1.4.2 1.4.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 All 27 releases
wp-bottom-menu / inc / multiple-select / multiple-select.php

multiple-select.php in WP Bottom Menu trunk, at inc/multiple-select/multiple-select.php

70 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 if ( ! class_exists( 'WP_Customize_Control' ) ) {
6 return null;
7 }
8
9 /**
10 * Multiselect option for WP Customizer
11 *
12 * @param $wp_customize
13 */
14
15 /**
16 * Multiple select customize control class.
17 */
18 class Customize_Control_Multiple_Select extends WP_Customize_Control {
19
20 /**
21 * The type of customize control being rendered.
22 */
23 public $type = 'multiple-select';
24
25 /**
26 * Displays the multiple select on the customize screen.
27 */
28 public function render_content() {
29
30 if ( empty( $this->choices ) ) {
31 return;
32 }
33 ?>
34
35 <label>
36 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
37 <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
38 <select <?php $this->link(); ?> class="wp-bottom-menu-select2" multiple="multiple" style="width: 100%">
39 <?php
40 foreach ( $this->choices as $value => $label ) {
41 echo '<option value="' . esc_attr( $value ) . '"' . selected( in_array( $this->value(), $this->choices ), true, false ) . '>' . esc_html( $label ) . '</option>';
42 }
43 ?>
44 </select>
45 </label>
46 <?php
47
48 }
49
50 }
51
52 function wpbm_get_user_roles() {
53
54 global $wp_roles;
55 $roles = [ 'all' => esc_html__( 'All Visitors', 'wp-bottom-menu' ) ];
56
57 // check roles
58 if ( ! isset( $wp_roles ) ){
59 $wp_roles = new WP_Roles();
60 }
61
62 // add roles in array
63 foreach( $wp_roles->get_names() as $key => $role ){
64 $roles[$key] = $role;
65 }
66
67 // return roles
68 return $roles;
69
70 }