5 * @package WordPress |
5 * @package WordPress |
6 * @subpackage Administration |
6 * @subpackage Administration |
7 */ |
7 */ |
8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once __DIR__ . '/admin.php'; |
11 |
11 |
12 /** WordPress Translation Installation API */ |
12 /** WordPress Translation Installation API */ |
13 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
13 require_once ABSPATH . 'wp-admin/includes/translation-install.php'; |
14 |
14 |
15 if ( ! current_user_can( 'manage_options' ) ) { |
15 if ( ! current_user_can( 'manage_options' ) ) { |
16 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
16 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
17 } |
17 } |
18 |
18 |
19 $title = __( 'General Settings' ); |
19 $title = __( 'General Settings' ); |
20 $parent_file = 'options-general.php'; |
20 $parent_file = 'options-general.php'; |
21 /* translators: date and time format for exact current time, mainly about timezones, see https://secure.php.net/date */ |
21 /* translators: Date and time format for exact current time, mainly about timezones, see https://www.php.net/date */ |
22 $timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' ); |
22 $timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' ); |
23 |
23 |
24 add_action( 'admin_head', 'options_general_add_js' ); |
24 add_action( 'admin_head', 'options_general_add_js' ); |
25 |
25 |
26 $options_help = '<p>' . __( 'The fields on this screen determine some of the basics of your site setup.' ) . '</p>' . |
26 $options_help = '<p>' . __( 'The fields on this screen determine some of the basics of your site setup.' ) . '</p>' . |
43 ) |
43 ) |
44 ); |
44 ); |
45 |
45 |
46 get_current_screen()->set_help_sidebar( |
46 get_current_screen()->set_help_sidebar( |
47 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
47 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
48 '<p>' . __( '<a href="https://codex.wordpress.org/Settings_General_Screen">Documentation on General Settings</a>' ) . '</p>' . |
48 '<p>' . __( '<a href="https://wordpress.org/support/article/settings-general-screen/">Documentation on General Settings</a>' ) . '</p>' . |
49 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
49 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
50 ); |
50 ); |
51 |
51 |
52 include( ABSPATH . 'wp-admin/admin-header.php' ); |
52 require_once ABSPATH . 'wp-admin/admin-header.php'; |
53 ?> |
53 ?> |
54 |
54 |
55 <div class="wrap"> |
55 <div class="wrap"> |
56 <h1><?php echo esc_html( $title ); ?></h1> |
56 <h1><?php echo esc_html( $title ); ?></h1> |
57 |
57 |
71 <p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ); ?></p></td> |
71 <p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ); ?></p></td> |
72 </tr> |
72 </tr> |
73 |
73 |
74 <?php |
74 <?php |
75 if ( ! is_multisite() ) { |
75 if ( ! is_multisite() ) { |
76 $wp_site_url_class = $wp_home_class = ''; |
76 $wp_site_url_class = ''; |
|
77 $wp_home_class = ''; |
77 if ( defined( 'WP_SITEURL' ) ) { |
78 if ( defined( 'WP_SITEURL' ) ) { |
78 $wp_site_url_class = ' disabled'; |
79 $wp_site_url_class = ' disabled'; |
79 } |
80 } |
80 if ( defined( 'WP_HOME' ) ) { |
81 if ( defined( 'WP_HOME' ) ) { |
81 $wp_home_class = ' disabled'; |
82 $wp_home_class = ' disabled'; |
92 <td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php echo $wp_home_class; ?>" /> |
93 <td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php echo $wp_home_class; ?>" /> |
93 <?php if ( ! defined( 'WP_HOME' ) ) : ?> |
94 <?php if ( ! defined( 'WP_HOME' ) ) : ?> |
94 <p class="description" id="home-description"> |
95 <p class="description" id="home-description"> |
95 <?php |
96 <?php |
96 printf( |
97 printf( |
97 /* translators: %s: Codex URL */ |
98 /* translators: %s: Documentation URL. */ |
98 __( 'Enter the address here if you <a href="%s">want your site home page to be different from your WordPress installation directory</a>.' ), |
99 __( 'Enter the address here if you <a href="%s">want your site home page to be different from your WordPress installation directory</a>.' ), |
99 __( 'https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory' ) |
100 __( 'https://wordpress.org/support/article/giving-wordpress-its-own-directory/' ) |
100 ); |
101 ); |
101 ?> |
102 ?> |
102 </p> |
103 </p> |
103 <?php endif; ?> |
104 <?php endif; ?> |
104 </td> |
105 </td> |
105 </tr> |
106 </tr> |
106 |
107 |
107 <?php } ?> |
108 <?php } ?> |
108 |
109 |
109 <tr> |
110 <tr> |
110 <th scope="row"><label for="new_admin_email"><?php _e( 'Email Address' ); ?></label></th> |
111 <th scope="row"><label for="new_admin_email"><?php _e( 'Administration Email Address' ); ?></label></th> |
111 <td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
112 <td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
112 <p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p> |
113 <p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p> |
113 <?php |
114 <?php |
114 $new_admin_email = get_option( 'new_admin_email' ); |
115 $new_admin_email = get_option( 'new_admin_email' ); |
115 if ( $new_admin_email && $new_admin_email != get_option( 'admin_email' ) ) : |
116 if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) : |
116 ?> |
117 ?> |
117 <div class="updated inline"> |
118 <div class="updated inline"> |
118 <p> |
119 <p> |
119 <?php |
120 <?php |
120 printf( |
121 printf( |
121 /* translators: %s: new admin email */ |
122 /* translators: %s: New admin email. */ |
122 __( 'There is a pending change of the admin email to %s.' ), |
123 __( 'There is a pending change of the admin email to %s.' ), |
123 '<code>' . esc_html( $new_admin_email ) . '</code>' |
124 '<code>' . esc_html( $new_admin_email ) . '</code>' |
124 ); |
125 ); |
125 printf( |
126 printf( |
126 ' <a href="%1$s">%2$s</a>', |
127 ' <a href="%1$s">%2$s</a>', |
154 <?php |
155 <?php |
155 } |
156 } |
156 |
157 |
157 $languages = get_available_languages(); |
158 $languages = get_available_languages(); |
158 $translations = wp_get_available_translations(); |
159 $translations = wp_get_available_translations(); |
159 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
160 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) { |
160 $languages[] = WPLANG; |
161 $languages[] = WPLANG; |
161 } |
162 } |
162 if ( ! empty( $languages ) || ! empty( $translations ) ) { |
163 if ( ! empty( $languages ) || ! empty( $translations ) ) { |
163 ?> |
164 ?> |
164 <tr> |
165 <tr> |
165 <th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th> |
166 <th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label></th> |
166 <td> |
167 <td> |
167 <?php |
168 <?php |
168 $locale = get_locale(); |
169 $locale = get_locale(); |
169 if ( ! in_array( $locale, $languages ) ) { |
170 if ( ! in_array( $locale, $languages, true ) ) { |
170 $locale = ''; |
171 $locale = ''; |
171 } |
172 } |
172 |
173 |
173 wp_dropdown_languages( |
174 wp_dropdown_languages( |
174 array( |
175 array( |
180 'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(), |
181 'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(), |
181 ) |
182 ) |
182 ); |
183 ); |
183 |
184 |
184 // Add note about deprecated WPLANG constant. |
185 // Add note about deprecated WPLANG constant. |
185 if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
186 if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && WPLANG !== $locale ) { |
186 _deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %1$s constant in your %2$s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) ); |
187 _deprecated_argument( |
|
188 'define()', |
|
189 '4.0.0', |
|
190 /* translators: 1: WPLANG, 2: wp-config.php */ |
|
191 sprintf( __( 'The %1$s constant in your %2$s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) |
|
192 ); |
187 } |
193 } |
188 ?> |
194 ?> |
189 </td> |
195 </td> |
190 </tr> |
196 </tr> |
191 <?php |
197 <?php |
201 // Remove old Etc mappings. Fallback to gmt_offset. |
207 // Remove old Etc mappings. Fallback to gmt_offset. |
202 if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) { |
208 if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) { |
203 $tzstring = ''; |
209 $tzstring = ''; |
204 } |
210 } |
205 |
211 |
206 if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists |
212 if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists. |
207 $check_zone_info = false; |
213 $check_zone_info = false; |
208 if ( 0 == $current_offset ) { |
214 if ( 0 == $current_offset ) { |
209 $tzstring = 'UTC+0'; |
215 $tzstring = 'UTC+0'; |
210 } elseif ( $current_offset < 0 ) { |
216 } elseif ( $current_offset < 0 ) { |
211 $tzstring = 'UTC' . $current_offset; |
217 $tzstring = 'UTC' . $current_offset; |
220 |
226 |
221 <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description"> |
227 <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description"> |
222 <?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?> |
228 <?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?> |
223 </select> |
229 </select> |
224 |
230 |
225 <p class="description" id="timezone-description"><?php _e( 'Choose either a city in the same timezone as you or a UTC timezone offset.' ); ?></p> |
231 <p class="description" id="timezone-description"> |
|
232 <?php |
|
233 printf( |
|
234 /* translators: %s: UTC abbreviation */ |
|
235 __( 'Choose either a city in the same timezone as you or a %s (Coordinated Universal Time) time offset.' ), |
|
236 '<abbr>UTC</abbr>' |
|
237 ); |
|
238 ?> |
|
239 </p> |
226 |
240 |
227 <p class="timezone-info"> |
241 <p class="timezone-info"> |
228 <span id="utc-time"> |
242 <span id="utc-time"> |
229 <?php |
243 <?php |
230 /* translators: 1: UTC abbreviation, 2: UTC time */ |
|
231 printf( |
244 printf( |
232 __( 'Universal time (%1$s) is %2$s.' ), |
245 /* translators: %s: UTC time. */ |
233 '<abbr>' . __( 'UTC' ) . '</abbr>', |
246 __( 'Universal time is %s.' ), |
234 '<code>' . date_i18n( $timezone_format, false, true ) . '</code>' |
247 '<code>' . date_i18n( $timezone_format, false, true ) . '</code>' |
235 ); |
248 ); |
236 ?> |
249 ?> |
237 </span> |
250 </span> |
238 <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
251 <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
239 <span id="local-time"> |
252 <span id="local-time"> |
240 <?php |
253 <?php |
241 /* translators: %s: local time */ |
|
242 printf( |
254 printf( |
|
255 /* translators: %s: Local time. */ |
243 __( 'Local time is %s.' ), |
256 __( 'Local time is %s.' ), |
244 '<code>' . date_i18n( $timezone_format ) . '</code>' |
257 '<code>' . date_i18n( $timezone_format ) . '</code>' |
245 ); |
258 ); |
246 ?> |
259 ?> |
247 </span> |
260 </span> |
250 |
263 |
251 <?php if ( $check_zone_info && $tzstring ) : ?> |
264 <?php if ( $check_zone_info && $tzstring ) : ?> |
252 <p class="timezone-info"> |
265 <p class="timezone-info"> |
253 <span> |
266 <span> |
254 <?php |
267 <?php |
255 // Set TZ so localtime works. |
268 $now = new DateTime( 'now', new DateTimeZone( $tzstring ) ); |
256 date_default_timezone_set( $tzstring ); |
269 $dst = (bool) $now->format( 'I' ); |
257 $now = localtime( time(), true ); |
270 |
258 if ( $now['tm_isdst'] ) { |
271 if ( $dst ) { |
259 _e( 'This timezone is currently in daylight saving time.' ); |
272 _e( 'This timezone is currently in daylight saving time.' ); |
260 } else { |
273 } else { |
261 _e( 'This timezone is currently in standard time.' ); |
274 _e( 'This timezone is currently in standard time.' ); |
262 } |
275 } |
263 ?> |
276 ?> |
264 <br /> |
277 <br /> |
265 <?php |
278 <?php |
266 $allowed_zones = timezone_identifiers_list(); |
279 if ( in_array( $tzstring, timezone_identifiers_list(), true ) ) { |
267 |
280 $transitions = timezone_transitions_get( timezone_open( $tzstring ), time() ); |
268 if ( in_array( $tzstring, $allowed_zones ) ) { |
281 |
269 $found = false; |
282 // 0 index is the state at current time, 1 index is the next transition, if any. |
270 $date_time_zone_selected = new DateTimeZone( $tzstring ); |
283 if ( ! empty( $transitions[1] ) ) { |
271 $tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() ); |
|
272 $right_now = time(); |
|
273 foreach ( timezone_transitions_get( $date_time_zone_selected ) as $tr ) { |
|
274 if ( $tr['ts'] > $right_now ) { |
|
275 $found = true; |
|
276 break; |
|
277 } |
|
278 } |
|
279 |
|
280 if ( $found ) { |
|
281 echo ' '; |
284 echo ' '; |
282 $message = $tr['isdst'] ? |
285 $message = $transitions[1]['isdst'] ? |
283 /* translators: %s: date and time */ |
286 /* translators: %s: Date and time. */ |
284 __( 'Daylight saving time begins on: %s.' ) : |
287 __( 'Daylight saving time begins on: %s.' ) : |
285 /* translators: %s: date and time */ |
288 /* translators: %s: Date and time. */ |
286 __( 'Standard time begins on: %s.' ); |
289 __( 'Standard time begins on: %s.' ); |
287 // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
|
288 printf( |
290 printf( |
289 $message, |
291 $message, |
290 '<code>' . date_i18n( |
292 '<code>' . wp_date( __( 'F j, Y' ) . ' ' . __( 'g:i a' ), $transitions[1]['ts'] ) . '</code>' |
291 __( 'F j, Y' ) . ' ' . __( 'g:i a' ), |
|
292 $tr['ts'] + ( $tz_offset - $tr['offset'] ) |
|
293 ) . '</code>' |
|
294 ); |
293 ); |
295 } else { |
294 } else { |
296 _e( 'This timezone does not observe daylight saving time.' ); |
295 _e( 'This timezone does not observe daylight saving time.' ); |
297 } |
296 } |
298 } |
297 } |
299 // Set back to UTC. |
|
300 date_default_timezone_set( 'UTC' ); |
|
301 ?> |
298 ?> |
302 </span> |
299 </span> |
303 </p> |
300 </p> |
304 <?php endif; ?> |
301 <?php endif; ?> |
305 </td> |
302 </td> |
322 |
319 |
323 $custom = true; |
320 $custom = true; |
324 |
321 |
325 foreach ( $date_formats as $format ) { |
322 foreach ( $date_formats as $format ) { |
326 echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
323 echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
327 if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===" |
324 if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===". |
328 echo " checked='checked'"; |
325 echo " checked='checked'"; |
329 $custom = false; |
326 $custom = false; |
330 } |
327 } |
331 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
328 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
332 } |
329 } |
359 |
356 |
360 $custom = true; |
357 $custom = true; |
361 |
358 |
362 foreach ( $time_formats as $format ) { |
359 foreach ( $time_formats as $format ) { |
363 echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
360 echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
364 if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===" |
361 if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===". |
365 echo " checked='checked'"; |
362 echo " checked='checked'"; |
366 $custom = false; |
363 $custom = false; |
367 } |
364 } |
368 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
365 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
369 } |
366 } |
375 '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' . |
372 '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' . |
376 '<br />' . |
373 '<br />' . |
377 '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' . |
374 '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' . |
378 "<span class='spinner'></span>\n" . '</p>'; |
375 "<span class='spinner'></span>\n" . '</p>'; |
379 |
376 |
380 echo "\t<p class='date-time-doc'>" . __( '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.' ) . "</p>\n"; |
377 echo "\t<p class='date-time-doc'>" . __( '<a href="https://wordpress.org/support/article/formatting-date-and-time/">Documentation on date and time formatting</a>.' ) . "</p>\n"; |
381 ?> |
378 ?> |
382 </fieldset> |
379 </fieldset> |
383 </td> |
380 </td> |
384 </tr> |
381 </tr> |
385 <tr> |
382 <tr> |
386 <th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th> |
383 <th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th> |
387 <td><select name="start_of_week" id="start_of_week"> |
384 <td><select name="start_of_week" id="start_of_week"> |
388 <?php |
385 <?php |
389 /** |
386 /** |
390 * @global WP_Locale $wp_locale |
387 * @global WP_Locale $wp_locale WordPress date and time locale object. |
391 */ |
388 */ |
392 global $wp_locale; |
389 global $wp_locale; |
393 |
390 |
394 for ( $day_index = 0; $day_index <= 6; $day_index++ ) : |
391 for ( $day_index = 0; $day_index <= 6; $day_index++ ) : |
395 $selected = ( get_option( 'start_of_week' ) == $day_index ) ? 'selected="selected"' : ''; |
392 $selected = ( get_option( 'start_of_week' ) == $day_index ) ? 'selected="selected"' : ''; |