@@ -49,12 +49,6 @@ function () {
49
49
* @uses selected
50
50
*/
51
51
public function add_filter (): void {
52
- $ id = (
53
- filter_has_var ( INPUT_GET , self ::FILTER_NAME ) ?
54
- filter_input ( INPUT_GET , self ::FILTER_NAME , FILTER_SANITIZE_NUMBER_INT ) :
55
- '0 '
56
- );
57
-
58
52
$ blogs = $ this ->collection ->get ();
59
53
if ( $ blogs ) {
60
54
$ options = array ( '' => esc_html ( __ ( 'Show all posts ' , 'multisite-language-switcher ' ) ) );
@@ -65,6 +59,12 @@ public function add_filter(): void {
65
59
);
66
60
}
67
61
62
+ $ id = (
63
+ filter_has_var ( INPUT_GET , self ::FILTER_NAME ) ?
64
+ filter_input ( INPUT_GET , self ::FILTER_NAME , FILTER_SANITIZE_NUMBER_INT ) :
65
+ '0 '
66
+ );
67
+
68
68
echo ( new Select ( self ::FILTER_NAME , $ options , $ id ) )->render ();
69
69
}
70
70
}
@@ -84,15 +84,15 @@ public function execute_filter( \WP_Query $query ) {
84
84
$ id = filter_input ( INPUT_GET , self ::FILTER_NAME , FILTER_SANITIZE_NUMBER_INT );
85
85
$ blog = $ this ->collection ->get_object ( intval ( $ id ) );
86
86
87
- if ( $ blog ) {
88
- $ sql_cache = MslsSqlCacher::create ( __CLASS__ , __METHOD__ );
87
+ if ( ! $ blog ) {
88
+ return false ;
89
+ }
89
90
90
- // load post we need to exclude (they already have a translation) from search query
91
- $ query ->query_vars ['post__not_in ' ] = ( new TranslatedPostIdQuery ( $ sql_cache ) )( $ blog ->get_language () );
91
+ $ sql_cache = MslsSqlCacher::create ( __CLASS__ , __METHOD__ );
92
92
93
- return $ query;
94
- }
93
+ // load post we need to exclude (they already have a translation) from search query
94
+ $ query -> query_vars [ ' post__not_in ' ] = ( new TranslatedPostIdQuery ( $ sql_cache ) )( $ blog -> get_language () );
95
95
96
- return false ;
96
+ return $ query ;
97
97
}
98
98
}
0 commit comments