Changeset 44273 for trunk/src/wp-includes/blocks/latest-comments.php
- Timestamp:
- 12/17/2018 07:05:30 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43935,43949-43951
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/blocks/latest-comments.php
r44262 r44273 3 3 * Server-side rendering of the `core/latest-comments` block. 4 4 * 5 * @package gutenberg5 * @package WordPress 6 6 */ 7 7 8 if ( ! function_exists( ' gutenberg_draft_or_post_title' ) ) {8 if ( ! function_exists( 'wp_latest_comments_draft_or_post_title' ) ) { 9 9 /** 10 10 * Get the post title. … … 27 27 * @return string The post title if set; "(no title)" if no title is set. 28 28 */ 29 function gutenberg_draft_or_post_title( $post = 0 ) {29 function wp_latest_comments_draft_or_post_title( $post = 0 ) { 30 30 $title = get_the_title( $post ); 31 31 if ( empty( $title ) ) { 32 $title = __( '(no title)' , 'default');32 $title = __( '(no title)' ); 33 33 } 34 34 return esc_html( $title ); … … 43 43 * @return string Returns the post content with latest comments added. 44 44 */ 45 function gutenberg_render_block_core_latest_comments( $attributes = array() ) {45 function render_block_core_latest_comments( $attributes = array() ) { 46 46 // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php. 47 47 $comments = get_comments( … … 95 95 // `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in 96 96 // `esc_html`. 97 $post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . gutenberg_draft_or_post_title( $comment->comment_post_ID ) . '</a>';97 $post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . '</a>'; 98 98 99 99 $list_items_markup .= sprintf( 100 100 /* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */ 101 __( '%1$s on %2$s' , 'default'),101 __( '%1$s on %2$s' ), 102 102 $author_markup, 103 103 $post_title … … 144 144 '<div class="%1$s">%2$s</div>', 145 145 $classnames, 146 __( 'No comments to show.' , 'default')146 __( 'No comments to show.' ) 147 147 ); 148 148 … … 180 180 ), 181 181 ), 182 'render_callback' => ' gutenberg_render_block_core_latest_comments',182 'render_callback' => 'render_block_core_latest_comments', 183 183 ) 184 184 );
Note: See TracChangeset
for help on using the changeset viewer.