]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/options-general.php
Wordpress 2.8.3
[autoinstalls/wordpress.git] / wp-admin / options-general.php
1 <?php
2 /**
3  * General settings administration panel.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** WordPress Administration Bootstrap */
10 require_once('./admin.php');
11
12 if ( ! current_user_can('manage_options') )
13         wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
14
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');
19
20 /**
21  * Display JavaScript on the page.
22  *
23  * @package WordPress
24  * @subpackage General_Settings_Panel
25  */
26 function add_js() {
27 ?>
28 <script type="text/javascript">
29 //<![CDATA[
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() );
34                 });
35                 $("input[name='date_format_custom']").focus(function(){
36                         $("#date_format_custom_radio").attr("checked", "checked");
37                 });
38
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() );
42                 });
43                 $("input[name='time_format_custom']").focus(function(){
44                         $("#time_format_custom_radio").attr("checked", "checked");
45                 });
46         });
47 //]]>
48 </script>
49 <?php
50 }
51 add_filter('admin_head', 'add_js');
52
53 include('./admin-header.php');
54 ?>
55
56 <div class="wrap">
57 <?php screen_icon(); ?>
58 <h2><?php echo esc_html( $title ); ?></h2>
59
60 <form method="post" action="options.php">
61 <?php settings_fields('general'); ?>
62
63 <table class="form-table">
64 <tr valign="top">
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>
67 </tr>
68 <tr valign="top">
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>
72 </tr>
73 <tr valign="top">
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>
76 </tr>
77 <tr valign="top">
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>
81 </tr>
82 <tr valign="top">
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>
86 </tr>
87 <tr valign="top">
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>
92 </fieldset></td>
93 </tr>
94 <tr valign="top">
95 <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
96 <td>
97 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
98 </td>
99 </tr>
100 <tr>
101 <?php
102 if ( !wp_timezone_supported() ) : // no magic timezone support here
103 ?>
104 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
105 <td>
106 <select name="gmt_offset" id="gmt_offset">
107 <?php
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 ) {
112         if ( 0 < $offset )
113                 $offset_name = '+' . $offset;
114         elseif ( 0 == $offset )
115                 $offset_name = '';
116         else
117                 $offset_name = (string) $offset;
118
119         $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
120
121         $selected = '';
122         if ( $current_offset == $offset ) {
123                 $selected = " selected='selected'";
124                 $current_offset_name = $offset_name;
125         }
126         echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
127 }
128 ?>
129 </select>
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>
134 <?php endif; ?>
135 <br />
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>
137 </td>
138 <?php
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;
146 }
147 ?>
148 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
149 <td>
150
151 <select id="timezone_string" name="timezone_string">
152 <?php echo wp_timezone_choice($tzstring); ?>
153 </select>
154
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>
158 <?php endif; ?>
159 <br />
160 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
161 <br />
162 <span>
163 <?php if ($tzstring) : ?>
164         <?php
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.');
168         ?>
169         <br />
170         <?php
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()) {
175                             $found = true;
176                                 break;
177                         }
178                 }
179
180                 if ( isset($found) && $found === true ) {
181                         echo ' ';
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'] ) );
186                 } else {
187                         _e('This timezone does not observe daylight savings time.');
188                 }
189         }
190         ?>
191         </span>
192 <?php endif; ?>
193 </td>
194
195 <?php endif; ?>
196 </tr>
197 <tr>
198 <th scope="row"><?php _e('Date Format') ?></th>
199 <td>
200         <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
201 <?php
202
203         $date_formats = apply_filters( 'date_formats', array(
204                 __('F j, Y'),
205                 'Y/m/d',
206                 'm/d/Y',
207                 'd/m/Y',
208         ) );
209
210         $custom = TRUE;
211
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'";
216                         $custom = FALSE;
217                 }
218                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
219         }
220
221         echo '  <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
222         checked( $custom );
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";
224
225         echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click &#8220;Save Changes&#8221; to update sample output.') . "</p>\n";
226 ?>
227         </fieldset>
228 </td>
229 </tr>
230 <tr>
231 <th scope="row"><?php _e('Time Format') ?></th>
232 <td>
233         <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
234 <?php
235
236         $time_formats = apply_filters( 'time_formats', array(
237                 __('g:i a'),
238                 'g:i A',
239                 'H:i',
240         ) );
241
242         $custom = TRUE;
243
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'";
248                         $custom = FALSE;
249                 }
250                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
251         }
252
253         echo '  <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
254         checked( $custom );
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";
256 ?>
257         </fieldset>
258 </td>
259 </tr>
260 <tr>
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">
263 <?php
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>';
267 endfor;
268 ?>
269 </select></td>
270 </tr>
271 <?php do_settings_fields('general', 'default'); ?>
272 </table>
273
274 <?php do_settings_sections('general'); ?>
275
276 <p class="submit">
277 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
278 </p>
279 </form>
280
281 </div>
282
283 <?php include('./admin-footer.php') ?>