Changeset 1649
- Timestamp:
- 06/04/2015 06:55:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/archive-meeting.php
r1637 r1649 2 2 3 3 <div class="wrapper"> 4 <h2 class="title"> Upcoming WordPress Meetings</h2>4 <h2 class="title"><?php _e('Upcoming WordPress Meetings','wporg'); ?></h2> 5 5 <table class="schedule"> 6 6 <thead> 7 7 <tr> 8 <th>Team</th> 9 <th>Name</th> 10 <th>Next Meeting Date</th> 11 <th>Time</th> 12 <th>Location</th> 8 <th><?php _e('Team','wporg'); ?></th> 9 <th><?php _e('Name','wporg'); ?></th> 10 <th><?php _e('Next Meeting','wporg'); ?></th> 11 <th><?php _e('Location','wporg'); ?></th> 13 12 </tr> 14 13 </thead> … … 18 17 <td><?php echo $post->team; ?></td> 19 18 <td><a href="<?php echo $post->link; ?>"><?php the_title(); ?></a></td> 20 <td><?php echo $post->next_date; ?></td> 21 <td><?php echo $post->time; ?></td> 19 <td><?php 20 // convert the date time to a pretty format 21 $time = strtotime( $post->next_date.' '. $post->time.' GMT' ); // note, strtotime doesn't grok UTC very well, GMT works fine though 22 echo '<a href="http://www.timeanddate.com/worldclock/fixedtime.html?iso='.gmdate('Ymd\THi', $time).'"><abbr class="date" title="'.gmdate('c', $time).'">'; 23 echo date( 'F j, Y H:i \U\T\C', $time ); 24 echo '</abbr></a>'; 25 ?></td> 22 26 <td><?php echo $post->location; ?></td> 23 27 </tr> … … 26 30 </table> 27 31 </div><!-- /wrapper --> 32 <?php 28 33 34 // convert the displayed date time to a local one to the viewing browser, if possible 35 function wporg_makehome_time_converter_script() { 36 $timestrings = array( 37 'months' => array(__('January'), __('February'), __('March'),__('April'),__('May'),__('June'),__('July'),__('August'),__('September'),__('October'),__('November'), __('December')), 38 ); 39 ?> 40 <script type="text/javascript"> 41 jQuery(document).ready( function ($) { 42 var timestrings = <?php echo json_encode($timestrings); ?> 43 44 var parse_date = function (text) { 45 var m = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\+00:00$/.exec(text); 46 var d = new Date(); 47 d.setUTCFullYear(+m[1]); 48 d.setUTCDate(+m[3]); 49 d.setUTCMonth(+m[2]-1); 50 d.setUTCHours(+m[4]); 51 d.setUTCMinutes(+m[5]); 52 d.setUTCSeconds(+m[6]); 53 return d; 54 } 55 var format_date = function (d) { 56 var p = function(n) {return ('00'+n).slice(-2); }; 57 var tz = -d.getTimezoneOffset()/60; 58 if (tz>=0) { tz = "+"+tz; } 59 return ""+timestrings['months'][d.getMonth()]+" "+p(d.getDate())+", "+d.getFullYear()+" "+p(d.getHours())+":"+p(d. getMinutes())+" UTC"+tz; 60 } 61 var nodes = document.getElementsByTagName('abbr'); 62 for (var i=0; i<nodes.length; ++i) { 63 var node = nodes[i]; 64 if (node.className === 'date') { 65 var d = parse_date(node.getAttribute('title')); 66 if (d) { 67 node.textContent = format_date(d); 68 } 69 } 70 } 71 }); 72 </script> 73 <?php 74 } 75 add_action('wp_footer', 'wporg_makehome_time_converter_script'); 76 ?> 29 77 <?php get_footer(); ?> 78
Note: See TracChangeset
for help on using the changeset viewer.