3 * General settings administration panel.
6 * @subpackage Administration
9 /** WordPress Administration Bootstrap */
10 require_once('./admin.php');
12 $title = __('General Settings');
13 $parent_file = 'options-general.php';
14 /* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
15 $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
18 * Display JavaScript on the page.
21 * @subpackage General_Settings_Panel
25 <script type="text/javascript">
27 jQuery(document).ready(function($){
28 $("input[name='date_format']").click(function(){
29 if ( "date_format_custom_radio" != $(this).attr("id") )
30 $("input[name='date_format_custom']").val( $(this).val() );
32 $("input[name='date_format_custom']").focus(function(){
33 $("#date_format_custom_radio").attr("checked", "checked");
36 $("input[name='time_format']").click(function(){
37 if ( "time_format_custom_radio" != $(this).attr("id") )
38 $("input[name='time_format_custom']").val( $(this).val() );
40 $("input[name='time_format_custom']").focus(function(){
41 $("#time_format_custom_radio").attr("checked", "checked");
48 add_filter('admin_head', 'add_js');
50 include('./admin-header.php');
54 <?php screen_icon(); ?>
55 <h2><?php echo esc_html( $title ); ?></h2>
57 <form method="post" action="options.php">
58 <?php settings_fields('general'); ?>
60 <table class="form-table">
62 <th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
63 <td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
66 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
67 <td><input name="blogdescription" type="text" id="blogdescription" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
68 <span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
71 <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
72 <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>
75 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
76 <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; ?> />
77 <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>
80 <th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
81 <td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text" />
82 <span class="description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
85 <th scope="row"><?php _e('Membership') ?></th>
86 <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
87 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
88 <?php _e('Anyone can register') ?></label>
92 <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
94 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
99 if ( !wp_timezone_supported() ) : // no magic timezone support here
101 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
103 <select name="gmt_offset" id="gmt_offset">
105 $current_offset = get_option('gmt_offset');
106 $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,
107 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);
108 foreach ( $offset_range as $offset ) {
110 $offset_name = '+' . $offset;
111 elseif ( 0 == $offset )
114 $offset_name = (string) $offset;
116 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
119 if ( $current_offset == $offset ) {
120 $selected = " selected='selected'";
121 $current_offset_name = $offset_name;
123 echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
127 <?php _e('hours'); ?>
128 <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>
129 <?php if ($current_offset) : ?>
130 <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
133 <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>
136 else: // looks like we can do nice timezone selection!
137 $current_offset = get_option('gmt_offset');
138 $tzstring = get_option('timezone_string');
139 if (empty($tzstring)) { // set the Etc zone if no timezone string exists
140 if ($current_offset < 0) $offnum = - ceil($current_offset);
141 else $offnum = - floor($current_offset);
142 $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;
145 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
148 <select id="timezone_string" name="timezone_string">
149 <?php echo wp_timezone_choice($tzstring); ?>
152 <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>
153 <?php if (get_option('timezone_string')) : ?>
154 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
157 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
160 <?php if ($tzstring) : ?>
162 $now = localtime(time(),true);
163 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
164 else _e('This timezone is currently in standard time.');
168 if (function_exists('timezone_transitions_get')) {
169 $dateTimeZoneSelected = new DateTimeZone($tzstring);
170 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
171 if ($tr['ts'] > time()) {
177 if ( isset($found) && $found === true ) {
179 $message = $tr['isdst'] ?
180 __('Daylight savings time begins on: <code>%s</code>.') :
181 __('Standard time begins on: <code>%s</code>.');
182 printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
184 _e('This timezone does not observe daylight savings time.');
195 <th scope="row"><?php _e('Date Format') ?></th>
197 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
200 $date_formats = apply_filters( 'date_formats', array(
209 foreach ( $date_formats as $format ) {
210 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
211 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
212 echo " checked='checked'";
215 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
218 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
220 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";
222 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";
228 <th scope="row"><?php _e('Time Format') ?></th>
230 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
233 $time_formats = apply_filters( 'time_formats', array(
241 foreach ( $time_formats as $format ) {
242 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
243 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
244 echo " checked='checked'";
247 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
250 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
252 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";
258 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
259 <td><select name="start_of_week" id="start_of_week">
261 for ($day_index = 0; $day_index <= 6; $day_index++) :
262 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
263 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
268 <?php do_settings_fields('general', 'default'); ?>
271 <?php do_settings_sections('general'); ?>
274 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
280 <?php include('./admin-footer.php') ?>