Changeset 40809
- Timestamp:
- 05/20/2017 02:23:00 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r40650 r40809 3099 3099 3100 3100 $author = new WP_User( $attachment->post_author ); 3101 $response['authorName'] = $author->display_name; 3101 if ( $author->exists() ) { 3102 $response['authorName'] = html_entity_decode( $author->display_name, ENT_QUOTES, get_bloginfo( 'charset' ) ); 3103 } else { 3104 $response['authorName'] = __( '(no author)' ); 3105 } 3102 3106 3103 3107 if ( $attachment->post_parent ) { -
trunk/tests/phpunit/tests/media.php
r40070 r40809 268 268 $this->assertEquals( 'image', $prepped['type'] ); 269 269 $this->assertEquals( '', $prepped['subtype'] ); 270 271 // Test that if author is not found, we return "(no author)" as `display_name`. 272 // The previously used test post contains no author, so we can reuse it. 273 $this->assertEquals( '(no author)', $prepped['authorName'] ); 274 275 // Test that if author has HTML entities in display_name, they're decoded correctly. 276 $html_entity_author = self::factory()->user->create( array( 277 'display_name' => 'You & Me', 278 ) ); 279 $post->post_author = $html_entity_author; 280 $prepped = wp_prepare_attachment_for_js( $post ); 281 $this->assertEquals( 'You & Me', $prepped['authorName'] ); 270 282 } 271 283
Note: See TracChangeset
for help on using the changeset viewer.