12
12
/** WordPress Translation Installation API */
13
13
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
15
if ( ! current_user_can( 'manage_options' ) )
15
if ( ! current_user_can( 'manage_options' ) ) {
16
16
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
18
$title = __('General Settings');
19
$title = __( 'General Settings' );
19
20
$parent_file = 'options-general.php';
20
21
/* translators: date and time format for exact current time, mainly about timezones, see https://secure.php.net/date */
21
$timezone_format = _x('Y-m-d H:i:s', 'timezone date format');
23
add_action('admin_head', 'options_general_add_js');
25
$options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' .
26
'<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>';
22
$timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' );
24
add_action( 'admin_head', 'options_general_add_js' );
26
$options_help = '<p>' . __( 'The fields on this screen determine some of the basics of your site setup.' ) . '</p>' .
27
'<p>' . __( 'Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.' ) . '</p>';
28
29
if ( ! is_multisite() ) {
29
$options_help .= '<p>' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '</p>' .
30
'<p>' . __('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.') . '</p>';
30
$options_help .= '<p>' . __( 'The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.' ) . '</p>' .
31
'<p>' . __( 'If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.' ) . '</p>';
33
34
$options_help .= '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' .
34
35
'<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' .
35
36
'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
37
get_current_screen()->add_help_tab( array(
39
'title' => __('Overview'),
40
'content' => $options_help,
38
get_current_screen()->add_help_tab(
41
'title' => __( 'Overview' ),
42
'content' => $options_help,
43
46
get_current_screen()->set_help_sidebar(
44
'<p><strong>' . __('For more information:') . '</strong></p>' .
45
'<p>' . __('<a href="https://codex.wordpress.org/Settings_General_Screen">Documentation on General Settings</a>') . '</p>' .
46
'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</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>' .
49
'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
49
52
include( ABSPATH . 'wp-admin/admin-header.php' );
53
56
<h1><?php echo esc_html( $title ); ?></h1>
55
58
<form method="post" action="options.php" novalidate="novalidate">
56
<?php settings_fields('general'); ?>
59
<?php settings_fields( 'general' ); ?>
58
61
<table class="form-table">
61
<th scope="row"><label for="blogname"><?php _e('Site Title') ?></label></th>
62
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
66
<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
67
<td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
68
<p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ) ?></p></td>
71
<?php if ( !is_multisite() ) { ?>
74
<th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th>
75
<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td>
79
<th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th>
80
<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 if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" />
81
<?php if ( ! defined( 'WP_HOME' ) ) : ?>
82
<p class="description" id="home-description"><?php
84
/* translators: %s: Codex URL */
85
__( 'Enter the address here if you <a href="%s">want your site home page to be different from your WordPress installation directory</a>.' ),
86
__( 'https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory' )
64
<th scope="row"><label for="blogname"><?php _e( 'Site Title' ); ?></label></th>
65
<td><input name="blogname" type="text" id="blogname" value="<?php form_option( 'blogname' ); ?>" class="regular-text" /></td>
69
<th scope="row"><label for="blogdescription"><?php _e( 'Tagline' ); ?></label></th>
70
<td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option( 'blogdescription' ); ?>" class="regular-text" />
71
<p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ); ?></p></td>
75
if ( ! is_multisite() ) {
76
$wp_site_url_class = $wp_home_class = '';
77
if ( defined( 'WP_SITEURL' ) ) {
78
$wp_site_url_class = ' disabled';
80
if ( defined( 'WP_HOME' ) ) {
81
$wp_home_class = ' disabled';
86
<th scope="row"><label for="siteurl"><?php _e( 'WordPress Address (URL)' ); ?></label></th>
87
<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php echo $wp_site_url_class; ?>" /></td>
91
<th scope="row"><label for="home"><?php _e( 'Site Address (URL)' ); ?></label></th>
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
<?php if ( ! defined( 'WP_HOME' ) ) : ?>
94
<p class="description" id="home-description">
97
/* translators: %s: Codex 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
__( 'https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory' )
98
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>
100
114
$new_admin_email = get_option( 'new_admin_email' );
101
if ( $new_admin_email && $new_admin_email != get_option( 'admin_email' ) ) : ?>
115
if ( $new_admin_email && $new_admin_email != get_option( 'admin_email' ) ) :
102
117
<div class="updated inline">
105
121
/* translators: %s: new admin email */
106
122
__( 'There is a pending change of the admin email to %s.' ),
120
137
<?php if ( ! is_multisite() ) { ?>
123
<th scope="row"><?php _e('Membership') ?></th>
124
<td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
125
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
126
<?php _e('Anyone can register') ?></label>
140
<th scope="row"><?php _e( 'Membership' ); ?></th>
141
<td> <fieldset><legend class="screen-reader-text"><span><?php _e( 'Membership' ); ?></span></legend><label for="users_can_register">
142
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked( '1', get_option( 'users_can_register' ) ); ?> />
143
<?php _e( 'Anyone can register' ); ?></label>
131
<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
148
<th scope="row"><label for="default_role"><?php _e( 'New User Default Role' ); ?></label></th>
133
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
150
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option( 'default_role' ) ); ?></select>
139
$languages = get_available_languages();
157
$languages = get_available_languages();
140
158
$translations = wp_get_available_translations();
141
159
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
142
160
$languages[] = WPLANG;
155
wp_dropdown_languages( array(
158
'selected' => $locale,
159
'languages' => $languages,
160
'translations' => $translations,
161
'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(),
173
wp_dropdown_languages(
177
'selected' => $locale,
178
'languages' => $languages,
179
'translations' => $translations,
180
'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(),
164
184
// Add note about deprecated WPLANG constant.
165
185
if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
167
187
|| ! is_multisite() && current_user_can( 'manage_options' ) ) {
169
189
<p class="description">
170
<strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
190
<strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %1$s constant in your %2$s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
174
_deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
194
_deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %1$s constant in your %2$s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
184
$current_offset = get_option('gmt_offset');
185
$tzstring = get_option('timezone_string');
204
$current_offset = get_option( 'gmt_offset' );
205
$tzstring = get_option( 'timezone_string' );
187
207
$check_zone_info = true;
189
209
// Remove old Etc mappings. Fallback to gmt_offset.
190
if ( false !== strpos($tzstring,'Etc/GMT') )
210
if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) {
193
if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
214
if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
194
215
$check_zone_info = false;
195
if ( 0 == $current_offset )
216
if ( 0 == $current_offset ) {
196
217
$tzstring = 'UTC+0';
197
elseif ($current_offset < 0)
218
} elseif ( $current_offset < 0 ) {
198
219
$tzstring = 'UTC' . $current_offset;
200
221
$tzstring = 'UTC+' . $current_offset;
204
<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
226
<th scope="row"><label for="timezone_string"><?php _e( 'Timezone' ); ?></label></th>
207
229
<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
211
233
<p class="description" id="timezone-description"><?php _e( 'Choose either a city in the same timezone as you or a UTC timezone offset.' ); ?></p>
213
235
<p class="timezone-info">
214
<span id="utc-time"><?php
215
238
/* translators: 1: UTC abbreviation, 2: UTC time */
216
printf( __( 'Universal time (%1$s) is %2$s.' ),
240
__( 'Universal time (%1$s) is %2$s.' ),
217
241
'<abbr>' . __( 'UTC' ) . '</abbr>',
218
242
'<code>' . date_i18n( $timezone_format, false, true ) . '</code>'
221
246
<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
222
<span id="local-time"><?php
247
<span id="local-time">
223
249
/* translators: %s: local time */
224
printf( __( 'Local time is %s.' ),
251
__( 'Local time is %s.' ),
225
252
'<code>' . date_i18n( $timezone_format ) . '</code>'
235
263
// Set TZ so localtime works.
236
date_default_timezone_set($tzstring);
237
$now = localtime(time(), true);
238
if ( $now['tm_isdst'] )
239
_e('This timezone is currently in daylight saving time.');
241
_e('This timezone is currently in standard time.');
264
date_default_timezone_set( $tzstring );
265
$now = localtime( time(), true );
266
if ( $now['tm_isdst'] ) {
267
_e( 'This timezone is currently in daylight saving time.' );
269
_e( 'This timezone is currently in standard time.' );
245
274
$allowed_zones = timezone_identifiers_list();
247
if ( in_array( $tzstring, $allowed_zones) ) {
249
$date_time_zone_selected = new DateTimeZone($tzstring);
250
$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
252
foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) {
276
if ( in_array( $tzstring, $allowed_zones ) ) {
278
$date_time_zone_selected = new DateTimeZone( $tzstring );
279
$tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() );
281
foreach ( timezone_transitions_get( $date_time_zone_selected ) as $tr ) {
253
282
if ( $tr['ts'] > $right_now ) {
261
290
$message = $tr['isdst'] ?
262
291
/* translators: %s: date and time */
263
__( 'Daylight saving time begins on: %s.') :
292
__( 'Daylight saving time begins on: %s.' ) :
264
293
/* translators: %s: date and time */
265
294
__( 'Standard time begins on: %s.' );
266
295
// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
268
298
'<code>' . date_i18n(
269
299
__( 'F j, Y' ) . ' ' . __( 'g:i a' ),
270
300
$tr['ts'] + ( $tz_offset - $tr['offset'] )
287
<th scope="row"><?php _e('Date Format') ?></th>
317
<th scope="row"><?php _e( 'Date Format' ); ?></th>
289
<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
319
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Date Format' ); ?></span></legend>
292
* Filters the default date formats.
295
* @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
297
* @param array $default_date_formats Array of default date formats.
322
* Filters the default date formats.
325
* @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
327
* @param string[] $default_date_formats Array of default date formats.
299
329
$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) );
303
foreach ( $date_formats as $format ) {
304
echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
305
if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
306
echo " checked='checked'";
309
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
333
foreach ( $date_formats as $format ) {
334
echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
335
if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "==="
336
echo " checked='checked'";
339
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
312
342
echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
313
343
checked( $custom );
325
<th scope="row"><?php _e('Time Format') ?></th>
355
<th scope="row"><?php _e( 'Time Format' ); ?></th>
327
<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
357
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Time Format' ); ?></span></legend>
330
* Filters the default time formats.
334
* @param array $default_time_formats Array of default time formats.
360
* Filters the default time formats.
364
* @param string[] $default_time_formats Array of default time formats.
336
366
$time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) );
340
foreach ( $time_formats as $format ) {
341
echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
342
if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
343
echo " checked='checked'";
346
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
370
foreach ( $time_formats as $format ) {
371
echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
372
if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "==="
373
echo " checked='checked'";
376
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
349
379
echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
350
380
checked( $custom );
355
385
'<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' .
356
386
"<span class='spinner'></span>\n" . '</p>';
358
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";
388
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";
364
<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
394
<th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th>
365
395
<td><select name="start_of_week" id="start_of_week">
370
400
global $wp_locale;
372
for ($day_index = 0; $day_index <= 6; $day_index++) :
373
$selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
374
echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
402
for ( $day_index = 0; $day_index <= 6; $day_index++ ) :
403
$selected = ( get_option( 'start_of_week' ) == $day_index ) ? 'selected="selected"' : '';
404
echo "\n\t<option value='" . esc_attr( $day_index ) . "' $selected>" . $wp_locale->get_weekday( $day_index ) . '</option>';
379
<?php do_settings_fields('general', 'default'); ?>
409
<?php do_settings_fields( 'general', 'default' ); ?>
382
<?php do_settings_sections('general'); ?>
412
<?php do_settings_sections( 'general' ); ?>
384
414
<?php submit_button(); ?>