Ticket #3078: 3078.3.diff
File 3078.3.diff, 14.9 KB (added by , 5 years ago) |
---|
-
wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php
diff --git wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php index f6cb97bf0..534eecdd6 100644
class Meeting_Post_Type { 30 30 add_action( 'admin_head', array( $mpt, 'meeting_column_width' ) ); 31 31 add_action( 'admin_bar_menu', array( $mpt, 'add_edit_meetings_item_to_admin_bar' ), 80 ); 32 32 add_action( 'wp_enqueue_scripts', array( $mpt, 'add_edit_meetings_icon_to_admin_bar' ) ); 33 add_shortcode( 'meeting_time', array( $mpt, 'meeting_time_shortcode' ) ); 33 34 } 34 35 35 36 public function meeting_column_width() { ?> … … class Meeting_Post_Type { 64 65 $query->set( 'nopaging', true ); 65 66 66 67 // meta query to eliminate expired meetings from query 67 $query->set( 'meta_query', array( 68 'relation'=>'OR', 69 // not recurring AND start_date >= CURDATE() = one-time meeting today or still in future 70 array( 71 'relation'=>'AND', 72 array( 73 'key'=>'recurring', 74 'value'=>array( 'weekly', 'biweekly', 'occurrence', 'monthly', '1' ), 75 'compare'=>'NOT IN', 76 ), 77 array( 78 'key'=>'start_date', 79 'type'=>'DATE', 80 'compare'=>'>=', 81 'value'=>'CURDATE()', 82 ) 83 ), 84 // recurring = 1 AND ( end_date = '' OR end_date > CURDATE() ) = recurring meeting that has no end or has not ended yet 85 array( 86 'relation'=>'AND', 87 array( 88 'key'=>'recurring', 89 'value'=>array( 'weekly', 'biweekly', 'occurrence', 'monthly', '1' ), 90 'compare'=>'IN', 91 ), 92 array( 93 'relation'=>'OR', 94 array( 95 'key'=>'end_date', 96 'value'=>'', 97 'compare'=>'=', 98 ), 99 array( 100 'key'=>'end_date', 101 'type'=>'DATE', 102 'compare'=>'>', 103 'value'=>'CURDATE()', 104 ) 105 ) 106 ), 107 ) 108 ); 68 $query->set( 'meta_query', $this->meeting_meta_query ); 109 69 110 70 // WP doesn't understand CURDATE() and prepares it as a quoted string. Repair this: 111 71 add_filter( 'get_meta_sql', function ($sql) { … … class Meeting_Post_Type { 462 422 ' ); 463 423 } 464 424 425 /** 426 * Renders meeting information with the next meeting time based on user's local timezone. Used in Make homepage. 427 */ 428 public function meeting_time_shortcode( $attr, $content = '' ) { 429 430 if ( empty( $attr['team'] ) ) { 431 return ''; 432 } 433 434 if ( $attr['team'] === 'Documentation' ) { 435 $attr['team'] = 'Docs'; 436 } 437 438 // turn off paging on the archive page, to show all meetings in the table 439 $query->set( 'nopaging', true ); 440 441 // meta query to eliminate expired meetings from query 442 add_filter( 'get_meta_sql', function ($sql) { 443 return str_replace( "'CURDATE()'", 'CURDATE()', $sql ); 444 } ); 445 446 $query = new WP_Query( 447 array( 448 'post_type' => 'meeting', 449 'meta_query' => array( 450 'relation' => 'AND', 451 array( 452 'key' => 'team', 453 'value' => $attr['team'], 454 'compare' => 'EQUALS', 455 ), 456 $this->meeting_meta_query 457 ) 458 ) 459 ); 460 461 if ( count( $query->posts ) > 0 ) { 462 463 $post = $query->posts[0]; 464 $next_meeting_datestring = $post->next_date; 465 $next_meeting_iso = $next_meeting_datestring . 'T' . $post->time . ':00+00:00'; 466 $next_meeeting_timestamp = strtotime( $next_meeting_datestring . $post->time ); 467 468 $out = '<p>'; 469 $out .= 'Next meeting: ' . __( $post->post_title ); 470 $display_count = count( $query->posts ) - 1; 471 $out .= $display_count === 0 ? '' : ' <a title="Click to view all meetings for this team" href="/meetings#' . esc_attr( $attr['team'] ) . '">' . sprintf( __( '(+%s more)'), $display_count ) . '</a>'; 472 $out .= '</br>'; 473 $out .= '<time class="date" date-time="' . esc_attr( $next_meeting_iso ) . '">' . $next_meeting_iso . '</time> '; 474 $out .= sprintf( __( '(%s from now)' ), human_time_diff( $next_meeeting_timestamp, current_time('timestamp') ) ); 475 $out .= empty( $post->location ) ? '' : ' ' . sprintf( __('at %s on Slack'), $post->location ); 476 $out .= '</p>'; 477 } 478 479 480 return $out; 481 } 482 483 private $meeting_meta_query = array( 484 'relation'=>'OR', 485 // not recurring AND start_date >= CURDATE() = one-time meeting today or still in future 486 array( 487 'relation'=>'AND', 488 array( 489 'key'=>'recurring', 490 'value'=>array( 'weekly', 'biweekly', 'occurrence', 'monthly', '1' ), 491 'compare'=>'NOT IN', 492 ), 493 array( 494 'key'=>'start_date', 495 'type'=>'DATE', 496 'compare'=>'>=', 497 'value'=>'CURDATE()', 498 ) 499 ), 500 // recurring = 1 AND ( end_date = '' OR end_date > CURDATE() ) = recurring meeting that has no end or has not ended yet 501 array( 502 'relation'=>'AND', 503 array( 504 'key'=>'recurring', 505 'value'=>array( 'weekly', 'biweekly', 'occurrence', 'monthly', '1' ), 506 'compare'=>'IN', 507 ), 508 array( 509 'relation'=>'OR', 510 array( 511 'key'=>'end_date', 512 'value'=>'', 513 'compare'=>'=', 514 ), 515 array( 516 'key'=>'end_date', 517 'type'=>'DATE', 518 'compare'=>'>', 519 'value'=>'CURDATE()', 520 ) 521 ) 522 ), 523 ); 465 524 } 466 525 467 526 // fire it up -
wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/archive-meeting.php
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/archive-meeting.php wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/archive-meeting.php index 3f0e4da4b..6c7765dfe 100644
1 1 <?php get_header(); ?> 2 2 3 3 <div class="wrapper"> 4 <h2 class="title"><?php _e( 'Upcoming WordPress Meetings', 'make-wporg' ); ?></h2> 4 <div class="header-section"> 5 <h2 class="title all"><?php _e( 'Upcoming WordPress Meetings', 'make-wporg' ); ?></h2> 6 <h2 class="title team"><?php _e( 'Upcoming Team Meetings', 'make-wporg' ); ?></h2> 7 <a class="team" href="/meetings"><?php _e( 'Show meetings for other teams', 'make-wporg' ); ?></a> 8 </div> 5 9 <table class="schedule"> 6 10 <thead> 7 11 <tr> … … function wporg_makehome_time_converter_script() { 111 115 } 112 116 } 113 117 } 118 119 // Allow client side filtering using # in url 120 var hash = window.location.hash.replace('#',''); 121 if (hash) { 122 var rowsToRemove = $('.schedule').find('tr td:nth-child(1)').filter(function() { 123 var reg = new RegExp(hash, "i"); 124 return !reg.test($(this).text()); 125 }); 126 127 for (var i = 0; i < rowsToRemove.length; i++) { 128 $(rowsToRemove[i]).parent().remove(); 129 } 130 131 $('.header-section').find('.team').show(); 132 } 133 else { 134 $('.header-section').find('.all').show(); 135 } 136 137 // avoid page flickers on load 138 $('.schedule').show(); 114 139 }); 115 140 </script> 116 141 <?php -
wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/front-page.php
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/front-page.php wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/front-page.php index 72e45c759..da101f56b 100644
8 8 <div class="wrapper"> 9 9 <h2 class="section-title"><?php _e( 'There are many different ways for you to get involved with WordPress:', 'make-wporg' ); ?></h2> 10 10 <div class="js-masonry" data-masonry-options='{ "itemSelector": ".make_site" }'> 11 <?php 11 <?php 12 12 $sites_query = new WP_Query( 'post_type=make_site&posts_per_page=-1&order=ASC' ); 13 13 $makesites = make_site_get_network_sites(); 14 14 ?> 15 <?php while ( $sites_query->have_posts() ) : $sites_query->the_post(); ?>16 <?php17 $make_site_id = get_post_meta( $post->ID, 'make_site_id', true );18 $url = $makesites[$make_site_id];19 ?> 15 <?php while ( $sites_query->have_posts() ) : $sites_query->the_post(); ?> 16 <?php 17 $make_site_id = get_post_meta( $post->ID, 'make_site_id', true ); 18 $url = $makesites[ $make_site_id ]; 19 ?> 20 20 <article id="site-<?php the_ID(); ?>" <?php post_class(); ?>> 21 21 <h2> 22 22 <?php if ( $url ) : ?> 23 <a href="<?php echo esc_url( $url ); ?>"><?php the_title(); ?></a> 23 <a 24 title="<?php printf( esc_attr( 'Learn more about %s.', 'make-wporg' ), esc_html( get_the_title() ) ); ?>" 25 href="<?php echo esc_url( $url ); ?>" 26 ><?php the_title(); ?></a> 24 27 <?php else : ?> 25 28 <?php the_title(); ?> 26 29 <?php endif; ?> 27 30 </h2> 28 31 29 32 <div class="team-description"> 30 33 <?php the_content(); ?> 31 <?php if ( $url ) : ?>32 <p><a href="<?php echo esc_url( $url ); ?>"><?php printf( __( 'Learn more about %s »', 'make-wporg' ), get_the_title() ); ?></a></p>33 <?php endif; ?>34 34 </div> 35 36 <?php if ( '1' == get_post_meta( get_the_ID(), 'weekly_meeting', true ) ) : ?> 37 <small> 38 <p><?php printf( __( 'Weekly chats: %s', 'make-wporg' ), get_post_meta( get_the_ID(), 'weekly_meeting_when', true ) ); ?></p> 39 <p><?php echo get_post_meta( get_the_ID(), 'weekly_meeting_where', true ); ?></p> 40 </small> 41 <?php endif; /**/ ?> 35 36 <div class="team-meeting"> 37 <?php 38 echo do_shortcode( sprintf( '[meeting_time team="%s"][/meeting_time]', $post->post_title ) ); 39 ?> 40 </div> 42 41 </article> 43 42 <?php endwhile; ?> 44 43 </div> 45 44 </div> 46 45 </section> 47 46 47 <script type="text/javascript"> 48 49 var parse_date = function (text) { 50 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); 51 var d = new Date(); 52 d.setUTCFullYear(+m[1]); 53 d.setUTCDate(+m[3]); 54 d.setUTCMonth(+m[2]-1); 55 d.setUTCHours(+m[4]); 56 d.setUTCMinutes(+m[5]); 57 d.setUTCSeconds(+m[6]); 58 return d; 59 } 60 var format_time = function (d) { 61 return d.toLocaleTimeString(navigator.language, {weekday: 'long'}); 62 } 63 64 var nodes = document.getElementsByTagName('time'); 65 for (var i=0; i<nodes.length; ++i) { 66 var node = nodes[i]; 67 if (node.className === 'date') { 68 var d = parse_date(node.getAttribute('date-time')); 69 if (d) { 70 node.textContent = format_time(d); 71 } 72 } 73 } 74 </script> 48 75 <?php get_footer(); ?> -
wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/style.css
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/style.css wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/style.css index ba4628452..98dbdd4a3 100644
section.get-involved article:nth-of-type(odd) { 203 203 clear: left; 204 204 } 205 205 206 section.get-involved article h2 :before {206 section.get-involved article h2 a:before { 207 207 font-family: 'dashicons'; 208 208 content: '\f109'; 209 209 margin-right: 0.4em; … … section.get-involved article h2:before { 214 214 -moz-osx-font-smoothing: grayscale; 215 215 } 216 216 217 section.get-involved article.make-core h2 :before { content: "\f475"; }218 section.get-involved article.make- design h2:before { content: "\f309"; }219 section.get-involved article.make- mobile h2:before { content: "\f470"; }220 section.get-involved article.make-accessibility h2 :before { content: "\f483"; }221 section.get-involved article.make-polyglots h2 :before { content: '\f326'; }222 section.get-involved article.make-support h2 :before { content: "\f125"; }223 section.get-involved article.make-themes h2 :before { content: '\f100'; }224 section.get-involved article.make-plugins h2 :before { content: '\f106'; }225 section.get-involved article.make-docs h2 :before { content: '\f105'; }226 section.get-involved article.make-community h2 :before { content: '\f307'; }227 section.get-involved article.make-meta h2 :before { content: '\f325'; }228 section.get-involved article.make-training h2 :before { content: '\f118'; }229 section.get-involved article.make-flow h2 :before { content: '\f115'; }230 section.get-involved article.make-tv h2 :before { content: '\f235'; }231 section.get-involved article.make-marketing h2 :before { content: '\f130'; }232 section.get-involved article.make-cli h2 :before { content: '\f345'; }233 section.get-involved article.make-hosting h2 :before { content: '\f176'; }234 section.get-involved article.make-tide h2 :before { content: '\f10d'; }217 section.get-involved article.make-core h2 a:before { content: "\f475"; } 218 section.get-involved article.make-mobile h2 a:before { content: "\f470"; } 219 section.get-involved article.make-design h2 a:before { content: "\f309"; } 220 section.get-involved article.make-accessibility h2 a:before { content: "\f483"; } 221 section.get-involved article.make-polyglots h2 a:before { content: '\f326'; } 222 section.get-involved article.make-support h2 a:before { content: "\f125"; } 223 section.get-involved article.make-themes h2 a:before { content: '\f100'; } 224 section.get-involved article.make-plugins h2 a:before { content: '\f106'; } 225 section.get-involved article.make-docs h2 a:before { content: '\f105'; } 226 section.get-involved article.make-community h2 a:before { content: '\f307'; } 227 section.get-involved article.make-meta h2 a:before { content: '\f325'; } 228 section.get-involved article.make-training h2 a:before { content: '\f118'; } 229 section.get-involved article.make-flow h2 a:before { content: '\f115'; } 230 section.get-involved article.make-tv h2 a:before { content: '\f235'; } 231 section.get-involved article.make-marketing h2 a:before { content: '\f130'; } 232 section.get-involved article.make-cli h2 a:before { content: '\f345'; } 233 section.get-involved article.make-hosting h2 a:before { content: '\f176'; } 234 section.get-involved article.make-tide h2 a:before { content: '\f10d'; } 235 235 236 236 section.get-involved article.featured-group h2:after { 237 237 display: block; … … section.get-involved article.featured-group h2:after { 243 243 244 244 section.get-involved article h2 a { 245 245 font-weight: 600; 246 color: #444444; 246 } 247 248 section.get-involved article h2 a { 249 font-weight: 600; 247 250 } 248 251 249 252 section.get-involved article div.team-description p { … … section.get-involved article div.team-description p { 252 255 line-height: 1.5; 253 256 } 254 257 255 section.get-involved article small{258 div.team-meeting { 256 259 display: block; 257 260 font-size: 0.8em; 258 261 font-style: italic; 259 opacity: 0. 5;262 opacity: 0.75; 260 263 padding-top: 0.5em; 261 264 } 262 265 263 section.get-involved article small p{266 section.get-involved article .team-meeting { 264 267 line-height: 1.5; 265 268 } 266 269 … … section.get-involved article small p { 304 307 body.post-type-archive-meeting { 305 308 background-color: white; 306 309 } 307 h2.title { 310 311 .header-section{ 308 312 margin: 30px 10px; 313 font-size: 14px; 314 } 315 .header-section h2.title { 309 316 font-size: 36px; 310 317 font-weight: 300; 311 318 line-height: 1.3; 312 319 } 320 321 .header-section * { 322 display: none; 323 } 324 313 325 table.schedule { 326 /* table is set to show after JS is completed to avoid fickering */ 327 display: none; 314 328 width: 100%; 315 329 margin: 30px 10px; 316 330 font-size: 1.4em;