Ticket #24199: 24199.patch
| File 24199.patch, 3.4 KB (added by , 13 years ago) |
|---|
-
wp-includes/media.php
1850 1850 * @return array Found attachments 1851 1851 */ 1852 1852 function get_attached_media( $type, $post_id = 0 ) { 1853 $post = empty( $post_id ) ? get_post() : get_post( $post_id ); 1854 if ( empty( $post ) ) 1853 if ( ! $post = get_post( $post_id ) ) 1855 1854 return; 1856 1855 1857 1856 $args = array( … … 2347 2346 * from the expanded shortcode 2348 2347 */ 2349 2348 function get_post_galleries( $post_id = 0, $html = true ) { 2350 $post = empty( $post_id ) ? clone get_post() : get_post( $post_id ); 2351 if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) 2349 if ( ! $post = get_post( $post_id ) ) 2352 2350 return array(); 2353 2351 2352 if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 2353 return array(); 2354 2354 2355 return get_content_galleries( $post->post_content, $html ); 2355 2356 } 2356 2357 … … 2364 2365 * from an expanded shortcode 2365 2366 */ 2366 2367 function get_post_galleries_images( $post_id = 0 ) { 2367 $post = empty( $post_id ) ? clone get_post() : get_post( $post_id ); 2368 if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) 2368 if ( ! $post = get_post( $post_id ) ) 2369 2369 return array(); 2370 2370 2371 if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 2372 return array(); 2373 2371 2374 $data = get_content_galleries( $post->post_content, false ); 2372 2375 return wp_list_pluck( $data, 'src' ); 2373 2376 } … … 2382 2385 * @return array Gallery data and srcs parsed from the expanded shortcode 2383 2386 */ 2384 2387 function get_post_gallery( $post_id = 0, $html = true ) { 2385 $post = empty( $post_id ) ? clone get_post() : get_post( $post_id ); 2386 if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) 2388 if ( ! $post = get_post( $post_id ) ) 2387 2389 return array(); 2388 2390 2391 if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 2392 return array(); 2393 2389 2394 $data = get_content_galleries( $post->post_content, $html, false, 1 ); 2390 2395 return reset( $data ); 2391 2396 } -
wp-includes/post-formats.php
319 319 * @param int $id (optional) The post ID. 320 320 * @return string Formatted output based on associated post format. 321 321 */ 322 function post_formats_compat( $content, $id = 0 ) { 323 $post = empty( $id ) ? get_post() : get_post( $id ); 324 if ( empty( $post ) ) 322 function post_formats_compat( $content, $post_id = 0 ) { 323 if ( ! $post = get_post( $post_id ) ) 325 324 return $content; 326 325 327 326 $format = get_post_format( $post ); … … 643 642 * @param int $id (optional) The post ID. 644 643 * @return array The chat content. 645 644 */ 646 function get_the_post_format_chat( $id = 0 ) { 647 $post = empty( $id ) ? clone get_post() : get_post( $id ); 648 if ( empty( $post ) ) 645 function get_the_post_format_chat( $post_id = 0 ) { 646 if ( ! $post = get_post( $post_id ) ) 649 647 return array(); 650 648 651 649 $data = get_content_chat( get_paged_content( $post->post_content ) ); … … 819 817 * @param int $id (optional) The post ID. 820 818 * @return string A URL, if found. 821 819 */ 822 function get_the_post_format_url( $id = 0 ) { 823 $post = empty( $id ) ? get_post() : get_post( $id ); 824 if ( empty( $post ) ) 820 function get_the_post_format_url( $post_id = 0 ) { 821 if ( ! $post = get_post( $post_id ) ) 825 822 return ''; 826 823 827 824 $format = get_post_format( $post->ID );