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