author | ymh <ymh.work@gmail.com> |
Tue, 15 Oct 2019 15:48:13 +0200 | |
changeset 13 | d255fe9cd479 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 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 |
||
9 | 12 |
if ( ! current_user_can( 'manage_options' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
9 | 14 |
} |
0 | 15 |
|
9 | 16 |
$title = __( 'Media Settings' ); |
0 | 17 |
$parent_file = 'options-general.php'; |
18 |
||
9 | 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>'; |
0 | 20 |
|
9 | 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>'; |
|
0 | 23 |
} |
24 |
||
9 | 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>'; |
0 | 26 |
|
9 | 27 |
get_current_screen()->add_help_tab( |
28 |
array( |
|
29 |
'id' => 'overview', |
|
30 |
'title' => __( 'Overview' ), |
|
31 |
'content' => $media_options_help, |
|
32 |
) |
|
33 |
); |
|
0 | 34 |
|
35 |
get_current_screen()->set_help_sidebar( |
|
9 | 36 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
37 |
'<p>' . __( '<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>' ) . '</p>' . |
|
38 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
|
0 | 39 |
); |
40 |
||
41 |
include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
42 |
||
43 |
?> |
|
44 |
||
45 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
46 |
<h1><?php echo esc_html( $title ); ?></h1> |
0 | 47 |
|
48 |
<form action="options.php" method="post"> |
|
9 | 49 |
<?php settings_fields( 'media' ); ?> |
0 | 50 |
|
9 | 51 |
<h2 class="title"><?php _e( 'Image sizes' ); ?></h2> |
0 | 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 |
||
9 | 54 |
<table class="form-table" role="presentation"> |
5 | 55 |
<tr> |
9 | 56 |
<th scope="row"><?php _e( 'Thumbnail size' ); ?></th> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
57 |
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
58 |
<label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
<br /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
<label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
63 |
</fieldset> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
65 |
<label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label> |
0 | 66 |
</td> |
67 |
</tr> |
|
68 |
||
5 | 69 |
<tr> |
9 | 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" /> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
<br /> |
9 | 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" /> |
|
0 | 77 |
</fieldset></td> |
78 |
</tr> |
|
79 |
||
5 | 80 |
<tr> |
9 | 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" /> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
<br /> |
9 | 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" /> |
|
0 | 88 |
</fieldset></td> |
89 |
</tr> |
|
90 |
||
9 | 91 |
<?php do_settings_fields( 'media', 'default' ); ?> |
0 | 92 |
</table> |
93 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
94 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
* @global array $wp_settings |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
*/ |
9 | 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' ); ?> |
|
0 | 103 |
</table> |
104 |
<?php endif; ?> |
|
105 |
||
9 | 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 |
?> |
|
5 | 113 |
<tr> |
9 | 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> |
|
0 | 122 |
</td> |
123 |
</tr> |
|
124 |
||
5 | 125 |
<tr> |
9 | 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> |
|
0 | 129 |
</td> |
130 |
</tr> |
|
131 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
<td colspan="2" class="td-full"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
133 |
<?php else : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
134 |
<tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
135 |
<td class="td-full"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
136 |
<?php endif; ?> |
0 | 137 |
<label for="uploads_use_yearmonth_folders"> |
9 | 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' ); ?> |
|
0 | 140 |
</label> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
</td> |
0 | 142 |
</tr> |
143 |
||
9 | 144 |
<?php do_settings_fields( 'media', 'uploads' ); ?> |
0 | 145 |
</table> |
146 |
<?php endif; ?> |
|
147 |
||
9 | 148 |
<?php do_settings_sections( 'media' ); ?> |
0 | 149 |
|
150 |
<?php submit_button(); ?> |
|
151 |
||
152 |
</form> |
|
153 |
||
154 |
</div> |
|
155 |
||
156 |
<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |