@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | public function abspath() { |
61 | 61 | $folder = $this->find_folder(ABSPATH); |
62 | 62 | // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. |
63 | - if ( ! $folder && $this->is_dir( '/' . WPINC ) ) |
|
64 | - $folder = '/'; |
|
63 | + if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { |
|
64 | + $folder = '/'; |
|
65 | + } |
|
65 | 66 | return $folder; |
66 | 67 | } |
67 | 68 | |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | $theme_root = get_theme_root( $theme ); |
103 | 104 | |
104 | 105 | // Account for relative theme roots |
105 | - if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) |
|
106 | - $theme_root = WP_CONTENT_DIR . $theme_root; |
|
106 | + if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) { |
|
107 | + $theme_root = WP_CONTENT_DIR . $theme_root; |
|
108 | + } |
|
107 | 109 | |
108 | 110 | return $this->find_folder( $theme_root ); |
109 | 111 | } |
@@ -178,8 +180,9 @@ discard block |
||
178 | 180 | * @return string|false The location of the remote path, false on failure. |
179 | 181 | */ |
180 | 182 | public function find_folder( $folder ) { |
181 | - if ( isset( $this->cache[ $folder ] ) ) |
|
182 | - return $this->cache[ $folder ]; |
|
183 | + if ( isset( $this->cache[ $folder ] ) ) { |
|
184 | + return $this->cache[ $folder ]; |
|
185 | + } |
|
183 | 186 | |
184 | 187 | if ( stripos($this->method, 'ftp') !== false ) { |
185 | 188 | $constant_overrides = array( |
@@ -191,16 +194,19 @@ discard block |
||
191 | 194 | |
192 | 195 | // Direct matches ( folder = CONSTANT/ ) |
193 | 196 | foreach ( $constant_overrides as $constant => $dir ) { |
194 | - if ( ! defined( $constant ) ) |
|
195 | - continue; |
|
196 | - if ( $folder === $dir ) |
|
197 | - return trailingslashit( constant( $constant ) ); |
|
197 | + if ( ! defined( $constant ) ) { |
|
198 | + continue; |
|
199 | + } |
|
200 | + if ( $folder === $dir ) { |
|
201 | + return trailingslashit( constant( $constant ) ); |
|
202 | + } |
|
198 | 203 | } |
199 | 204 | |
200 | 205 | // Prefix Matches ( folder = CONSTANT/subdir ) |
201 | 206 | foreach ( $constant_overrides as $constant => $dir ) { |
202 | - if ( ! defined( $constant ) ) |
|
203 | - continue; |
|
207 | + if ( ! defined( $constant ) ) { |
|
208 | + continue; |
|
209 | + } |
|
204 | 210 | if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir |
205 | 211 | $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); |
206 | 212 | $potential_folder = trailingslashit( $potential_folder ); |
@@ -219,16 +225,18 @@ discard block |
||
219 | 225 | $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there. |
220 | 226 | $folder = str_replace('\\', '/', $folder); // Windows path sanitisation |
221 | 227 | |
222 | - if ( isset($this->cache[ $folder ] ) ) |
|
223 | - return $this->cache[ $folder ]; |
|
228 | + if ( isset($this->cache[ $folder ] ) ) { |
|
229 | + return $this->cache[ $folder ]; |
|
230 | + } |
|
224 | 231 | |
225 | 232 | if ( $this->exists($folder) ) { // Folder exists at that absolute path. |
226 | 233 | $folder = trailingslashit($folder); |
227 | 234 | $this->cache[ $folder ] = $folder; |
228 | 235 | return $folder; |
229 | 236 | } |
230 | - if ( $return = $this->search_for_folder($folder) ) |
|
231 | - $this->cache[ $folder ] = $return; |
|
237 | + if ( $return = $this->search_for_folder($folder) ) { |
|
238 | + $this->cache[ $folder ] = $return; |
|
239 | + } |
|
232 | 240 | return $return; |
233 | 241 | } |
234 | 242 | |
@@ -246,8 +254,9 @@ discard block |
||
246 | 254 | * @return string|false The location of the remote path, false to cease looping. |
247 | 255 | */ |
248 | 256 | public function search_for_folder( $folder, $base = '.', $loop = false ) { |
249 | - if ( empty( $base ) || '.' == $base ) |
|
250 | - $base = trailingslashit($this->cwd()); |
|
257 | + if ( empty( $base ) || '.' == $base ) { |
|
258 | + $base = trailingslashit($this->cwd()); |
|
259 | + } |
|
251 | 260 | |
252 | 261 | $folder = untrailingslashit($folder); |
253 | 262 | |
@@ -264,8 +273,10 @@ discard block |
||
264 | 273 | $files = $this->dirlist( $base ); |
265 | 274 | |
266 | 275 | foreach ( $folder_parts as $index => $key ) { |
267 | - if ( $index == $last_index ) |
|
268 | - continue; // We want this to be caught by the next code block. |
|
276 | + if ( $index == $last_index ) { |
|
277 | + continue; |
|
278 | + } |
|
279 | + // We want this to be caught by the next code block. |
|
269 | 280 | |
270 | 281 | /* |
271 | 282 | * Working from /home/ to /user/ to /wordpress/ see if that file exists within |
@@ -285,8 +296,9 @@ discard block |
||
285 | 296 | |
286 | 297 | // Only search for the remaining path tokens in the directory, not the full path again. |
287 | 298 | $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); |
288 | - if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) |
|
289 | - return $ret; |
|
299 | + if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) { |
|
300 | + return $ret; |
|
301 | + } |
|
290 | 302 | } |
291 | 303 | } |
292 | 304 | |
@@ -302,8 +314,9 @@ discard block |
||
302 | 314 | |
303 | 315 | // Prevent this function from looping again. |
304 | 316 | // No need to proceed if we've just searched in / |
305 | - if ( $loop || '/' == $base ) |
|
306 | - return false; |
|
317 | + if ( $loop || '/' == $base ) { |
|
318 | + return false; |
|
319 | + } |
|
307 | 320 | |
308 | 321 | // As an extra last resort, Change back to / if the folder wasn't found. |
309 | 322 | // This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... |
@@ -326,22 +339,31 @@ discard block |
||
326 | 339 | */ |
327 | 340 | public function gethchmod( $file ){ |
328 | 341 | $perms = intval( $this->getchmod( $file ), 8 ); |
329 | - if (($perms & 0xC000) == 0xC000) // Socket |
|
342 | + if (($perms & 0xC000) == 0xC000) { |
|
343 | + // Socket |
|
330 | 344 | $info = 's'; |
331 | - elseif (($perms & 0xA000) == 0xA000) // Symbolic Link |
|
345 | + } elseif (($perms & 0xA000) == 0xA000) { |
|
346 | + // Symbolic Link |
|
332 | 347 | $info = 'l'; |
333 | - elseif (($perms & 0x8000) == 0x8000) // Regular |
|
348 | + } elseif (($perms & 0x8000) == 0x8000) { |
|
349 | + // Regular |
|
334 | 350 | $info = '-'; |
335 | - elseif (($perms & 0x6000) == 0x6000) // Block special |
|
351 | + } elseif (($perms & 0x6000) == 0x6000) { |
|
352 | + // Block special |
|
336 | 353 | $info = 'b'; |
337 | - elseif (($perms & 0x4000) == 0x4000) // Directory |
|
354 | + } elseif (($perms & 0x4000) == 0x4000) { |
|
355 | + // Directory |
|
338 | 356 | $info = 'd'; |
339 | - elseif (($perms & 0x2000) == 0x2000) // Character special |
|
357 | + } elseif (($perms & 0x2000) == 0x2000) { |
|
358 | + // Character special |
|
340 | 359 | $info = 'c'; |
341 | - elseif (($perms & 0x1000) == 0x1000) // FIFO pipe |
|
360 | + } elseif (($perms & 0x1000) == 0x1000) { |
|
361 | + // FIFO pipe |
|
342 | 362 | $info = 'p'; |
343 | - else // Unknown |
|
363 | + } else { |
|
364 | + // Unknown |
|
344 | 365 | $info = 'u'; |
366 | + } |
|
345 | 367 | |
346 | 368 | // Owner |
347 | 369 | $info .= (($perms & 0x0100) ? 'r' : '-'); |
@@ -384,7 +384,7 @@ |
||
384 | 384 | * |
385 | 385 | * Converts '-rw-r--r--' to 0644 |
386 | 386 | * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod() |
387 | - * |
|
387 | + * |
|
388 | 388 | * @link https://secure.php.net/manual/en/function.chmod.php#49614 |
389 | 389 | * |
390 | 390 | * @access public |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @since 2.5.0 |
392 | 392 | * |
393 | 393 | * @param string $mode string The *nix-style file permission. |
394 | - * @return int octal representation |
|
394 | + * @return string octal representation |
|
395 | 395 | */ |
396 | 396 | public function getnumchmodfromh( $mode ) { |
397 | 397 | $realmode = ''; |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * @abstract |
467 | 467 | * |
468 | 468 | * @param string $file Name of the file to read. |
469 | - * @return mixed|bool Returns the read data or false on failure. |
|
469 | + * @return boolean Returns the read data or false on failure. |
|
470 | 470 | */ |
471 | 471 | public function get_contents( $file ) { |
472 | 472 | return false; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function abspath() { |
62 | 62 | $folder = $this->find_folder(ABSPATH); |
63 | 63 | // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. |
64 | - if ( ! $folder && $this->is_dir( '/' . WPINC ) ) |
|
64 | + if ( ! $folder && $this->is_dir('/'.WPINC)) |
|
65 | 65 | $folder = '/'; |
66 | 66 | return $folder; |
67 | 67 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | * @param string $theme The Theme stylesheet or template for the directory. |
100 | 100 | * @return string The location of the remote path. |
101 | 101 | */ |
102 | - public function wp_themes_dir( $theme = false ) { |
|
103 | - $theme_root = get_theme_root( $theme ); |
|
102 | + public function wp_themes_dir($theme = false) { |
|
103 | + $theme_root = get_theme_root($theme); |
|
104 | 104 | |
105 | 105 | // Account for relative theme roots |
106 | - if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) |
|
107 | - $theme_root = WP_CONTENT_DIR . $theme_root; |
|
106 | + if ('/themes' == $theme_root || ! is_dir($theme_root)) |
|
107 | + $theme_root = WP_CONTENT_DIR.$theme_root; |
|
108 | 108 | |
109 | - return $this->find_folder( $theme_root ); |
|
109 | + return $this->find_folder($theme_root); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * Default false. |
139 | 139 | * @return string The location of the remote path. |
140 | 140 | */ |
141 | - public function find_base_dir( $base = '.', $echo = false ) { |
|
142 | - _deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' ); |
|
141 | + public function find_base_dir($base = '.', $echo = false) { |
|
142 | + _deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()'); |
|
143 | 143 | $this->verbose = $echo; |
144 | 144 | return $this->abspath(); |
145 | 145 | } |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * @param bool $echo True to display debug information. |
161 | 161 | * @return string The location of the remote path. |
162 | 162 | */ |
163 | - public function get_base_dir( $base = '.', $echo = false ) { |
|
164 | - _deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' ); |
|
163 | + public function get_base_dir($base = '.', $echo = false) { |
|
164 | + _deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()'); |
|
165 | 165 | $this->verbose = $echo; |
166 | 166 | return $this->abspath(); |
167 | 167 | } |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | * @param string $folder the folder to locate. |
179 | 179 | * @return string|false The location of the remote path, false on failure. |
180 | 180 | */ |
181 | - public function find_folder( $folder ) { |
|
182 | - if ( isset( $this->cache[ $folder ] ) ) |
|
183 | - return $this->cache[ $folder ]; |
|
181 | + public function find_folder($folder) { |
|
182 | + if (isset($this->cache[$folder])) |
|
183 | + return $this->cache[$folder]; |
|
184 | 184 | |
185 | - if ( stripos($this->method, 'ftp') !== false ) { |
|
185 | + if (stripos($this->method, 'ftp') !== false) { |
|
186 | 186 | $constant_overrides = array( |
187 | 187 | 'FTP_BASE' => ABSPATH, |
188 | 188 | 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, |
@@ -191,28 +191,28 @@ discard block |
||
191 | 191 | ); |
192 | 192 | |
193 | 193 | // Direct matches ( folder = CONSTANT/ ) |
194 | - foreach ( $constant_overrides as $constant => $dir ) { |
|
195 | - if ( ! defined( $constant ) ) |
|
194 | + foreach ($constant_overrides as $constant => $dir) { |
|
195 | + if ( ! defined($constant)) |
|
196 | 196 | continue; |
197 | - if ( $folder === $dir ) |
|
198 | - return trailingslashit( constant( $constant ) ); |
|
197 | + if ($folder === $dir) |
|
198 | + return trailingslashit(constant($constant)); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // Prefix Matches ( folder = CONSTANT/subdir ) |
202 | - foreach ( $constant_overrides as $constant => $dir ) { |
|
203 | - if ( ! defined( $constant ) ) |
|
202 | + foreach ($constant_overrides as $constant => $dir) { |
|
203 | + if ( ! defined($constant)) |
|
204 | 204 | continue; |
205 | - if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir |
|
206 | - $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); |
|
207 | - $potential_folder = trailingslashit( $potential_folder ); |
|
205 | + if (0 === stripos($folder, $dir)) { // $folder starts with $dir |
|
206 | + $potential_folder = preg_replace('#^'.preg_quote($dir, '#').'/#i', trailingslashit(constant($constant)), $folder); |
|
207 | + $potential_folder = trailingslashit($potential_folder); |
|
208 | 208 | |
209 | - if ( $this->is_dir( $potential_folder ) ) { |
|
210 | - $this->cache[ $folder ] = $potential_folder; |
|
209 | + if ($this->is_dir($potential_folder)) { |
|
210 | + $this->cache[$folder] = $potential_folder; |
|
211 | 211 | return $potential_folder; |
212 | 212 | } |
213 | 213 | } |
214 | 214 | } |
215 | - } elseif ( 'direct' == $this->method ) { |
|
215 | + } elseif ('direct' == $this->method) { |
|
216 | 216 | $folder = str_replace('\\', '/', $folder); // Windows path sanitisation |
217 | 217 | return trailingslashit($folder); |
218 | 218 | } |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there. |
221 | 221 | $folder = str_replace('\\', '/', $folder); // Windows path sanitisation |
222 | 222 | |
223 | - if ( isset($this->cache[ $folder ] ) ) |
|
224 | - return $this->cache[ $folder ]; |
|
223 | + if (isset($this->cache[$folder])) |
|
224 | + return $this->cache[$folder]; |
|
225 | 225 | |
226 | - if ( $this->exists($folder) ) { // Folder exists at that absolute path. |
|
226 | + if ($this->exists($folder)) { // Folder exists at that absolute path. |
|
227 | 227 | $folder = trailingslashit($folder); |
228 | - $this->cache[ $folder ] = $folder; |
|
228 | + $this->cache[$folder] = $folder; |
|
229 | 229 | return $folder; |
230 | 230 | } |
231 | - if ( $return = $this->search_for_folder($folder) ) |
|
232 | - $this->cache[ $folder ] = $return; |
|
231 | + if ($return = $this->search_for_folder($folder)) |
|
232 | + $this->cache[$folder] = $return; |
|
233 | 233 | return $return; |
234 | 234 | } |
235 | 235 | |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | * @param bool $loop If the function has recursed, Internal use only. |
247 | 247 | * @return string|false The location of the remote path, false to cease looping. |
248 | 248 | */ |
249 | - public function search_for_folder( $folder, $base = '.', $loop = false ) { |
|
250 | - if ( empty( $base ) || '.' == $base ) |
|
249 | + public function search_for_folder($folder, $base = '.', $loop = false) { |
|
250 | + if (empty($base) || '.' == $base) |
|
251 | 251 | $base = trailingslashit($this->cwd()); |
252 | 252 | |
253 | 253 | $folder = untrailingslashit($folder); |
254 | 254 | |
255 | - if ( $this->verbose ) { |
|
255 | + if ($this->verbose) { |
|
256 | 256 | /* translators: 1: folder to locate, 2: folder to start searching from */ |
257 | - printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "<br/>\n", $folder, $base ); |
|
257 | + printf("\n".__('Looking for %1$s in %2$s')."<br/>\n", $folder, $base); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | $folder_parts = explode('/', $folder); |
261 | - $folder_part_keys = array_keys( $folder_parts ); |
|
262 | - $last_index = array_pop( $folder_part_keys ); |
|
263 | - $last_path = $folder_parts[ $last_index ]; |
|
261 | + $folder_part_keys = array_keys($folder_parts); |
|
262 | + $last_index = array_pop($folder_part_keys); |
|
263 | + $last_path = $folder_parts[$last_index]; |
|
264 | 264 | |
265 | - $files = $this->dirlist( $base ); |
|
265 | + $files = $this->dirlist($base); |
|
266 | 266 | |
267 | - foreach ( $folder_parts as $index => $key ) { |
|
268 | - if ( $index == $last_index ) |
|
267 | + foreach ($folder_parts as $index => $key) { |
|
268 | + if ($index == $last_index) |
|
269 | 269 | continue; // We want this to be caught by the next code block. |
270 | 270 | |
271 | 271 | /* |
@@ -275,40 +275,40 @@ discard block |
||
275 | 275 | * folder level, and see if that matches, and so on. If it reaches the end, and still |
276 | 276 | * cant find it, it'll return false for the entire function. |
277 | 277 | */ |
278 | - if ( isset($files[ $key ]) ){ |
|
278 | + if (isset($files[$key])) { |
|
279 | 279 | |
280 | 280 | // Let's try that folder: |
281 | 281 | $newdir = trailingslashit(path_join($base, $key)); |
282 | - if ( $this->verbose ) { |
|
282 | + if ($this->verbose) { |
|
283 | 283 | /* translators: %s: directory name */ |
284 | - printf( "\n" . __( 'Changing to %s' ) . "<br/>\n", $newdir ); |
|
284 | + printf("\n".__('Changing to %s')."<br/>\n", $newdir); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // Only search for the remaining path tokens in the directory, not the full path again. |
288 | - $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); |
|
289 | - if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) |
|
288 | + $newfolder = implode('/', array_slice($folder_parts, $index + 1)); |
|
289 | + if ($ret = $this->search_for_folder($newfolder, $newdir, $loop)) |
|
290 | 290 | return $ret; |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | 294 | // Only check this as a last resort, to prevent locating the incorrect install. |
295 | 295 | // All above procedures will fail quickly if this is the right branch to take. |
296 | - if (isset( $files[ $last_path ] ) ) { |
|
297 | - if ( $this->verbose ) { |
|
296 | + if (isset($files[$last_path])) { |
|
297 | + if ($this->verbose) { |
|
298 | 298 | /* translators: %s: directory name */ |
299 | - printf( "\n" . __( 'Found %s' ) . "<br/>\n", $base . $last_path ); |
|
299 | + printf("\n".__('Found %s')."<br/>\n", $base.$last_path); |
|
300 | 300 | } |
301 | - return trailingslashit($base . $last_path); |
|
301 | + return trailingslashit($base.$last_path); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | // Prevent this function from looping again. |
305 | 305 | // No need to proceed if we've just searched in / |
306 | - if ( $loop || '/' == $base ) |
|
306 | + if ($loop || '/' == $base) |
|
307 | 307 | return false; |
308 | 308 | |
309 | 309 | // As an extra last resort, Change back to / if the folder wasn't found. |
310 | 310 | // This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... |
311 | - return $this->search_for_folder( $folder, '/', true ); |
|
311 | + return $this->search_for_folder($folder, '/', true); |
|
312 | 312 | |
313 | 313 | } |
314 | 314 | |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | * @param string $file String filename. |
326 | 326 | * @return string The *nix-style representation of permissions. |
327 | 327 | */ |
328 | - public function gethchmod( $file ){ |
|
329 | - $perms = intval( $this->getchmod( $file ), 8 ); |
|
328 | + public function gethchmod($file) { |
|
329 | + $perms = intval($this->getchmod($file), 8); |
|
330 | 330 | if (($perms & 0xC000) == 0xC000) // Socket |
331 | 331 | $info = 's'; |
332 | 332 | elseif (($perms & 0xA000) == 0xA000) // Symbolic Link |
@@ -348,22 +348,19 @@ discard block |
||
348 | 348 | $info .= (($perms & 0x0100) ? 'r' : '-'); |
349 | 349 | $info .= (($perms & 0x0080) ? 'w' : '-'); |
350 | 350 | $info .= (($perms & 0x0040) ? |
351 | - (($perms & 0x0800) ? 's' : 'x' ) : |
|
352 | - (($perms & 0x0800) ? 'S' : '-')); |
|
351 | + (($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-')); |
|
353 | 352 | |
354 | 353 | // Group |
355 | 354 | $info .= (($perms & 0x0020) ? 'r' : '-'); |
356 | 355 | $info .= (($perms & 0x0010) ? 'w' : '-'); |
357 | 356 | $info .= (($perms & 0x0008) ? |
358 | - (($perms & 0x0400) ? 's' : 'x' ) : |
|
359 | - (($perms & 0x0400) ? 'S' : '-')); |
|
357 | + (($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-')); |
|
360 | 358 | |
361 | 359 | // World |
362 | 360 | $info .= (($perms & 0x0004) ? 'r' : '-'); |
363 | 361 | $info .= (($perms & 0x0002) ? 'w' : '-'); |
364 | 362 | $info .= (($perms & 0x0001) ? |
365 | - (($perms & 0x0200) ? 't' : 'x' ) : |
|
366 | - (($perms & 0x0200) ? 'T' : '-')); |
|
363 | + (($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-')); |
|
367 | 364 | return $info; |
368 | 365 | } |
369 | 366 | |
@@ -375,7 +372,7 @@ discard block |
||
375 | 372 | * @param string $file |
376 | 373 | * @return string the last 3 characters of the octal number |
377 | 374 | */ |
378 | - public function getchmod( $file ) { |
|
375 | + public function getchmod($file) { |
|
379 | 376 | return '777'; |
380 | 377 | } |
381 | 378 | |
@@ -393,12 +390,12 @@ discard block |
||
393 | 390 | * @param string $mode string The *nix-style file permission. |
394 | 391 | * @return int octal representation |
395 | 392 | */ |
396 | - public function getnumchmodfromh( $mode ) { |
|
393 | + public function getnumchmodfromh($mode) { |
|
397 | 394 | $realmode = ''; |
398 | - $legal = array('', 'w', 'r', 'x', '-'); |
|
395 | + $legal = array('', 'w', 'r', 'x', '-'); |
|
399 | 396 | $attarray = preg_split('//', $mode); |
400 | 397 | |
401 | - for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { |
|
398 | + for ($i = 0, $c = count($attarray); $i < $c; $i++) { |
|
402 | 399 | if ($key = array_search($attarray[$i], $legal)) { |
403 | 400 | $realmode .= $legal[$key]; |
404 | 401 | } |
@@ -406,7 +403,7 @@ discard block |
||
406 | 403 | |
407 | 404 | $mode = str_pad($realmode, 10, '-', STR_PAD_LEFT); |
408 | 405 | $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1'); |
409 | - $mode = strtr($mode,$trans); |
|
406 | + $mode = strtr($mode, $trans); |
|
410 | 407 | |
411 | 408 | $newmode = $mode[0]; |
412 | 409 | $newmode .= $mode[1] + $mode[2] + $mode[3]; |
@@ -424,8 +421,8 @@ discard block |
||
424 | 421 | * @param string $text String to test against. |
425 | 422 | * @return bool true if string is binary, false otherwise. |
426 | 423 | */ |
427 | - public function is_binary( $text ) { |
|
428 | - return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127) |
|
424 | + public function is_binary($text) { |
|
425 | + return (bool) preg_match('|[^\x20-\x7E]|', $text); // chr(32)..chr(127) |
|
429 | 426 | } |
430 | 427 | |
431 | 428 | /** |
@@ -441,7 +438,7 @@ discard block |
||
441 | 438 | * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. |
442 | 439 | * @return bool Returns true on success or false on failure. |
443 | 440 | */ |
444 | - public function chown( $file, $owner, $recursive = false ) { |
|
441 | + public function chown($file, $owner, $recursive = false) { |
|
445 | 442 | return false; |
446 | 443 | } |
447 | 444 | |
@@ -468,7 +465,7 @@ discard block |
||
468 | 465 | * @param string $file Name of the file to read. |
469 | 466 | * @return mixed|bool Returns the read data or false on failure. |
470 | 467 | */ |
471 | - public function get_contents( $file ) { |
|
468 | + public function get_contents($file) { |
|
472 | 469 | return false; |
473 | 470 | } |
474 | 471 | |
@@ -482,7 +479,7 @@ discard block |
||
482 | 479 | * @param string $file Path to the file. |
483 | 480 | * @return array|bool the file contents in an array or false on failure. |
484 | 481 | */ |
485 | - public function get_contents_array( $file ) { |
|
482 | + public function get_contents_array($file) { |
|
486 | 483 | return false; |
487 | 484 | } |
488 | 485 | |
@@ -498,7 +495,7 @@ discard block |
||
498 | 495 | * @param int $mode Optional. The file permissions as octal number, usually 0644. |
499 | 496 | * @return bool False on failure. |
500 | 497 | */ |
501 | - public function put_contents( $file, $contents, $mode = false ) { |
|
498 | + public function put_contents($file, $contents, $mode = false) { |
|
502 | 499 | return false; |
503 | 500 | } |
504 | 501 | |
@@ -525,7 +522,7 @@ discard block |
||
525 | 522 | * @param string $dir The new current directory. |
526 | 523 | * @return bool|string |
527 | 524 | */ |
528 | - public function chdir( $dir ) { |
|
525 | + public function chdir($dir) { |
|
529 | 526 | return false; |
530 | 527 | } |
531 | 528 | |
@@ -541,7 +538,7 @@ discard block |
||
541 | 538 | * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
542 | 539 | * @return bool|string |
543 | 540 | */ |
544 | - public function chgrp( $file, $group, $recursive = false ) { |
|
541 | + public function chgrp($file, $group, $recursive = false) { |
|
545 | 542 | return false; |
546 | 543 | } |
547 | 544 | |
@@ -557,7 +554,7 @@ discard block |
||
557 | 554 | * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
558 | 555 | * @return bool|string |
559 | 556 | */ |
560 | - public function chmod( $file, $mode = false, $recursive = false ) { |
|
557 | + public function chmod($file, $mode = false, $recursive = false) { |
|
561 | 558 | return false; |
562 | 559 | } |
563 | 560 | |
@@ -571,7 +568,7 @@ discard block |
||
571 | 568 | * @param string $file Path to the file. |
572 | 569 | * @return string|bool Username of the user or false on error. |
573 | 570 | */ |
574 | - public function owner( $file ) { |
|
571 | + public function owner($file) { |
|
575 | 572 | return false; |
576 | 573 | } |
577 | 574 | |
@@ -585,7 +582,7 @@ discard block |
||
585 | 582 | * @param string $file Path to the file. |
586 | 583 | * @return string|bool The group or false on error. |
587 | 584 | */ |
588 | - public function group( $file ) { |
|
585 | + public function group($file) { |
|
589 | 586 | return false; |
590 | 587 | } |
591 | 588 | |
@@ -604,7 +601,7 @@ discard block |
||
604 | 601 | * Default false. |
605 | 602 | * @return bool True if file copied successfully, False otherwise. |
606 | 603 | */ |
607 | - public function copy( $source, $destination, $overwrite = false, $mode = false ) { |
|
604 | + public function copy($source, $destination, $overwrite = false, $mode = false) { |
|
608 | 605 | return false; |
609 | 606 | } |
610 | 607 | |
@@ -621,7 +618,7 @@ discard block |
||
621 | 618 | * Default false. |
622 | 619 | * @return bool True if file copied successfully, False otherwise. |
623 | 620 | */ |
624 | - public function move( $source, $destination, $overwrite = false ) { |
|
621 | + public function move($source, $destination, $overwrite = false) { |
|
625 | 622 | return false; |
626 | 623 | } |
627 | 624 | |
@@ -639,7 +636,7 @@ discard block |
||
639 | 636 | * Default false. |
640 | 637 | * @return bool True if the file or directory was deleted, false on failure. |
641 | 638 | */ |
642 | - public function delete( $file, $recursive = false, $type = false ) { |
|
639 | + public function delete($file, $recursive = false, $type = false) { |
|
643 | 640 | return false; |
644 | 641 | } |
645 | 642 | |
@@ -653,7 +650,7 @@ discard block |
||
653 | 650 | * @param string $file Path to file/directory. |
654 | 651 | * @return bool Whether $file exists or not. |
655 | 652 | */ |
656 | - public function exists( $file ) { |
|
653 | + public function exists($file) { |
|
657 | 654 | return false; |
658 | 655 | } |
659 | 656 | |
@@ -667,7 +664,7 @@ discard block |
||
667 | 664 | * @param string $file File path. |
668 | 665 | * @return bool Whether $file is a file. |
669 | 666 | */ |
670 | - public function is_file( $file ) { |
|
667 | + public function is_file($file) { |
|
671 | 668 | return false; |
672 | 669 | } |
673 | 670 | |
@@ -681,7 +678,7 @@ discard block |
||
681 | 678 | * @param string $path Directory path. |
682 | 679 | * @return bool Whether $path is a directory. |
683 | 680 | */ |
684 | - public function is_dir( $path ) { |
|
681 | + public function is_dir($path) { |
|
685 | 682 | return false; |
686 | 683 | } |
687 | 684 | |
@@ -695,7 +692,7 @@ discard block |
||
695 | 692 | * @param string $file Path to file. |
696 | 693 | * @return bool Whether $file is readable. |
697 | 694 | */ |
698 | - public function is_readable( $file ) { |
|
695 | + public function is_readable($file) { |
|
699 | 696 | return false; |
700 | 697 | } |
701 | 698 | |
@@ -709,7 +706,7 @@ discard block |
||
709 | 706 | * @param string $file Path to file. |
710 | 707 | * @return bool Whether $file is writable. |
711 | 708 | */ |
712 | - public function is_writable( $file ) { |
|
709 | + public function is_writable($file) { |
|
713 | 710 | return false; |
714 | 711 | } |
715 | 712 | |
@@ -723,7 +720,7 @@ discard block |
||
723 | 720 | * @param string $file Path to file. |
724 | 721 | * @return int|bool Unix timestamp representing last access time. |
725 | 722 | */ |
726 | - public function atime( $file ) { |
|
723 | + public function atime($file) { |
|
727 | 724 | return false; |
728 | 725 | } |
729 | 726 | |
@@ -737,7 +734,7 @@ discard block |
||
737 | 734 | * @param string $file Path to file. |
738 | 735 | * @return int|bool Unix timestamp representing modification time. |
739 | 736 | */ |
740 | - public function mtime( $file ) { |
|
737 | + public function mtime($file) { |
|
741 | 738 | return false; |
742 | 739 | } |
743 | 740 | |
@@ -751,7 +748,7 @@ discard block |
||
751 | 748 | * @param string $file Path to file. |
752 | 749 | * @return int|bool Size of the file in bytes. |
753 | 750 | */ |
754 | - public function size( $file ) { |
|
751 | + public function size($file) { |
|
755 | 752 | return false; |
756 | 753 | } |
757 | 754 | |
@@ -771,7 +768,7 @@ discard block |
||
771 | 768 | * Default 0. |
772 | 769 | * @return bool Whether operation was successful or not. |
773 | 770 | */ |
774 | - public function touch( $file, $time = 0, $atime = 0 ) { |
|
771 | + public function touch($file, $time = 0, $atime = 0) { |
|
775 | 772 | return false; |
776 | 773 | } |
777 | 774 | |
@@ -791,7 +788,7 @@ discard block |
||
791 | 788 | * Default false. |
792 | 789 | * @return bool False if directory cannot be created, true otherwise. |
793 | 790 | */ |
794 | - public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { |
|
791 | + public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { |
|
795 | 792 | return false; |
796 | 793 | } |
797 | 794 | |
@@ -807,7 +804,7 @@ discard block |
||
807 | 804 | * Default false. |
808 | 805 | * @return bool Whether directory is deleted successfully or not. |
809 | 806 | */ |
810 | - public function rmdir( $path, $recursive = false ) { |
|
807 | + public function rmdir($path, $recursive = false) { |
|
811 | 808 | return false; |
812 | 809 | } |
813 | 810 | |
@@ -838,7 +835,7 @@ discard block |
||
838 | 835 | * @type mixed $files If a directory and $recursive is true, contains another array of files. |
839 | 836 | * } |
840 | 837 | */ |
841 | - public function dirlist( $path, $include_hidden = true, $recursive = false ) { |
|
838 | + public function dirlist($path, $include_hidden = true, $recursive = false) { |
|
842 | 839 | return false; |
843 | 840 | } |
844 | 841 |
@@ -11,32 +11,32 @@ discard block |
||
11 | 11 | // 0 = unused. Messages start at index 1. |
12 | 12 | $messages['_item'] = array( |
13 | 13 | 0 => '', |
14 | - 1 => __( 'Item added.' ), |
|
15 | - 2 => __( 'Item deleted.' ), |
|
16 | - 3 => __( 'Item updated.' ), |
|
17 | - 4 => __( 'Item not added.' ), |
|
18 | - 5 => __( 'Item not updated.' ), |
|
19 | - 6 => __( 'Items deleted.' ), |
|
14 | + 1 => __('Item added.'), |
|
15 | + 2 => __('Item deleted.'), |
|
16 | + 3 => __('Item updated.'), |
|
17 | + 4 => __('Item not added.'), |
|
18 | + 5 => __('Item not updated.'), |
|
19 | + 6 => __('Items deleted.'), |
|
20 | 20 | ); |
21 | 21 | |
22 | 22 | $messages['category'] = array( |
23 | 23 | 0 => '', |
24 | - 1 => __( 'Category added.' ), |
|
25 | - 2 => __( 'Category deleted.' ), |
|
26 | - 3 => __( 'Category updated.' ), |
|
27 | - 4 => __( 'Category not added.' ), |
|
28 | - 5 => __( 'Category not updated.' ), |
|
29 | - 6 => __( 'Categories deleted.' ), |
|
24 | + 1 => __('Category added.'), |
|
25 | + 2 => __('Category deleted.'), |
|
26 | + 3 => __('Category updated.'), |
|
27 | + 4 => __('Category not added.'), |
|
28 | + 5 => __('Category not updated.'), |
|
29 | + 6 => __('Categories deleted.'), |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | $messages['post_tag'] = array( |
33 | 33 | 0 => '', |
34 | - 1 => __( 'Tag added.' ), |
|
35 | - 2 => __( 'Tag deleted.' ), |
|
36 | - 3 => __( 'Tag updated.' ), |
|
37 | - 4 => __( 'Tag not added.' ), |
|
38 | - 5 => __( 'Tag not updated.' ), |
|
39 | - 6 => __( 'Tags deleted.' ), |
|
34 | + 1 => __('Tag added.'), |
|
35 | + 2 => __('Tag deleted.'), |
|
36 | + 3 => __('Tag updated.'), |
|
37 | + 4 => __('Tag not added.'), |
|
38 | + 5 => __('Tag not updated.'), |
|
39 | + 6 => __('Tags deleted.'), |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param array $messages The messages to be displayed. |
48 | 48 | */ |
49 | -$messages = apply_filters( 'term_updated_messages', $messages ); |
|
49 | +$messages = apply_filters('term_updated_messages', $messages); |
|
50 | 50 | |
51 | 51 | $message = false; |
52 | -if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { |
|
53 | - if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { |
|
54 | - $message = $messages[ $taxonomy ][ $msg ]; |
|
55 | - } elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) { |
|
56 | - $message = $messages['_item'][ $msg ]; |
|
52 | +if (isset($_REQUEST['message']) && ($msg = (int) $_REQUEST['message'])) { |
|
53 | + if (isset($messages[$taxonomy][$msg])) { |
|
54 | + $message = $messages[$taxonomy][$msg]; |
|
55 | + } elseif ( ! isset($messages[$taxonomy]) && isset($messages['_item'][$msg])) { |
|
56 | + $message = $messages['_item'][$msg]; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * @ignore |
60 | 60 | */ |
61 | -function is_admin() {return true;} |
|
61 | +function is_admin() {return true; } |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @ignore |
@@ -85,22 +85,22 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function wp_guess_url() {} |
87 | 87 | |
88 | -if ( ! function_exists( 'json_encode' ) ) : |
|
88 | +if ( ! function_exists('json_encode')) : |
|
89 | 89 | /** |
90 | 90 | * @ignore |
91 | 91 | */ |
92 | 92 | function json_encode() {} |
93 | 93 | endif; |
94 | 94 | |
95 | -function get_file( $path ) { |
|
95 | +function get_file($path) { |
|
96 | 96 | |
97 | - if ( function_exists('realpath') ) { |
|
98 | - $path = realpath( $path ); |
|
97 | + if (function_exists('realpath')) { |
|
98 | + $path = realpath($path); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( ! $path || ! @is_file( $path ) ) { |
|
101 | + if ( ! $path || ! @is_file($path)) { |
|
102 | 102 | return ''; |
103 | 103 | } |
104 | 104 | |
105 | - return @file_get_contents( $path ); |
|
105 | + return @file_get_contents($path); |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -150,8 +150,9 @@ discard block |
||
150 | 150 | $actions['delete'] = __( 'Delete Permanently' ); |
151 | 151 | } |
152 | 152 | |
153 | - if ( $this->detached ) |
|
154 | - $actions['attach'] = __( 'Attach' ); |
|
153 | + if ( $this->detached ) { |
|
154 | + $actions['attach'] = __( 'Attach' ); |
|
155 | + } |
|
155 | 156 | |
156 | 157 | return $actions; |
157 | 158 | } |
@@ -189,14 +190,17 @@ discard block |
||
189 | 190 | * @return string |
190 | 191 | */ |
191 | 192 | public function current_action() { |
192 | - if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
193 | - return 'attach'; |
|
193 | + if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) { |
|
194 | + return 'attach'; |
|
195 | + } |
|
194 | 196 | |
195 | - if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
196 | - return 'detach'; |
|
197 | + if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) { |
|
198 | + return 'detach'; |
|
199 | + } |
|
197 | 200 | |
198 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
199 | - return 'delete_all'; |
|
201 | + if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { |
|
202 | + return 'delete_all'; |
|
203 | + } |
|
200 | 204 | |
201 | 205 | return parent::current_action(); |
202 | 206 | } |
@@ -306,8 +310,9 @@ discard block |
||
306 | 310 | /* translators: column name */ |
307 | 311 | if ( !$this->detached ) { |
308 | 312 | $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); |
309 | - if ( post_type_supports( 'attachment', 'comments' ) ) |
|
310 | - $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
313 | + if ( post_type_supports( 'attachment', 'comments' ) ) { |
|
314 | + $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
315 | + } |
|
311 | 316 | } |
312 | 317 | /* translators: column name */ |
313 | 318 | $posts_columns['date'] = _x( 'Date', 'column name' ); |
@@ -692,8 +697,7 @@ discard block |
||
692 | 697 | __( 'Attach' ) |
693 | 698 | ); |
694 | 699 | } |
695 | - } |
|
696 | - else { |
|
700 | + } else { |
|
697 | 701 | if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) { |
698 | 702 | $actions['edit'] = sprintf( |
699 | 703 | '<a href="%s" aria-label="%s">%s</a>', |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param array $args An associative array of arguments. |
41 | 41 | */ |
42 | - public function __construct( $args = array() ) { |
|
43 | - $this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); |
|
42 | + public function __construct($args = array()) { |
|
43 | + $this->detached = (isset($_REQUEST['attachment-filter']) && 'detached' === $_REQUEST['attachment-filter']); |
|
44 | 44 | |
45 | 45 | $this->modes = array( |
46 | - 'list' => __( 'List View' ), |
|
47 | - 'grid' => __( 'Grid View' ) |
|
46 | + 'list' => __('List View'), |
|
47 | + 'grid' => __('Grid View') |
|
48 | 48 | ); |
49 | 49 | |
50 | - parent::__construct( array( |
|
50 | + parent::__construct(array( |
|
51 | 51 | 'plural' => 'media', |
52 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
53 | - ) ); |
|
52 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | public function prepare_items() { |
72 | 72 | global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; |
73 | 73 | |
74 | - list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); |
|
74 | + list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query($_REQUEST); |
|
75 | 75 | |
76 | - $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter']; |
|
76 | + $this->is_trash = isset($_REQUEST['attachment-filter']) && 'trash' === $_REQUEST['attachment-filter']; |
|
77 | 77 | |
78 | - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
78 | + $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode']; |
|
79 | 79 | |
80 | - $this->set_pagination_args( array( |
|
80 | + $this->set_pagination_args(array( |
|
81 | 81 | 'total_items' => $wp_query->found_posts, |
82 | 82 | 'total_pages' => $wp_query->max_num_pages, |
83 | 83 | 'per_page' => $wp_query->query_vars['posts_per_page'], |
84 | - ) ); |
|
84 | + )); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -94,40 +94,40 @@ discard block |
||
94 | 94 | |
95 | 95 | $type_links = array(); |
96 | 96 | |
97 | - $filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter']; |
|
97 | + $filter = empty($_GET['attachment-filter']) ? '' : $_GET['attachment-filter']; |
|
98 | 98 | |
99 | 99 | $type_links['all'] = sprintf( |
100 | 100 | '<option value=""%s>%s</option>', |
101 | - selected( $filter, true, false ), |
|
102 | - __( 'All media items' ) |
|
101 | + selected($filter, true, false), |
|
102 | + __('All media items') |
|
103 | 103 | ); |
104 | 104 | |
105 | - foreach ( $post_mime_types as $mime_type => $label ) { |
|
106 | - if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { |
|
105 | + foreach ($post_mime_types as $mime_type => $label) { |
|
106 | + if ( ! wp_match_mime_types($mime_type, $avail_post_mime_types)) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $selected = selected( |
111 | - $filter && 0 === strpos( $filter, 'post_mime_type:' ) && |
|
112 | - wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), |
|
111 | + $filter && 0 === strpos($filter, 'post_mime_type:') && |
|
112 | + wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $filter)), |
|
113 | 113 | true, |
114 | 114 | false |
115 | 115 | ); |
116 | 116 | |
117 | 117 | $type_links[$mime_type] = sprintf( |
118 | 118 | '<option value="post_mime_type:%s"%s>%s</option>', |
119 | - esc_attr( $mime_type ), |
|
119 | + esc_attr($mime_type), |
|
120 | 120 | $selected, |
121 | 121 | $label[0] |
122 | 122 | ); |
123 | 123 | } |
124 | - $type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . __( 'Unattached' ) . '</option>'; |
|
124 | + $type_links['detached'] = '<option value="detached"'.($this->detached ? ' selected="selected"' : '').'>'.__('Unattached').'</option>'; |
|
125 | 125 | |
126 | - if ( $this->is_trash || ( defined( 'MEDIA_TRASH') && MEDIA_TRASH ) ) { |
|
126 | + if ($this->is_trash || (defined('MEDIA_TRASH') && MEDIA_TRASH)) { |
|
127 | 127 | $type_links['trash'] = sprintf( |
128 | 128 | '<option value="trash"%s>%s</option>', |
129 | - selected( 'trash' === $filter, true, false ), |
|
130 | - _x( 'Trash', 'attachment filter' ) |
|
129 | + selected('trash' === $filter, true, false), |
|
130 | + _x('Trash', 'attachment filter') |
|
131 | 131 | ); |
132 | 132 | } |
133 | 133 | return $type_links; |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function get_bulk_actions() { |
141 | 141 | $actions = array(); |
142 | - if ( MEDIA_TRASH ) { |
|
143 | - if ( $this->is_trash ) { |
|
144 | - $actions['untrash'] = __( 'Restore' ); |
|
145 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
142 | + if (MEDIA_TRASH) { |
|
143 | + if ($this->is_trash) { |
|
144 | + $actions['untrash'] = __('Restore'); |
|
145 | + $actions['delete'] = __('Delete Permanently'); |
|
146 | 146 | } else { |
147 | - $actions['trash'] = _x( 'Trash', 'verb' ); |
|
147 | + $actions['trash'] = _x('Trash', 'verb'); |
|
148 | 148 | } |
149 | 149 | } else { |
150 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
150 | + $actions['delete'] = __('Delete Permanently'); |
|
151 | 151 | } |
152 | 152 | |
153 | - if ( $this->detached ) |
|
154 | - $actions['attach'] = __( 'Attach' ); |
|
153 | + if ($this->detached) |
|
154 | + $actions['attach'] = __('Attach'); |
|
155 | 155 | |
156 | 156 | return $actions; |
157 | 157 | } |
@@ -159,26 +159,26 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * @param string $which |
161 | 161 | */ |
162 | - protected function extra_tablenav( $which ) { |
|
163 | - if ( 'bar' !== $which ) { |
|
162 | + protected function extra_tablenav($which) { |
|
163 | + if ('bar' !== $which) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | <div class="actions"> |
168 | 168 | <?php |
169 | - if ( ! is_singular() ) { |
|
170 | - if ( ! $this->is_trash ) { |
|
171 | - $this->months_dropdown( 'attachment' ); |
|
169 | + if ( ! is_singular()) { |
|
170 | + if ( ! $this->is_trash) { |
|
171 | + $this->months_dropdown('attachment'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ |
175 | - do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); |
|
175 | + do_action('restrict_manage_posts', $this->screen->post_type, $which); |
|
176 | 176 | |
177 | - submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
|
177 | + submit_button(__('Filter'), '', 'filter_action', false, array('id' => 'post-query-submit')); |
|
178 | 178 | } |
179 | 179 | |
180 | - if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) { |
|
181 | - submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
|
180 | + if ($this->is_trash && current_user_can('edit_others_posts') && $this->has_items()) { |
|
181 | + submit_button(__('Empty Trash'), 'apply', 'delete_all', false); |
|
182 | 182 | } ?> |
183 | 183 | </div> |
184 | 184 | <?php |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @return string |
190 | 190 | */ |
191 | 191 | public function current_action() { |
192 | - if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
192 | + if (isset($_REQUEST['found_post_id']) && isset($_REQUEST['media'])) |
|
193 | 193 | return 'attach'; |
194 | 194 | |
195 | - if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
195 | + if (isset($_REQUEST['parent_post_id']) && isset($_REQUEST['media'])) |
|
196 | 196 | return 'detach'; |
197 | 197 | |
198 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
198 | + if (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) |
|
199 | 199 | return 'delete_all'; |
200 | 200 | |
201 | 201 | return parent::current_action(); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @access public |
214 | 214 | */ |
215 | 215 | public function no_items() { |
216 | - _e( 'No media files found.' ); |
|
216 | + _e('No media files found.'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | |
227 | 227 | $views = $this->get_views(); |
228 | 228 | |
229 | - $this->screen->render_screen_reader_content( 'heading_views' ); |
|
229 | + $this->screen->render_screen_reader_content('heading_views'); |
|
230 | 230 | ?> |
231 | 231 | <div class="wp-filter"> |
232 | 232 | <div class="filter-items"> |
233 | - <?php $this->view_switcher( $mode ); ?> |
|
233 | + <?php $this->view_switcher($mode); ?> |
|
234 | 234 | |
235 | - <label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label> |
|
235 | + <label for="attachment-filter" class="screen-reader-text"><?php _e('Filter by type'); ?></label> |
|
236 | 236 | <select class="attachment-filters" name="attachment-filter" id="attachment-filter"> |
237 | 237 | <?php |
238 | - if ( ! empty( $views ) ) { |
|
239 | - foreach ( $views as $class => $view ) { |
|
238 | + if ( ! empty($views)) { |
|
239 | + foreach ($views as $class => $view) { |
|
240 | 240 | echo "\t$view\n"; |
241 | 241 | } |
242 | 242 | } |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | </select> |
245 | 245 | |
246 | 246 | <?php |
247 | - $this->extra_tablenav( 'bar' ); |
|
247 | + $this->extra_tablenav('bar'); |
|
248 | 248 | |
249 | 249 | /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ |
250 | - $views = apply_filters( "views_{$this->screen->id}", array() ); |
|
250 | + $views = apply_filters("views_{$this->screen->id}", array()); |
|
251 | 251 | |
252 | 252 | // Back compat for pre-4.0 view links. |
253 | - if ( ! empty( $views ) ) { |
|
253 | + if ( ! empty($views)) { |
|
254 | 254 | echo '<ul class="filter-links">'; |
255 | - foreach ( $views as $class => $view ) { |
|
255 | + foreach ($views as $class => $view) { |
|
256 | 256 | echo "<li class='$class'>$view</li>"; |
257 | 257 | } |
258 | 258 | echo '</ul>'; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | </div> |
262 | 262 | |
263 | 263 | <div class="search-form"> |
264 | - <label for="media-search-input" class="screen-reader-text"><?php esc_html_e( 'Search Media' ); ?></label> |
|
265 | - <input type="search" placeholder="<?php esc_attr_e( 'Search media items...' ) ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div> |
|
264 | + <label for="media-search-input" class="screen-reader-text"><?php esc_html_e('Search Media'); ?></label> |
|
265 | + <input type="search" placeholder="<?php esc_attr_e('Search media items...') ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div> |
|
266 | 266 | </div> |
267 | 267 | <?php |
268 | 268 | } |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | $posts_columns = array(); |
276 | 276 | $posts_columns['cb'] = '<input type="checkbox" />'; |
277 | 277 | /* translators: column name */ |
278 | - $posts_columns['title'] = _x( 'File', 'column name' ); |
|
279 | - $posts_columns['author'] = __( 'Author' ); |
|
278 | + $posts_columns['title'] = _x('File', 'column name'); |
|
279 | + $posts_columns['author'] = __('Author'); |
|
280 | 280 | |
281 | - $taxonomies = get_taxonomies_for_attachments( 'objects' ); |
|
282 | - $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); |
|
281 | + $taxonomies = get_taxonomies_for_attachments('objects'); |
|
282 | + $taxonomies = wp_filter_object_list($taxonomies, array('show_admin_column' => true), 'and', 'name'); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Filters the taxonomy columns for attachments in the Media list table. |
@@ -289,28 +289,28 @@ discard block |
||
289 | 289 | * @param array $taxonomies An array of registered taxonomies to show for attachments. |
290 | 290 | * @param string $post_type The post type. Default 'attachment'. |
291 | 291 | */ |
292 | - $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); |
|
293 | - $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
|
292 | + $taxonomies = apply_filters('manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment'); |
|
293 | + $taxonomies = array_filter($taxonomies, 'taxonomy_exists'); |
|
294 | 294 | |
295 | - foreach ( $taxonomies as $taxonomy ) { |
|
296 | - if ( 'category' === $taxonomy ) { |
|
295 | + foreach ($taxonomies as $taxonomy) { |
|
296 | + if ('category' === $taxonomy) { |
|
297 | 297 | $column_key = 'categories'; |
298 | - } elseif ( 'post_tag' === $taxonomy ) { |
|
298 | + } elseif ('post_tag' === $taxonomy) { |
|
299 | 299 | $column_key = 'tags'; |
300 | 300 | } else { |
301 | - $column_key = 'taxonomy-' . $taxonomy; |
|
301 | + $column_key = 'taxonomy-'.$taxonomy; |
|
302 | 302 | } |
303 | - $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
|
303 | + $posts_columns[$column_key] = get_taxonomy($taxonomy)->labels->name; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /* translators: column name */ |
307 | - if ( !$this->detached ) { |
|
308 | - $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); |
|
309 | - if ( post_type_supports( 'attachment', 'comments' ) ) |
|
310 | - $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
307 | + if ( ! $this->detached) { |
|
308 | + $posts_columns['parent'] = _x('Uploaded to', 'column name'); |
|
309 | + if (post_type_supports('attachment', 'comments')) |
|
310 | + $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="'.esc_attr__('Comments').'"><span class="screen-reader-text">'.__('Comments').'</span></span>'; |
|
311 | 311 | } |
312 | 312 | /* translators: column name */ |
313 | - $posts_columns['date'] = _x( 'Date', 'column name' ); |
|
313 | + $posts_columns['date'] = _x('Date', 'column name'); |
|
314 | 314 | /** |
315 | 315 | * Filters the Media list table columns. |
316 | 316 | * |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param bool $detached Whether the list table contains media not attached |
321 | 321 | * to any posts. Default true. |
322 | 322 | */ |
323 | - return apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); |
|
323 | + return apply_filters('manage_media_columns', $posts_columns, $this->detached); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | 'author' => 'author', |
334 | 334 | 'parent' => 'parent', |
335 | 335 | 'comments' => 'comment_count', |
336 | - 'date' => array( 'date', true ), |
|
336 | + 'date' => array('date', true), |
|
337 | 337 | ); |
338 | 338 | } |
339 | 339 | |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @param WP_Post $post The current WP_Post object. |
347 | 347 | */ |
348 | - public function column_cb( $post ) { |
|
349 | - if ( current_user_can( 'edit_post', $post->ID ) ) { ?> |
|
348 | + public function column_cb($post) { |
|
349 | + if (current_user_can('edit_post', $post->ID)) { ?> |
|
350 | 350 | <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"><?php |
351 | - echo sprintf( __( 'Select %s' ), _draft_or_post_title() ); |
|
351 | + echo sprintf(__('Select %s'), _draft_or_post_title()); |
|
352 | 352 | ?></label> |
353 | 353 | <input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" /> |
354 | 354 | <?php } |
@@ -362,19 +362,19 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @param WP_Post $post The current WP_Post object. |
364 | 364 | */ |
365 | - public function column_title( $post ) { |
|
366 | - list( $mime ) = explode( '/', $post->post_mime_type ); |
|
365 | + public function column_title($post) { |
|
366 | + list($mime) = explode('/', $post->post_mime_type); |
|
367 | 367 | |
368 | 368 | $title = _draft_or_post_title(); |
369 | - $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); |
|
369 | + $thumb = wp_get_attachment_image($post->ID, array(60, 60), true, array('alt' => '')); |
|
370 | 370 | $link_start = $link_end = ''; |
371 | 371 | |
372 | - if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { |
|
372 | + if (current_user_can('edit_post', $post->ID) && ! $this->is_trash) { |
|
373 | 373 | $link_start = sprintf( |
374 | 374 | '<a href="%s" aria-label="%s">', |
375 | - get_edit_post_link( $post->ID ), |
|
375 | + get_edit_post_link($post->ID), |
|
376 | 376 | /* translators: %s: attachment title */ |
377 | - esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) |
|
377 | + esc_attr(sprintf(__('“%s” (Edit)'), $title)) |
|
378 | 378 | ); |
379 | 379 | $link_end = '</a>'; |
380 | 380 | } |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | <strong<?php echo $class; ?>> |
385 | 385 | <?php |
386 | 386 | echo $link_start; |
387 | - if ( $thumb ) : ?> |
|
388 | - <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span> |
|
387 | + if ($thumb) : ?> |
|
388 | + <span class="media-icon <?php echo sanitize_html_class($mime.'-icon'); ?>"><?php echo $thumb; ?></span> |
|
389 | 389 | <?php endif; |
390 | - echo $title . $link_end; |
|
391 | - _media_states( $post ); |
|
390 | + echo $title.$link_end; |
|
391 | + _media_states($post); |
|
392 | 392 | ?> |
393 | 393 | </strong> |
394 | 394 | <p class="filename"> |
395 | - <span class="screen-reader-text"><?php _e( 'File name:' ); ?> </span> |
|
395 | + <span class="screen-reader-text"><?php _e('File name:'); ?> </span> |
|
396 | 396 | <?php |
397 | - $file = get_attached_file( $post->ID ); |
|
398 | - echo esc_html( wp_basename( $file ) ); |
|
397 | + $file = get_attached_file($post->ID); |
|
398 | + echo esc_html(wp_basename($file)); |
|
399 | 399 | ?> |
400 | 400 | </p> |
401 | 401 | <?php |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @param WP_Post $post The current WP_Post object. |
411 | 411 | */ |
412 | - public function column_author( $post ) { |
|
413 | - printf( '<a href="%s">%s</a>', |
|
414 | - esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ), |
|
412 | + public function column_author($post) { |
|
413 | + printf('<a href="%s">%s</a>', |
|
414 | + esc_url(add_query_arg(array('author' => get_the_author_meta('ID')), 'upload.php')), |
|
415 | 415 | get_the_author() |
416 | 416 | ); |
417 | 417 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @param WP_Post $post The current WP_Post object. |
426 | 426 | */ |
427 | - public function column_desc( $post ) { |
|
427 | + public function column_desc($post) { |
|
428 | 428 | echo has_excerpt() ? $post->post_excerpt : ''; |
429 | 429 | } |
430 | 430 | |
@@ -436,20 +436,20 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @param WP_Post $post The current WP_Post object. |
438 | 438 | */ |
439 | - public function column_date( $post ) { |
|
440 | - if ( '0000-00-00 00:00:00' === $post->post_date ) { |
|
441 | - $h_time = __( 'Unpublished' ); |
|
439 | + public function column_date($post) { |
|
440 | + if ('0000-00-00 00:00:00' === $post->post_date) { |
|
441 | + $h_time = __('Unpublished'); |
|
442 | 442 | } else { |
443 | 443 | $m_time = $post->post_date; |
444 | - $time = get_post_time( 'G', true, $post, false ); |
|
445 | - if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) { |
|
446 | - if ( $t_diff < 0 ) { |
|
447 | - $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); |
|
444 | + $time = get_post_time('G', true, $post, false); |
|
445 | + if ((abs($t_diff = time() - $time)) < DAY_IN_SECONDS) { |
|
446 | + if ($t_diff < 0) { |
|
447 | + $h_time = sprintf(__('%s from now'), human_time_diff($time)); |
|
448 | 448 | } else { |
449 | - $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
|
449 | + $h_time = sprintf(__('%s ago'), human_time_diff($time)); |
|
450 | 450 | } |
451 | 451 | } else { |
452 | - $h_time = mysql2date( __( 'Y/m/d' ), $m_time ); |
|
452 | + $h_time = mysql2date(__('Y/m/d'), $m_time); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
@@ -464,54 +464,54 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param WP_Post $post The current WP_Post object. |
466 | 466 | */ |
467 | - public function column_parent( $post ) { |
|
468 | - $user_can_edit = current_user_can( 'edit_post', $post->ID ); |
|
467 | + public function column_parent($post) { |
|
468 | + $user_can_edit = current_user_can('edit_post', $post->ID); |
|
469 | 469 | |
470 | - if ( $post->post_parent > 0 ) { |
|
471 | - $parent = get_post( $post->post_parent ); |
|
470 | + if ($post->post_parent > 0) { |
|
471 | + $parent = get_post($post->post_parent); |
|
472 | 472 | } else { |
473 | 473 | $parent = false; |
474 | 474 | } |
475 | 475 | |
476 | - if ( $parent ) { |
|
477 | - $title = _draft_or_post_title( $post->post_parent ); |
|
478 | - $parent_type = get_post_type_object( $parent->post_type ); |
|
476 | + if ($parent) { |
|
477 | + $title = _draft_or_post_title($post->post_parent); |
|
478 | + $parent_type = get_post_type_object($parent->post_type); |
|
479 | 479 | |
480 | - if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { |
|
480 | + if ($parent_type && $parent_type->show_ui && current_user_can('edit_post', $post->post_parent)) { |
|
481 | 481 | ?> |
482 | - <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"> |
|
482 | + <strong><a href="<?php echo get_edit_post_link($post->post_parent); ?>"> |
|
483 | 483 | <?php echo $title ?></a></strong><?php |
484 | - } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) { |
|
484 | + } elseif ($parent_type && current_user_can('read_post', $post->post_parent)) { |
|
485 | 485 | ?> |
486 | 486 | <strong><?php echo $title ?></strong><?php |
487 | 487 | } else { |
488 | - _e( '(Private post)' ); |
|
488 | + _e('(Private post)'); |
|
489 | 489 | } |
490 | 490 | |
491 | - if ( $user_can_edit ): |
|
492 | - $detach_url = add_query_arg( array( |
|
491 | + if ($user_can_edit): |
|
492 | + $detach_url = add_query_arg(array( |
|
493 | 493 | 'parent_post_id' => $post->post_parent, |
494 | 494 | 'media[]' => $post->ID, |
495 | - '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ) |
|
496 | - ), 'upload.php' ); |
|
495 | + '_wpnonce' => wp_create_nonce('bulk-'.$this->_args['plural']) |
|
496 | + ), 'upload.php'); |
|
497 | 497 | printf( |
498 | 498 | '<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>', |
499 | 499 | $detach_url, |
500 | 500 | /* translators: %s: title of the post the attachment is attached to */ |
501 | - esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ), |
|
502 | - __( 'Detach' ) |
|
501 | + esc_attr(sprintf(__('Detach from “%s”'), $title)), |
|
502 | + __('Detach') |
|
503 | 503 | ); |
504 | 504 | endif; |
505 | 505 | } else { |
506 | - _e( '(Unattached)' ); ?> |
|
507 | - <?php if ( $user_can_edit ) { |
|
508 | - $title = _draft_or_post_title( $post->post_parent ); |
|
506 | + _e('(Unattached)'); ?> |
|
507 | + <?php if ($user_can_edit) { |
|
508 | + $title = _draft_or_post_title($post->post_parent); |
|
509 | 509 | printf( |
510 | 510 | '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>', |
511 | 511 | $post->ID, |
512 | 512 | /* translators: %s: attachment title */ |
513 | - esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ), |
|
514 | - __( 'Attach' ) |
|
513 | + esc_attr(sprintf(__('Attach “%s” to existing content'), $title)), |
|
514 | + __('Attach') |
|
515 | 515 | ); |
516 | 516 | } |
517 | 517 | } |
@@ -525,16 +525,16 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @param WP_Post $post The current WP_Post object. |
527 | 527 | */ |
528 | - public function column_comments( $post ) { |
|
528 | + public function column_comments($post) { |
|
529 | 529 | echo '<div class="post-com-count-wrapper">'; |
530 | 530 | |
531 | - if ( isset( $this->comment_pending_count[ $post->ID ] ) ) { |
|
532 | - $pending_comments = $this->comment_pending_count[ $post->ID ]; |
|
531 | + if (isset($this->comment_pending_count[$post->ID])) { |
|
532 | + $pending_comments = $this->comment_pending_count[$post->ID]; |
|
533 | 533 | } else { |
534 | - $pending_comments = get_pending_comments_num( $post->ID ); |
|
534 | + $pending_comments = get_pending_comments_num($post->ID); |
|
535 | 535 | } |
536 | 536 | |
537 | - $this->comments_bubble( $post->ID, $pending_comments ); |
|
537 | + $this->comments_bubble($post->ID, $pending_comments); |
|
538 | 538 | |
539 | 539 | echo '</div>'; |
540 | 540 | } |
@@ -548,35 +548,35 @@ discard block |
||
548 | 548 | * @param WP_Post $post The current WP_Post object. |
549 | 549 | * @param string $column_name Current column name. |
550 | 550 | */ |
551 | - public function column_default( $post, $column_name ) { |
|
552 | - if ( 'categories' === $column_name ) { |
|
551 | + public function column_default($post, $column_name) { |
|
552 | + if ('categories' === $column_name) { |
|
553 | 553 | $taxonomy = 'category'; |
554 | - } elseif ( 'tags' === $column_name ) { |
|
554 | + } elseif ('tags' === $column_name) { |
|
555 | 555 | $taxonomy = 'post_tag'; |
556 | - } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { |
|
557 | - $taxonomy = substr( $column_name, 9 ); |
|
556 | + } elseif (0 === strpos($column_name, 'taxonomy-')) { |
|
557 | + $taxonomy = substr($column_name, 9); |
|
558 | 558 | } else { |
559 | 559 | $taxonomy = false; |
560 | 560 | } |
561 | 561 | |
562 | - if ( $taxonomy ) { |
|
563 | - $terms = get_the_terms( $post->ID, $taxonomy ); |
|
564 | - if ( is_array( $terms ) ) { |
|
562 | + if ($taxonomy) { |
|
563 | + $terms = get_the_terms($post->ID, $taxonomy); |
|
564 | + if (is_array($terms)) { |
|
565 | 565 | $out = array(); |
566 | - foreach ( $terms as $t ) { |
|
566 | + foreach ($terms as $t) { |
|
567 | 567 | $posts_in_term_qv = array(); |
568 | 568 | $posts_in_term_qv['taxonomy'] = $taxonomy; |
569 | 569 | $posts_in_term_qv['term'] = $t->slug; |
570 | 570 | |
571 | - $out[] = sprintf( '<a href="%s">%s</a>', |
|
572 | - esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), |
|
573 | - esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) |
|
571 | + $out[] = sprintf('<a href="%s">%s</a>', |
|
572 | + esc_url(add_query_arg($posts_in_term_qv, 'upload.php')), |
|
573 | + esc_html(sanitize_term_field('name', $t->name, $t->term_id, $taxonomy, 'display')) |
|
574 | 574 | ); |
575 | 575 | } |
576 | 576 | /* translators: used between list items, there is a space after the comma */ |
577 | - echo join( __( ', ' ), $out ); |
|
577 | + echo join(__(', '), $out); |
|
578 | 578 | } else { |
579 | - echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>'; |
|
579 | + echo '<span aria-hidden="true">—</span><span class="screen-reader-text">'.get_taxonomy($taxonomy)->labels->no_terms.'</span>'; |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | return; |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * @param string $column_name Name of the custom column. |
593 | 593 | * @param int $post_id Attachment ID. |
594 | 594 | */ |
595 | - do_action( 'manage_media_custom_column', $column_name, $post->ID ); |
|
595 | + do_action('manage_media_custom_column', $column_name, $post->ID); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -602,24 +602,24 @@ discard block |
||
602 | 602 | public function display_rows() { |
603 | 603 | global $post, $wp_query; |
604 | 604 | |
605 | - $post_ids = wp_list_pluck( $wp_query->posts, 'ID' ); |
|
606 | - reset( $wp_query->posts ); |
|
605 | + $post_ids = wp_list_pluck($wp_query->posts, 'ID'); |
|
606 | + reset($wp_query->posts); |
|
607 | 607 | |
608 | - $this->comment_pending_count = get_pending_comments_num( $post_ids ); |
|
608 | + $this->comment_pending_count = get_pending_comments_num($post_ids); |
|
609 | 609 | |
610 | - add_filter( 'the_title','esc_html' ); |
|
610 | + add_filter('the_title', 'esc_html'); |
|
611 | 611 | |
612 | - while ( have_posts() ) : the_post(); |
|
612 | + while (have_posts()) : the_post(); |
|
613 | 613 | if ( |
614 | - ( $this->is_trash && $post->post_status != 'trash' ) |
|
615 | - || ( ! $this->is_trash && $post->post_status === 'trash' ) |
|
614 | + ($this->is_trash && $post->post_status != 'trash') |
|
615 | + || ( ! $this->is_trash && $post->post_status === 'trash') |
|
616 | 616 | ) { |
617 | 617 | continue; |
618 | 618 | } |
619 | - $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other'; |
|
619 | + $post_owner = (get_current_user_id() == $post->post_author) ? 'self' : 'other'; |
|
620 | 620 | ?> |
621 | - <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>"> |
|
622 | - <?php $this->single_row_columns( $post ); ?> |
|
621 | + <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim(' author-'.$post_owner.' status-'.$post->post_status); ?>"> |
|
622 | + <?php $this->single_row_columns($post); ?> |
|
623 | 623 | </tr> |
624 | 624 | <?php |
625 | 625 | endwhile; |
@@ -643,105 +643,105 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @return array |
645 | 645 | */ |
646 | - private function _get_row_actions( $post, $att_title ) { |
|
646 | + private function _get_row_actions($post, $att_title) { |
|
647 | 647 | $actions = array(); |
648 | 648 | |
649 | - if ( $this->detached ) { |
|
650 | - if ( current_user_can( 'edit_post', $post->ID ) ) { |
|
649 | + if ($this->detached) { |
|
650 | + if (current_user_can('edit_post', $post->ID)) { |
|
651 | 651 | $actions['edit'] = sprintf( |
652 | 652 | '<a href="%s" aria-label="%s">%s</a>', |
653 | - get_edit_post_link( $post->ID ), |
|
653 | + get_edit_post_link($post->ID), |
|
654 | 654 | /* translators: %s: attachment title */ |
655 | - esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), |
|
656 | - __( 'Edit' ) |
|
655 | + esc_attr(sprintf(__('Edit “%s”'), $att_title)), |
|
656 | + __('Edit') |
|
657 | 657 | ); |
658 | 658 | } |
659 | - if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
660 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
659 | + if (current_user_can('delete_post', $post->ID)) { |
|
660 | + if (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
661 | 661 | $actions['trash'] = sprintf( |
662 | 662 | '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>', |
663 | - wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), |
|
663 | + wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_'.$post->ID), |
|
664 | 664 | /* translators: %s: attachment title */ |
665 | - esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), |
|
666 | - _x( 'Trash', 'verb' ) |
|
665 | + esc_attr(sprintf(__('Move “%s” to the Trash'), $att_title)), |
|
666 | + _x('Trash', 'verb') |
|
667 | 667 | ); |
668 | 668 | } else { |
669 | 669 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
670 | 670 | $actions['delete'] = sprintf( |
671 | 671 | '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>', |
672 | - wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), |
|
672 | + wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_'.$post->ID), |
|
673 | 673 | $delete_ays, |
674 | 674 | /* translators: %s: attachment title */ |
675 | - esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), |
|
676 | - __( 'Delete Permanently' ) |
|
675 | + esc_attr(sprintf(__('Delete “%s” permanently'), $att_title)), |
|
676 | + __('Delete Permanently') |
|
677 | 677 | ); |
678 | 678 | } |
679 | 679 | } |
680 | 680 | $actions['view'] = sprintf( |
681 | 681 | '<a href="%s" aria-label="%s" rel="bookmark">%s</a>', |
682 | - get_permalink( $post->ID ), |
|
682 | + get_permalink($post->ID), |
|
683 | 683 | /* translators: %s: attachment title */ |
684 | - esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
|
685 | - __( 'View' ) |
|
684 | + esc_attr(sprintf(__('View “%s”'), $att_title)), |
|
685 | + __('View') |
|
686 | 686 | ); |
687 | 687 | |
688 | - if ( current_user_can( 'edit_post', $post->ID ) ) { |
|
688 | + if (current_user_can('edit_post', $post->ID)) { |
|
689 | 689 | $actions['attach'] = sprintf( |
690 | 690 | '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>', |
691 | 691 | $post->ID, |
692 | 692 | /* translators: %s: attachment title */ |
693 | - esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ), |
|
694 | - __( 'Attach' ) |
|
693 | + esc_attr(sprintf(__('Attach “%s” to existing content'), $att_title)), |
|
694 | + __('Attach') |
|
695 | 695 | ); |
696 | 696 | } |
697 | 697 | } |
698 | 698 | else { |
699 | - if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) { |
|
699 | + if (current_user_can('edit_post', $post->ID) && ! $this->is_trash) { |
|
700 | 700 | $actions['edit'] = sprintf( |
701 | 701 | '<a href="%s" aria-label="%s">%s</a>', |
702 | - get_edit_post_link( $post->ID ), |
|
702 | + get_edit_post_link($post->ID), |
|
703 | 703 | /* translators: %s: attachment title */ |
704 | - esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), |
|
705 | - __( 'Edit' ) |
|
704 | + esc_attr(sprintf(__('Edit “%s”'), $att_title)), |
|
705 | + __('Edit') |
|
706 | 706 | ); |
707 | 707 | } |
708 | - if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
709 | - if ( $this->is_trash ) { |
|
708 | + if (current_user_can('delete_post', $post->ID)) { |
|
709 | + if ($this->is_trash) { |
|
710 | 710 | $actions['untrash'] = sprintf( |
711 | 711 | '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>', |
712 | - wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ), |
|
712 | + wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_'.$post->ID), |
|
713 | 713 | /* translators: %s: attachment title */ |
714 | - esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ), |
|
715 | - __( 'Restore' ) |
|
714 | + esc_attr(sprintf(__('Restore “%s” from the Trash'), $att_title)), |
|
715 | + __('Restore') |
|
716 | 716 | ); |
717 | - } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
717 | + } elseif (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
718 | 718 | $actions['trash'] = sprintf( |
719 | 719 | '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>', |
720 | - wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), |
|
720 | + wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_'.$post->ID), |
|
721 | 721 | /* translators: %s: attachment title */ |
722 | - esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), |
|
723 | - _x( 'Trash', 'verb' ) |
|
722 | + esc_attr(sprintf(__('Move “%s” to the Trash'), $att_title)), |
|
723 | + _x('Trash', 'verb') |
|
724 | 724 | ); |
725 | 725 | } |
726 | - if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) { |
|
727 | - $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; |
|
726 | + if ($this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH) { |
|
727 | + $delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH) ? " onclick='return showNotice.warn();'" : ''; |
|
728 | 728 | $actions['delete'] = sprintf( |
729 | 729 | '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>', |
730 | - wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), |
|
730 | + wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_'.$post->ID), |
|
731 | 731 | $delete_ays, |
732 | 732 | /* translators: %s: attachment title */ |
733 | - esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), |
|
734 | - __( 'Delete Permanently' ) |
|
733 | + esc_attr(sprintf(__('Delete “%s” permanently'), $att_title)), |
|
734 | + __('Delete Permanently') |
|
735 | 735 | ); |
736 | 736 | } |
737 | 737 | } |
738 | - if ( ! $this->is_trash ) { |
|
738 | + if ( ! $this->is_trash) { |
|
739 | 739 | $actions['view'] = sprintf( |
740 | 740 | '<a href="%s" aria-label="%s" rel="bookmark">%s</a>', |
741 | - get_permalink( $post->ID ), |
|
741 | + get_permalink($post->ID), |
|
742 | 742 | /* translators: %s: attachment title */ |
743 | - esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
|
744 | - __( 'View' ) |
|
743 | + esc_attr(sprintf(__('View “%s”'), $att_title)), |
|
744 | + __('View') |
|
745 | 745 | ); |
746 | 746 | } |
747 | 747 | } |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * @param bool $detached Whether the list table contains media not attached |
758 | 758 | * to any posts. Default true. |
759 | 759 | */ |
760 | - return apply_filters( 'media_row_actions', $actions, $post, $this->detached ); |
|
760 | + return apply_filters('media_row_actions', $actions, $post, $this->detached); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
@@ -771,12 +771,12 @@ discard block |
||
771 | 771 | * @param string $primary Primary column name. |
772 | 772 | * @return string Row actions output for media attachments. |
773 | 773 | */ |
774 | - protected function handle_row_actions( $post, $column_name, $primary ) { |
|
775 | - if ( $primary !== $column_name ) { |
|
774 | + protected function handle_row_actions($post, $column_name, $primary) { |
|
775 | + if ($primary !== $column_name) { |
|
776 | 776 | return ''; |
777 | 777 | } |
778 | 778 | |
779 | 779 | $att_title = _draft_or_post_title(); |
780 | - return $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); |
|
780 | + return $this->row_actions($this->_get_row_actions($post, $att_title)); |
|
781 | 781 | } |
782 | 782 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | protected function get_column_info() { |
25 | 25 | return array( |
26 | 26 | array( |
27 | - 'author' => __( 'Author' ), |
|
28 | - 'comment' => _x( 'Comment', 'column name' ), |
|
27 | + 'author' => __('Author'), |
|
28 | + 'comment' => _x('Comment', 'column name'), |
|
29 | 29 | ), |
30 | 30 | array(), |
31 | 31 | array(), |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param bool $output_empty |
50 | 50 | */ |
51 | - public function display( $output_empty = false ) { |
|
51 | + public function display($output_empty = false) { |
|
52 | 52 | $singular = $this->_args['singular']; |
53 | 53 | |
54 | - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
54 | + wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce'); |
|
55 | 55 | ?> |
56 | -<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;"> |
|
56 | +<table class="<?php echo implode(' ', $this->get_table_classes()); ?>" style="display:none;"> |
|
57 | 57 | <tbody id="the-comment-list"<?php |
58 | - if ( $singular ) { |
|
58 | + if ($singular) { |
|
59 | 59 | echo " data-wp-lists='list:$singular'"; |
60 | 60 | } ?>> |
61 | - <?php if ( ! $output_empty ) { |
|
61 | + <?php if ( ! $output_empty) { |
|
62 | 62 | $this->display_rows_or_placeholder(); |
63 | 63 | } ?> |
64 | 64 | </tbody> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param bool $comment_status |
72 | 72 | * @return int |
73 | 73 | */ |
74 | - public function get_per_page( $comment_status = false ) { |
|
74 | + public function get_per_page($comment_status = false) { |
|
75 | 75 | return 10; |
76 | 76 | } |
77 | 77 | } |
@@ -39,11 +39,13 @@ discard block |
||
39 | 39 | ) ); |
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
43 | - $status = $_REQUEST['plugin_status']; |
|
42 | + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) { |
|
43 | + $status = $_REQUEST['plugin_status']; |
|
44 | + } |
|
44 | 45 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
46 | + if ( isset($_REQUEST['s']) ) { |
|
47 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
48 | + } |
|
47 | 49 | |
48 | 50 | $page = $this->get_pagenum(); |
49 | 51 | } |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | } |
124 | 126 | |
125 | 127 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
127 | - $plugins['dropins'] = get_dropins(); |
|
128 | + if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { |
|
129 | + $plugins['dropins'] = get_dropins(); |
|
130 | + } |
|
128 | 131 | |
129 | 132 | if ( current_user_can( 'update_plugins' ) ) { |
130 | 133 | $current = get_site_transient( 'update_plugins' ); |
@@ -232,11 +235,13 @@ discard block |
||
232 | 235 | } |
233 | 236 | |
234 | 237 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
238 | + foreach ( $plugins as $type => $list ) { |
|
239 | + $totals[ $type ] = count( $list ); |
|
240 | + } |
|
237 | 241 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
239 | - $status = 'all'; |
|
242 | + if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) { |
|
243 | + $status = 'all'; |
|
244 | + } |
|
240 | 245 | |
241 | 246 | $this->items = array(); |
242 | 247 | foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
@@ -260,8 +265,9 @@ discard block |
||
260 | 265 | |
261 | 266 | $start = ( $page - 1 ) * $plugins_per_page; |
262 | 267 | |
263 | - if ( $total_this_page > $plugins_per_page ) |
|
264 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
268 | + if ( $total_this_page > $plugins_per_page ) { |
|
269 | + $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
270 | + } |
|
265 | 271 | |
266 | 272 | $this->set_pagination_args( array( |
267 | 273 | 'total_items' => $total_this_page, |
@@ -300,8 +306,9 @@ discard block |
||
300 | 306 | $a = $plugin_a[$orderby]; |
301 | 307 | $b = $plugin_b[$orderby]; |
302 | 308 | |
303 | - if ( $a == $b ) |
|
304 | - return 0; |
|
309 | + if ( $a == $b ) { |
|
310 | + return 0; |
|
311 | + } |
|
305 | 312 | |
306 | 313 | if ( 'DESC' === $order ) { |
307 | 314 | return strcasecmp( $b, $a ); |
@@ -326,10 +333,11 @@ discard block |
||
326 | 333 | if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
327 | 334 | echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
328 | 335 | } |
329 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
330 | - _e( 'No plugins found.' ); |
|
331 | - else |
|
332 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
336 | + } elseif ( ! empty( $plugins['all'] ) ) { |
|
337 | + _e( 'No plugins found.' ); |
|
338 | + } else { |
|
339 | + _e( 'You do not appear to have any plugins available at this time.' ); |
|
340 | + } |
|
333 | 341 | } |
334 | 342 | |
335 | 343 | /** |
@@ -365,8 +373,9 @@ discard block |
||
365 | 373 | |
366 | 374 | $status_links = array(); |
367 | 375 | foreach ( $totals as $type => $count ) { |
368 | - if ( !$count ) |
|
369 | - continue; |
|
376 | + if ( !$count ) { |
|
377 | + continue; |
|
378 | + } |
|
370 | 379 | |
371 | 380 | switch ( $type ) { |
372 | 381 | case 'all': |
@@ -414,17 +423,21 @@ discard block |
||
414 | 423 | |
415 | 424 | $actions = array(); |
416 | 425 | |
417 | - if ( 'active' != $status ) |
|
418 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
426 | + if ( 'active' != $status ) { |
|
427 | + $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
428 | + } |
|
419 | 429 | |
420 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
421 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
430 | + if ( 'inactive' != $status && 'recent' != $status ) { |
|
431 | + $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
432 | + } |
|
422 | 433 | |
423 | 434 | if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
424 | - if ( current_user_can( 'update_plugins' ) ) |
|
425 | - $actions['update-selected'] = __( 'Update' ); |
|
426 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
427 | - $actions['delete-selected'] = __( 'Delete' ); |
|
435 | + if ( current_user_can( 'update_plugins' ) ) { |
|
436 | + $actions['update-selected'] = __( 'Update' ); |
|
437 | + } |
|
438 | + if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) { |
|
439 | + $actions['delete-selected'] = __( 'Delete' ); |
|
440 | + } |
|
428 | 441 | } |
429 | 442 | |
430 | 443 | return $actions; |
@@ -437,8 +450,9 @@ discard block |
||
437 | 450 | public function bulk_actions( $which = '' ) { |
438 | 451 | global $status; |
439 | 452 | |
440 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
441 | - return; |
|
453 | + if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
454 | + return; |
|
455 | + } |
|
442 | 456 | |
443 | 457 | parent::bulk_actions( $which ); |
444 | 458 | } |
@@ -450,8 +464,9 @@ discard block |
||
450 | 464 | protected function extra_tablenav( $which ) { |
451 | 465 | global $status; |
452 | 466 | |
453 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
454 | - return; |
|
467 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) { |
|
468 | + return; |
|
469 | + } |
|
455 | 470 | |
456 | 471 | echo '<div class="alignleft actions">'; |
457 | 472 | |
@@ -475,8 +490,9 @@ discard block |
||
475 | 490 | * @return string |
476 | 491 | */ |
477 | 492 | public function current_action() { |
478 | - if ( isset($_POST['clear-recent-list']) ) |
|
479 | - return 'clear-recent-list'; |
|
493 | + if ( isset($_POST['clear-recent-list']) ) { |
|
494 | + return 'clear-recent-list'; |
|
495 | + } |
|
480 | 496 | |
481 | 497 | return parent::current_action(); |
482 | 498 | } |
@@ -488,11 +504,13 @@ discard block |
||
488 | 504 | public function display_rows() { |
489 | 505 | global $status; |
490 | 506 | |
491 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
492 | - return; |
|
507 | + if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
508 | + return; |
|
509 | + } |
|
493 | 510 | |
494 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
495 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
511 | + foreach ( $this->items as $plugin_file => $plugin_data ) { |
|
512 | + $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
513 | + } |
|
496 | 514 | } |
497 | 515 | |
498 | 516 | /** |
@@ -528,8 +546,9 @@ discard block |
||
528 | 546 | } elseif ( 'dropins' === $context ) { |
529 | 547 | $dropins = _get_dropins(); |
530 | 548 | $plugin_name = $plugin_file; |
531 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
532 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
549 | + if ( $plugin_file != $plugin_data['Name'] ) { |
|
550 | + $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
551 | + } |
|
533 | 552 | if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
534 | 553 | $is_active = true; |
535 | 554 | $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
@@ -545,8 +564,9 @@ discard block |
||
545 | 564 | '<code>wp-config.php</code>' |
546 | 565 | ) . '</p>'; |
547 | 566 | } |
548 | - if ( $plugin_data['Description'] ) |
|
549 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
567 | + if ( $plugin_data['Description'] ) { |
|
568 | + $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
569 | + } |
|
550 | 570 | } else { |
551 | 571 | if ( $screen->in_admin( 'network' ) ) { |
552 | 572 | $is_active = is_plugin_active_for_network( $plugin_file ); |
@@ -696,8 +716,9 @@ discard block |
||
696 | 716 | $plugin_name = $plugin_data['Name']; |
697 | 717 | } |
698 | 718 | |
699 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
700 | - $class .= ' update'; |
|
719 | + if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { |
|
720 | + $class .= ' update'; |
|
721 | + } |
|
701 | 722 | |
702 | 723 | $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
703 | 724 | printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
@@ -731,12 +752,14 @@ discard block |
||
731 | 752 | <div class='$class second plugin-version-author-uri'>"; |
732 | 753 | |
733 | 754 | $plugin_meta = array(); |
734 | - if ( !empty( $plugin_data['Version'] ) ) |
|
735 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
755 | + if ( !empty( $plugin_data['Version'] ) ) { |
|
756 | + $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
757 | + } |
|
736 | 758 | if ( !empty( $plugin_data['Author'] ) ) { |
737 | 759 | $author = $plugin_data['Author']; |
738 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
739 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
760 | + if ( !empty( $plugin_data['AuthorURI'] ) ) { |
|
761 | + $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
762 | + } |
|
740 | 763 | $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
741 | 764 | } |
742 | 765 |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param array $args An associative array of arguments. |
32 | 32 | */ |
33 | - public function __construct( $args = array() ) { |
|
33 | + public function __construct($args = array()) { |
|
34 | 34 | global $status, $page; |
35 | 35 | |
36 | - parent::__construct( array( |
|
36 | + parent::__construct(array( |
|
37 | 37 | 'plural' => 'plugins', |
38 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
39 | - ) ); |
|
38 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
42 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search'))) |
|
43 | 43 | $status = $_REQUEST['plugin_status']; |
44 | 44 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
45 | + if (isset($_REQUEST['s'])) |
|
46 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s'])); |
|
47 | 47 | |
48 | 48 | $page = $this->get_pagenum(); |
49 | 49 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return array |
53 | 53 | */ |
54 | 54 | protected function get_table_classes() { |
55 | - return array( 'widefat', $this->_args['plural'] ); |
|
55 | + return array('widefat', $this->_args['plural']); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function prepare_items() { |
76 | 76 | global $status, $plugins, $totals, $page, $orderby, $order, $s; |
77 | 77 | |
78 | - wp_reset_vars( array( 'orderby', 'order' ) ); |
|
78 | + wp_reset_vars(array('orderby', 'order')); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Filters the full array of plugins to list in the Plugins list table. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param array $all_plugins An array of plugins to display in the list table. |
88 | 88 | */ |
89 | - $all_plugins = apply_filters( 'all_plugins', get_plugins() ); |
|
89 | + $all_plugins = apply_filters('all_plugins', get_plugins()); |
|
90 | 90 | |
91 | 91 | $plugins = array( |
92 | 92 | 'all' => $all_plugins, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $screen = $this->screen; |
103 | 103 | |
104 | - if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
|
104 | + if ( ! is_multisite() || ($screen->in_admin('network') && current_user_can('manage_network_plugins'))) { |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Filters whether to display the advanced plugins list table. |
@@ -118,27 +118,27 @@ discard block |
||
118 | 118 | * plugin type. Default true. |
119 | 119 | * @param string $type The plugin type. Accepts 'mustuse', 'dropins'. |
120 | 120 | */ |
121 | - if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { |
|
121 | + if (apply_filters('show_advanced_plugins', true, 'mustuse')) { |
|
122 | 122 | $plugins['mustuse'] = get_mu_plugins(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
126 | + if (apply_filters('show_advanced_plugins', true, 'dropins')) |
|
127 | 127 | $plugins['dropins'] = get_dropins(); |
128 | 128 | |
129 | - if ( current_user_can( 'update_plugins' ) ) { |
|
130 | - $current = get_site_transient( 'update_plugins' ); |
|
131 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
132 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
133 | - $plugins['all'][ $plugin_file ]['update'] = true; |
|
134 | - $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; |
|
129 | + if (current_user_can('update_plugins')) { |
|
130 | + $current = get_site_transient('update_plugins'); |
|
131 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
132 | + if (isset($current->response[$plugin_file])) { |
|
133 | + $plugins['all'][$plugin_file]['update'] = true; |
|
134 | + $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file]; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! $screen->in_admin( 'network' ) ) { |
|
141 | - $show = current_user_can( 'manage_network_plugins' ); |
|
140 | + if ( ! $screen->in_admin('network')) { |
|
141 | + $show = current_user_can('manage_network_plugins'); |
|
142 | 142 | /** |
143 | 143 | * Filters whether to display network-active plugins alongside plugins active for the current site. |
144 | 144 | * |
@@ -152,131 +152,131 @@ discard block |
||
152 | 152 | * @param bool $show Whether to show network-active plugins. Default is whether the current |
153 | 153 | * user can manage network plugins (ie. a Super Admin). |
154 | 154 | */ |
155 | - $show_network_active = apply_filters( 'show_network_active_plugins', $show ); |
|
155 | + $show_network_active = apply_filters('show_network_active_plugins', $show); |
|
156 | 156 | } |
157 | 157 | |
158 | - set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); |
|
158 | + set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS); |
|
159 | 159 | |
160 | - if ( $screen->in_admin( 'network' ) ) { |
|
161 | - $recently_activated = get_site_option( 'recently_activated', array() ); |
|
160 | + if ($screen->in_admin('network')) { |
|
161 | + $recently_activated = get_site_option('recently_activated', array()); |
|
162 | 162 | } else { |
163 | - $recently_activated = get_option( 'recently_activated', array() ); |
|
163 | + $recently_activated = get_option('recently_activated', array()); |
|
164 | 164 | } |
165 | 165 | |
166 | - foreach ( $recently_activated as $key => $time ) { |
|
167 | - if ( $time + WEEK_IN_SECONDS < time() ) { |
|
168 | - unset( $recently_activated[$key] ); |
|
166 | + foreach ($recently_activated as $key => $time) { |
|
167 | + if ($time + WEEK_IN_SECONDS < time()) { |
|
168 | + unset($recently_activated[$key]); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - if ( $screen->in_admin( 'network' ) ) { |
|
173 | - update_site_option( 'recently_activated', $recently_activated ); |
|
172 | + if ($screen->in_admin('network')) { |
|
173 | + update_site_option('recently_activated', $recently_activated); |
|
174 | 174 | } else { |
175 | - update_option( 'recently_activated', $recently_activated ); |
|
175 | + update_option('recently_activated', $recently_activated); |
|
176 | 176 | } |
177 | 177 | |
178 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
178 | + $plugin_info = get_site_transient('update_plugins'); |
|
179 | 179 | |
180 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
180 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
181 | 181 | // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide. |
182 | - if ( isset( $plugin_info->response[ $plugin_file ] ) ) { |
|
183 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
182 | + if (isset($plugin_info->response[$plugin_file])) { |
|
183 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
184 | 184 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
185 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
186 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
185 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
186 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
187 | 187 | } |
188 | 188 | |
189 | - } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { |
|
190 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
189 | + } elseif (isset($plugin_info->no_update[$plugin_file])) { |
|
190 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
191 | 191 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
192 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
193 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
192 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
193 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Filter into individual sections |
198 | - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { |
|
199 | - if ( $show_network_active ) { |
|
198 | + if (is_multisite() && ! $screen->in_admin('network') && is_network_only_plugin($plugin_file) && ! is_plugin_active($plugin_file)) { |
|
199 | + if ($show_network_active) { |
|
200 | 200 | // On the non-network screen, show inactive network-only plugins if allowed |
201 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
201 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
202 | 202 | } else { |
203 | 203 | // On the non-network screen, filter out network-only plugins as long as they're not individually active |
204 | - unset( $plugins['all'][ $plugin_file ] ); |
|
204 | + unset($plugins['all'][$plugin_file]); |
|
205 | 205 | } |
206 | - } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { |
|
207 | - if ( $show_network_active ) { |
|
206 | + } elseif ( ! $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) { |
|
207 | + if ($show_network_active) { |
|
208 | 208 | // On the non-network screen, show network-active plugins if allowed |
209 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
209 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
210 | 210 | } else { |
211 | 211 | // On the non-network screen, filter out network-active plugins |
212 | - unset( $plugins['all'][ $plugin_file ] ); |
|
212 | + unset($plugins['all'][$plugin_file]); |
|
213 | 213 | } |
214 | - } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) |
|
215 | - || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { |
|
214 | + } elseif (( ! $screen->in_admin('network') && is_plugin_active($plugin_file)) |
|
215 | + || ($screen->in_admin('network') && is_plugin_active_for_network($plugin_file))) { |
|
216 | 216 | // On the non-network screen, populate the active list with plugins that are individually activated |
217 | 217 | // On the network-admin screen, populate the active list with plugins that are network activated |
218 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
218 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
219 | 219 | } else { |
220 | - if ( isset( $recently_activated[ $plugin_file ] ) ) { |
|
220 | + if (isset($recently_activated[$plugin_file])) { |
|
221 | 221 | // Populate the recently activated list with plugins that have been recently activated |
222 | - $plugins['recently_activated'][ $plugin_file ] = $plugin_data; |
|
222 | + $plugins['recently_activated'][$plugin_file] = $plugin_data; |
|
223 | 223 | } |
224 | 224 | // Populate the inactive list with plugins that aren't activated |
225 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
225 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if ( strlen( $s ) ) { |
|
229 | + if (strlen($s)) { |
|
230 | 230 | $status = 'search'; |
231 | - $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); |
|
231 | + $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback')); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
235 | + foreach ($plugins as $type => $list) |
|
236 | + $totals[$type] = count($list); |
|
237 | 237 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
238 | + if (empty($plugins[$status]) && ! in_array($status, array('all', 'search'))) |
|
239 | 239 | $status = 'all'; |
240 | 240 | |
241 | 241 | $this->items = array(); |
242 | - foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
|
242 | + foreach ($plugins[$status] as $plugin_file => $plugin_data) { |
|
243 | 243 | // Translate, Don't Apply Markup, Sanitize HTML |
244 | - $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); |
|
244 | + $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
245 | 245 | } |
246 | 246 | |
247 | - $total_this_page = $totals[ $status ]; |
|
247 | + $total_this_page = $totals[$status]; |
|
248 | 248 | |
249 | 249 | $js_plugins = array(); |
250 | - foreach ( $plugins as $key => $list ) { |
|
251 | - $js_plugins[ $key ] = array_keys( (array) $list ); |
|
250 | + foreach ($plugins as $key => $list) { |
|
251 | + $js_plugins[$key] = array_keys((array) $list); |
|
252 | 252 | } |
253 | 253 | |
254 | - wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( |
|
254 | + wp_localize_script('updates', '_wpUpdatesItemCounts', array( |
|
255 | 255 | 'plugins' => $js_plugins, |
256 | 256 | 'totals' => wp_get_update_data(), |
257 | - ) ); |
|
257 | + )); |
|
258 | 258 | |
259 | - if ( ! $orderby ) { |
|
259 | + if ( ! $orderby) { |
|
260 | 260 | $orderby = 'Name'; |
261 | 261 | } else { |
262 | - $orderby = ucfirst( $orderby ); |
|
262 | + $orderby = ucfirst($orderby); |
|
263 | 263 | } |
264 | 264 | |
265 | - $order = strtoupper( $order ); |
|
265 | + $order = strtoupper($order); |
|
266 | 266 | |
267 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
267 | + uasort($this->items, array($this, '_order_callback')); |
|
268 | 268 | |
269 | - $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); |
|
269 | + $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id.'_per_page'), 999); |
|
270 | 270 | |
271 | - $start = ( $page - 1 ) * $plugins_per_page; |
|
271 | + $start = ($page - 1) * $plugins_per_page; |
|
272 | 272 | |
273 | - if ( $total_this_page > $plugins_per_page ) |
|
274 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
273 | + if ($total_this_page > $plugins_per_page) |
|
274 | + $this->items = array_slice($this->items, $start, $plugins_per_page); |
|
275 | 275 | |
276 | - $this->set_pagination_args( array( |
|
276 | + $this->set_pagination_args(array( |
|
277 | 277 | 'total_items' => $total_this_page, |
278 | 278 | 'per_page' => $plugins_per_page, |
279 | - ) ); |
|
279 | + )); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | * @param array $plugin |
286 | 286 | * @return bool |
287 | 287 | */ |
288 | - public function _search_callback( $plugin ) { |
|
288 | + public function _search_callback($plugin) { |
|
289 | 289 | global $s; |
290 | 290 | |
291 | - foreach ( $plugin as $value ) { |
|
292 | - if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { |
|
291 | + foreach ($plugin as $value) { |
|
292 | + if (is_string($value) && false !== stripos(strip_tags($value), urldecode($s))) { |
|
293 | 293 | return true; |
294 | 294 | } |
295 | 295 | } |
@@ -304,19 +304,19 @@ discard block |
||
304 | 304 | * @param array $plugin_b |
305 | 305 | * @return int |
306 | 306 | */ |
307 | - public function _order_callback( $plugin_a, $plugin_b ) { |
|
307 | + public function _order_callback($plugin_a, $plugin_b) { |
|
308 | 308 | global $orderby, $order; |
309 | 309 | |
310 | 310 | $a = $plugin_a[$orderby]; |
311 | 311 | $b = $plugin_b[$orderby]; |
312 | 312 | |
313 | - if ( $a == $b ) |
|
313 | + if ($a == $b) |
|
314 | 314 | return 0; |
315 | 315 | |
316 | - if ( 'DESC' === $order ) { |
|
317 | - return strcasecmp( $b, $a ); |
|
316 | + if ('DESC' === $order) { |
|
317 | + return strcasecmp($b, $a); |
|
318 | 318 | } else { |
319 | - return strcasecmp( $a, $b ); |
|
319 | + return strcasecmp($a, $b); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -327,19 +327,19 @@ discard block |
||
327 | 327 | public function no_items() { |
328 | 328 | global $plugins; |
329 | 329 | |
330 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
331 | - $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); |
|
330 | + if ( ! empty($_REQUEST['s'])) { |
|
331 | + $s = esc_html(wp_unslash($_REQUEST['s'])); |
|
332 | 332 | |
333 | - printf( __( 'No plugins found for “%s”.' ), $s ); |
|
333 | + printf(__('No plugins found for “%s”.'), $s); |
|
334 | 334 | |
335 | 335 | // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link. |
336 | - if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
337 | - echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
|
336 | + if ( ! is_multisite() && current_user_can('install_plugins')) { |
|
337 | + echo ' <a href="'.esc_url(admin_url('plugin-install.php?tab=search&s='.urlencode($s))).'">'.__('Search for plugins in the WordPress Plugin Directory.').'</a>'; |
|
338 | 338 | } |
339 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
340 | - _e( 'No plugins found.' ); |
|
339 | + } elseif ( ! empty($plugins['all'])) |
|
340 | + _e('No plugins found.'); |
|
341 | 341 | else |
342 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
342 | + _e('You do not appear to have any plugins available at this time.'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -351,24 +351,24 @@ discard block |
||
351 | 351 | * @param string $text The 'submit' button label. |
352 | 352 | * @param string $input_id ID attribute value for the search input field. |
353 | 353 | */ |
354 | - public function search_box( $text, $input_id ) { |
|
355 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
354 | + public function search_box($text, $input_id) { |
|
355 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
356 | 356 | return; |
357 | 357 | } |
358 | 358 | |
359 | - $input_id = $input_id . '-search-input'; |
|
359 | + $input_id = $input_id.'-search-input'; |
|
360 | 360 | |
361 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
362 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
361 | + if ( ! empty($_REQUEST['orderby'])) { |
|
362 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
363 | 363 | } |
364 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
365 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
364 | + if ( ! empty($_REQUEST['order'])) { |
|
365 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
366 | 366 | } |
367 | 367 | ?> |
368 | 368 | <p class="search-box"> |
369 | - <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label> |
|
370 | - <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/> |
|
371 | - <?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?> |
|
369 | + <label class="screen-reader-text" for="<?php echo esc_attr($input_id); ?>"><?php echo $text; ?>:</label> |
|
370 | + <input type="search" id="<?php echo esc_attr($input_id); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e('Search installed plugins...'); ?>"/> |
|
371 | + <?php submit_button($text, 'hide-if-js', '', false, array('id' => 'search-submit')); ?> |
|
372 | 372 | </p> |
373 | 373 | <?php |
374 | 374 | } |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | global $status; |
383 | 383 | |
384 | 384 | return array( |
385 | - 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
|
386 | - 'name' => __( 'Plugin' ), |
|
387 | - 'description' => __( 'Description' ), |
|
385 | + 'cb' => ! in_array($status, array('mustuse', 'dropins')) ? '<input type="checkbox" />' : '', |
|
386 | + 'name' => __('Plugin'), |
|
387 | + 'description' => __('Description'), |
|
388 | 388 | ); |
389 | 389 | } |
390 | 390 | |
@@ -405,39 +405,39 @@ discard block |
||
405 | 405 | global $totals, $status; |
406 | 406 | |
407 | 407 | $status_links = array(); |
408 | - foreach ( $totals as $type => $count ) { |
|
409 | - if ( !$count ) |
|
408 | + foreach ($totals as $type => $count) { |
|
409 | + if ( ! $count) |
|
410 | 410 | continue; |
411 | 411 | |
412 | - switch ( $type ) { |
|
412 | + switch ($type) { |
|
413 | 413 | case 'all': |
414 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' ); |
|
414 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins'); |
|
415 | 415 | break; |
416 | 416 | case 'active': |
417 | - $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count ); |
|
417 | + $text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count); |
|
418 | 418 | break; |
419 | 419 | case 'recently_activated': |
420 | - $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count ); |
|
420 | + $text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count); |
|
421 | 421 | break; |
422 | 422 | case 'inactive': |
423 | - $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); |
|
423 | + $text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count); |
|
424 | 424 | break; |
425 | 425 | case 'mustuse': |
426 | - $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count ); |
|
426 | + $text = _n('Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count); |
|
427 | 427 | break; |
428 | 428 | case 'dropins': |
429 | - $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); |
|
429 | + $text = _n('Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count); |
|
430 | 430 | break; |
431 | 431 | case 'upgrade': |
432 | - $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count ); |
|
432 | + $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count); |
|
433 | 433 | break; |
434 | 434 | } |
435 | 435 | |
436 | - if ( 'search' !== $type ) { |
|
437 | - $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", |
|
436 | + if ('search' !== $type) { |
|
437 | + $status_links[$type] = sprintf("<a href='%s' %s>%s</a>", |
|
438 | 438 | add_query_arg('plugin_status', $type, 'plugins.php'), |
439 | - ( $type === $status ) ? ' class="current"' : '', |
|
440 | - sprintf( $text, number_format_i18n( $count ) ) |
|
439 | + ($type === $status) ? ' class="current"' : '', |
|
440 | + sprintf($text, number_format_i18n($count)) |
|
441 | 441 | ); |
442 | 442 | } |
443 | 443 | } |
@@ -455,17 +455,17 @@ discard block |
||
455 | 455 | |
456 | 456 | $actions = array(); |
457 | 457 | |
458 | - if ( 'active' != $status ) |
|
459 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
458 | + if ('active' != $status) |
|
459 | + $actions['activate-selected'] = $this->screen->in_admin('network') ? __('Network Activate') : __('Activate'); |
|
460 | 460 | |
461 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
462 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
461 | + if ('inactive' != $status && 'recent' != $status) |
|
462 | + $actions['deactivate-selected'] = $this->screen->in_admin('network') ? __('Network Deactivate') : __('Deactivate'); |
|
463 | 463 | |
464 | - if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
|
465 | - if ( current_user_can( 'update_plugins' ) ) |
|
466 | - $actions['update-selected'] = __( 'Update' ); |
|
467 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
468 | - $actions['delete-selected'] = __( 'Delete' ); |
|
464 | + if ( ! is_multisite() || $this->screen->in_admin('network')) { |
|
465 | + if (current_user_can('update_plugins')) |
|
466 | + $actions['update-selected'] = __('Update'); |
|
467 | + if (current_user_can('delete_plugins') && ('active' != $status)) |
|
468 | + $actions['delete-selected'] = __('Delete'); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | return $actions; |
@@ -475,39 +475,39 @@ discard block |
||
475 | 475 | * @global string $status |
476 | 476 | * @param string $which |
477 | 477 | */ |
478 | - public function bulk_actions( $which = '' ) { |
|
478 | + public function bulk_actions($which = '') { |
|
479 | 479 | global $status; |
480 | 480 | |
481 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
481 | + if (in_array($status, array('mustuse', 'dropins'))) |
|
482 | 482 | return; |
483 | 483 | |
484 | - parent::bulk_actions( $which ); |
|
484 | + parent::bulk_actions($which); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
488 | 488 | * @global string $status |
489 | 489 | * @param string $which |
490 | 490 | */ |
491 | - protected function extra_tablenav( $which ) { |
|
491 | + protected function extra_tablenav($which) { |
|
492 | 492 | global $status; |
493 | 493 | |
494 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
494 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins'))) |
|
495 | 495 | return; |
496 | 496 | |
497 | 497 | echo '<div class="alignleft actions">'; |
498 | 498 | |
499 | - if ( 'recently_activated' == $status ) { |
|
500 | - submit_button( __( 'Clear List' ), '', 'clear-recent-list', false ); |
|
501 | - } elseif ( 'top' === $which && 'mustuse' === $status ) { |
|
499 | + if ('recently_activated' == $status) { |
|
500 | + submit_button(__('Clear List'), '', 'clear-recent-list', false); |
|
501 | + } elseif ('top' === $which && 'mustuse' === $status) { |
|
502 | 502 | /* translators: %s: mu-plugins directory name */ |
503 | - echo '<p>' . sprintf( __( 'Files in the %s directory are executed automatically.' ), |
|
504 | - '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>' |
|
505 | - ) . '</p>'; |
|
506 | - } elseif ( 'top' === $which && 'dropins' === $status ) { |
|
503 | + echo '<p>'.sprintf(__('Files in the %s directory are executed automatically.'), |
|
504 | + '<code>'.str_replace(ABSPATH, '/', WPMU_PLUGIN_DIR).'</code>' |
|
505 | + ).'</p>'; |
|
506 | + } elseif ('top' === $which && 'dropins' === $status) { |
|
507 | 507 | /* translators: %s: wp-content directory name */ |
508 | - echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ), |
|
509 | - '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>' |
|
510 | - ) . '</p>'; |
|
508 | + echo '<p>'.sprintf(__('Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.'), |
|
509 | + '<code>'.str_replace(ABSPATH, '', WP_CONTENT_DIR).'</code>' |
|
510 | + ).'</p>'; |
|
511 | 511 | } |
512 | 512 | echo '</div>'; |
513 | 513 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @return string |
517 | 517 | */ |
518 | 518 | public function current_action() { |
519 | - if ( isset($_POST['clear-recent-list']) ) |
|
519 | + if (isset($_POST['clear-recent-list'])) |
|
520 | 520 | return 'clear-recent-list'; |
521 | 521 | |
522 | 522 | return parent::current_action(); |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | public function display_rows() { |
530 | 530 | global $status; |
531 | 531 | |
532 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
532 | + if (is_multisite() && ! $this->screen->in_admin('network') && in_array($status, array('mustuse', 'dropins'))) |
|
533 | 533 | return; |
534 | 534 | |
535 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
536 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
535 | + foreach ($this->items as $plugin_file => $plugin_data) |
|
536 | + $this->single_row(array($plugin_file, $plugin_data)); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @param array $item |
546 | 546 | */ |
547 | - public function single_row( $item ) { |
|
547 | + public function single_row($item) { |
|
548 | 548 | global $status, $page, $s, $totals; |
549 | 549 | |
550 | - list( $plugin_file, $plugin_data ) = $item; |
|
550 | + list($plugin_file, $plugin_data) = $item; |
|
551 | 551 | $context = $status; |
552 | 552 | $screen = $this->screen; |
553 | 553 | |
@@ -564,88 +564,88 @@ discard block |
||
564 | 564 | $restrict_network_active = false; |
565 | 565 | $restrict_network_only = false; |
566 | 566 | |
567 | - if ( 'mustuse' === $context ) { |
|
567 | + if ('mustuse' === $context) { |
|
568 | 568 | $is_active = true; |
569 | - } elseif ( 'dropins' === $context ) { |
|
569 | + } elseif ('dropins' === $context) { |
|
570 | 570 | $dropins = _get_dropins(); |
571 | 571 | $plugin_name = $plugin_file; |
572 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
573 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
574 | - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
|
572 | + if ($plugin_file != $plugin_data['Name']) |
|
573 | + $plugin_name .= '<br/>'.$plugin_data['Name']; |
|
574 | + if (true === ($dropins[$plugin_file][1])) { // Doesn't require a constant |
|
575 | 575 | $is_active = true; |
576 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
577 | - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
|
576 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
577 | + } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) { // Constant is true |
|
578 | 578 | $is_active = true; |
579 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
579 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
580 | 580 | } else { |
581 | 581 | $is_active = false; |
582 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' . |
|
582 | + $description = '<p><strong>'.$dropins[$plugin_file][0].' <span class="error-message">'.__('Inactive:').'</span></strong> '. |
|
583 | 583 | /* translators: 1: drop-in constant name, 2: wp-config.php */ |
584 | - sprintf( __( 'Requires %1$s in %2$s file.' ), |
|
585 | - "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>", |
|
584 | + sprintf(__('Requires %1$s in %2$s file.'), |
|
585 | + "<code>define('".$dropins[$plugin_file][1]."', true);</code>", |
|
586 | 586 | '<code>wp-config.php</code>' |
587 | - ) . '</p>'; |
|
587 | + ).'</p>'; |
|
588 | 588 | } |
589 | - if ( $plugin_data['Description'] ) |
|
590 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
589 | + if ($plugin_data['Description']) |
|
590 | + $description .= '<p>'.$plugin_data['Description'].'</p>'; |
|
591 | 591 | } else { |
592 | - if ( $screen->in_admin( 'network' ) ) { |
|
593 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
592 | + if ($screen->in_admin('network')) { |
|
593 | + $is_active = is_plugin_active_for_network($plugin_file); |
|
594 | 594 | } else { |
595 | - $is_active = is_plugin_active( $plugin_file ); |
|
596 | - $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); |
|
597 | - $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); |
|
595 | + $is_active = is_plugin_active($plugin_file); |
|
596 | + $restrict_network_active = (is_multisite() && is_plugin_active_for_network($plugin_file)); |
|
597 | + $restrict_network_only = (is_multisite() && is_network_only_plugin($plugin_file) && ! $is_active); |
|
598 | 598 | } |
599 | 599 | |
600 | - if ( $screen->in_admin( 'network' ) ) { |
|
601 | - if ( $is_active ) { |
|
602 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
600 | + if ($screen->in_admin('network')) { |
|
601 | + if ($is_active) { |
|
602 | + if (current_user_can('manage_network_plugins')) { |
|
603 | 603 | /* translators: %s: plugin name */ |
604 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; |
|
604 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(_x('Network Deactivate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Network Deactivate').'</a>'; |
|
605 | 605 | } |
606 | 606 | } else { |
607 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
607 | + if (current_user_can('manage_network_plugins')) { |
|
608 | 608 | /* translators: %s: plugin name */ |
609 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; |
|
609 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(_x('Network Activate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Network Activate').'</a>'; |
|
610 | 610 | } |
611 | - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
611 | + if (current_user_can('delete_plugins') && ! is_plugin_active($plugin_file)) { |
|
612 | 612 | /* translators: %s: plugin name */ |
613 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
613 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } else { |
617 | - if ( $restrict_network_active ) { |
|
617 | + if ($restrict_network_active) { |
|
618 | 618 | $actions = array( |
619 | - 'network_active' => __( 'Network Active' ), |
|
619 | + 'network_active' => __('Network Active'), |
|
620 | 620 | ); |
621 | - } elseif ( $restrict_network_only ) { |
|
621 | + } elseif ($restrict_network_only) { |
|
622 | 622 | $actions = array( |
623 | - 'network_only' => __( 'Network Only' ), |
|
623 | + 'network_only' => __('Network Only'), |
|
624 | 624 | ); |
625 | - } elseif ( $is_active ) { |
|
625 | + } elseif ($is_active) { |
|
626 | 626 | /* translators: %s: plugin name */ |
627 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
627 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(_x('Deactivate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Deactivate').'</a>'; |
|
628 | 628 | } else { |
629 | 629 | /* translators: %s: plugin name */ |
630 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
630 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(_x('Activate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Activate').'</a>'; |
|
631 | 631 | |
632 | - if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
632 | + if ( ! is_multisite() && current_user_can('delete_plugins')) { |
|
633 | 633 | /* translators: %s: plugin name */ |
634 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
634 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
635 | 635 | } |
636 | 636 | } // end if $is_active |
637 | 637 | |
638 | 638 | } // end if $screen->in_admin( 'network' ) |
639 | 639 | |
640 | - if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { |
|
640 | + if (( ! is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR.'/'.$plugin_file)) { |
|
641 | 641 | /* translators: %s: plugin name */ |
642 | - $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
642 | + $actions['edit'] = '<a href="plugin-editor.php?file='.$plugin_file.'" class="edit" aria-label="'.esc_attr(sprintf(__('Edit %s'), $plugin_data['Name'])).'">'.__('Edit').'</a>'; |
|
643 | 643 | } |
644 | 644 | } // end if $context |
645 | 645 | |
646 | - $actions = array_filter( $actions ); |
|
646 | + $actions = array_filter($actions); |
|
647 | 647 | |
648 | - if ( $screen->in_admin( 'network' ) ) { |
|
648 | + if ($screen->in_admin('network')) { |
|
649 | 649 | |
650 | 650 | /** |
651 | 651 | * Filters the action links displayed for each plugin in the Network Admin Plugins list table. |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * 'Inactive', 'Recently Activated', 'Upgrade', |
663 | 663 | * 'Must-Use', 'Drop-ins', 'Search'. |
664 | 664 | */ |
665 | - $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
665 | + $actions = apply_filters('network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table. |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * 'Inactive', 'Recently Activated', 'Upgrade', |
680 | 680 | * 'Must-Use', 'Drop-ins', 'Search'. |
681 | 681 | */ |
682 | - $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
682 | + $actions = apply_filters("network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
683 | 683 | |
684 | 684 | } else { |
685 | 685 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * 'Inactive', 'Recently Activated', 'Upgrade', |
701 | 701 | * 'Must-Use', 'Drop-ins', 'Search'. |
702 | 702 | */ |
703 | - $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
703 | + $actions = apply_filters('plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
704 | 704 | |
705 | 705 | /** |
706 | 706 | * Filters the list of action links displayed for a specific plugin in the Plugins list table. |
@@ -717,48 +717,48 @@ discard block |
||
717 | 717 | * 'Inactive', 'Recently Activated', 'Upgrade', |
718 | 718 | * 'Must-Use', 'Drop-ins', 'Search'. |
719 | 719 | */ |
720 | - $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
720 | + $actions = apply_filters("plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
721 | 721 | |
722 | 722 | } |
723 | 723 | |
724 | 724 | $class = $is_active ? 'active' : 'inactive'; |
725 | - $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
|
726 | - if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
725 | + $checkbox_id = "checkbox_".md5($plugin_data['Name']); |
|
726 | + if ($restrict_network_active || $restrict_network_only || in_array($status, array('mustuse', 'dropins'))) { |
|
727 | 727 | $checkbox = ''; |
728 | 728 | } else { |
729 | - $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
|
730 | - . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
|
729 | + $checkbox = "<label class='screen-reader-text' for='".$checkbox_id."' >".sprintf(__('Select %s'), $plugin_data['Name'])."</label>" |
|
730 | + . "<input type='checkbox' name='checked[]' value='".esc_attr($plugin_file)."' id='".$checkbox_id."' />"; |
|
731 | 731 | } |
732 | - if ( 'dropins' != $context ) { |
|
733 | - $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
|
732 | + if ('dropins' != $context) { |
|
733 | + $description = '<p>'.($plugin_data['Description'] ? $plugin_data['Description'] : ' ').'</p>'; |
|
734 | 734 | $plugin_name = $plugin_data['Name']; |
735 | 735 | } |
736 | 736 | |
737 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
737 | + if ( ! empty($totals['upgrade']) && ! empty($plugin_data['update'])) |
|
738 | 738 | $class .= ' update'; |
739 | 739 | |
740 | - $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
|
741 | - printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
742 | - esc_attr( $class ), |
|
743 | - esc_attr( $plugin_slug ), |
|
744 | - esc_attr( $plugin_file ) |
|
740 | + $plugin_slug = isset($plugin_data['slug']) ? $plugin_data['slug'] : sanitize_title($plugin_name); |
|
741 | + printf('<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
742 | + esc_attr($class), |
|
743 | + esc_attr($plugin_slug), |
|
744 | + esc_attr($plugin_file) |
|
745 | 745 | ); |
746 | 746 | |
747 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
747 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
748 | 748 | |
749 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
749 | + foreach ($columns as $column_name => $column_display_name) { |
|
750 | 750 | $extra_classes = ''; |
751 | - if ( in_array( $column_name, $hidden ) ) { |
|
751 | + if (in_array($column_name, $hidden)) { |
|
752 | 752 | $extra_classes = ' hidden'; |
753 | 753 | } |
754 | 754 | |
755 | - switch ( $column_name ) { |
|
755 | + switch ($column_name) { |
|
756 | 756 | case 'cb': |
757 | 757 | echo "<th scope='row' class='check-column'>$checkbox</th>"; |
758 | 758 | break; |
759 | 759 | case 'name': |
760 | 760 | echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
761 | - echo $this->row_actions( $actions, true ); |
|
761 | + echo $this->row_actions($actions, true); |
|
762 | 762 | echo "</td>"; |
763 | 763 | break; |
764 | 764 | case 'description': |
@@ -769,28 +769,28 @@ discard block |
||
769 | 769 | <div class='$class second plugin-version-author-uri'>"; |
770 | 770 | |
771 | 771 | $plugin_meta = array(); |
772 | - if ( !empty( $plugin_data['Version'] ) ) |
|
773 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
774 | - if ( !empty( $plugin_data['Author'] ) ) { |
|
772 | + if ( ! empty($plugin_data['Version'])) |
|
773 | + $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
774 | + if ( ! empty($plugin_data['Author'])) { |
|
775 | 775 | $author = $plugin_data['Author']; |
776 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
777 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
778 | - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
|
776 | + if ( ! empty($plugin_data['AuthorURI'])) |
|
777 | + $author = '<a href="'.$plugin_data['AuthorURI'].'">'.$plugin_data['Author'].'</a>'; |
|
778 | + $plugin_meta[] = sprintf(__('By %s'), $author); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // Details link using API info, if available |
782 | - if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { |
|
783 | - $plugin_meta[] = sprintf( '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
784 | - esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . |
|
785 | - '&TB_iframe=true&width=600&height=550' ) ), |
|
786 | - esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), |
|
787 | - esc_attr( $plugin_name ), |
|
788 | - __( 'View details' ) |
|
782 | + if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { |
|
783 | + $plugin_meta[] = sprintf('<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
784 | + esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data['slug']. |
|
785 | + '&TB_iframe=true&width=600&height=550')), |
|
786 | + esc_attr(sprintf(__('More information about %s'), $plugin_name)), |
|
787 | + esc_attr($plugin_name), |
|
788 | + __('View details') |
|
789 | 789 | ); |
790 | - } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
791 | - $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
|
792 | - esc_url( $plugin_data['PluginURI'] ), |
|
793 | - __( 'Visit plugin site' ) |
|
790 | + } elseif ( ! empty($plugin_data['PluginURI'])) { |
|
791 | + $plugin_meta[] = sprintf('<a href="%s">%s</a>', |
|
792 | + esc_url($plugin_data['PluginURI']), |
|
793 | + __('Visit plugin site') |
|
794 | 794 | ); |
795 | 795 | } |
796 | 796 | |
@@ -808,8 +808,8 @@ discard block |
||
808 | 808 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
809 | 809 | * 'Drop-ins', 'Search'. |
810 | 810 | */ |
811 | - $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); |
|
812 | - echo implode( ' | ', $plugin_meta ); |
|
811 | + $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); |
|
812 | + echo implode(' | ', $plugin_meta); |
|
813 | 813 | |
814 | 814 | echo "</div></td>"; |
815 | 815 | break; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * @param string $plugin_file Path to the plugin file. |
828 | 828 | * @param array $plugin_data An array of plugin data. |
829 | 829 | */ |
830 | - do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); |
|
830 | + do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); |
|
831 | 831 | |
832 | 832 | echo "</td>"; |
833 | 833 | } |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
847 | 847 | * 'Drop-ins', 'Search'. |
848 | 848 | */ |
849 | - do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); |
|
849 | + do_action('after_plugin_row', $plugin_file, $plugin_data, $status); |
|
850 | 850 | |
851 | 851 | /** |
852 | 852 | * Fires after each specific row in the Plugins list table. |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
863 | 863 | * 'Drop-ins', 'Search'. |
864 | 864 | */ |
865 | - do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); |
|
865 | + do_action("after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | private $_help_sidebar = ''; |
144 | 144 | |
145 | 145 | /** |
146 | - * The accessible hidden headings and text associated with the screen, if any. |
|
147 | - * |
|
148 | - * @since 4.4.0 |
|
149 | - * @access private |
|
150 | - * @var array |
|
151 | - */ |
|
146 | + * The accessible hidden headings and text associated with the screen, if any. |
|
147 | + * |
|
148 | + * @since 4.4.0 |
|
149 | + * @access private |
|
150 | + * @var array |
|
151 | + */ |
|
152 | 152 | private $_screen_reader_content = array(); |
153 | 153 | |
154 | 154 | /** |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
659 | - * Get the accessible hidden headings and text used in the screen. |
|
660 | - * |
|
661 | - * @since 4.4.0 |
|
662 | - * |
|
663 | - * @see set_screen_reader_content() For more information on the array format. |
|
664 | - * |
|
665 | - * @return array An associative array of screen reader text strings. |
|
666 | - */ |
|
659 | + * Get the accessible hidden headings and text used in the screen. |
|
660 | + * |
|
661 | + * @since 4.4.0 |
|
662 | + * |
|
663 | + * @see set_screen_reader_content() For more information on the array format. |
|
664 | + * |
|
665 | + * @return array An associative array of screen reader text strings. |
|
666 | + */ |
|
667 | 667 | public function get_screen_reader_content() { |
668 | 668 | return $this->_screen_reader_content; |
669 | 669 | } |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * Defaults to the current $hook_suffix global. |
215 | 215 | * @return WP_Screen Screen object. |
216 | 216 | */ |
217 | - public static function get( $hook_name = '' ) { |
|
218 | - if ( $hook_name instanceof WP_Screen ) { |
|
217 | + public static function get($hook_name = '') { |
|
218 | + if ($hook_name instanceof WP_Screen) { |
|
219 | 219 | return $hook_name; |
220 | 220 | } |
221 | 221 | |
@@ -223,89 +223,89 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
226 | + if ($hook_name) |
|
227 | 227 | $id = $hook_name; |
228 | 228 | else |
229 | 229 | $id = $GLOBALS['hook_suffix']; |
230 | 230 | |
231 | 231 | // For those pesky meta boxes. |
232 | - if ( $hook_name && post_type_exists( $hook_name ) ) { |
|
232 | + if ($hook_name && post_type_exists($hook_name)) { |
|
233 | 233 | $post_type = $id; |
234 | 234 | $id = 'post'; // changes later. ends up being $base. |
235 | 235 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
236 | + if ('.php' == substr($id, -4)) |
|
237 | + $id = substr($id, 0, -4); |
|
238 | 238 | |
239 | - if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
|
240 | - $id = substr( $id, 0, -4 ); |
|
239 | + if ('post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id) { |
|
240 | + $id = substr($id, 0, -4); |
|
241 | 241 | $action = 'add'; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! $post_type && $hook_name ) { |
|
246 | - if ( '-network' == substr( $id, -8 ) ) { |
|
247 | - $id = substr( $id, 0, -8 ); |
|
245 | + if ( ! $post_type && $hook_name) { |
|
246 | + if ('-network' == substr($id, -8)) { |
|
247 | + $id = substr($id, 0, -8); |
|
248 | 248 | $in_admin = 'network'; |
249 | - } elseif ( '-user' == substr( $id, -5 ) ) { |
|
250 | - $id = substr( $id, 0, -5 ); |
|
249 | + } elseif ('-user' == substr($id, -5)) { |
|
250 | + $id = substr($id, 0, -5); |
|
251 | 251 | $in_admin = 'user'; |
252 | 252 | } |
253 | 253 | |
254 | - $id = sanitize_key( $id ); |
|
255 | - if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) { |
|
256 | - $maybe = substr( $id, 5 ); |
|
257 | - if ( taxonomy_exists( $maybe ) ) { |
|
254 | + $id = sanitize_key($id); |
|
255 | + if ('edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr($id, 0, 5)) { |
|
256 | + $maybe = substr($id, 5); |
|
257 | + if (taxonomy_exists($maybe)) { |
|
258 | 258 | $id = 'edit-tags'; |
259 | 259 | $taxonomy = $maybe; |
260 | - } elseif ( post_type_exists( $maybe ) ) { |
|
260 | + } elseif (post_type_exists($maybe)) { |
|
261 | 261 | $id = 'edit'; |
262 | 262 | $post_type = $maybe; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! $in_admin ) |
|
266 | + if ( ! $in_admin) |
|
267 | 267 | $in_admin = 'site'; |
268 | 268 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
269 | + if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) |
|
270 | 270 | $in_admin = 'network'; |
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
271 | + elseif (defined('WP_USER_ADMIN') && WP_USER_ADMIN) |
|
272 | 272 | $in_admin = 'user'; |
273 | 273 | else |
274 | 274 | $in_admin = 'site'; |
275 | 275 | } |
276 | 276 | |
277 | - if ( 'index' == $id ) |
|
277 | + if ('index' == $id) |
|
278 | 278 | $id = 'dashboard'; |
279 | - elseif ( 'front' == $id ) |
|
279 | + elseif ('front' == $id) |
|
280 | 280 | $in_admin = false; |
281 | 281 | |
282 | 282 | $base = $id; |
283 | 283 | |
284 | 284 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | - if ( ! $hook_name ) { |
|
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
285 | + if ( ! $hook_name) { |
|
286 | + if (isset($_REQUEST['post_type'])) |
|
287 | + $post_type = post_type_exists($_REQUEST['post_type']) ? $_REQUEST['post_type'] : false; |
|
288 | + if (isset($_REQUEST['taxonomy'])) |
|
289 | + $taxonomy = taxonomy_exists($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : false; |
|
290 | 290 | |
291 | - switch ( $base ) { |
|
291 | + switch ($base) { |
|
292 | 292 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
293 | + if (isset($_GET['post'])) |
|
294 | 294 | $post_id = (int) $_GET['post']; |
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
295 | + elseif (isset($_POST['post_ID'])) |
|
296 | 296 | $post_id = (int) $_POST['post_ID']; |
297 | 297 | else |
298 | 298 | $post_id = 0; |
299 | 299 | |
300 | - if ( $post_id ) { |
|
301 | - $post = get_post( $post_id ); |
|
302 | - if ( $post ) |
|
300 | + if ($post_id) { |
|
301 | + $post = get_post($post_id); |
|
302 | + if ($post) |
|
303 | 303 | $post_type = $post->post_type; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | case 'edit-tags' : |
307 | 307 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
308 | + if (null === $post_type && is_object_in_taxonomy('post', $taxonomy ? $taxonomy : 'post_tag')) |
|
309 | 309 | $post_type = 'post'; |
310 | 310 | break; |
311 | 311 | case 'upload': |
@@ -314,58 +314,58 @@ discard block |
||
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | - switch ( $base ) { |
|
317 | + switch ($base) { |
|
318 | 318 | case 'post' : |
319 | - if ( null === $post_type ) |
|
319 | + if (null === $post_type) |
|
320 | 320 | $post_type = 'post'; |
321 | 321 | $id = $post_type; |
322 | 322 | break; |
323 | 323 | case 'edit' : |
324 | - if ( null === $post_type ) |
|
324 | + if (null === $post_type) |
|
325 | 325 | $post_type = 'post'; |
326 | - $id .= '-' . $post_type; |
|
326 | + $id .= '-'.$post_type; |
|
327 | 327 | break; |
328 | 328 | case 'edit-tags' : |
329 | 329 | case 'term' : |
330 | - if ( null === $taxonomy ) |
|
330 | + if (null === $taxonomy) |
|
331 | 331 | $taxonomy = 'post_tag'; |
332 | 332 | // The edit-tags ID does not contain the post type. Look for it in the request. |
333 | - if ( null === $post_type ) { |
|
333 | + if (null === $post_type) { |
|
334 | 334 | $post_type = 'post'; |
335 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
335 | + if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type'])) |
|
336 | 336 | $post_type = $_REQUEST['post_type']; |
337 | 337 | } |
338 | 338 | |
339 | - $id = 'edit-' . $taxonomy; |
|
339 | + $id = 'edit-'.$taxonomy; |
|
340 | 340 | break; |
341 | 341 | } |
342 | 342 | |
343 | - if ( 'network' == $in_admin ) { |
|
343 | + if ('network' == $in_admin) { |
|
344 | 344 | $id .= '-network'; |
345 | 345 | $base .= '-network'; |
346 | - } elseif ( 'user' == $in_admin ) { |
|
346 | + } elseif ('user' == $in_admin) { |
|
347 | 347 | $id .= '-user'; |
348 | 348 | $base .= '-user'; |
349 | 349 | } |
350 | 350 | |
351 | - if ( isset( self::$_registry[ $id ] ) ) { |
|
352 | - $screen = self::$_registry[ $id ]; |
|
353 | - if ( $screen === get_current_screen() ) |
|
351 | + if (isset(self::$_registry[$id])) { |
|
352 | + $screen = self::$_registry[$id]; |
|
353 | + if ($screen === get_current_screen()) |
|
354 | 354 | return $screen; |
355 | 355 | } else { |
356 | 356 | $screen = new WP_Screen(); |
357 | - $screen->id = $id; |
|
357 | + $screen->id = $id; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $screen->base = $base; |
361 | 361 | $screen->action = $action; |
362 | 362 | $screen->post_type = (string) $post_type; |
363 | 363 | $screen->taxonomy = (string) $taxonomy; |
364 | - $screen->is_user = ( 'user' == $in_admin ); |
|
365 | - $screen->is_network = ( 'network' == $in_admin ); |
|
364 | + $screen->is_user = ('user' == $in_admin); |
|
365 | + $screen->is_network = ('network' == $in_admin); |
|
366 | 366 | $screen->in_admin = $in_admin; |
367 | 367 | |
368 | - self::$_registry[ $id ] = $screen; |
|
368 | + self::$_registry[$id] = $screen; |
|
369 | 369 | |
370 | 370 | return $screen; |
371 | 371 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @param WP_Screen $current_screen Current WP_Screen object. |
395 | 395 | */ |
396 | - do_action( 'current_screen', $current_screen ); |
|
396 | + do_action('current_screen', $current_screen); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | * If empty any of the three admins will result in true. |
414 | 414 | * @return bool True if the screen is in the indicated admin, false otherwise. |
415 | 415 | */ |
416 | - public function in_admin( $admin = null ) { |
|
417 | - if ( empty( $admin ) ) |
|
416 | + public function in_admin($admin = null) { |
|
417 | + if (empty($admin)) |
|
418 | 418 | return (bool) $this->in_admin; |
419 | 419 | |
420 | - return ( $admin == $this->in_admin ); |
|
420 | + return ($admin == $this->in_admin); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param WP_Screen $screen A screen object. |
431 | 431 | * @param string $help Help text. |
432 | 432 | */ |
433 | - public static function add_old_compat_help( $screen, $help ) { |
|
434 | - self::$_old_compat_help[ $screen->id ] = $help; |
|
433 | + public static function add_old_compat_help($screen, $help) { |
|
434 | + self::$_old_compat_help[$screen->id] = $help; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @param string $parent_file The parent file of the screen. Typically the $parent_file global. |
444 | 444 | */ |
445 | - public function set_parentage( $parent_file ) { |
|
445 | + public function set_parentage($parent_file) { |
|
446 | 446 | $this->parent_file = $parent_file; |
447 | - list( $this->parent_base ) = explode( '?', $parent_file ); |
|
448 | - $this->parent_base = str_replace( '.php', '', $this->parent_base ); |
|
447 | + list($this->parent_base) = explode('?', $parent_file); |
|
448 | + $this->parent_base = str_replace('.php', '', $this->parent_base); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | * @param string $option Option ID |
458 | 458 | * @param mixed $args Option-dependent arguments. |
459 | 459 | */ |
460 | - public function add_option( $option, $args = array() ) { |
|
461 | - $this->_options[ $option ] = $args; |
|
460 | + public function add_option($option, $args = array()) { |
|
461 | + $this->_options[$option] = $args; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @param string $option Option ID. |
470 | 470 | */ |
471 | - public function remove_option( $option ) { |
|
472 | - unset( $this->_options[ $option ] ); |
|
471 | + public function remove_option($option) { |
|
472 | + unset($this->_options[$option]); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -502,15 +502,15 @@ discard block |
||
502 | 502 | * Default false. |
503 | 503 | * @return string The option value if set, null otherwise. |
504 | 504 | */ |
505 | - public function get_option( $option, $key = false ) { |
|
506 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
505 | + public function get_option($option, $key = false) { |
|
506 | + if ( ! isset($this->_options[$option])) |
|
507 | 507 | return null; |
508 | - if ( $key ) { |
|
509 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
510 | - return $this->_options[ $option ][ $key ]; |
|
508 | + if ($key) { |
|
509 | + if (isset($this->_options[$option][$key])) |
|
510 | + return $this->_options[$option][$key]; |
|
511 | 511 | return null; |
512 | 512 | } |
513 | - return $this->_options[ $option ]; |
|
513 | + return $this->_options[$option]; |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -525,20 +525,20 @@ discard block |
||
525 | 525 | $help_tabs = $this->_help_tabs; |
526 | 526 | |
527 | 527 | $priorities = array(); |
528 | - foreach ( $help_tabs as $help_tab ) { |
|
529 | - if ( isset( $priorities[ $help_tab['priority'] ] ) ) { |
|
530 | - $priorities[ $help_tab['priority'] ][] = $help_tab; |
|
528 | + foreach ($help_tabs as $help_tab) { |
|
529 | + if (isset($priorities[$help_tab['priority']])) { |
|
530 | + $priorities[$help_tab['priority']][] = $help_tab; |
|
531 | 531 | } else { |
532 | - $priorities[ $help_tab['priority'] ] = array( $help_tab ); |
|
532 | + $priorities[$help_tab['priority']] = array($help_tab); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | - ksort( $priorities ); |
|
536 | + ksort($priorities); |
|
537 | 537 | |
538 | 538 | $sorted = array(); |
539 | - foreach ( $priorities as $list ) { |
|
540 | - foreach ( $list as $tab ) { |
|
541 | - $sorted[ $tab['id'] ] = $tab; |
|
539 | + foreach ($priorities as $list) { |
|
540 | + foreach ($list as $tab) { |
|
541 | + $sorted[$tab['id']] = $tab; |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | * @param string $id Help Tab ID. |
554 | 554 | * @return array Help tab arguments. |
555 | 555 | */ |
556 | - public function get_help_tab( $id ) { |
|
557 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
556 | + public function get_help_tab($id) { |
|
557 | + if ( ! isset($this->_help_tabs[$id])) |
|
558 | 558 | return null; |
559 | - return $this->_help_tabs[ $id ]; |
|
559 | + return $this->_help_tabs[$id]; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | /** |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @type int $priority Optional. The priority of the tab, used for ordering. Default 10. |
577 | 577 | * } |
578 | 578 | */ |
579 | - public function add_help_tab( $args ) { |
|
579 | + public function add_help_tab($args) { |
|
580 | 580 | $defaults = array( |
581 | 581 | 'title' => false, |
582 | 582 | 'id' => false, |
@@ -584,16 +584,16 @@ discard block |
||
584 | 584 | 'callback' => false, |
585 | 585 | 'priority' => 10, |
586 | 586 | ); |
587 | - $args = wp_parse_args( $args, $defaults ); |
|
587 | + $args = wp_parse_args($args, $defaults); |
|
588 | 588 | |
589 | - $args['id'] = sanitize_html_class( $args['id'] ); |
|
589 | + $args['id'] = sanitize_html_class($args['id']); |
|
590 | 590 | |
591 | 591 | // Ensure we have an ID and title. |
592 | - if ( ! $args['id'] || ! $args['title'] ) |
|
592 | + if ( ! $args['id'] || ! $args['title']) |
|
593 | 593 | return; |
594 | 594 | |
595 | 595 | // Allows for overriding an existing tab with that ID. |
596 | - $this->_help_tabs[ $args['id'] ] = $args; |
|
596 | + $this->_help_tabs[$args['id']] = $args; |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -603,8 +603,8 @@ discard block |
||
603 | 603 | * |
604 | 604 | * @param string $id The help tab ID. |
605 | 605 | */ |
606 | - public function remove_help_tab( $id ) { |
|
607 | - unset( $this->_help_tabs[ $id ] ); |
|
606 | + public function remove_help_tab($id) { |
|
607 | + unset($this->_help_tabs[$id]); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | /** |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * |
636 | 636 | * @param string $content Sidebar content in plain text or HTML. |
637 | 637 | */ |
638 | - public function set_help_sidebar( $content ) { |
|
638 | + public function set_help_sidebar($content) { |
|
639 | 639 | $this->_help_sidebar = $content; |
640 | 640 | } |
641 | 641 | |
@@ -677,11 +677,11 @@ discard block |
||
677 | 677 | * @param string $key Screen reader text array named key. |
678 | 678 | * @return string Screen reader text string. |
679 | 679 | */ |
680 | - public function get_screen_reader_text( $key ) { |
|
681 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
680 | + public function get_screen_reader_text($key) { |
|
681 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
682 | 682 | return null; |
683 | 683 | } |
684 | - return $this->_screen_reader_content[ $key ]; |
|
684 | + return $this->_screen_reader_content[$key]; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
@@ -700,13 +700,13 @@ discard block |
||
700 | 700 | * Default 'Items list'. |
701 | 701 | * } |
702 | 702 | */ |
703 | - public function set_screen_reader_content( $content = array() ) { |
|
703 | + public function set_screen_reader_content($content = array()) { |
|
704 | 704 | $defaults = array( |
705 | - 'heading_views' => __( 'Filter items list' ), |
|
706 | - 'heading_pagination' => __( 'Items list navigation' ), |
|
707 | - 'heading_list' => __( 'Items list' ), |
|
705 | + 'heading_views' => __('Filter items list'), |
|
706 | + 'heading_pagination' => __('Items list navigation'), |
|
707 | + 'heading_list' => __('Items list'), |
|
708 | 708 | ); |
709 | - $content = wp_parse_args( $content, $defaults ); |
|
709 | + $content = wp_parse_args($content, $defaults); |
|
710 | 710 | |
711 | 711 | $this->_screen_reader_content = $content; |
712 | 712 | } |
@@ -741,9 +741,9 @@ discard block |
||
741 | 741 | * @param array $old_compat_help Old contextual help. |
742 | 742 | * @param WP_Screen $this Current WP_Screen instance. |
743 | 743 | */ |
744 | - self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); |
|
744 | + self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); |
|
745 | 745 | |
746 | - $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; |
|
746 | + $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; |
|
747 | 747 | |
748 | 748 | /** |
749 | 749 | * Filters the legacy contextual help text. |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | * @param WP_Screen $this Current WP_Screen instance. |
758 | 758 | * |
759 | 759 | */ |
760 | - $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this ); |
|
760 | + $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); |
|
761 | 761 | |
762 | 762 | // Default help only if there is no old-style block of text and no new-style help tabs. |
763 | - if ( empty( $old_help ) && ! $this->get_help_tabs() ) { |
|
763 | + if (empty($old_help) && ! $this->get_help_tabs()) { |
|
764 | 764 | |
765 | 765 | /** |
766 | 766 | * Filters the default legacy contextual help text. |
@@ -771,44 +771,44 @@ discard block |
||
771 | 771 | * |
772 | 772 | * @param string $old_help_default Default contextual help text. |
773 | 773 | */ |
774 | - $default_help = apply_filters( 'default_contextual_help', '' ); |
|
775 | - if ( $default_help ) |
|
776 | - $old_help = '<p>' . $default_help . '</p>'; |
|
774 | + $default_help = apply_filters('default_contextual_help', ''); |
|
775 | + if ($default_help) |
|
776 | + $old_help = '<p>'.$default_help.'</p>'; |
|
777 | 777 | } |
778 | 778 | |
779 | - if ( $old_help ) { |
|
780 | - $this->add_help_tab( array( |
|
779 | + if ($old_help) { |
|
780 | + $this->add_help_tab(array( |
|
781 | 781 | 'id' => 'old-contextual-help', |
782 | 782 | 'title' => __('Overview'), |
783 | 783 | 'content' => $old_help, |
784 | - ) ); |
|
784 | + )); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | $help_sidebar = $this->get_help_sidebar(); |
788 | 788 | |
789 | 789 | $help_class = 'hidden'; |
790 | - if ( ! $help_sidebar ) |
|
790 | + if ( ! $help_sidebar) |
|
791 | 791 | $help_class .= ' no-sidebar'; |
792 | 792 | |
793 | 793 | // Time to render! |
794 | 794 | ?> |
795 | 795 | <div id="screen-meta" class="metabox-prefs"> |
796 | 796 | |
797 | - <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
797 | + <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
798 | 798 | <div id="contextual-help-back"></div> |
799 | 799 | <div id="contextual-help-columns"> |
800 | 800 | <div class="contextual-help-tabs"> |
801 | 801 | <ul> |
802 | 802 | <?php |
803 | 803 | $class = ' class="active"'; |
804 | - foreach ( $this->get_help_tabs() as $tab ) : |
|
804 | + foreach ($this->get_help_tabs() as $tab) : |
|
805 | 805 | $link_id = "tab-link-{$tab['id']}"; |
806 | 806 | $panel_id = "tab-panel-{$tab['id']}"; |
807 | 807 | ?> |
808 | 808 | |
809 | - <li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>> |
|
810 | - <a href="<?php echo esc_url( "#$panel_id" ); ?>" aria-controls="<?php echo esc_attr( $panel_id ); ?>"> |
|
811 | - <?php echo esc_html( $tab['title'] ); ?> |
|
809 | + <li id="<?php echo esc_attr($link_id); ?>"<?php echo $class; ?>> |
|
810 | + <a href="<?php echo esc_url("#$panel_id"); ?>" aria-controls="<?php echo esc_attr($panel_id); ?>"> |
|
811 | + <?php echo esc_html($tab['title']); ?> |
|
812 | 812 | </a> |
813 | 813 | </li> |
814 | 814 | <?php |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | </ul> |
819 | 819 | </div> |
820 | 820 | |
821 | - <?php if ( $help_sidebar ) : ?> |
|
821 | + <?php if ($help_sidebar) : ?> |
|
822 | 822 | <div class="contextual-help-sidebar"> |
823 | 823 | <?php echo $help_sidebar; ?> |
824 | 824 | </div> |
@@ -827,18 +827,18 @@ discard block |
||
827 | 827 | <div class="contextual-help-tabs-wrap"> |
828 | 828 | <?php |
829 | 829 | $classes = 'help-tab-content active'; |
830 | - foreach ( $this->get_help_tabs() as $tab ): |
|
830 | + foreach ($this->get_help_tabs() as $tab): |
|
831 | 831 | $panel_id = "tab-panel-{$tab['id']}"; |
832 | 832 | ?> |
833 | 833 | |
834 | - <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>"> |
|
834 | + <div id="<?php echo esc_attr($panel_id); ?>" class="<?php echo $classes; ?>"> |
|
835 | 835 | <?php |
836 | 836 | // Print tab content. |
837 | 837 | echo $tab['content']; |
838 | 838 | |
839 | 839 | // If it exists, fire tab callback. |
840 | - if ( ! empty( $tab['callback'] ) ) |
|
841 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
840 | + if ( ! empty($tab['callback'])) |
|
841 | + call_user_func_array($tab['callback'], array($this, $tab)); |
|
842 | 842 | ?> |
843 | 843 | </div> |
844 | 844 | <?php |
@@ -863,37 +863,37 @@ discard block |
||
863 | 863 | * @param string $screen_id Screen ID. |
864 | 864 | * @param WP_Screen $this Current WP_Screen instance. |
865 | 865 | */ |
866 | - $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
|
866 | + $columns = apply_filters('screen_layout_columns', array(), $this->id, $this); |
|
867 | 867 | |
868 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
869 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
868 | + if ( ! empty($columns) && isset($columns[$this->id])) |
|
869 | + $this->add_option('layout_columns', array('max' => $columns[$this->id])); |
|
870 | 870 | |
871 | - if ( $this->get_option( 'layout_columns' ) ) { |
|
871 | + if ($this->get_option('layout_columns')) { |
|
872 | 872 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
873 | 873 | |
874 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
875 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
874 | + if ( ! $this->columns && $this->get_option('layout_columns', 'default')) |
|
875 | + $this->columns = $this->get_option('layout_columns', 'default'); |
|
876 | 876 | } |
877 | - $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
|
877 | + $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat. |
|
878 | 878 | |
879 | 879 | // Add screen options |
880 | - if ( $this->show_screen_options() ) |
|
880 | + if ($this->show_screen_options()) |
|
881 | 881 | $this->render_screen_options(); |
882 | 882 | ?> |
883 | 883 | </div> |
884 | 884 | <?php |
885 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
885 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options()) |
|
886 | 886 | return; |
887 | 887 | ?> |
888 | 888 | <div id="screen-meta-links"> |
889 | - <?php if ( $this->get_help_tabs() ) : ?> |
|
889 | + <?php if ($this->get_help_tabs()) : ?> |
|
890 | 890 | <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
891 | - <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></button> |
|
891 | + <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e('Help'); ?></button> |
|
892 | 892 | </div> |
893 | 893 | <?php endif; |
894 | - if ( $this->show_screen_options() ) : ?> |
|
894 | + if ($this->show_screen_options()) : ?> |
|
895 | 895 | <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
896 | - <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></button> |
|
896 | + <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e('Screen Options'); ?></button> |
|
897 | 897 | </div> |
898 | 898 | <?php endif; ?> |
899 | 899 | </div> |
@@ -909,22 +909,22 @@ discard block |
||
909 | 909 | public function show_screen_options() { |
910 | 910 | global $wp_meta_boxes; |
911 | 911 | |
912 | - if ( is_bool( $this->_show_screen_options ) ) |
|
912 | + if (is_bool($this->_show_screen_options)) |
|
913 | 913 | return $this->_show_screen_options; |
914 | 914 | |
915 | - $columns = get_column_headers( $this ); |
|
915 | + $columns = get_column_headers($this); |
|
916 | 916 | |
917 | - $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); |
|
917 | + $show_screen = ! empty($wp_meta_boxes[$this->id]) || $columns || $this->get_option('per_page'); |
|
918 | 918 | |
919 | - switch ( $this->base ) { |
|
919 | + switch ($this->base) { |
|
920 | 920 | case 'widgets': |
921 | - $nonce = wp_create_nonce( 'widgets-access' ); |
|
922 | - $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n"; |
|
921 | + $nonce = wp_create_nonce('widgets-access'); |
|
922 | + $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce='.urlencode($nonce).'">'.__('Enable accessibility mode').'</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce='.urlencode($nonce).'">'.__('Disable accessibility mode')."</a></p>\n"; |
|
923 | 923 | break; |
924 | 924 | case 'post' : |
925 | - $expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">'; |
|
926 | - $expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />'; |
|
927 | - $expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>'; |
|
925 | + $expand = '<fieldset class="editor-expand hidden"><legend>'.__('Additional settings').'</legend><label for="editor-expand-toggle">'; |
|
926 | + $expand .= '<input type="checkbox" id="editor-expand-toggle"'.checked(get_user_setting('editor_expand', 'on'), 'on', false).' />'; |
|
927 | + $expand .= __('Enable full-height editor and distraction-free functionality.').'</label></fieldset>'; |
|
928 | 928 | $this->_screen_settings = $expand; |
929 | 929 | break; |
930 | 930 | default: |
@@ -943,9 +943,9 @@ discard block |
||
943 | 943 | * @param string $screen_settings Screen settings. |
944 | 944 | * @param WP_Screen $this WP_Screen object. |
945 | 945 | */ |
946 | - $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
|
946 | + $this->_screen_settings = apply_filters('screen_settings', $this->_screen_settings, $this); |
|
947 | 947 | |
948 | - if ( $this->_screen_settings || $this->_options ) |
|
948 | + if ($this->_screen_settings || $this->_options) |
|
949 | 949 | $show_screen = true; |
950 | 950 | |
951 | 951 | /** |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | * Default true. |
958 | 958 | * @param WP_Screen $this Current WP_Screen instance. |
959 | 959 | */ |
960 | - $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); |
|
960 | + $this->_show_screen_options = apply_filters('screen_options_show_screen', $show_screen, $this); |
|
961 | 961 | return $this->_show_screen_options; |
962 | 962 | } |
963 | 963 | |
@@ -970,26 +970,26 @@ discard block |
||
970 | 970 | * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. |
971 | 971 | * } |
972 | 972 | */ |
973 | - public function render_screen_options( $options = array() ) { |
|
974 | - $options = wp_parse_args( $options, array( |
|
973 | + public function render_screen_options($options = array()) { |
|
974 | + $options = wp_parse_args($options, array( |
|
975 | 975 | 'wrap' => true, |
976 | - ) ); |
|
976 | + )); |
|
977 | 977 | |
978 | 978 | $wrapper_start = $wrapper_end = $form_start = $form_end = ''; |
979 | 979 | |
980 | 980 | // Output optional wrapper. |
981 | - if ( $options['wrap'] ) { |
|
982 | - $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="' . esc_attr__( 'Screen Options Tab' ) . '">'; |
|
981 | + if ($options['wrap']) { |
|
982 | + $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="'.esc_attr__('Screen Options Tab').'">'; |
|
983 | 983 | $wrapper_end = '</div>'; |
984 | 984 | } |
985 | 985 | |
986 | 986 | // Don't output the form and nonce for the widgets accessibility mode links. |
987 | - if ( 'widgets' !== $this->base ) { |
|
987 | + if ('widgets' !== $this->base) { |
|
988 | 988 | $form_start = "\n<form id='adv-settings' method='post'>\n"; |
989 | - $form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n"; |
|
989 | + $form_end = "\n".wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false, false)."\n</form>\n"; |
|
990 | 990 | } |
991 | 991 | |
992 | - echo $wrapper_start . $form_start; |
|
992 | + echo $wrapper_start.$form_start; |
|
993 | 993 | |
994 | 994 | $this->render_meta_boxes_preferences(); |
995 | 995 | $this->render_list_table_columns_preferences(); |
@@ -1007,13 +1007,13 @@ discard block |
||
1007 | 1007 | * Default false. |
1008 | 1008 | * @param WP_Screen $this Current WP_Screen instance. |
1009 | 1009 | */ |
1010 | - $show_button = apply_filters( 'screen_options_show_submit', false, $this ); |
|
1010 | + $show_button = apply_filters('screen_options_show_submit', false, $this); |
|
1011 | 1011 | |
1012 | - if ( $show_button ) { |
|
1013 | - submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true ); |
|
1012 | + if ($show_button) { |
|
1013 | + submit_button(__('Apply'), 'primary', 'screen-options-apply', true); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | - echo $form_end . $wrapper_end; |
|
1016 | + echo $form_end.$wrapper_end; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | /** |
@@ -1026,28 +1026,28 @@ discard block |
||
1026 | 1026 | public function render_meta_boxes_preferences() { |
1027 | 1027 | global $wp_meta_boxes; |
1028 | 1028 | |
1029 | - if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { |
|
1029 | + if ( ! isset($wp_meta_boxes[$this->id])) { |
|
1030 | 1030 | return; |
1031 | 1031 | } |
1032 | 1032 | ?> |
1033 | 1033 | <fieldset class="metabox-prefs"> |
1034 | - <legend><?php _e( 'Boxes' ); ?></legend> |
|
1034 | + <legend><?php _e('Boxes'); ?></legend> |
|
1035 | 1035 | <?php |
1036 | - meta_box_prefs( $this ); |
|
1036 | + meta_box_prefs($this); |
|
1037 | 1037 | |
1038 | - if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { |
|
1039 | - if ( isset( $_GET['welcome'] ) ) { |
|
1040 | - $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; |
|
1041 | - update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); |
|
1038 | + if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) { |
|
1039 | + if (isset($_GET['welcome'])) { |
|
1040 | + $welcome_checked = empty($_GET['welcome']) ? 0 : 1; |
|
1041 | + update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked); |
|
1042 | 1042 | } else { |
1043 | - $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|
1044 | - if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) { |
|
1043 | + $welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true); |
|
1044 | + if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) { |
|
1045 | 1045 | $welcome_checked = false; |
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | echo '<label for="wp_welcome_panel-hide">'; |
1049 | - echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; |
|
1050 | - echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; |
|
1049 | + echo '<input type="checkbox" id="wp_welcome_panel-hide"'.checked((bool) $welcome_checked, true, false).' />'; |
|
1050 | + echo _x('Welcome', 'Welcome panel')."</label>\n"; |
|
1051 | 1051 | } |
1052 | 1052 | ?> |
1053 | 1053 | </fieldset> |
@@ -1061,37 +1061,37 @@ discard block |
||
1061 | 1061 | */ |
1062 | 1062 | public function render_list_table_columns_preferences() { |
1063 | 1063 | |
1064 | - $columns = get_column_headers( $this ); |
|
1065 | - $hidden = get_hidden_columns( $this ); |
|
1064 | + $columns = get_column_headers($this); |
|
1065 | + $hidden = get_hidden_columns($this); |
|
1066 | 1066 | |
1067 | - if ( ! $columns ) { |
|
1067 | + if ( ! $columns) { |
|
1068 | 1068 | return; |
1069 | 1069 | } |
1070 | 1070 | |
1071 | - $legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' ); |
|
1071 | + $legend = ! empty($columns['_title']) ? $columns['_title'] : __('Columns'); |
|
1072 | 1072 | ?> |
1073 | 1073 | <fieldset class="metabox-prefs"> |
1074 | 1074 | <legend><?php echo $legend; ?></legend> |
1075 | 1075 | <?php |
1076 | - $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); |
|
1076 | + $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); |
|
1077 | 1077 | |
1078 | - foreach ( $columns as $column => $title ) { |
|
1078 | + foreach ($columns as $column => $title) { |
|
1079 | 1079 | // Can't hide these for they are special |
1080 | - if ( in_array( $column, $special ) ) { |
|
1080 | + if (in_array($column, $special)) { |
|
1081 | 1081 | continue; |
1082 | 1082 | } |
1083 | 1083 | |
1084 | - if ( empty( $title ) ) { |
|
1084 | + if (empty($title)) { |
|
1085 | 1085 | continue; |
1086 | 1086 | } |
1087 | 1087 | |
1088 | - if ( 'comments' == $column ) { |
|
1089 | - $title = __( 'Comments' ); |
|
1088 | + if ('comments' == $column) { |
|
1089 | + $title = __('Comments'); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | $id = "$column-hide"; |
1093 | 1093 | echo '<label>'; |
1094 | - echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />'; |
|
1094 | + echo '<input class="hide-column-tog" name="'.$id.'" type="checkbox" id="'.$id.'" value="'.$column.'"'.checked( ! in_array($column, $hidden), true, false).' />'; |
|
1095 | 1095 | echo "$title</label>\n"; |
1096 | 1096 | } |
1097 | 1097 | ?> |
@@ -1105,22 +1105,22 @@ discard block |
||
1105 | 1105 | * @since 3.3.0 |
1106 | 1106 | */ |
1107 | 1107 | public function render_screen_layout() { |
1108 | - if ( ! $this->get_option( 'layout_columns' ) ) { |
|
1108 | + if ( ! $this->get_option('layout_columns')) { |
|
1109 | 1109 | return; |
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | $screen_layout_columns = $this->get_columns(); |
1113 | - $num = $this->get_option( 'layout_columns', 'max' ); |
|
1113 | + $num = $this->get_option('layout_columns', 'max'); |
|
1114 | 1114 | |
1115 | 1115 | ?> |
1116 | 1116 | <fieldset class='columns-prefs'> |
1117 | - <legend class="screen-layout"><?php _e( 'Layout' ); ?></legend><?php |
|
1118 | - for ( $i = 1; $i <= $num; ++$i ): |
|
1117 | + <legend class="screen-layout"><?php _e('Layout'); ?></legend><?php |
|
1118 | + for ($i = 1; $i <= $num; ++$i): |
|
1119 | 1119 | ?> |
1120 | 1120 | <label class="columns-prefs-<?php echo $i; ?>"> |
1121 | - <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' |
|
1122 | - <?php checked( $screen_layout_columns, $i ); ?> /> |
|
1123 | - <?php printf( _n( '%s column', '%s columns', $i ), number_format_i18n( $i ) ); ?> |
|
1121 | + <input type='radio' name='screen_columns' value='<?php echo esc_attr($i); ?>' |
|
1122 | + <?php checked($screen_layout_columns, $i); ?> /> |
|
1123 | + <?php printf(_n('%s column', '%s columns', $i), number_format_i18n($i)); ?> |
|
1124 | 1124 | </label> |
1125 | 1125 | <?php |
1126 | 1126 | endfor; ?> |
@@ -1134,60 +1134,60 @@ discard block |
||
1134 | 1134 | * @since 3.3.0 |
1135 | 1135 | */ |
1136 | 1136 | public function render_per_page_options() { |
1137 | - if ( null === $this->get_option( 'per_page' ) ) { |
|
1137 | + if (null === $this->get_option('per_page')) { |
|
1138 | 1138 | return; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - $per_page_label = $this->get_option( 'per_page', 'label' ); |
|
1142 | - if ( null === $per_page_label ) { |
|
1143 | - $per_page_label = __( 'Number of items per page:' ); |
|
1141 | + $per_page_label = $this->get_option('per_page', 'label'); |
|
1142 | + if (null === $per_page_label) { |
|
1143 | + $per_page_label = __('Number of items per page:'); |
|
1144 | 1144 | } |
1145 | 1145 | |
1146 | - $option = $this->get_option( 'per_page', 'option' ); |
|
1147 | - if ( ! $option ) { |
|
1148 | - $option = str_replace( '-', '_', "{$this->id}_per_page" ); |
|
1146 | + $option = $this->get_option('per_page', 'option'); |
|
1147 | + if ( ! $option) { |
|
1148 | + $option = str_replace('-', '_', "{$this->id}_per_page"); |
|
1149 | 1149 | } |
1150 | 1150 | |
1151 | - $per_page = (int) get_user_option( $option ); |
|
1152 | - if ( empty( $per_page ) || $per_page < 1 ) { |
|
1153 | - $per_page = $this->get_option( 'per_page', 'default' ); |
|
1154 | - if ( ! $per_page ) { |
|
1151 | + $per_page = (int) get_user_option($option); |
|
1152 | + if (empty($per_page) || $per_page < 1) { |
|
1153 | + $per_page = $this->get_option('per_page', 'default'); |
|
1154 | + if ( ! $per_page) { |
|
1155 | 1155 | $per_page = 20; |
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | |
1159 | - if ( 'edit_comments_per_page' == $option ) { |
|
1160 | - $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|
1159 | + if ('edit_comments_per_page' == $option) { |
|
1160 | + $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; |
|
1161 | 1161 | |
1162 | 1162 | /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */ |
1163 | - $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); |
|
1164 | - } elseif ( 'categories_per_page' == $option ) { |
|
1163 | + $per_page = apply_filters('comments_per_page', $per_page, $comment_status); |
|
1164 | + } elseif ('categories_per_page' == $option) { |
|
1165 | 1165 | /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */ |
1166 | - $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|
1166 | + $per_page = apply_filters('edit_categories_per_page', $per_page); |
|
1167 | 1167 | } else { |
1168 | 1168 | /** This filter is documented in wp-admin/includes/class-wp-list-table.php */ |
1169 | - $per_page = apply_filters( "{$option}", $per_page ); |
|
1169 | + $per_page = apply_filters("{$option}", $per_page); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | // Back compat |
1173 | - if ( isset( $this->post_type ) ) { |
|
1173 | + if (isset($this->post_type)) { |
|
1174 | 1174 | /** This filter is documented in wp-admin/includes/post.php */ |
1175 | - $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); |
|
1175 | + $per_page = apply_filters('edit_posts_per_page', $per_page, $this->post_type); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | // This needs a submit button |
1179 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1179 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1180 | 1180 | |
1181 | 1181 | ?> |
1182 | 1182 | <fieldset class="screen-options"> |
1183 | - <legend><?php _e( 'Pagination' ); ?></legend> |
|
1184 | - <?php if ( $per_page_label ) : ?> |
|
1185 | - <label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label> |
|
1183 | + <legend><?php _e('Pagination'); ?></legend> |
|
1184 | + <?php if ($per_page_label) : ?> |
|
1185 | + <label for="<?php echo esc_attr($option); ?>"><?php echo $per_page_label; ?></label> |
|
1186 | 1186 | <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" |
1187 | - id="<?php echo esc_attr( $option ); ?>" maxlength="3" |
|
1188 | - value="<?php echo esc_attr( $per_page ); ?>" /> |
|
1187 | + id="<?php echo esc_attr($option); ?>" maxlength="3" |
|
1188 | + value="<?php echo esc_attr($per_page); ?>" /> |
|
1189 | 1189 | <?php endif; ?> |
1190 | - <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" /> |
|
1190 | + <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr($option); ?>" /> |
|
1191 | 1191 | </fieldset> |
1192 | 1192 | <?php |
1193 | 1193 | } |
@@ -1203,11 +1203,11 @@ discard block |
||
1203 | 1203 | $screen = get_current_screen(); |
1204 | 1204 | |
1205 | 1205 | // Currently only enabled for posts lists |
1206 | - if ( 'edit' !== $screen->base ) { |
|
1206 | + if ('edit' !== $screen->base) { |
|
1207 | 1207 | return; |
1208 | 1208 | } |
1209 | 1209 | |
1210 | - $view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) ); |
|
1210 | + $view_mode_post_types = get_post_types(array('hierarchical' => false, 'show_ui' => true)); |
|
1211 | 1211 | |
1212 | 1212 | /** |
1213 | 1213 | * Filters the post types that have different view mode options. |
@@ -1217,26 +1217,26 @@ discard block |
||
1217 | 1217 | * @param array $view_mode_post_types Array of post types that can change view modes. |
1218 | 1218 | * Default hierarchical post types with show_ui on. |
1219 | 1219 | */ |
1220 | - $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); |
|
1220 | + $view_mode_post_types = apply_filters('view_mode_post_types', $view_mode_post_types); |
|
1221 | 1221 | |
1222 | - if ( ! in_array( $this->post_type, $view_mode_post_types ) ) { |
|
1222 | + if ( ! in_array($this->post_type, $view_mode_post_types)) { |
|
1223 | 1223 | return; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | global $mode; |
1227 | 1227 | |
1228 | 1228 | // This needs a submit button |
1229 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1229 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1230 | 1230 | ?> |
1231 | 1231 | <fieldset class="metabox-prefs view-mode"> |
1232 | - <legend><?php _e( 'View Mode' ); ?></legend> |
|
1232 | + <legend><?php _e('View Mode'); ?></legend> |
|
1233 | 1233 | <label for="list-view-mode"> |
1234 | - <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> |
|
1235 | - <?php _e( 'List View' ); ?> |
|
1234 | + <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked('list', $mode); ?> /> |
|
1235 | + <?php _e('List View'); ?> |
|
1236 | 1236 | </label> |
1237 | 1237 | <label for="excerpt-view-mode"> |
1238 | - <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> /> |
|
1239 | - <?php _e( 'Excerpt View' ); ?> |
|
1238 | + <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked('excerpt', $mode); ?> /> |
|
1239 | + <?php _e('Excerpt View'); ?> |
|
1240 | 1240 | </label> |
1241 | 1241 | </fieldset> |
1242 | 1242 | <?php |
@@ -1250,11 +1250,11 @@ discard block |
||
1250 | 1250 | * @param string $key The screen reader text array named key. |
1251 | 1251 | * @param string $tag Optional. The HTML tag to wrap the screen reader text. Default h2. |
1252 | 1252 | */ |
1253 | - public function render_screen_reader_content( $key = '', $tag = 'h2' ) { |
|
1253 | + public function render_screen_reader_content($key = '', $tag = 'h2') { |
|
1254 | 1254 | |
1255 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
1255 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
1256 | 1256 | return; |
1257 | 1257 | } |
1258 | - echo "<$tag class='screen-reader-text'>" . $this->_screen_reader_content[ $key ] . "</$tag>"; |
|
1258 | + echo "<$tag class='screen-reader-text'>".$this->_screen_reader_content[$key]."</$tag>"; |
|
1259 | 1259 | } |
1260 | 1260 | } |
@@ -223,18 +223,20 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
227 | - $id = $hook_name; |
|
228 | - else |
|
229 | - $id = $GLOBALS['hook_suffix']; |
|
226 | + if ( $hook_name ) { |
|
227 | + $id = $hook_name; |
|
228 | + } else { |
|
229 | + $id = $GLOBALS['hook_suffix']; |
|
230 | + } |
|
230 | 231 | |
231 | 232 | // For those pesky meta boxes. |
232 | 233 | if ( $hook_name && post_type_exists( $hook_name ) ) { |
233 | 234 | $post_type = $id; |
234 | 235 | $id = 'post'; // changes later. ends up being $base. |
235 | 236 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
237 | + if ( '.php' == substr( $id, -4 ) ) { |
|
238 | + $id = substr( $id, 0, -4 ); |
|
239 | + } |
|
238 | 240 | |
239 | 241 | if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
240 | 242 | $id = substr( $id, 0, -4 ); |
@@ -263,50 +265,58 @@ discard block |
||
263 | 265 | } |
264 | 266 | } |
265 | 267 | |
266 | - if ( ! $in_admin ) |
|
267 | - $in_admin = 'site'; |
|
268 | + if ( ! $in_admin ) { |
|
269 | + $in_admin = 'site'; |
|
270 | + } |
|
268 | 271 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
270 | - $in_admin = 'network'; |
|
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
272 | - $in_admin = 'user'; |
|
273 | - else |
|
274 | - $in_admin = 'site'; |
|
272 | + if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) { |
|
273 | + $in_admin = 'network'; |
|
274 | + } elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) { |
|
275 | + $in_admin = 'user'; |
|
276 | + } else { |
|
277 | + $in_admin = 'site'; |
|
278 | + } |
|
275 | 279 | } |
276 | 280 | |
277 | - if ( 'index' == $id ) |
|
278 | - $id = 'dashboard'; |
|
279 | - elseif ( 'front' == $id ) |
|
280 | - $in_admin = false; |
|
281 | + if ( 'index' == $id ) { |
|
282 | + $id = 'dashboard'; |
|
283 | + } elseif ( 'front' == $id ) { |
|
284 | + $in_admin = false; |
|
285 | + } |
|
281 | 286 | |
282 | 287 | $base = $id; |
283 | 288 | |
284 | 289 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | 290 | if ( ! $hook_name ) { |
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
291 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
292 | + $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
293 | + } |
|
294 | + if ( isset( $_REQUEST['taxonomy'] ) ) { |
|
295 | + $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
296 | + } |
|
290 | 297 | |
291 | 298 | switch ( $base ) { |
292 | 299 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
294 | - $post_id = (int) $_GET['post']; |
|
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
296 | - $post_id = (int) $_POST['post_ID']; |
|
297 | - else |
|
298 | - $post_id = 0; |
|
300 | + if ( isset( $_GET['post'] ) ) { |
|
301 | + $post_id = (int) $_GET['post']; |
|
302 | + } elseif ( isset( $_POST['post_ID'] ) ) { |
|
303 | + $post_id = (int) $_POST['post_ID']; |
|
304 | + } else { |
|
305 | + $post_id = 0; |
|
306 | + } |
|
299 | 307 | |
300 | 308 | if ( $post_id ) { |
301 | 309 | $post = get_post( $post_id ); |
302 | - if ( $post ) |
|
303 | - $post_type = $post->post_type; |
|
310 | + if ( $post ) { |
|
311 | + $post_type = $post->post_type; |
|
312 | + } |
|
304 | 313 | } |
305 | 314 | break; |
306 | 315 | case 'edit-tags' : |
307 | 316 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
309 | - $post_type = 'post'; |
|
317 | + if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) { |
|
318 | + $post_type = 'post'; |
|
319 | + } |
|
310 | 320 | break; |
311 | 321 | case 'upload': |
312 | 322 | $post_type = 'attachment'; |
@@ -316,24 +326,28 @@ discard block |
||
316 | 326 | |
317 | 327 | switch ( $base ) { |
318 | 328 | case 'post' : |
319 | - if ( null === $post_type ) |
|
320 | - $post_type = 'post'; |
|
329 | + if ( null === $post_type ) { |
|
330 | + $post_type = 'post'; |
|
331 | + } |
|
321 | 332 | $id = $post_type; |
322 | 333 | break; |
323 | 334 | case 'edit' : |
324 | - if ( null === $post_type ) |
|
325 | - $post_type = 'post'; |
|
335 | + if ( null === $post_type ) { |
|
336 | + $post_type = 'post'; |
|
337 | + } |
|
326 | 338 | $id .= '-' . $post_type; |
327 | 339 | break; |
328 | 340 | case 'edit-tags' : |
329 | 341 | case 'term' : |
330 | - if ( null === $taxonomy ) |
|
331 | - $taxonomy = 'post_tag'; |
|
342 | + if ( null === $taxonomy ) { |
|
343 | + $taxonomy = 'post_tag'; |
|
344 | + } |
|
332 | 345 | // The edit-tags ID does not contain the post type. Look for it in the request. |
333 | 346 | if ( null === $post_type ) { |
334 | 347 | $post_type = 'post'; |
335 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
336 | - $post_type = $_REQUEST['post_type']; |
|
348 | + if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { |
|
349 | + $post_type = $_REQUEST['post_type']; |
|
350 | + } |
|
337 | 351 | } |
338 | 352 | |
339 | 353 | $id = 'edit-' . $taxonomy; |
@@ -350,8 +364,9 @@ discard block |
||
350 | 364 | |
351 | 365 | if ( isset( self::$_registry[ $id ] ) ) { |
352 | 366 | $screen = self::$_registry[ $id ]; |
353 | - if ( $screen === get_current_screen() ) |
|
354 | - return $screen; |
|
367 | + if ( $screen === get_current_screen() ) { |
|
368 | + return $screen; |
|
369 | + } |
|
355 | 370 | } else { |
356 | 371 | $screen = new WP_Screen(); |
357 | 372 | $screen->id = $id; |
@@ -414,8 +429,9 @@ discard block |
||
414 | 429 | * @return bool True if the screen is in the indicated admin, false otherwise. |
415 | 430 | */ |
416 | 431 | public function in_admin( $admin = null ) { |
417 | - if ( empty( $admin ) ) |
|
418 | - return (bool) $this->in_admin; |
|
432 | + if ( empty( $admin ) ) { |
|
433 | + return (bool) $this->in_admin; |
|
434 | + } |
|
419 | 435 | |
420 | 436 | return ( $admin == $this->in_admin ); |
421 | 437 | } |
@@ -503,11 +519,13 @@ discard block |
||
503 | 519 | * @return string The option value if set, null otherwise. |
504 | 520 | */ |
505 | 521 | public function get_option( $option, $key = false ) { |
506 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
507 | - return null; |
|
522 | + if ( ! isset( $this->_options[ $option ] ) ) { |
|
523 | + return null; |
|
524 | + } |
|
508 | 525 | if ( $key ) { |
509 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
510 | - return $this->_options[ $option ][ $key ]; |
|
526 | + if ( isset( $this->_options[ $option ][ $key ] ) ) { |
|
527 | + return $this->_options[ $option ][ $key ]; |
|
528 | + } |
|
511 | 529 | return null; |
512 | 530 | } |
513 | 531 | return $this->_options[ $option ]; |
@@ -554,8 +572,9 @@ discard block |
||
554 | 572 | * @return array Help tab arguments. |
555 | 573 | */ |
556 | 574 | public function get_help_tab( $id ) { |
557 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
558 | - return null; |
|
575 | + if ( ! isset( $this->_help_tabs[ $id ] ) ) { |
|
576 | + return null; |
|
577 | + } |
|
559 | 578 | return $this->_help_tabs[ $id ]; |
560 | 579 | } |
561 | 580 | |
@@ -589,8 +608,9 @@ discard block |
||
589 | 608 | $args['id'] = sanitize_html_class( $args['id'] ); |
590 | 609 | |
591 | 610 | // Ensure we have an ID and title. |
592 | - if ( ! $args['id'] || ! $args['title'] ) |
|
593 | - return; |
|
611 | + if ( ! $args['id'] || ! $args['title'] ) { |
|
612 | + return; |
|
613 | + } |
|
594 | 614 | |
595 | 615 | // Allows for overriding an existing tab with that ID. |
596 | 616 | $this->_help_tabs[ $args['id'] ] = $args; |
@@ -772,8 +792,9 @@ discard block |
||
772 | 792 | * @param string $old_help_default Default contextual help text. |
773 | 793 | */ |
774 | 794 | $default_help = apply_filters( 'default_contextual_help', '' ); |
775 | - if ( $default_help ) |
|
776 | - $old_help = '<p>' . $default_help . '</p>'; |
|
795 | + if ( $default_help ) { |
|
796 | + $old_help = '<p>' . $default_help . '</p>'; |
|
797 | + } |
|
777 | 798 | } |
778 | 799 | |
779 | 800 | if ( $old_help ) { |
@@ -787,8 +808,9 @@ discard block |
||
787 | 808 | $help_sidebar = $this->get_help_sidebar(); |
788 | 809 | |
789 | 810 | $help_class = 'hidden'; |
790 | - if ( ! $help_sidebar ) |
|
791 | - $help_class .= ' no-sidebar'; |
|
811 | + if ( ! $help_sidebar ) { |
|
812 | + $help_class .= ' no-sidebar'; |
|
813 | + } |
|
792 | 814 | |
793 | 815 | // Time to render! |
794 | 816 | ?> |
@@ -837,8 +859,9 @@ discard block |
||
837 | 859 | echo $tab['content']; |
838 | 860 | |
839 | 861 | // If it exists, fire tab callback. |
840 | - if ( ! empty( $tab['callback'] ) ) |
|
841 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
862 | + if ( ! empty( $tab['callback'] ) ) { |
|
863 | + call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
864 | + } |
|
842 | 865 | ?> |
843 | 866 | </div> |
844 | 867 | <?php |
@@ -865,25 +888,29 @@ discard block |
||
865 | 888 | */ |
866 | 889 | $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
867 | 890 | |
868 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
869 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
891 | + if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) { |
|
892 | + $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
893 | + } |
|
870 | 894 | |
871 | 895 | if ( $this->get_option( 'layout_columns' ) ) { |
872 | 896 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
873 | 897 | |
874 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
875 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
898 | + if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) { |
|
899 | + $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
900 | + } |
|
876 | 901 | } |
877 | 902 | $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
878 | 903 | |
879 | 904 | // Add screen options |
880 | - if ( $this->show_screen_options() ) |
|
881 | - $this->render_screen_options(); |
|
905 | + if ( $this->show_screen_options() ) { |
|
906 | + $this->render_screen_options(); |
|
907 | + } |
|
882 | 908 | ?> |
883 | 909 | </div> |
884 | 910 | <?php |
885 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
886 | - return; |
|
911 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) { |
|
912 | + return; |
|
913 | + } |
|
887 | 914 | ?> |
888 | 915 | <div id="screen-meta-links"> |
889 | 916 | <?php if ( $this->get_help_tabs() ) : ?> |
@@ -909,8 +936,9 @@ discard block |
||
909 | 936 | public function show_screen_options() { |
910 | 937 | global $wp_meta_boxes; |
911 | 938 | |
912 | - if ( is_bool( $this->_show_screen_options ) ) |
|
913 | - return $this->_show_screen_options; |
|
939 | + if ( is_bool( $this->_show_screen_options ) ) { |
|
940 | + return $this->_show_screen_options; |
|
941 | + } |
|
914 | 942 | |
915 | 943 | $columns = get_column_headers( $this ); |
916 | 944 | |
@@ -945,8 +973,9 @@ discard block |
||
945 | 973 | */ |
946 | 974 | $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
947 | 975 | |
948 | - if ( $this->_screen_settings || $this->_options ) |
|
949 | - $show_screen = true; |
|
976 | + if ( $this->_screen_settings || $this->_options ) { |
|
977 | + $show_screen = true; |
|
978 | + } |
|
950 | 979 | |
951 | 980 | /** |
952 | 981 | * Filters whether to show the Screen Options tab. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param string $hook_suffix The current admin page. |
30 | 30 | */ |
31 | - public static function enqueue_scripts( $hook_suffix ) { |
|
31 | + public static function enqueue_scripts($hook_suffix) { |
|
32 | 32 | /* |
33 | 33 | * Register feature pointers |
34 | 34 | * |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
50 | + if (empty($registered_pointers[$hook_suffix])) |
|
51 | 51 | return; |
52 | 52 | |
53 | - $pointers = (array) $registered_pointers[ $hook_suffix ]; |
|
53 | + $pointers = (array) $registered_pointers[$hook_suffix]; |
|
54 | 54 | |
55 | 55 | /* |
56 | 56 | * Specify required capabilities for feature pointers |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | // Get dismissed pointers |
73 | - $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); |
|
73 | + $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)); |
|
74 | 74 | |
75 | 75 | $got_pointers = false; |
76 | - foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
|
77 | - if ( isset( $caps_required[ $pointer ] ) ) { |
|
78 | - foreach ( $caps_required[ $pointer ] as $cap ) { |
|
79 | - if ( ! current_user_can( $cap ) ) |
|
76 | + foreach (array_diff($pointers, $dismissed) as $pointer) { |
|
77 | + if (isset($caps_required[$pointer])) { |
|
78 | + foreach ($caps_required[$pointer] as $cap) { |
|
79 | + if ( ! current_user_can($cap)) |
|
80 | 80 | continue 2; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | // Bind pointer print function |
85 | - add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); |
|
85 | + add_action('admin_print_footer_scripts', array('WP_Internal_Pointers', 'pointer_'.$pointer)); |
|
86 | 86 | $got_pointers = true; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! $got_pointers ) |
|
89 | + if ( ! $got_pointers) |
|
90 | 90 | return; |
91 | 91 | |
92 | 92 | // Add pointers script and style to queue |
93 | - wp_enqueue_style( 'wp-pointer' ); |
|
94 | - wp_enqueue_script( 'wp-pointer' ); |
|
93 | + wp_enqueue_style('wp-pointer'); |
|
94 | + wp_enqueue_script('wp-pointer'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param string $selector The HTML elements, on which the pointer should be attached. |
106 | 106 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 107 | */ |
108 | - private static function print_js( $pointer_id, $selector, $args ) { |
|
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
108 | + private static function print_js($pointer_id, $selector, $args) { |
|
109 | + if (empty($pointer_id) || empty($selector) || empty($args) || empty($args['content'])) |
|
110 | 110 | return; |
111 | 111 | |
112 | 112 | ?> |
113 | 113 | <script type="text/javascript"> |
114 | 114 | (function($){ |
115 | - var options = <?php echo wp_json_encode( $args ); ?>, setup; |
|
115 | + var options = <?php echo wp_json_encode($args); ?>, setup; |
|
116 | 116 | |
117 | 117 | if ( ! options ) |
118 | 118 | return; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param int $user_id User ID. |
162 | 162 | */ |
163 | - public static function dismiss_pointers_for_new_users( $user_id ) { |
|
164 | - add_user_meta( $user_id, 'dismissed_wp_pointers', '' ); |
|
163 | + public static function dismiss_pointers_for_new_users($user_id) { |
|
164 | + add_user_meta($user_id, 'dismissed_wp_pointers', ''); |
|
165 | 165 | } |
166 | 166 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
51 | - return; |
|
50 | + if ( empty( $registered_pointers[ $hook_suffix ] ) ) { |
|
51 | + return; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | $pointers = (array) $registered_pointers[ $hook_suffix ]; |
54 | 55 | |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
77 | 78 | if ( isset( $caps_required[ $pointer ] ) ) { |
78 | 79 | foreach ( $caps_required[ $pointer ] as $cap ) { |
79 | - if ( ! current_user_can( $cap ) ) |
|
80 | - continue 2; |
|
80 | + if ( ! current_user_can( $cap ) ) { |
|
81 | + continue 2; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | } |
83 | 85 | |
@@ -86,8 +88,9 @@ discard block |
||
86 | 88 | $got_pointers = true; |
87 | 89 | } |
88 | 90 | |
89 | - if ( ! $got_pointers ) |
|
90 | - return; |
|
91 | + if ( ! $got_pointers ) { |
|
92 | + return; |
|
93 | + } |
|
91 | 94 | |
92 | 95 | // Add pointers script and style to queue |
93 | 96 | wp_enqueue_style( 'wp-pointer' ); |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 110 | */ |
108 | 111 | private static function print_js( $pointer_id, $selector, $args ) { |
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
110 | - return; |
|
112 | + if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) { |
|
113 | + return; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | ?> |
113 | 117 | <script type="text/javascript"> |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param array $fields |
20 | 20 | */ |
21 | - public function __construct( $fields = false ) { |
|
22 | - if ( $fields ) { |
|
21 | + public function __construct($fields = false) { |
|
22 | + if ($fields) { |
|
23 | 23 | $this->db_fields = $fields; |
24 | 24 | } |
25 | 25 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param int $depth Depth of page. Used for padding. |
36 | 36 | * @param array $args Not used. |
37 | 37 | */ |
38 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
39 | - $indent = str_repeat( "\t", $depth ); |
|
38 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
39 | + $indent = str_repeat("\t", $depth); |
|
40 | 40 | $output .= "\n$indent<ul class='children'>\n"; |
41 | 41 | } |
42 | 42 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param int $depth Depth of page. Used for padding. |
52 | 52 | * @param array $args Not used. |
53 | 53 | */ |
54 | - public function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
55 | - $indent = str_repeat( "\t", $depth ); |
|
54 | + public function end_lvl(&$output, $depth = 0, $args = array()) { |
|
55 | + $indent = str_repeat("\t", $depth); |
|
56 | 56 | $output .= "\n$indent</ul>"; |
57 | 57 | } |
58 | 58 | |
@@ -71,47 +71,47 @@ discard block |
||
71 | 71 | * @param array $args Not used. |
72 | 72 | * @param int $id Not used. |
73 | 73 | */ |
74 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
74 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
75 | 75 | global $_nav_menu_placeholder; |
76 | 76 | |
77 | - $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; |
|
78 | - $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
|
79 | - $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; |
|
77 | + $_nav_menu_placeholder = (0 > $_nav_menu_placeholder) ? intval($_nav_menu_placeholder) - 1 : -1; |
|
78 | + $possible_object_id = isset($item->post_type) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
|
79 | + $possible_db_id = ( ! empty($item->ID)) && (0 < $possible_object_id) ? (int) $item->ID : 0; |
|
80 | 80 | |
81 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
81 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
82 | 82 | |
83 | - $output .= $indent . '<li>'; |
|
83 | + $output .= $indent.'<li>'; |
|
84 | 84 | $output .= '<label class="menu-item-title">'; |
85 | 85 | $output .= '<input type="checkbox" class="menu-item-checkbox'; |
86 | 86 | |
87 | - if ( ! empty( $item->front_or_home ) ) |
|
87 | + if ( ! empty($item->front_or_home)) |
|
88 | 88 | $output .= ' add-to-top'; |
89 | 89 | |
90 | - $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; |
|
90 | + $output .= '" name="menu-item['.$possible_object_id.'][menu-item-object-id]" value="'.esc_attr($item->object_id).'" /> '; |
|
91 | 91 | |
92 | - if ( ! empty( $item->label ) ) { |
|
92 | + if ( ! empty($item->label)) { |
|
93 | 93 | $title = $item->label; |
94 | - } elseif ( isset( $item->post_type ) ) { |
|
94 | + } elseif (isset($item->post_type)) { |
|
95 | 95 | /** This filter is documented in wp-includes/post-template.php */ |
96 | - $title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
|
97 | - if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) |
|
98 | - $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
96 | + $title = apply_filters('the_title', $item->post_title, $item->ID); |
|
97 | + if ( ! empty($item->front_or_home) && _x('Home', 'nav menu home label') !== $title) |
|
98 | + $title = sprintf(_x('Home: %s', 'nav menu front page title'), $title); |
|
99 | 99 | } |
100 | 100 | |
101 | - $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); |
|
101 | + $output .= isset($title) ? esc_html($title) : esc_html($item->title); |
|
102 | 102 | $output .= '</label>'; |
103 | 103 | |
104 | 104 | // Menu item hidden fields |
105 | - $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; |
|
106 | - $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />'; |
|
107 | - $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />'; |
|
108 | - $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />'; |
|
109 | - $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />'; |
|
110 | - $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />'; |
|
111 | - $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; |
|
112 | - $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; |
|
113 | - $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; |
|
114 | - $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />'; |
|
105 | + $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item['.$possible_object_id.'][menu-item-db-id]" value="'.$possible_db_id.'" />'; |
|
106 | + $output .= '<input type="hidden" class="menu-item-object" name="menu-item['.$possible_object_id.'][menu-item-object]" value="'.esc_attr($item->object).'" />'; |
|
107 | + $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item['.$possible_object_id.'][menu-item-parent-id]" value="'.esc_attr($item->menu_item_parent).'" />'; |
|
108 | + $output .= '<input type="hidden" class="menu-item-type" name="menu-item['.$possible_object_id.'][menu-item-type]" value="'.esc_attr($item->type).'" />'; |
|
109 | + $output .= '<input type="hidden" class="menu-item-title" name="menu-item['.$possible_object_id.'][menu-item-title]" value="'.esc_attr($item->title).'" />'; |
|
110 | + $output .= '<input type="hidden" class="menu-item-url" name="menu-item['.$possible_object_id.'][menu-item-url]" value="'.esc_attr($item->url).'" />'; |
|
111 | + $output .= '<input type="hidden" class="menu-item-target" name="menu-item['.$possible_object_id.'][menu-item-target]" value="'.esc_attr($item->target).'" />'; |
|
112 | + $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item['.$possible_object_id.'][menu-item-attr_title]" value="'.esc_attr($item->attr_title).'" />'; |
|
113 | + $output .= '<input type="hidden" class="menu-item-classes" name="menu-item['.$possible_object_id.'][menu-item-classes]" value="'.esc_attr(implode(' ', $item->classes)).'" />'; |
|
114 | + $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item['.$possible_object_id.'][menu-item-xfn]" value="'.esc_attr($item->xfn).'" />'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } // Walker_Nav_Menu_Checklist |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | $output .= '<label class="menu-item-title">'; |
85 | 85 | $output .= '<input type="checkbox" class="menu-item-checkbox'; |
86 | 86 | |
87 | - if ( ! empty( $item->front_or_home ) ) |
|
88 | - $output .= ' add-to-top'; |
|
87 | + if ( ! empty( $item->front_or_home ) ) { |
|
88 | + $output .= ' add-to-top'; |
|
89 | + } |
|
89 | 90 | |
90 | 91 | $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; |
91 | 92 | |
@@ -94,8 +95,9 @@ discard block |
||
94 | 95 | } elseif ( isset( $item->post_type ) ) { |
95 | 96 | /** This filter is documented in wp-includes/post-template.php */ |
96 | 97 | $title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
97 | - if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) |
|
98 | - $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
98 | + if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) { |
|
99 | + $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
100 | + } |
|
99 | 101 | } |
100 | 102 | |
101 | 103 | $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); |