10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/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 $title = __('General Settings'); |
18 |
|
19 $title = __( 'General Settings' ); |
19 $parent_file = 'options-general.php'; |
20 $parent_file = 'options-general.php'; |
20 /* 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://secure.php.net/date */ |
21 $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' ); |
22 |
23 |
23 add_action('admin_head', 'options_general_add_js'); |
24 add_action( 'admin_head', 'options_general_add_js' ); |
24 |
25 |
25 $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>' . |
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>'; |
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>'; |
27 |
28 |
28 if ( ! is_multisite() ) { |
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 $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>'; |
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>'; |
31 } |
32 } |
32 |
33 |
33 $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 $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 '<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' . |
35 '<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' . |
35 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; |
36 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; |
36 |
37 |
37 get_current_screen()->add_help_tab( array( |
38 get_current_screen()->add_help_tab( |
38 'id' => 'overview', |
39 array( |
39 'title' => __('Overview'), |
40 'id' => 'overview', |
40 'content' => $options_help, |
41 'title' => __( 'Overview' ), |
41 ) ); |
42 'content' => $options_help, |
|
43 ) |
|
44 ); |
42 |
45 |
43 get_current_screen()->set_help_sidebar( |
46 get_current_screen()->set_help_sidebar( |
44 '<p><strong>' . __('For more information:') . '</strong></p>' . |
47 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
45 '<p>' . __('<a href="https://codex.wordpress.org/Settings_General_Screen">Documentation on General Settings</a>') . '</p>' . |
48 '<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>' |
49 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
47 ); |
50 ); |
48 |
51 |
49 include( ABSPATH . 'wp-admin/admin-header.php' ); |
52 include( ABSPATH . 'wp-admin/admin-header.php' ); |
50 ?> |
53 ?> |
51 |
54 |
52 <div class="wrap"> |
55 <div class="wrap"> |
53 <h1><?php echo esc_html( $title ); ?></h1> |
56 <h1><?php echo esc_html( $title ); ?></h1> |
54 |
57 |
55 <form method="post" action="options.php" novalidate="novalidate"> |
58 <form method="post" action="options.php" novalidate="novalidate"> |
56 <?php settings_fields('general'); ?> |
59 <?php settings_fields( 'general' ); ?> |
57 |
60 |
58 <table class="form-table"> |
61 <table class="form-table" role="presentation"> |
59 |
62 |
60 <tr> |
63 <tr> |
61 <th scope="row"><label for="blogname"><?php _e('Site Title') ?></label></th> |
64 <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> |
65 <td><input name="blogname" type="text" id="blogname" value="<?php form_option( 'blogname' ); ?>" class="regular-text" /></td> |
63 </tr> |
66 </tr> |
64 |
67 |
65 <tr> |
68 <tr> |
66 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th> |
69 <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" /> |
70 <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 <p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ); ?></p></td> |
69 </tr> |
72 </tr> |
70 |
73 |
71 <?php if ( !is_multisite() ) { ?> |
74 <?php |
72 |
75 if ( ! is_multisite() ) { |
73 <tr> |
76 $wp_site_url_class = $wp_home_class = ''; |
74 <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th> |
77 if ( defined( 'WP_SITEURL' ) ) { |
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> |
78 $wp_site_url_class = ' disabled'; |
76 </tr> |
79 } |
77 |
80 if ( defined( 'WP_HOME' ) ) { |
78 <tr> |
81 $wp_home_class = ' disabled'; |
79 <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th> |
82 } |
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' ?>" /> |
83 ?> |
81 <?php if ( ! defined( 'WP_HOME' ) ) : ?> |
84 |
82 <p class="description" id="home-description"><?php |
85 <tr> |
83 printf( |
86 <th scope="row"><label for="siteurl"><?php _e( 'WordPress Address (URL)' ); ?></label></th> |
84 /* translators: %s: Codex URL */ |
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> |
85 __( 'Enter the address here if you <a href="%s">want your site home page to be different from your WordPress installation directory</a>.' ), |
88 </tr> |
86 __( 'https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory' ) |
89 |
87 ); |
90 <tr> |
88 ?></p> |
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"> |
|
95 <?php |
|
96 printf( |
|
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' ) |
|
100 ); |
|
101 ?> |
|
102 </p> |
89 <?php endif; ?> |
103 <?php endif; ?> |
90 </td> |
104 </td> |
91 </tr> |
105 </tr> |
92 |
106 |
93 <?php } ?> |
107 <?php } ?> |
96 <th scope="row"><label for="new_admin_email"><?php _e( 'Email Address' ); ?></label></th> |
110 <th scope="row"><label for="new_admin_email"><?php _e( 'Email Address' ); ?></label></th> |
97 <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" /> |
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" /> |
98 <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> |
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> |
99 <?php |
113 <?php |
100 $new_admin_email = get_option( 'new_admin_email' ); |
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' ) ) : |
|
116 ?> |
102 <div class="updated inline"> |
117 <div class="updated inline"> |
103 <p><?php |
118 <p> |
|
119 <?php |
104 printf( |
120 printf( |
105 /* translators: %s: new admin email */ |
121 /* translators: %s: new admin email */ |
106 __( 'There is a pending change of the admin email to %s.' ), |
122 __( 'There is a pending change of the admin email to %s.' ), |
107 '<code>' . esc_html( $new_admin_email ) . '</code>' |
123 '<code>' . esc_html( $new_admin_email ) . '</code>' |
108 ); |
124 ); |
109 printf( |
125 printf( |
110 ' <a href="%1$s">%2$s</a>', |
126 ' <a href="%1$s">%2$s</a>', |
111 esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ), |
127 esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ), |
112 __( 'Cancel' ) |
128 __( 'Cancel' ) |
113 ); |
129 ); |
114 ?></p> |
130 ?> |
|
131 </p> |
115 </div> |
132 </div> |
116 <?php endif; ?> |
133 <?php endif; ?> |
117 </td> |
134 </td> |
118 </tr> |
135 </tr> |
119 |
136 |
120 <?php if ( ! is_multisite() ) { ?> |
137 <?php if ( ! is_multisite() ) { ?> |
121 |
138 |
122 <tr> |
139 <tr> |
123 <th scope="row"><?php _e('Membership') ?></th> |
140 <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"> |
141 <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')); ?> /> |
142 <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> |
143 <?php _e( 'Anyone can register' ); ?></label> |
127 </fieldset></td> |
144 </fieldset></td> |
128 </tr> |
145 </tr> |
129 |
146 |
130 <tr> |
147 <tr> |
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> |
132 <td> |
149 <td> |
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> |
134 </td> |
151 </td> |
135 </tr> |
152 </tr> |
136 |
153 |
137 <?php } |
154 <?php |
138 |
155 } |
139 $languages = get_available_languages(); |
156 |
|
157 $languages = get_available_languages(); |
140 $translations = wp_get_available_translations(); |
158 $translations = wp_get_available_translations(); |
141 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
159 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
142 $languages[] = WPLANG; |
160 $languages[] = WPLANG; |
143 } |
161 } |
144 if ( ! empty( $languages ) || ! empty( $translations ) ) { |
162 if ( ! empty( $languages ) || ! empty( $translations ) ) { |
150 $locale = get_locale(); |
168 $locale = get_locale(); |
151 if ( ! in_array( $locale, $languages ) ) { |
169 if ( ! in_array( $locale, $languages ) ) { |
152 $locale = ''; |
170 $locale = ''; |
153 } |
171 } |
154 |
172 |
155 wp_dropdown_languages( array( |
173 wp_dropdown_languages( |
156 'name' => 'WPLANG', |
174 array( |
157 'id' => 'WPLANG', |
175 'name' => 'WPLANG', |
158 'selected' => $locale, |
176 'id' => 'WPLANG', |
159 'languages' => $languages, |
177 'selected' => $locale, |
160 'translations' => $translations, |
178 'languages' => $languages, |
161 'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(), |
179 'translations' => $translations, |
162 ) ); |
180 'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(), |
|
181 ) |
|
182 ); |
163 |
183 |
164 // Add note about deprecated WPLANG constant. |
184 // Add note about deprecated WPLANG constant. |
165 if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
185 if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
166 if ( is_multisite() && current_user_can( 'manage_network_options' ) |
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' ) ); |
167 || ! is_multisite() && current_user_can( 'manage_options' ) ) { |
|
168 ?> |
|
169 <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>' ); ?> |
|
171 </p> |
|
172 <?php |
|
173 } |
|
174 _deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) ); |
|
175 } |
187 } |
176 ?> |
188 ?> |
177 </td> |
189 </td> |
178 </tr> |
190 </tr> |
179 <?php |
191 <?php |
180 } |
192 } |
181 ?> |
193 ?> |
182 <tr> |
194 <tr> |
183 <?php |
195 <?php |
184 $current_offset = get_option('gmt_offset'); |
196 $current_offset = get_option( 'gmt_offset' ); |
185 $tzstring = get_option('timezone_string'); |
197 $tzstring = get_option( 'timezone_string' ); |
186 |
198 |
187 $check_zone_info = true; |
199 $check_zone_info = true; |
188 |
200 |
189 // Remove old Etc mappings. Fallback to gmt_offset. |
201 // Remove old Etc mappings. Fallback to gmt_offset. |
190 if ( false !== strpos($tzstring,'Etc/GMT') ) |
202 if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) { |
191 $tzstring = ''; |
203 $tzstring = ''; |
192 |
204 } |
193 if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists |
205 |
|
206 if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists |
194 $check_zone_info = false; |
207 $check_zone_info = false; |
195 if ( 0 == $current_offset ) |
208 if ( 0 == $current_offset ) { |
196 $tzstring = 'UTC+0'; |
209 $tzstring = 'UTC+0'; |
197 elseif ($current_offset < 0) |
210 } elseif ( $current_offset < 0 ) { |
198 $tzstring = 'UTC' . $current_offset; |
211 $tzstring = 'UTC' . $current_offset; |
199 else |
212 } else { |
200 $tzstring = 'UTC+' . $current_offset; |
213 $tzstring = 'UTC+' . $current_offset; |
201 } |
214 } |
202 |
215 } |
203 ?> |
216 |
204 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th> |
217 ?> |
|
218 <th scope="row"><label for="timezone_string"><?php _e( 'Timezone' ); ?></label></th> |
205 <td> |
219 <td> |
206 |
220 |
207 <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description"> |
221 <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description"> |
208 <?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?> |
222 <?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?> |
209 </select> |
223 </select> |
210 |
224 |
211 <p class="description" id="timezone-description"><?php _e( 'Choose either a city in the same timezone as you or a UTC timezone offset.' ); ?></p> |
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> |
212 |
226 |
213 <p class="timezone-info"> |
227 <p class="timezone-info"> |
214 <span id="utc-time"><?php |
228 <span id="utc-time"> |
|
229 <?php |
215 /* translators: 1: UTC abbreviation, 2: UTC time */ |
230 /* translators: 1: UTC abbreviation, 2: UTC time */ |
216 printf( __( 'Universal time (%1$s) is %2$s.' ), |
231 printf( |
|
232 __( 'Universal time (%1$s) is %2$s.' ), |
217 '<abbr>' . __( 'UTC' ) . '</abbr>', |
233 '<abbr>' . __( 'UTC' ) . '</abbr>', |
218 '<code>' . date_i18n( $timezone_format, false, true ) . '</code>' |
234 '<code>' . date_i18n( $timezone_format, false, true ) . '</code>' |
219 ); |
235 ); |
220 ?></span> |
236 ?> |
|
237 </span> |
221 <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
238 <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
222 <span id="local-time"><?php |
239 <span id="local-time"> |
|
240 <?php |
223 /* translators: %s: local time */ |
241 /* translators: %s: local time */ |
224 printf( __( 'Local time is %s.' ), |
242 printf( |
|
243 __( 'Local time is %s.' ), |
225 '<code>' . date_i18n( $timezone_format ) . '</code>' |
244 '<code>' . date_i18n( $timezone_format ) . '</code>' |
226 ); |
245 ); |
227 ?></span> |
246 ?> |
|
247 </span> |
228 <?php endif; ?> |
248 <?php endif; ?> |
229 </p> |
249 </p> |
230 |
250 |
231 <?php if ( $check_zone_info && $tzstring ) : ?> |
251 <?php if ( $check_zone_info && $tzstring ) : ?> |
232 <p class="timezone-info"> |
252 <p class="timezone-info"> |
233 <span> |
253 <span> |
234 <?php |
254 <?php |
235 // Set TZ so localtime works. |
255 // Set TZ so localtime works. |
236 date_default_timezone_set($tzstring); |
256 date_default_timezone_set( $tzstring ); |
237 $now = localtime(time(), true); |
257 $now = localtime( time(), true ); |
238 if ( $now['tm_isdst'] ) |
258 if ( $now['tm_isdst'] ) { |
239 _e('This timezone is currently in daylight saving time.'); |
259 _e( 'This timezone is currently in daylight saving time.' ); |
240 else |
260 } else { |
241 _e('This timezone is currently in standard time.'); |
261 _e( 'This timezone is currently in standard time.' ); |
|
262 } |
242 ?> |
263 ?> |
243 <br /> |
264 <br /> |
244 <?php |
265 <?php |
245 $allowed_zones = timezone_identifiers_list(); |
266 $allowed_zones = timezone_identifiers_list(); |
246 |
267 |
247 if ( in_array( $tzstring, $allowed_zones) ) { |
268 if ( in_array( $tzstring, $allowed_zones ) ) { |
248 $found = false; |
269 $found = false; |
249 $date_time_zone_selected = new DateTimeZone($tzstring); |
270 $date_time_zone_selected = new DateTimeZone( $tzstring ); |
250 $tz_offset = timezone_offset_get($date_time_zone_selected, date_create()); |
271 $tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() ); |
251 $right_now = time(); |
272 $right_now = time(); |
252 foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) { |
273 foreach ( timezone_transitions_get( $date_time_zone_selected ) as $tr ) { |
253 if ( $tr['ts'] > $right_now ) { |
274 if ( $tr['ts'] > $right_now ) { |
254 $found = true; |
275 $found = true; |
255 break; |
276 break; |
256 } |
277 } |
257 } |
278 } |
258 |
279 |
259 if ( $found ) { |
280 if ( $found ) { |
260 echo ' '; |
281 echo ' '; |
261 $message = $tr['isdst'] ? |
282 $message = $tr['isdst'] ? |
262 /* translators: %s: date and time */ |
283 /* translators: %s: date and time */ |
263 __( 'Daylight saving time begins on: %s.') : |
284 __( 'Daylight saving time begins on: %s.' ) : |
264 /* translators: %s: date and time */ |
285 /* translators: %s: date and time */ |
265 __( 'Standard time begins on: %s.' ); |
286 __( 'Standard time begins on: %s.' ); |
266 // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
287 // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
267 printf( $message, |
288 printf( |
|
289 $message, |
268 '<code>' . date_i18n( |
290 '<code>' . date_i18n( |
269 __( 'F j, Y' ) . ' ' . __( 'g:i a' ), |
291 __( 'F j, Y' ) . ' ' . __( 'g:i a' ), |
270 $tr['ts'] + ( $tz_offset - $tr['offset'] ) |
292 $tr['ts'] + ( $tz_offset - $tr['offset'] ) |
271 ) . '</code>' |
293 ) . '</code>' |
272 ); |
294 ); |
273 } else { |
295 } else { |
274 _e( 'This timezone does not observe daylight saving time.' ); |
296 _e( 'This timezone does not observe daylight saving time.' ); |
275 } |
297 } |
276 } |
298 } |
277 // Set back to UTC. |
299 // Set back to UTC. |
278 date_default_timezone_set('UTC'); |
300 date_default_timezone_set( 'UTC' ); |
279 ?> |
301 ?> |
280 </span> |
302 </span> |
281 </p> |
303 </p> |
282 <?php endif; ?> |
304 <?php endif; ?> |
283 </td> |
305 </td> |
284 |
306 |
285 </tr> |
307 </tr> |
286 <tr> |
308 <tr> |
287 <th scope="row"><?php _e('Date Format') ?></th> |
309 <th scope="row"><?php _e( 'Date Format' ); ?></th> |
288 <td> |
310 <td> |
289 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> |
311 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Date Format' ); ?></span></legend> |
290 <?php |
312 <?php |
291 /** |
313 /** |
292 * Filters the default date formats. |
314 * Filters the default date formats. |
293 * |
315 * |
294 * @since 2.7.0 |
316 * @since 2.7.0 |
295 * @since 4.0.0 Added ISO date standard YYYY-MM-DD format. |
317 * @since 4.0.0 Added ISO date standard YYYY-MM-DD format. |
296 * |
318 * |
297 * @param array $default_date_formats Array of default date formats. |
319 * @param string[] $default_date_formats Array of default date formats. |
298 */ |
320 */ |
299 $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
321 $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
300 |
322 |
301 $custom = true; |
323 $custom = true; |
302 |
324 |
303 foreach ( $date_formats as $format ) { |
325 foreach ( $date_formats as $format ) { |
304 echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
326 echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
305 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" |
327 if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===" |
306 echo " checked='checked'"; |
328 echo " checked='checked'"; |
307 $custom = false; |
329 $custom = false; |
308 } |
330 } |
309 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
331 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
310 } |
332 } |
311 |
333 |
312 echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
334 echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
313 checked( $custom ); |
335 checked( $custom ); |
314 echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . '</span></span></label>' . |
336 echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . '</span></span></label>' . |
315 '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label>' . |
337 '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label>' . |
320 ?> |
342 ?> |
321 </fieldset> |
343 </fieldset> |
322 </td> |
344 </td> |
323 </tr> |
345 </tr> |
324 <tr> |
346 <tr> |
325 <th scope="row"><?php _e('Time Format') ?></th> |
347 <th scope="row"><?php _e( 'Time Format' ); ?></th> |
326 <td> |
348 <td> |
327 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> |
349 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Time Format' ); ?></span></legend> |
328 <?php |
350 <?php |
329 /** |
351 /** |
330 * Filters the default time formats. |
352 * Filters the default time formats. |
331 * |
353 * |
332 * @since 2.7.0 |
354 * @since 2.7.0 |
333 * |
355 * |
334 * @param array $default_time_formats Array of default time formats. |
356 * @param string[] $default_time_formats Array of default time formats. |
335 */ |
357 */ |
336 $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
358 $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
337 |
359 |
338 $custom = true; |
360 $custom = true; |
339 |
361 |
340 foreach ( $time_formats as $format ) { |
362 foreach ( $time_formats as $format ) { |
341 echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
363 echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
342 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "===" |
364 if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===" |
343 echo " checked='checked'"; |
365 echo " checked='checked'"; |
344 $custom = false; |
366 $custom = false; |
345 } |
367 } |
346 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
368 echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
347 } |
369 } |
348 |
370 |
349 echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
371 echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
350 checked( $custom ); |
372 checked( $custom ); |
351 echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . '</span></span></label>' . |
373 echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . '</span></span></label>' . |
352 '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label>' . |
374 '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label>' . |
353 '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' . |
375 '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' . |
354 '<br />' . |
376 '<br />' . |
355 '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' . |
377 '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' . |
356 "<span class='spinner'></span>\n" . '</p>'; |
378 "<span class='spinner'></span>\n" . '</p>'; |
357 |
379 |
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"; |
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"; |
359 ?> |
381 ?> |
360 </fieldset> |
382 </fieldset> |
361 </td> |
383 </td> |
362 </tr> |
384 </tr> |
363 <tr> |
385 <tr> |
364 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th> |
386 <th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th> |
365 <td><select name="start_of_week" id="start_of_week"> |
387 <td><select name="start_of_week" id="start_of_week"> |
366 <?php |
388 <?php |
367 /** |
389 /** |
368 * @global WP_Locale $wp_locale |
390 * @global WP_Locale $wp_locale |
369 */ |
391 */ |
370 global $wp_locale; |
392 global $wp_locale; |
371 |
393 |
372 for ($day_index = 0; $day_index <= 6; $day_index++) : |
394 for ( $day_index = 0; $day_index <= 6; $day_index++ ) : |
373 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; |
395 $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>'; |
396 echo "\n\t<option value='" . esc_attr( $day_index ) . "' $selected>" . $wp_locale->get_weekday( $day_index ) . '</option>'; |
375 endfor; |
397 endfor; |
376 ?> |
398 ?> |
377 </select></td> |
399 </select></td> |
378 </tr> |
400 </tr> |
379 <?php do_settings_fields('general', 'default'); ?> |
401 <?php do_settings_fields( 'general', 'default' ); ?> |
380 </table> |
402 </table> |
381 |
403 |
382 <?php do_settings_sections('general'); ?> |
404 <?php do_settings_sections( 'general' ); ?> |
383 |
405 |
384 <?php submit_button(); ?> |
406 <?php submit_button(); ?> |
385 </form> |
407 </form> |
386 |
408 |
387 </div> |
409 </div> |