]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/options-general.php
Wordpress 2.7.1
[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 $title = __('General Settings');
13 $parent_file = 'options-general.php';
14
15 /**
16  * Display JavaScript on the page.
17  *
18  * @package WordPress
19  * @subpackage General_Settings_Panel
20  */
21 function add_js() {
22 ?>
23 <script type="text/javascript">
24 //<![CDATA[
25         jQuery(document).ready(function($){
26                 $("input[name='date_format']").click(function(){
27                         if ( "date_format_custom_radio" != $(this).attr("id") )
28                                 $("input[name='date_format_custom']").val( $(this).val() );
29                 });
30                 $("input[name='date_format_custom']").focus(function(){
31                         $("#date_format_custom_radio").attr("checked", "checked");
32                 });
33
34                 $("input[name='time_format']").click(function(){
35                         if ( "time_format_custom_radio" != $(this).attr("id") )
36                                 $("input[name='time_format_custom']").val( $(this).val() );
37                 });
38                 $("input[name='time_format_custom']").focus(function(){
39                         $("#time_format_custom_radio").attr("checked", "checked");
40                 });
41         });
42 //]]>
43 </script>
44 <?php
45 }
46 add_filter('admin_head', 'add_js');
47
48 include('./admin-header.php');
49 ?>
50
51 <div class="wrap">
52 <?php screen_icon(); ?>
53 <h2><?php echo wp_specialchars( $title ); ?></h2>
54
55 <form method="post" action="options.php">
56 <?php settings_fields('general'); ?>
57
58 <table class="form-table">
59 <tr valign="top">
60 <th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
61 <td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
62 </tr>
63 <tr valign="top">
64 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
65 <td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />
66 <span class="setting-description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
67 </tr>
68 <tr valign="top">
69 <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
70 <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>
71 </tr>
72 <tr valign="top">
73 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
74 <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; ?> />
75 <span class="setting-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>
76 </tr>
77 <tr valign="top">
78 <th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
79 <td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" />
80 <span class="setting-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
81 </tr>
82 <tr valign="top">
83 <th scope="row"><?php _e('Membership') ?></th>
84 <td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register">
85 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
86 <?php _e('Anyone can register') ?></label>
87 </fieldset></td>
88 </tr>
89 <tr valign="top">
90 <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
91 <td>
92 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
93 </td>
94 </tr>
95 <tr>
96 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
97 <td>
98 <select name="gmt_offset" id="gmt_offset">
99 <?php
100 $current_offset = get_option('gmt_offset');
101 $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,
102         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);
103 foreach ( $offset_range as $offset ) {
104         if ( 0 < $offset )
105                 $offset_name = '+' . $offset;
106         elseif ( 0 == $offset )
107                 $offset_name = '';
108         else
109                 $offset_name = (string) $offset;
110
111         $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
112
113         $selected = '';
114         if ( $current_offset == $offset ) {
115                 $selected = " selected='selected'";
116                 $current_offset_name = $offset_name;
117         }
118         echo "<option value=\"$offset\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
119 }
120 ?>
121 </select>
122 <?php _e('hours') ?>
123 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?></span>
124 <?php if ($current_offset) : ?>
125         <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n(__('Y-m-d G:i:s'))); ?></span>
126 <?php endif; ?>
127 <br/>
128 <span class="setting-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>
129 </td>
130 </tr>
131 <tr>
132 <th scope="row"><?php _e('Date Format') ?></th>
133 <td>
134         <fieldset><legend class="hidden"><?php _e('Date Format') ?></legend>
135 <?php
136
137         $date_formats = apply_filters( 'date_formats', array(
138                 __('F j, Y'),
139                 'Y/m/d',
140                 'm/d/Y',
141                 'd/m/Y',
142         ) );
143
144         $custom = TRUE;
145
146         foreach ( $date_formats as $format ) {
147                 echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='date_format' value='" . attribute_escape($format) . "'";
148                 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
149                         echo " checked='checked'";
150                         $custom = FALSE;
151                 }
152                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
153         }
154
155         echo '  <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
156         checked( $custom, TRUE );
157         echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";
158
159         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";
160 ?>
161         </fieldset>
162 </td>
163 </tr>
164 <tr>
165 <th scope="row"><?php _e('Time Format') ?></th>
166 <td>
167         <fieldset><legend class="hidden"><?php _e('Time Format') ?></legend>
168 <?php
169
170         $time_formats = apply_filters( 'time_formats', array(
171                 __('g:i a'),
172                 'g:i A',
173                 'H:i',
174         ) );
175
176         $custom = TRUE;
177
178         foreach ( $time_formats as $format ) {
179                 echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='time_format' value='" . attribute_escape($format) . "'";
180                 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
181                         echo " checked='checked'";
182                         $custom = FALSE;
183                 }
184                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
185         }
186
187         echo '  <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
188         checked( $custom, TRUE );
189         echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
190 ?>
191         </fieldset>
192 </td>
193 </tr>
194 <tr>
195 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
196 <td><select name="start_of_week" id="start_of_week">
197 <?php
198 for ($day_index = 0; $day_index <= 6; $day_index++) :
199         $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
200         echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
201 endfor;
202 ?>
203 </select></td>
204 </tr>
205 <?php do_settings_fields('general', 'default'); ?>
206 </table>
207
208 <?php do_settings_sections('general'); ?>
209
210 <p class="submit">
211 <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
212 </p>
213 </form>
214
215 </div>
216
217 <?php include('./admin-footer.php') ?>