WordPress.org

Make WordPress Core

Changeset 24569


Ignore:
Timestamp:
07/05/2013 06:45:41 PM (8 years ago)
Author:
ocean90
Message:

Remove img_html_to_post_id(). It's unused since [24555]. fixes #24610.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r24555 r24569  
    22672267    return $gallery['src'];
    22682268}
    2269 
    2270 /**
    2271  * Retrieve the attachment post id from HTML containing an image.
    2272  *
    2273  * @since 3.6.0
    2274  *
    2275  * @param string $html The html, possibly with an image
    2276  * @param string $matched_html Passed by reference, will be set to to the matched img string
    2277  * @return int The attachment id if found, or 0.
    2278  */
    2279 function img_html_to_post_id( $html, &$matched_html = null ) {
    2280     $attachment_id = 0;
    2281 
    2282     // Look for an <img /> tag
    2283     if ( ! preg_match( '#' . get_tag_regex( 'img' ) .  '#i', $html, $matches ) || empty( $matches ) )
    2284         return $attachment_id;
    2285 
    2286     $matched_html = $matches[0];
    2287 
    2288     // Look for the class attribute.
    2289     if ( ! preg_match( '#class=([\'"])(.+?)\1#is', $matched_html, $matches ) || empty( $matches ) )
    2290         return $attachment_id;
    2291 
    2292     $classes = $matches[2];
    2293     if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) )
    2294         if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) )
    2295             $attachment_id = absint( $matches[1] );
    2296 
    2297     return $attachment_id;
    2298 }
Note: See TracChangeset for help on using the changeset viewer.