WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (4 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-writing.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 
    15 $title = __('Writing Settings');
     14}
     15
     16$title       = __( 'Writing Settings' );
    1617$parent_file = 'options-general.php';
    1718
    18 get_current_screen()->add_help_tab( array(
    19     'id'      => 'overview',
    20     'title'   => __('Overview'),
    21     'content' => '<p>' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.') . '</p>' .
    22         '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
    23 ) );
     19get_current_screen()->add_help_tab(
     20    array(
     21        'id'      => 'overview',
     22        'title'   => __( 'Overview' ),
     23        'content' => '<p>' . __( 'You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.' ) . '</p>' .
     24            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
     25    )
     26);
    2427
    2528/** This filter is documented in wp-admin/options.php */
    2629if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
    27     get_current_screen()->add_help_tab( array(
    28         'id'      => 'options-postemail',
    29         'title'   => __( 'Post Via Email' ),
    30         'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress installation an email with the content of your post. You must set up a secret email account with POP3 access to use this, and any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret.' ) . '</p>',
    31     ) );
     30    get_current_screen()->add_help_tab(
     31        array(
     32            'id'      => 'options-postemail',
     33            'title'   => __( 'Post Via Email' ),
     34            'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress installation an email with the content of your post. You must set up a secret email account with POP3 access to use this, and any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret.' ) . '</p>',
     35        )
     36    );
    3237}
    3338
    3439/** This filter is documented in wp-admin/options-writing.php */
    3540if ( apply_filters( 'enable_update_services_configuration', true ) ) {
    36     get_current_screen()->add_help_tab( array(
    37         'id'      => 'options-services',
    38         'title'   => __( 'Update Services' ),
    39         'content' => '<p>' . __( 'If desired, WordPress will automatically alert various services of your new posts.' ) . '</p>',
    40     ) );
     41    get_current_screen()->add_help_tab(
     42        array(
     43            'id'      => 'options-services',
     44            'title'   => __( 'Update Services' ),
     45            'content' => '<p>' . __( 'If desired, WordPress will automatically alert various services of your new posts.' ) . '</p>',
     46        )
     47    );
    4148}
    4249
    4350get_current_screen()->set_help_sidebar(
    44     '<p><strong>' . __('For more information:') . '</strong></p>' .
    45     '<p>' . __('<a href="https://codex.wordpress.org/Settings_Writing_Screen">Documentation on Writing Settings</a>') . '</p>' .
    46     '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
     51    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     52    '<p>' . __( '<a href="https://codex.wordpress.org/Settings_Writing_Screen">Documentation on Writing Settings</a>' ) . '</p>' .
     53    '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
    4754);
    4855
     
    5461
    5562<form method="post" action="options.php">
    56 <?php settings_fields('writing'); ?>
     63<?php settings_fields( 'writing' ); ?>
    5764
    5865<table class="form-table">
    5966<?php if ( get_site_option( 'initial_db_version' ) < 32453 ) : ?>
    6067<tr>
    61 <th scope="row"><?php _e('Formatting') ?></th>
    62 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Formatting') ?></span></legend>
     68<th scope="row"><?php _e( 'Formatting' ); ?></th>
     69<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Formatting' ); ?></span></legend>
    6370<label for="use_smilies">
    64 <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
    65 <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
    66 <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
     71<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked( '1', get_option( 'use_smilies' ) ); ?> />
     72<?php _e( 'Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display' ); ?></label><br />
     73<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked( '1', get_option( 'use_balanceTags' ) ); ?> /> <?php _e( 'WordPress should correct invalidly nested XHTML automatically' ); ?></label>
    6774</fieldset></td>
    6875</tr>
    6976<?php endif; ?>
    7077<tr>
    71 <th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
    72 <td>
    73 <?php
    74 wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));
     78<th scope="row"><label for="default_category"><?php _e( 'Default Post Category' ); ?></label></th>
     79<td>
     80<?php
     81wp_dropdown_categories(
     82    array(
     83        'hide_empty'   => 0,
     84        'name'         => 'default_category',
     85        'orderby'      => 'name',
     86        'selected'     => get_option( 'default_category' ),
     87        'hierarchical' => true,
     88    )
     89);
    7590?>
    7691</td>
     
    8196?>
    8297<tr>
    83 <th scope="row"><label for="default_post_format"><?php _e('Default Post Format') ?></label></th>
     98<th scope="row"><label for="default_post_format"><?php _e( 'Default Post Format' ); ?></label></th>
    8499<td>
    85100    <select name="default_post_format" id="default_post_format">
    86101        <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
    87 <?php foreach ( $post_formats as $format_slug => $format_name ): ?>
     102<?php foreach ( $post_formats as $format_slug => $format_name ) : ?>
    88103        <option<?php selected( get_option( 'default_post_format' ), $format_slug ); ?> value="<?php echo esc_attr( $format_slug ); ?>"><?php echo esc_html( $format_name ); ?></option>
    89104<?php endforeach; ?>
     
    95110?>
    96111<tr>
    97 <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
    98 <td>
    99 <?php
    100 wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category'));
     112<th scope="row"><label for="default_link_category"><?php _e( 'Default Link Category' ); ?></label></th>
     113<td>
     114<?php
     115wp_dropdown_categories(
     116    array(
     117        'hide_empty'   => 0,
     118        'name'         => 'default_link_category',
     119        'orderby'      => 'name',
     120        'selected'     => get_option( 'default_link_category' ),
     121        'hierarchical' => true,
     122        'taxonomy'     => 'link_category',
     123    )
     124);
    101125?>
    102126</td>
     
    105129
    106130<?php
    107 do_settings_fields('writing', 'default');
    108 do_settings_fields('writing', 'remote_publishing'); // A deprecated section.
     131do_settings_fields( 'writing', 'default' );
     132do_settings_fields( 'writing', 'remote_publishing' ); // A deprecated section.
    109133?>
    110134</table>
     
    114138if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
    115139?>
    116 <h2 class="title"><?php _e( 'Post via email' ) ?></h2>
    117 <p><?php
     140<h2 class="title"><?php _e( 'Post via email' ); ?></h2>
     141<p>
     142<?php
    118143printf(
    119144    /* translators: 1, 2, 3: examples of random email addresses */
     
    123148    sprintf( '<kbd>%s</kbd>', wp_generate_password( 8, false ) )
    124149);
    125 ?></p>
     150?>
     151</p>
    126152
    127153<table class="form-table">
    128154<tr>
    129 <th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
    130 <td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text code" />
    131 <label for="mailserver_port"><?php _e('Port') ?></label>
    132 <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
    133 </td>
    134 </tr>
    135 <tr>
    136 <th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
    137 <td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" class="regular-text ltr" /></td>
    138 </tr>
    139 <tr>
    140 <th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
    141 <td>
    142 <input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" class="regular-text ltr" />
    143 </td>
    144 </tr>
    145 <tr>
    146 <th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
    147 <td>
    148 <?php
    149 wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true));
    150 ?>
    151 </td>
    152 </tr>
    153 <?php do_settings_fields('writing', 'post_via_email'); ?>
     155<th scope="row"><label for="mailserver_url"><?php _e( 'Mail Server' ); ?></label></th>
     156<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option( 'mailserver_url' ); ?>" class="regular-text code" />
     157<label for="mailserver_port"><?php _e( 'Port' ); ?></label>
     158<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option( 'mailserver_port' ); ?>" class="small-text" />
     159</td>
     160</tr>
     161<tr>
     162<th scope="row"><label for="mailserver_login"><?php _e( 'Login Name' ); ?></label></th>
     163<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option( 'mailserver_login' ); ?>" class="regular-text ltr" /></td>
     164</tr>
     165<tr>
     166<th scope="row"><label for="mailserver_pass"><?php _e( 'Password' ); ?></label></th>
     167<td>
     168<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option( 'mailserver_pass' ); ?>" class="regular-text ltr" />
     169</td>
     170</tr>
     171<tr>
     172<th scope="row"><label for="default_email_category"><?php _e( 'Default Mail Category' ); ?></label></th>
     173<td>
     174<?php
     175wp_dropdown_categories(
     176    array(
     177        'hide_empty'   => 0,
     178        'name'         => 'default_email_category',
     179        'orderby'      => 'name',
     180        'selected'     => get_option( 'default_email_category' ),
     181        'hierarchical' => true,
     182    )
     183);
     184?>
     185</td>
     186</tr>
     187<?php do_settings_fields( 'writing', 'post_via_email' ); ?>
    154188</table>
    155189<?php } ?>
     
    165199if ( apply_filters( 'enable_update_services_configuration', true ) ) {
    166200?>
    167 <h2 class="title"><?php _e( 'Update Services' ) ?></h2>
    168 
    169 <?php if ( 1 == get_option('blog_public') ) : ?>
    170 
    171     <p><label for="ping_sites"><?php
     201<h2 class="title"><?php _e( 'Update Services' ); ?></h2>
     202
     203<?php if ( 1 == get_option( 'blog_public' ) ) : ?>
     204
     205    <p><label for="ping_sites">
     206    <?php
    172207        printf(
    173208            /* translators: %s: Codex URL */
     
    175210            __( 'https://codex.wordpress.org/Update_Services' )
    176211        );
    177     ?></label></p>
    178 
    179     <textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea( get_option('ping_sites') ); ?></textarea>
     212    ?>
     213    </label></p>
     214
     215    <textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea( get_option( 'ping_sites' ) ); ?></textarea>
    180216
    181217<?php else : ?>
    182218
    183     <p><?php
     219    <p>
     220    <?php
    184221        printf(
    185222            /* translators: 1: Codex URL, 2: Reading Settings URL */
     
    188225            'options-reading.php'
    189226        );
    190     ?></p>
     227    ?>
     228    </p>
    191229
    192230<?php endif; ?>
    193231<?php } // enable_update_services_configuration ?>
    194232
    195 <?php do_settings_sections('writing'); ?>
     233<?php do_settings_sections( 'writing' ); ?>
    196234
    197235<?php submit_button(); ?>
Note: See TracChangeset for help on using the changeset viewer.