7 */ |
7 */ |
8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 |
11 |
12 if ( ! current_user_can( 'manage_options' ) ) |
12 if ( ! current_user_can( 'manage_options' ) ) { |
13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
|
14 } |
14 |
15 |
15 $title = __('Media Settings'); |
16 $title = __( 'Media Settings' ); |
16 $parent_file = 'options-general.php'; |
17 $parent_file = 'options-general.php'; |
17 |
18 |
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 $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 |
20 if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) { |
21 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 $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>'; |
22 } |
23 } |
23 |
24 |
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 $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 |
26 get_current_screen()->add_help_tab( array( |
27 get_current_screen()->add_help_tab( |
27 'id' => 'overview', |
28 array( |
28 'title' => __('Overview'), |
29 'id' => 'overview', |
29 'content' => $media_options_help, |
30 'title' => __( 'Overview' ), |
30 ) ); |
31 'content' => $media_options_help, |
|
32 ) |
|
33 ); |
31 |
34 |
32 get_current_screen()->set_help_sidebar( |
35 get_current_screen()->set_help_sidebar( |
33 '<p><strong>' . __('For more information:') . '</strong></p>' . |
36 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
34 '<p>' . __('<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>') . '</p>' . |
37 '<p>' . __( '<a href="https://codex.wordpress.org/Settings_Media_Screen">Documentation on Media Settings</a>' ) . '</p>' . |
35 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
38 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
36 ); |
39 ); |
37 |
40 |
38 include( ABSPATH . 'wp-admin/admin-header.php' ); |
41 include( ABSPATH . 'wp-admin/admin-header.php' ); |
39 |
42 |
40 ?> |
43 ?> |
41 |
44 |
42 <div class="wrap"> |
45 <div class="wrap"> |
43 <h1><?php echo esc_html( $title ); ?></h1> |
46 <h1><?php echo esc_html( $title ); ?></h1> |
44 |
47 |
45 <form action="options.php" method="post"> |
48 <form action="options.php" method="post"> |
46 <?php settings_fields('media'); ?> |
49 <?php settings_fields( 'media' ); ?> |
47 |
50 |
48 <h2 class="title"><?php _e('Image sizes') ?></h2> |
51 <h2 class="title"><?php _e( 'Image sizes' ); ?></h2> |
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> |
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> |
50 |
53 |
51 <table class="form-table"> |
54 <table class="form-table" role="presentation"> |
52 <tr> |
55 <tr> |
53 <th scope="row"><?php _e('Thumbnail size') ?></th> |
56 <th scope="row"><?php _e( 'Thumbnail size' ); ?></th> |
54 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend> |
57 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend> |
55 <label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label> |
58 <label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label> |
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" /> |
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" /> |
57 <br /> |
60 <br /> |
58 <label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label> |
61 <label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label> |
62 <label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label> |
65 <label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label> |
63 </td> |
66 </td> |
64 </tr> |
67 </tr> |
65 |
68 |
66 <tr> |
69 <tr> |
67 <th scope="row"><?php _e('Medium size') ?></th> |
70 <th scope="row"><?php _e( 'Medium size' ); ?></th> |
68 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend> |
71 <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> |
72 <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" /> |
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" /> |
71 <br /> |
74 <br /> |
72 <label for="medium_size_h"><?php _e('Max Height'); ?></label> |
75 <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" /> |
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" /> |
74 </fieldset></td> |
77 </fieldset></td> |
75 </tr> |
78 </tr> |
76 |
79 |
77 <tr> |
80 <tr> |
78 <th scope="row"><?php _e('Large size') ?></th> |
81 <th scope="row"><?php _e( 'Large size' ); ?></th> |
79 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend> |
82 <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> |
83 <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" /> |
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" /> |
82 <br /> |
85 <br /> |
83 <label for="large_size_h"><?php _e('Max Height'); ?></label> |
86 <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" /> |
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" /> |
85 </fieldset></td> |
88 </fieldset></td> |
86 </tr> |
89 </tr> |
87 |
90 |
88 <?php do_settings_fields('media', 'default'); ?> |
91 <?php do_settings_fields( 'media', 'default' ); ?> |
89 </table> |
92 </table> |
90 |
93 |
91 <?php |
94 <?php |
92 /** |
95 /** |
93 * @global array $wp_settings |
96 * @global array $wp_settings |
94 */ |
97 */ |
95 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?> |
98 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : |
96 <h2 class="title"><?php _e('Embeds') ?></h2> |
99 ?> |
97 <table class="form-table"> |
100 <h2 class="title"><?php _e( 'Embeds' ); ?></h2> |
98 <?php do_settings_fields( 'media', 'embeds' ); ?> |
101 <table class="form-table" role="presentation"> |
|
102 <?php do_settings_fields( 'media', 'embeds' ); ?> |
99 </table> |
103 </table> |
100 <?php endif; ?> |
104 <?php endif; ?> |
101 |
105 |
102 <?php if ( !is_multisite() ) : ?> |
106 <?php if ( ! is_multisite() ) : ?> |
103 <h2 class="title"><?php _e('Uploading Files'); ?></h2> |
107 <h2 class="title"><?php _e( 'Uploading Files' ); ?></h2> |
104 <table class="form-table"> |
108 <table class="form-table" role="presentation"> |
105 <?php |
109 <?php |
106 // If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty) |
110 // 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') ) ) : |
111 if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) : |
108 ?> |
112 ?> |
109 <tr> |
113 <tr> |
110 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th> |
114 <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" /> |
115 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" /> |
112 <p class="description"><?php |
116 <p class="description"> |
113 /* translators: %s: wp-content/uploads */ |
117 <?php |
114 printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' ); |
118 /* translators: %s: wp-content/uploads */ |
115 ?></p> |
119 printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' ); |
|
120 ?> |
|
121 </p> |
116 </td> |
122 </td> |
117 </tr> |
123 </tr> |
118 |
124 |
119 <tr> |
125 <tr> |
120 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th> |
126 <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" /> |
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" /> |
122 <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p> |
128 <p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p> |
123 </td> |
129 </td> |
124 </tr> |
130 </tr> |
125 <tr> |
131 <tr> |
126 <td colspan="2" class="td-full"> |
132 <td colspan="2" class="td-full"> |
127 <?php else : ?> |
133 <?php else : ?> |
128 <tr> |
134 <tr> |
129 <td class="td-full"> |
135 <td class="td-full"> |
130 <?php endif; ?> |
136 <?php endif; ?> |
131 <label for="uploads_use_yearmonth_folders"> |
137 <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')); ?> /> |
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' ) ); ?> /> |
133 <?php _e('Organize my uploads into month- and year-based folders'); ?> |
139 <?php _e( 'Organize my uploads into month- and year-based folders' ); ?> |
134 </label> |
140 </label> |
135 </td> |
141 </td> |
136 </tr> |
142 </tr> |
137 |
143 |
138 <?php do_settings_fields('media', 'uploads'); ?> |
144 <?php do_settings_fields( 'media', 'uploads' ); ?> |
139 </table> |
145 </table> |
140 <?php endif; ?> |
146 <?php endif; ?> |
141 |
147 |
142 <?php do_settings_sections('media'); ?> |
148 <?php do_settings_sections( 'media' ); ?> |
143 |
149 |
144 <?php submit_button(); ?> |
150 <?php submit_button(); ?> |
145 |
151 |
146 </form> |
152 </form> |
147 |
153 |