Changeset 23876 for trunk/wp-includes/post-formats.php
- Timestamp:
- 03/29/2013 09:06:37 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post-formats.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-formats.php
r23847 r23876 418 418 419 419 /** 420 * Add chat detection support to the `get_content_chat()` chat parser 420 * Add chat detection support to the `get_content_chat()` chat parser. 421 421 * 422 422 * @since 3.6.0 … … 485 485 return array(); 486 486 487 $has_match = false;488 487 $matched_parser = false; 489 488 foreach ( $_wp_chat_parsers as $parser ) { 490 @list( $newline_regex ) = $parser;489 @list( $newline_regex, $delimiter_regex ) = $parser; 491 490 if ( preg_match( $newline_regex, $trimmed ) ) { 492 $has_match = true;493 491 $matched_parser = $parser; 494 492 break; … … 499 497 return array(); 500 498 501 @list( $newline_regex, $delimiter_regex ) = $parser;502 503 499 $last_index = 0; 504 $stanzas = array(); 500 $stanzas = $data = $stanza = array(); 501 $author = $time = ''; 505 502 $lines = explode( "\n", make_clickable( $trimmed ) ); 506 503 507 $author = $time = '';508 $data = array();509 $stanza = array();510 504 511 505 foreach ( $lines as $index => $line ) { … … 515 509 if ( ! empty( $author ) ) { 516 510 $stanza[] = array( 517 'time' => $time,518 'author' => $author,511 'time' => $time, 512 'author' => $author, 519 513 'message' => join( ' ', $data ) 520 514 ); … … 523 517 $stanzas[] = $stanza; 524 518 $last_index = $index; 525 $stanza = array();519 $stanza = $data = array(); 526 520 $author = $time = ''; 527 $data = array();528 521 if ( ! empty( $lines[$index + 1] ) && ! preg_match( $delimiter_regex, $lines[$index + 1] ) ) 529 522 break; … … 540 533 if ( ! empty( $author ) ) { 541 534 $stanza[] = array( 542 'time' => $time,543 'author' => $author,535 'time' => $time, 536 'author' => $author, 544 537 'message' => join( ' ', $data ) 545 538 ); … … 557 550 if ( ! empty( $author ) ) { 558 551 $stanza[] = array( 559 'time' => $time,560 'author' => $author,552 'time' => $time, 553 'author' => $author, 561 554 'message' => trim( join( ' ', $data ) ) 562 555 ); … … 603 596 */ 604 597 function the_chat() { 605 $output = '<dl class="chat-transcript">'; 606 598 $output = '<dl class="chat">'; 607 599 $stanzas = get_the_chat(); 608 600 … … 611 603 $time = ''; 612 604 if ( ! empty( $row['time'] ) ) 613 $time = sprintf( '<time >%s</time>', esc_html( $row['time'] ) );605 $time = sprintf( '<time class="chat-timestamp">%s</time>', esc_html( $row['time'] ) ); 614 606 615 607 $output .= sprintf( … … 617 609 <dd class="chat-text">%4$s</dd> 618 610 ', 619 esc_attr( s trtolower( $row['author'] ) ), // Slug.611 esc_attr( sanitize_title_with_dashes( $row['author'] ) ), // Slug. 620 612 $time, 621 613 esc_html( $row['author'] ), 622 esc_html( $row['message'] )614 $row['message'] 623 615 ); 624 616 } 625 617 } 626 618 627 $output .= '</dl><!-- .chat -transcript-->';619 $output .= '</dl><!-- .chat -->'; 628 620 629 621 echo $output;
Note: See TracChangeset
for help on using the changeset viewer.