WordPress.org

Make WordPress Core

Ticket #18128: 18128.2.diff

File 18128.2.diff, 8.6 KB (added by kawauso, 7 years ago)
  • wp-includes/default-filters.php

     
    201201add_action( 'wp_head',             'feed_links_extra',              3     );
    202202add_action( 'wp_head',             'rsd_link'                             );
    203203add_action( 'wp_head',             'wlwmanifest_link'                     );
    204 add_action( 'wp_head',             'index_rel_link'                       );
    205 add_action( 'wp_head',             'parent_post_rel_link',          10, 0 );
    206 add_action( 'wp_head',             'start_post_rel_link',           10, 0 );
    207204add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
    208205add_action( 'wp_head',             'locale_stylesheet'                    );
    209206add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
  • wp-includes/deprecated.php

     
    26152615
    26162616        return true;
    26172617}
     2618
     2619/**
     2620 * Get boundary post relational link.
     2621 *
     2622 * Can either be start or end post relational link.
     2623 *
     2624 * @since 2.8.0
     2625 * @deprecated 3.3
     2626 *
     2627 * @param string $title Optional. Link title format.
     2628 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2629 * @param string $excluded_categories Optional. Excluded categories IDs.
     2630 * @param bool $start Optional, default is true. Whether display link to first or last post.
     2631 * @return string
     2632 */
     2633function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
     2634        _deprecated_function( __FUNCTION__, '3.3' );
     2635
     2636        $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
     2637        // If there is no post stop.
     2638        if ( empty($posts) )
     2639                return;
     2640
     2641        // Even though we limited get_posts to return only 1 item it still returns an array of objects.
     2642        $post = $posts[0];
     2643
     2644        if ( empty($post->post_title) )
     2645                $post->post_title = $start ? __('First Post') : __('Last Post');
     2646
     2647        $date = mysql2date(get_option('date_format'), $post->post_date);
     2648
     2649        $title = str_replace('%title', $post->post_title, $title);
     2650        $title = str_replace('%date', $date, $title);
     2651        $title = apply_filters('the_title', $title, $post->ID);
     2652
     2653        $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
     2654        $link .= esc_attr($title);
     2655        $link .= "' href='" . get_permalink($post) . "' />\n";
     2656
     2657        $boundary = $start ? 'start' : 'end';
     2658        return apply_filters( "{$boundary}_post_rel_link", $link );
     2659}
     2660
     2661/**
     2662 * Display relational link for the first post.
     2663 *
     2664 * @since 2.8.0
     2665 * @deprecated 3.3
     2666 *
     2667 * @param string $title Optional. Link title format.
     2668 * @param bool $in_same_cat Optional. Whether link should be in same category.
     2669 * @param string $excluded_categories Optional. Excluded categories IDs.
     2670 */
     2671function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
     2672        _deprecated_function( __FUNCTION__, '3.3' );
     2673
     2674        echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
     2675}
     2676
     2677/**
     2678 * Get site index relational link.
     2679 *
     2680 * @since 2.8.0
     2681 * @deprecated 3.3
     2682 *
     2683 * @return string
     2684 */
     2685function get_index_rel_link() {
     2686        _deprecated_function( __FUNCTION__, '3.3' );
     2687
     2688        $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
     2689        return apply_filters( "index_rel_link", $link );
     2690}
     2691
     2692/**
     2693 * Display relational link for the site index.
     2694 *
     2695 * @since 2.8.0
     2696 * @deprecated 3.3
     2697 */
     2698function index_rel_link() {
     2699        _deprecated_function( __FUNCTION__, '3.3' );
     2700
     2701        echo get_index_rel_link();
     2702}
     2703
     2704/**
     2705 * Get parent post relational link.
     2706 *
     2707 * @since 2.8.0
     2708 * @deprecated 3.3
     2709 *
     2710 * @param string $title Optional. Link title format.
     2711 * @return string
     2712 */
     2713function get_parent_post_rel_link($title = '%title') {
     2714        _deprecated_function( __FUNCTION__, '3.3' );
     2715
     2716        if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
     2717                $post = & get_post($GLOBALS['post']->post_parent);
     2718
     2719        if ( empty($post) )
     2720                return;
     2721
     2722        $date = mysql2date(get_option('date_format'), $post->post_date);
     2723
     2724        $title = str_replace('%title', $post->post_title, $title);
     2725        $title = str_replace('%date', $date, $title);
     2726        $title = apply_filters('the_title', $title, $post->ID);
     2727
     2728        $link = "<link rel='up' title='";
     2729        $link .= esc_attr( $title );
     2730        $link .= "' href='" . get_permalink($post) . "' />\n";
     2731
     2732        return apply_filters( "parent_post_rel_link", $link );
     2733}
     2734
     2735/**
     2736 * Display relational link for parent item
     2737 *
     2738 * @since 2.8.0
     2739 * @deprecated 3.3
     2740 */
     2741function parent_post_rel_link($title = '%title') {
     2742        _deprecated_function( __FUNCTION__, '3.3' );
     2743
     2744        echo get_parent_post_rel_link($title);
     2745}
     2746 No newline at end of file
  • wp-includes/link-template.php

     
    12901290}
    12911291
    12921292/**
    1293  * Get boundary post relational link.
    1294  *
    1295  * Can either be start or end post relational link.
    1296  *
    1297  * @since 2.8.0
    1298  *
    1299  * @param string $title Optional. Link title format.
    1300  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1301  * @param string $excluded_categories Optional. Excluded categories IDs.
    1302  * @param bool $start Optional, default is true. Whether display link to first or last post.
    1303  * @return string
    1304  */
    1305 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
    1306         $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
    1307         // If there is no post stop.
    1308         if ( empty($posts) )
    1309                 return;
    1310 
    1311         // Even though we limited get_posts to return only 1 item it still returns an array of objects.
    1312         $post = $posts[0];
    1313 
    1314         if ( empty($post->post_title) )
    1315                 $post->post_title = $start ? __('First Post') : __('Last Post');
    1316 
    1317         $date = mysql2date(get_option('date_format'), $post->post_date);
    1318 
    1319         $title = str_replace('%title', $post->post_title, $title);
    1320         $title = str_replace('%date', $date, $title);
    1321         $title = apply_filters('the_title', $title, $post->ID);
    1322 
    1323         $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
    1324         $link .= esc_attr($title);
    1325         $link .= "' href='" . get_permalink($post) . "' />\n";
    1326 
    1327         $boundary = $start ? 'start' : 'end';
    1328         return apply_filters( "{$boundary}_post_rel_link", $link );
    1329 }
    1330 
    1331 /**
    1332  * Display relational link for the first post.
    1333  *
    1334  * @since 2.8.0
    1335  *
    1336  * @param string $title Optional. Link title format.
    1337  * @param bool $in_same_cat Optional. Whether link should be in same category.
    1338  * @param string $excluded_categories Optional. Excluded categories IDs.
    1339  */
    1340 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
    1341         echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
    1342 }
    1343 
    1344 /**
    1345  * Get site index relational link.
    1346  *
    1347  * @since 2.8.0
    1348  *
    1349  * @return string
    1350  */
    1351 function get_index_rel_link() {
    1352         $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
    1353         return apply_filters( "index_rel_link", $link );
    1354 }
    1355 
    1356 /**
    1357  * Display relational link for the site index.
    1358  *
    1359  * @since 2.8.0
    1360  */
    1361 function index_rel_link() {
    1362         echo get_index_rel_link();
    1363 }
    1364 
    1365 /**
    1366  * Get parent post relational link.
    1367  *
    1368  * @since 2.8.0
    1369  *
    1370  * @param string $title Optional. Link title format.
    1371  * @return string
    1372  */
    1373 function get_parent_post_rel_link($title = '%title') {
    1374         if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
    1375                 $post = & get_post($GLOBALS['post']->post_parent);
    1376 
    1377         if ( empty($post) )
    1378                 return;
    1379 
    1380         $date = mysql2date(get_option('date_format'), $post->post_date);
    1381 
    1382         $title = str_replace('%title', $post->post_title, $title);
    1383         $title = str_replace('%date', $date, $title);
    1384         $title = apply_filters('the_title', $title, $post->ID);
    1385 
    1386         $link = "<link rel='up' title='";
    1387         $link .= esc_attr( $title );
    1388         $link .= "' href='" . get_permalink($post) . "' />\n";
    1389 
    1390         return apply_filters( "parent_post_rel_link", $link );
    1391 }
    1392 
    1393 /**
    1394  * Display relational link for parent item
    1395  *
    1396  * @since 2.8.0
    1397  */
    1398 function parent_post_rel_link($title = '%title') {
    1399         echo get_parent_post_rel_link($title);
    1400 }
    1401 
    1402 /**
    14031293 * Display previous post link that is adjacent to the current post.
    14041294 *
    14051295 * @since 1.5.0