WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (3 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-admin/options-reading.php

    r42201 r42343  
    1010require_once( dirname( __FILE__ ) . '/admin.php' );
    1111
    12 if ( ! current_user_can( 'manage_options' ) )
     12if ( ! current_user_can( 'manage_options' ) ) {
    1313    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
     14}
    1415
    15 $title = __( 'Reading Settings' );
     16$title       = __( 'Reading Settings' );
    1617$parent_file = 'options-general.php';
    1718
    18 add_action('admin_head', 'options_reading_add_js');
     19add_action( 'admin_head', 'options_reading_add_js' );
    1920
    20 get_current_screen()->add_help_tab( array(
    21     'id'      => 'overview',
    22     'title'   => __('Overview'),
    23     'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
    24         '<p>' . sprintf(__('You can choose what&#8217;s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two <a href="%s">Pages</a>. One will become the homepage, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
    25         '<p>' . __('You can also control the display of your content in RSS feeds, including the maximum number of posts to display and whether to show full text or a summary.') . '</p>' .
    26         '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
    27 ) );
     21get_current_screen()->add_help_tab(
     22    array(
     23        'id'      => 'overview',
     24        'title'   => __( 'Overview' ),
     25        'content' => '<p>' . __( 'This screen contains the settings that affect the display of your content.' ) . '</p>' .
     26            '<p>' . sprintf( __( 'You can choose what&#8217;s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two <a href="%s">Pages</a>. One will become the homepage, and the other will be where your posts are displayed.' ), 'post-new.php?post_type=page' ) . '</p>' .
     27            '<p>' . __( 'You can also control the display of your content in RSS feeds, including the maximum number of posts to display and whether to show full text or a summary.' ) . '</p>' .
     28            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
     29    )
     30);
    2831
    29 get_current_screen()->add_help_tab( array(
    30     'id'      => 'site-visibility',
    31     'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
    32     'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
    33         '<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
    34 ) );
     32get_current_screen()->add_help_tab(
     33    array(
     34        'id'      => 'site-visibility',
     35        'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
     36        'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
     37            '<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
     38    )
     39);
    3540
    3641get_current_screen()->set_help_sidebar(
    37     '<p><strong>' . __('For more information:') . '</strong></p>' .
    38     '<p>' . __('<a href="https://codex.wordpress.org/Settings_Reading_Screen">Documentation on Reading Settings</a>') . '</p>' .
    39     '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
     42    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     43    '<p>' . __( '<a href="https://codex.wordpress.org/Settings_Reading_Screen">Documentation on Reading Settings</a>' ) . '</p>' .
     44    '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
    4045);
    4146
     
    5055settings_fields( 'reading' );
    5156
    52 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
     57if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
    5358    add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
     59}
    5460?>
    5561
     
    5864<table class="form-table">
    5965<?php
    60     if ( 'posts' != get_option( 'show_on_front' ) ) :
    61         update_option( 'show_on_front', 'posts' );
     66if ( 'posts' != get_option( 'show_on_front' ) ) :
     67    update_option( 'show_on_front', 'posts' );
    6268    endif;
    6369
    6470else :
    65     if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
     71    if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) {
    6672        update_option( 'show_on_front', 'posts' );
     73    }
    6774?>
    6875<table class="form-table">
     
    8188    </p>
    8289<ul>
    83     <li><label for="page_on_front"><?php printf( __( 'Homepage: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
    84     <li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
     90    <li><label for="page_on_front">
     91    <?php
     92    printf(
     93        __( 'Homepage: %s' ), wp_dropdown_pages(
     94            array(
     95                'name'              => 'page_on_front',
     96                'echo'              => 0,
     97                'show_option_none'  => __( '&mdash; Select &mdash;' ),
     98                'option_none_value' => '0',
     99                'selected'          => get_option( 'page_on_front' ),
     100            )
     101        )
     102    );
     103?>
     104</label></li>
     105    <li><label for="page_for_posts">
     106    <?php
     107    printf(
     108        __( 'Posts page: %s' ), wp_dropdown_pages(
     109            array(
     110                'name'              => 'page_for_posts',
     111                'echo'              => 0,
     112                'show_option_none'  => __( '&mdash; Select &mdash;' ),
     113                'option_none_value' => '0',
     114                'selected'          => get_option( 'page_for_posts' ),
     115            )
     116        )
     117    );
     118?>
     119</label></li>
    85120</ul>
    86121<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
     
    112147<td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
    113148<?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
    114     <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
    115     <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
    116     <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
     149    <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> />
     150    <label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br/>
     151    <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
    117152    <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
    118153    <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
Note: See TracChangeset for help on using the changeset viewer.