You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

144 lines
5.8 KiB

  1. <?php
  2. /**
  3. * Media settings administration panel.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once( dirname( __FILE__ ) . '/admin.php' );
  10. if ( ! current_user_can( 'manage_options' ) )
  11. wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
  12. $title = __('Media Settings');
  13. $parent_file = 'options-general.php';
  14. $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>';
  15. if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) {
  16. $media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
  17. }
  18. $media_options_help .= '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>';
  19. get_current_screen()->add_help_tab( array(
  20. 'id' => 'overview',
  21. 'title' => __('Overview'),
  22. 'content' => $media_options_help,
  23. ) );
  24. get_current_screen()->set_help_sidebar(
  25. '<p><strong>' . __('For more information:') . '</strong></p>' .
  26. '<p>' . __('<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>') . '</p>' .
  27. '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
  28. );
  29. include( ABSPATH . 'wp-admin/admin-header.php' );
  30. ?>
  31. <div class="wrap">
  32. <h1><?php echo esc_html( $title ); ?></h1>
  33. <form action="options.php" method="post">
  34. <?php settings_fields('media'); ?>
  35. <h2 class="title"><?php _e('Image sizes') ?></h2>
  36. <p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
  37. <table class="form-table">
  38. <tr>
  39. <th scope="row"><?php _e('Thumbnail size') ?></th>
  40. <td>
  41. <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
  42. <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" />
  43. <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
  44. <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 />
  45. <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
  46. <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
  47. </td>
  48. </tr>
  49. <tr>
  50. <th scope="row"><?php _e('Medium size') ?></th>
  51. <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>
  52. <label for="medium_size_w"><?php _e('Max Width'); ?></label>
  53. <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" />
  54. <label for="medium_size_h"><?php _e('Max Height'); ?></label>
  55. <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" />
  56. </fieldset></td>
  57. </tr>
  58. <tr>
  59. <th scope="row"><?php _e('Large size') ?></th>
  60. <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
  61. <label for="large_size_w"><?php _e('Max Width'); ?></label>
  62. <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" />
  63. <label for="large_size_h"><?php _e('Max Height'); ?></label>
  64. <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" />
  65. </fieldset></td>
  66. </tr>
  67. <?php do_settings_fields('media', 'default'); ?>
  68. </table>
  69. <?php
  70. /**
  71. * @global array $wp_settings
  72. */
  73. if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
  74. <h2 class="title"><?php _e('Embeds') ?></h2>
  75. <table class="form-table">
  76. <?php do_settings_fields( 'media', 'embeds' ); ?>
  77. </table>
  78. <?php endif; ?>
  79. <?php if ( !is_multisite() ) : ?>
  80. <h2 class="title"><?php _e('Uploading Files'); ?></h2>
  81. <table class="form-table">
  82. <?php
  83. // If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
  84. if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
  85. ?>
  86. <tr>
  87. <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
  88. <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
  89. <p class="description"><?php
  90. /* translators: %s: wp-content/uploads */
  91. printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
  92. ?></p>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
  97. <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" />
  98. <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
  99. </td>
  100. </tr>
  101. <?php endif; ?>
  102. <tr>
  103. <th scope="row" colspan="2" class="th-full">
  104. <label for="uploads_use_yearmonth_folders">
  105. <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
  106. <?php _e('Organize my uploads into month- and year-based folders'); ?>
  107. </label>
  108. </th>
  109. </tr>
  110. <?php do_settings_fields('media', 'uploads'); ?>
  111. </table>
  112. <?php endif; ?>
  113. <?php do_settings_sections('media'); ?>
  114. <?php submit_button(); ?>
  115. </form>
  116. </div>
  117. <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>