Changeset 5808 for trunk/wp-admin/includes/template.php
- Timestamp:
- 07/17/2007 07:26:03 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r5804 r5808 417 417 } 418 418 419 // return an option/select list with correct html escaping420 function input_dropdown($name, $vals, $selected=null, $class='', $onchange='') {421 422 // cf. http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.2.2423 $out = '<select name="' . htmlspecialchars($name) . '" class="' . htmlspecialchars($class) . '" onchange="' . htmlspecialchars($onchange) . '">' . "\n";424 foreach ($vals as $k=>$v) {425 $out .= '<option value="' . htmlspecialchars($k) . '"';426 if ( $selected !== null and $k == $selected )427 $out .= ' selected="selected"';428 $out .= '>' . htmlspecialchars($v) . "</option>\n";429 }430 $out .= "</select>\n";431 432 return $out;433 }434 435 // return an array of month names for the current locale, indexed 1..12436 function locale_months() {437 global $wp_locale;438 439 $months = array();440 foreach ( range(1, 12) as $m )441 $months[$m] = $wp_locale->get_month( $m );442 return $months;443 }444 445 419 function touch_time( $edit = 1, $for_post = 1 ) { 446 420 global $wp_locale, $post, $comment; … … 449 423 $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true; 450 424 451 echo '<fieldset class="jcalendar"><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';425 echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>'; 452 426 453 427 $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 ); … … 460 434 $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); 461 435 462 echo '<div class="jcalendar-selects">'; 463 echo input_dropdown( 'mm', locale_months(), $mm, 'jcalendar-select-month', 'edit_date.checked=true' ); 464 465 foreach ( range(1, 31) as $i ) 466 $days[$i] = $i; 467 echo input_dropdown( 'jj', $days, $jj, 'jcalendar-select-day', 'edit_date.checked=true' ); 468 469 foreach ( range(1970, 2038) as $i ) 470 $years[$i] = $i; 471 echo input_dropdown( 'aa', $years, $aa, 'jcalendar-select-year', 'edit_date.checked=true' ); 472 echo '</div>'; 473 474 $jcal_css_url = get_bloginfo('wpurl') . '/wp-includes/js/jquery/css/jcalendar.css?version=' . get_bloginfo('version'); 475 476 ?> 477 <script type="text/javascript"> 478 <!-- 479 jQuery(document).ready(function() { 480 jQuery.jcalendar.setLanguageStrings(jcalendar_L10n.days, jcalendar_L10n.months, jcalendar_L10n.navLinks); 481 jQuery('fieldset.jcalendar').jcalendar(); 482 }); 483 // --> 484 </script> 485 @ <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : 436 echo "<select name=\"mm\" onchange=\"edit_date.checked=true\">\n"; 437 for ( $i = 1; $i < 13; $i = $i +1 ) { 438 echo "\t\t\t<option value=\"$i\""; 439 if ( $i == $mm ) 440 echo ' selected="selected"'; 441 echo '>' . $wp_locale->get_month( $i ) . "</option>\n"; 442 } 443 ?> 444 </select> 445 <input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/> 446 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @ 447 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : 486 448 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 487 449 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
Note: See TracChangeset
for help on using the changeset viewer.