3 * General settings administration panel.
6 * @subpackage Administration
9 /** WordPress Administration Bootstrap */
10 require_once('./admin.php');
12 if ( ! current_user_can('manage_options') )
13 wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
15 $title = __('General Settings');
16 $parent_file = 'options-general.php';
17 /* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
18 $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
21 * Display JavaScript on the page.
24 * @subpackage General_Settings_Panel
28 <script type="text/javascript">
30 jQuery(document).ready(function($){
31 $("input[name='date_format']").click(function(){
32 if ( "date_format_custom_radio" != $(this).attr("id") )
33 $("input[name='date_format_custom']").val( $(this).val() );
35 $("input[name='date_format_custom']").focus(function(){
36 $("#date_format_custom_radio").attr("checked", "checked");
39 $("input[name='time_format']").click(function(){
40 if ( "time_format_custom_radio" != $(this).attr("id") )
41 $("input[name='time_format_custom']").val( $(this).val() );
43 $("input[name='time_format_custom']").focus(function(){
44 $("#time_format_custom_radio").attr("checked", "checked");
51 add_filter('admin_head', 'add_js');
53 include('./admin-header.php');
57 <?php screen_icon(); ?>
58 <h2><?php echo esc_html( $title ); ?></h2>
60 <form method="post" action="options.php">
61 <?php settings_fields('general'); ?>
63 <table class="form-table">
65 <th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
66 <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" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
71 <span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
74 <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
75 <td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
78 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
79 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
80 <span class="description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
83 <th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
84 <td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text" />
85 <span class="description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
88 <th scope="row"><?php _e('Membership') ?></th>
89 <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
90 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
91 <?php _e('Anyone can register') ?></label>
95 <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
97 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
102 if ( !wp_timezone_supported() ) : // no magic timezone support here
104 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
106 <select name="gmt_offset" id="gmt_offset">
108 $current_offset = get_option('gmt_offset');
109 $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
110 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
111 foreach ( $offset_range as $offset ) {
113 $offset_name = '+' . $offset;
114 elseif ( 0 == $offset )
117 $offset_name = (string) $offset;
119 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
122 if ( $current_offset == $offset ) {
123 $selected = " selected='selected'";
124 $current_offset_name = $offset_name;
126 echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
130 <?php _e('hours'); ?>
131 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n( $time_format, false, 'gmt')); ?></span>
132 <?php if ($current_offset) : ?>
133 <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
136 <span class="description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
139 else: // looks like we can do nice timezone selection!
140 $current_offset = get_option('gmt_offset');
141 $tzstring = get_option('timezone_string');
143 $check_zone_info = true;
145 // Remove old Etc mappings. Fallback to gmt_offset.
146 if ( false !== strpos($tzstring,'Etc/GMT') )
149 if (empty($tzstring)) { // set the Etc zone if no timezone string exists
150 $check_zone_info = false;
151 if ( 0 == $current_offset )
153 elseif ($current_offset < 0)
154 $tzstring = 'UTC' . $current_offset;
156 $tzstring = 'UTC+' . $current_offset;
160 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
163 <select id="timezone_string" name="timezone_string">
164 <?php echo wp_timezone_choice($tzstring); ?>
167 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
168 <?php if (get_option('timezone_string')) : ?>
169 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
172 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
175 <?php if ($check_zone_info && $tzstring) : ?>
177 $now = localtime(time(),true);
178 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
179 else _e('This timezone is currently in standard time.');
183 if (function_exists('timezone_transitions_get')) {
184 $dateTimeZoneSelected = new DateTimeZone($tzstring);
185 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
186 if ($tr['ts'] > time()) {
192 if ( isset($found) && $found === true ) {
194 $message = $tr['isdst'] ?
195 __('Daylight savings time begins on: <code>%s</code>.') :
196 __('Standard time begins on: <code>%s</code>.');
197 printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
199 _e('This timezone does not observe daylight savings time.');
210 <th scope="row"><?php _e('Date Format') ?></th>
212 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
215 $date_formats = apply_filters( 'date_formats', array(
224 foreach ( $date_formats as $format ) {
225 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
226 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
227 echo " checked='checked'";
230 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
233 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
235 echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";
237 echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click “Save Changes” to update sample output.') . "</p>\n";
243 <th scope="row"><?php _e('Time Format') ?></th>
245 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
248 $time_formats = apply_filters( 'time_formats', array(
256 foreach ( $time_formats as $format ) {
257 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
258 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
259 echo " checked='checked'";
262 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
265 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
267 echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
273 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
274 <td><select name="start_of_week" id="start_of_week">
276 for ($day_index = 0; $day_index <= 6; $day_index++) :
277 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
278 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
283 <?php do_settings_fields('general', 'default'); ?>
286 <?php do_settings_sections('general'); ?>
289 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
295 <?php include('./admin-footer.php') ?>