Changeset 35472
- Timestamp:
- 10/31/2015 03:50:23 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
src/wp-includes/embed-functions.php (modified) (2 diffs)
-
src/wp-includes/embed-template.php (modified) (1 diff)
-
tests/phpunit/tests/oembed/getResponseData.php (modified) (2 diffs)
-
tests/phpunit/tests/oembed/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/embed-functions.php
r35471 r35472 447 447 * @since 4.4.0 448 448 * 449 * @param int|WP_Post $post Optional. Post ID or object. Default is global `$post`.450 449 * @param int $width The width for the response. 451 450 * @param int $height The height for the response. 451 * @param int|WP_Post $post Optional. Post ID or object. Default is global `$post`. 452 452 * @return string|false Embed code on success, false if post doesn't exist. 453 453 */ 454 function get_post_embed_html( $ post = null, $width, $height) {454 function get_post_embed_html( $width, $height, $post = null ) { 455 455 $post = get_post( $post ); 456 456 … … 591 591 $data['height'] = absint( $height ); 592 592 $data['type'] = 'rich'; 593 $data['html'] = get_post_embed_html( $ post, $width, $height );593 $data['html'] = get_post_embed_html( $width, $height, $post ); 594 594 595 595 // Add post thumbnail to response if available. -
trunk/src/wp-includes/embed-template.php
r35466 r35472 185 185 </div> 186 186 <div id="wp-embed-share-tab-html" class="wp-embed-share-tab" role="tabpanel" aria-labelledby="wp-embed-share-tab-button-html" aria-hidden="true"> 187 <textarea class="wp-embed-share-input" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( null,600, 400 ) ); ?></textarea>187 <textarea class="wp-embed-share-input" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( 600, 400 ) ); ?></textarea> 188 188 189 189 <p class="wp-embed-share-description"> -
trunk/tests/phpunit/tests/oembed/getResponseData.php
r35242 r35472 26 26 'width' => 400, 27 27 'height' => 225, 28 'html' => get_post_embed_html( $post, 400, 225),28 'html' => get_post_embed_html( 400, 225, $post ), 29 29 ), $data ); 30 30 } … … 55 55 'width' => 400, 56 56 'height' => 225, 57 'html' => get_post_embed_html( $post, 400, 225),57 'html' => get_post_embed_html( 400, 225, $post ), 58 58 ), $data ); 59 59 } -
trunk/tests/phpunit/tests/oembed/template.php
r35436 r35472 237 237 238 238 function test_get_post_embed_html_non_existent_post() { 239 $this->assertFalse( get_post_embed_html( 0, 200, 200 ) );240 $this->assertFalse( get_post_embed_html( null,200, 200 ) );239 $this->assertFalse( get_post_embed_html( 200, 200, 0 ) ); 240 $this->assertFalse( get_post_embed_html( 200, 200 ) ); 241 241 } 242 242 … … 246 246 $expected = '<iframe sandbox="allow-scripts" security="restricted" src="' . esc_url( get_post_embed_url( $post_id ) ) . '" width="200" height="200" title="Embedded WordPress Post" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>'; 247 247 248 $this->assertStringEndsWith( $expected, get_post_embed_html( $post_id, 200, 200) );248 $this->assertStringEndsWith( $expected, get_post_embed_html( 200, 200, $post_id ) ); 249 249 } 250 250
Note: See TracChangeset
for help on using the changeset viewer.