@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | <script type="text/javascript"> |
37 | 37 | jQuery(document).ready(function($){ |
38 | 38 | var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(), |
39 | - homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
|
39 | + homeURL = ( <?php echo wp_json_encode(get_home_url()); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
|
40 | 40 | |
41 | 41 | $( '#blogname' ).on( 'input', function() { |
42 | 42 | var title = $.trim( $( this ).val() ) || homeURL; |
@@ -136,6 +136,6 @@ discard block |
||
136 | 136 | * @since 3.5.0 |
137 | 137 | */ |
138 | 138 | function options_reading_blog_charset() { |
139 | - echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />'; |
|
140 | - echo '<p class="description">' . __( 'The <a href="https://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>'; |
|
139 | + echo '<input name="blog_charset" type="text" id="blog_charset" value="'.esc_attr(get_option('blog_charset')).'" class="regular-text" />'; |
|
140 | + echo '<p class="description">'.__('The <a href="https://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)').'</p>'; |
|
141 | 141 | } |
@@ -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' : '-'); |
@@ -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; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Used to trigger a success message when settings updated and set to true. |
45 | - * |
|
45 | + * |
|
46 | 46 | * @since 3.0.0 |
47 | 47 | * @access private |
48 | 48 | * @var bool |
@@ -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 |
@@ -28,13 +28,15 @@ |
||
28 | 28 | ) { |
29 | 29 | $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" ); |
30 | 30 | |
31 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
32 | - return false; |
|
31 | + if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
32 | + return false; |
|
33 | + } |
|
33 | 34 | |
34 | 35 | $results = json_decode( wp_remote_retrieve_body( $response ), true ); |
35 | 36 | |
36 | - if ( ! is_array( $results ) ) |
|
37 | - return false; |
|
37 | + if ( ! is_array( $results ) ) { |
|
38 | + return false; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); |
40 | 42 | } |
@@ -15,26 +15,26 @@ discard block |
||
15 | 15 | * @return array|false A list of all of the contributors, or false on error. |
16 | 16 | */ |
17 | 17 | function wp_credits() { |
18 | - $wp_version = get_bloginfo( 'version' ); |
|
18 | + $wp_version = get_bloginfo('version'); |
|
19 | 19 | $locale = get_user_locale(); |
20 | 20 | |
21 | - $results = get_site_transient( 'wordpress_credits_' . $locale ); |
|
21 | + $results = get_site_transient('wordpress_credits_'.$locale); |
|
22 | 22 | |
23 | - if ( ! is_array( $results ) |
|
24 | - || false !== strpos( $wp_version, '-' ) |
|
25 | - || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 ) |
|
23 | + if ( ! is_array($results) |
|
24 | + || false !== strpos($wp_version, '-') |
|
25 | + || (isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) |
|
26 | 26 | ) { |
27 | - $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}" ); |
|
27 | + $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}"); |
|
28 | 28 | |
29 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
29 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) |
|
30 | 30 | return false; |
31 | 31 | |
32 | - $results = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
32 | + $results = json_decode(wp_remote_retrieve_body($response), true); |
|
33 | 33 | |
34 | - if ( ! is_array( $results ) ) |
|
34 | + if ( ! is_array($results)) |
|
35 | 35 | return false; |
36 | 36 | |
37 | - set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); |
|
37 | + set_site_transient('wordpress_credits_'.$locale, $results, DAY_IN_SECONDS); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $results; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param string $username The contributor's username. |
51 | 51 | * @param string $profiles URL to the contributor's WordPress.org profile page. |
52 | 52 | */ |
53 | -function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { |
|
54 | - $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; |
|
53 | +function _wp_credits_add_profile_link(&$display_name, $username, $profiles) { |
|
54 | + $display_name = '<a href="'.esc_url(sprintf($profiles, $username)).'">'.esc_html($display_name).'</a>'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -62,6 +62,6 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param string $data External library data, passed by reference. |
64 | 64 | */ |
65 | -function _wp_credits_build_object_link( &$data ) { |
|
66 | - $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>'; |
|
65 | +function _wp_credits_build_object_link(&$data) { |
|
66 | + $data = '<a href="'.esc_url($data[1]).'">'.esc_html($data[0]).'</a>'; |
|
67 | 67 | } |
@@ -65,8 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) { |
67 | 67 | $ptype = get_post_type_object( $args['content'] ); |
68 | - if ( ! $ptype->can_export ) |
|
69 | - $args['content'] = 'post'; |
|
68 | + if ( ! $ptype->can_export ) { |
|
69 | + $args['content'] = 'post'; |
|
70 | + } |
|
70 | 71 | |
71 | 72 | $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); |
72 | 73 | } else { |
@@ -75,10 +76,11 @@ discard block |
||
75 | 76 | $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ); |
76 | 77 | } |
77 | 78 | |
78 | - if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) |
|
79 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); |
|
80 | - else |
|
81 | - $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; |
|
79 | + if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) { |
|
80 | + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); |
|
81 | + } else { |
|
82 | + $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; |
|
83 | + } |
|
82 | 84 | |
83 | 85 | $join = ''; |
84 | 86 | if ( $args['category'] && 'post' == $args['content'] ) { |
@@ -89,14 +91,17 @@ discard block |
||
89 | 91 | } |
90 | 92 | |
91 | 93 | if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) { |
92 | - if ( $args['author'] ) |
|
93 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); |
|
94 | + if ( $args['author'] ) { |
|
95 | + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); |
|
96 | + } |
|
94 | 97 | |
95 | - if ( $args['start_date'] ) |
|
96 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) ); |
|
98 | + if ( $args['start_date'] ) { |
|
99 | + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) ); |
|
100 | + } |
|
97 | 101 | |
98 | - if ( $args['end_date'] ) |
|
99 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); |
|
102 | + if ( $args['end_date'] ) { |
|
103 | + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); |
|
104 | + } |
|
100 | 105 | } |
101 | 106 | |
102 | 107 | // Grab a snapshot of post IDs, just in case it changes during the export. |
@@ -120,18 +125,20 @@ discard block |
||
120 | 125 | |
121 | 126 | // Put categories in order with no child going before its parent. |
122 | 127 | while ( $cat = array_shift( $categories ) ) { |
123 | - if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) |
|
124 | - $cats[$cat->term_id] = $cat; |
|
125 | - else |
|
126 | - $categories[] = $cat; |
|
128 | + if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) { |
|
129 | + $cats[$cat->term_id] = $cat; |
|
130 | + } else { |
|
131 | + $categories[] = $cat; |
|
132 | + } |
|
127 | 133 | } |
128 | 134 | |
129 | 135 | // Put terms in order with no child going before its parent. |
130 | 136 | while ( $t = array_shift( $custom_terms ) ) { |
131 | - if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) |
|
132 | - $terms[$t->term_id] = $t; |
|
133 | - else |
|
134 | - $custom_terms[] = $t; |
|
137 | + if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) { |
|
138 | + $terms[$t->term_id] = $t; |
|
139 | + } else { |
|
140 | + $custom_terms[] = $t; |
|
141 | + } |
|
135 | 142 | } |
136 | 143 | |
137 | 144 | unset( $categories, $custom_taxonomies, $custom_terms ); |
@@ -164,11 +171,13 @@ discard block |
||
164 | 171 | */ |
165 | 172 | function wxr_site_url() { |
166 | 173 | // Multisite: the base URL. |
167 | - if ( is_multisite() ) |
|
168 | - return network_home_url(); |
|
174 | + if ( is_multisite() ) { |
|
175 | + return network_home_url(); |
|
176 | + } |
|
169 | 177 | // WordPress (single site): the blog URL. |
170 | - else |
|
171 | - return get_bloginfo_rss( 'url' ); |
|
178 | + else { |
|
179 | + return get_bloginfo_rss( 'url' ); |
|
180 | + } |
|
172 | 181 | } |
173 | 182 | |
174 | 183 | /** |
@@ -179,8 +188,9 @@ discard block |
||
179 | 188 | * @param object $category Category Object |
180 | 189 | */ |
181 | 190 | function wxr_cat_name( $category ) { |
182 | - if ( empty( $category->name ) ) |
|
183 | - return; |
|
191 | + if ( empty( $category->name ) ) { |
|
192 | + return; |
|
193 | + } |
|
184 | 194 | |
185 | 195 | echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>'; |
186 | 196 | } |
@@ -193,8 +203,9 @@ discard block |
||
193 | 203 | * @param object $category Category Object |
194 | 204 | */ |
195 | 205 | function wxr_category_description( $category ) { |
196 | - if ( empty( $category->description ) ) |
|
197 | - return; |
|
206 | + if ( empty( $category->description ) ) { |
|
207 | + return; |
|
208 | + } |
|
198 | 209 | |
199 | 210 | echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>'; |
200 | 211 | } |
@@ -207,8 +218,9 @@ discard block |
||
207 | 218 | * @param object $tag Tag Object |
208 | 219 | */ |
209 | 220 | function wxr_tag_name( $tag ) { |
210 | - if ( empty( $tag->name ) ) |
|
211 | - return; |
|
221 | + if ( empty( $tag->name ) ) { |
|
222 | + return; |
|
223 | + } |
|
212 | 224 | |
213 | 225 | echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>'; |
214 | 226 | } |
@@ -221,8 +233,9 @@ discard block |
||
221 | 233 | * @param object $tag Tag Object |
222 | 234 | */ |
223 | 235 | function wxr_tag_description( $tag ) { |
224 | - if ( empty( $tag->description ) ) |
|
225 | - return; |
|
236 | + if ( empty( $tag->description ) ) { |
|
237 | + return; |
|
238 | + } |
|
226 | 239 | |
227 | 240 | echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>'; |
228 | 241 | } |
@@ -235,8 +248,9 @@ discard block |
||
235 | 248 | * @param object $term Term Object |
236 | 249 | */ |
237 | 250 | function wxr_term_name( $term ) { |
238 | - if ( empty( $term->name ) ) |
|
239 | - return; |
|
251 | + if ( empty( $term->name ) ) { |
|
252 | + return; |
|
253 | + } |
|
240 | 254 | |
241 | 255 | echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>'; |
242 | 256 | } |
@@ -249,8 +263,9 @@ discard block |
||
249 | 263 | * @param object $term Term Object |
250 | 264 | */ |
251 | 265 | function wxr_term_description( $term ) { |
252 | - if ( empty( $term->description ) ) |
|
253 | - return; |
|
266 | + if ( empty( $term->description ) ) { |
|
267 | + return; |
|
268 | + } |
|
254 | 269 | |
255 | 270 | echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>'; |
256 | 271 | } |
@@ -276,8 +291,9 @@ discard block |
||
276 | 291 | |
277 | 292 | $authors = array(); |
278 | 293 | $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" ); |
279 | - foreach ( (array) $results as $result ) |
|
280 | - $authors[] = get_userdata( $result->post_author ); |
|
294 | + foreach ( (array) $results as $result ) { |
|
295 | + $authors[] = get_userdata( $result->post_author ); |
|
296 | + } |
|
281 | 297 | |
282 | 298 | $authors = array_filter( $authors ); |
283 | 299 | |
@@ -300,8 +316,9 @@ discard block |
||
300 | 316 | */ |
301 | 317 | function wxr_nav_menu_terms() { |
302 | 318 | $nav_menus = wp_get_nav_menus(); |
303 | - if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) |
|
304 | - return; |
|
319 | + if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) { |
|
320 | + return; |
|
321 | + } |
|
305 | 322 | |
306 | 323 | foreach ( $nav_menus as $menu ) { |
307 | 324 | echo "\t<wp:term>"; |
@@ -322,8 +339,9 @@ discard block |
||
322 | 339 | $post = get_post(); |
323 | 340 | |
324 | 341 | $taxonomies = get_object_taxonomies( $post->post_type ); |
325 | - if ( empty( $taxonomies ) ) |
|
326 | - return; |
|
342 | + if ( empty( $taxonomies ) ) { |
|
343 | + return; |
|
344 | + } |
|
327 | 345 | $terms = wp_get_object_terms( $post->ID, $taxonomies ); |
328 | 346 | |
329 | 347 | foreach ( (array) $terms as $term ) { |
@@ -338,8 +356,9 @@ discard block |
||
338 | 356 | * @return bool |
339 | 357 | */ |
340 | 358 | function wxr_filter_postmeta( $return_me, $meta_key ) { |
341 | - if ( '_edit_lock' == $meta_key ) |
|
342 | - $return_me = true; |
|
359 | + if ( '_edit_lock' == $meta_key ) { |
|
360 | + $return_me = true; |
|
361 | + } |
|
343 | 362 | return $return_me; |
344 | 363 | } |
345 | 364 | add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 ); |
@@ -394,7 +413,10 @@ discard block |
||
394 | 413 | <?php foreach ( $terms as $t ) : ?> |
395 | 414 | <wp:term><wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id><wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy><wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug><wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term> |
396 | 415 | <?php endforeach; ?> |
397 | -<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?> |
|
416 | +<?php if ( 'all' == $args['content'] ) { |
|
417 | + wxr_nav_menu_terms(); |
|
418 | +} |
|
419 | +?> |
|
398 | 420 | |
399 | 421 | <?php |
400 | 422 | /** This action is documented in wp-includes/feed-rss2.php */ |
@@ -480,8 +502,9 @@ discard block |
||
480 | 502 | * @param string $meta_key Current meta key. |
481 | 503 | * @param object $meta Current meta object. |
482 | 504 | */ |
483 | - if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) |
|
484 | - continue; |
|
505 | + if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { |
|
506 | + continue; |
|
507 | + } |
|
485 | 508 | ?> |
486 | 509 | <wp:postmeta> |
487 | 510 | <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @since 2.5.0 |
15 | 15 | */ |
16 | -define( 'WXR_VERSION', '1.2' ); |
|
16 | +define('WXR_VERSION', '1.2'); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Generates the WXR export file for download. |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @param array $args Filters defining what should be included in the export. |
27 | 27 | */ |
28 | -function export_wp( $args = array() ) { |
|
28 | +function export_wp($args = array()) { |
|
29 | 29 | global $wpdb, $post; |
30 | 30 | |
31 | - $defaults = array( 'content' => 'all', 'author' => false, 'category' => false, |
|
31 | + $defaults = array('content' => 'all', 'author' => false, 'category' => false, |
|
32 | 32 | 'start_date' => false, 'end_date' => false, 'status' => false, |
33 | 33 | ); |
34 | - $args = wp_parse_args( $args, $defaults ); |
|
34 | + $args = wp_parse_args($args, $defaults); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Fires at the beginning of an export, before any headers are sent. |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $args An array of export arguments. |
42 | 42 | */ |
43 | - do_action( 'export_wp', $args ); |
|
43 | + do_action('export_wp', $args); |
|
44 | 44 | |
45 | - $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
46 | - if ( ! empty( $sitename ) ) { |
|
45 | + $sitename = sanitize_key(get_bloginfo('name')); |
|
46 | + if ( ! empty($sitename)) { |
|
47 | 47 | $sitename .= '.'; |
48 | 48 | } |
49 | - $date = date( 'Y-m-d' ); |
|
50 | - $wp_filename = $sitename . 'wordpress.' . $date . '.xml'; |
|
49 | + $date = date('Y-m-d'); |
|
50 | + $wp_filename = $sitename.'wordpress.'.$date.'.xml'; |
|
51 | 51 | /** |
52 | 52 | * Filters the export filename. |
53 | 53 | * |
@@ -57,84 +57,84 @@ discard block |
||
57 | 57 | * @param string $sitename The site name. |
58 | 58 | * @param string $date Today's date, formatted. |
59 | 59 | */ |
60 | - $filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date ); |
|
60 | + $filename = apply_filters('export_wp_filename', $wp_filename, $sitename, $date); |
|
61 | 61 | |
62 | - header( 'Content-Description: File Transfer' ); |
|
63 | - header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
64 | - header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
62 | + header('Content-Description: File Transfer'); |
|
63 | + header('Content-Disposition: attachment; filename='.$filename); |
|
64 | + header('Content-Type: text/xml; charset='.get_option('blog_charset'), true); |
|
65 | 65 | |
66 | - if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) { |
|
67 | - $ptype = get_post_type_object( $args['content'] ); |
|
68 | - if ( ! $ptype->can_export ) |
|
66 | + if ('all' != $args['content'] && post_type_exists($args['content'])) { |
|
67 | + $ptype = get_post_type_object($args['content']); |
|
68 | + if ( ! $ptype->can_export) |
|
69 | 69 | $args['content'] = 'post'; |
70 | 70 | |
71 | - $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); |
|
71 | + $where = $wpdb->prepare("{$wpdb->posts}.post_type = %s", $args['content']); |
|
72 | 72 | } else { |
73 | - $post_types = get_post_types( array( 'can_export' => true ) ); |
|
74 | - $esses = array_fill( 0, count($post_types), '%s' ); |
|
75 | - $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ); |
|
73 | + $post_types = get_post_types(array('can_export' => true)); |
|
74 | + $esses = array_fill(0, count($post_types), '%s'); |
|
75 | + $where = $wpdb->prepare("{$wpdb->posts}.post_type IN (".implode(',', $esses).')', $post_types); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) |
|
79 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); |
|
78 | + if ($args['status'] && ('post' == $args['content'] || 'page' == $args['content'])) |
|
79 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_status = %s", $args['status']); |
|
80 | 80 | else |
81 | 81 | $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; |
82 | 82 | |
83 | 83 | $join = ''; |
84 | - if ( $args['category'] && 'post' == $args['content'] ) { |
|
85 | - if ( $term = term_exists( $args['category'], 'category' ) ) { |
|
84 | + if ($args['category'] && 'post' == $args['content']) { |
|
85 | + if ($term = term_exists($args['category'], 'category')) { |
|
86 | 86 | $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)"; |
87 | - $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] ); |
|
87 | + $where .= $wpdb->prepare(" AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id']); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) { |
|
92 | - if ( $args['author'] ) |
|
93 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); |
|
91 | + if ('post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content']) { |
|
92 | + if ($args['author']) |
|
93 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_author = %d", $args['author']); |
|
94 | 94 | |
95 | - if ( $args['start_date'] ) |
|
96 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) ); |
|
95 | + if ($args['start_date']) |
|
96 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date >= %s", date('Y-m-d', strtotime($args['start_date']))); |
|
97 | 97 | |
98 | - if ( $args['end_date'] ) |
|
99 | - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); |
|
98 | + if ($args['end_date']) |
|
99 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date < %s", date('Y-m-d', strtotime('+1 month', strtotime($args['end_date'])))); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | // Grab a snapshot of post IDs, just in case it changes during the export. |
103 | - $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ); |
|
103 | + $post_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} $join WHERE $where"); |
|
104 | 104 | |
105 | 105 | /* |
106 | 106 | * Get the requested terms ready, empty unless posts filtered by category |
107 | 107 | * or all content. |
108 | 108 | */ |
109 | 109 | $cats = $tags = $terms = array(); |
110 | - if ( isset( $term ) && $term ) { |
|
111 | - $cat = get_term( $term['term_id'], 'category' ); |
|
112 | - $cats = array( $cat->term_id => $cat ); |
|
113 | - unset( $term, $cat ); |
|
114 | - } elseif ( 'all' == $args['content'] ) { |
|
115 | - $categories = (array) get_categories( array( 'get' => 'all' ) ); |
|
116 | - $tags = (array) get_tags( array( 'get' => 'all' ) ); |
|
110 | + if (isset($term) && $term) { |
|
111 | + $cat = get_term($term['term_id'], 'category'); |
|
112 | + $cats = array($cat->term_id => $cat); |
|
113 | + unset($term, $cat); |
|
114 | + } elseif ('all' == $args['content']) { |
|
115 | + $categories = (array) get_categories(array('get' => 'all')); |
|
116 | + $tags = (array) get_tags(array('get' => 'all')); |
|
117 | 117 | |
118 | - $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) ); |
|
119 | - $custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) ); |
|
118 | + $custom_taxonomies = get_taxonomies(array('_builtin' => false)); |
|
119 | + $custom_terms = (array) get_terms($custom_taxonomies, array('get' => 'all')); |
|
120 | 120 | |
121 | 121 | // Put categories in order with no child going before its parent. |
122 | - while ( $cat = array_shift( $categories ) ) { |
|
123 | - if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) |
|
122 | + while ($cat = array_shift($categories)) { |
|
123 | + if ($cat->parent == 0 || isset($cats[$cat->parent])) |
|
124 | 124 | $cats[$cat->term_id] = $cat; |
125 | 125 | else |
126 | 126 | $categories[] = $cat; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Put terms in order with no child going before its parent. |
130 | - while ( $t = array_shift( $custom_terms ) ) { |
|
131 | - if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) |
|
130 | + while ($t = array_shift($custom_terms)) { |
|
131 | + if ($t->parent == 0 || isset($terms[$t->parent])) |
|
132 | 132 | $terms[$t->term_id] = $t; |
133 | 133 | else |
134 | 134 | $custom_terms[] = $t; |
135 | 135 | } |
136 | 136 | |
137 | - unset( $categories, $custom_taxonomies, $custom_terms ); |
|
137 | + unset($categories, $custom_taxonomies, $custom_terms); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param string $str String to wrap in XML CDATA tag. |
146 | 146 | * @return string |
147 | 147 | */ |
148 | - function wxr_cdata( $str ) { |
|
149 | - if ( ! seems_utf8( $str ) ) { |
|
150 | - $str = utf8_encode( $str ); |
|
148 | + function wxr_cdata($str) { |
|
149 | + if ( ! seems_utf8($str)) { |
|
150 | + $str = utf8_encode($str); |
|
151 | 151 | } |
152 | 152 | // $str = ent2ncr(esc_html($str)); |
153 | - $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>'; |
|
153 | + $str = '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $str).']]>'; |
|
154 | 154 | |
155 | 155 | return $str; |
156 | 156 | } |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function wxr_site_url() { |
166 | 166 | // Multisite: the base URL. |
167 | - if ( is_multisite() ) |
|
167 | + if (is_multisite()) |
|
168 | 168 | return network_home_url(); |
169 | 169 | // WordPress (single site): the blog URL. |
170 | 170 | else |
171 | - return get_bloginfo_rss( 'url' ); |
|
171 | + return get_bloginfo_rss('url'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param object $category Category Object |
180 | 180 | */ |
181 | - function wxr_cat_name( $category ) { |
|
182 | - if ( empty( $category->name ) ) |
|
181 | + function wxr_cat_name($category) { |
|
182 | + if (empty($category->name)) |
|
183 | 183 | return; |
184 | 184 | |
185 | - echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n"; |
|
185 | + echo '<wp:cat_name>'.wxr_cdata($category->name)."</wp:cat_name>\n"; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param object $category Category Object |
194 | 194 | */ |
195 | - function wxr_category_description( $category ) { |
|
196 | - if ( empty( $category->description ) ) |
|
195 | + function wxr_category_description($category) { |
|
196 | + if (empty($category->description)) |
|
197 | 197 | return; |
198 | 198 | |
199 | - echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n"; |
|
199 | + echo '<wp:category_description>'.wxr_cdata($category->description)."</wp:category_description>\n"; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param object $tag Tag Object |
208 | 208 | */ |
209 | - function wxr_tag_name( $tag ) { |
|
210 | - if ( empty( $tag->name ) ) |
|
209 | + function wxr_tag_name($tag) { |
|
210 | + if (empty($tag->name)) |
|
211 | 211 | return; |
212 | 212 | |
213 | - echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n"; |
|
213 | + echo '<wp:tag_name>'.wxr_cdata($tag->name)."</wp:tag_name>\n"; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param object $tag Tag Object |
222 | 222 | */ |
223 | - function wxr_tag_description( $tag ) { |
|
224 | - if ( empty( $tag->description ) ) |
|
223 | + function wxr_tag_description($tag) { |
|
224 | + if (empty($tag->description)) |
|
225 | 225 | return; |
226 | 226 | |
227 | - echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n"; |
|
227 | + echo '<wp:tag_description>'.wxr_cdata($tag->description)."</wp:tag_description>\n"; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param object $term Term Object |
236 | 236 | */ |
237 | - function wxr_term_name( $term ) { |
|
238 | - if ( empty( $term->name ) ) |
|
237 | + function wxr_term_name($term) { |
|
238 | + if (empty($term->name)) |
|
239 | 239 | return; |
240 | 240 | |
241 | - echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n"; |
|
241 | + echo '<wp:term_name>'.wxr_cdata($term->name)."</wp:term_name>\n"; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param object $term Term Object |
250 | 250 | */ |
251 | - function wxr_term_description( $term ) { |
|
252 | - if ( empty( $term->description ) ) |
|
251 | + function wxr_term_description($term) { |
|
252 | + if (empty($term->description)) |
|
253 | 253 | return; |
254 | 254 | |
255 | - echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n"; |
|
255 | + echo "\t\t<wp:term_description>".wxr_cdata($term->description)."</wp:term_description>\n"; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @param WP_Term $term Term object. |
264 | 264 | */ |
265 | - function wxr_term_meta( $term ) { |
|
265 | + function wxr_term_meta($term) { |
|
266 | 266 | global $wpdb; |
267 | 267 | |
268 | - $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); |
|
268 | + $termmeta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id)); |
|
269 | 269 | |
270 | - foreach ( $termmeta as $meta ) { |
|
270 | + foreach ($termmeta as $meta) { |
|
271 | 271 | /** |
272 | 272 | * Filters whether to selectively skip term meta used for WXR exports. |
273 | 273 | * |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | * @param string $meta_key Current meta key. |
281 | 281 | * @param object $meta Current meta object. |
282 | 282 | */ |
283 | - if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { |
|
284 | - printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); |
|
283 | + if ( ! apply_filters('wxr_export_skip_termmeta', false, $meta->meta_key, $meta)) { |
|
284 | + printf("\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata($meta->meta_key), wxr_cdata($meta->meta_value)); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
@@ -295,31 +295,31 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param array $post_ids Array of post IDs to filter the query by. Optional. |
297 | 297 | */ |
298 | - function wxr_authors_list( array $post_ids = null ) { |
|
298 | + function wxr_authors_list(array $post_ids = null) { |
|
299 | 299 | global $wpdb; |
300 | 300 | |
301 | - if ( !empty( $post_ids ) ) { |
|
302 | - $post_ids = array_map( 'absint', $post_ids ); |
|
303 | - $and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')'; |
|
301 | + if ( ! empty($post_ids)) { |
|
302 | + $post_ids = array_map('absint', $post_ids); |
|
303 | + $and = 'AND ID IN ( '.implode(', ', $post_ids).')'; |
|
304 | 304 | } else { |
305 | 305 | $and = ''; |
306 | 306 | } |
307 | 307 | |
308 | 308 | $authors = array(); |
309 | - $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" ); |
|
310 | - foreach ( (array) $results as $result ) |
|
311 | - $authors[] = get_userdata( $result->post_author ); |
|
309 | + $results = $wpdb->get_results("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and"); |
|
310 | + foreach ((array) $results as $result) |
|
311 | + $authors[] = get_userdata($result->post_author); |
|
312 | 312 | |
313 | - $authors = array_filter( $authors ); |
|
313 | + $authors = array_filter($authors); |
|
314 | 314 | |
315 | - foreach ( $authors as $author ) { |
|
315 | + foreach ($authors as $author) { |
|
316 | 316 | echo "\t<wp:author>"; |
317 | - echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>'; |
|
318 | - echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>'; |
|
319 | - echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>'; |
|
320 | - echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; |
|
321 | - echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>'; |
|
322 | - echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>'; |
|
317 | + echo '<wp:author_id>'.intval($author->ID).'</wp:author_id>'; |
|
318 | + echo '<wp:author_login>'.wxr_cdata($author->user_login).'</wp:author_login>'; |
|
319 | + echo '<wp:author_email>'.wxr_cdata($author->user_email).'</wp:author_email>'; |
|
320 | + echo '<wp:author_display_name>'.wxr_cdata($author->display_name).'</wp:author_display_name>'; |
|
321 | + echo '<wp:author_first_name>'.wxr_cdata($author->first_name).'</wp:author_first_name>'; |
|
322 | + echo '<wp:author_last_name>'.wxr_cdata($author->last_name).'</wp:author_last_name>'; |
|
323 | 323 | echo "</wp:author>\n"; |
324 | 324 | } |
325 | 325 | } |
@@ -331,15 +331,15 @@ discard block |
||
331 | 331 | */ |
332 | 332 | function wxr_nav_menu_terms() { |
333 | 333 | $nav_menus = wp_get_nav_menus(); |
334 | - if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) |
|
334 | + if (empty($nav_menus) || ! is_array($nav_menus)) |
|
335 | 335 | return; |
336 | 336 | |
337 | - foreach ( $nav_menus as $menu ) { |
|
337 | + foreach ($nav_menus as $menu) { |
|
338 | 338 | echo "\t<wp:term>"; |
339 | - echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>'; |
|
339 | + echo '<wp:term_id>'.intval($menu->term_id).'</wp:term_id>'; |
|
340 | 340 | echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>'; |
341 | - echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>'; |
|
342 | - wxr_term_name( $menu ); |
|
341 | + echo '<wp:term_slug>'.wxr_cdata($menu->slug).'</wp:term_slug>'; |
|
342 | + wxr_term_name($menu); |
|
343 | 343 | echo "</wp:term>\n"; |
344 | 344 | } |
345 | 345 | } |
@@ -352,13 +352,13 @@ discard block |
||
352 | 352 | function wxr_post_taxonomy() { |
353 | 353 | $post = get_post(); |
354 | 354 | |
355 | - $taxonomies = get_object_taxonomies( $post->post_type ); |
|
356 | - if ( empty( $taxonomies ) ) |
|
355 | + $taxonomies = get_object_taxonomies($post->post_type); |
|
356 | + if (empty($taxonomies)) |
|
357 | 357 | return; |
358 | - $terms = wp_get_object_terms( $post->ID, $taxonomies ); |
|
358 | + $terms = wp_get_object_terms($post->ID, $taxonomies); |
|
359 | 359 | |
360 | - foreach ( (array) $terms as $term ) { |
|
361 | - echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n"; |
|
360 | + foreach ((array) $terms as $term) { |
|
361 | + echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">".wxr_cdata($term->name)."</category>\n"; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | * @param string $meta_key |
369 | 369 | * @return bool |
370 | 370 | */ |
371 | - function wxr_filter_postmeta( $return_me, $meta_key ) { |
|
372 | - if ( '_edit_lock' == $meta_key ) |
|
371 | + function wxr_filter_postmeta($return_me, $meta_key) { |
|
372 | + if ('_edit_lock' == $meta_key) |
|
373 | 373 | $return_me = true; |
374 | 374 | return $return_me; |
375 | 375 | } |
376 | - add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 ); |
|
376 | + add_filter('wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2); |
|
377 | 377 | |
378 | - echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n"; |
|
378 | + echo '<?xml version="1.0" encoding="'.get_bloginfo('charset')."\" ?>\n"; |
|
379 | 379 | |
380 | 380 | ?> |
381 | 381 | <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. --> |
396 | 396 | <!-- contained in this file into your site. --> |
397 | 397 | |
398 | -<?php the_generator( 'export' ); ?> |
|
398 | +<?php the_generator('export'); ?> |
|
399 | 399 | <rss version="2.0" |
400 | 400 | xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/" |
401 | 401 | xmlns:content="http://purl.org/rss/1.0/modules/content/" |
@@ -405,55 +405,55 @@ discard block |
||
405 | 405 | > |
406 | 406 | |
407 | 407 | <channel> |
408 | - <title><?php bloginfo_rss( 'name' ); ?></title> |
|
409 | - <link><?php bloginfo_rss( 'url' ); ?></link> |
|
410 | - <description><?php bloginfo_rss( 'description' ); ?></description> |
|
411 | - <pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate> |
|
412 | - <language><?php bloginfo_rss( 'language' ); ?></language> |
|
408 | + <title><?php bloginfo_rss('name'); ?></title> |
|
409 | + <link><?php bloginfo_rss('url'); ?></link> |
|
410 | + <description><?php bloginfo_rss('description'); ?></description> |
|
411 | + <pubDate><?php echo date('D, d M Y H:i:s +0000'); ?></pubDate> |
|
412 | + <language><?php bloginfo_rss('language'); ?></language> |
|
413 | 413 | <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version> |
414 | 414 | <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url> |
415 | - <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url> |
|
415 | + <wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url> |
|
416 | 416 | |
417 | -<?php wxr_authors_list( $post_ids ); ?> |
|
417 | +<?php wxr_authors_list($post_ids); ?> |
|
418 | 418 | |
419 | -<?php foreach ( $cats as $c ) : ?> |
|
419 | +<?php foreach ($cats as $c) : ?> |
|
420 | 420 | <wp:category> |
421 | - <wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id> |
|
422 | - <wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename> |
|
423 | - <wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[$c->parent]->slug : '' ); ?></wp:category_parent> |
|
424 | - <?php wxr_cat_name( $c ); |
|
425 | - wxr_category_description( $c ); |
|
426 | - wxr_term_meta( $c ); ?> |
|
421 | + <wp:term_id><?php echo intval($c->term_id); ?></wp:term_id> |
|
422 | + <wp:category_nicename><?php echo wxr_cdata($c->slug); ?></wp:category_nicename> |
|
423 | + <wp:category_parent><?php echo wxr_cdata($c->parent ? $cats[$c->parent]->slug : ''); ?></wp:category_parent> |
|
424 | + <?php wxr_cat_name($c); |
|
425 | + wxr_category_description($c); |
|
426 | + wxr_term_meta($c); ?> |
|
427 | 427 | </wp:category> |
428 | 428 | <?php endforeach; ?> |
429 | -<?php foreach ( $tags as $t ) : ?> |
|
429 | +<?php foreach ($tags as $t) : ?> |
|
430 | 430 | <wp:tag> |
431 | - <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> |
|
432 | - <wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug> |
|
433 | - <?php wxr_tag_name( $t ); |
|
434 | - wxr_tag_description( $t ); |
|
435 | - wxr_term_meta( $t ); ?> |
|
431 | + <wp:term_id><?php echo intval($t->term_id); ?></wp:term_id> |
|
432 | + <wp:tag_slug><?php echo wxr_cdata($t->slug); ?></wp:tag_slug> |
|
433 | + <?php wxr_tag_name($t); |
|
434 | + wxr_tag_description($t); |
|
435 | + wxr_term_meta($t); ?> |
|
436 | 436 | </wp:tag> |
437 | 437 | <?php endforeach; ?> |
438 | -<?php foreach ( $terms as $t ) : ?> |
|
438 | +<?php foreach ($terms as $t) : ?> |
|
439 | 439 | <wp:term> |
440 | - <wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id> |
|
441 | - <wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy> |
|
442 | - <wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug> |
|
443 | - <wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent> |
|
444 | - <?php wxr_term_name( $t ); |
|
445 | - wxr_term_description( $t ); |
|
446 | - wxr_term_meta( $t ); ?> |
|
440 | + <wp:term_id><?php echo wxr_cdata($t->term_id); ?></wp:term_id> |
|
441 | + <wp:term_taxonomy><?php echo wxr_cdata($t->taxonomy); ?></wp:term_taxonomy> |
|
442 | + <wp:term_slug><?php echo wxr_cdata($t->slug); ?></wp:term_slug> |
|
443 | + <wp:term_parent><?php echo wxr_cdata($t->parent ? $terms[$t->parent]->slug : ''); ?></wp:term_parent> |
|
444 | + <?php wxr_term_name($t); |
|
445 | + wxr_term_description($t); |
|
446 | + wxr_term_meta($t); ?> |
|
447 | 447 | </wp:term> |
448 | 448 | <?php endforeach; ?> |
449 | -<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?> |
|
449 | +<?php if ('all' == $args['content']) wxr_nav_menu_terms(); ?> |
|
450 | 450 | |
451 | 451 | <?php |
452 | 452 | /** This action is documented in wp-includes/feed-rss2.php */ |
453 | - do_action( 'rss2_head' ); |
|
453 | + do_action('rss2_head'); |
|
454 | 454 | ?> |
455 | 455 | |
456 | -<?php if ( $post_ids ) { |
|
456 | +<?php if ($post_ids) { |
|
457 | 457 | /** |
458 | 458 | * @global WP_Query $wp_query |
459 | 459 | */ |
@@ -463,23 +463,23 @@ discard block |
||
463 | 463 | $wp_query->in_the_loop = true; |
464 | 464 | |
465 | 465 | // Fetch 20 posts at a time rather than loading the entire table into memory. |
466 | - while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { |
|
467 | - $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')'; |
|
468 | - $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); |
|
466 | + while ($next_posts = array_splice($post_ids, 0, 20)) { |
|
467 | + $where = 'WHERE ID IN ('.join(',', $next_posts).')'; |
|
468 | + $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} $where"); |
|
469 | 469 | |
470 | 470 | // Begin Loop. |
471 | - foreach ( $posts as $post ) { |
|
472 | - setup_postdata( $post ); |
|
473 | - $is_sticky = is_sticky( $post->ID ) ? 1 : 0; |
|
471 | + foreach ($posts as $post) { |
|
472 | + setup_postdata($post); |
|
473 | + $is_sticky = is_sticky($post->ID) ? 1 : 0; |
|
474 | 474 | ?> |
475 | 475 | <item> |
476 | 476 | <title><?php |
477 | 477 | /** This filter is documented in wp-includes/feed.php */ |
478 | - echo apply_filters( 'the_title_rss', $post->post_title ); |
|
478 | + echo apply_filters('the_title_rss', $post->post_title); |
|
479 | 479 | ?></title> |
480 | 480 | <link><?php the_permalink_rss() ?></link> |
481 | - <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> |
|
482 | - <dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator> |
|
481 | + <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate> |
|
482 | + <dc:creator><?php echo wxr_cdata(get_the_author_meta('login')); ?></dc:creator> |
|
483 | 483 | <guid isPermaLink="false"><?php the_guid(); ?></guid> |
484 | 484 | <description></description> |
485 | 485 | <content:encoded><?php |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @param string $post_content Content of the current post. |
492 | 492 | */ |
493 | - echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); |
|
493 | + echo wxr_cdata(apply_filters('the_content_export', $post->post_content)); |
|
494 | 494 | ?></content:encoded> |
495 | 495 | <excerpt:encoded><?php |
496 | 496 | /** |
@@ -500,26 +500,26 @@ discard block |
||
500 | 500 | * |
501 | 501 | * @param string $post_excerpt Excerpt for the current post. |
502 | 502 | */ |
503 | - echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); |
|
503 | + echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt)); |
|
504 | 504 | ?></excerpt:encoded> |
505 | - <wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id> |
|
506 | - <wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date> |
|
507 | - <wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt> |
|
508 | - <wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status> |
|
509 | - <wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status> |
|
510 | - <wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name> |
|
511 | - <wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status> |
|
512 | - <wp:post_parent><?php echo intval( $post->post_parent ); ?></wp:post_parent> |
|
513 | - <wp:menu_order><?php echo intval( $post->menu_order ); ?></wp:menu_order> |
|
514 | - <wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type> |
|
515 | - <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password> |
|
516 | - <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky> |
|
517 | -<?php if ( $post->post_type == 'attachment' ) : ?> |
|
518 | - <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url> |
|
505 | + <wp:post_id><?php echo intval($post->ID); ?></wp:post_id> |
|
506 | + <wp:post_date><?php echo wxr_cdata($post->post_date); ?></wp:post_date> |
|
507 | + <wp:post_date_gmt><?php echo wxr_cdata($post->post_date_gmt); ?></wp:post_date_gmt> |
|
508 | + <wp:comment_status><?php echo wxr_cdata($post->comment_status); ?></wp:comment_status> |
|
509 | + <wp:ping_status><?php echo wxr_cdata($post->ping_status); ?></wp:ping_status> |
|
510 | + <wp:post_name><?php echo wxr_cdata($post->post_name); ?></wp:post_name> |
|
511 | + <wp:status><?php echo wxr_cdata($post->post_status); ?></wp:status> |
|
512 | + <wp:post_parent><?php echo intval($post->post_parent); ?></wp:post_parent> |
|
513 | + <wp:menu_order><?php echo intval($post->menu_order); ?></wp:menu_order> |
|
514 | + <wp:post_type><?php echo wxr_cdata($post->post_type); ?></wp:post_type> |
|
515 | + <wp:post_password><?php echo wxr_cdata($post->post_password); ?></wp:post_password> |
|
516 | + <wp:is_sticky><?php echo intval($is_sticky); ?></wp:is_sticky> |
|
517 | +<?php if ($post->post_type == 'attachment') : ?> |
|
518 | + <wp:attachment_url><?php echo wxr_cdata(wp_get_attachment_url($post->ID)); ?></wp:attachment_url> |
|
519 | 519 | <?php endif; ?> |
520 | 520 | <?php wxr_post_taxonomy(); ?> |
521 | -<?php $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); |
|
522 | - foreach ( $postmeta as $meta ) : |
|
521 | +<?php $postmeta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID)); |
|
522 | + foreach ($postmeta as $meta) : |
|
523 | 523 | /** |
524 | 524 | * Filters whether to selectively skip post meta used for WXR exports. |
525 | 525 | * |
@@ -532,33 +532,33 @@ discard block |
||
532 | 532 | * @param string $meta_key Current meta key. |
533 | 533 | * @param object $meta Current meta object. |
534 | 534 | */ |
535 | - if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) |
|
535 | + if (apply_filters('wxr_export_skip_postmeta', false, $meta->meta_key, $meta)) |
|
536 | 536 | continue; |
537 | 537 | ?> |
538 | 538 | <wp:postmeta> |
539 | - <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key> |
|
540 | - <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value> |
|
539 | + <wp:meta_key><?php echo wxr_cdata($meta->meta_key); ?></wp:meta_key> |
|
540 | + <wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value> |
|
541 | 541 | </wp:postmeta> |
542 | 542 | <?php endforeach; |
543 | 543 | |
544 | - $_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); |
|
545 | - $comments = array_map( 'get_comment', $_comments ); |
|
546 | - foreach ( $comments as $c ) : ?> |
|
544 | + $_comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID)); |
|
545 | + $comments = array_map('get_comment', $_comments); |
|
546 | + foreach ($comments as $c) : ?> |
|
547 | 547 | <wp:comment> |
548 | - <wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id> |
|
549 | - <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author> |
|
550 | - <wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email> |
|
551 | - <wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url> |
|
552 | - <wp:comment_author_IP><?php echo wxr_cdata( $c->comment_author_IP ); ?></wp:comment_author_IP> |
|
553 | - <wp:comment_date><?php echo wxr_cdata( $c->comment_date ); ?></wp:comment_date> |
|
554 | - <wp:comment_date_gmt><?php echo wxr_cdata( $c->comment_date_gmt ); ?></wp:comment_date_gmt> |
|
555 | - <wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content> |
|
556 | - <wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved> |
|
557 | - <wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type> |
|
558 | - <wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent> |
|
559 | - <wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id> |
|
560 | -<?php $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); |
|
561 | - foreach ( $c_meta as $meta ) : |
|
548 | + <wp:comment_id><?php echo intval($c->comment_ID); ?></wp:comment_id> |
|
549 | + <wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author> |
|
550 | + <wp:comment_author_email><?php echo wxr_cdata($c->comment_author_email); ?></wp:comment_author_email> |
|
551 | + <wp:comment_author_url><?php echo esc_url_raw($c->comment_author_url); ?></wp:comment_author_url> |
|
552 | + <wp:comment_author_IP><?php echo wxr_cdata($c->comment_author_IP); ?></wp:comment_author_IP> |
|
553 | + <wp:comment_date><?php echo wxr_cdata($c->comment_date); ?></wp:comment_date> |
|
554 | + <wp:comment_date_gmt><?php echo wxr_cdata($c->comment_date_gmt); ?></wp:comment_date_gmt> |
|
555 | + <wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content> |
|
556 | + <wp:comment_approved><?php echo wxr_cdata($c->comment_approved); ?></wp:comment_approved> |
|
557 | + <wp:comment_type><?php echo wxr_cdata($c->comment_type); ?></wp:comment_type> |
|
558 | + <wp:comment_parent><?php echo intval($c->comment_parent); ?></wp:comment_parent> |
|
559 | + <wp:comment_user_id><?php echo intval($c->user_id); ?></wp:comment_user_id> |
|
560 | +<?php $c_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID)); |
|
561 | + foreach ($c_meta as $meta) : |
|
562 | 562 | /** |
563 | 563 | * Filters whether to selectively skip comment meta used for WXR exports. |
564 | 564 | * |
@@ -571,13 +571,13 @@ discard block |
||
571 | 571 | * @param string $meta_key Current meta key. |
572 | 572 | * @param object $meta Current meta object. |
573 | 573 | */ |
574 | - if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) { |
|
574 | + if (apply_filters('wxr_export_skip_commentmeta', false, $meta->meta_key, $meta)) { |
|
575 | 575 | continue; |
576 | 576 | } |
577 | 577 | ?> |
578 | 578 | <wp:commentmeta> |
579 | - <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key> |
|
580 | - <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value> |
|
579 | + <wp:meta_key><?php echo wxr_cdata($meta->meta_key); ?></wp:meta_key> |
|
580 | + <wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value> |
|
581 | 581 | </wp:commentmeta> |
582 | 582 | <?php endforeach; ?> |
583 | 583 | </wp:comment> |
@@ -73,8 +73,9 @@ discard block |
||
73 | 73 | $original_title = ''; |
74 | 74 | if ( 'taxonomy' == $item->type ) { |
75 | 75 | $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); |
76 | - if ( is_wp_error( $original_title ) ) |
|
77 | - $original_title = false; |
|
76 | + if ( is_wp_error( $original_title ) ) { |
|
77 | + $original_title = false; |
|
78 | + } |
|
78 | 79 | } elseif ( 'post_type' == $item->type ) { |
79 | 80 | $original_object = get_post( $item->object_id ); |
80 | 81 | $original_title = get_the_title( $original_object->ID ); |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; |
107 | 108 | |
108 | 109 | $submenu_text = ''; |
109 | - if ( 0 == $depth ) |
|
110 | - $submenu_text = 'style="display: none;"'; |
|
110 | + if ( 0 == $depth ) { |
|
111 | + $submenu_text = 'style="display: none;"'; |
|
112 | + } |
|
111 | 113 | |
112 | 114 | ?> |
113 | 115 | <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param int $depth Depth of menu item. Used for padding. |
27 | 27 | * @param array $args Not used. |
28 | 28 | */ |
29 | - public function start_lvl( &$output, $depth = 0, $args = array() ) {} |
|
29 | + public function start_lvl(&$output, $depth = 0, $args = array()) {} |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Ends the list of after the elements are added. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param int $depth Depth of menu item. Used for padding. |
40 | 40 | * @param array $args Not used. |
41 | 41 | */ |
42 | - public function end_lvl( &$output, $depth = 0, $args = array() ) {} |
|
42 | + public function end_lvl(&$output, $depth = 0, $args = array()) {} |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Start the element output. |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * @param array $args Not used. |
56 | 56 | * @param int $id Not used. |
57 | 57 | */ |
58 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
58 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
59 | 59 | global $_wp_nav_menu_max_depth; |
60 | 60 | $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; |
61 | 61 | |
62 | 62 | ob_start(); |
63 | - $item_id = esc_attr( $item->ID ); |
|
63 | + $item_id = esc_attr($item->ID); |
|
64 | 64 | $removed_args = array( |
65 | 65 | 'action', |
66 | 66 | 'customlink-tab', |
@@ -71,51 +71,51 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $original_title = false; |
74 | - if ( 'taxonomy' == $item->type ) { |
|
75 | - $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); |
|
76 | - if ( is_wp_error( $original_title ) ) |
|
74 | + if ('taxonomy' == $item->type) { |
|
75 | + $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); |
|
76 | + if (is_wp_error($original_title)) |
|
77 | 77 | $original_title = false; |
78 | - } elseif ( 'post_type' == $item->type ) { |
|
79 | - $original_object = get_post( $item->object_id ); |
|
80 | - $original_title = get_the_title( $original_object->ID ); |
|
81 | - } elseif ( 'post_type_archive' == $item->type ) { |
|
82 | - $original_object = get_post_type_object( $item->object ); |
|
83 | - if ( $original_object ) { |
|
78 | + } elseif ('post_type' == $item->type) { |
|
79 | + $original_object = get_post($item->object_id); |
|
80 | + $original_title = get_the_title($original_object->ID); |
|
81 | + } elseif ('post_type_archive' == $item->type) { |
|
82 | + $original_object = get_post_type_object($item->object); |
|
83 | + if ($original_object) { |
|
84 | 84 | $original_title = $original_object->labels->archives; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | $classes = array( |
89 | - 'menu-item menu-item-depth-' . $depth, |
|
90 | - 'menu-item-' . esc_attr( $item->object ), |
|
91 | - 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), |
|
89 | + 'menu-item menu-item-depth-'.$depth, |
|
90 | + 'menu-item-'.esc_attr($item->object), |
|
91 | + 'menu-item-edit-'.((isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item']) ? 'active' : 'inactive'), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | $title = $item->title; |
95 | 95 | |
96 | - if ( ! empty( $item->_invalid ) ) { |
|
96 | + if ( ! empty($item->_invalid)) { |
|
97 | 97 | $classes[] = 'menu-item-invalid'; |
98 | 98 | /* translators: %s: title of menu item which is invalid */ |
99 | - $title = sprintf( __( '%s (Invalid)' ), $item->title ); |
|
100 | - } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { |
|
99 | + $title = sprintf(__('%s (Invalid)'), $item->title); |
|
100 | + } elseif (isset($item->post_status) && 'draft' == $item->post_status) { |
|
101 | 101 | $classes[] = 'pending'; |
102 | 102 | /* translators: %s: title of menu item in draft status */ |
103 | - $title = sprintf( __('%s (Pending)'), $item->title ); |
|
103 | + $title = sprintf(__('%s (Pending)'), $item->title); |
|
104 | 104 | } |
105 | 105 | |
106 | - $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; |
|
106 | + $title = ( ! isset($item->label) || '' == $item->label) ? $title : $item->label; |
|
107 | 107 | |
108 | 108 | $submenu_text = ''; |
109 | - if ( 0 == $depth ) |
|
109 | + if (0 == $depth) |
|
110 | 110 | $submenu_text = 'style="display: none;"'; |
111 | 111 | |
112 | 112 | ?> |
113 | - <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>"> |
|
113 | + <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes); ?>"> |
|
114 | 114 | <div class="menu-item-bar"> |
115 | 115 | <div class="menu-item-handle"> |
116 | - <span class="item-title"><span class="menu-item-title"><?php echo esc_html( $title ); ?></span> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span> |
|
116 | + <span class="item-title"><span class="menu-item-title"><?php echo esc_html($title); ?></span> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e('sub item'); ?></span></span> |
|
117 | 117 | <span class="item-controls"> |
118 | - <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span> |
|
118 | + <span class="item-type"><?php echo esc_html($item->type_label); ?></span> |
|
119 | 119 | <span class="item-order hide-if-js"> |
120 | 120 | <a href="<?php |
121 | 121 | echo wp_nonce_url( |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | 'action' => 'move-up-menu-item', |
125 | 125 | 'menu-item' => $item_id, |
126 | 126 | ), |
127 | - remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) |
|
127 | + remove_query_arg($removed_args, admin_url('nav-menus.php')) |
|
128 | 128 | ), |
129 | 129 | 'move-menu_item' |
130 | 130 | ); |
131 | - ?>" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up' ) ?>">↑</a> |
|
131 | + ?>" class="item-move-up" aria-label="<?php esc_attr_e('Move up') ?>">↑</a> |
|
132 | 132 | | |
133 | 133 | <a href="<?php |
134 | 134 | echo wp_nonce_url( |
@@ -137,79 +137,79 @@ discard block |
||
137 | 137 | 'action' => 'move-down-menu-item', |
138 | 138 | 'menu-item' => $item_id, |
139 | 139 | ), |
140 | - remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) |
|
140 | + remove_query_arg($removed_args, admin_url('nav-menus.php')) |
|
141 | 141 | ), |
142 | 142 | 'move-menu_item' |
143 | 143 | ); |
144 | - ?>" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down' ) ?>">↓</a> |
|
144 | + ?>" class="item-move-down" aria-label="<?php esc_attr_e('Move down') ?>">↓</a> |
|
145 | 145 | </span> |
146 | 146 | <a class="item-edit" id="edit-<?php echo $item_id; ?>" href="<?php |
147 | - echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ); |
|
148 | - ?>" aria-label="<?php esc_attr_e( 'Edit menu item' ); ?>"><?php _e( 'Edit' ); ?></a> |
|
147 | + echo (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item']) ? admin_url('nav-menus.php') : add_query_arg('edit-menu-item', $item_id, remove_query_arg($removed_args, admin_url('nav-menus.php#menu-item-settings-'.$item_id))); |
|
148 | + ?>" aria-label="<?php esc_attr_e('Edit menu item'); ?>"><?php _e('Edit'); ?></a> |
|
149 | 149 | </span> |
150 | 150 | </div> |
151 | 151 | </div> |
152 | 152 | |
153 | 153 | <div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>"> |
154 | - <?php if ( 'custom' == $item->type ) : ?> |
|
154 | + <?php if ('custom' == $item->type) : ?> |
|
155 | 155 | <p class="field-url description description-wide"> |
156 | 156 | <label for="edit-menu-item-url-<?php echo $item_id; ?>"> |
157 | - <?php _e( 'URL' ); ?><br /> |
|
158 | - <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" /> |
|
157 | + <?php _e('URL'); ?><br /> |
|
158 | + <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->url); ?>" /> |
|
159 | 159 | </label> |
160 | 160 | </p> |
161 | 161 | <?php endif; ?> |
162 | 162 | <p class="description description-wide"> |
163 | 163 | <label for="edit-menu-item-title-<?php echo $item_id; ?>"> |
164 | - <?php _e( 'Navigation Label' ); ?><br /> |
|
165 | - <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" /> |
|
164 | + <?php _e('Navigation Label'); ?><br /> |
|
165 | + <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->title); ?>" /> |
|
166 | 166 | </label> |
167 | 167 | </p> |
168 | 168 | <p class="field-title-attribute field-attr-title description description-wide"> |
169 | 169 | <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>"> |
170 | - <?php _e( 'Title Attribute' ); ?><br /> |
|
171 | - <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>" /> |
|
170 | + <?php _e('Title Attribute'); ?><br /> |
|
171 | + <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->post_excerpt); ?>" /> |
|
172 | 172 | </label> |
173 | 173 | </p> |
174 | 174 | <p class="field-link-target description"> |
175 | 175 | <label for="edit-menu-item-target-<?php echo $item_id; ?>"> |
176 | - <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $item->target, '_blank' ); ?> /> |
|
177 | - <?php _e( 'Open link in a new tab' ); ?> |
|
176 | + <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked($item->target, '_blank'); ?> /> |
|
177 | + <?php _e('Open link in a new tab'); ?> |
|
178 | 178 | </label> |
179 | 179 | </p> |
180 | 180 | <p class="field-css-classes description description-thin"> |
181 | 181 | <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> |
182 | - <?php _e( 'CSS Classes (optional)' ); ?><br /> |
|
183 | - <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" /> |
|
182 | + <?php _e('CSS Classes (optional)'); ?><br /> |
|
183 | + <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr(implode(' ', $item->classes)); ?>" /> |
|
184 | 184 | </label> |
185 | 185 | </p> |
186 | 186 | <p class="field-xfn description description-thin"> |
187 | 187 | <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> |
188 | - <?php _e( 'Link Relationship (XFN)' ); ?><br /> |
|
189 | - <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" /> |
|
188 | + <?php _e('Link Relationship (XFN)'); ?><br /> |
|
189 | + <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->xfn); ?>" /> |
|
190 | 190 | </label> |
191 | 191 | </p> |
192 | 192 | <p class="field-description description description-wide"> |
193 | 193 | <label for="edit-menu-item-description-<?php echo $item_id; ?>"> |
194 | - <?php _e( 'Description' ); ?><br /> |
|
195 | - <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); // textarea_escaped ?></textarea> |
|
194 | + <?php _e('Description'); ?><br /> |
|
195 | + <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html($item->description); // textarea_escaped ?></textarea> |
|
196 | 196 | <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span> |
197 | 197 | </label> |
198 | 198 | </p> |
199 | 199 | |
200 | 200 | <fieldset class="field-move hide-if-no-js description description-wide"> |
201 | - <span class="field-move-visual-label" aria-hidden="true"><?php _e( 'Move' ); ?></span> |
|
202 | - <button type="button" class="button-link menus-move menus-move-up" data-dir="up"><?php _e( 'Up one' ); ?></button> |
|
203 | - <button type="button" class="button-link menus-move menus-move-down" data-dir="down"><?php _e( 'Down one' ); ?></button> |
|
201 | + <span class="field-move-visual-label" aria-hidden="true"><?php _e('Move'); ?></span> |
|
202 | + <button type="button" class="button-link menus-move menus-move-up" data-dir="up"><?php _e('Up one'); ?></button> |
|
203 | + <button type="button" class="button-link menus-move menus-move-down" data-dir="down"><?php _e('Down one'); ?></button> |
|
204 | 204 | <button type="button" class="button-link menus-move menus-move-left" data-dir="left"></button> |
205 | 205 | <button type="button" class="button-link menus-move menus-move-right" data-dir="right"></button> |
206 | - <button type="button" class="button-link menus-move menus-move-top" data-dir="top"><?php _e( 'To the top' ); ?></button> |
|
206 | + <button type="button" class="button-link menus-move menus-move-top" data-dir="top"><?php _e('To the top'); ?></button> |
|
207 | 207 | </fieldset> |
208 | 208 | |
209 | 209 | <div class="menu-item-actions description-wide submitbox"> |
210 | - <?php if ( 'custom' != $item->type && $original_title !== false ) : ?> |
|
210 | + <?php if ('custom' != $item->type && $original_title !== false) : ?> |
|
211 | 211 | <p class="link-to-original"> |
212 | - <?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?> |
|
212 | + <?php printf(__('Original: %s'), '<a href="'.esc_attr($item->url).'">'.esc_html($original_title).'</a>'); ?> |
|
213 | 213 | </p> |
214 | 214 | <?php endif; ?> |
215 | 215 | <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php |
@@ -219,19 +219,19 @@ discard block |
||
219 | 219 | 'action' => 'delete-menu-item', |
220 | 220 | 'menu-item' => $item_id, |
221 | 221 | ), |
222 | - admin_url( 'nav-menus.php' ) |
|
222 | + admin_url('nav-menus.php') |
|
223 | 223 | ), |
224 | - 'delete-menu_item_' . $item_id |
|
225 | - ); ?>"><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array( 'edit-menu-item' => $item_id, 'cancel' => time() ), admin_url( 'nav-menus.php' ) ) ); |
|
224 | + 'delete-menu_item_'.$item_id |
|
225 | + ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url(add_query_arg(array('edit-menu-item' => $item_id, 'cancel' => time()), admin_url('nav-menus.php'))); |
|
226 | 226 | ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a> |
227 | 227 | </div> |
228 | 228 | |
229 | 229 | <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> |
230 | - <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" /> |
|
231 | - <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" /> |
|
232 | - <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" /> |
|
233 | - <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" /> |
|
234 | - <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" /> |
|
230 | + <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->object_id); ?>" /> |
|
231 | + <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->object); ?>" /> |
|
232 | + <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->menu_item_parent); ?>" /> |
|
233 | + <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->menu_order); ?>" /> |
|
234 | + <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->type); ?>" /> |
|
235 | 235 | </div><!-- .menu-item-settings--> |
236 | 236 | <ul class="menu-item-transport"></ul> |
237 | 237 | <?php |
@@ -123,8 +123,9 @@ discard block |
||
123 | 123 | $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); |
124 | 124 | |
125 | 125 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
126 | - if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
127 | - $tab = key( $tabs ); |
|
126 | + if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) { |
|
127 | + $tab = key( $tabs ); |
|
128 | + } |
|
128 | 129 | |
129 | 130 | $args = array( |
130 | 131 | 'page' => $paged, |
@@ -172,10 +173,11 @@ discard block |
||
172 | 173 | case 'favorites': |
173 | 174 | $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); |
174 | 175 | update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); |
175 | - if ( $user ) |
|
176 | - $args['user'] = $user; |
|
177 | - else |
|
178 | - $args = false; |
|
176 | + if ( $user ) { |
|
177 | + $args['user'] = $user; |
|
178 | + } else { |
|
179 | + $args = false; |
|
180 | + } |
|
179 | 181 | |
180 | 182 | add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 ); |
181 | 183 | break; |
@@ -197,8 +199,9 @@ discard block |
||
197 | 199 | */ |
198 | 200 | $args = apply_filters( "install_plugins_table_api_args_$tab", $args ); |
199 | 201 | |
200 | - if ( !$args ) |
|
201 | - return; |
|
202 | + if ( !$args ) { |
|
203 | + return; |
|
204 | + } |
|
202 | 205 | |
203 | 206 | $api = plugins_api( 'query_plugins', $args ); |
204 | 207 |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | protected function get_installed_plugin_slugs() { |
47 | 47 | $slugs = array(); |
48 | 48 | |
49 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
50 | - if ( isset( $plugin_info->no_update ) ) { |
|
51 | - foreach ( $plugin_info->no_update as $plugin ) { |
|
49 | + $plugin_info = get_site_transient('update_plugins'); |
|
50 | + if (isset($plugin_info->no_update)) { |
|
51 | + foreach ($plugin_info->no_update as $plugin) { |
|
52 | 52 | $slugs[] = $plugin->slug; |
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - if ( isset( $plugin_info->response ) ) { |
|
57 | - foreach ( $plugin_info->response as $plugin ) { |
|
56 | + if (isset($plugin_info->response)) { |
|
57 | + foreach ($plugin_info->response as $plugin) { |
|
58 | 58 | $slugs[] = $plugin->slug; |
59 | 59 | } |
60 | 60 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | * @global string $term |
72 | 72 | */ |
73 | 73 | public function prepare_items() { |
74 | - include( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
74 | + include(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
75 | 75 | |
76 | 76 | global $tabs, $tab, $paged, $type, $term; |
77 | 77 | |
78 | - wp_reset_vars( array( 'tab' ) ); |
|
78 | + wp_reset_vars(array('tab')); |
|
79 | 79 | |
80 | 80 | $paged = $this->get_pagenum(); |
81 | 81 | |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | // These are the tabs which are shown on the page |
85 | 85 | $tabs = array(); |
86 | 86 | |
87 | - if ( 'search' === $tab ) { |
|
88 | - $tabs['search'] = __( 'Search Results' ); |
|
87 | + if ('search' === $tab) { |
|
88 | + $tabs['search'] = __('Search Results'); |
|
89 | 89 | } |
90 | - if ( $tab === 'beta' || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { |
|
91 | - $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); |
|
90 | + if ($tab === 'beta' || false !== strpos(get_bloginfo('version'), '-')) { |
|
91 | + $tabs['beta'] = _x('Beta Testing', 'Plugin Installer'); |
|
92 | 92 | } |
93 | - $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); |
|
94 | - $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); |
|
95 | - $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); |
|
96 | - $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); |
|
97 | - if ( current_user_can( 'upload_plugins' ) ) { |
|
93 | + $tabs['featured'] = _x('Featured', 'Plugin Installer'); |
|
94 | + $tabs['popular'] = _x('Popular', 'Plugin Installer'); |
|
95 | + $tabs['recommended'] = _x('Recommended', 'Plugin Installer'); |
|
96 | + $tabs['favorites'] = _x('Favorites', 'Plugin Installer'); |
|
97 | + if (current_user_can('upload_plugins')) { |
|
98 | 98 | // No longer a real tab. Here for filter compatibility. |
99 | 99 | // Gets skipped in get_views(). |
100 | - $tabs['upload'] = __( 'Upload Plugin' ); |
|
100 | + $tabs['upload'] = __('Upload Plugin'); |
|
101 | 101 | } |
102 | 102 | |
103 | - $nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item. |
|
103 | + $nonmenu_tabs = array('plugin-information'); // Valid actions to perform which do not have a Menu item. |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Filters the tabs shown on the Plugin Install screen. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param array $tabs The tabs shown on the Plugin Install screen. Defaults include 'featured', 'popular', |
111 | 111 | * 'recommended', 'favorites', and 'upload'. |
112 | 112 | */ |
113 | - $tabs = apply_filters( 'install_plugins_tabs', $tabs ); |
|
113 | + $tabs = apply_filters('install_plugins_tabs', $tabs); |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Filters tabs not associated with a menu item on the Plugin Install screen. |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen. |
121 | 121 | */ |
122 | - $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); |
|
122 | + $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs); |
|
123 | 123 | |
124 | 124 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
125 | - if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
126 | - $tab = key( $tabs ); |
|
125 | + if (empty($tab) || ( ! isset($tabs[$tab]) && ! in_array($tab, (array) $nonmenu_tabs))) |
|
126 | + $tab = key($tabs); |
|
127 | 127 | |
128 | 128 | $args = array( |
129 | 129 | 'page' => $paged, |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | 'installed_plugins' => $this->get_installed_plugin_slugs(), |
139 | 139 | ); |
140 | 140 | |
141 | - switch ( $tab ) { |
|
141 | + switch ($tab) { |
|
142 | 142 | case 'search': |
143 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
144 | - $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; |
|
143 | + $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; |
|
144 | + $term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : ''; |
|
145 | 145 | |
146 | - switch ( $type ) { |
|
146 | + switch ($type) { |
|
147 | 147 | case 'tag': |
148 | - $args['tag'] = sanitize_title_with_dashes( $term ); |
|
148 | + $args['tag'] = sanitize_title_with_dashes($term); |
|
149 | 149 | break; |
150 | 150 | case 'term': |
151 | 151 | $args['search'] = $term; |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | break; |
170 | 170 | |
171 | 171 | case 'favorites': |
172 | - $action = 'save_wporg_username_' . get_current_user_id(); |
|
173 | - if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { |
|
174 | - $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); |
|
175 | - update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); |
|
172 | + $action = 'save_wporg_username_'.get_current_user_id(); |
|
173 | + if (isset($_GET['_wpnonce']) && wp_verify_nonce(wp_unslash($_GET['_wpnonce']), $action)) { |
|
174 | + $user = isset($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites'); |
|
175 | + update_user_meta(get_current_user_id(), 'wporg_favorites', $user); |
|
176 | 176 | } else { |
177 | - $user = get_user_option( 'wporg_favorites' ); |
|
177 | + $user = get_user_option('wporg_favorites'); |
|
178 | 178 | } |
179 | - if ( $user ) |
|
179 | + if ($user) |
|
180 | 180 | $args['user'] = $user; |
181 | 181 | else |
182 | 182 | $args = false; |
183 | 183 | |
184 | - add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 ); |
|
184 | + add_action('install_plugins_favorites', 'install_plugins_favorites_form', 9, 0); |
|
185 | 185 | break; |
186 | 186 | |
187 | 187 | default: |
@@ -199,30 +199,30 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param array|bool $args Plugin Install API arguments. |
201 | 201 | */ |
202 | - $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args ); |
|
202 | + $args = apply_filters("install_plugins_table_api_args_{$tab}", $args); |
|
203 | 203 | |
204 | - if ( !$args ) |
|
204 | + if ( ! $args) |
|
205 | 205 | return; |
206 | 206 | |
207 | - $api = plugins_api( 'query_plugins', $args ); |
|
207 | + $api = plugins_api('query_plugins', $args); |
|
208 | 208 | |
209 | - if ( is_wp_error( $api ) ) { |
|
209 | + if (is_wp_error($api)) { |
|
210 | 210 | $this->error = $api; |
211 | 211 | return; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $this->items = $api->plugins; |
215 | 215 | |
216 | - if ( $this->orderby ) { |
|
217 | - uasort( $this->items, array( $this, 'order_callback' ) ); |
|
216 | + if ($this->orderby) { |
|
217 | + uasort($this->items, array($this, 'order_callback')); |
|
218 | 218 | } |
219 | 219 | |
220 | - $this->set_pagination_args( array( |
|
220 | + $this->set_pagination_args(array( |
|
221 | 221 | 'total_items' => $api->info['results'], |
222 | 222 | 'per_page' => $args['per_page'], |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | |
225 | - if ( isset( $api->info['groups'] ) ) { |
|
225 | + if (isset($api->info['groups'])) { |
|
226 | 226 | $this->groups = $api->info['groups']; |
227 | 227 | } |
228 | 228 | } |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * @access public |
232 | 232 | */ |
233 | 233 | public function no_items() { |
234 | - if ( isset( $this->error ) ) { |
|
235 | - $message = $this->error->get_error_message() . '<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a></p>'; |
|
234 | + if (isset($this->error)) { |
|
235 | + $message = $this->error->get_error_message().'<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">'.__('Try again').'</a></p>'; |
|
236 | 236 | } else { |
237 | - $message = __( 'No plugins match your request.' ); |
|
237 | + $message = __('No plugins match your request.'); |
|
238 | 238 | } |
239 | - echo '<div class="no-plugin-results">' . $message . '</div>'; |
|
239 | + echo '<div class="no-plugin-results">'.$message.'</div>'; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | global $tabs, $tab; |
251 | 251 | |
252 | 252 | $display_tabs = array(); |
253 | - foreach ( (array) $tabs as $action => $text ) { |
|
254 | - $class = ( $action === $tab ) ? ' current' : ''; |
|
255 | - $href = self_admin_url('plugin-install.php?tab=' . $action); |
|
253 | + foreach ((array) $tabs as $action => $text) { |
|
254 | + $class = ($action === $tab) ? ' current' : ''; |
|
255 | + $href = self_admin_url('plugin-install.php?tab='.$action); |
|
256 | 256 | $display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>"; |
257 | 257 | } |
258 | 258 | // No longer a real tab. |
259 | - unset( $display_tabs['plugin-install-upload'] ); |
|
259 | + unset($display_tabs['plugin-install-upload']); |
|
260 | 260 | |
261 | 261 | return $display_tabs; |
262 | 262 | } |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | $views = $this->get_views(); |
269 | 269 | |
270 | 270 | /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ |
271 | - $views = apply_filters( "views_{$this->screen->id}", $views ); |
|
271 | + $views = apply_filters("views_{$this->screen->id}", $views); |
|
272 | 272 | |
273 | - $this->screen->render_screen_reader_content( 'heading_views' ); |
|
273 | + $this->screen->render_screen_reader_content('heading_views'); |
|
274 | 274 | ?> |
275 | 275 | <div class="wp-filter"> |
276 | 276 | <ul class="filter-links"> |
277 | 277 | <?php |
278 | - if ( ! empty( $views ) ) { |
|
279 | - foreach ( $views as $class => $view ) { |
|
280 | - $views[ $class ] = "\t<li class='$class'>$view"; |
|
278 | + if ( ! empty($views)) { |
|
279 | + foreach ($views as $class => $view) { |
|
280 | + $views[$class] = "\t<li class='$class'>$view"; |
|
281 | 281 | } |
282 | - echo implode( " </li>\n", $views ) . "</li>\n"; |
|
282 | + echo implode(" </li>\n", $views)."</li>\n"; |
|
283 | 283 | } |
284 | 284 | ?> |
285 | 285 | </ul> |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | |
298 | 298 | $data_attr = ''; |
299 | 299 | |
300 | - if ( $singular ) { |
|
300 | + if ($singular) { |
|
301 | 301 | $data_attr = " data-wp-lists='list:$singular'"; |
302 | 302 | } |
303 | 303 | |
304 | - $this->display_tablenav( 'top' ); |
|
304 | + $this->display_tablenav('top'); |
|
305 | 305 | |
306 | 306 | ?> |
307 | -<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
307 | +<div class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
308 | 308 | <?php |
309 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
309 | + $this->screen->render_screen_reader_content('heading_list'); |
|
310 | 310 | ?> |
311 | 311 | <div id="the-list"<?php echo $data_attr; ?>> |
312 | 312 | <?php $this->display_rows_or_placeholder(); ?> |
313 | 313 | </div> |
314 | 314 | </div> |
315 | 315 | <?php |
316 | - $this->display_tablenav( 'bottom' ); |
|
316 | + $this->display_tablenav('bottom'); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @param string $which |
323 | 323 | */ |
324 | - protected function display_tablenav( $which ) { |
|
325 | - if ( $GLOBALS['tab'] === 'featured' ) { |
|
324 | + protected function display_tablenav($which) { |
|
325 | + if ($GLOBALS['tab'] === 'featured') { |
|
326 | 326 | return; |
327 | 327 | } |
328 | 328 | |
329 | - if ( 'top' === $which ) { |
|
329 | + if ('top' === $which) { |
|
330 | 330 | wp_referer_field(); |
331 | 331 | ?> |
332 | 332 | <div class="tablenav top"> |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @since 2.7.0 |
339 | 339 | */ |
340 | - do_action( 'install_plugins_table_header' ); ?> |
|
340 | + do_action('install_plugins_table_header'); ?> |
|
341 | 341 | </div> |
342 | - <?php $this->pagination( $which ); ?> |
|
342 | + <?php $this->pagination($which); ?> |
|
343 | 343 | <br class="clear" /> |
344 | 344 | </div> |
345 | 345 | <?php } else { ?> |
346 | 346 | <div class="tablenav bottom"> |
347 | - <?php $this->pagination( $which ); ?> |
|
347 | + <?php $this->pagination($which); ?> |
|
348 | 348 | <br class="clear" /> |
349 | 349 | </div> |
350 | 350 | <?php |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return array |
356 | 356 | */ |
357 | 357 | protected function get_table_classes() { |
358 | - return array( 'widefat', $this->_args['plural'] ); |
|
358 | + return array('widefat', $this->_args['plural']); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
@@ -370,147 +370,147 @@ discard block |
||
370 | 370 | * @param object $plugin_b |
371 | 371 | * @return int |
372 | 372 | */ |
373 | - private function order_callback( $plugin_a, $plugin_b ) { |
|
373 | + private function order_callback($plugin_a, $plugin_b) { |
|
374 | 374 | $orderby = $this->orderby; |
375 | - if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) { |
|
375 | + if ( ! isset($plugin_a->$orderby, $plugin_b->$orderby)) { |
|
376 | 376 | return 0; |
377 | 377 | } |
378 | 378 | |
379 | 379 | $a = $plugin_a->$orderby; |
380 | 380 | $b = $plugin_b->$orderby; |
381 | 381 | |
382 | - if ( $a == $b ) { |
|
382 | + if ($a == $b) { |
|
383 | 383 | return 0; |
384 | 384 | } |
385 | 385 | |
386 | - if ( 'DESC' === $this->order ) { |
|
387 | - return ( $a < $b ) ? 1 : -1; |
|
386 | + if ('DESC' === $this->order) { |
|
387 | + return ($a < $b) ? 1 : -1; |
|
388 | 388 | } else { |
389 | - return ( $a < $b ) ? -1 : 1; |
|
389 | + return ($a < $b) ? -1 : 1; |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | 393 | public function display_rows() { |
394 | 394 | $plugins_allowedtags = array( |
395 | - 'a' => array( 'href' => array(),'title' => array(), 'target' => array() ), |
|
396 | - 'abbr' => array( 'title' => array() ),'acronym' => array( 'title' => array() ), |
|
397 | - 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(), |
|
395 | + 'a' => array('href' => array(), 'title' => array(), 'target' => array()), |
|
396 | + 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), |
|
397 | + 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), |
|
398 | 398 | 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array() |
399 | 399 | ); |
400 | 400 | |
401 | 401 | $plugins_group_titles = array( |
402 | - 'Performance' => _x( 'Performance', 'Plugin installer group title' ), |
|
403 | - 'Social' => _x( 'Social', 'Plugin installer group title' ), |
|
404 | - 'Tools' => _x( 'Tools', 'Plugin installer group title' ), |
|
402 | + 'Performance' => _x('Performance', 'Plugin installer group title'), |
|
403 | + 'Social' => _x('Social', 'Plugin installer group title'), |
|
404 | + 'Tools' => _x('Tools', 'Plugin installer group title'), |
|
405 | 405 | ); |
406 | 406 | |
407 | 407 | $group = null; |
408 | 408 | |
409 | - foreach ( (array) $this->items as $plugin ) { |
|
410 | - if ( is_object( $plugin ) ) { |
|
409 | + foreach ((array) $this->items as $plugin) { |
|
410 | + if (is_object($plugin)) { |
|
411 | 411 | $plugin = (array) $plugin; |
412 | 412 | } |
413 | 413 | |
414 | 414 | // Display the group heading if there is one |
415 | - if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { |
|
416 | - if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
|
417 | - $group_name = $this->groups[ $plugin['group'] ]; |
|
418 | - if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
|
419 | - $group_name = $plugins_group_titles[ $group_name ]; |
|
415 | + if (isset($plugin['group']) && $plugin['group'] != $group) { |
|
416 | + if (isset($this->groups[$plugin['group']])) { |
|
417 | + $group_name = $this->groups[$plugin['group']]; |
|
418 | + if (isset($plugins_group_titles[$group_name])) { |
|
419 | + $group_name = $plugins_group_titles[$group_name]; |
|
420 | 420 | } |
421 | 421 | } else { |
422 | 422 | $group_name = $plugin['group']; |
423 | 423 | } |
424 | 424 | |
425 | 425 | // Starting a new group, close off the divs of the last one |
426 | - if ( ! empty( $group ) ) { |
|
426 | + if ( ! empty($group)) { |
|
427 | 427 | echo '</div></div>'; |
428 | 428 | } |
429 | 429 | |
430 | - echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; |
|
430 | + echo '<div class="plugin-group"><h3>'.esc_html($group_name).'</h3>'; |
|
431 | 431 | // needs an extra wrapping div for nth-child selectors to work |
432 | 432 | echo '<div class="plugin-items">'; |
433 | 433 | |
434 | 434 | $group = $plugin['group']; |
435 | 435 | } |
436 | - $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
|
436 | + $title = wp_kses($plugin['name'], $plugins_allowedtags); |
|
437 | 437 | |
438 | 438 | // Remove any HTML from the description. |
439 | - $description = strip_tags( $plugin['short_description'] ); |
|
440 | - $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
|
439 | + $description = strip_tags($plugin['short_description']); |
|
440 | + $version = wp_kses($plugin['version'], $plugins_allowedtags); |
|
441 | 441 | |
442 | - $name = strip_tags( $title . ' ' . $version ); |
|
442 | + $name = strip_tags($title.' '.$version); |
|
443 | 443 | |
444 | - $author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
|
445 | - if ( ! empty( $author ) ) { |
|
446 | - $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; |
|
444 | + $author = wp_kses($plugin['author'], $plugins_allowedtags); |
|
445 | + if ( ! empty($author)) { |
|
446 | + $author = ' <cite>'.sprintf(__('By %s'), $author).'</cite>'; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | $action_links = array(); |
450 | 450 | |
451 | - if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { |
|
452 | - $status = install_plugin_install_status( $plugin ); |
|
451 | + if (current_user_can('install_plugins') || current_user_can('update_plugins')) { |
|
452 | + $status = install_plugin_install_status($plugin); |
|
453 | 453 | |
454 | - switch ( $status['status'] ) { |
|
454 | + switch ($status['status']) { |
|
455 | 455 | case 'install': |
456 | - if ( $status['url'] ) { |
|
456 | + if ($status['url']) { |
|
457 | 457 | /* translators: 1: Plugin name and version. */ |
458 | - $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install Now' ) . '</a>'; |
|
458 | + $action_links[] = '<a class="install-now button" data-slug="'.esc_attr($plugin['slug']).'" href="'.esc_url($status['url']).'" aria-label="'.esc_attr(sprintf(__('Install %s now'), $name)).'" data-name="'.esc_attr($name).'">'.__('Install Now').'</a>'; |
|
459 | 459 | } |
460 | 460 | break; |
461 | 461 | |
462 | 462 | case 'update_available': |
463 | - if ( $status['url'] ) { |
|
463 | + if ($status['url']) { |
|
464 | 464 | /* translators: 1: Plugin name and version */ |
465 | - $action_links[] = '<a class="update-now button aria-button-if-js" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>'; |
|
465 | + $action_links[] = '<a class="update-now button aria-button-if-js" data-plugin="'.esc_attr($status['file']).'" data-slug="'.esc_attr($plugin['slug']).'" href="'.esc_url($status['url']).'" aria-label="'.esc_attr(sprintf(__('Update %s now'), $name)).'" data-name="'.esc_attr($name).'">'.__('Update Now').'</a>'; |
|
466 | 466 | } |
467 | 467 | break; |
468 | 468 | |
469 | 469 | case 'latest_installed': |
470 | 470 | case 'newer_installed': |
471 | - if ( is_plugin_active( $status['file'] ) ) { |
|
472 | - $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">' . _x( 'Active', 'plugin' ) . '</button>'; |
|
473 | - } elseif ( current_user_can( 'activate_plugins' ) ) { |
|
474 | - $button_text = __( 'Activate' ); |
|
471 | + if (is_plugin_active($status['file'])) { |
|
472 | + $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">'._x('Active', 'plugin').'</button>'; |
|
473 | + } elseif (current_user_can('activate_plugins')) { |
|
474 | + $button_text = __('Activate'); |
|
475 | 475 | /* translators: %s: Plugin name */ |
476 | - $button_label = _x( 'Activate %s', 'plugin' ); |
|
477 | - $activate_url = add_query_arg( array( |
|
478 | - '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), |
|
476 | + $button_label = _x('Activate %s', 'plugin'); |
|
477 | + $activate_url = add_query_arg(array( |
|
478 | + '_wpnonce' => wp_create_nonce('activate-plugin_'.$status['file']), |
|
479 | 479 | 'action' => 'activate', |
480 | 480 | 'plugin' => $status['file'], |
481 | - ), network_admin_url( 'plugins.php' ) ); |
|
481 | + ), network_admin_url('plugins.php')); |
|
482 | 482 | |
483 | - if ( is_network_admin() ) { |
|
484 | - $button_text = __( 'Network Activate' ); |
|
483 | + if (is_network_admin()) { |
|
484 | + $button_text = __('Network Activate'); |
|
485 | 485 | /* translators: %s: Plugin name */ |
486 | - $button_label = _x( 'Network Activate %s', 'plugin' ); |
|
487 | - $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
|
486 | + $button_label = _x('Network Activate %s', 'plugin'); |
|
487 | + $activate_url = add_query_arg(array('networkwide' => 1), $activate_url); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | $action_links[] = sprintf( |
491 | 491 | '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', |
492 | - esc_url( $activate_url ), |
|
493 | - esc_attr( sprintf( $button_label, $plugin['name'] ) ), |
|
492 | + esc_url($activate_url), |
|
493 | + esc_attr(sprintf($button_label, $plugin['name'])), |
|
494 | 494 | $button_text |
495 | 495 | ); |
496 | 496 | } else { |
497 | - $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">' . _x( 'Installed', 'plugin' ) . '</button>'; |
|
497 | + $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">'._x('Installed', 'plugin').'</button>'; |
|
498 | 498 | } |
499 | 499 | break; |
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - $details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . |
|
504 | - '&TB_iframe=true&width=600&height=550' ); |
|
503 | + $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin['slug']. |
|
504 | + '&TB_iframe=true&width=600&height=550'); |
|
505 | 505 | |
506 | 506 | /* translators: 1: Plugin name and version. */ |
507 | - $action_links[] = '<a href="' . esc_url( $details_link ) . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '" data-title="' . esc_attr( $name ) . '">' . __( 'More Details' ) . '</a>'; |
|
507 | + $action_links[] = '<a href="'.esc_url($details_link).'" class="thickbox open-plugin-details-modal" aria-label="'.esc_attr(sprintf(__('More information about %s'), $name)).'" data-title="'.esc_attr($name).'">'.__('More Details').'</a>'; |
|
508 | 508 | |
509 | - if ( !empty( $plugin['icons']['svg'] ) ) { |
|
509 | + if ( ! empty($plugin['icons']['svg'])) { |
|
510 | 510 | $plugin_icon_url = $plugin['icons']['svg']; |
511 | - } elseif ( !empty( $plugin['icons']['2x'] ) ) { |
|
511 | + } elseif ( ! empty($plugin['icons']['2x'])) { |
|
512 | 512 | $plugin_icon_url = $plugin['icons']['2x']; |
513 | - } elseif ( !empty( $plugin['icons']['1x'] ) ) { |
|
513 | + } elseif ( ! empty($plugin['icons']['1x'])) { |
|
514 | 514 | $plugin_icon_url = $plugin['icons']['1x']; |
515 | 515 | } else { |
516 | 516 | $plugin_icon_url = $plugin['icons']['default']; |
@@ -524,24 +524,24 @@ discard block |
||
524 | 524 | * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now. |
525 | 525 | * @param array $plugin The plugin currently being listed. |
526 | 526 | */ |
527 | - $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
|
527 | + $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); |
|
528 | 528 | |
529 | - $last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
|
529 | + $last_updated_timestamp = strtotime($plugin['last_updated']); |
|
530 | 530 | ?> |
531 | - <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
|
531 | + <div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?>"> |
|
532 | 532 | <div class="plugin-card-top"> |
533 | 533 | <div class="name column-name"> |
534 | 534 | <h3> |
535 | - <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> |
|
535 | + <a href="<?php echo esc_url($details_link); ?>" class="thickbox open-plugin-details-modal"> |
|
536 | 536 | <?php echo $title; ?> |
537 | - <img src="<?php echo esc_attr( $plugin_icon_url ) ?>" class="plugin-icon" alt=""> |
|
537 | + <img src="<?php echo esc_attr($plugin_icon_url) ?>" class="plugin-icon" alt=""> |
|
538 | 538 | </a> |
539 | 539 | </h3> |
540 | 540 | </div> |
541 | 541 | <div class="action-links"> |
542 | 542 | <?php |
543 | - if ( $action_links ) { |
|
544 | - echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; |
|
543 | + if ($action_links) { |
|
544 | + echo '<ul class="plugin-action-buttons"><li>'.implode('</li><li>', $action_links).'</li></ul>'; |
|
545 | 545 | } |
546 | 546 | ?> |
547 | 547 | </div> |
@@ -552,34 +552,34 @@ discard block |
||
552 | 552 | </div> |
553 | 553 | <div class="plugin-card-bottom"> |
554 | 554 | <div class="vers column-rating"> |
555 | - <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?> |
|
556 | - <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> |
|
555 | + <?php wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?> |
|
556 | + <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n($plugin['num_ratings']); ?>)</span> |
|
557 | 557 | </div> |
558 | 558 | <div class="column-updated"> |
559 | - <strong><?php _e( 'Last Updated:' ); ?></strong> <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?> |
|
559 | + <strong><?php _e('Last Updated:'); ?></strong> <?php printf(__('%s ago'), human_time_diff($last_updated_timestamp)); ?> |
|
560 | 560 | </div> |
561 | 561 | <div class="column-downloaded"> |
562 | 562 | <?php |
563 | - if ( $plugin['active_installs'] >= 1000000 ) { |
|
564 | - $active_installs_text = _x( '1+ Million', 'Active plugin installs' ); |
|
565 | - } elseif ( 0 == $plugin['active_installs'] ) { |
|
566 | - $active_installs_text = _x( 'Less Than 10', 'Active plugin installs' ); |
|
563 | + if ($plugin['active_installs'] >= 1000000) { |
|
564 | + $active_installs_text = _x('1+ Million', 'Active plugin installs'); |
|
565 | + } elseif (0 == $plugin['active_installs']) { |
|
566 | + $active_installs_text = _x('Less Than 10', 'Active plugin installs'); |
|
567 | 567 | } else { |
568 | - $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
|
568 | + $active_installs_text = number_format_i18n($plugin['active_installs']).'+'; |
|
569 | 569 | } |
570 | - printf( __( '%s Active Installs' ), $active_installs_text ); |
|
570 | + printf(__('%s Active Installs'), $active_installs_text); |
|
571 | 571 | ?> |
572 | 572 | </div> |
573 | 573 | <div class="column-compatibility"> |
574 | 574 | <?php |
575 | - $wp_version = get_bloginfo( 'version' ); |
|
575 | + $wp_version = get_bloginfo('version'); |
|
576 | 576 | |
577 | - if ( ! empty( $plugin['tested'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { |
|
578 | - echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>'; |
|
579 | - } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) { |
|
580 | - echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>'; |
|
577 | + if ( ! empty($plugin['tested']) && version_compare(substr($wp_version, 0, strlen($plugin['tested'])), $plugin['tested'], '>')) { |
|
578 | + echo '<span class="compatibility-untested">'.__('Untested with your version of WordPress').'</span>'; |
|
579 | + } elseif ( ! empty($plugin['requires']) && version_compare(substr($wp_version, 0, strlen($plugin['requires'])), $plugin['requires'], '<')) { |
|
580 | + echo '<span class="compatibility-incompatible">'.__('<strong>Incompatible</strong> with your version of WordPress').'</span>'; |
|
581 | 581 | } else { |
582 | - echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>'; |
|
582 | + echo '<span class="compatibility-compatible">'.__('<strong>Compatible</strong> with your version of WordPress').'</span>'; |
|
583 | 583 | } |
584 | 584 | ?> |
585 | 585 | </div> |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | // Close off the group divs of the last one |
592 | - if ( ! empty( $group ) ) { |
|
592 | + if ( ! empty($group)) { |
|
593 | 593 | echo '</div></div>'; |
594 | 594 | } |
595 | 595 | } |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | * @return array Containing the headers in the format id => UI String |
18 | 18 | */ |
19 | 19 | function get_column_headers( $screen ) { |
20 | - if ( is_string( $screen ) ) |
|
21 | - $screen = convert_to_screen( $screen ); |
|
20 | + if ( is_string( $screen ) ) { |
|
21 | + $screen = convert_to_screen( $screen ); |
|
22 | + } |
|
22 | 23 | |
23 | 24 | static $column_headers = array(); |
24 | 25 | |
@@ -98,11 +99,13 @@ discard block |
||
98 | 99 | function meta_box_prefs( $screen ) { |
99 | 100 | global $wp_meta_boxes; |
100 | 101 | |
101 | - if ( is_string( $screen ) ) |
|
102 | - $screen = convert_to_screen( $screen ); |
|
102 | + if ( is_string( $screen ) ) { |
|
103 | + $screen = convert_to_screen( $screen ); |
|
104 | + } |
|
103 | 105 | |
104 | - if ( empty($wp_meta_boxes[$screen->id]) ) |
|
105 | - return; |
|
106 | + if ( empty($wp_meta_boxes[$screen->id]) ) { |
|
107 | + return; |
|
108 | + } |
|
106 | 109 | |
107 | 110 | $hidden = get_hidden_meta_boxes($screen); |
108 | 111 | |
@@ -112,11 +115,13 @@ discard block |
||
112 | 115 | continue; |
113 | 116 | } |
114 | 117 | foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { |
115 | - if ( false == $box || ! $box['title'] ) |
|
116 | - continue; |
|
118 | + if ( false == $box || ! $box['title'] ) { |
|
119 | + continue; |
|
120 | + } |
|
117 | 121 | // Submit box cannot be hidden |
118 | - if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) |
|
119 | - continue; |
|
122 | + if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) { |
|
123 | + continue; |
|
124 | + } |
|
120 | 125 | $box_id = $box['id']; |
121 | 126 | echo '<label for="' . $box_id . '-hide">'; |
122 | 127 | echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />'; |
@@ -135,8 +140,9 @@ discard block |
||
135 | 140 | * @return array Hidden Meta Boxes |
136 | 141 | */ |
137 | 142 | function get_hidden_meta_boxes( $screen ) { |
138 | - if ( is_string( $screen ) ) |
|
139 | - $screen = convert_to_screen( $screen ); |
|
143 | + if ( is_string( $screen ) ) { |
|
144 | + $screen = convert_to_screen( $screen ); |
|
145 | + } |
|
140 | 146 | |
141 | 147 | $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); |
142 | 148 | |
@@ -146,10 +152,11 @@ discard block |
||
146 | 152 | if ( $use_defaults ) { |
147 | 153 | $hidden = array(); |
148 | 154 | if ( 'post' == $screen->base ) { |
149 | - if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type ) |
|
150 | - $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); |
|
151 | - else |
|
152 | - $hidden = array( 'slugdiv' ); |
|
155 | + if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type ) { |
|
156 | + $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); |
|
157 | + } else { |
|
158 | + $hidden = array( 'slugdiv' ); |
|
159 | + } |
|
153 | 160 | } |
154 | 161 | |
155 | 162 | /** |
@@ -187,8 +194,9 @@ discard block |
||
187 | 194 | function add_screen_option( $option, $args = array() ) { |
188 | 195 | $current_screen = get_current_screen(); |
189 | 196 | |
190 | - if ( ! $current_screen ) |
|
191 | - return; |
|
197 | + if ( ! $current_screen ) { |
|
198 | + return; |
|
199 | + } |
|
192 | 200 | |
193 | 201 | $current_screen->add_option( $option, $args ); |
194 | 202 | } |
@@ -205,8 +213,9 @@ discard block |
||
205 | 213 | function get_current_screen() { |
206 | 214 | global $current_screen; |
207 | 215 | |
208 | - if ( ! isset( $current_screen ) ) |
|
209 | - return null; |
|
216 | + if ( ! isset( $current_screen ) ) { |
|
217 | + return null; |
|
218 | + } |
|
210 | 219 | |
211 | 220 | return $current_screen; |
212 | 221 | } |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param string|WP_Screen $screen The screen you want the headers for |
17 | 17 | * @return array Containing the headers in the format id => UI String |
18 | 18 | */ |
19 | -function get_column_headers( $screen ) { |
|
20 | - if ( is_string( $screen ) ) |
|
21 | - $screen = convert_to_screen( $screen ); |
|
19 | +function get_column_headers($screen) { |
|
20 | + if (is_string($screen)) |
|
21 | + $screen = convert_to_screen($screen); |
|
22 | 22 | |
23 | 23 | static $column_headers = array(); |
24 | 24 | |
25 | - if ( ! isset( $column_headers[ $screen->id ] ) ) { |
|
25 | + if ( ! isset($column_headers[$screen->id])) { |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Filters the column headers for a list table on a specific screen. |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param array $columns An array of column headers. Default empty. |
38 | 38 | */ |
39 | - $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); |
|
39 | + $column_headers[$screen->id] = apply_filters("manage_{$screen->id}_columns", array()); |
|
40 | 40 | } |
41 | 41 | |
42 | - return $column_headers[ $screen->id ]; |
|
42 | + return $column_headers[$screen->id]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | * @param string|WP_Screen $screen The screen you want the hidden columns for |
51 | 51 | * @return array |
52 | 52 | */ |
53 | -function get_hidden_columns( $screen ) { |
|
54 | - if ( is_string( $screen ) ) { |
|
55 | - $screen = convert_to_screen( $screen ); |
|
53 | +function get_hidden_columns($screen) { |
|
54 | + if (is_string($screen)) { |
|
55 | + $screen = convert_to_screen($screen); |
|
56 | 56 | } |
57 | 57 | |
58 | - $hidden = get_user_option( 'manage' . $screen->id . 'columnshidden' ); |
|
58 | + $hidden = get_user_option('manage'.$screen->id.'columnshidden'); |
|
59 | 59 | |
60 | - $use_defaults = ! is_array( $hidden ); |
|
60 | + $use_defaults = ! is_array($hidden); |
|
61 | 61 | |
62 | - if ( $use_defaults ) { |
|
62 | + if ($use_defaults) { |
|
63 | 63 | $hidden = array(); |
64 | 64 | |
65 | 65 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array $hidden An array of columns hidden by default. |
71 | 71 | * @param WP_Screen $screen WP_Screen object of the current screen. |
72 | 72 | */ |
73 | - $hidden = apply_filters( 'default_hidden_columns', $hidden, $screen ); |
|
73 | + $hidden = apply_filters('default_hidden_columns', $hidden, $screen); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param WP_Screen $screen WP_Screen object of the current screen. |
84 | 84 | * @param bool $use_defaults Whether to show the default columns. |
85 | 85 | */ |
86 | - return apply_filters( 'hidden_columns', $hidden, $screen, $use_defaults ); |
|
86 | + return apply_filters('hidden_columns', $hidden, $screen, $use_defaults); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -95,39 +95,39 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param WP_Screen $screen |
97 | 97 | */ |
98 | -function meta_box_prefs( $screen ) { |
|
98 | +function meta_box_prefs($screen) { |
|
99 | 99 | global $wp_meta_boxes; |
100 | 100 | |
101 | - if ( is_string( $screen ) ) |
|
102 | - $screen = convert_to_screen( $screen ); |
|
101 | + if (is_string($screen)) |
|
102 | + $screen = convert_to_screen($screen); |
|
103 | 103 | |
104 | - if ( empty($wp_meta_boxes[$screen->id]) ) |
|
104 | + if (empty($wp_meta_boxes[$screen->id])) |
|
105 | 105 | return; |
106 | 106 | |
107 | 107 | $hidden = get_hidden_meta_boxes($screen); |
108 | 108 | |
109 | - foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { |
|
110 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
111 | - if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { |
|
109 | + foreach (array_keys($wp_meta_boxes[$screen->id]) as $context) { |
|
110 | + foreach (array('high', 'core', 'default', 'low') as $priority) { |
|
111 | + if ( ! isset($wp_meta_boxes[$screen->id][$context][$priority])) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | - foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { |
|
115 | - if ( false == $box || ! $box['title'] ) |
|
114 | + foreach ($wp_meta_boxes[$screen->id][$context][$priority] as $box) { |
|
115 | + if (false == $box || ! $box['title']) |
|
116 | 116 | continue; |
117 | 117 | // Submit box cannot be hidden |
118 | - if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) |
|
118 | + if ('submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id']) |
|
119 | 119 | continue; |
120 | 120 | |
121 | 121 | $widget_title = $box['title']; |
122 | 122 | |
123 | - if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { |
|
123 | + if (is_array($box['args']) && isset($box['args']['__widget_basename'])) { |
|
124 | 124 | $widget_title = $box['args']['__widget_basename']; |
125 | 125 | } |
126 | 126 | |
127 | 127 | printf( |
128 | 128 | '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>', |
129 | - esc_attr( $box['id'] ), |
|
130 | - checked( in_array( $box['id'], $hidden ), false, false ), |
|
129 | + esc_attr($box['id']), |
|
130 | + checked(in_array($box['id'], $hidden), false, false), |
|
131 | 131 | $widget_title |
132 | 132 | ); |
133 | 133 | } |
@@ -143,22 +143,22 @@ discard block |
||
143 | 143 | * @param string|WP_Screen $screen Screen identifier |
144 | 144 | * @return array Hidden Meta Boxes |
145 | 145 | */ |
146 | -function get_hidden_meta_boxes( $screen ) { |
|
147 | - if ( is_string( $screen ) ) |
|
148 | - $screen = convert_to_screen( $screen ); |
|
146 | +function get_hidden_meta_boxes($screen) { |
|
147 | + if (is_string($screen)) |
|
148 | + $screen = convert_to_screen($screen); |
|
149 | 149 | |
150 | - $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); |
|
150 | + $hidden = get_user_option("metaboxhidden_{$screen->id}"); |
|
151 | 151 | |
152 | - $use_defaults = ! is_array( $hidden ); |
|
152 | + $use_defaults = ! is_array($hidden); |
|
153 | 153 | |
154 | 154 | // Hide slug boxes by default |
155 | - if ( $use_defaults ) { |
|
155 | + if ($use_defaults) { |
|
156 | 156 | $hidden = array(); |
157 | - if ( 'post' == $screen->base ) { |
|
158 | - if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type ) |
|
157 | + if ('post' == $screen->base) { |
|
158 | + if ('post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type) |
|
159 | 159 | $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); |
160 | 160 | else |
161 | - $hidden = array( 'slugdiv' ); |
|
161 | + $hidden = array('slugdiv'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param array $hidden An array of meta boxes hidden by default. |
170 | 170 | * @param WP_Screen $screen WP_Screen object of the current screen. |
171 | 171 | */ |
172 | - $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen ); |
|
172 | + $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param bool $use_defaults Whether to show the default meta boxes. |
183 | 183 | * Default true. |
184 | 184 | */ |
185 | - return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); |
|
185 | + return apply_filters('hidden_meta_boxes', $hidden, $screen, $use_defaults); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | * @param string $option An option name. |
194 | 194 | * @param mixed $args Option-dependent arguments. |
195 | 195 | */ |
196 | -function add_screen_option( $option, $args = array() ) { |
|
196 | +function add_screen_option($option, $args = array()) { |
|
197 | 197 | $current_screen = get_current_screen(); |
198 | 198 | |
199 | - if ( ! $current_screen ) |
|
199 | + if ( ! $current_screen) |
|
200 | 200 | return; |
201 | 201 | |
202 | - $current_screen->add_option( $option, $args ); |
|
202 | + $current_screen->add_option($option, $args); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | function get_current_screen() { |
215 | 215 | global $current_screen; |
216 | 216 | |
217 | - if ( ! isset( $current_screen ) ) |
|
217 | + if ( ! isset($current_screen)) |
|
218 | 218 | return null; |
219 | 219 | |
220 | 220 | return $current_screen; |
@@ -228,6 +228,6 @@ discard block |
||
228 | 228 | * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen, |
229 | 229 | * or an existing screen object. |
230 | 230 | */ |
231 | -function set_current_screen( $hook_name = '' ) { |
|
232 | - WP_Screen::get( $hook_name )->set_current_screen(); |
|
231 | +function set_current_screen($hook_name = '') { |
|
232 | + WP_Screen::get($hook_name)->set_current_screen(); |
|
233 | 233 | } |
@@ -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 |