Make WordPress Core


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

    r41836 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 = __('Media Settings');
     16$title       = __( 'Media Settings' );
    1617$parent_file = 'options-general.php';
    1718
    18 $media_options_help = '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>';
     19$media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';
    1920
    20 if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) {
    21     $media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
     21if ( ! is_multisite() && ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) ) {
     22    $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
    2223}
    2324
    24 $media_options_help .= '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>';
     25$media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
    2526
    26 get_current_screen()->add_help_tab( array(
    27     'id'      => 'overview',
    28     'title'   => __('Overview'),
    29     'content' => $media_options_help,
    30 ) );
     27get_current_screen()->add_help_tab(
     28    array(
     29        'id'      => 'overview',
     30        'title'   => __( 'Overview' ),
     31        'content' => $media_options_help,
     32    )
     33);
    3134
    3235get_current_screen()->set_help_sidebar(
    33     '<p><strong>' . __('For more information:') . '</strong></p>' .
    34     '<p>' . __('<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>') . '</p>' .
    35     '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
     36    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     37    '<p>' . __( '<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>' ) . '</p>' .
     38    '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
    3639);
    3740
     
    4447
    4548<form action="options.php" method="post">
    46 <?php settings_fields('media'); ?>
     49<?php settings_fields( 'media' ); ?>
    4750
    48 <h2 class="title"><?php _e('Image sizes') ?></h2>
     51<h2 class="title"><?php _e( 'Image sizes' ); ?></h2>
    4952<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
    5053
    5154<table class="form-table">
    5255<tr>
    53 <th scope="row"><?php _e('Thumbnail size') ?></th>
     56<th scope="row"><?php _e( 'Thumbnail size' ); ?></th>
    5457<td>
    55 <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
    56 <input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" />
    57 <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
    58 <input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" />
    59 <p><input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
    60 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label></p>
     58<label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label>
     59<input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option( 'thumbnail_size_w' ); ?>" class="small-text" />
     60<label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label>
     61<input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option( 'thumbnail_size_h' ); ?>" class="small-text" />
     62<p><input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/>
     63<label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label></p>
    6164</td>
    6265</tr>
    6366
    6467<tr>
    65 <th scope="row"><?php _e('Medium size') ?></th>
    66 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>
    67 <label for="medium_size_w"><?php _e('Max Width'); ?></label>
    68 <input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />
     68<th scope="row"><?php _e( 'Medium size' ); ?></th>
     69<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Medium size' ); ?></span></legend>
     70<label for="medium_size_w"><?php _e( 'Max Width' ); ?></label>
     71<input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option( 'medium_size_w' ); ?>" class="small-text" />
    6972<br />
    70 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
    71 <input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" />
     73<label for="medium_size_h"><?php _e( 'Max Height' ); ?></label>
     74<input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option( 'medium_size_h' ); ?>" class="small-text" />
    7275</fieldset></td>
    7376</tr>
    7477
    7578<tr>
    76 <th scope="row"><?php _e('Large size') ?></th>
    77 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
    78 <label for="large_size_w"><?php _e('Max Width'); ?></label>
    79 <input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />
     79<th scope="row"><?php _e( 'Large size' ); ?></th>
     80<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Large size' ); ?></span></legend>
     81<label for="large_size_w"><?php _e( 'Max Width' ); ?></label>
     82<input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option( 'large_size_w' ); ?>" class="small-text" />
    8083<br />
    81 <label for="large_size_h"><?php _e('Max Height'); ?></label>
    82 <input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" />
     84<label for="large_size_h"><?php _e( 'Max Height' ); ?></label>
     85<input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option( 'large_size_h' ); ?>" class="small-text" />
    8386</fieldset></td>
    8487</tr>
    8588
    86 <?php do_settings_fields('media', 'default'); ?>
     89<?php do_settings_fields( 'media', 'default' ); ?>
    8790</table>
    8891
     
    9194 * @global array $wp_settings
    9295 */
    93 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
    94 <h2 class="title"><?php _e('Embeds') ?></h2>
     96if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
     97?>
     98<h2 class="title"><?php _e( 'Embeds' ); ?></h2>
    9599<table class="form-table">
    96100<?php do_settings_fields( 'media', 'embeds' ); ?>
     
    98102<?php endif; ?>
    99103
    100 <?php if ( !is_multisite() ) : ?>
    101 <h2 class="title"><?php _e('Uploading Files'); ?></h2>
     104<?php if ( ! is_multisite() ) : ?>
     105<h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
    102106<table class="form-table">
    103107<?php
    104108// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
    105 if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
     109if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) :
    106110?>
    107111<tr>
    108 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
    109 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
    110 <p class="description"><?php
     112<th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th>
     113<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" />
     114<p class="description">
     115<?php
    111116    /* translators: %s: wp-content/uploads */
    112117    printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
    113 ?></p>
     118?>
     119</p>
    114120</td>
    115121</tr>
    116122
    117123<tr>
    118 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
    119 <td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
    120 <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
     124<th scope="row"><label for="upload_url_path"><?php _e( 'Full URL path to files' ); ?></label></th>
     125<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option( 'upload_url_path' ) ); ?>" class="regular-text code" />
     126<p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p>
    121127</td>
    122128</tr>
     
    128134<?php endif; ?>
    129135<label for="uploads_use_yearmonth_folders">
    130 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
    131 <?php _e('Organize my uploads into month- and year-based folders'); ?>
     136<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> />
     137<?php _e( 'Organize my uploads into month- and year-based folders' ); ?>
    132138</label>
    133139</td>
    134140</tr>
    135141
    136 <?php do_settings_fields('media', 'uploads'); ?>
     142<?php do_settings_fields( 'media', 'uploads' ); ?>
    137143</table>
    138144<?php endif; ?>
    139145
    140 <?php do_settings_sections('media'); ?>
     146<?php do_settings_sections( 'media' ); ?>
    141147
    142148<?php submit_button(); ?>
Note: See TracChangeset for help on using the changeset viewer.