@@ -77,13 +77,13 @@ function metabox_render( $post ) {
77
77
78
78
$ hidden_posts = get_option ( 'unlist_posts ' , array () );
79
79
80
- if ( '' == $ hidden_posts ) {
80
+ if ( '' === $ hidden_posts ) {
81
81
$ hidden_posts = array ();
82
82
}
83
83
84
84
$ checked = '' ;
85
85
86
- if ( in_array ( $ post ->ID , $ hidden_posts ) ) {
86
+ if ( in_array ( $ post ->ID , $ hidden_posts, true ) ) {
87
87
$ checked = 'checked ' ;
88
88
}
89
89
@@ -129,7 +129,7 @@ public function save_meta( $post_id ) {
129
129
130
130
$ hidden_posts = get_option ( 'unlist_posts ' , array () );
131
131
132
- if ( '' == $ hidden_posts ) {
132
+ if ( '' === $ hidden_posts ) {
133
133
$ hidden_posts = array ();
134
134
}
135
135
@@ -138,12 +138,12 @@ public function save_meta( $post_id ) {
138
138
139
139
// Get only the unique post id's in the option array.
140
140
$ hidden_posts = array_unique ( $ hidden_posts );
141
- } elseif ( in_array ( $ post_id , $ hidden_posts ) ) {
141
+ } elseif ( in_array ( $ post_id , $ hidden_posts, true ) ) {
142
142
143
143
// Get only the unique post id's in the option array.
144
144
$ hidden_posts = array_unique ( $ hidden_posts );
145
145
146
- $ key = array_search ( $ post_id , $ hidden_posts );
146
+ $ key = array_search ( $ post_id , $ hidden_posts, true );
147
147
unset( $ hidden_posts [ $ key ] );
148
148
}
149
149
@@ -160,15 +160,15 @@ public function save_meta( $post_id ) {
160
160
*/
161
161
function add_unlisted_post_status ( $ states , $ post ) {
162
162
// Bail if the unlisted post filter is active, to avoid redundancy.
163
- if ( is_admin () && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' == $ _GET ['post_status ' ] ) {
163
+ if ( is_admin () && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' === $ _GET ['post_status ' ] ) {
164
164
return ;
165
165
}
166
166
167
167
// Get the list of unlisted post IDs from the options table.
168
168
$ unlisted_posts = maybe_unserialize ( get_option ( 'unlist_posts ' , array () ) );
169
169
170
170
// Check if this post is unlisted and mark it as so if appropriate.
171
- if ( in_array ( $ post ->ID , $ unlisted_posts ) ) {
171
+ if ( in_array ( $ post ->ID , $ unlisted_posts, true ) ) {
172
172
$ states [] = __ ( 'Unlisted ' , 'unlist-posts ' );
173
173
}
174
174
@@ -185,20 +185,20 @@ function add_unlisted_post_status( $states, $post ) {
185
185
function add_unlisted_post_filter ( $ views ) {
186
186
// Get the list of unlisted post IDs from the options table.
187
187
$ unlisted_posts = maybe_unserialize ( get_option ( 'unlist_posts ' , array () ) );
188
- $ count = false ;
188
+ $ count = false ;
189
189
190
190
// Mark 'Unlisted' filter as the current filter if it is.
191
191
$ link_attributes = '' ;
192
- if ( is_admin () && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' == $ _GET ['post_status ' ] ) {
192
+ if ( is_admin () && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' === $ _GET ['post_status ' ] ) {
193
193
$ link_attributes = 'class="current" aria-current="page" ' ;
194
194
}
195
195
196
196
if ( ! empty ( $ unlisted_posts ) ) {
197
197
$ post_type = get_current_screen ()->post_type ? get_current_screen ()->post_type : get_post_types ();
198
- $ query = new WP_Query (
198
+ $ query = new WP_Query (
199
199
array (
200
200
'post_type ' => $ post_type ,
201
- 'post__in ' => $ unlisted_posts
201
+ 'post__in ' => $ unlisted_posts,
202
202
)
203
203
);
204
204
@@ -207,12 +207,12 @@ function add_unlisted_post_filter( $views ) {
207
207
208
208
$ link = add_query_arg (
209
209
array (
210
- 'post_status ' => 'unlisted '
210
+ 'post_status ' => 'unlisted ' ,
211
211
)
212
212
);
213
213
214
214
if ( false !== $ count && 0 !== $ count ) {
215
- $ views ['unlisted ' ] = '<a href=" ' . esc_url ( $ link ) .' " ' . $ link_attributes . '> ' . __ ( 'Unlisted ' , 'unlist-posts ' ) . ' <span class="count">( ' . esc_html ( $ count ) . ')</span></a> ' ;
215
+ $ views ['unlisted ' ] = '<a href=" ' . esc_url ( $ link ) . ' " ' . $ link_attributes . '> ' . __ ( 'Unlisted ' , 'unlist-posts ' ) . ' <span class="count">( ' . esc_html ( $ count ) . ')</span></a> ' ;
216
216
}
217
217
218
218
return $ views ;
@@ -230,7 +230,7 @@ function add_post_filter() {
230
230
231
231
$ post_types = get_post_types ( $ args , 'names ' , 'and ' );
232
232
233
- foreach ( $ post_types as $ post_type ) {
233
+ foreach ( $ post_types as $ post_type ) {
234
234
add_filter ( 'views_edit- ' . $ post_type , array ( $ this , 'add_unlisted_post_filter ' ) );
235
235
}
236
236
}
@@ -245,7 +245,7 @@ function add_post_filter() {
245
245
function filter_unlisted_posts ( $ query ) {
246
246
global $ pagenow ;
247
247
248
- if ( is_admin () && 'edit.php ' == $ pagenow && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' == $ _GET ['post_status ' ] ) {
248
+ if ( is_admin () && 'edit.php ' === $ pagenow && isset ( $ _GET ['post_status ' ] ) && 'unlisted ' = == $ _GET ['post_status ' ] ) {
249
249
// Get the list of unlisted post IDs from the options table.
250
250
$ unlisted_posts = maybe_unserialize ( get_option ( 'unlist_posts ' , array () ) );
251
251
0 commit comments