Changeset 23729 for trunk/wp-includes/post-formats.php
- Timestamp:
- 03/16/2013 05:25:44 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post-formats.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-formats.php
r23655 r23729 309 309 $format_output = ''; 310 310 $meta = get_post_format_meta( $post->ID ); 311 // passed by ref in preg_match() 312 $matches = array(); 311 313 312 314 switch ( $format ) { … … 366 368 367 369 case 'gallery': 368 preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches ); 369 if ( ! empty( $matches ) && isset( $matches[2] ) ) { 370 foreach ( (array) $matches[2] as $match ) { 371 if ( 'gallery' === $match ) 372 break 2; // foreach + case 373 } 374 } 375 376 if ( ! empty( $meta['gallery'] ) ) { 370 if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta['gallery'] ) ) 377 371 $format_output .= $meta['gallery']; 378 }379 372 break; 380 373 381 374 case 'video': 382 375 case 'audio': 383 $shortcode_regex = '/' . get_shortcode_regex() . '/s'; 384 $matches = preg_match( $shortcode_regex, $content ); 385 if ( ! $matches || $format !== $matches[2] ) { 386 if ( ! empty( $meta['media'] ) ) { 387 // the metadata is a shortcode or an embed code 388 if ( preg_match( $shortcode_regex, $meta['media'] ) || preg_match( '#<[^>]+>#', $meta['media'] ) ) { 389 $format_output .= $meta['media']; 390 } elseif ( ! stristr( $content, $meta['media'] ) ) { 391 // attempt to embed the URL 392 $format_output .= sprintf( '[embed]%s[/embed]', $meta['media'] ); 393 } 376 if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta['media'] ) ) { 377 // the metadata is a shortcode or an embed code 378 if ( preg_match( '/' . get_shortcode_regex() . '/s', $meta['media'] ) || preg_match( '#<[^>]+>#', $meta['media'] ) ) { 379 $format_output .= $meta['media']; 380 } elseif ( ! stristr( $content, $meta['media'] ) ) { 381 // attempt to embed the URL 382 $format_output .= sprintf( '[embed]%s[/embed]', $meta['media'] ); 394 383 } 395 384 }
Note: See TracChangeset
for help on using the changeset viewer.