wp/wp-admin/options-media.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    11 
    11 
    12 if ( ! current_user_can( 'manage_options' ) )
    12 if ( ! current_user_can( 'manage_options' ) )
    13 	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
    13 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    14 
    14 
    15 $title = __('Media Settings');
    15 $title = __('Media Settings');
    16 $parent_file = 'options-general.php';
    16 $parent_file = 'options-general.php';
    17 
    17 
    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>';
    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>';
    29 	'content' => $media_options_help,
    29 	'content' => $media_options_help,
    30 ) );
    30 ) );
    31 
    31 
    32 get_current_screen()->set_help_sidebar(
    32 get_current_screen()->set_help_sidebar(
    33 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    33 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    34 	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Media_Screen" target="_blank">Documentation on Media Settings</a>') . '</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/" target="_blank">Support Forums</a>') . '</p>'
    35 	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    36 );
    36 );
    37 
    37 
    38 include( ABSPATH . 'wp-admin/admin-header.php' );
    38 include( ABSPATH . 'wp-admin/admin-header.php' );
    39 
    39 
    40 ?>
    40 ?>
    41 
    41 
    42 <div class="wrap">
    42 <div class="wrap">
    43 <h2><?php echo esc_html( $title ); ?></h2>
    43 <h1><?php echo esc_html( $title ); ?></h1>
    44 
    44 
    45 <form action="options.php" method="post">
    45 <form action="options.php" method="post">
    46 <?php settings_fields('media'); ?>
    46 <?php settings_fields('media'); ?>
    47 
    47 
    48 <h3 class="title"><?php _e('Image sizes') ?></h3>
    48 <h2 class="title"><?php _e('Image sizes') ?></h2>
    49 <p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
    49 <p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
    50 
    50 
    51 <table class="form-table">
    51 <table class="form-table">
    52 <tr>
    52 <tr>
    53 <th scope="row"><?php _e('Thumbnail size') ?></th>
    53 <th scope="row"><?php _e('Thumbnail size') ?></th>
    54 <td>
    54 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend>
    55 <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
    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" />
    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>
    57 <br />
    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" /><br />
    58 <label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label>
    59 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
    59 <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" />
    60 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
    60 </fieldset>
       
    61 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/>
       
    62 <label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label>
    61 </td>
    63 </td>
    62 </tr>
    64 </tr>
    63 
    65 
    64 <tr>
    66 <tr>
    65 <th scope="row"><?php _e('Medium size') ?></th>
    67 <th scope="row"><?php _e('Medium size') ?></th>
    66 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>
    68 <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>
    69 <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" />
    70 <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" />
       
    71 <br />
    69 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
    72 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
    70 <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 <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" />
    71 </fieldset></td>
    74 </fieldset></td>
    72 </tr>
    75 </tr>
    73 
    76 
    74 <tr>
    77 <tr>
    75 <th scope="row"><?php _e('Large size') ?></th>
    78 <th scope="row"><?php _e('Large size') ?></th>
    76 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
    79 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
    77 <label for="large_size_w"><?php _e('Max Width'); ?></label>
    80 <label for="large_size_w"><?php _e('Max Width'); ?></label>
    78 <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" />
    81 <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" />
       
    82 <br />
    79 <label for="large_size_h"><?php _e('Max Height'); ?></label>
    83 <label for="large_size_h"><?php _e('Max Height'); ?></label>
    80 <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 <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" />
    81 </fieldset></td>
    85 </fieldset></td>
    82 </tr>
    86 </tr>
    83 
    87 
    84 <?php do_settings_fields('media', 'default'); ?>
    88 <?php do_settings_fields('media', 'default'); ?>
    85 </table>
    89 </table>
    86 
    90 
    87 <?php if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
    91 <?php
    88 <h3 class="title"><?php _e('Embeds') ?></h3>
    92 /**
       
    93  * @global array $wp_settings
       
    94  */
       
    95 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
       
    96 <h2 class="title"><?php _e('Embeds') ?></h2>
    89 <table class="form-table">
    97 <table class="form-table">
    90 <?php do_settings_fields( 'media', 'embeds' ); ?>
    98 <?php do_settings_fields( 'media', 'embeds' ); ?>
    91 </table>
    99 </table>
    92 <?php endif; ?>
   100 <?php endif; ?>
    93 
   101 
    94 <?php if ( !is_multisite() ) : ?>
   102 <?php if ( !is_multisite() ) : ?>
    95 <h3 class="title"><?php _e('Uploading Files'); ?></h3>
   103 <h2 class="title"><?php _e('Uploading Files'); ?></h2>
    96 <table class="form-table">
   104 <table class="form-table">
    97 <?php
   105 <?php
    98 // If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
   106 // If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
    99 if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
   107 if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
   100 ?>
   108 ?>
   101 <tr>
   109 <tr>
   102 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
   110 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
   103 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
   111 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
   104 <p class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></p>
   112 <p class="description"><?php
       
   113 	/* translators: %s: wp-content/uploads */
       
   114 	printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
       
   115 ?></p>
   105 </td>
   116 </td>
   106 </tr>
   117 </tr>
   107 
   118 
   108 <tr>
   119 <tr>
   109 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
   120 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
   110 <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" />
   121 <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" />
   111 <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
   122 <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
   112 </td>
   123 </td>
   113 </tr>
   124 </tr>
       
   125 <tr>
       
   126 <td colspan="2" class="td-full">
       
   127 <?php else : ?>
       
   128 <tr>
       
   129 <td class="td-full">
   114 <?php endif; ?>
   130 <?php endif; ?>
   115 <tr>
       
   116 <th scope="row" colspan="2" class="th-full">
       
   117 <label for="uploads_use_yearmonth_folders">
   131 <label for="uploads_use_yearmonth_folders">
   118 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
   132 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
   119 <?php _e('Organize my uploads into month- and year-based folders'); ?>
   133 <?php _e('Organize my uploads into month- and year-based folders'); ?>
   120 </label>
   134 </label>
   121 </th>
   135 </td>
   122 </tr>
   136 </tr>
   123 
   137 
   124 <?php do_settings_fields('media', 'uploads'); ?>
   138 <?php do_settings_fields('media', 'uploads'); ?>
   125 </table>
   139 </table>
   126 <?php endif; ?>
   140 <?php endif; ?>