Ticket #23625: 23625.11.diff
File 23625.11.diff, 4.5 KB (added by , 12 years ago) |
---|
-
wp-includes/post-formats.php
392 392 } 393 393 394 394 /** 395 * Add chat detection support to the `get_content_chat()` chat parser 395 * Add chat detection support to the `get_content_chat()` chat parser. 396 396 * 397 397 * @since 3.6.0 398 398 * … … 459 459 if ( empty( $trimmed ) ) 460 460 return array(); 461 461 462 $has_match = false;463 462 $matched_parser = false; 464 463 foreach ( $_wp_chat_parsers as $parser ) { 465 @list( $newline_regex ) = $parser;464 @list( $newline_regex, $delimiter_regex ) = $parser; 466 465 if ( preg_match( $newline_regex, $trimmed ) ) { 467 $has_match = true;468 466 $matched_parser = $parser; 469 467 break; 470 468 } … … 473 471 if ( false === $matched_parser ) 474 472 return array(); 475 473 476 @list( $newline_regex, $delimiter_regex ) = $parser;477 478 474 $last_index = 0; 479 $stanzas = array(); 475 $stanzas = $data = $stanza = array(); 476 $author = $time = ''; 480 477 $lines = explode( "\n", make_clickable( $trimmed ) ); 481 478 482 $author = $time = '';483 $data = array();484 $stanza = array();485 479 486 480 foreach ( $lines as $index => $line ) { 487 481 $line = trim( $line ); … … 489 483 if ( empty( $line ) ) { 490 484 if ( ! empty( $author ) ) { 491 485 $stanza[] = array( 492 'time' => $time,493 'author' => $author,486 'time' => $time, 487 'author' => $author, 494 488 'message' => join( ' ', $data ) 495 489 ); 496 490 } 497 491 498 492 $stanzas[] = $stanza; 499 493 $last_index = $index; 500 $stanza = array();494 $stanza = $data = array(); 501 495 $author = $time = ''; 502 $data = array();503 496 if ( ! empty( $lines[$index + 1] ) && ! preg_match( $delimiter_regex, $lines[$index + 1] ) ) 504 497 break; 505 498 } … … 514 507 if ( $matched && ( ! empty( $matches[2] ) || ( $no_ws || $has_ws ) ) ) { 515 508 if ( ! empty( $author ) ) { 516 509 $stanza[] = array( 517 'time' => $time,518 'author' => $author,510 'time' => $time, 511 'author' => $author, 519 512 'message' => join( ' ', $data ) 520 513 ); 521 514 $data = array(); … … 531 524 532 525 if ( ! empty( $author ) ) { 533 526 $stanza[] = array( 534 'time' => $time,535 'author' => $author,527 'time' => $time, 528 'author' => $author, 536 529 'message' => trim( join( ' ', $data ) ) 537 530 ); 538 531 } … … 577 570 * @print HTML 578 571 */ 579 572 function the_chat() { 580 $output = '<dl class="chat-transcript">'; 581 573 $output = '<dl class="chat">'; 582 574 $stanzas = get_the_chat(); 583 575 584 576 foreach ( $stanzas as $stanza ) { 585 577 foreach ( $stanza as $row ) { 586 578 $time = ''; 587 579 if ( ! empty( $row['time'] ) ) 588 $time = sprintf( '<time >%s</time>', esc_html( $row['time'] ) );580 $time = sprintf( '<time class="chat-timestamp">%s</time>', esc_html( $row['time'] ) ); 589 581 590 582 $output .= sprintf( 591 583 '<dt class="chat-author chat-author-%1$s vcard">%2$s <cite class="fn">%3$s</cite>: </dt> 592 584 <dd class="chat-text">%4$s</dd> 593 585 ', 594 esc_attr( s trtolower( $row['author'] ) ), // Slug.586 esc_attr( sanitize_title_with_dashes( $row['author'] ) ), // Slug. 595 587 $time, 596 588 esc_html( $row['author'] ), 597 esc_html( $row['message'] )589 $row['message'] 598 590 ); 599 591 } 600 592 } 601 593 602 $output .= '</dl><!-- .chat -transcript-->';594 $output .= '</dl><!-- .chat -->'; 603 595 604 596 echo $output; 605 597 } -
wp-includes/query.php
3626 3626 * 3627 3627 * @since 3.6.0 3628 3628 * 3629 * @param string $content Content to split 3630 * @return array Paged content 3629 * @param string $content Content to split. 3630 * @return array Paged content. 3631 3631 */ 3632 3632 function paginate_content( $content ) { 3633 3633 $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); 3634 $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );3635 $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );3636 return explode( '<!--nextpage-->', $content );3634 $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); 3635 $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); 3636 return explode( '<!--nextpage-->', $content ); 3637 3637 } 3638 3638 3639 3639 /** … … 3642 3642 * @since 3.6.0 3643 3643 * 3644 3644 * @param string $content 3645 * @param int $paged 3645 3646 * @return string 3646 3647 */ 3647 function get_paged_content( $content = null, $paged = null) {3648 function get_paged_content( $content = '', $paged = 0 ) { 3648 3649 global $page; 3649 3650 if ( empty( $page ) ) 3650 3651 $page = 1; … … 3655 3656 if ( empty( $content ) ) { 3656 3657 $post = get_post(); 3657 3658 if ( empty( $post ) ) 3658 return ;3659 return ''; 3659 3660 3660 3661 $content = $post->post_content; 3661 3662 }