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