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/template-loader.php

    r38755 r42343  
    22/**
    33 * Loads the correct template based on the visitor's url
     4 *
    45 * @package WordPress
    56 */
    6 if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
     7if ( defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) {
    78    /**
    89     * Fires before determining which template to load.
     
    1112     */
    1213    do_action( 'template_redirect' );
     14}
    1315
    1416/**
     
    2224 * @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
    2325 */
    24 if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) )
     26if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) ) {
    2527    exit();
     28}
    2629
    2730// Process feeds and trackbacks even if not using themes.
     
    4245endif;
    4346
    44 if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
     47if ( defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) :
    4548    $template = false;
    46     if     ( is_embed()          && $template = get_embed_template()          ) :
    47     elseif ( is_404()            && $template = get_404_template()            ) :
    48     elseif ( is_search()         && $template = get_search_template()        ) :
    49     elseif ( is_front_page()     && $template = get_front_page_template()    ) :
    50     elseif ( is_home()           && $template = get_home_template()          ) :
     49    if ( is_embed() && $template = get_embed_template() ) :
     50    elseif ( is_404() && $template = get_404_template() ) :
     51    elseif ( is_search() && $template = get_search_template() ) :
     52    elseif ( is_front_page() && $template = get_front_page_template() ) :
     53    elseif ( is_home() && $template = get_home_template() ) :
    5154    elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
    52     elseif ( is_tax()            && $template = get_taxonomy_template()      ) :
    53     elseif ( is_attachment()     && $template = get_attachment_template()    ) :
    54         remove_filter('the_content', 'prepend_attachment');
    55     elseif ( is_single()         && $template = get_single_template()        ) :
    56     elseif ( is_page()           && $template = get_page_template()          ) :
    57     elseif ( is_singular()       && $template = get_singular_template()      ) :
    58     elseif ( is_category()       && $template = get_category_template()      ) :
    59     elseif ( is_tag()            && $template = get_tag_template()            ) :
    60     elseif ( is_author()         && $template = get_author_template()        ) :
    61     elseif ( is_date()           && $template = get_date_template()          ) :
    62     elseif ( is_archive()        && $template = get_archive_template()        ) :
     55    elseif ( is_tax() && $template = get_taxonomy_template() ) :
     56    elseif ( is_attachment() && $template = get_attachment_template() ) :
     57        remove_filter( 'the_content', 'prepend_attachment' );
     58    elseif ( is_single() && $template = get_single_template() ) :
     59    elseif ( is_page() && $template = get_page_template() ) :
     60    elseif ( is_singular() && $template = get_singular_template() ) :
     61    elseif ( is_category() && $template = get_category_template() ) :
     62    elseif ( is_tag() && $template = get_tag_template() ) :
     63    elseif ( is_author() && $template = get_author_template() ) :
     64    elseif ( is_date() && $template = get_date_template() ) :
     65    elseif ( is_archive() && $template = get_archive_template() ) :
    6366    else :
    6467        $template = get_index_template();
Note: See TracChangeset for help on using the changeset viewer.