Make WordPress Core

Changeset 28194


Ignore:
Timestamp:
04/24/2014 11:54:31 AM (9 years ago)
Author:
johnbillion
Message:

Remove some unnecessary abstraction introduced in [28191]. See #27985.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r28191 r28194  
    26572657        return;
    26582658
    2659     global $content_width;
     2659    global $content_width, $wpdb;
    26602660
    26612661    $defaults = array(
     
    26952695        }
    26962696    }
     2697
     2698    $has_audio = $wpdb->get_var( "
     2699        SELECT ID
     2700        FROM $wpdb->posts
     2701        WHERE post_type = 'attachment'
     2702        AND post_mime_type LIKE 'audio%'
     2703        LIMIT 1
     2704    " );
     2705    $has_video = $wpdb->get_var( "
     2706        SELECT ID
     2707        FROM $wpdb->posts
     2708        WHERE post_type = 'attachment'
     2709        AND post_mime_type LIKE 'video%'
     2710        LIMIT 1
     2711    " );
    26972712
    26982713    $settings = array(
     
    27102725        'defaultProps' => $props,
    27112726        'attachmentCounts' => array(
    2712             'audio' => wp_has_mime_type_attachments( 'audio' ) ? 1 : 0,
    2713             'video' => wp_has_mime_type_attachments( 'video' ) ? 1 : 0
     2727            'audio' => ( $has_audio ) ? 1 : 0,
     2728            'video' => ( $has_video ) ? 1 : 0
    27142729        ),
    27152730        'embedExts'    => $exts,
  • trunk/src/wp-includes/post.php

    r28191 r28194  
    22932293
    22942294/**
    2295  * Determine if at least one attachment of a particular mime-type has been uploaded
    2296  *
    2297  * @global wpdb $wpdb
    2298  *
    2299  * @since 3.9.1
    2300  *
    2301  * @param string $mime_type The mime-type string to check.
    2302  *
    2303  * @return int|null If exist, the post ID of the first found attachment.
    2304  */
    2305 function wp_has_mime_type_attachments( $mime_type ) {
    2306     global $wpdb;
    2307     $sql = sprintf( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE '%s%%' LIMIT 1", like_escape( $mime_type ) );
    2308     return $wpdb->get_var( $sql );
    2309 }
    2310 
    2311 /**
    23122295 * Get default post mime types
    23132296 *
Note: See TracChangeset for help on using the changeset viewer.