Remove support for <link rel=start>, end, up, and index. These rel="" values have been dropped by the HTML Working Group. props Elpie, kawauso, fixes #18128.

git-svn-id: https://develop.svn.wordpress.org/trunk@18680 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-09-15 16:54:59 +00:00
parent a8f99a3d72
commit b4b2a1847b
3 changed files with 128 additions and 113 deletions

View File

@ -203,9 +203,6 @@ add_action( 'wp_head', 'feed_links', 2 );
add_action( 'wp_head', 'feed_links_extra', 3 );
add_action( 'wp_head', 'rsd_link' );
add_action( 'wp_head', 'wlwmanifest_link' );
add_action( 'wp_head', 'index_rel_link' );
add_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
add_action( 'wp_head', 'start_post_rel_link', 10, 0 );
add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
add_action( 'wp_head', 'locale_stylesheet' );
add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );

View File

@ -2721,3 +2721,131 @@ function sanitize_user_object($user, $context = 'display') {
return $user;
}
/**
* Get boundary post relational link.
*
* Can either be start or end post relational link.
*
* @since 2.8.0
* @deprecated 3.3
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in same category.
* @param string $excluded_categories Optional. Excluded categories IDs.
* @param bool $start Optional, default is true. Whether display link to first or last post.
* @return string
*/
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
_deprecated_function( __FUNCTION__, '3.3' );
$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
// If there is no post stop.
if ( empty($posts) )
return;
// Even though we limited get_posts to return only 1 item it still returns an array of objects.
$post = $posts[0];
if ( empty($post->post_title) )
$post->post_title = $start ? __('First Post') : __('Last Post');
$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->ID);
$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
$link .= esc_attr($title);
$link .= "' href='" . get_permalink($post) . "' />\n";
$boundary = $start ? 'start' : 'end';
return apply_filters( "{$boundary}_post_rel_link", $link );
}
/**
* Display relational link for the first post.
*
* @since 2.8.0
* @deprecated 3.3
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in same category.
* @param string $excluded_categories Optional. Excluded categories IDs.
*/
function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
_deprecated_function( __FUNCTION__, '3.3' );
echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
}
/**
* Get site index relational link.
*
* @since 2.8.0
* @deprecated 3.3
*
* @return string
*/
function get_index_rel_link() {
_deprecated_function( __FUNCTION__, '3.3' );
$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
return apply_filters( "index_rel_link", $link );
}
/**
* Display relational link for the site index.
*
* @since 2.8.0
* @deprecated 3.3
*/
function index_rel_link() {
_deprecated_function( __FUNCTION__, '3.3' );
echo get_index_rel_link();
}
/**
* Get parent post relational link.
*
* @since 2.8.0
* @deprecated 3.3
*
* @param string $title Optional. Link title format.
* @return string
*/
function get_parent_post_rel_link($title = '%title') {
_deprecated_function( __FUNCTION__, '3.3' );
if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
$post = & get_post($GLOBALS['post']->post_parent);
if ( empty($post) )
return;
$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->ID);
$link = "<link rel='up' title='";
$link .= esc_attr( $title );
$link .= "' href='" . get_permalink($post) . "' />\n";
return apply_filters( "parent_post_rel_link", $link );
}
/**
* Display relational link for parent item
*
* @since 2.8.0
* @deprecated 3.3
*/
function parent_post_rel_link($title = '%title') {
_deprecated_function( __FUNCTION__, '3.3' );
echo get_parent_post_rel_link($title);
}

View File

@ -1299,116 +1299,6 @@ function get_boundary_post( $in_same_cat = false, $excluded_categories = '', $st
return get_posts( array('numberposts' => 1, 'category' => $categories, 'order' => $order, 'update_post_term_cache' => false, 'update_post_meta_cache' => false) );
}
/**
* Get boundary post relational link.
*
* Can either be start or end post relational link.
*
* @since 2.8.0
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in same category.
* @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs.
* @param bool $start Optional, default is true. Whether display link to first or last post.
* @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);
// If there is no post stop.
if ( empty($posts) )
return;
// Even though we limited get_posts to return only 1 item it still returns an array of objects.
$post = $posts[0];
if ( empty($post->post_title) )
$post->post_title = $start ? __('First Post') : __('Last Post');
$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->ID);
$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
$link .= esc_attr($title);
$link .= "' href='" . get_permalink($post) . "' />\n";
$boundary = $start ? 'start' : 'end';
return apply_filters( "{$boundary}_post_rel_link", $link );
}
/**
* Display relational link for the first post.
*
* @since 2.8.0
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in same category.
* @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs.
*/
function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
}
/**
* Get site index relational link.
*
* @since 2.8.0
*
* @return string
*/
function get_index_rel_link() {
$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
return apply_filters( "index_rel_link", $link );
}
/**
* Display relational link for the site index.
*
* @since 2.8.0
*/
function index_rel_link() {
echo get_index_rel_link();
}
/**
* Get parent post relational link.
*
* @since 2.8.0
*
* @param string $title Optional. Link title format.
* @return string
*/
function get_parent_post_rel_link($title = '%title') {
if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
$post = & get_post($GLOBALS['post']->post_parent);
if ( empty($post) )
return;
$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->ID);
$link = "<link rel='up' title='";
$link .= esc_attr( $title );
$link .= "' href='" . get_permalink($post) . "' />\n";
return apply_filters( "parent_post_rel_link", $link );
}
/**
* Display relational link for parent item
*
* @since 2.8.0
*/
function parent_post_rel_link($title = '%title') {
echo get_parent_post_rel_link($title);
}
/**
* Display previous post link that is adjacent to the current post.
*