11<?php
2-
32if ( ! defined ( 'ABSPATH ' ) ) {
43 exit ; // Exit if accessed directly
54}
65
76$ sort_by = "" ;
87$ sort_by_options = uwp_get_sort_by_order_list ();
98
10- if (isset ($ _GET ['uwp_sort_by ' ]) && $ _GET ['uwp_sort_by ' ] != '' ) {
11- $ sort_by = strip_tags (esc_attr ($ _GET ['uwp_sort_by ' ]));
12- if (!isset ($ sort_by_options [$ sort_by ])){$ sort_by = "" ;} // validate
9+ if ( isset ( $ _REQUEST ['uwp_sort_by ' ] ) && $ _REQUEST ['uwp_sort_by ' ] != '' ) {
10+ $ sort_by = strip_tags ( $ _REQUEST ['uwp_sort_by ' ] );
11+
12+ if ( ! isset ( $ sort_by_options [ $ sort_by ] ) ) {
13+ $ sort_by = "" ;
14+ }
1315}
1416
15- do_action ('uwp_users_loop_actions ' );
17+ do_action ( 'uwp_users_loop_actions ' );
1618?>
1719<div class="container mb-3 overflow-visible">
18- <div class="row">
19- <div class="col-sm-8 p-0">
20+ <div class="row">
21+ <div class="col-sm-8 p-0">
2022 <?php
21- if ( is_uwp_users_page () || is_admin ()) {
22- echo do_shortcode ('[uwp_users_search] ' );
23+ if ( is_uwp_users_page () || is_admin () ) {
24+ echo do_shortcode ( '[uwp_users_search] ' );
2325 }
2426 ?>
25- </div>
26- <div class="col-sm-4 p-0">
27-
28- <div class="btn-toolbar justify-content-end" role="toolbar" aria-label="Toolbar with button groups">
29-
30- <div class="btn-group btn-group-sm mr-2 uwp-user-sort" role="group">
31- <?php
32- if (!empty ($ sort_by_options [$ sort_by ])){
33- $ content = esc_attr ( $ sort_by_options [$ sort_by ] );
34- }else {
35- $ content = __ ("Sort By " , "userswp " );
36- }
37-
38- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
39- 'type ' => 'button ' ,
40- 'id ' => 'uwp-user-sort ' ,
41- 'icon ' => 'fas fa-sort ' ,
42- 'class ' => 'btn btn-outline-primary rounded-right ' ,
43- 'content ' => $ content , // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
44- 'extra_attributes ' => array ('data-toggle ' =>'dropdown ' , 'aria-haspopup ' =>'true ' , 'aria-expanded ' =>'false ' )
45- ));
46- ?>
47- <div class="dropdown-menu mt-3" aria-labelledby="uwp-user-sort">
48- <h6 class="dropdown-header"><?php esc_html_e ("Sort Options " , "userswp " ); ?> </h6>
27+ </div>
28+ <div class="col-sm-4 p-0">
29+ <div class="btn-toolbar justify-content-end" role="toolbar" aria-label="Toolbar with button groups">
30+ <div class="btn-group btn-group-sm mr-2 uwp-user-sort" role="group">
31+ <?php
32+ if ( ! empty ( $ sort_by_options [ $ sort_by ] ) ) {
33+ $ content = $ sort_by_options [ $ sort_by ];
34+ } else {
35+ $ content = __ ( "Sort By " , "userswp " );
36+ }
37+
38+ aui ()->button ( array (
39+ 'type ' => 'button ' ,
40+ 'id ' => 'uwp-user-sort ' ,
41+ 'icon ' => 'fas fa-sort ' ,
42+ 'class ' => 'btn btn-outline-primary rounded-right ' ,
43+ 'content ' => esc_html ( $ content ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
44+ 'extra_attributes ' => array ('data-toggle ' =>'dropdown ' , 'aria-haspopup ' =>'true ' , 'aria-expanded ' =>'false ' )
45+ ), true );
46+ ?>
47+ <div class="dropdown-menu mt-3" aria-labelledby="uwp-user-sort">
48+ <h6 class="dropdown-header"><?php esc_html_e ( "Sort Options " , "userswp " ); ?> </h6>
4949 <?php
50- $ base_link = uwp_get_page_id ('users_page ' ,true );
50+ $ base_link = uwp_get_page_id ( 'users_page ' , true );
5151
5252 $ query_string = array ();
5353 $ default_query = array ('uwp_sort_by ' );
54- if (!empty ($ _SERVER ['QUERY_STRING ' ])) {
55- $ query_string_temp = explode ('& ' ,$ _SERVER ['QUERY_STRING ' ]);
56- if (!empty ($ query_string_temp ) && is_array ($ query_string_temp )) {
57- foreach ($ query_string_temp as $ string ) {
58- $ string_temp = explode ('= ' ,$ string );
59- $ key = !empty ($ string_temp [0 ]) ? $ string_temp [0 ] : '' ;
60- $ value = !empty ($ string_temp [1 ]) ? $ string_temp [1 ] : '' ;
61- if (!empty ($ key ) && !empty ($ value ) && !in_array ($ key ,$ default_query )) {
62- $ query_string [$ key ] = !empty ($ value )? esc_attr ($ value ) : '' ;
54+
55+ if ( ! empty ( $ _SERVER ['QUERY_STRING ' ] ) ) {
56+ $ query_string_temp = explode ( '& ' ,$ _SERVER ['QUERY_STRING ' ] );
57+
58+ if ( ! empty ( $ query_string_temp ) && is_array ( $ query_string_temp ) ) {
59+ foreach ( $ query_string_temp as $ string ) {
60+ $ string_temp = explode ( '= ' , $ string );
61+ $ key = ! empty ( $ string_temp [0 ] ) ? $ string_temp [0 ] : '' ;
62+ $ value = ! empty ( $ string_temp [1 ] ) ? $ string_temp [1 ] : '' ;
63+
64+ if ( ! empty ( $ key ) && ! empty ( $ value ) && ! in_array ( $ key , $ default_query ) ) {
65+ $ query_string [ $ key ] = ! empty ( $ value ) ? esc_attr ( $ value ) : '' ;
6366 }
6467 }
6568 }
6669 }
6770
68- if (! empty ($ query_string)) {
69- $ base_link = add_query_arg ($ query_string ,$ base_link );
70- } // search param
71+ if ( ! empty ( $ query_string ) ) {
72+ $ base_link = add_query_arg ( $ query_string , $ base_link );
73+ }
7174
72- if (!empty ($ _REQUEST ['uwp_sort_by ' ])){$ base_link = remove_query_arg (array ('uwp_sort_by ' ),$ base_link );} // search param
75+ if ( ! empty ( $ _REQUEST ['uwp_sort_by ' ] ) ) {
76+ $ base_link = remove_query_arg ( array ( 'uwp_sort_by ' ), $ base_link );
77+ }
7378
74- foreach ($ sort_by_options as $ key => $ val ){
75- $ active = isset ($ _REQUEST ['uwp_sort_by ' ]) && $ _REQUEST ['uwp_sort_by ' ]==$ key ? 'active ' : '' ;
76- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
77- 'type ' => 'a ' ,
78- 'href ' => esc_url_raw (add_query_arg (array ('uwp_sort_by ' =>$ key ),$ base_link )),
79- 'class ' => esc_html ( 'dropdown-item ' .$ active ),
80- 'content ' => esc_attr ($ val ),
81- ));
79+ foreach ( $ sort_by_options as $ key => $ val ) {
80+ $ active = isset ( $ _REQUEST ['uwp_sort_by ' ] ) && $ _REQUEST ['uwp_sort_by ' ] == $ key ? ' active ' : '' ;
81+
82+ aui ()->button ( array (
83+ 'type ' => 'a ' ,
84+ 'href ' => esc_url_raw ( add_query_arg ( array ( 'uwp_sort_by ' => $ key ), $ base_link ) ),
85+ 'class ' => esc_html ( 'dropdown-item ' . $ active ),
86+ 'content ' => esc_html ( $ val ),
87+ 'extra_attributes ' => array ( 'rel ' => 'nofollow ' )
88+ ), true );
8289 }
8390
84- if (! empty ($ _REQUEST ['uwp_sort_by ' ])) {
91+ if ( ! empty ( $ _REQUEST ['uwp_sort_by ' ] ) ) {
8592 echo '<div class="dropdown-divider"></div> ' ;
86- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
87- 'type ' => 'a ' ,
88- 'href ' => esc_url_raw ($ base_link ),
89- 'class ' => 'dropdown-item ' ,
90- 'content ' => esc_html__ ("Clear Sort " , "userswp " ),
91- ));
93+ aui ()->button ( array (
94+ 'type ' => 'a ' ,
95+ 'href ' => esc_url_raw ( $ base_link ),
96+ 'class ' => 'dropdown-item ' ,
97+ 'content ' => esc_html__ ( "Clear Sort " , "userswp " ),
98+ 'extra_attributes ' => array ( 'rel ' => 'nofollow ' )
99+ ), true );
92100 } ?>
93- </div>
94- </div>
95-
96- <div class="btn-group btn-group-sm uwp-list-view-select" role="group" aria-label="First group">
97- <div class="btn-group btn-group-sm" role="group">
98- <?php
99- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
100- 'type ' => 'button ' ,
101- 'id ' => 'uwp-list-view-select-grid ' ,
102- 'class ' => 'btn btn-outline-primary rounded-right uwp-list-view-select-grid ' ,
103- 'icon ' => 'fas fa-th ' ,
104- 'extra_attributes ' => array ('data-toggle ' =>'dropdown ' , 'aria-haspopup ' =>'true ' , 'aria-expanded ' =>'false ' )
105- ));
106- ?>
107- <div class="dropdown-menu dropdown-menu-right mt-3 p-0" aria-labelledby="uwp-list-view-select-grid">
108- <?php
109- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
110- 'type ' => 'button ' ,
111- 'class ' => 'dropdown-item ' ,
112- 'content ' => esc_html ( sprintf (__ ("Grid %d " ,"userswp " ),1 ) ),
113- 'onclick ' => 'uwp_list_view_select(1);return false; ' ,
114- 'extra_attributes ' => array ('data-gridview ' =>'1 ' )
115- ));
116- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
117- 'type ' => 'button ' ,
118- 'class ' => 'dropdown-item ' ,
119- 'content ' => esc_html ( sprintf (__ ("Grid %d " ,"userswp " ),2 ) ),
120- 'onclick ' => 'uwp_list_view_select(2);return false; ' ,
121- 'extra_attributes ' => array ('data-gridview ' =>'2 ' )
122- ));
123- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
124- 'type ' => 'button ' ,
125- 'class ' => 'dropdown-item ' ,
126- 'content ' => esc_html ( sprintf (__ ("Grid %d " ,"userswp " ),3 ) ),
127- 'onclick ' => 'uwp_list_view_select(3);return false; ' ,
128- 'extra_attributes ' => array ('data-gridview ' =>'3 ' )
129- ));
130- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
131- 'type ' => 'button ' ,
132- 'class ' => 'dropdown-item ' ,
133- 'content ' => esc_html ( sprintf (__ ("Grid %d " ,"userswp " ),4 ) ),
134- 'onclick ' => 'uwp_list_view_select(4);return false; ' ,
135- 'extra_attributes ' => array ('data-gridview ' =>'4 ' )
136- ));
137- echo aui ()->button (array ( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
138- 'type ' => 'button ' ,
139- 'class ' => 'dropdown-item ' ,
140- 'content ' => esc_html ( sprintf (__ ("Grid %d " ,"userswp " ),5 ) ),
141- 'onclick ' => 'uwp_list_view_select(5);return false; ' ,
142- 'extra_attributes ' => array ('data-gridview ' =>'5 ' )
143- ));
144- ?>
145- </div>
146- </div>
147- </div>
148- </div>
149- </div>
150- <?php do_action ('uwp_advanced_search_form ' ); ?>
151- </div>
101+ </div>
102+ </div>
103+
104+ <div class="btn-group btn-group-sm uwp-list-view-select" role="group" aria-label="First group">
105+ <div class="btn-group btn-group-sm" role="group">
106+ <?php
107+ aui ()->button ( array (
108+ 'type ' => 'button ' ,
109+ 'id ' => 'uwp-list-view-select-grid ' ,
110+ 'class ' => 'btn btn-outline-primary rounded-right uwp-list-view-select-grid ' ,
111+ 'icon ' => 'fas fa-th ' ,
112+ 'extra_attributes ' => array ( 'data-toggle ' => 'dropdown ' , 'aria-haspopup ' => 'true ' , 'aria-expanded ' => 'false ' )
113+ ), true );
114+ ?>
115+ <div class="dropdown-menu dropdown-menu-right mt-3 p-0" aria-labelledby="uwp-list-view-select-grid">
116+ <?php
117+ aui ()->button ( array (
118+ 'type ' => 'button ' ,
119+ 'class ' => 'dropdown-item ' ,
120+ 'content ' => esc_html ( wp_sprintf ( __ ( "Grid %d " ,"userswp " ), 1 ) ),
121+ 'onclick ' => 'uwp_list_view_select(1);return false; ' ,
122+ 'extra_attributes ' => array ( 'data-gridview ' => '1 ' )
123+ ), true );
124+
125+ aui ()->button ( array (
126+ 'type ' => 'button ' ,
127+ 'class ' => 'dropdown-item ' ,
128+ 'content ' => esc_html ( wp_sprintf ( __ ( "Grid %d " ,"userswp " ), 2 ) ),
129+ 'onclick ' => 'uwp_list_view_select(2);return false; ' ,
130+ 'extra_attributes ' => array ( 'data-gridview ' => '2 ' )
131+ ), true );
132+
133+ aui ()->button ( array (
134+ 'type ' => 'button ' ,
135+ 'class ' => 'dropdown-item ' ,
136+ 'content ' => esc_html ( wp_sprintf ( __ ( "Grid %d " ,"userswp " ), 3 ) ),
137+ 'onclick ' => 'uwp_list_view_select(3);return false; ' ,
138+ 'extra_attributes ' => array ( 'data-gridview ' => '3 ' )
139+ ), true );
140+
141+ aui ()->button ( array (
142+ 'type ' => 'button ' ,
143+ 'class ' => 'dropdown-item ' ,
144+ 'content ' => esc_html ( wp_sprintf ( __ ( "Grid %d " ,"userswp " ), 4 ) ),
145+ 'onclick ' => 'uwp_list_view_select(4);return false; ' ,
146+ 'extra_attributes ' => array ( 'data-gridview ' => '4 ' )
147+ ), true );
148+
149+ aui ()->button ( array (
150+ 'type ' => 'button ' ,
151+ 'class ' => 'dropdown-item ' ,
152+ 'content ' => esc_html ( wp_sprintf ( __ ( "Grid %d " ,"userswp " ), 5 ) ),
153+ 'onclick ' => 'uwp_list_view_select(5);return false; ' ,
154+ 'extra_attributes ' => array ( 'data-gridview ' => '5 ' )
155+ ), true );
156+ ?>
157+ </div>
158+ </div>
159+ </div>
160+ </div>
161+ </div>
162+ <?php do_action ( 'uwp_advanced_search_form ' ); ?>
163+ </div>
152164</div>
153- <?php do_action ('uwp_after_users_loop_actions ' ); ?>
165+ <?php do_action ( 'uwp_after_users_loop_actions ' ); ?>
0 commit comments