Make WordPress Core

Ticket #18128: 18128.diff

File 18128.diff, 8.5 KB (added by kawauso, 14 years ago)

Remove 'adjacent_posts_rel_link_wp_head' action, deprecate related functions

  • wp-includes/default-filters.php

     
    204204add_action( 'wp_head',             'index_rel_link'                       );
    205205add_action( 'wp_head',             'parent_post_rel_link',          10, 0 );
    206206add_action( 'wp_head',             'start_post_rel_link',           10, 0 );
    207 add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
    208207add_action( 'wp_head',             'locale_stylesheet'                    );
    209208add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
    210209add_action( 'wp_head',             'noindex',                       1     );
  • wp-includes/deprecated.php

     
    26152615
    26162616        return true;
    26172617}
     2618
     2619
     2620/**
     2621 * Get adjacent post relational link.
     2622 *
     2623 * Can either be next or previous post relational link.
     2624 *
     2625 * @since 2.8.0
     2626 * @deprecated 3.3
     2627 *
     2628 * @param string $title Optional. Link title format.
     2629 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2630 * @param string $excluded_categories Optional. Excluded categories IDs.
     2631 * @param bool $previous Optional, default is true. Whether display link to previous post.
     2632 * @return string
     2633 */
     2634function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
     2635        _deprecated_function( __FUNCTION__, '3.3'  );
     2636
     2637        if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) )
     2638                $post = & get_post($GLOBALS['post']->post_parent);
     2639        else
     2640                $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
     2641
     2642        if ( empty($post) )
     2643                return;
     2644
     2645        if ( empty($post->post_title) )
     2646                $post->post_title = $previous ? __('Previous Post') : __('Next Post');
     2647
     2648        $date = mysql2date(get_option('date_format'), $post->post_date);
     2649
     2650        $title = str_replace('%title', $post->post_title, $title);
     2651        $title = str_replace('%date', $date, $title);
     2652        $title = apply_filters('the_title', $title, $post->ID);
     2653
     2654        $link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
     2655        $link .= esc_attr( $title );
     2656        $link .= "' href='" . get_permalink($post) . "' />\n";
     2657
     2658        $adjacent = $previous ? 'previous' : 'next';
     2659        return apply_filters( "{$adjacent}_post_rel_link", $link );
     2660}
     2661
     2662/**
     2663 * Display relational links for the posts adjacent to the current post.
     2664 *
     2665 * @since 2.8.0
     2666 * @deprecated 3.3
     2667 *
     2668 * @param string $title Optional. Link title format.
     2669 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2670 * @param string $excluded_categories Optional. Excluded categories IDs.
     2671 */
     2672function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
     2673        _deprecated_function( __FUNCTION__, '3.3'  );
     2674
     2675        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
     2676        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
     2677}
     2678
     2679/**
     2680 * Display relational links for the posts adjacent to the current post for single post pages.
     2681 *
     2682 * This is meant to be attached to actions like 'wp_head'.  Do not call this directly in plugins or theme templates.
     2683 * @since 3.0.0
     2684 * @deprecated 3.3
     2685 *
     2686 */
     2687function adjacent_posts_rel_link_wp_head() {
     2688        _deprecated_function( __FUNCTION__, '3.3'  );
     2689
     2690        if ( !is_singular() || is_attachment() )
     2691                return;
     2692        adjacent_posts_rel_link();
     2693}
     2694
     2695/**
     2696 * Display relational link for the next post adjacent to the current post.
     2697 *
     2698 * @since 2.8.0
     2699 * @deprecated 3.3
     2700 *
     2701 * @param string $title Optional. Link title format.
     2702 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2703 * @param string $excluded_categories Optional. Excluded categories IDs.
     2704 */
     2705function next_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
     2706        _deprecated_function( __FUNCTION__, '3.3'  );
     2707
     2708        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
     2709}
     2710
     2711/**
     2712 * Display relational link for the previous post adjacent to the current post.
     2713 *
     2714 * @since 2.8.0
     2715 * @deprecated 3.3
     2716 *
     2717 * @param string $title Optional. Link title format.
     2718 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2719 * @param string $excluded_categories Optional. Excluded categories IDs.
     2720 */
     2721function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
     2722        _deprecated_function( __FUNCTION__, '3.3'  );
     2723
     2724        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
     2725}
     2726 No newline at end of file
  • wp-includes/link-template.php

     
    11521152}
    11531153
    11541154/**
    1155  * Get adjacent post relational link.
    1156  *
    1157  * Can either be next or previous post relational link.
    1158  *
    1159  * @since 2.8.0
    1160  *
    1161  * @param string $title Optional. Link title format.
    1162  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1163  * @param string $excluded_categories Optional. Excluded categories IDs.
    1164  * @param bool $previous Optional, default is true. Whether display link to previous post.
    1165  * @return string
    1166  */
    1167 function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
    1168         if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) )
    1169                 $post = & get_post($GLOBALS['post']->post_parent);
    1170         else
    1171                 $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
    1172 
    1173         if ( empty($post) )
    1174                 return;
    1175 
    1176         if ( empty($post->post_title) )
    1177                 $post->post_title = $previous ? __('Previous Post') : __('Next Post');
    1178 
    1179         $date = mysql2date(get_option('date_format'), $post->post_date);
    1180 
    1181         $title = str_replace('%title', $post->post_title, $title);
    1182         $title = str_replace('%date', $date, $title);
    1183         $title = apply_filters('the_title', $title, $post->ID);
    1184 
    1185         $link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
    1186         $link .= esc_attr( $title );
    1187         $link .= "' href='" . get_permalink($post) . "' />\n";
    1188 
    1189         $adjacent = $previous ? 'previous' : 'next';
    1190         return apply_filters( "{$adjacent}_post_rel_link", $link );
    1191 }
    1192 
    1193 /**
    1194  * Display relational links for the posts adjacent to the current post.
    1195  *
    1196  * @since 2.8.0
    1197  *
    1198  * @param string $title Optional. Link title format.
    1199  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1200  * @param string $excluded_categories Optional. Excluded categories IDs.
    1201  */
    1202 function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
    1203         echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
    1204         echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
    1205 }
    1206 
    1207 /**
    1208  * Display relational links for the posts adjacent to the current post for single post pages.
    1209  *
    1210  * This is meant to be attached to actions like 'wp_head'.  Do not call this directly in plugins or theme templates.
    1211  * @since 3.0.0
    1212  *
    1213  */
    1214 function adjacent_posts_rel_link_wp_head() {
    1215         if ( !is_singular() || is_attachment() )
    1216                 return;
    1217         adjacent_posts_rel_link();
    1218 }
    1219 
    1220 /**
    1221  * Display relational link for the next post adjacent to the current post.
    1222  *
    1223  * @since 2.8.0
    1224  *
    1225  * @param string $title Optional. Link title format.
    1226  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1227  * @param string $excluded_categories Optional. Excluded categories IDs.
    1228  */
    1229 function next_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
    1230         echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
    1231 }
    1232 
    1233 /**
    1234  * Display relational link for the previous post adjacent to the current post.
    1235  *
    1236  * @since 2.8.0
    1237  *
    1238  * @param string $title Optional. Link title format.
    1239  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1240  * @param string $excluded_categories Optional. Excluded categories IDs.
    1241  */
    1242 function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
    1243         echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
    1244 }
    1245 
    1246 /**
    12471155 * Retrieve boundary post.
    12481156 *
    12491157 * Boundary being either the first or last post by publish date within the constraints specified