Changeset 24078
- Timestamp:
- 04/25/2013 02:18:49 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r24066 r24078 2429 2429 if ( ! empty( $meta['url'] ) ) 2430 2430 $image = sprint( $link_fmt, $image ); 2431 } elseif ( has_shortcode( $meta['image'], ' gallery' ) ) {2431 } elseif ( has_shortcode( $meta['image'], 'caption' ) ) { 2432 2432 // wrap <img> in <a> 2433 2433 if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], '<a ' ) ) { -
trunk/wp-includes/post-formats.php
r24075 r24078 375 375 case 'image': 376 376 if ( ! empty( $meta['image'] ) ) { 377 $image = is_numeric( $meta['image'] ) ? wp_get_attachment_url( $meta['image'] ) : $meta['image']; 378 379 if ( ! empty( $image ) && ! stristr( $content, $image ) ) { 380 if ( false === strpos( $image, '<a ' ) ) { 381 $image_html = sprintf( 377 378 if ( has_shortcode( $meta['image'], 'caption' ) ) { 379 // wrap <img> in <a> 380 if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], '<a ' ) ) { 381 $meta['image'] = preg_replace( 382 '#(<img[^>]+>)#', 383 sprintf( '<a href="%s">$1</a>', esc_url( $meta['url'] ) ), 384 $meta['image'] 385 ); 386 } 387 $format_output .= do_shortcode( $meta['image'] ); 388 } else { 389 390 if ( is_numeric( $meta['image'] ) ) { 391 $image = wp_get_attachment_image( absint( $meta['image'] ), 'full' ); 392 } elseif ( ! preg_match( '#<[^>]+>#', $meta['image'] ) ) { 393 // not HTML, assume URL 394 $image = sprintf( 382 395 '<img %ssrc="%s" alt="" />', 383 396 empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ), 397 esc_url( $meta['image'] ) 398 ); 399 } else { 400 // assume HTML 401 $image = $meta['image']; 402 } 403 404 if ( ! empty( $meta['url'] ) && false === strpos( $image, '<a ' ) ) { 405 $format_output .= sprintf( 406 '<a href="%s">%s</a>', 407 esc_url( $meta['url'] ), 384 408 $image 385 409 ); 386 410 } else { 387 $image_html = $image; 388 } 389 390 if ( empty( $meta['url'] ) || false !== strpos( $image, '<a ' ) ) { 391 $format_output .= $image_html; 392 } else { 393 $format_output .= sprintf( 394 '<a href="%s">%s</a>', 395 esc_url( $meta['url'] ), 396 $image_html 397 ); 411 $format_output .= $image; 398 412 } 399 413 }
Note: See TracChangeset
for help on using the changeset viewer.