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');
142 if (empty($tzstring)) { // set the Etc zone if no timezone string exists
143 if ($current_offset < 0) $offnum = - ceil($current_offset);
144 else $offnum = - floor($current_offset);
145 $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;
148 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
151 <select id="timezone_string" name="timezone_string">
152 <?php echo wp_timezone_choice($tzstring); ?>
155 <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>
156 <?php if (get_option('timezone_string')) : ?>
157 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
160 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
163 <?php if ($tzstring) : ?>
165 $now = localtime(time(),true);
166 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
167 else _e('This timezone is currently in standard time.');
171 if (function_exists('timezone_transitions_get')) {
172 $dateTimeZoneSelected = new DateTimeZone($tzstring);
173 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
174 if ($tr['ts'] > time()) {
180 if ( isset($found) && $found === true ) {
182 $message = $tr['isdst'] ?
183 __('Daylight savings time begins on: <code>%s</code>.') :
184 __('Standard time begins on: <code>%s</code>.');
185 printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
187 _e('This timezone does not observe daylight savings time.');
198 <th scope="row"><?php _e('Date Format') ?></th>
200 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
203 $date_formats = apply_filters( 'date_formats', array(
212 foreach ( $date_formats as $format ) {
213 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
214 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
215 echo " checked='checked'";
218 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
221 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
223 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";
225 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";
231 <th scope="row"><?php _e('Time Format') ?></th>
233 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
236 $time_formats = apply_filters( 'time_formats', array(
244 foreach ( $time_formats as $format ) {
245 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
246 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
247 echo " checked='checked'";
250 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
253 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
255 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";
261 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
262 <td><select name="start_of_week" id="start_of_week">
264 for ($day_index = 0; $day_index <= 6; $day_index++) :
265 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
266 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
271 <?php do_settings_fields('general', 'default'); ?>
274 <?php do_settings_sections('general'); ?>
277 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
283 <?php include('./admin-footer.php') ?>