Changeset 1632
- Timestamp:
- 09/09/2004 11:07:46 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-general.php
r1599 r1632 48 48 <form name="form1" method="post" action="options.php"> 49 49 <input type="hidden" name="action" value="update" /> 50 <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','siteurl','admin_email','users_can_register','new_users_can_blog','gmt_offset','date_format','time_format','home' " />50 <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','siteurl','admin_email','users_can_register','new_users_can_blog','gmt_offset','date_format','time_format','home','start_of_week'" /> 51 51 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 52 52 <tr valign="top"> … … 111 111 <?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td> 112 112 </tr> 113 <tr> 114 <th scope="row"><?php _e('Weeks in the calendar should start on:') ?></th> 115 <td><select name="start_of_week" id="start_of_week"> 116 <?php 117 for ($day_index = 0; $day_index <= 6; $day_index++) : 118 if ($day_index == get_settings('start_of_week')) $selected = " selected='selected'"; 119 else $selected = ''; 120 echo "\n\t<option value='$day_index' $selected>$weekday[$day_index]</option>"; 121 endfor; 122 ?> 123 </select></td> 124 </tr> 125 113 126 </table> 114 127 -
trunk/wp-includes/template-functions-general.php
r1629 r1632 330 330 } 331 331 332 // Used in get_calendar 333 function calendar_week_mod($num) { 334 $base = 7; 335 return ($num - $base*floor($num/$base)); 336 } 337 332 338 function get_calendar($daylength = 1) { 333 339 global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts; … … 344 350 } 345 351 352 // week_begins = 0 stands for sunday 353 $week_begins = intval(get_settings('start_of_week')); 346 354 $add_hours = intval(get_settings('gmt_offset')); 347 355 $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); … … 396 404 } 397 405 398 foreach ($weekday as $wd) { 406 $myweek = array(); 407 408 for ($wdcount=0; $wdcount<=6; $wdcount++) { 409 $myweek[]=$weekday[($wdcount+$week_begins)%7]; 410 } 411 412 foreach ($myweek as $wd) { 399 413 echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . $day_abbrev[$wd] . '</th>'; 400 414 } … … 478 492 479 493 // See how much we should pad in the beginning 480 $pad = intval(date('w', $unixmonth));494 $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins); 481 495 if (0 != $pad) echo "\n\t\t".'<td colspan="'.$pad.'" class="pad"> </td>'; 482 496 … … 499 513 echo '</td>'; 500 514 501 if (6 == date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear)))515 if (6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins)) 502 516 $newrow = true; 503 517 } 504 518 505 $pad = 7 - date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear));519 $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins); 506 520 if ($pad != 0 && $pad != 7) 507 521 echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>';
Note: See TracChangeset
for help on using the changeset viewer.