Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed-atom.php

    r42228 r42343  
    66 */
    77
    8 header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
     8header( 'Content-Type: ' . feed_content_type( 'atom' ) . '; charset=' . get_option( 'blog_charset' ), true );
    99$more = 1;
    1010
    11 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
     11echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
    1212
    1313/** This action is documented in wp-includes/feed-rss2.php */
     
    1818    xmlns:thr="http://purl.org/syndication/thread/1.0"
    1919    xml:lang="<?php bloginfo_rss( 'language' ); ?>"
    20     xml:base="<?php bloginfo_rss('url') ?>/wp-atom.php"
     20    xml:base="<?php bloginfo_rss( 'url' ); ?>/wp-atom.php"
    2121    <?php
    2222    /**
     
    2929>
    3030    <title type="text"><?php wp_title_rss(); ?></title>
    31     <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
     31    <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle>
    3232
    33     <updated><?php
     33    <updated>
     34    <?php
    3435        $date = get_lastpostmodified( 'GMT' );
    3536        echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
    36     ?></updated>
     37    ?>
     38    </updated>
    3739
    38     <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url') ?>" />
    39     <id><?php bloginfo('atom_url'); ?></id>
     40    <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" />
     41    <id><?php bloginfo( 'atom_url' ); ?></id>
    4042    <link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
    4143
     
    4850    do_action( 'atom_head' );
    4951
    50     while ( have_posts() ) : the_post();
     52    while ( have_posts() ) :
     53        the_post();
    5154    ?>
    5255    <entry>
    5356        <author>
    54             <name><?php the_author() ?></name>
    55             <?php $author_url = get_the_author_meta('url'); if ( !empty($author_url) ) : ?>
    56             <uri><?php the_author_meta('url')?></uri>
    57             <?php endif;
     57            <name><?php the_author(); ?></name>
     58            <?php $author_url = get_the_author_meta( 'url' ); if ( ! empty( $author_url ) ) : ?>
     59            <uri><?php the_author_meta( 'url' ); ?></uri>
     60            <?php
     61            endif;
    5862
    5963            /**
     
    6569        ?>
    6670        </author>
    67         <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
    68         <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>" />
    69         <id><?php the_guid() ; ?></id>
    70         <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
    71         <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
    72         <?php the_category_rss('atom') ?>
     71        <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss(); ?>]]></title>
     72        <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>" />
     73        <id><?php the_guid(); ?></id>
     74        <updated><?php echo get_post_modified_time( 'Y-m-d\TH:i:s\Z', true ); ?></updated>
     75        <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z', true ); ?></published>
     76        <?php the_category_rss( 'atom' ); ?>
    7377        <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
    74 <?php if ( !get_option('rss_use_excerpt') ) : ?>
    75         <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content_feed('atom') ?>]]></content>
     78<?php if ( ! get_option( 'rss_use_excerpt' ) ) : ?>
     79        <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss(); ?>"><![CDATA[<?php the_content_feed( 'atom' ); ?>]]></content>
    7680<?php endif; ?>
    77     <?php atom_enclosure();
     81    <?php
     82    atom_enclosure();
    7883    /**
    7984     * Fires at the end of each Atom feed item.
     
    8590    if ( get_comments_number() || comments_open() ) :
    8691        ?>
    87         <link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
    88         <link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
    89         <thr:total><?php echo get_comments_number()?></thr:total>
     92        <link rel="replies" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>#comments" thr:count="<?php echo get_comments_number(); ?>"/>
     93        <link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( 0, 'atom' ) ); ?>" thr:count="<?php echo get_comments_number(); ?>"/>
     94        <thr:total><?php echo get_comments_number(); ?></thr:total>
    9095    <?php endif; ?>
    9196    </entry>
    92     <?php endwhile ; ?>
     97    <?php endwhile; ?>
    9398</feed>
Note: See TracChangeset for help on using the changeset viewer.