diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 2242b3b46e..6e7747e9ba 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -940,11 +940,11 @@ function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $ex $title = apply_filters('the_title', $title, $post); $link = $previous ? "\n"; - $adjacent = $previous ? 'previous' : 'next'; - return apply_filters( "{$adjacent}_post_rel_link", $link ); + $adjacent = $previous ? 'previous' : 'next'; + return apply_filters( "{$adjacent}_post_rel_link", $link ); } /** @@ -1001,36 +1001,34 @@ function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_c * @return object */ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $start = true) { - global $post, $wpdb; + global $post, $wpdb; - if( empty($post) || !is_single() || is_attachment() ) - return null; + if ( empty($post) || !is_single() || is_attachment() ) + return null; $cat_array = array(); $excluded_categories = array(); - if ( !empty($in_same_cat) || !empty($excluded_categories) ) { - if ( !empty($in_same_cat) ) { - $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); - } + if ( !empty($in_same_cat) || !empty($excluded_categories) ) { + if ( !empty($in_same_cat) ) { + $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); + } - if ( !empty($excluded_categories) ) { - $excluded_categories = array_map('intval', explode(',', $excluded_categories)); + if ( !empty($excluded_categories) ) { + $excluded_categories = array_map('intval', explode(',', $excluded_categories)); - if ( !empty($cat_array) ) { - $excluded_categories = array_diff($excluded_categories, $cat_array); - } + if ( !empty($cat_array) ) + $excluded_categories = array_diff($excluded_categories, $cat_array); - $inverse_cats = array(); - foreach ( $excluded_categories as $excluded_category) { - $inverse_cats[] = $excluded_category * -1; - } - $excluded_categories = $inverse_cats; - } - } + $inverse_cats = array(); + foreach ( $excluded_categories as $excluded_category) + $inverse_cats[] = $excluded_category * -1; + $excluded_categories = $inverse_cats; + } + } $categories = array_merge($cat_array, $excluded_categories); - $order = $start ? 'ASC' : 'DESC'; + $order = $start ? 'ASC' : 'DESC'; return get_posts("numberposts=1&order=$order&orderby=ID&category=$categories"); } @@ -1049,28 +1047,28 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta * @return string */ function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { - $posts = get_boundary_post($in_same_cat,$excluded_categories,$start); + $posts = get_boundary_post($in_same_cat,$excluded_categories,$start); // Even though we limited get_posts to return only 1 item it still returns an array of objects. $post = $posts[0]; - if ( empty($post) ) - return; + if ( empty($post) ) + return; - if ( empty($post->post_title) ) - $post->post_title = $start ? __('First Post') : __('Last Post'); + if ( empty($post->post_title) ) + $post->post_title = $start ? __('First Post') : __('Last Post'); - $date = mysql2date(get_option('date_format'), $post->post_date); + $date = mysql2date(get_option('date_format'), $post->post_date); - $title = str_replace('%title', $post->post_title, $title); - $title = str_replace('%date', $date, $title); - $title = apply_filters('the_title', $title, $post); + $title = str_replace('%title', $post->post_title, $title); + $title = str_replace('%date', $date, $title); + $title = apply_filters('the_title', $title, $post); - $link = $start ? "\n"; + $link = $start ? "\n"; - $boundary = $start ? 'start' : 'end'; - return apply_filters( "{$boundary}_post_rel_link", $link ); + $boundary = $start ? 'start' : 'end'; + return apply_filters( "{$boundary}_post_rel_link", $link ); } /** @@ -1122,17 +1120,17 @@ function get_parent_post_rel_link($title = '%title') { if ( empty($post) ) return; - $date = mysql2date(get_option('date_format'), $post->post_date); + $date = mysql2date(get_option('date_format'), $post->post_date); - $title = str_replace('%title', $post->post_title, $title); - $title = str_replace('%date', $date, $title); - $title = apply_filters('the_title', $title, $post); + $title = str_replace('%title', $post->post_title, $title); + $title = str_replace('%date', $date, $title); + $title = apply_filters('the_title', $title, $post); - $link = "\n"; + $link = "\n"; - return apply_filters( "parent_post_rel_link", $link ); + return apply_filters( "parent_post_rel_link", $link ); } /**