[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> options-media.php (source)

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


Generated: Tue Dec 10 01:00:04 2019 Cross-referenced by PHPXref 0.7.1