author | ymh <ymh.work@gmail.com> |
Tue, 15 Oct 2019 15:48:13 +0200 | |
changeset 13 | d255fe9cd479 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
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 */ |
|
10 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
/** WordPress Translation Installation API */ |
5 | 13 |
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
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 |
|
9 | 19 |
$title = __( 'General Settings' ); |
0 | 20 |
$parent_file = 'options-general.php'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
/* translators: date and time format for exact current time, mainly about timezones, see https://secure.php.net/date */ |
9 | 22 |
$timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' ); |
0 | 23 |
|
9 | 24 |
add_action( 'admin_head', 'options_general_add_js' ); |
0 | 25 |
|
9 | 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>'; |
|
0 | 28 |
|
29 |
if ( ! is_multisite() ) { |
|
9 | 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>'; |
|
0 | 32 |
} |
33 |
||
5 | 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>' . |
35 |
'<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' . |
|
0 | 36 |
'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; |
37 |
||
9 | 38 |
get_current_screen()->add_help_tab( |
39 |
array( |
|
40 |
'id' => 'overview', |
|
41 |
'title' => __( 'Overview' ), |
|
42 |
'content' => $options_help, |
|
43 |
) |
|
44 |
); |
|
0 | 45 |
|
46 |
get_current_screen()->set_help_sidebar( |
|
9 | 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</a>' ) . '</p>' |
|
0 | 50 |
); |
51 |
||
52 |
include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
53 |
?> |
|
54 |
||
55 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
<h1><?php echo esc_html( $title ); ?></h1> |
0 | 57 |
|
5 | 58 |
<form method="post" action="options.php" novalidate="novalidate"> |
9 | 59 |
<?php settings_fields( 'general' ); ?> |
0 | 60 |
|
9 | 61 |
<table class="form-table" role="presentation"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
62 |
|
5 | 63 |
<tr> |
9 | 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> |
|
0 | 66 |
</tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
67 |
|
5 | 68 |
<tr> |
9 | 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> |
|
0 | 72 |
</tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
|
9 | 74 |
<?php |
75 |
if ( ! is_multisite() ) { |
|
76 |
$wp_site_url_class = $wp_home_class = ''; |
|
77 |
if ( defined( 'WP_SITEURL' ) ) { |
|
78 |
$wp_site_url_class = ' disabled'; |
|
79 |
} |
|
80 |
if ( defined( 'WP_HOME' ) ) { |
|
81 |
$wp_home_class = ' disabled'; |
|
82 |
} |
|
83 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
|
5 | 85 |
<tr> |
9 | 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> |
|
0 | 88 |
</tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
|
5 | 90 |
<tr> |
9 | 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> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
104 |
</td> |
0 | 105 |
</tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
<?php } ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
108 |
|
5 | 109 |
<tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
110 |
<th scope="row"><label for="new_admin_email"><?php _e( 'Email Address' ); ?></label></th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
113 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
114 |
$new_admin_email = get_option( 'new_admin_email' ); |
9 | 115 |
if ( $new_admin_email && $new_admin_email != get_option( 'admin_email' ) ) : |
116 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
117 |
<div class="updated inline"> |
9 | 118 |
<p> |
119 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
120 |
printf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
/* translators: %s: new admin email */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
__( '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
|
123 |
'<code>' . esc_html( $new_admin_email ) . '</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
124 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
125 |
printf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
126 |
' <a href="%1$s">%2$s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
127 |
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
|
128 |
__( 'Cancel' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
129 |
); |
9 | 130 |
?> |
131 |
</p> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
133 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
134 |
</td> |
0 | 135 |
</tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
136 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
<?php if ( ! is_multisite() ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
|
5 | 139 |
<tr> |
9 | 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> |
|
0 | 144 |
</fieldset></td> |
145 |
</tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
|
5 | 147 |
<tr> |
9 | 148 |
<th scope="row"><label for="default_role"><?php _e( 'New User Default Role' ); ?></label></th> |
0 | 149 |
<td> |
9 | 150 |
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option( 'default_role' ) ); ?></select> |
0 | 151 |
</td> |
152 |
</tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
|
9 | 154 |
<?php |
155 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
|
9 | 157 |
$languages = get_available_languages(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
$translations = wp_get_available_translations(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
$languages[] = WPLANG; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
if ( ! empty( $languages ) || ! empty( $translations ) ) { |
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 |
<tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
<th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
167 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
$locale = get_locale(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
if ( ! in_array( $locale, $languages ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
$locale = ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
|
9 | 173 |
wp_dropdown_languages( |
174 |
array( |
|
175 |
'name' => 'WPLANG', |
|
176 |
'id' => 'WPLANG', |
|
177 |
'selected' => $locale, |
|
178 |
'languages' => $languages, |
|
179 |
'translations' => $translations, |
|
180 |
'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(), |
|
181 |
) |
|
182 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
// Add note about deprecated WPLANG constant. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
9 | 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' ) ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
</td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
</tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
?> |
0 | 194 |
<tr> |
195 |
<?php |
|
9 | 196 |
$current_offset = get_option( 'gmt_offset' ); |
197 |
$tzstring = get_option( 'timezone_string' ); |
|
0 | 198 |
|
199 |
$check_zone_info = true; |
|
200 |
||
201 |
// Remove old Etc mappings. Fallback to gmt_offset. |
|
9 | 202 |
if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) { |
0 | 203 |
$tzstring = ''; |
9 | 204 |
} |
0 | 205 |
|
9 | 206 |
if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists |
0 | 207 |
$check_zone_info = false; |
9 | 208 |
if ( 0 == $current_offset ) { |
0 | 209 |
$tzstring = 'UTC+0'; |
9 | 210 |
} elseif ( $current_offset < 0 ) { |
0 | 211 |
$tzstring = 'UTC' . $current_offset; |
9 | 212 |
} else { |
0 | 213 |
$tzstring = 'UTC+' . $current_offset; |
9 | 214 |
} |
0 | 215 |
} |
216 |
||
217 |
?> |
|
9 | 218 |
<th scope="row"><label for="timezone_string"><?php _e( 'Timezone' ); ?></label></th> |
0 | 219 |
<td> |
220 |
||
5 | 221 |
<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
|
222 |
<?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?> |
0 | 223 |
</select> |
224 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
227 |
<p class="timezone-info"> |
9 | 228 |
<span id="utc-time"> |
229 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
230 |
/* translators: 1: UTC abbreviation, 2: UTC time */ |
9 | 231 |
printf( |
232 |
__( 'Universal time (%1$s) is %2$s.' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
233 |
'<abbr>' . __( 'UTC' ) . '</abbr>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
234 |
'<code>' . date_i18n( $timezone_format, false, true ) . '</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
235 |
); |
9 | 236 |
?> |
237 |
</span> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
238 |
<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
9 | 239 |
<span id="local-time"> |
240 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
241 |
/* translators: %s: local time */ |
9 | 242 |
printf( |
243 |
__( 'Local time is %s.' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
244 |
'<code>' . date_i18n( $timezone_format ) . '</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
245 |
); |
9 | 246 |
?> |
247 |
</span> |
|
0 | 248 |
<?php endif; ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
249 |
</p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
250 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
251 |
<?php if ( $check_zone_info && $tzstring ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
252 |
<p class="timezone-info"> |
0 | 253 |
<span> |
254 |
<?php |
|
255 |
// Set TZ so localtime works. |
|
9 | 256 |
date_default_timezone_set( $tzstring ); |
257 |
$now = localtime( time(), true ); |
|
258 |
if ( $now['tm_isdst'] ) { |
|
259 |
_e( 'This timezone is currently in daylight saving time.' ); |
|
260 |
} else { |
|
261 |
_e( 'This timezone is currently in standard time.' ); |
|
262 |
} |
|
0 | 263 |
?> |
264 |
<br /> |
|
265 |
<?php |
|
266 |
$allowed_zones = timezone_identifiers_list(); |
|
267 |
||
9 | 268 |
if ( in_array( $tzstring, $allowed_zones ) ) { |
269 |
$found = false; |
|
270 |
$date_time_zone_selected = new DateTimeZone( $tzstring ); |
|
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 ) { |
|
0 | 274 |
if ( $tr['ts'] > $right_now ) { |
9 | 275 |
$found = true; |
0 | 276 |
break; |
277 |
} |
|
278 |
} |
|
279 |
||
280 |
if ( $found ) { |
|
281 |
echo ' '; |
|
282 |
$message = $tr['isdst'] ? |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
/* translators: %s: date and time */ |
9 | 284 |
__( 'Daylight saving time begins on: %s.' ) : |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
/* translators: %s: date and time */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
286 |
__( 'Standard time begins on: %s.' ); |
0 | 287 |
// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
9 | 288 |
printf( |
289 |
$message, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
'<code>' . date_i18n( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
291 |
__( 'F j, Y' ) . ' ' . __( 'g:i a' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
292 |
$tr['ts'] + ( $tz_offset - $tr['offset'] ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
293 |
) . '</code>' |
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 |
// Set back to UTC. |
|
9 | 300 |
date_default_timezone_set( 'UTC' ); |
0 | 301 |
?> |
302 |
</span> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
303 |
</p> |
0 | 304 |
<?php endif; ?> |
305 |
</td> |
|
306 |
||
307 |
</tr> |
|
308 |
<tr> |
|
9 | 309 |
<th scope="row"><?php _e( 'Date Format' ); ?></th> |
0 | 310 |
<td> |
9 | 311 |
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Date Format' ); ?></span></legend> |
0 | 312 |
<?php |
313 |
/** |
|
9 | 314 |
* Filters the default date formats. |
315 |
* |
|
316 |
* @since 2.7.0 |
|
317 |
* @since 4.0.0 Added ISO date standard YYYY-MM-DD format. |
|
318 |
* |
|
319 |
* @param string[] $default_date_formats Array of default date formats. |
|
320 |
*/ |
|
5 | 321 |
$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
0 | 322 |
|
323 |
$custom = true; |
|
324 |
||
9 | 325 |
foreach ( $date_formats as $format ) { |
326 |
echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
|
327 |
if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===" |
|
328 |
echo " checked='checked'"; |
|
329 |
$custom = false; |
|
0 | 330 |
} |
9 | 331 |
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
332 |
} |
|
0 | 333 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
0 | 335 |
checked( $custom ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
337 |
'<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
|
338 |
'<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
|
339 |
'<br />' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
340 |
'<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
|
341 |
"<span class='spinner'></span>\n" . '</p>'; |
0 | 342 |
?> |
343 |
</fieldset> |
|
344 |
</td> |
|
345 |
</tr> |
|
346 |
<tr> |
|
9 | 347 |
<th scope="row"><?php _e( 'Time Format' ); ?></th> |
0 | 348 |
<td> |
9 | 349 |
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Time Format' ); ?></span></legend> |
0 | 350 |
<?php |
351 |
/** |
|
9 | 352 |
* Filters the default time formats. |
353 |
* |
|
354 |
* @since 2.7.0 |
|
355 |
* |
|
356 |
* @param string[] $default_time_formats Array of default time formats. |
|
357 |
*/ |
|
0 | 358 |
$time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
359 |
||
360 |
$custom = true; |
|
361 |
||
9 | 362 |
foreach ( $time_formats as $format ) { |
363 |
echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
|
364 |
if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===" |
|
365 |
echo " checked='checked'"; |
|
366 |
$custom = false; |
|
0 | 367 |
} |
9 | 368 |
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
369 |
} |
|
0 | 370 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
371 |
echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
0 | 372 |
checked( $custom ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
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>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
374 |
'<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
|
375 |
'<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
|
376 |
'<br />' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
377 |
'<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
|
378 |
"<span class='spinner'></span>\n" . '</p>'; |
5 | 379 |
|
9 | 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"; |
0 | 381 |
?> |
382 |
</fieldset> |
|
383 |
</td> |
|
384 |
</tr> |
|
385 |
<tr> |
|
9 | 386 |
<th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th> |
0 | 387 |
<td><select name="start_of_week" id="start_of_week"> |
388 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
389 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
390 |
* @global WP_Locale $wp_locale |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
391 |
*/ |
5 | 392 |
global $wp_locale; |
393 |
||
9 | 394 |
for ( $day_index = 0; $day_index <= 6; $day_index++ ) : |
395 |
$selected = ( get_option( 'start_of_week' ) == $day_index ) ? 'selected="selected"' : ''; |
|
396 |
echo "\n\t<option value='" . esc_attr( $day_index ) . "' $selected>" . $wp_locale->get_weekday( $day_index ) . '</option>'; |
|
0 | 397 |
endfor; |
398 |
?> |
|
399 |
</select></td> |
|
400 |
</tr> |
|
9 | 401 |
<?php do_settings_fields( 'general', 'default' ); ?> |
0 | 402 |
</table> |
403 |
||
9 | 404 |
<?php do_settings_sections( 'general' ); ?> |
0 | 405 |
|
406 |
<?php submit_button(); ?> |
|
407 |
</form> |
|
408 |
||
409 |
</div> |
|
410 |
||
411 |
<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |