@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Deprecated functions from WordPress MU and the multisite feature. You shouldn't |
|
4 | - * use these functions and look for the alternatives instead. The functions will be |
|
5 | - * removed in a later version. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Deprecated |
|
9 | - * @since 3.0.0 |
|
10 | - */ |
|
3 | + * Deprecated functions from WordPress MU and the multisite feature. You shouldn't |
|
4 | + * use these functions and look for the alternatives instead. The functions will be |
|
5 | + * removed in a later version. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Deprecated |
|
9 | + * @since 3.0.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /* |
13 | 13 | * Deprecated functions come here to die. |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @return int Current site ID. |
25 | 25 | */ |
26 | 26 | function get_dashboard_blog() { |
27 | - _deprecated_function( __FUNCTION__, '3.1' ); |
|
28 | - if ( $blog = get_site_option( 'dashboard_blog' ) ) |
|
29 | - return get_blog_details( $blog ); |
|
27 | + _deprecated_function( __FUNCTION__, '3.1' ); |
|
28 | + if ( $blog = get_site_option( 'dashboard_blog' ) ) |
|
29 | + return get_blog_details( $blog ); |
|
30 | 30 | |
31 | - return get_blog_details( $GLOBALS['current_site']->blog_id ); |
|
31 | + return get_blog_details( $GLOBALS['current_site']->blog_id ); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @return int Current site ID. |
25 | 25 | */ |
26 | 26 | function get_dashboard_blog() { |
27 | - _deprecated_function( __FUNCTION__, '3.1' ); |
|
28 | - if ( $blog = get_site_option( 'dashboard_blog' ) ) |
|
29 | - return get_blog_details( $blog ); |
|
27 | + _deprecated_function(__FUNCTION__, '3.1'); |
|
28 | + if ($blog = get_site_option('dashboard_blog')) |
|
29 | + return get_blog_details($blog); |
|
30 | 30 | |
31 | - return get_blog_details( $GLOBALS['current_site']->blog_id ); |
|
31 | + return get_blog_details($GLOBALS['current_site']->blog_id); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @deprecated 3.0.0 Use wp_generate_password() |
39 | 39 | * @see wp_generate_password() |
40 | 40 | */ |
41 | -function generate_random_password( $len = 8 ) { |
|
42 | - _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' ); |
|
43 | - return wp_generate_password( $len ); |
|
41 | +function generate_random_password($len = 8) { |
|
42 | + _deprecated_function(__FUNCTION__, '3.0', 'wp_generate_password()'); |
|
43 | + return wp_generate_password($len); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | * @deprecated 3.0.0 Use is_super_admin() |
57 | 57 | * @see is_super_admin() |
58 | 58 | */ |
59 | -function is_site_admin( $user_login = '' ) { |
|
60 | - _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' ); |
|
59 | +function is_site_admin($user_login = '') { |
|
60 | + _deprecated_function(__FUNCTION__, '3.0', 'is_super_admin()'); |
|
61 | 61 | |
62 | - if ( empty( $user_login ) ) { |
|
62 | + if (empty($user_login)) { |
|
63 | 63 | $user_id = get_current_user_id(); |
64 | - if ( !$user_id ) |
|
64 | + if ( ! $user_id) |
|
65 | 65 | return false; |
66 | 66 | } else { |
67 | - $user = get_user_by( 'login', $user_login ); |
|
68 | - if ( ! $user->exists() ) |
|
67 | + $user = get_user_by('login', $user_login); |
|
68 | + if ( ! $user->exists()) |
|
69 | 69 | return false; |
70 | 70 | $user_id = $user->ID; |
71 | 71 | } |
72 | 72 | |
73 | - return is_super_admin( $user_id ); |
|
73 | + return is_super_admin($user_id); |
|
74 | 74 | } |
75 | 75 | |
76 | -if ( !function_exists( 'graceful_fail' ) ) : |
|
76 | +if ( ! function_exists('graceful_fail')) : |
|
77 | 77 | /** |
78 | 78 | * Deprecated functionality to gracefully fail. |
79 | 79 | * |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @deprecated 3.0.0 Use wp_die() |
82 | 82 | * @see wp_die() |
83 | 83 | */ |
84 | -function graceful_fail( $message ) { |
|
85 | - _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' ); |
|
86 | - $message = apply_filters( 'graceful_fail', $message ); |
|
87 | - $message_template = apply_filters( 'graceful_fail_template', |
|
84 | +function graceful_fail($message) { |
|
85 | + _deprecated_function(__FUNCTION__, '3.0', 'wp_die()'); |
|
86 | + $message = apply_filters('graceful_fail', $message); |
|
87 | + $message_template = apply_filters('graceful_fail_template', |
|
88 | 88 | '<!DOCTYPE html> |
89 | 89 | <html xmlns="http://www.w3.org/1999/xhtml"><head> |
90 | 90 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | <p class="message">%s</p> |
109 | 109 | </body> |
110 | 110 | </html>' ); |
111 | - die( sprintf( $message_template, $message ) ); |
|
111 | + die(sprintf($message_template, $message)); |
|
112 | 112 | } |
113 | 113 | endif; |
114 | 114 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @deprecated 3.0.0 Use get_user_by() |
120 | 120 | * @see get_user_by() |
121 | 121 | */ |
122 | -function get_user_details( $username ) { |
|
123 | - _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' ); |
|
122 | +function get_user_details($username) { |
|
123 | + _deprecated_function(__FUNCTION__, '3.0', 'get_user_by()'); |
|
124 | 124 | return get_user_by('login', $username); |
125 | 125 | } |
126 | 126 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @deprecated 3.0.0 Use clean_post_cache() |
132 | 132 | * @see clean_post_cache() |
133 | 133 | */ |
134 | -function clear_global_post_cache( $post_id ) { |
|
135 | - _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' ); |
|
134 | +function clear_global_post_cache($post_id) { |
|
135 | + _deprecated_function(__FUNCTION__, '3.0', 'clean_post_cache()'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @see is_main_site() |
144 | 144 | */ |
145 | 145 | function is_main_blog() { |
146 | - _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' ); |
|
146 | + _deprecated_function(__FUNCTION__, '3.0', 'is_main_site()'); |
|
147 | 147 | return is_main_site(); |
148 | 148 | } |
149 | 149 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @deprecated 3.0.0 Use is_email() |
155 | 155 | * @see is_email() |
156 | 156 | */ |
157 | -function validate_email( $email, $check_domain = true) { |
|
158 | - _deprecated_function( __FUNCTION__, '3.0', 'is_email()' ); |
|
159 | - return is_email( $email, $check_domain ); |
|
157 | +function validate_email($email, $check_domain = true) { |
|
158 | + _deprecated_function(__FUNCTION__, '3.0', 'is_email()'); |
|
159 | + return is_email($email, $check_domain); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -166,26 +166,26 @@ discard block |
||
166 | 166 | * @deprecated 3.0.0 Use wp_get_sites() |
167 | 167 | * @see wp_get_sites() |
168 | 168 | */ |
169 | -function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { |
|
170 | - _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' ); |
|
169 | +function get_blog_list($start = 0, $num = 10, $deprecated = '') { |
|
170 | + _deprecated_function(__FUNCTION__, '3.0', 'wp_get_sites()'); |
|
171 | 171 | |
172 | 172 | global $wpdb; |
173 | - $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A ); |
|
173 | + $blogs = $wpdb->get_results($wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A); |
|
174 | 174 | |
175 | 175 | $blog_list = array(); |
176 | - foreach ( (array) $blogs as $details ) { |
|
177 | - $blog_list[ $details['blog_id'] ] = $details; |
|
178 | - $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); |
|
176 | + foreach ((array) $blogs as $details) { |
|
177 | + $blog_list[$details['blog_id']] = $details; |
|
178 | + $blog_list[$details['blog_id']]['postcount'] = $wpdb->get_var("SELECT COUNT(ID) FROM ".$wpdb->get_blog_prefix($details['blog_id'])."posts WHERE post_status='publish' AND post_type='post'"); |
|
179 | 179 | } |
180 | 180 | |
181 | - if ( ! $blog_list ) { |
|
181 | + if ( ! $blog_list) { |
|
182 | 182 | return array(); |
183 | 183 | } |
184 | 184 | |
185 | - if ( $num == 'all' ) { |
|
186 | - return array_slice( $blog_list, $start, count( $blog_list ) ); |
|
185 | + if ($num == 'all') { |
|
186 | + return array_slice($blog_list, $start, count($blog_list)); |
|
187 | 187 | } else { |
188 | - return array_slice( $blog_list, $start, $num ); |
|
188 | + return array_slice($blog_list, $start, $num); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -197,38 +197,38 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return array List of "most active" sites. |
199 | 199 | */ |
200 | -function get_most_active_blogs( $num = 10, $display = true ) { |
|
201 | - _deprecated_function( __FUNCTION__, '3.0' ); |
|
200 | +function get_most_active_blogs($num = 10, $display = true) { |
|
201 | + _deprecated_function(__FUNCTION__, '3.0'); |
|
202 | 202 | |
203 | - $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details |
|
204 | - if ( is_array( $blogs ) ) { |
|
205 | - reset( $blogs ); |
|
203 | + $blogs = get_blog_list(0, 'all', false); // $blog_id -> $details |
|
204 | + if (is_array($blogs)) { |
|
205 | + reset($blogs); |
|
206 | 206 | $most_active = array(); |
207 | 207 | $blog_list = array(); |
208 | - foreach ( (array) $blogs as $key => $details ) { |
|
209 | - $most_active[ $details['blog_id'] ] = $details['postcount']; |
|
210 | - $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!! |
|
208 | + foreach ((array) $blogs as $key => $details) { |
|
209 | + $most_active[$details['blog_id']] = $details['postcount']; |
|
210 | + $blog_list[$details['blog_id']] = $details; // array_slice() removes keys!! |
|
211 | 211 | } |
212 | - arsort( $most_active ); |
|
213 | - reset( $most_active ); |
|
212 | + arsort($most_active); |
|
213 | + reset($most_active); |
|
214 | 214 | $t = array(); |
215 | - foreach ( (array) $most_active as $key => $details ) { |
|
216 | - $t[ $key ] = $blog_list[ $key ]; |
|
215 | + foreach ((array) $most_active as $key => $details) { |
|
216 | + $t[$key] = $blog_list[$key]; |
|
217 | 217 | } |
218 | - unset( $most_active ); |
|
218 | + unset($most_active); |
|
219 | 219 | $most_active = $t; |
220 | 220 | } |
221 | 221 | |
222 | - if ( $display ) { |
|
223 | - if ( is_array( $most_active ) ) { |
|
224 | - reset( $most_active ); |
|
225 | - foreach ( (array) $most_active as $key => $details ) { |
|
226 | - $url = esc_url('http://' . $details['domain'] . $details['path']); |
|
227 | - echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>"; |
|
222 | + if ($display) { |
|
223 | + if (is_array($most_active)) { |
|
224 | + reset($most_active); |
|
225 | + foreach ((array) $most_active as $key => $details) { |
|
226 | + $url = esc_url('http://'.$details['domain'].$details['path']); |
|
227 | + echo '<li>'.$details['postcount']." <a href='$url'>$url</a></li>"; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | - return array_slice( $most_active, 0, $num ); |
|
231 | + return array_slice($most_active, 0, $num); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -248,33 +248,33 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param string $url |
250 | 250 | */ |
251 | -function wpmu_admin_do_redirect( $url = '' ) { |
|
252 | - _deprecated_function( __FUNCTION__, '3.3' ); |
|
251 | +function wpmu_admin_do_redirect($url = '') { |
|
252 | + _deprecated_function(__FUNCTION__, '3.3'); |
|
253 | 253 | |
254 | 254 | $ref = ''; |
255 | - if ( isset( $_GET['ref'] ) ) |
|
255 | + if (isset($_GET['ref'])) |
|
256 | 256 | $ref = $_GET['ref']; |
257 | - if ( isset( $_POST['ref'] ) ) |
|
257 | + if (isset($_POST['ref'])) |
|
258 | 258 | $ref = $_POST['ref']; |
259 | 259 | |
260 | - if ( $ref ) { |
|
261 | - $ref = wpmu_admin_redirect_add_updated_param( $ref ); |
|
262 | - wp_redirect( $ref ); |
|
260 | + if ($ref) { |
|
261 | + $ref = wpmu_admin_redirect_add_updated_param($ref); |
|
262 | + wp_redirect($ref); |
|
263 | 263 | exit(); |
264 | 264 | } |
265 | - if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { |
|
266 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
265 | + if ( ! empty($_SERVER['HTTP_REFERER'])) { |
|
266 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
267 | 267 | exit(); |
268 | 268 | } |
269 | 269 | |
270 | - $url = wpmu_admin_redirect_add_updated_param( $url ); |
|
271 | - if ( isset( $_GET['redirect'] ) ) { |
|
272 | - if ( substr( $_GET['redirect'], 0, 2 ) == 's_' ) |
|
273 | - $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); |
|
274 | - } elseif ( isset( $_POST['redirect'] ) ) { |
|
275 | - $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); |
|
270 | + $url = wpmu_admin_redirect_add_updated_param($url); |
|
271 | + if (isset($_GET['redirect'])) { |
|
272 | + if (substr($_GET['redirect'], 0, 2) == 's_') |
|
273 | + $url .= '&action=blogs&s='.esc_html(substr($_GET['redirect'], 2)); |
|
274 | + } elseif (isset($_POST['redirect'])) { |
|
275 | + $url = wpmu_admin_redirect_add_updated_param($_POST['redirect']); |
|
276 | 276 | } |
277 | - wp_redirect( $url ); |
|
277 | + wp_redirect($url); |
|
278 | 278 | exit(); |
279 | 279 | } |
280 | 280 | |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | * @param string $url |
289 | 289 | * @return string |
290 | 290 | */ |
291 | -function wpmu_admin_redirect_add_updated_param( $url = '' ) { |
|
292 | - _deprecated_function( __FUNCTION__, '3.3' ); |
|
291 | +function wpmu_admin_redirect_add_updated_param($url = '') { |
|
292 | + _deprecated_function(__FUNCTION__, '3.3'); |
|
293 | 293 | |
294 | - if ( strpos( $url, 'updated=true' ) === false ) { |
|
295 | - if ( strpos( $url, '?' ) === false ) |
|
296 | - return $url . '?updated=true'; |
|
294 | + if (strpos($url, 'updated=true') === false) { |
|
295 | + if (strpos($url, '?') === false) |
|
296 | + return $url.'?updated=true'; |
|
297 | 297 | else |
298 | - return $url . '&updated=true'; |
|
298 | + return $url.'&updated=true'; |
|
299 | 299 | } |
300 | 300 | return $url; |
301 | 301 | } |
@@ -313,17 +313,17 @@ discard block |
||
313 | 313 | * @param string $string Either an email address or a login. |
314 | 314 | * @return int |
315 | 315 | */ |
316 | -function get_user_id_from_string( $string ) { |
|
317 | - _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' ); |
|
316 | +function get_user_id_from_string($string) { |
|
317 | + _deprecated_function(__FUNCTION__, '3.6', 'get_user_by()'); |
|
318 | 318 | |
319 | - if ( is_email( $string ) ) |
|
320 | - $user = get_user_by( 'email', $string ); |
|
321 | - elseif ( is_numeric( $string ) ) |
|
319 | + if (is_email($string)) |
|
320 | + $user = get_user_by('email', $string); |
|
321 | + elseif (is_numeric($string)) |
|
322 | 322 | return $string; |
323 | 323 | else |
324 | - $user = get_user_by( 'login', $string ); |
|
324 | + $user = get_user_by('login', $string); |
|
325 | 325 | |
326 | - if ( $user ) |
|
326 | + if ($user) |
|
327 | 327 | return $user->ID; |
328 | 328 | return 0; |
329 | 329 | } |
@@ -338,21 +338,21 @@ discard block |
||
338 | 338 | * @param string $path |
339 | 339 | * @return string |
340 | 340 | */ |
341 | -function get_blogaddress_by_domain( $domain, $path ) { |
|
342 | - _deprecated_function( __FUNCTION__, '3.7' ); |
|
341 | +function get_blogaddress_by_domain($domain, $path) { |
|
342 | + _deprecated_function(__FUNCTION__, '3.7'); |
|
343 | 343 | |
344 | - if ( is_subdomain_install() ) { |
|
345 | - $url = "http://" . $domain.$path; |
|
344 | + if (is_subdomain_install()) { |
|
345 | + $url = "http://".$domain.$path; |
|
346 | 346 | } else { |
347 | - if ( $domain != $_SERVER['HTTP_HOST'] ) { |
|
348 | - $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); |
|
349 | - $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; |
|
347 | + if ($domain != $_SERVER['HTTP_HOST']) { |
|
348 | + $blogname = substr($domain, 0, strpos($domain, '.')); |
|
349 | + $url = 'http://'.substr($domain, strpos($domain, '.') + 1).$path; |
|
350 | 350 | // we're not installing the main blog |
351 | - if ( $blogname != 'www.' ) |
|
352 | - $url .= $blogname . '/'; |
|
351 | + if ($blogname != 'www.') |
|
352 | + $url .= $blogname.'/'; |
|
353 | 353 | } else { // main blog |
354 | - $url = 'http://' . $domain . $path; |
|
354 | + $url = 'http://'.$domain.$path; |
|
355 | 355 | } |
356 | 356 | } |
357 | - return esc_url_raw( $url ); |
|
357 | + return esc_url_raw($url); |
|
358 | 358 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function get_dashboard_blog() { |
27 | 27 | _deprecated_function( __FUNCTION__, '3.1' ); |
28 | - if ( $blog = get_site_option( 'dashboard_blog' ) ) |
|
29 | - return get_blog_details( $blog ); |
|
28 | + if ( $blog = get_site_option( 'dashboard_blog' ) ) { |
|
29 | + return get_blog_details( $blog ); |
|
30 | + } |
|
30 | 31 | |
31 | 32 | return get_blog_details( $GLOBALS['current_site']->blog_id ); |
32 | 33 | } |
@@ -61,12 +62,14 @@ discard block |
||
61 | 62 | |
62 | 63 | if ( empty( $user_login ) ) { |
63 | 64 | $user_id = get_current_user_id(); |
64 | - if ( !$user_id ) |
|
65 | - return false; |
|
65 | + if ( !$user_id ) { |
|
66 | + return false; |
|
67 | + } |
|
66 | 68 | } else { |
67 | 69 | $user = get_user_by( 'login', $user_login ); |
68 | - if ( ! $user->exists() ) |
|
69 | - return false; |
|
70 | + if ( ! $user->exists() ) { |
|
71 | + return false; |
|
72 | + } |
|
70 | 73 | $user_id = $user->ID; |
71 | 74 | } |
72 | 75 | |
@@ -252,10 +255,12 @@ discard block |
||
252 | 255 | _deprecated_function( __FUNCTION__, '3.3' ); |
253 | 256 | |
254 | 257 | $ref = ''; |
255 | - if ( isset( $_GET['ref'] ) ) |
|
256 | - $ref = $_GET['ref']; |
|
257 | - if ( isset( $_POST['ref'] ) ) |
|
258 | - $ref = $_POST['ref']; |
|
258 | + if ( isset( $_GET['ref'] ) ) { |
|
259 | + $ref = $_GET['ref']; |
|
260 | + } |
|
261 | + if ( isset( $_POST['ref'] ) ) { |
|
262 | + $ref = $_POST['ref']; |
|
263 | + } |
|
259 | 264 | |
260 | 265 | if ( $ref ) { |
261 | 266 | $ref = wpmu_admin_redirect_add_updated_param( $ref ); |
@@ -269,8 +274,9 @@ discard block |
||
269 | 274 | |
270 | 275 | $url = wpmu_admin_redirect_add_updated_param( $url ); |
271 | 276 | if ( isset( $_GET['redirect'] ) ) { |
272 | - if ( substr( $_GET['redirect'], 0, 2 ) == 's_' ) |
|
273 | - $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); |
|
277 | + if ( substr( $_GET['redirect'], 0, 2 ) == 's_' ) { |
|
278 | + $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); |
|
279 | + } |
|
274 | 280 | } elseif ( isset( $_POST['redirect'] ) ) { |
275 | 281 | $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); |
276 | 282 | } |
@@ -292,10 +298,11 @@ discard block |
||
292 | 298 | _deprecated_function( __FUNCTION__, '3.3' ); |
293 | 299 | |
294 | 300 | if ( strpos( $url, 'updated=true' ) === false ) { |
295 | - if ( strpos( $url, '?' ) === false ) |
|
296 | - return $url . '?updated=true'; |
|
297 | - else |
|
298 | - return $url . '&updated=true'; |
|
301 | + if ( strpos( $url, '?' ) === false ) { |
|
302 | + return $url . '?updated=true'; |
|
303 | + } else { |
|
304 | + return $url . '&updated=true'; |
|
305 | + } |
|
299 | 306 | } |
300 | 307 | return $url; |
301 | 308 | } |
@@ -316,15 +323,17 @@ discard block |
||
316 | 323 | function get_user_id_from_string( $string ) { |
317 | 324 | _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' ); |
318 | 325 | |
319 | - if ( is_email( $string ) ) |
|
320 | - $user = get_user_by( 'email', $string ); |
|
321 | - elseif ( is_numeric( $string ) ) |
|
322 | - return $string; |
|
323 | - else |
|
324 | - $user = get_user_by( 'login', $string ); |
|
326 | + if ( is_email( $string ) ) { |
|
327 | + $user = get_user_by( 'email', $string ); |
|
328 | + } elseif ( is_numeric( $string ) ) { |
|
329 | + return $string; |
|
330 | + } else { |
|
331 | + $user = get_user_by( 'login', $string ); |
|
332 | + } |
|
325 | 333 | |
326 | - if ( $user ) |
|
327 | - return $user->ID; |
|
334 | + if ( $user ) { |
|
335 | + return $user->ID; |
|
336 | + } |
|
328 | 337 | return 0; |
329 | 338 | } |
330 | 339 | |
@@ -348,8 +357,9 @@ discard block |
||
348 | 357 | $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); |
349 | 358 | $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; |
350 | 359 | // we're not installing the main blog |
351 | - if ( $blogname != 'www.' ) |
|
352 | - $url .= $blogname . '/'; |
|
360 | + if ( $blogname != 'www.' ) { |
|
361 | + $url .= $blogname . '/'; |
|
362 | + } |
|
353 | 363 | } else { // main blog |
354 | 364 | $url = 'http://' . $domain . $path; |
355 | 365 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Navigation Menu template functions |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Nav_Menus |
|
7 | - * @since 3.0.0 |
|
8 | - */ |
|
3 | + * Navigation Menu template functions |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Nav_Menus |
|
7 | + * @since 3.0.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Create HTML list of nav menu items. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @since 3.0.0 |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - public $tree_type = array( 'post_type', 'taxonomy', 'custom' ); |
|
24 | + public $tree_type = array('post_type', 'taxonomy', 'custom'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Database fields to use. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @todo Decouple this. |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); |
|
34 | + public $db_fields = array('parent' => 'menu_item_parent', 'id' => 'db_id'); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Starts the list before the elements are added. |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param int $depth Depth of menu item. Used for padding. |
45 | 45 | * @param array $args An array of arguments. @see wp_nav_menu() |
46 | 46 | */ |
47 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
47 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
48 | 48 | $indent = str_repeat("\t", $depth); |
49 | 49 | $output .= "\n$indent<ul class=\"sub-menu\">\n"; |
50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param int $depth Depth of menu item. Used for padding. |
61 | 61 | * @param array $args An array of arguments. @see wp_nav_menu() |
62 | 62 | */ |
63 | - public function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
63 | + public function end_lvl(&$output, $depth = 0, $args = array()) { |
|
64 | 64 | $indent = str_repeat("\t", $depth); |
65 | 65 | $output .= "$indent</ul>\n"; |
66 | 66 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param array $args An array of arguments. @see wp_nav_menu() |
79 | 79 | * @param int $id Current item ID. |
80 | 80 | */ |
81 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
82 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
81 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
82 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
83 | 83 | |
84 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
85 | - $classes[] = 'menu-item-' . $item->ID; |
|
84 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
85 | + $classes[] = 'menu-item-'.$item->ID; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Filter the CSS class(es) applied to a menu item's list item element. |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @param array $args An array of {@see wp_nav_menu()} arguments. |
96 | 96 | * @param int $depth Depth of menu item. Used for padding. |
97 | 97 | */ |
98 | - $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); |
|
99 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
98 | + $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth)); |
|
99 | + $class_names = $class_names ? ' class="'.esc_attr($class_names).'"' : ''; |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Filter the ID applied to a menu item's list item element. |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | * @param array $args An array of {@see wp_nav_menu()} arguments. |
110 | 110 | * @param int $depth Depth of menu item. Used for padding. |
111 | 111 | */ |
112 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth ); |
|
113 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
112 | + $id = apply_filters('nav_menu_item_id', 'menu-item-'.$item->ID, $item, $args, $depth); |
|
113 | + $id = $id ? ' id="'.esc_attr($id).'"' : ''; |
|
114 | 114 | |
115 | - $output .= $indent . '<li' . $id . $class_names .'>'; |
|
115 | + $output .= $indent.'<li'.$id.$class_names.'>'; |
|
116 | 116 | |
117 | 117 | $atts = array(); |
118 | - $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
|
119 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
120 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
121 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
118 | + $atts['title'] = ! empty($item->attr_title) ? $item->attr_title : ''; |
|
119 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
120 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
121 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Filter the HTML attributes applied to a menu item's anchor element. |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | * @param array $args An array of {@see wp_nav_menu()} arguments. |
139 | 139 | * @param int $depth Depth of menu item. Used for padding. |
140 | 140 | */ |
141 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); |
|
141 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth); |
|
142 | 142 | |
143 | 143 | $attributes = ''; |
144 | - foreach ( $atts as $attr => $value ) { |
|
145 | - if ( ! empty( $value ) ) { |
|
146 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
147 | - $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
144 | + foreach ($atts as $attr => $value) { |
|
145 | + if ( ! empty($value)) { |
|
146 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
147 | + $attributes .= ' '.$attr.'="'.$value.'"'; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | 151 | $item_output = $args->before; |
152 | - $item_output .= '<a'. $attributes .'>'; |
|
152 | + $item_output .= '<a'.$attributes.'>'; |
|
153 | 153 | /** This filter is documented in wp-includes/post-template.php */ |
154 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
154 | + $item_output .= $args->link_before.apply_filters('the_title', $item->title, $item->ID).$args->link_after; |
|
155 | 155 | $item_output .= '</a>'; |
156 | 156 | $item_output .= $args->after; |
157 | 157 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param int $depth Depth of menu item. Used for padding. |
170 | 170 | * @param array $args An array of {@see wp_nav_menu()} arguments. |
171 | 171 | */ |
172 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
172 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param int $depth Depth of page. Not Used. |
185 | 185 | * @param array $args An array of arguments. @see wp_nav_menu() |
186 | 186 | */ |
187 | - public function end_el( &$output, $item, $depth = 0, $args = array() ) { |
|
187 | + public function end_el(&$output, $item, $depth = 0, $args = array()) { |
|
188 | 188 | $output .= "</li>\n"; |
189 | 189 | } |
190 | 190 | |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | * } |
224 | 224 | * @return object|false|void Menu output if $echo is false, false if there are no items or no menu was found. |
225 | 225 | */ |
226 | -function wp_nav_menu( $args = array() ) { |
|
226 | +function wp_nav_menu($args = array()) { |
|
227 | 227 | static $menu_id_slugs = array(); |
228 | 228 | |
229 | - $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', |
|
229 | + $defaults = array('menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', |
|
230 | 230 | 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
231 | - 'depth' => 0, 'walker' => '', 'theme_location' => '' ); |
|
231 | + 'depth' => 0, 'walker' => '', 'theme_location' => ''); |
|
232 | 232 | |
233 | - $args = wp_parse_args( $args, $defaults ); |
|
233 | + $args = wp_parse_args($args, $defaults); |
|
234 | 234 | /** |
235 | 235 | * Filter the arguments used to display a navigation menu. |
236 | 236 | * |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param array $args Array of wp_nav_menu() arguments. |
242 | 242 | */ |
243 | - $args = apply_filters( 'wp_nav_menu_args', $args ); |
|
243 | + $args = apply_filters('wp_nav_menu_args', $args); |
|
244 | 244 | $args = (object) $args; |
245 | 245 | |
246 | 246 | /** |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * @param string|null $output Nav menu output to short-circuit with. Default null. |
258 | 258 | * @param object $args An object containing wp_nav_menu() arguments. |
259 | 259 | */ |
260 | - $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args ); |
|
260 | + $nav_menu = apply_filters('pre_wp_nav_menu', null, $args); |
|
261 | 261 | |
262 | - if ( null !== $nav_menu ) { |
|
263 | - if ( $args->echo ) { |
|
262 | + if (null !== $nav_menu) { |
|
263 | + if ($args->echo) { |
|
264 | 264 | echo $nav_menu; |
265 | 265 | return; |
266 | 266 | } |
@@ -269,30 +269,30 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | // Get the nav menu based on the requested menu |
272 | - $menu = wp_get_nav_menu_object( $args->menu ); |
|
272 | + $menu = wp_get_nav_menu_object($args->menu); |
|
273 | 273 | |
274 | 274 | // Get the nav menu based on the theme_location |
275 | - if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) |
|
276 | - $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); |
|
275 | + if ( ! $menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location])) |
|
276 | + $menu = wp_get_nav_menu_object($locations[$args->theme_location]); |
|
277 | 277 | |
278 | 278 | // get the first menu that has items if we still can't find a menu |
279 | - if ( ! $menu && !$args->theme_location ) { |
|
279 | + if ( ! $menu && ! $args->theme_location) { |
|
280 | 280 | $menus = wp_get_nav_menus(); |
281 | - foreach ( $menus as $menu_maybe ) { |
|
282 | - if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) { |
|
281 | + foreach ($menus as $menu_maybe) { |
|
282 | + if ($menu_items = wp_get_nav_menu_items($menu_maybe->term_id, array('update_post_term_cache' => false))) { |
|
283 | 283 | $menu = $menu_maybe; |
284 | 284 | break; |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | - if ( empty( $args->menu ) ) { |
|
289 | + if (empty($args->menu)) { |
|
290 | 290 | $args->menu = $menu; |
291 | 291 | } |
292 | 292 | |
293 | 293 | // If the menu exists, get its items. |
294 | - if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) |
|
295 | - $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); |
|
294 | + if ($menu && ! is_wp_error($menu) && ! isset($menu_items)) |
|
295 | + $menu_items = wp_get_nav_menu_items($menu->term_id, array('update_post_term_cache' => false)); |
|
296 | 296 | |
297 | 297 | /* |
298 | 298 | * If no menu was found: |
@@ -302,17 +302,17 @@ discard block |
||
302 | 302 | * - Fall back, but only if no theme location was specified. |
303 | 303 | * - Otherwise, bail. |
304 | 304 | */ |
305 | - if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) ) |
|
306 | - && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) |
|
307 | - return call_user_func( $args->fallback_cb, (array) $args ); |
|
305 | + if (( ! $menu || is_wp_error($menu) || (isset($menu_items) && empty($menu_items) && ! $args->theme_location)) |
|
306 | + && isset($args->fallback_cb) && $args->fallback_cb && is_callable($args->fallback_cb)) |
|
307 | + return call_user_func($args->fallback_cb, (array) $args); |
|
308 | 308 | |
309 | - if ( ! $menu || is_wp_error( $menu ) ) |
|
309 | + if ( ! $menu || is_wp_error($menu)) |
|
310 | 310 | return false; |
311 | 311 | |
312 | 312 | $nav_menu = $items = ''; |
313 | 313 | |
314 | 314 | $show_container = false; |
315 | - if ( $args->container ) { |
|
315 | + if ($args->container) { |
|
316 | 316 | /** |
317 | 317 | * Filter the list of HTML tags that are valid for use as menu containers. |
318 | 318 | * |
@@ -321,34 +321,34 @@ discard block |
||
321 | 321 | * @param array $tags The acceptable HTML tags for use as menu containers. |
322 | 322 | * Default is array containing 'div' and 'nav'. |
323 | 323 | */ |
324 | - $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); |
|
325 | - if ( in_array( $args->container, $allowed_tags ) ) { |
|
324 | + $allowed_tags = apply_filters('wp_nav_menu_container_allowedtags', array('div', 'nav')); |
|
325 | + if (in_array($args->container, $allowed_tags)) { |
|
326 | 326 | $show_container = true; |
327 | - $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"'; |
|
328 | - $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : ''; |
|
329 | - $nav_menu .= '<'. $args->container . $id . $class . '>'; |
|
327 | + $class = $args->container_class ? ' class="'.esc_attr($args->container_class).'"' : ' class="menu-'.$menu->slug.'-container"'; |
|
328 | + $id = $args->container_id ? ' id="'.esc_attr($args->container_id).'"' : ''; |
|
329 | + $nav_menu .= '<'.$args->container.$id.$class.'>'; |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Set up the $menu_item variables |
334 | - _wp_menu_item_classes_by_context( $menu_items ); |
|
334 | + _wp_menu_item_classes_by_context($menu_items); |
|
335 | 335 | |
336 | 336 | $sorted_menu_items = $menu_items_with_children = array(); |
337 | - foreach ( (array) $menu_items as $menu_item ) { |
|
338 | - $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; |
|
339 | - if ( $menu_item->menu_item_parent ) |
|
340 | - $menu_items_with_children[ $menu_item->menu_item_parent ] = true; |
|
337 | + foreach ((array) $menu_items as $menu_item) { |
|
338 | + $sorted_menu_items[$menu_item->menu_order] = $menu_item; |
|
339 | + if ($menu_item->menu_item_parent) |
|
340 | + $menu_items_with_children[$menu_item->menu_item_parent] = true; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | // Add the menu-item-has-children class where applicable |
344 | - if ( $menu_items_with_children ) { |
|
345 | - foreach ( $sorted_menu_items as &$menu_item ) { |
|
346 | - if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) |
|
344 | + if ($menu_items_with_children) { |
|
345 | + foreach ($sorted_menu_items as &$menu_item) { |
|
346 | + if (isset($menu_items_with_children[$menu_item->ID])) |
|
347 | 347 | $menu_item->classes[] = 'menu-item-has-children'; |
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - unset( $menu_items, $menu_item ); |
|
351 | + unset($menu_items, $menu_item); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Filter the sorted list of menu item objects before generating the menu's HTML. |
@@ -358,21 +358,21 @@ discard block |
||
358 | 358 | * @param array $sorted_menu_items The menu items, sorted by each menu item's menu order. |
359 | 359 | * @param object $args An object containing wp_nav_menu() arguments. |
360 | 360 | */ |
361 | - $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); |
|
361 | + $sorted_menu_items = apply_filters('wp_nav_menu_objects', $sorted_menu_items, $args); |
|
362 | 362 | |
363 | - $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args ); |
|
363 | + $items .= walk_nav_menu_tree($sorted_menu_items, $args->depth, $args); |
|
364 | 364 | unset($sorted_menu_items); |
365 | 365 | |
366 | 366 | // Attributes |
367 | - if ( ! empty( $args->menu_id ) ) { |
|
367 | + if ( ! empty($args->menu_id)) { |
|
368 | 368 | $wrap_id = $args->menu_id; |
369 | 369 | } else { |
370 | - $wrap_id = 'menu-' . $menu->slug; |
|
371 | - while ( in_array( $wrap_id, $menu_id_slugs ) ) { |
|
372 | - if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) |
|
373 | - $wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); |
|
370 | + $wrap_id = 'menu-'.$menu->slug; |
|
371 | + while (in_array($wrap_id, $menu_id_slugs)) { |
|
372 | + if (preg_match('#-(\d+)$#', $wrap_id, $matches)) |
|
373 | + $wrap_id = preg_replace('#-(\d+)$#', '-'.++$matches[1], $wrap_id); |
|
374 | 374 | else |
375 | - $wrap_id = $wrap_id . '-1'; |
|
375 | + $wrap_id = $wrap_id.'-1'; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | $menu_id_slugs[] = $wrap_id; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param string $items The HTML list content for the menu items. |
390 | 390 | * @param object $args An object containing wp_nav_menu() arguments. |
391 | 391 | */ |
392 | - $items = apply_filters( 'wp_nav_menu_items', $items, $args ); |
|
392 | + $items = apply_filters('wp_nav_menu_items', $items, $args); |
|
393 | 393 | /** |
394 | 394 | * Filter the HTML list content for a specific navigation menu. |
395 | 395 | * |
@@ -400,17 +400,17 @@ discard block |
||
400 | 400 | * @param string $items The HTML list content for the menu items. |
401 | 401 | * @param object $args An object containing wp_nav_menu() arguments. |
402 | 402 | */ |
403 | - $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); |
|
403 | + $items = apply_filters("wp_nav_menu_{$menu->slug}_items", $items, $args); |
|
404 | 404 | |
405 | 405 | // Don't print any markup if there are no items at this point. |
406 | - if ( empty( $items ) ) |
|
406 | + if (empty($items)) |
|
407 | 407 | return false; |
408 | 408 | |
409 | - $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); |
|
410 | - unset( $items ); |
|
409 | + $nav_menu .= sprintf($args->items_wrap, esc_attr($wrap_id), esc_attr($wrap_class), $items); |
|
410 | + unset($items); |
|
411 | 411 | |
412 | - if ( $show_container ) |
|
413 | - $nav_menu .= '</' . $args->container . '>'; |
|
412 | + if ($show_container) |
|
413 | + $nav_menu .= '</'.$args->container.'>'; |
|
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Filter the HTML content for navigation menus. |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | * @param string $nav_menu The HTML content for the navigation menu. |
423 | 423 | * @param object $args An object containing wp_nav_menu() arguments. |
424 | 424 | */ |
425 | - $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); |
|
425 | + $nav_menu = apply_filters('wp_nav_menu', $nav_menu, $args); |
|
426 | 426 | |
427 | - if ( $args->echo ) |
|
427 | + if ($args->echo) |
|
428 | 428 | echo $nav_menu; |
429 | 429 | else |
430 | 430 | return $nav_menu; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param array $menu_items The current menu item objects to which to add the class property information. |
443 | 443 | */ |
444 | -function _wp_menu_item_classes_by_context( &$menu_items ) { |
|
444 | +function _wp_menu_item_classes_by_context(&$menu_items) { |
|
445 | 445 | global $wp_query, $wp_rewrite; |
446 | 446 | |
447 | 447 | $queried_object = $wp_query->get_queried_object(); |
@@ -453,71 +453,71 @@ discard block |
||
453 | 453 | $active_parent_object_ids = array(); |
454 | 454 | $possible_taxonomy_ancestors = array(); |
455 | 455 | $possible_object_parents = array(); |
456 | - $home_page_id = (int) get_option( 'page_for_posts' ); |
|
457 | - |
|
458 | - if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) { |
|
459 | - foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) { |
|
460 | - if ( is_taxonomy_hierarchical( $taxonomy ) ) { |
|
461 | - $term_hierarchy = _get_term_hierarchy( $taxonomy ); |
|
462 | - $terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) ); |
|
463 | - if ( is_array( $terms ) ) { |
|
464 | - $possible_object_parents = array_merge( $possible_object_parents, $terms ); |
|
456 | + $home_page_id = (int) get_option('page_for_posts'); |
|
457 | + |
|
458 | + if ($wp_query->is_singular && ! empty($queried_object->post_type) && ! is_post_type_hierarchical($queried_object->post_type)) { |
|
459 | + foreach ((array) get_object_taxonomies($queried_object->post_type) as $taxonomy) { |
|
460 | + if (is_taxonomy_hierarchical($taxonomy)) { |
|
461 | + $term_hierarchy = _get_term_hierarchy($taxonomy); |
|
462 | + $terms = wp_get_object_terms($queried_object_id, $taxonomy, array('fields' => 'ids')); |
|
463 | + if (is_array($terms)) { |
|
464 | + $possible_object_parents = array_merge($possible_object_parents, $terms); |
|
465 | 465 | $term_to_ancestor = array(); |
466 | - foreach ( (array) $term_hierarchy as $anc => $descs ) { |
|
467 | - foreach ( (array) $descs as $desc ) |
|
468 | - $term_to_ancestor[ $desc ] = $anc; |
|
466 | + foreach ((array) $term_hierarchy as $anc => $descs) { |
|
467 | + foreach ((array) $descs as $desc) |
|
468 | + $term_to_ancestor[$desc] = $anc; |
|
469 | 469 | } |
470 | 470 | |
471 | - foreach ( $terms as $desc ) { |
|
471 | + foreach ($terms as $desc) { |
|
472 | 472 | do { |
473 | - $possible_taxonomy_ancestors[ $taxonomy ][] = $desc; |
|
474 | - if ( isset( $term_to_ancestor[ $desc ] ) ) { |
|
475 | - $_desc = $term_to_ancestor[ $desc ]; |
|
476 | - unset( $term_to_ancestor[ $desc ] ); |
|
473 | + $possible_taxonomy_ancestors[$taxonomy][] = $desc; |
|
474 | + if (isset($term_to_ancestor[$desc])) { |
|
475 | + $_desc = $term_to_ancestor[$desc]; |
|
476 | + unset($term_to_ancestor[$desc]); |
|
477 | 477 | $desc = $_desc; |
478 | 478 | } else { |
479 | 479 | $desc = 0; |
480 | 480 | } |
481 | - } while ( ! empty( $desc ) ); |
|
481 | + } while ( ! empty($desc)); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | - } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) { |
|
487 | - $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy ); |
|
486 | + } elseif ( ! empty($queried_object->taxonomy) && is_taxonomy_hierarchical($queried_object->taxonomy)) { |
|
487 | + $term_hierarchy = _get_term_hierarchy($queried_object->taxonomy); |
|
488 | 488 | $term_to_ancestor = array(); |
489 | - foreach ( (array) $term_hierarchy as $anc => $descs ) { |
|
490 | - foreach ( (array) $descs as $desc ) |
|
491 | - $term_to_ancestor[ $desc ] = $anc; |
|
489 | + foreach ((array) $term_hierarchy as $anc => $descs) { |
|
490 | + foreach ((array) $descs as $desc) |
|
491 | + $term_to_ancestor[$desc] = $anc; |
|
492 | 492 | } |
493 | 493 | $desc = $queried_object->term_id; |
494 | 494 | do { |
495 | - $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc; |
|
496 | - if ( isset( $term_to_ancestor[ $desc ] ) ) { |
|
497 | - $_desc = $term_to_ancestor[ $desc ]; |
|
498 | - unset( $term_to_ancestor[ $desc ] ); |
|
495 | + $possible_taxonomy_ancestors[$queried_object->taxonomy][] = $desc; |
|
496 | + if (isset($term_to_ancestor[$desc])) { |
|
497 | + $_desc = $term_to_ancestor[$desc]; |
|
498 | + unset($term_to_ancestor[$desc]); |
|
499 | 499 | $desc = $_desc; |
500 | 500 | } else { |
501 | 501 | $desc = 0; |
502 | 502 | } |
503 | - } while ( ! empty( $desc ) ); |
|
503 | + } while ( ! empty($desc)); |
|
504 | 504 | } |
505 | 505 | |
506 | - $possible_object_parents = array_filter( $possible_object_parents ); |
|
506 | + $possible_object_parents = array_filter($possible_object_parents); |
|
507 | 507 | |
508 | 508 | $front_page_url = home_url(); |
509 | 509 | |
510 | - foreach ( (array) $menu_items as $key => $menu_item ) { |
|
510 | + foreach ((array) $menu_items as $key => $menu_item) { |
|
511 | 511 | |
512 | 512 | $menu_items[$key]->current = false; |
513 | 513 | |
514 | 514 | $classes = (array) $menu_item->classes; |
515 | 515 | $classes[] = 'menu-item'; |
516 | - $classes[] = 'menu-item-type-' . $menu_item->type; |
|
517 | - $classes[] = 'menu-item-object-' . $menu_item->object; |
|
516 | + $classes[] = 'menu-item-type-'.$menu_item->type; |
|
517 | + $classes[] = 'menu-item-object-'.$menu_item->object; |
|
518 | 518 | |
519 | 519 | // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object |
520 | - if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) { |
|
520 | + if ($wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array($menu_item->object_id, $possible_object_parents)) { |
|
521 | 521 | $active_parent_object_ids[] = (int) $menu_item->object_id; |
522 | 522 | $active_parent_item_ids[] = (int) $menu_item->db_id; |
523 | 523 | $active_object = $queried_object->post_type; |
@@ -526,26 +526,26 @@ discard block |
||
526 | 526 | } elseif ( |
527 | 527 | $menu_item->object_id == $queried_object_id && |
528 | 528 | ( |
529 | - ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || |
|
530 | - ( 'post_type' == $menu_item->type && $wp_query->is_singular ) || |
|
531 | - ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object ) |
|
529 | + ( ! empty($home_page_id) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id) || |
|
530 | + ('post_type' == $menu_item->type && $wp_query->is_singular) || |
|
531 | + ('taxonomy' == $menu_item->type && ($wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax) && $queried_object->taxonomy == $menu_item->object) |
|
532 | 532 | ) |
533 | 533 | ) { |
534 | 534 | $classes[] = 'current-menu-item'; |
535 | 535 | $menu_items[$key]->current = true; |
536 | 536 | $_anc_id = (int) $menu_item->db_id; |
537 | 537 | |
538 | - while( |
|
539 | - ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && |
|
540 | - ! in_array( $_anc_id, $active_ancestor_item_ids ) |
|
538 | + while ( |
|
539 | + ($_anc_id = get_post_meta($_anc_id, '_menu_item_menu_item_parent', true)) && |
|
540 | + ! in_array($_anc_id, $active_ancestor_item_ids) |
|
541 | 541 | ) { |
542 | 542 | $active_ancestor_item_ids[] = $_anc_id; |
543 | 543 | } |
544 | 544 | |
545 | - if ( 'post_type' == $menu_item->type && 'page' == $menu_item->object ) { |
|
545 | + if ('post_type' == $menu_item->type && 'page' == $menu_item->object) { |
|
546 | 546 | // Back compat classes for pages to match wp_page_menu() |
547 | 547 | $classes[] = 'page_item'; |
548 | - $classes[] = 'page-item-' . $menu_item->object_id; |
|
548 | + $classes[] = 'page-item-'.$menu_item->object_id; |
|
549 | 549 | $classes[] = 'current_page_item'; |
550 | 550 | } |
551 | 551 | $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; |
@@ -553,26 +553,26 @@ discard block |
||
553 | 553 | $active_object = $menu_item->object; |
554 | 554 | |
555 | 555 | // if the menu item corresponds to the currently-requested URL |
556 | - } elseif ( 'custom' == $menu_item->object ) { |
|
557 | - $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); |
|
558 | - $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current ); |
|
559 | - $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; |
|
560 | - $item_url = set_url_scheme( untrailingslashit( $raw_item_url ) ); |
|
561 | - $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) ); |
|
562 | - |
|
563 | - if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) { |
|
556 | + } elseif ('custom' == $menu_item->object) { |
|
557 | + $_root_relative_current = untrailingslashit($_SERVER['REQUEST_URI']); |
|
558 | + $current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_root_relative_current); |
|
559 | + $raw_item_url = strpos($menu_item->url, '#') ? substr($menu_item->url, 0, strpos($menu_item->url, '#')) : $menu_item->url; |
|
560 | + $item_url = set_url_scheme(untrailingslashit($raw_item_url)); |
|
561 | + $_indexless_current = untrailingslashit(preg_replace('/'.preg_quote($wp_rewrite->index, '/').'$/', '', $current_url)); |
|
562 | + |
|
563 | + if ($raw_item_url && in_array($item_url, array($current_url, $_indexless_current, $_root_relative_current))) { |
|
564 | 564 | $classes[] = 'current-menu-item'; |
565 | 565 | $menu_items[$key]->current = true; |
566 | 566 | $_anc_id = (int) $menu_item->db_id; |
567 | 567 | |
568 | - while( |
|
569 | - ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && |
|
570 | - ! in_array( $_anc_id, $active_ancestor_item_ids ) |
|
568 | + while ( |
|
569 | + ($_anc_id = get_post_meta($_anc_id, '_menu_item_menu_item_parent', true)) && |
|
570 | + ! in_array($_anc_id, $active_ancestor_item_ids) |
|
571 | 571 | ) { |
572 | 572 | $active_ancestor_item_ids[] = $_anc_id; |
573 | 573 | } |
574 | 574 | |
575 | - if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ) ) ) { |
|
575 | + if (in_array(home_url(), array(untrailingslashit($current_url), untrailingslashit($_indexless_current)))) { |
|
576 | 576 | // Back compat for home link to match wp_page_menu() |
577 | 577 | $classes[] = 'current_page_item'; |
578 | 578 | } |
@@ -581,77 +581,77 @@ discard block |
||
581 | 581 | $active_object = $menu_item->object; |
582 | 582 | |
583 | 583 | // give front page item current-menu-item class when extra query arguments involved |
584 | - } elseif ( $item_url == $front_page_url && is_front_page() ) { |
|
584 | + } elseif ($item_url == $front_page_url && is_front_page()) { |
|
585 | 585 | $classes[] = 'current-menu-item'; |
586 | 586 | } |
587 | 587 | |
588 | - if ( untrailingslashit($item_url) == home_url() ) |
|
588 | + if (untrailingslashit($item_url) == home_url()) |
|
589 | 589 | $classes[] = 'menu-item-home'; |
590 | 590 | } |
591 | 591 | |
592 | 592 | // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query |
593 | - if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) |
|
593 | + if ( ! empty($home_page_id) && 'post_type' == $menu_item->type && empty($wp_query->is_page) && $home_page_id == $menu_item->object_id) |
|
594 | 594 | $classes[] = 'current_page_parent'; |
595 | 595 | |
596 | - $menu_items[$key]->classes = array_unique( $classes ); |
|
596 | + $menu_items[$key]->classes = array_unique($classes); |
|
597 | 597 | } |
598 | - $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) ); |
|
599 | - $active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) ); |
|
600 | - $active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) ); |
|
598 | + $active_ancestor_item_ids = array_filter(array_unique($active_ancestor_item_ids)); |
|
599 | + $active_parent_item_ids = array_filter(array_unique($active_parent_item_ids)); |
|
600 | + $active_parent_object_ids = array_filter(array_unique($active_parent_object_ids)); |
|
601 | 601 | |
602 | 602 | // set parent's class |
603 | - foreach ( (array) $menu_items as $key => $parent_item ) { |
|
603 | + foreach ((array) $menu_items as $key => $parent_item) { |
|
604 | 604 | $classes = (array) $parent_item->classes; |
605 | 605 | $menu_items[$key]->current_item_ancestor = false; |
606 | 606 | $menu_items[$key]->current_item_parent = false; |
607 | 607 | |
608 | 608 | if ( |
609 | - isset( $parent_item->type ) && |
|
609 | + isset($parent_item->type) && |
|
610 | 610 | ( |
611 | 611 | // ancestral post object |
612 | 612 | ( |
613 | 613 | 'post_type' == $parent_item->type && |
614 | - ! empty( $queried_object->post_type ) && |
|
615 | - is_post_type_hierarchical( $queried_object->post_type ) && |
|
616 | - in_array( $parent_item->object_id, $queried_object->ancestors ) && |
|
614 | + ! empty($queried_object->post_type) && |
|
615 | + is_post_type_hierarchical($queried_object->post_type) && |
|
616 | + in_array($parent_item->object_id, $queried_object->ancestors) && |
|
617 | 617 | $parent_item->object != $queried_object->ID |
618 | 618 | ) || |
619 | 619 | |
620 | 620 | // ancestral term |
621 | 621 | ( |
622 | 622 | 'taxonomy' == $parent_item->type && |
623 | - isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) && |
|
624 | - in_array( $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ] ) && |
|
623 | + isset($possible_taxonomy_ancestors[$parent_item->object]) && |
|
624 | + in_array($parent_item->object_id, $possible_taxonomy_ancestors[$parent_item->object]) && |
|
625 | 625 | ( |
626 | - ! isset( $queried_object->term_id ) || |
|
626 | + ! isset($queried_object->term_id) || |
|
627 | 627 | $parent_item->object_id != $queried_object->term_id |
628 | 628 | ) |
629 | 629 | ) |
630 | 630 | ) |
631 | 631 | ) { |
632 | - $classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor'; |
|
632 | + $classes[] = empty($queried_object->taxonomy) ? 'current-'.$queried_object->post_type.'-ancestor' : 'current-'.$queried_object->taxonomy.'-ancestor'; |
|
633 | 633 | } |
634 | 634 | |
635 | - if ( in_array( intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) { |
|
635 | + if (in_array(intval($parent_item->db_id), $active_ancestor_item_ids)) { |
|
636 | 636 | $classes[] = 'current-menu-ancestor'; |
637 | 637 | $menu_items[$key]->current_item_ancestor = true; |
638 | 638 | } |
639 | - if ( in_array( $parent_item->db_id, $active_parent_item_ids ) ) { |
|
639 | + if (in_array($parent_item->db_id, $active_parent_item_ids)) { |
|
640 | 640 | $classes[] = 'current-menu-parent'; |
641 | 641 | $menu_items[$key]->current_item_parent = true; |
642 | 642 | } |
643 | - if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) |
|
644 | - $classes[] = 'current-' . $active_object . '-parent'; |
|
643 | + if (in_array($parent_item->object_id, $active_parent_object_ids)) |
|
644 | + $classes[] = 'current-'.$active_object.'-parent'; |
|
645 | 645 | |
646 | - if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) { |
|
646 | + if ('post_type' == $parent_item->type && 'page' == $parent_item->object) { |
|
647 | 647 | // Back compat classes for pages to match wp_page_menu() |
648 | - if ( in_array('current-menu-parent', $classes) ) |
|
648 | + if (in_array('current-menu-parent', $classes)) |
|
649 | 649 | $classes[] = 'current_page_parent'; |
650 | - if ( in_array('current-menu-ancestor', $classes) ) |
|
650 | + if (in_array('current-menu-ancestor', $classes)) |
|
651 | 651 | $classes[] = 'current_page_ancestor'; |
652 | 652 | } |
653 | 653 | |
654 | - $menu_items[$key]->classes = array_unique( $classes ); |
|
654 | + $menu_items[$key]->classes = array_unique($classes); |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
@@ -666,11 +666,11 @@ discard block |
||
666 | 666 | * @param object $r |
667 | 667 | * @return string |
668 | 668 | */ |
669 | -function walk_nav_menu_tree( $items, $depth, $r ) { |
|
670 | - $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; |
|
671 | - $args = array( $items, $depth, $r ); |
|
669 | +function walk_nav_menu_tree($items, $depth, $r) { |
|
670 | + $walker = (empty($r->walker)) ? new Walker_Nav_Menu : $r->walker; |
|
671 | + $args = array($items, $depth, $r); |
|
672 | 672 | |
673 | - return call_user_func_array( array( $walker, 'walk' ), $args ); |
|
673 | + return call_user_func_array(array($walker, 'walk'), $args); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -684,9 +684,9 @@ discard block |
||
684 | 684 | * @param object $item |
685 | 685 | * @return string |
686 | 686 | */ |
687 | -function _nav_menu_item_id_use_once( $id, $item ) { |
|
687 | +function _nav_menu_item_id_use_once($id, $item) { |
|
688 | 688 | static $_used_ids = array(); |
689 | - if ( in_array( $item->ID, $_used_ids ) ) { |
|
689 | + if (in_array($item->ID, $_used_ids)) { |
|
690 | 690 | return ''; |
691 | 691 | } |
692 | 692 | $_used_ids[] = $item->ID; |
@@ -272,8 +272,9 @@ discard block |
||
272 | 272 | $menu = wp_get_nav_menu_object( $args->menu ); |
273 | 273 | |
274 | 274 | // Get the nav menu based on the theme_location |
275 | - if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) |
|
276 | - $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); |
|
275 | + if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) { |
|
276 | + $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); |
|
277 | + } |
|
277 | 278 | |
278 | 279 | // get the first menu that has items if we still can't find a menu |
279 | 280 | if ( ! $menu && !$args->theme_location ) { |
@@ -291,8 +292,9 @@ discard block |
||
291 | 292 | } |
292 | 293 | |
293 | 294 | // If the menu exists, get its items. |
294 | - if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) |
|
295 | - $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); |
|
295 | + if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) { |
|
296 | + $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); |
|
297 | + } |
|
296 | 298 | |
297 | 299 | /* |
298 | 300 | * If no menu was found: |
@@ -303,11 +305,13 @@ discard block |
||
303 | 305 | * - Otherwise, bail. |
304 | 306 | */ |
305 | 307 | if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) ) |
306 | - && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) |
|
307 | - return call_user_func( $args->fallback_cb, (array) $args ); |
|
308 | + && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) { |
|
309 | + return call_user_func( $args->fallback_cb, (array) $args ); |
|
310 | + } |
|
308 | 311 | |
309 | - if ( ! $menu || is_wp_error( $menu ) ) |
|
310 | - return false; |
|
312 | + if ( ! $menu || is_wp_error( $menu ) ) { |
|
313 | + return false; |
|
314 | + } |
|
311 | 315 | |
312 | 316 | $nav_menu = $items = ''; |
313 | 317 | |
@@ -336,15 +340,17 @@ discard block |
||
336 | 340 | $sorted_menu_items = $menu_items_with_children = array(); |
337 | 341 | foreach ( (array) $menu_items as $menu_item ) { |
338 | 342 | $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; |
339 | - if ( $menu_item->menu_item_parent ) |
|
340 | - $menu_items_with_children[ $menu_item->menu_item_parent ] = true; |
|
343 | + if ( $menu_item->menu_item_parent ) { |
|
344 | + $menu_items_with_children[ $menu_item->menu_item_parent ] = true; |
|
345 | + } |
|
341 | 346 | } |
342 | 347 | |
343 | 348 | // Add the menu-item-has-children class where applicable |
344 | 349 | if ( $menu_items_with_children ) { |
345 | 350 | foreach ( $sorted_menu_items as &$menu_item ) { |
346 | - if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) |
|
347 | - $menu_item->classes[] = 'menu-item-has-children'; |
|
351 | + if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) { |
|
352 | + $menu_item->classes[] = 'menu-item-has-children'; |
|
353 | + } |
|
348 | 354 | } |
349 | 355 | } |
350 | 356 | |
@@ -369,10 +375,11 @@ discard block |
||
369 | 375 | } else { |
370 | 376 | $wrap_id = 'menu-' . $menu->slug; |
371 | 377 | while ( in_array( $wrap_id, $menu_id_slugs ) ) { |
372 | - if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) |
|
373 | - $wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); |
|
374 | - else |
|
375 | - $wrap_id = $wrap_id . '-1'; |
|
378 | + if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) { |
|
379 | + $wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); |
|
380 | + } else { |
|
381 | + $wrap_id = $wrap_id . '-1'; |
|
382 | + } |
|
376 | 383 | } |
377 | 384 | } |
378 | 385 | $menu_id_slugs[] = $wrap_id; |
@@ -403,14 +410,16 @@ discard block |
||
403 | 410 | $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); |
404 | 411 | |
405 | 412 | // Don't print any markup if there are no items at this point. |
406 | - if ( empty( $items ) ) |
|
407 | - return false; |
|
413 | + if ( empty( $items ) ) { |
|
414 | + return false; |
|
415 | + } |
|
408 | 416 | |
409 | 417 | $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); |
410 | 418 | unset( $items ); |
411 | 419 | |
412 | - if ( $show_container ) |
|
413 | - $nav_menu .= '</' . $args->container . '>'; |
|
420 | + if ( $show_container ) { |
|
421 | + $nav_menu .= '</' . $args->container . '>'; |
|
422 | + } |
|
414 | 423 | |
415 | 424 | /** |
416 | 425 | * Filter the HTML content for navigation menus. |
@@ -424,11 +433,12 @@ discard block |
||
424 | 433 | */ |
425 | 434 | $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); |
426 | 435 | |
427 | - if ( $args->echo ) |
|
428 | - echo $nav_menu; |
|
429 | - else |
|
430 | - return $nav_menu; |
|
431 | -} |
|
436 | + if ( $args->echo ) { |
|
437 | + echo $nav_menu; |
|
438 | + } else { |
|
439 | + return $nav_menu; |
|
440 | + } |
|
441 | + } |
|
432 | 442 | |
433 | 443 | /** |
434 | 444 | * Add the class property classes for the current context, if applicable. |
@@ -464,8 +474,9 @@ discard block |
||
464 | 474 | $possible_object_parents = array_merge( $possible_object_parents, $terms ); |
465 | 475 | $term_to_ancestor = array(); |
466 | 476 | foreach ( (array) $term_hierarchy as $anc => $descs ) { |
467 | - foreach ( (array) $descs as $desc ) |
|
468 | - $term_to_ancestor[ $desc ] = $anc; |
|
477 | + foreach ( (array) $descs as $desc ) { |
|
478 | + $term_to_ancestor[ $desc ] = $anc; |
|
479 | + } |
|
469 | 480 | } |
470 | 481 | |
471 | 482 | foreach ( $terms as $desc ) { |
@@ -487,8 +498,9 @@ discard block |
||
487 | 498 | $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy ); |
488 | 499 | $term_to_ancestor = array(); |
489 | 500 | foreach ( (array) $term_hierarchy as $anc => $descs ) { |
490 | - foreach ( (array) $descs as $desc ) |
|
491 | - $term_to_ancestor[ $desc ] = $anc; |
|
501 | + foreach ( (array) $descs as $desc ) { |
|
502 | + $term_to_ancestor[ $desc ] = $anc; |
|
503 | + } |
|
492 | 504 | } |
493 | 505 | $desc = $queried_object->term_id; |
494 | 506 | do { |
@@ -585,13 +597,15 @@ discard block |
||
585 | 597 | $classes[] = 'current-menu-item'; |
586 | 598 | } |
587 | 599 | |
588 | - if ( untrailingslashit($item_url) == home_url() ) |
|
589 | - $classes[] = 'menu-item-home'; |
|
600 | + if ( untrailingslashit($item_url) == home_url() ) { |
|
601 | + $classes[] = 'menu-item-home'; |
|
602 | + } |
|
590 | 603 | } |
591 | 604 | |
592 | 605 | // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query |
593 | - if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) |
|
594 | - $classes[] = 'current_page_parent'; |
|
606 | + if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) { |
|
607 | + $classes[] = 'current_page_parent'; |
|
608 | + } |
|
595 | 609 | |
596 | 610 | $menu_items[$key]->classes = array_unique( $classes ); |
597 | 611 | } |
@@ -640,15 +654,18 @@ discard block |
||
640 | 654 | $classes[] = 'current-menu-parent'; |
641 | 655 | $menu_items[$key]->current_item_parent = true; |
642 | 656 | } |
643 | - if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) |
|
644 | - $classes[] = 'current-' . $active_object . '-parent'; |
|
657 | + if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) { |
|
658 | + $classes[] = 'current-' . $active_object . '-parent'; |
|
659 | + } |
|
645 | 660 | |
646 | 661 | if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) { |
647 | 662 | // Back compat classes for pages to match wp_page_menu() |
648 | - if ( in_array('current-menu-parent', $classes) ) |
|
649 | - $classes[] = 'current_page_parent'; |
|
650 | - if ( in_array('current-menu-ancestor', $classes) ) |
|
651 | - $classes[] = 'current_page_ancestor'; |
|
663 | + if ( in_array('current-menu-parent', $classes) ) { |
|
664 | + $classes[] = 'current_page_parent'; |
|
665 | + } |
|
666 | + if ( in_array('current-menu-ancestor', $classes) ) { |
|
667 | + $classes[] = 'current_page_ancestor'; |
|
668 | + } |
|
652 | 669 | } |
653 | 670 | |
654 | 671 | $menu_items[$key]->classes = array_unique( $classes ); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * BackPress Scripts enqueue. |
|
4 | - * |
|
5 | - * These classes were refactored from the WordPress WP_Scripts and WordPress |
|
6 | - * script enqueue API. |
|
7 | - * |
|
8 | - * @package BackPress |
|
9 | - * @since r16 |
|
10 | - */ |
|
3 | + * BackPress Scripts enqueue. |
|
4 | + * |
|
5 | + * These classes were refactored from the WordPress WP_Scripts and WordPress |
|
6 | + * script enqueue API. |
|
7 | + * |
|
8 | + * @package BackPress |
|
9 | + * @since r16 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * BackPress Scripts enqueue class. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function __construct() { |
34 | 34 | $this->init(); |
35 | - add_action( 'init', array( $this, 'init' ), 0 ); |
|
35 | + add_action('init', array($this, 'init'), 0); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param WP_Scripts &$this WP_Scripts instance, passed by reference. |
48 | 48 | */ |
49 | - do_action_ref_array( 'wp_default_scripts', array(&$this) ); |
|
49 | + do_action_ref_array('wp_default_scripts', array(&$this)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * Default false. |
61 | 61 | * @return array Scripts that have been printed. |
62 | 62 | */ |
63 | - public function print_scripts( $handles = false, $group = false ) { |
|
64 | - return $this->do_items( $handles, $group ); |
|
63 | + public function print_scripts($handles = false, $group = false) { |
|
64 | + return $this->do_items($handles, $group); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @param bool $echo |
73 | 73 | * @return bool|string|void |
74 | 74 | */ |
75 | - public function print_scripts_l10n( $handle, $echo = true ) { |
|
76 | - _deprecated_function( __FUNCTION__, '3.3', 'print_extra_script()' ); |
|
77 | - return $this->print_extra_script( $handle, $echo ); |
|
75 | + public function print_scripts_l10n($handle, $echo = true) { |
|
76 | + _deprecated_function(__FUNCTION__, '3.3', 'print_extra_script()'); |
|
77 | + return $this->print_extra_script($handle, $echo); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * @param bool $echo |
83 | 83 | * @return bool|string|void |
84 | 84 | */ |
85 | - public function print_extra_script( $handle, $echo = true ) { |
|
86 | - if ( !$output = $this->get_data( $handle, 'data' ) ) |
|
85 | + public function print_extra_script($handle, $echo = true) { |
|
86 | + if ( ! $output = $this->get_data($handle, 'data')) |
|
87 | 87 | return; |
88 | 88 | |
89 | - if ( !$echo ) |
|
89 | + if ( ! $echo) |
|
90 | 90 | return $output; |
91 | 91 | |
92 | 92 | echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5 |
@@ -103,39 +103,39 @@ discard block |
||
103 | 103 | * @param int|bool $group |
104 | 104 | * @return bool True on success, false if not set. |
105 | 105 | */ |
106 | - public function do_item( $handle, $group = false ) { |
|
107 | - if ( !parent::do_item($handle) ) |
|
106 | + public function do_item($handle, $group = false) { |
|
107 | + if ( ! parent::do_item($handle)) |
|
108 | 108 | return false; |
109 | 109 | |
110 | - if ( 0 === $group && $this->groups[$handle] > 0 ) { |
|
110 | + if (0 === $group && $this->groups[$handle] > 0) { |
|
111 | 111 | $this->in_footer[] = $handle; |
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
115 | - if ( false === $group && in_array($handle, $this->in_footer, true) ) |
|
116 | - $this->in_footer = array_diff( $this->in_footer, (array) $handle ); |
|
115 | + if (false === $group && in_array($handle, $this->in_footer, true)) |
|
116 | + $this->in_footer = array_diff($this->in_footer, (array) $handle); |
|
117 | 117 | |
118 | 118 | $obj = $this->registered[$handle]; |
119 | 119 | |
120 | - if ( null === $obj->ver ) { |
|
120 | + if (null === $obj->ver) { |
|
121 | 121 | $ver = ''; |
122 | 122 | } else { |
123 | 123 | $ver = $obj->ver ? $obj->ver : $this->default_version; |
124 | 124 | } |
125 | 125 | |
126 | - if ( isset($this->args[$handle]) ) |
|
127 | - $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; |
|
126 | + if (isset($this->args[$handle])) |
|
127 | + $ver = $ver ? $ver.'&'.$this->args[$handle] : $this->args[$handle]; |
|
128 | 128 | |
129 | 129 | $src = $obj->src; |
130 | 130 | $cond_before = $cond_after = ''; |
131 | - $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; |
|
131 | + $conditional = isset($obj->extra['conditional']) ? $obj->extra['conditional'] : ''; |
|
132 | 132 | |
133 | - if ( $conditional ) { |
|
133 | + if ($conditional) { |
|
134 | 134 | $cond_before = "<!--[if {$conditional}]>\n"; |
135 | 135 | $cond_after = "<![endif]-->\n"; |
136 | 136 | } |
137 | 137 | |
138 | - if ( $this->do_concat ) { |
|
138 | + if ($this->do_concat) { |
|
139 | 139 | /** |
140 | 140 | * Filter the script loader source. |
141 | 141 | * |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * @param string $src Script loader source path. |
145 | 145 | * @param string $handle Script handle. |
146 | 146 | */ |
147 | - $srce = apply_filters( 'script_loader_src', $src, $handle ); |
|
148 | - if ( $this->in_default_dir( $srce ) && ! $conditional ) { |
|
149 | - $this->print_code .= $this->print_extra_script( $handle, false ); |
|
147 | + $srce = apply_filters('script_loader_src', $src, $handle); |
|
148 | + if ($this->in_default_dir($srce) && ! $conditional) { |
|
149 | + $this->print_code .= $this->print_extra_script($handle, false); |
|
150 | 150 | $this->concat .= "$handle,"; |
151 | 151 | $this->concat_version .= "$handle$ver"; |
152 | 152 | return true; |
@@ -156,29 +156,29 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - $has_conditional_data = $conditional && $this->get_data( $handle, 'data' ); |
|
159 | + $has_conditional_data = $conditional && $this->get_data($handle, 'data'); |
|
160 | 160 | |
161 | - if ( $has_conditional_data ) { |
|
161 | + if ($has_conditional_data) { |
|
162 | 162 | echo $cond_before; |
163 | 163 | } |
164 | 164 | |
165 | - $this->print_extra_script( $handle ); |
|
165 | + $this->print_extra_script($handle); |
|
166 | 166 | |
167 | - if ( $has_conditional_data ) { |
|
167 | + if ($has_conditional_data) { |
|
168 | 168 | echo $cond_after; |
169 | 169 | } |
170 | 170 | |
171 | - if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) { |
|
172 | - $src = $this->base_url . $src; |
|
171 | + if ( ! preg_match('|^(https?:)?//|', $src) && ! ($this->content_url && 0 === strpos($src, $this->content_url))) { |
|
172 | + $src = $this->base_url.$src; |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( ! empty( $ver ) ) |
|
176 | - $src = add_query_arg( 'ver', $ver, $src ); |
|
175 | + if ( ! empty($ver)) |
|
176 | + $src = add_query_arg('ver', $ver, $src); |
|
177 | 177 | |
178 | 178 | /** This filter is documented in wp-includes/class.wp-scripts.php */ |
179 | - $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); |
|
179 | + $src = esc_url(apply_filters('script_loader_src', $src, $handle)); |
|
180 | 180 | |
181 | - if ( ! $src ) |
|
181 | + if ( ! $src) |
|
182 | 182 | return true; |
183 | 183 | |
184 | 184 | $tag = "{$cond_before}<script type='text/javascript' src='$src'></script>\n{$cond_after}"; |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * @param string $handle The script's registered handle. |
193 | 193 | * @param string $src The script's source URL. |
194 | 194 | */ |
195 | - $tag = apply_filters( 'script_loader_tag', $tag, $handle, $src ); |
|
195 | + $tag = apply_filters('script_loader_tag', $tag, $handle, $src); |
|
196 | 196 | |
197 | - if ( $this->do_concat ) { |
|
197 | + if ($this->do_concat) { |
|
198 | 198 | $this->print_html .= $tag; |
199 | 199 | } else { |
200 | 200 | echo $tag; |
@@ -211,33 +211,33 @@ discard block |
||
211 | 211 | * @param array $l10n |
212 | 212 | * @return bool |
213 | 213 | */ |
214 | - public function localize( $handle, $object_name, $l10n ) { |
|
215 | - if ( $handle === 'jquery' ) |
|
214 | + public function localize($handle, $object_name, $l10n) { |
|
215 | + if ($handle === 'jquery') |
|
216 | 216 | $handle = 'jquery-core'; |
217 | 217 | |
218 | - if ( is_array($l10n) && isset($l10n['l10n_print_after']) ) { // back compat, preserve the code in 'l10n_print_after' if present |
|
218 | + if (is_array($l10n) && isset($l10n['l10n_print_after'])) { // back compat, preserve the code in 'l10n_print_after' if present |
|
219 | 219 | $after = $l10n['l10n_print_after']; |
220 | 220 | unset($l10n['l10n_print_after']); |
221 | 221 | } |
222 | 222 | |
223 | - foreach ( (array) $l10n as $key => $value ) { |
|
224 | - if ( !is_scalar($value) ) |
|
223 | + foreach ((array) $l10n as $key => $value) { |
|
224 | + if ( ! is_scalar($value)) |
|
225 | 225 | continue; |
226 | 226 | |
227 | - $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8'); |
|
227 | + $l10n[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
228 | 228 | } |
229 | 229 | |
230 | - $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; |
|
230 | + $script = "var $object_name = ".wp_json_encode($l10n).';'; |
|
231 | 231 | |
232 | - if ( !empty($after) ) |
|
232 | + if ( ! empty($after)) |
|
233 | 233 | $script .= "\n$after;"; |
234 | 234 | |
235 | - $data = $this->get_data( $handle, 'data' ); |
|
235 | + $data = $this->get_data($handle, 'data'); |
|
236 | 236 | |
237 | - if ( !empty( $data ) ) |
|
237 | + if ( ! empty($data)) |
|
238 | 238 | $script = "$data\n$script"; |
239 | 239 | |
240 | - return $this->add_data( $handle, 'data', $script ); |
|
240 | + return $this->add_data($handle, 'data', $script); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | * @param mixed $group Group level. |
247 | 247 | * @return bool Not already in the group or a lower group |
248 | 248 | */ |
249 | - public function set_group( $handle, $recursion, $group = false ) { |
|
250 | - if ( $this->registered[$handle]->args === 1 ) |
|
249 | + public function set_group($handle, $recursion, $group = false) { |
|
250 | + if ($this->registered[$handle]->args === 1) |
|
251 | 251 | $grp = 1; |
252 | 252 | else |
253 | - $grp = (int) $this->get_data( $handle, 'group' ); |
|
253 | + $grp = (int) $this->get_data($handle, 'group'); |
|
254 | 254 | |
255 | - if ( false !== $group && $grp > $group ) |
|
255 | + if (false !== $group && $grp > $group) |
|
256 | 256 | $grp = $group; |
257 | 257 | |
258 | - return parent::set_group( $handle, $recursion, $grp ); |
|
258 | + return parent::set_group($handle, $recursion, $grp); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | * @param mixed $group Group level: (int) level, (false) no groups. |
265 | 265 | * @return bool True on success, false on failure. |
266 | 266 | */ |
267 | - public function all_deps( $handles, $recursion = false, $group = false ) { |
|
268 | - $r = parent::all_deps( $handles, $recursion ); |
|
269 | - if ( ! $recursion ) { |
|
267 | + public function all_deps($handles, $recursion = false, $group = false) { |
|
268 | + $r = parent::all_deps($handles, $recursion); |
|
269 | + if ( ! $recursion) { |
|
270 | 270 | /** |
271 | 271 | * Filter the list of script dependencies left to print. |
272 | 272 | * |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @param array $to_do An array of script dependencies. |
276 | 276 | */ |
277 | - $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); |
|
277 | + $this->to_do = apply_filters('print_scripts_array', $this->to_do); |
|
278 | 278 | } |
279 | 279 | return $r; |
280 | 280 | } |
@@ -299,17 +299,17 @@ discard block |
||
299 | 299 | * @param string $src |
300 | 300 | * @return bool |
301 | 301 | */ |
302 | - public function in_default_dir( $src ) { |
|
303 | - if ( ! $this->default_dirs ) { |
|
302 | + public function in_default_dir($src) { |
|
303 | + if ( ! $this->default_dirs) { |
|
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | - if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) { |
|
307 | + if (0 === strpos($src, '/'.WPINC.'/js/l10n')) { |
|
308 | 308 | return false; |
309 | 309 | } |
310 | 310 | |
311 | - foreach ( (array) $this->default_dirs as $test ) { |
|
312 | - if ( 0 === strpos( $src, $test ) ) { |
|
311 | + foreach ((array) $this->default_dirs as $test) { |
|
312 | + if (0 === strpos($src, $test)) { |
|
313 | 313 | return true; |
314 | 314 | } |
315 | 315 | } |
@@ -83,11 +83,13 @@ discard block |
||
83 | 83 | * @return bool|string|void |
84 | 84 | */ |
85 | 85 | public function print_extra_script( $handle, $echo = true ) { |
86 | - if ( !$output = $this->get_data( $handle, 'data' ) ) |
|
87 | - return; |
|
86 | + if ( !$output = $this->get_data( $handle, 'data' ) ) { |
|
87 | + return; |
|
88 | + } |
|
88 | 89 | |
89 | - if ( !$echo ) |
|
90 | - return $output; |
|
90 | + if ( !$echo ) { |
|
91 | + return $output; |
|
92 | + } |
|
91 | 93 | |
92 | 94 | echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5 |
93 | 95 | echo "/* <![CDATA[ */\n"; |
@@ -104,16 +106,18 @@ discard block |
||
104 | 106 | * @return bool True on success, false if not set. |
105 | 107 | */ |
106 | 108 | public function do_item( $handle, $group = false ) { |
107 | - if ( !parent::do_item($handle) ) |
|
108 | - return false; |
|
109 | + if ( !parent::do_item($handle) ) { |
|
110 | + return false; |
|
111 | + } |
|
109 | 112 | |
110 | 113 | if ( 0 === $group && $this->groups[$handle] > 0 ) { |
111 | 114 | $this->in_footer[] = $handle; |
112 | 115 | return false; |
113 | 116 | } |
114 | 117 | |
115 | - if ( false === $group && in_array($handle, $this->in_footer, true) ) |
|
116 | - $this->in_footer = array_diff( $this->in_footer, (array) $handle ); |
|
118 | + if ( false === $group && in_array($handle, $this->in_footer, true) ) { |
|
119 | + $this->in_footer = array_diff( $this->in_footer, (array) $handle ); |
|
120 | + } |
|
117 | 121 | |
118 | 122 | $obj = $this->registered[$handle]; |
119 | 123 | |
@@ -123,8 +127,9 @@ discard block |
||
123 | 127 | $ver = $obj->ver ? $obj->ver : $this->default_version; |
124 | 128 | } |
125 | 129 | |
126 | - if ( isset($this->args[$handle]) ) |
|
127 | - $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; |
|
130 | + if ( isset($this->args[$handle]) ) { |
|
131 | + $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; |
|
132 | + } |
|
128 | 133 | |
129 | 134 | $src = $obj->src; |
130 | 135 | $cond_before = $cond_after = ''; |
@@ -172,14 +177,16 @@ discard block |
||
172 | 177 | $src = $this->base_url . $src; |
173 | 178 | } |
174 | 179 | |
175 | - if ( ! empty( $ver ) ) |
|
176 | - $src = add_query_arg( 'ver', $ver, $src ); |
|
180 | + if ( ! empty( $ver ) ) { |
|
181 | + $src = add_query_arg( 'ver', $ver, $src ); |
|
182 | + } |
|
177 | 183 | |
178 | 184 | /** This filter is documented in wp-includes/class.wp-scripts.php */ |
179 | 185 | $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); |
180 | 186 | |
181 | - if ( ! $src ) |
|
182 | - return true; |
|
187 | + if ( ! $src ) { |
|
188 | + return true; |
|
189 | + } |
|
183 | 190 | |
184 | 191 | $tag = "{$cond_before}<script type='text/javascript' src='$src'></script>\n{$cond_after}"; |
185 | 192 | |
@@ -212,8 +219,9 @@ discard block |
||
212 | 219 | * @return bool |
213 | 220 | */ |
214 | 221 | public function localize( $handle, $object_name, $l10n ) { |
215 | - if ( $handle === 'jquery' ) |
|
216 | - $handle = 'jquery-core'; |
|
222 | + if ( $handle === 'jquery' ) { |
|
223 | + $handle = 'jquery-core'; |
|
224 | + } |
|
217 | 225 | |
218 | 226 | if ( is_array($l10n) && isset($l10n['l10n_print_after']) ) { // back compat, preserve the code in 'l10n_print_after' if present |
219 | 227 | $after = $l10n['l10n_print_after']; |
@@ -221,21 +229,24 @@ discard block |
||
221 | 229 | } |
222 | 230 | |
223 | 231 | foreach ( (array) $l10n as $key => $value ) { |
224 | - if ( !is_scalar($value) ) |
|
225 | - continue; |
|
232 | + if ( !is_scalar($value) ) { |
|
233 | + continue; |
|
234 | + } |
|
226 | 235 | |
227 | 236 | $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8'); |
228 | 237 | } |
229 | 238 | |
230 | 239 | $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; |
231 | 240 | |
232 | - if ( !empty($after) ) |
|
233 | - $script .= "\n$after;"; |
|
241 | + if ( !empty($after) ) { |
|
242 | + $script .= "\n$after;"; |
|
243 | + } |
|
234 | 244 | |
235 | 245 | $data = $this->get_data( $handle, 'data' ); |
236 | 246 | |
237 | - if ( !empty( $data ) ) |
|
238 | - $script = "$data\n$script"; |
|
247 | + if ( !empty( $data ) ) { |
|
248 | + $script = "$data\n$script"; |
|
249 | + } |
|
239 | 250 | |
240 | 251 | return $this->add_data( $handle, 'data', $script ); |
241 | 252 | } |
@@ -247,13 +258,15 @@ discard block |
||
247 | 258 | * @return bool Not already in the group or a lower group |
248 | 259 | */ |
249 | 260 | public function set_group( $handle, $recursion, $group = false ) { |
250 | - if ( $this->registered[$handle]->args === 1 ) |
|
251 | - $grp = 1; |
|
252 | - else |
|
253 | - $grp = (int) $this->get_data( $handle, 'group' ); |
|
261 | + if ( $this->registered[$handle]->args === 1 ) { |
|
262 | + $grp = 1; |
|
263 | + } else { |
|
264 | + $grp = (int) $this->get_data( $handle, 'group' ); |
|
265 | + } |
|
254 | 266 | |
255 | - if ( false !== $group && $grp > $group ) |
|
256 | - $grp = $group; |
|
267 | + if ( false !== $group && $grp > $group ) { |
|
268 | + $grp = $group; |
|
269 | + } |
|
257 | 270 | |
258 | 271 | return parent::set_group( $handle, $recursion, $grp ); |
259 | 272 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Deprecated. Use rss.php instead. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - */ |
|
3 | + * Deprecated. Use rss.php instead. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | _deprecated_file( basename(__FILE__), '2.1', WPINC . '/rss.php' ); |
9 | 9 | require_once( ABSPATH . WPINC . '/rss.php' ); |
@@ -5,5 +5,5 @@ |
||
5 | 5 | * @package WordPress |
6 | 6 | */ |
7 | 7 | |
8 | -_deprecated_file( basename(__FILE__), '2.1', WPINC . '/rss.php' ); |
|
9 | -require_once( ABSPATH . WPINC . '/rss.php' ); |
|
8 | +_deprecated_file(basename(__FILE__), '2.1', WPINC.'/rss.php'); |
|
9 | +require_once(ABSPATH.WPINC.'/rss.php'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Date and Time Locale object |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage i18n |
|
7 | - */ |
|
3 | + * Date and Time Locale object |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage i18n |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class that loads the calendar locale. |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; |
180 | 180 | |
181 | 181 | // Set text direction. |
182 | - if ( isset( $GLOBALS['text_direction'] ) ) |
|
182 | + if (isset($GLOBALS['text_direction'])) |
|
183 | 183 | $this->text_direction = $GLOBALS['text_direction']; |
184 | 184 | /* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */ |
185 | - elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) |
|
185 | + elseif ('rtl' == _x('ltr', 'text direction')) |
|
186 | 186 | $this->text_direction = 'rtl'; |
187 | 187 | |
188 | - if ( 'rtl' === $this->text_direction && strpos( $GLOBALS['wp_version'], '-src' ) ) { |
|
188 | + if ('rtl' === $this->text_direction && strpos($GLOBALS['wp_version'], '-src')) { |
|
189 | 189 | $this->text_direction = 'ltr'; |
190 | - add_action( 'all_admin_notices', array( $this, 'rtl_src_admin_notice' ) ); |
|
190 | + add_action('all_admin_notices', array($this, 'rtl_src_admin_notice')); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function rtl_src_admin_notice() { |
198 | 198 | /* translators: %s: Name of the directory (build) */ |
199 | - echo '<div class="error"><p>' . sprintf( __( 'The %s directory of the develop repository must be used for RTL.' ), '<code>build</code>' ) . '</p></div>'; |
|
199 | + echo '<div class="error"><p>'.sprintf(__('The %s directory of the develop repository must be used for RTL.'), '<code>build</code>').'</p></div>'; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function _strings_for_pot() { |
357 | 357 | /* translators: localized date format, see http://php.net/date */ |
358 | - __( 'F j, Y' ); |
|
358 | + __('F j, Y'); |
|
359 | 359 | /* translators: localized time format, see http://php.net/date */ |
360 | - __( 'g:i a' ); |
|
360 | + __('g:i a'); |
|
361 | 361 | /* translators: localized date and time format, see http://php.net/date */ |
362 | - __( 'F j, Y g:i a' ); |
|
362 | + __('F j, Y g:i a'); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 |
@@ -179,11 +179,13 @@ |
||
179 | 179 | $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; |
180 | 180 | |
181 | 181 | // Set text direction. |
182 | - if ( isset( $GLOBALS['text_direction'] ) ) |
|
183 | - $this->text_direction = $GLOBALS['text_direction']; |
|
182 | + if ( isset( $GLOBALS['text_direction'] ) ) { |
|
183 | + $this->text_direction = $GLOBALS['text_direction']; |
|
184 | + } |
|
184 | 185 | /* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */ |
185 | - elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) |
|
186 | - $this->text_direction = 'rtl'; |
|
186 | + elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) { |
|
187 | + $this->text_direction = 'rtl'; |
|
188 | + } |
|
187 | 189 | |
188 | 190 | if ( 'rtl' === $this->text_direction && strpos( $GLOBALS['wp_version'], '-src' ) ) { |
189 | 191 | $this->text_direction = 'ltr'; |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * RSS2 Feed Template for displaying RSS2 Posts feed. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - */ |
|
3 | + * RSS2 Feed Template for displaying RSS2 Posts feed. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true); |
9 | 9 | $more = 1; |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package WordPress |
6 | 6 | */ |
7 | 7 | |
8 | -header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true); |
|
8 | +header('Content-Type: '.feed_content_type('rss2').'; charset='.get_option('blog_charset'), true); |
|
9 | 9 | $more = 1; |
10 | 10 | |
11 | 11 | echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments', |
19 | 19 | * 'rdf', 'atom', and 'atom-comments'. |
20 | 20 | */ |
21 | -do_action( 'rss_tag_pre', 'rss2' ); |
|
21 | +do_action('rss_tag_pre', 'rss2'); |
|
22 | 22 | ?> |
23 | 23 | <rss version="2.0" |
24 | 24 | xmlns:content="http://purl.org/rss/1.0/modules/content/" |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @since 2.0.0 |
35 | 35 | */ |
36 | - do_action( 'rss2_ns' ); |
|
36 | + do_action('rss2_ns'); |
|
37 | 37 | ?> |
38 | 38 | > |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <link><?php bloginfo_rss('url') ?></link> |
44 | 44 | <description><?php bloginfo_rss("description") ?></description> |
45 | 45 | <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate> |
46 | - <language><?php bloginfo_rss( 'language' ); ?></language> |
|
46 | + <language><?php bloginfo_rss('language'); ?></language> |
|
47 | 47 | <sy:updatePeriod><?php |
48 | 48 | $duration = 'hourly'; |
49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly', |
56 | 56 | * 'yearly'. Default 'hourly'. |
57 | 57 | */ |
58 | - echo apply_filters( 'rss_update_period', $duration ); |
|
58 | + echo apply_filters('rss_update_period', $duration); |
|
59 | 59 | ?></sy:updatePeriod> |
60 | 60 | <sy:updateFrequency><?php |
61 | 61 | $frequency = '1'; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $frequency An integer passed as a string representing the frequency |
69 | 69 | * of RSS updates within the update period. Default '1'. |
70 | 70 | */ |
71 | - echo apply_filters( 'rss_update_frequency', $frequency ); |
|
71 | + echo apply_filters('rss_update_frequency', $frequency); |
|
72 | 72 | ?></sy:updateFrequency> |
73 | 73 | <?php |
74 | 74 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @since 2.0.0 |
78 | 78 | */ |
79 | - do_action( 'rss2_head'); |
|
79 | + do_action('rss2_head'); |
|
80 | 80 | |
81 | - while( have_posts()) : the_post(); |
|
81 | + while (have_posts()) : the_post(); |
|
82 | 82 | ?> |
83 | 83 | <item> |
84 | 84 | <title><?php the_title_rss() ?></title> |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | <?php else : ?> |
95 | 95 | <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
96 | 96 | <?php $content = get_the_content_feed('rss2'); ?> |
97 | - <?php if ( strlen( $content ) > 0 ) : ?> |
|
97 | + <?php if (strlen($content) > 0) : ?> |
|
98 | 98 | <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> |
99 | 99 | <?php else : ?> |
100 | 100 | <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded> |
101 | 101 | <?php endif; ?> |
102 | 102 | <?php endif; ?> |
103 | - <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss> |
|
103 | + <wfw:commentRss><?php echo esc_url(get_post_comments_feed_link(null, 'rss2')); ?></wfw:commentRss> |
|
104 | 104 | <slash:comments><?php echo get_comments_number(); ?></slash:comments> |
105 | 105 | <?php rss_enclosure(); ?> |
106 | 106 | <?php |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 2.0.0 |
111 | 111 | */ |
112 | - do_action( 'rss2_item' ); |
|
112 | + do_action('rss2_item'); |
|
113 | 113 | ?> |
114 | 114 | </item> |
115 | 115 | <?php endwhile; ?> |
@@ -91,13 +91,19 @@ |
||
91 | 91 | <guid isPermaLink="false"><?php the_guid(); ?></guid> |
92 | 92 | <?php if (get_option('rss_use_excerpt')) : ?> |
93 | 93 | <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
94 | -<?php else : ?> |
|
95 | - <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
|
94 | +<?php else { |
|
95 | + : ?> |
|
96 | + <description><![CDATA[<?php the_excerpt_rss(); |
|
97 | +} |
|
98 | +?>]]></description> |
|
96 | 99 | <?php $content = get_the_content_feed('rss2'); ?> |
97 | 100 | <?php if ( strlen( $content ) > 0 ) : ?> |
98 | 101 | <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> |
99 | - <?php else : ?> |
|
100 | - <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded> |
|
102 | + <?php else { |
|
103 | + : ?> |
|
104 | + <content:encoded><![CDATA[<?php the_excerpt_rss(); |
|
105 | +} |
|
106 | +?>]]></content:encoded> |
|
101 | 107 | <?php endif; ?> |
102 | 108 | <?php endif; ?> |
103 | 109 | <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss> |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // We should only use the last Content-Type header. c.f. issue #1 |
259 | 259 | if (isset($this->headers[$this->name]) && $this->name !== 'content-type') |
260 | 260 | { |
261 | - $this->headers[$this->name] .= ', ' . $this->value; |
|
261 | + $this->headers[$this->name] .= ', '.$this->value; |
|
262 | 262 | } |
263 | 263 | else |
264 | 264 | { |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | protected function body() |
442 | 442 | { |
443 | 443 | $this->body = substr($this->data, $this->position); |
444 | - if (!empty($this->headers['transfer-encoding'])) |
|
444 | + if ( ! empty($this->headers['transfer-encoding'])) |
|
445 | 445 | { |
446 | 446 | unset($this->headers['transfer-encoding']); |
447 | 447 | $this->state = 'chunked'; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | protected function chunked() |
459 | 459 | { |
460 | - if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) |
|
460 | + if ( ! preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) |
|
461 | 461 | { |
462 | 462 | $this->state = 'emit'; |
463 | 463 | return; |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | |
469 | 469 | while (true) |
470 | 470 | { |
471 | - $is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches ); |
|
472 | - if (!$is_chunked) |
|
471 | + $is_chunked = (bool) preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches); |
|
472 | + if ( ! $is_chunked) |
|
473 | 473 | { |
474 | 474 | // Looks like it's not chunked after all |
475 | 475 | $this->state = 'emit'; |
@@ -155,8 +155,7 @@ discard block |
||
155 | 155 | if ($this->state === 'emit' || $this->state === 'body') |
156 | 156 | { |
157 | 157 | return true; |
158 | - } |
|
159 | - else |
|
158 | + } else |
|
160 | 159 | { |
161 | 160 | $this->http_version = ''; |
162 | 161 | $this->status_code = ''; |
@@ -206,13 +205,11 @@ discard block |
||
206 | 205 | $this->http_version = (float) $this->http_version; |
207 | 206 | $this->position += strspn($this->data, "\x09\x20", $this->position); |
208 | 207 | $this->state = 'status'; |
209 | - } |
|
210 | - else |
|
208 | + } else |
|
211 | 209 | { |
212 | 210 | $this->state = false; |
213 | 211 | } |
214 | - } |
|
215 | - else |
|
212 | + } else |
|
216 | 213 | { |
217 | 214 | $this->state = false; |
218 | 215 | } |
@@ -228,8 +225,7 @@ discard block |
||
228 | 225 | $this->status_code = (int) substr($this->data, $this->position, $len); |
229 | 226 | $this->position += $len; |
230 | 227 | $this->state = 'reason'; |
231 | - } |
|
232 | - else |
|
228 | + } else |
|
233 | 229 | { |
234 | 230 | $this->state = false; |
235 | 231 | } |
@@ -259,8 +255,7 @@ discard block |
||
259 | 255 | if (isset($this->headers[$this->name]) && $this->name !== 'content-type') |
260 | 256 | { |
261 | 257 | $this->headers[$this->name] .= ', ' . $this->value; |
262 | - } |
|
263 | - else |
|
258 | + } else |
|
264 | 259 | { |
265 | 260 | $this->headers[$this->name] = $this->value; |
266 | 261 | } |
@@ -271,13 +266,11 @@ discard block |
||
271 | 266 | { |
272 | 267 | $this->position += 2; |
273 | 268 | $this->state = 'body'; |
274 | - } |
|
275 | - elseif ($this->data[$this->position] === "\x0A") |
|
269 | + } elseif ($this->data[$this->position] === "\x0A") |
|
276 | 270 | { |
277 | 271 | $this->position++; |
278 | 272 | $this->state = 'body'; |
279 | - } |
|
280 | - else |
|
273 | + } else |
|
281 | 274 | { |
282 | 275 | $this->state = 'name'; |
283 | 276 | } |
@@ -295,15 +288,13 @@ discard block |
||
295 | 288 | { |
296 | 289 | $this->position += $len; |
297 | 290 | $this->state = 'new_line'; |
298 | - } |
|
299 | - else |
|
291 | + } else |
|
300 | 292 | { |
301 | 293 | $this->name = substr($this->data, $this->position, $len); |
302 | 294 | $this->position += $len + 1; |
303 | 295 | $this->state = 'value'; |
304 | 296 | } |
305 | - } |
|
306 | - else |
|
297 | + } else |
|
307 | 298 | { |
308 | 299 | $this->state = false; |
309 | 300 | } |
@@ -319,8 +310,7 @@ discard block |
||
319 | 310 | if (substr($this->data, $this->position, 2) === "\x0D\x0A") |
320 | 311 | { |
321 | 312 | $this->position += 2; |
322 | - } |
|
323 | - elseif ($this->data[$this->position] === "\x0A") |
|
313 | + } elseif ($this->data[$this->position] === "\x0A") |
|
324 | 314 | { |
325 | 315 | $this->position++; |
326 | 316 | } |
@@ -337,8 +327,7 @@ discard block |
||
337 | 327 | if ($this->is_linear_whitespace()) |
338 | 328 | { |
339 | 329 | $this->linear_whitespace(); |
340 | - } |
|
341 | - else |
|
330 | + } else |
|
342 | 331 | { |
343 | 332 | switch ($this->data[$this->position]) |
344 | 333 | { |
@@ -387,8 +376,7 @@ discard block |
||
387 | 376 | if ($this->is_linear_whitespace()) |
388 | 377 | { |
389 | 378 | $this->linear_whitespace(); |
390 | - } |
|
391 | - else |
|
379 | + } else |
|
392 | 380 | { |
393 | 381 | switch ($this->data[$this->position]) |
394 | 382 | { |
@@ -445,8 +433,7 @@ discard block |
||
445 | 433 | { |
446 | 434 | unset($this->headers['transfer-encoding']); |
447 | 435 | $this->state = 'chunked'; |
448 | - } |
|
449 | - else |
|
436 | + } else |
|
450 | 437 | { |
451 | 438 | $this->state = 'emit'; |
452 | 439 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Handles `<atom:source>` |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
198 | 198 | } |
199 | 199 | |
200 | - if (!empty($categories)) |
|
200 | + if ( ! empty($categories)) |
|
201 | 201 | { |
202 | 202 | return array_unique($categories); |
203 | 203 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
281 | 281 | } |
282 | 282 | |
283 | - if (!empty($authors)) |
|
283 | + if ( ! empty($authors)) |
|
284 | 284 | { |
285 | 285 | return array_unique($authors); |
286 | 286 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | - if (!empty($contributors)) |
|
354 | + if ( ! empty($contributors)) |
|
355 | 355 | { |
356 | 356 | return array_unique($contributors); |
357 | 357 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | public function get_links($rel = 'alternate') |
386 | 386 | { |
387 | - if (!isset($this->data['links'])) |
|
387 | + if ( ! isset($this->data['links'])) |
|
388 | 388 | { |
389 | 389 | $this->data['links'] = array(); |
390 | 390 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) |
@@ -428,19 +428,19 @@ discard block |
||
428 | 428 | { |
429 | 429 | if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) |
430 | 430 | { |
431 | - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) |
|
431 | + if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key])) |
|
432 | 432 | { |
433 | - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); |
|
434 | - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; |
|
433 | + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]); |
|
434 | + $this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]; |
|
435 | 435 | } |
436 | 436 | else |
437 | 437 | { |
438 | - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
|
438 | + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key]; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
442 | 442 | { |
443 | - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
|
443 | + $this->data['links'][substr($key, 41)] = & $this->data['links'][$key]; |
|
444 | 444 | } |
445 | 445 | $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
446 | 446 | } |
@@ -79,8 +79,7 @@ discard block |
||
79 | 79 | if (isset($this->data['child'][$namespace][$tag])) |
80 | 80 | { |
81 | 81 | return $this->data['child'][$namespace][$tag]; |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | return null; |
86 | 85 | } |
@@ -106,32 +105,25 @@ discard block |
||
106 | 105 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) |
107 | 106 | { |
108 | 107 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
109 | - } |
|
110 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
108 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
111 | 109 | { |
112 | 110 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
113 | - } |
|
114 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
111 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
115 | 112 | { |
116 | 113 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
117 | - } |
|
118 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
114 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
119 | 115 | { |
120 | 116 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
121 | - } |
|
122 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
117 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
123 | 118 | { |
124 | 119 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
125 | - } |
|
126 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
120 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
127 | 121 | { |
128 | 122 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
129 | - } |
|
130 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
123 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
131 | 124 | { |
132 | 125 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
133 | - } |
|
134 | - else |
|
126 | + } else |
|
135 | 127 | { |
136 | 128 | return null; |
137 | 129 | } |
@@ -143,8 +135,7 @@ discard block |
||
143 | 135 | if (isset($categories[$key])) |
144 | 136 | { |
145 | 137 | return $categories[$key]; |
146 | - } |
|
147 | - else |
|
138 | + } else |
|
148 | 139 | { |
149 | 140 | return null; |
150 | 141 | } |
@@ -181,8 +172,7 @@ discard block |
||
181 | 172 | if (isset($category['attribs']['']['domain'])) |
182 | 173 | { |
183 | 174 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
184 | - } |
|
185 | - else |
|
175 | + } else |
|
186 | 176 | { |
187 | 177 | $scheme = null; |
188 | 178 | } |
@@ -200,8 +190,7 @@ discard block |
||
200 | 190 | if (!empty($categories)) |
201 | 191 | { |
202 | 192 | return array_unique($categories); |
203 | - } |
|
204 | - else |
|
193 | + } else |
|
205 | 194 | { |
206 | 195 | return null; |
207 | 196 | } |
@@ -213,8 +202,7 @@ discard block |
||
213 | 202 | if (isset($authors[$key])) |
214 | 203 | { |
215 | 204 | return $authors[$key]; |
216 | - } |
|
217 | - else |
|
205 | + } else |
|
218 | 206 | { |
219 | 207 | return null; |
220 | 208 | } |
@@ -283,8 +271,7 @@ discard block |
||
283 | 271 | if (!empty($authors)) |
284 | 272 | { |
285 | 273 | return array_unique($authors); |
286 | - } |
|
287 | - else |
|
274 | + } else |
|
288 | 275 | { |
289 | 276 | return null; |
290 | 277 | } |
@@ -296,8 +283,7 @@ discard block |
||
296 | 283 | if (isset($contributors[$key])) |
297 | 284 | { |
298 | 285 | return $contributors[$key]; |
299 | - } |
|
300 | - else |
|
286 | + } else |
|
301 | 287 | { |
302 | 288 | return null; |
303 | 289 | } |
@@ -354,8 +340,7 @@ discard block |
||
354 | 340 | if (!empty($contributors)) |
355 | 341 | { |
356 | 342 | return array_unique($contributors); |
357 | - } |
|
358 | - else |
|
343 | + } else |
|
359 | 344 | { |
360 | 345 | return null; |
361 | 346 | } |
@@ -367,8 +352,7 @@ discard block |
||
367 | 352 | if (isset($links[$key])) |
368 | 353 | { |
369 | 354 | return $links[$key]; |
370 | - } |
|
371 | - else |
|
355 | + } else |
|
372 | 356 | { |
373 | 357 | return null; |
374 | 358 | } |
@@ -432,13 +416,11 @@ discard block |
||
432 | 416 | { |
433 | 417 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); |
434 | 418 | $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; |
435 | - } |
|
436 | - else |
|
419 | + } else |
|
437 | 420 | { |
438 | 421 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
439 | 422 | } |
440 | - } |
|
441 | - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
423 | + } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
442 | 424 | { |
443 | 425 | $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
444 | 426 | } |
@@ -449,8 +431,7 @@ discard block |
||
449 | 431 | if (isset($this->data['links'][$rel])) |
450 | 432 | { |
451 | 433 | return $this->data['links'][$rel]; |
452 | - } |
|
453 | - else |
|
434 | + } else |
|
454 | 435 | { |
455 | 436 | return null; |
456 | 437 | } |
@@ -461,40 +442,31 @@ discard block |
||
461 | 442 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) |
462 | 443 | { |
463 | 444 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
464 | - } |
|
465 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) |
|
445 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) |
|
466 | 446 | { |
467 | 447 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
468 | - } |
|
469 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
448 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
470 | 449 | { |
471 | 450 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
472 | - } |
|
473 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
451 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
474 | 452 | { |
475 | 453 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
476 | - } |
|
477 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
454 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
478 | 455 | { |
479 | 456 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
480 | - } |
|
481 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
457 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
482 | 458 | { |
483 | 459 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
484 | - } |
|
485 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
460 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
486 | 461 | { |
487 | 462 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
488 | - } |
|
489 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
463 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
490 | 464 | { |
491 | 465 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
492 | - } |
|
493 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
466 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
494 | 467 | { |
495 | 468 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
496 | - } |
|
497 | - else |
|
469 | + } else |
|
498 | 470 | { |
499 | 471 | return null; |
500 | 472 | } |
@@ -505,24 +477,19 @@ discard block |
||
505 | 477 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) |
506 | 478 | { |
507 | 479 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
508 | - } |
|
509 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
|
480 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
|
510 | 481 | { |
511 | 482 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
512 | - } |
|
513 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
|
483 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
|
514 | 484 | { |
515 | 485 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
516 | - } |
|
517 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
486 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
518 | 487 | { |
519 | 488 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
520 | - } |
|
521 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
489 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
522 | 490 | { |
523 | 491 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
524 | - } |
|
525 | - else |
|
492 | + } else |
|
526 | 493 | { |
527 | 494 | return null; |
528 | 495 | } |
@@ -533,20 +500,16 @@ discard block |
||
533 | 500 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) |
534 | 501 | { |
535 | 502 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
536 | - } |
|
537 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
|
503 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
|
538 | 504 | { |
539 | 505 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
540 | - } |
|
541 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) |
|
506 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) |
|
542 | 507 | { |
543 | 508 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
544 | - } |
|
545 | - elseif (isset($this->data['xml_lang'])) |
|
509 | + } elseif (isset($this->data['xml_lang'])) |
|
546 | 510 | { |
547 | 511 | return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); |
548 | - } |
|
549 | - else |
|
512 | + } else |
|
550 | 513 | { |
551 | 514 | return null; |
552 | 515 | } |
@@ -557,12 +520,10 @@ discard block |
||
557 | 520 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) |
558 | 521 | { |
559 | 522 | return (float) $return[0]['data']; |
560 | - } |
|
561 | - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
523 | + } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
562 | 524 | { |
563 | 525 | return (float) $match[1]; |
564 | - } |
|
565 | - else |
|
526 | + } else |
|
566 | 527 | { |
567 | 528 | return null; |
568 | 529 | } |
@@ -573,16 +534,13 @@ discard block |
||
573 | 534 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) |
574 | 535 | { |
575 | 536 | return (float) $return[0]['data']; |
576 | - } |
|
577 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
537 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
578 | 538 | { |
579 | 539 | return (float) $return[0]['data']; |
580 | - } |
|
581 | - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
540 | + } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
582 | 541 | { |
583 | 542 | return (float) $match[2]; |
584 | - } |
|
585 | - else |
|
543 | + } else |
|
586 | 544 | { |
587 | 545 | return null; |
588 | 546 | } |
@@ -593,16 +551,13 @@ discard block |
||
593 | 551 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) |
594 | 552 | { |
595 | 553 | return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); |
596 | - } |
|
597 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) |
|
554 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) |
|
598 | 555 | { |
599 | 556 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
600 | - } |
|
601 | - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) |
|
557 | + } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) |
|
602 | 558 | { |
603 | 559 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
604 | - } |
|
605 | - else |
|
560 | + } else |
|
606 | 561 | { |
607 | 562 | return null; |
608 | 563 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Used to create cache objects |
@@ -83,7 +83,7 @@ |
||
83 | 83 | { |
84 | 84 | $type = explode(':', $location, 2); |
85 | 85 | $type = $type[0]; |
86 | - if (!empty(self::$handlers[$type])) |
|
86 | + if ( ! empty(self::$handlers[$type])) |
|
87 | 87 | { |
88 | 88 | $class = self::$handlers[$type]; |
89 | 89 | return new $class($location, $filename, $extension); |