Issues (1223)

classes/class-lsx-team-widget.php (110 issues)

1
<?php
2
/**
3
 * LSX Team Widget Class
4
 *
5
 * @package   LSX Team
6
 * @author    LightSpeed
7
 * @license   GPL3
8
 * @link
9
 * @copyright 2016 LightSpeed
10
 */
11
class LSX_Team_Widget extends WP_Widget {
12
13
	public function __construct() {
14
		$widget_ops = array(
15
			'classname' => 'lsx-team',
16
		);
17
18
		parent::__construct( 'LSX_Team_Widget', esc_html__( 'LSX Team Members', 'lsx-team' ), $widget_ops );
19
	}
20
21
	public function widget( $args, $instance ) {
22
		extract( $args );
0 ignored issues
show
extract() usage is highly discouraged, due to the complexity and unintended issues it might cause.
Loading history...
23
24
		$title = $instance['title'];
25
		$title_link = $instance['title_link'];
26
		$tagline = $instance['tagline'];
27
		$columns = $instance['columns'];
28
		$orderby = $instance['orderby'];
29
		$order = $instance['order'];
30
		$role = $instance['role'];
31
		$limit = $instance['limit'];
32
		$include = $instance['include'];
33
		$display = $instance['display'];
34
		$size = $instance['size'];
35
		$show_link = $instance['show_link'];
36
		$show_image = $instance['show_image'];
37
		$show_roles = $instance['show_roles'];
38
		$show_job_title = $instance['show_job_title'];
39
		$show_desc = $instance['show_desc'];
40
		$show_social = $instance['show_social'];
41
		$button_text = $instance['button_text'];
42
		$carousel = $instance['carousel'];
43
		$featured = $instance['featured'];
44
45
		// If limit not set, display 99 posts
46
		if ( empty( $limit ) ) {
47
			$limit = '99';
48
		}
49
50
		// If specific posts included, display 99 posts
51
		if ( ! empty( $include ) ) {
52
			$limit = '99';
53
		}
54
55
		// Disregard specific ID setting if specific role is defined
56
		if ( 'all' !== $role ) {
57
			$include = '';
58
		} else {
59
			$role = '';
60
		}
61
62
		$show_link = '1' == $show_link ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
63
		$show_image = '1' == $show_image ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
64
		$show_roles = '1' == $show_roles ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
65
		$show_job_title = '1' == $show_job_title ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
66
		$show_desc = '1' == $show_desc ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
67
		$show_social = '1' == $show_social ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
68
		$carousel = '1' == $carousel ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
69
		$featured = '1' == $featured ? 'true' : 'false';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
70
71
		if ( $title_link ) {
72
			//$link_open = '<a href="' . $title_link . '">';
73
			$link_open = '';
74
			$link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">';
75
			//$link_close = '</a>';
76
			$link_close = '';
77
			$link_btn_close = '</a>';
78
		} else {
79
			$link_open = '';
80
			$link_btn_open = '';
81
			$link_close = '';
82
			$link_btn_close = '';
83
		}
84
85
		echo wp_kses_post( $before_widget );
86
87
		if ( $title ) {
88
			echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title );
89
		}
90
91
		if ( $tagline ) {
92
			echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>';
93
		}
94
95
		if ( class_exists( 'LSX_Team' ) ) {
96
			lsx_team( array(
97
				'columns' => $columns,
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'columns'" and double arrow, but found 1.
Loading history...
98
				'orderby' => $orderby,
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'orderby'" and double arrow, but found 1.
Loading history...
99
				'order' => $order,
0 ignored issues
show
Array double arrow not aligned correctly; expected 10 space(s) between "'order'" and double arrow, but found 1.
Loading history...
100
				'role' => $role,
0 ignored issues
show
Array double arrow not aligned correctly; expected 11 space(s) between "'role'" and double arrow, but found 1.
Loading history...
101
				'limit' => $limit,
0 ignored issues
show
Array double arrow not aligned correctly; expected 10 space(s) between "'limit'" and double arrow, but found 1.
Loading history...
102
				'include' => $include,
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'include'" and double arrow, but found 1.
Loading history...
103
				'display' => $display,
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'display'" and double arrow, but found 1.
Loading history...
104
				'size' => $size,
0 ignored issues
show
Array double arrow not aligned correctly; expected 11 space(s) between "'size'" and double arrow, but found 1.
Loading history...
105
				'show_link' => $show_link,
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'show_link'" and double arrow, but found 1.
Loading history...
106
				'show_image' => $show_image,
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'show_image'" and double arrow, but found 1.
Loading history...
107
				'show_roles' => $show_roles,
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'show_roles'" and double arrow, but found 1.
Loading history...
108
				'show_job_title' => $show_job_title,
109
				'show_desc' => $show_desc,
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'show_desc'" and double arrow, but found 1.
Loading history...
110
				'show_social' => $show_social,
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'show_social'" and double arrow, but found 1.
Loading history...
111
				'carousel' => $carousel,
0 ignored issues
show
Array double arrow not aligned correctly; expected 7 space(s) between "'carousel'" and double arrow, but found 1.
Loading history...
112
				'featured' => $featured,
0 ignored issues
show
Array double arrow not aligned correctly; expected 7 space(s) between "'featured'" and double arrow, but found 1.
Loading history...
113
			) );
114
115
		};
116
117
		if ( $button_text && $title_link ) {
118
			echo wp_kses_post( '<p class="text-center lsx-team-archive-link-wrap"><span class="lsx-team-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' );
119
		}
120
121
		echo wp_kses_post( $after_widget );
122
	}
123
124
	public function update( $new_instance, $old_instance ) {
125
		$instance = $old_instance;
126
127
		$instance['title'] 				= wp_kses_post( force_balance_tags( $new_instance['title'] ) );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
128
		$instance['title_link'] 		= strip_tags( $new_instance['title_link'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
129
		$instance['tagline'] 			= strip_tags( $new_instance['tagline'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
130
		$instance['columns'] 			= strip_tags( $new_instance['columns'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
131
		$instance['orderby'] 			= strip_tags( $new_instance['orderby'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
132
		$instance['order'] 				= strip_tags( $new_instance['order'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
133
		$instance['role'] 				= strip_tags( $new_instance['role'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
134
		$instance['limit'] 				= strip_tags( $new_instance['limit'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
135
		$instance['include'] 			= strip_tags( $new_instance['include'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
136
		$instance['display'] 			= strip_tags( $new_instance['display'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
137
		$instance['size'] 				= strip_tags( $new_instance['size'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
138
		$instance['show_link'] 			= strip_tags( $new_instance['show_link'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
139
		$instance['show_image'] 		= strip_tags( $new_instance['show_image'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
140
		$instance['show_roles'] 		= strip_tags( $new_instance['show_roles'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
141
		$instance['show_job_title'] 	= strip_tags( $new_instance['show_job_title'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
142
		$instance['show_desc'] 			= strip_tags( $new_instance['show_desc'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
143
		$instance['show_social'] 		= strip_tags( $new_instance['show_social'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
144
		$instance['button_text'] 	    = strip_tags( $new_instance['button_text'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
145
		$instance['carousel'] 			= strip_tags( $new_instance['carousel'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
146
		$instance['featured']           = strip_tags( $new_instance['featured'] );
0 ignored issues
show
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
147
148
		return $instance;
149
	}
150
151
	public function form( $instance ) {
152
		$defaults = array(
153
			'title' => 'Team Members',
0 ignored issues
show
Array double arrow not aligned correctly; expected 10 space(s) between "'title'" and double arrow, but found 1.
Loading history...
154
			'title_link' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'title_link'" and double arrow, but found 1.
Loading history...
155
			'tagline' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'tagline'" and double arrow, but found 1.
Loading history...
156
			'columns' => '1',
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'columns'" and double arrow, but found 1.
Loading history...
157
			'orderby' => 'name',
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'orderby'" and double arrow, but found 1.
Loading history...
158
			'order' => 'ASC',
0 ignored issues
show
Array double arrow not aligned correctly; expected 10 space(s) between "'order'" and double arrow, but found 1.
Loading history...
159
			'role' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 11 space(s) between "'role'" and double arrow, but found 1.
Loading history...
160
			'limit' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 10 space(s) between "'limit'" and double arrow, but found 1.
Loading history...
161
			'include' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'include'" and double arrow, but found 1.
Loading history...
162
			'display' => 'excerpt',
0 ignored issues
show
Array double arrow not aligned correctly; expected 8 space(s) between "'display'" and double arrow, but found 1.
Loading history...
163
			'size' => 'lsx-team-archive',
0 ignored issues
show
Array double arrow not aligned correctly; expected 11 space(s) between "'size'" and double arrow, but found 1.
Loading history...
164
			'show_link' => 0,
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'show_link'" and double arrow, but found 1.
Loading history...
165
			'show_image' => 1,
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'show_image'" and double arrow, but found 1.
Loading history...
166
			'show_roles' => 0,
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'show_roles'" and double arrow, but found 1.
Loading history...
167
			'show_job_title' => 1,
168
			'show_desc' => 1,
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'show_desc'" and double arrow, but found 1.
Loading history...
169
			'show_social' => 1,
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'show_social'" and double arrow, but found 1.
Loading history...
170
			'button_text' => '',
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'button_text'" and double arrow, but found 1.
Loading history...
171
			'carousel' => 1,
0 ignored issues
show
Array double arrow not aligned correctly; expected 7 space(s) between "'carousel'" and double arrow, but found 1.
Loading history...
172
			'featured' => 0,
0 ignored issues
show
Array double arrow not aligned correctly; expected 7 space(s) between "'featured'" and double arrow, but found 1.
Loading history...
173
		);
174
175
		$instance = wp_parse_args( (array) $instance, $defaults );
176
177
		$title 				= esc_attr( $instance['title'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
178
		$title_link			= esc_attr( $instance['title_link'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
179
		$tagline 			= esc_attr( $instance['tagline'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
180
		$columns 			= esc_attr( $instance['columns'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
181
		$orderby 			= esc_attr( $instance['orderby'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
182
		$order 				= esc_attr( $instance['order'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
183
		$role 				= esc_attr( $instance['role'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
184
		$limit  			= esc_attr( $instance['limit'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
185
		$include  			= esc_attr( $instance['include'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
186
		$display  			= esc_attr( $instance['display'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
187
		$size  				= esc_attr( $instance['size'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
188
		$show_link 			= esc_attr( $instance['show_link'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
189
		$show_image 		= esc_attr( $instance['show_image'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
190
		$show_roles 		= esc_attr( $instance['show_roles'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
191
		$show_job_title 	= esc_attr( $instance['show_job_title'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
192
		$show_desc 			= esc_attr( $instance['show_desc'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
193
		$show_social 		= esc_attr( $instance['show_social'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
194
		$button_text 	    = esc_attr( $instance['button_text'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
195
		$carousel 			= esc_attr( $instance['carousel'] );
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
196
		$featured           = esc_attr( $instance['featured'] );
197
		?>
198
		<p>
199
			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-team' ); ?></label>
200
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
201
		</p>
202
		<p>
203
			<label for="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>"><?php esc_html_e( 'Page Link:', 'lsx-team' ); ?></label>
204
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_link' ) ); ?>" type="text" value="<?php echo esc_attr( $title_link ); ?>" />
205
			<small><?php esc_html_e( 'Link the widget to a page', 'lsx-team' ); ?></small>
206
		</p>
207
		<p>
208
			<label for="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>"><?php esc_html_e( 'Tagline:', 'lsx-team' ); ?></label>
209
			<textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tagline' ) ); ?>"><?php echo esc_html( $tagline ); ?></textarea>
210
			<small><?php esc_html_e( 'Tagline to display below the widget title', 'lsx-team' ); ?></small>
211
		</p>
212
		<p>
213
			<label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-team' ); ?></label>
214
			<select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat layout">
215
			<?php
216
				$options = array( '1', '2', '3', '4' );
217
218
			foreach ( $options as $option ) {
219
					echo '<option value="' . lcfirst( esc_attr( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
220
			}
221
			?>
222
			</select>
223
		</p>
224
		<p>
225
			<label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-team' ); ?></label>
226
			<select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
227
			<?php
228
				$options = array(
229
					esc_html__( 'None', 'lsx-team' ) => 'none',
0 ignored issues
show
Array double arrow not aligned correctly; expected 3 space(s) between ")" and double arrow, but found 1.
Loading history...
230
					esc_html__( 'ID', 'lsx-team' ) => 'ID',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between ")" and double arrow, but found 1.
Loading history...
231
					esc_html__( 'Name', 'lsx-team' ) => 'name',
0 ignored issues
show
Array double arrow not aligned correctly; expected 3 space(s) between ")" and double arrow, but found 1.
Loading history...
232
					esc_html__( 'Date', 'lsx-team' ) => 'date',
0 ignored issues
show
Array double arrow not aligned correctly; expected 3 space(s) between ")" and double arrow, but found 1.
Loading history...
233
					esc_html__( 'Modified Date', 'lsx-team' ) => 'modified',
234
					esc_html__( 'Random', 'lsx-team' ) => 'rand',
235
					esc_html__( 'Menu (WP dashboard order)', 'lsx-team' ) => 'menu_order',
236
				);
237
238
			foreach ( $options as $name => $value ) {
239
					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
240
			}
241
			?>
242
			</select>
243
		</p>
244
		<p>
245
			<label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-team' ); ?></label>
246
			<select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat">
247
			<?php
248
				$options = array(
249
					esc_html__( 'Ascending', 'lsx-team' ) => 'ASC',
0 ignored issues
show
Array double arrow not aligned correctly; expected 2 space(s) between ")" and double arrow, but found 1.
Loading history...
250
					esc_html__( 'Descending', 'lsx-team' ) => 'DESC',
251
				);
252
253
			foreach ( $options as $name => $value ) {
254
					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
255
			}
256
			?>
257
			</select>
258
		</p>
259
		<p>
260
			<label for="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>"><?php esc_html_e( 'Role:', 'lsx-team' ); ?></label>
261
			<select name="<?php echo esc_attr( $this->get_field_name( 'role' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>" class="widefat">
262
			<?php
263
				$options = get_terms( 'team_role' );
264
			?>
265
			<option value="all" id="all">
266
				<?php esc_html_e( 'All Roles', 'lsx-team' ); ?>
267
			</option>
268
			<?php
269
			foreach ( $options as $option ) {
270
					echo '<option value="' . esc_attr( $option->slug ) . '" id="' . esc_attr( $option->slug ) . '"', $role == $option->slug ? ' selected="selected"' : '', '>', esc_html( $option->name ), '</option>';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
271
			}
272
			?>
273
			</select>
274
			<small><?php esc_html_e( 'Display team members within a specific role', 'lsx-team' ); ?></small>
275
		</p>
276
		<p>
277
			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum amount:', 'lsx-team' ); ?></label>
278
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" />
279
			<small><?php esc_html_e( 'Leave empty to display all', 'lsx-team' ); ?></small>
280
		</p>
281
		<p>
282
			<label for="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>"><?php esc_html_e( 'Specify Team Members by ID:', 'lsx-team' ); ?></label>
283
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include' ) ); ?>" type="text" value="<?php echo esc_attr( $include ); ?>" />
284
			<small><?php esc_html_e( 'Comma separated list, overrides limit setting', 'lsx-team' ); ?></small>
285
		</p>
286
		<p>
287
			<label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-team' ); ?></label>
288
			<select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat">
289
			<?php
290
				$options = array(
291
					esc_html__( 'Excerpt', 'lsx-team' ) => 'excerpt',
292
					esc_html__( 'Full Content', 'lsx-team' ) => 'full',
293
				);
294
295
			foreach ( $options as $name => $value ) {
296
					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
297
			}
298
			?>
299
			</select>
300
		</p>
301
		<p>
302
			<label for="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>"><?php esc_html_e( 'Image size:', 'lsx-team' ); ?></label>
303
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'size' ) ); ?>" type="text" value="<?php echo esc_attr( $size ); ?>" />
304
		</p>
305
		<p>
306
			<label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button "view all" text:', 'lsx-team' ); ?></label>
307
			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $button_text ); ?>" />
308
			<small><?php esc_html_e( 'Leave empty to not display the button', 'lsx-team' ); ?></small>
309
		</p>
310
		<p>
311
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_link' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_link ); ?> />
312
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_link' ) ); ?>"><?php esc_html_e( 'Link to Single', 'lsx-team' ); ?></label>
313
		</p>
314
		<p>
315
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_image ); ?> />
316
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php esc_html_e( 'Show Images', 'lsx-team' ); ?></label>
317
		</p>
318
		<p>
319
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_roles' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_roles' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_roles ); ?> />
320
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_roles' ) ); ?>"><?php esc_html_e( 'Show Roles', 'lsx-team' ); ?></label>
321
		</p>
322
		<p>
323
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_job_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_job_title' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_job_title ); ?> />
324
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_job_title' ) ); ?>"><?php esc_html_e( 'Show Job Title', 'lsx-team' ); ?></label>
325
		</p>
326
		<p>
327
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_desc' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_desc' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_desc ); ?> />
328
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_desc' ) ); ?>"><?php esc_html_e( 'Show Description', 'lsx-team' ); ?></label>
329
		</p>
330
		<p>
331
			<input id="<?php echo esc_attr( $this->get_field_id( 'show_social' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_social' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_social ); ?> />
332
			<label for="<?php echo esc_attr( $this->get_field_id( 'show_social' ) ); ?>"><?php esc_html_e( 'Show Social Icons', 'lsx-team' ); ?></label>
333
		</p>
334
		<p>
335
			<input id="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'carousel' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $carousel ); ?> />
336
			<label for="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>"><?php esc_html_e( 'Carousel', 'lsx-team' ); ?></label>
337
		</p>
338
		<p>
339
			<input id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $featured ); ?> />
340
			<label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-team' ); ?></label>
341
		</p>
342
		<?php
343
	}
344
345
}
346
347
/**
348
* Registers the Widget
349
*/
350
function lsx_team_widget() {
351
	register_widget( 'LSX_Team_Widget' );
352
}
353
354
add_action( 'widgets_init', 'lsx_team_widget' );
355