| [ Root ] [ Search ] [ Index ] |
PHP Cross Reference of WordPress MU 2.9.2Provided by Yoast |
[Summary view] [Print] [Text view]
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 <tr valign="top"> 75 <th scope="row"><label for="new_admin_email"><?php _e('E-mail address') ?> </label></th> 76 <td><input name="new_admin_email" type="text" id="new_admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" /> 77 <span class="setting-description"><?php _e('This address is used for admin purposes.') ?> <?php _e('If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></span></td> 78 </tr> 79 <tr> 80 <?php 81 if ( !wp_timezone_supported() ) : // no magic timezone support here 82 ?> 83 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th> 84 <td> 85 <select name="gmt_offset" id="gmt_offset"> 86 <?php 87 $current_offset = get_option('gmt_offset'); 88 $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, 89 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); 90 foreach ( $offset_range as $offset ) { 91 if ( 0 < $offset ) 92 $offset_name = '+' . $offset; 93 elseif ( 0 == $offset ) 94 $offset_name = ''; 95 else 96 $offset_name = (string) $offset; 97 98 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); 99 100 $selected = ''; 101 if ( $current_offset == $offset ) { 102 $selected = " selected='selected'"; 103 $current_offset_name = $offset_name; 104 } 105 echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>'; 106 } 107 ?> 108 </select> 109 <?php _e('hours'); ?> 110 <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> 111 <?php if ($current_offset) : ?> 112 <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span> 113 <?php endif; ?> 114 <br /> 115 <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> 116 </td> 117 <?php 118 else: // looks like we can do nice timezone selection! 119 $current_offset = get_option('gmt_offset'); 120 $tzstring = get_option('timezone_string'); 121 122 $check_zone_info = true; 123 124 // Remove old Etc mappings. Fallback to gmt_offset. 125 if ( false !== strpos($tzstring,'Etc/GMT') ) 126 $tzstring = ''; 127 128 if (empty($tzstring)) { // set the Etc zone if no timezone string exists 129 $check_zone_info = false; 130 if ( 0 == $current_offset ) 131 $tzstring = 'UTC+0'; 132 elseif ($current_offset < 0) 133 $tzstring = 'UTC' . $current_offset; 134 else 135 $tzstring = 'UTC+' . $current_offset; 136 } 137 138 ?> 139 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th> 140 <td> 141 142 <select id="timezone_string" name="timezone_string"> 143 <?php echo wp_timezone_choice($tzstring); ?> 144 </select> 145 146 <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> 147 <?php if (get_option('timezone_string')) : ?> 148 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span> 149 <?php endif; ?> 150 <br /> 151 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span> 152 <br /> 153 <span> 154 <?php if ($check_zone_info && $tzstring) : ?> 155 <?php 156 $now = localtime(time(),true); 157 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.'); 158 else _e('This timezone is currently in standard time.'); 159 ?> 160 <br /> 161 <?php 162 if (function_exists('timezone_transitions_get')) { 163 $dateTimeZoneSelected = new DateTimeZone($tzstring); 164 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) { 165 if ($tr['ts'] > time()) { 166 $found = true; 167 break; 168 } 169 } 170 171 if ( isset($found) && $found === true ) { 172 echo ' '; 173 $message = $tr['isdst'] ? 174 __('Daylight savings time begins on: <code>%s</code>.') : 175 __('Standard time begins on: <code>%s</code>.'); 176 printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) ); 177 } else { 178 _e('This timezone does not observe daylight savings time.'); 179 } 180 } 181 ?> 182 </span> 183 <?php endif; ?> 184 </td> 185 186 <?php endif; ?> 187 </tr> 188 <tr> 189 <th scope="row"><?php _e('Date Format') ?></th> 190 <td> 191 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> 192 <?php 193 194 $date_formats = apply_filters( 'date_formats', array( 195 __('F j, Y'), 196 'Y/m/d', 197 'm/d/Y', 198 'd/m/Y', 199 ) ); 200 201 $custom = TRUE; 202 203 foreach ( $date_formats as $format ) { 204 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'"; 205 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" 206 echo " checked='checked'"; 207 $custom = FALSE; 208 } 209 echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; 210 } 211 212 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; 213 checked( $custom ); 214 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"; 215 216 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"; 217 ?> 218 </fieldset> 219 </td> 220 </tr> 221 <tr> 222 <th scope="row"><?php _e('Time Format') ?></th> 223 <td> 224 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> 225 <?php 226 227 $time_formats = apply_filters( 'time_formats', array( 228 __('g:i a'), 229 'g:i A', 230 'H:i', 231 ) ); 232 233 $custom = TRUE; 234 235 foreach ( $time_formats as $format ) { 236 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'"; 237 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "===" 238 echo " checked='checked'"; 239 $custom = FALSE; 240 } 241 echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; 242 } 243 244 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; 245 checked( $custom ); 246 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"; 247 ?> 248 </fieldset> 249 </td> 250 </tr> 251 <tr> 252 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th> 253 <td><select name="start_of_week" id="start_of_week"> 254 <?php 255 for ($day_index = 0; $day_index <= 6; $day_index++) : 256 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; 257 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>'; 258 endfor; 259 ?> 260 </select></td> 261 </tr> 262 <?php do_settings_fields('general', 'default'); ?> 263 <?php 264 if( is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) ) 265 while( ( $lang_file = readdir( $dh ) ) !== false ) 266 if( substr( $lang_file, -3 ) == '.mo' ) 267 $lang_files[] = $lang_file; 268 $lang = get_option('WPLANG'); 269 270 if( is_array($lang_files) && !empty($lang_files) ) { 271 ?> 272 <tr valign="top"> 273 <th width="33%" scope="row"><?php _e('Blog language:') ?></th> 274 <td> 275 <select name="WPLANG" id="WPLANG"> 276 <?php mu_dropdown_languages( $lang_files, get_option('WPLANG') ); ?> 277 </select> 278 </td> 279 </tr> 280 <?php 281 } // languages 282 ?> 283 </table> 284 285 <?php do_settings_sections('general'); ?> 286 287 <p class="submit"> 288 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 289 </p> 290 </form> 291 292 </div> 293 294 <?php include ('./admin-footer.php') ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon May 3 12:25:32 2010 | Cross-referenced by PHPXref 0.7 |