[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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  __DIR__ . '/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  // Used in the HTML title tag.
  17  $title       = __( 'Media Settings' );
  18  $parent_file = 'options-general.php';
  19  
  20  $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>';
  21  
  22  if ( ! is_multisite()
  23      && ( get_option( 'upload_url_path' )
  24          || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
  25  ) {
  26      $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
  27  }
  28  
  29  $media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
  30  
  31  get_current_screen()->add_help_tab(
  32      array(
  33          'id'      => 'overview',
  34          'title'   => __( 'Overview' ),
  35          'content' => $media_options_help,
  36      )
  37  );
  38  
  39  get_current_screen()->set_help_sidebar(
  40      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  41      '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
  42      '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
  43  );
  44  
  45  require_once  ABSPATH . 'wp-admin/admin-header.php';
  46  
  47  ?>
  48  
  49  <div class="wrap">
  50  <h1><?php echo esc_html( $title ); ?></h1>
  51  
  52  <form action="options.php" method="post">
  53  <?php settings_fields( 'media' ); ?>
  54  
  55  <h2 class="title"><?php _e( 'Image sizes' ); ?></h2>
  56  <p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
  57  
  58  <table class="form-table" role="presentation">
  59  <tr>
  60  <th scope="row"><?php _e( 'Thumbnail size' ); ?></th>
  61  <td><fieldset><legend class="screen-reader-text"><span>
  62      <?php
  63      /* translators: Hidden accessibility text. */
  64      _e( 'Thumbnail size' );
  65      ?>
  66  </span></legend>
  67  <label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label>
  68  <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" />
  69  <br />
  70  <label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label>
  71  <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" />
  72  </fieldset>
  73  <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/>
  74  <label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label>
  75  </td>
  76  </tr>
  77  
  78  <tr>
  79  <th scope="row"><?php _e( 'Medium size' ); ?></th>
  80  <td><fieldset><legend class="screen-reader-text"><span>
  81      <?php
  82      /* translators: Hidden accessibility text. */
  83      _e( 'Medium size' );
  84      ?>
  85  </span></legend>
  86  <label for="medium_size_w"><?php _e( 'Max Width' ); ?></label>
  87  <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" />
  88  <br />
  89  <label for="medium_size_h"><?php _e( 'Max Height' ); ?></label>
  90  <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" />
  91  </fieldset></td>
  92  </tr>
  93  
  94  <tr>
  95  <th scope="row"><?php _e( 'Large size' ); ?></th>
  96  <td><fieldset><legend class="screen-reader-text"><span>
  97      <?php
  98      /* translators: Hidden accessibility text. */
  99      _e( 'Large size' );
 100      ?>
 101  </span></legend>
 102  <label for="large_size_w"><?php _e( 'Max Width' ); ?></label>
 103  <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" />
 104  <br />
 105  <label for="large_size_h"><?php _e( 'Max Height' ); ?></label>
 106  <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" />
 107  </fieldset></td>
 108  </tr>
 109  
 110  <?php do_settings_fields( 'media', 'default' ); ?>
 111  </table>
 112  
 113  <?php
 114  /**
 115   * @global array $wp_settings
 116   */
 117  if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
 118      ?>
 119  <h2 class="title"><?php _e( 'Embeds' ); ?></h2>
 120  <table class="form-table" role="presentation">
 121      <?php do_settings_fields( 'media', 'embeds' ); ?>
 122  </table>
 123  <?php endif; ?>
 124  
 125  <?php if ( ! is_multisite() ) : ?>
 126  <h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
 127  <table class="form-table" role="presentation">
 128      <?php
 129      /*
 130       * If upload_url_path is not the default (empty),
 131       * or upload_path is not the default ('wp-content/uploads' or empty),
 132       * they can be edited, otherwise they're locked.
 133       */
 134      if ( get_option( 'upload_url_path' )
 135          || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
 136          ?>
 137  <tr>
 138  <th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th>
 139  <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" />
 140  <p class="description">
 141          <?php
 142          /* translators: %s: wp-content/uploads */
 143          printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
 144          ?>
 145  </p>
 146  </td>
 147  </tr>
 148  
 149  <tr>
 150  <th scope="row"><label for="upload_url_path"><?php _e( 'Full URL path to files' ); ?></label></th>
 151  <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" />
 152  <p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p>
 153  </td>
 154  </tr>
 155  <tr>
 156  <td colspan="2" class="td-full">
 157  <?php else : ?>
 158  <tr>
 159  <td class="td-full">
 160  <?php endif; ?>
 161  <label for="uploads_use_yearmonth_folders">
 162  <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> />
 163      <?php _e( 'Organize my uploads into month- and year-based folders' ); ?>
 164  </label>
 165  </td>
 166  </tr>
 167  
 168      <?php do_settings_fields( 'media', 'uploads' ); ?>
 169  </table>
 170  <?php endif; ?>
 171  
 172  <?php do_settings_sections( 'media' ); ?>
 173  
 174  <?php submit_button(); ?>
 175  
 176  </form>
 177  
 178  </div>
 179  
 180  <?php require_once  ABSPATH . 'wp-admin/admin-footer.php'; ?>


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref