WordPress.org

Make WordPress Core

Ticket #8878: 8878.3.patch

File 8878.3.patch, 11.6 KB (added by Viper007Bond, 9 years ago)

Keep two new functions in the same order, but move them to much earlier in the wp_head hook

  • wp-content/themes/classic/functions.php

     
    33 * @package WordPress
    44 * @subpackage Classic_Theme
    55 */
     6
     7automatic_feed_links();
     8
    69if ( function_exists('register_sidebar') )
    710        register_sidebar(array(
    811                'before_widget' => '<li id="%1$s" class="widget %2$s">',
     
    1114                'after_title' => '',
    1215        ));
    1316
    14 ?>
     17?>
     18 No newline at end of file
  • wp-content/themes/classic/header.php

     
    1616                @import url( <?php bloginfo('stylesheet_url'); ?> );
    1717        </style>
    1818
    19         <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    20         <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    21         <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php bloginfo('atom_url'); ?>" />
    22 
    2319        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    2420        <?php wp_get_archives('type=monthly&format=link'); ?>
    2521        <?php //comments_popup_script(); // off by default ?>
  • wp-content/themes/default/functions.php

     
    44 * @subpackage Default_Theme
    55 */
    66
    7 if ( function_exists('register_sidebar') )
    8     register_sidebar(array(
    9         'before_widget' => '<li id="%1$s" class="widget %2$s">',
    10         'after_widget' => '</li>',
    11         'before_title' => '<h2 class="widgettitle">',
    12         'after_title' => '</h2>',
    13     ));
     7automatic_feed_links();
    148
     9if ( function_exists('register_sidebar') ) {
     10        register_sidebar(array(
     11                'before_widget' => '<li id="%1$s" class="widget %2$s">',
     12                'after_widget' => '</li>',
     13                'before_title' => '<h2 class="widgettitle">',
     14                'after_title' => '</h2>',
     15        ));
     16}
     17
    1518/** @ignore */
    1619function kubrick_head() {
    1720        $head = "<style type='text/css'>\n<!--";
     
    419422                </div>
    420423        </div>
    421424</div>
    422 <?php } ?>
     425<?php } ?>
     426 No newline at end of file
  • wp-content/themes/default/header.php

     
    1313<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    1414
    1515<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    16 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    17 <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    1816<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    1917
    2018<style type="text/css" media="screen">
  • wp-includes/default-filters.php

     
    164164add_filter('atom_service_url','atom_service_url_filter');
    165165
    166166// Actions
     167add_action('wp_head', 'feed_links_extra', 3);
    167168add_action('wp_head', 'rsd_link');
    168169add_action('wp_head', 'wlwmanifest_link');
    169170add_action('wp_head', 'locale_stylesheet');
  • wp-includes/feed-atom-comments.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: application/atom+xml; charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
    99echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
    1010?>
    1111<feed
  • wp-includes/feed-atom.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: application/atom+xml; charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
    99$more = 1;
    1010
    1111?>
  • wp-includes/feed-rdf.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('rdf') . '; charset=' . get_option('blog_charset'), true);
    99$more = 1;
    1010
    1111?>
  • wp-includes/feed-rss.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('rss') . '; charset=' . get_option('blog_charset'), true);
    99$more = 1;
    1010
    1111?>
  • wp-includes/feed-rss2-comments.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
    99
    1010echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    1111?>
  • wp-includes/feed-rss2.php

     
    55 * @package WordPress
    66 */
    77
    8 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     8header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
    99$more = 1;
    1010
    1111?>
  • wp-includes/feed.php

     
    508508                );
    509509}
    510510
    511 ?>
     511/**
     512 * Return the content type for specified feed type.
     513 *
     514 * @package WordPress
     515 * @subpackage Feed
     516 * @since 2.8.0
     517 */
     518function feed_content_type( $type = '' ) {
     519        if ( empty($type) )
     520                $type = get_default_feed();
     521
     522        $types = array(
     523                'rss'  => 'application/rss+xml',
     524                'rss2' => 'application/rss+xml',
     525                'atom' => 'application/atom+xml',
     526                'rdf'  => 'application/rdf+xml',
     527        );
     528
     529        $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
     530
     531        return apply_filters( 'feed_content_type', $content_type, $type );
     532}
     533
     534?>
     535 No newline at end of file
  • wp-includes/general-template.php

     
    13691369}
    13701370
    13711371/**
     1372 * Enable/disable automatic general feed link outputting.
     1373 *
     1374 * @since 2.8.0
     1375 *
     1376 * @param boolean $add Add or remove links. Defaults to true.
     1377 */
     1378function automatic_feed_links( $add = true ) {
     1379        if ( $add )
     1380                add_action( 'wp_head', 'feed_links', 2 );
     1381        else {
     1382                remove_action( 'wp_head', 'feed_links', 2 );
     1383                remove_action( 'wp_head', 'feed_links_extra', 3 );
     1384        }
     1385}
     1386
     1387/**
     1388 * Display the links to the general feeds.
     1389 *
     1390 * @since 2.8.0
     1391 *
     1392 * @param array $args Optional arguments.
     1393 */
     1394function feed_links( $args ) {
     1395        $defaults = array(
     1396                'seperator'   => _c('&raquo;|Seperator character feed titles in theme head'),
     1397                'rsstitle'    => __('%s Feed'),
     1398                'comstitle'   => __('%s Comments Feed'),
     1399        );
     1400
     1401        $args = wp_parse_args( $args, $defaults );
     1402
     1403        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['rsstitle'], get_bloginfo('name') ) . '" href="' . get_feed_link() . "\" />\n";
     1404        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['comstitle'], get_bloginfo('name') ) . '" href="' . get_feed_link( 'comments_' . get_default_feed() ) . "\" />\n";
     1405}
     1406
     1407/**
     1408 * Display the links to the extra feeds such as category feeds.
     1409 *
     1410 * @since 2.8.0
     1411 *
     1412 * @param array $args Optional arguments.
     1413 */
     1414function feed_links_extra( $args ) {
     1415        $defaults = array(
     1416                'seperator'   => _c('&raquo;|Seperator character feed titles in theme head'),
     1417                'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
     1418                'cattitle'    => __('%1$s %2$s %3$s Category Feed'),
     1419                'tagtitle'    => __('%1$s %2$s %3$s Tag Feed'),
     1420                'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
     1421                'searchtitle' => __('%1$s %2$s Search Results for &quot;%3$s&quot; Feed'),
     1422        );
     1423
     1424        $args = wp_parse_args( $args, $defaults );
     1425
     1426        if ( is_single() || is_page() ) {
     1427                $post = &get_post( $id = 0 );
     1428                if ( comments_open() || pings_open() || $post->comment_count > 0 )
     1429                        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['singletitle'], get_bloginfo('name'), $args['seperator'], get_the_title() ) . '" href="' . get_post_comments_feed_link( $post->ID ) . "\" />\n";
     1430        }
     1431
     1432        elseif ( is_category() ) {
     1433                $cat_id = intval( get_query_var('cat') );
     1434                echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['cattitle'], get_bloginfo('name'), $args['seperator'], get_cat_name( $cat_id ) ) . '" href="' . get_category_feed_link( $cat_id ) . "\" />\n";
     1435        }
     1436
     1437        elseif ( is_tag() ) {
     1438                $tag_id = intval( get_query_var('tag_id') );
     1439                $tag = get_tag( $tag_id );
     1440                echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['tagtitle'], get_bloginfo('name'), $args['seperator'], $tag->name ) . '" href="' . get_tag_feed_link( $tag_id ) . "\" />\n";
     1441        }
     1442
     1443        elseif ( is_author() ) {
     1444                $author_id = intval( get_query_var('author') );
     1445                echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['authortitle'], get_bloginfo('name'), $args['seperator'], get_author_name( $author_id ) ) . '" href="' . get_author_feed_link( $author_id ) . "\" />\n";
     1446        }
     1447
     1448        elseif ( is_search() ) {
     1449                echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . sprintf( $args['searchtitle'], get_bloginfo('name'), $args['seperator'], get_search_query() ) . '" href="' . get_search_feed_link() . "\" />\n";
     1450        }
     1451}
     1452
     1453/**
    13721454 * Display the link to the Really Simple Discovery service endpoint.
    13731455 *
    13741456 * @link http://archipelago.phrasewise.com/rsd
     
    18861968        return apply_filters( "get_the_generator_{$type}", $gen, $type );
    18871969}
    18881970
    1889 ?>
     1971?>
     1972 No newline at end of file
  • wp-includes/link-template.php

     
    507507        $permalink_structure = get_option('permalink_structure');
    508508
    509509        if ( '' == $permalink_structure ) {
    510                 $link = get_option('home') . "?feed=$feed&amp;cat=" . $cat_id;
     510                $link = trailingslashit( get_option('home') ) . "?feed=$feed&amp;cat=" . $cat_id;
    511511        } else {
    512512                $link = get_category_link($cat_id);
    513513                if( $feed == get_default_feed() )