Hide upload_path and upload_url_path from the Media Settings screen, assuming they are both set to their default values.

These can be set on options.php, or the UPLOADS constant or the filters in wp_upload_dir() should be used. WordPress should aim to avoid UI options that require filesystem changes as well, not to mention requiring the user to convert between paths and URLs.

fixes #21720.



git-svn-id: http://core.svn.wordpress.org/trunk@21852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-14 21:00:39 +00:00
parent a8a78b8975
commit 85d25dacc5
2 changed files with 12 additions and 3 deletions

View File

@ -121,6 +121,10 @@ include('./admin-header.php');
<?php if ( !is_multisite() ) : ?>
<h3><?php _e('Uploading Files'); ?></h3>
<table class="form-table">
<?php
// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
?>
<tr valign="top">
<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
@ -134,7 +138,7 @@ include('./admin-header.php');
<p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
</td>
</tr>
<?php endif; ?>
<tr>
<th scope="row" colspan="2" class="th-full">
<label for="uploads_use_yearmonth_folders">

View File

@ -68,7 +68,6 @@ $whitelist_options = array(
$whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
$uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path');
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
$whitelist_options['reading'][] = 'blog_charset';
@ -86,7 +85,13 @@ if ( !is_multisite() ) {
$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
$whitelist_options['writing'][] = 'ping_sites';
$whitelist_options['media'] = array_merge($whitelist_options['media'], $uploads_options);
$whitelist_options['media'][] = 'uploads_use_yearmonth_folders';
// If upload_url_path and upload_path are both default values, they're locked.
if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) {
$whitelist_options['media'][] = 'upload_path';
$whitelist_options['media'][] = 'upload_url_path';
}
} else {
$whitelist_options['general'][] = 'new_admin_email';
$whitelist_options['general'][] = 'WPLANG';