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