Make WordPress Core

Ticket #41801: 41801.diff

File 41801.diff, 2.0 KB (added by pbiron, 6 years ago)
  • src/wp-includes/media.php

    From ff228a3bf671f5e0975859388a887b013ec56fcd Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Tue, 5 Sep 2017 08:16:44 -0600
    Subject: [PATCH] add wp_get_image_extensions()
    
    ---
     src/wp-includes/media.php | 19 +++++++++++++++++++
     src/wp-includes/post.php  | 17 ++++++++---------
     2 files changed, 27 insertions(+), 9 deletions(-)
    
    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 9ec3f61..c8365f7 100644
    a b function wp_get_video_extensions() { 
    23982398}
    23992399
    24002400/**
     2401 * Returns a filtered list of WP-supported image formats.
     2402 *
     2403 * @since x.y.z
     2404 *
     2405 * @return array List of supported video formats.
     2406 */
     2407function wp_get_image_extensions() {
     2408        /**
     2409         * Filters the list of supported image formats.
     2410         *
     2411         * @since z.y.z
     2412         *
     2413         * @param array $extensions An array of support image formats. Defaults are
     2414         *                          'jpg', 'jpeg', 'jpe', 'gif', 'png'.
     2415         */
     2416        return apply_filters( 'wp_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) );
     2417}
     2418
     2419/**
    24012420 * Builds the Video shortcode output.
    24022421 *
    24032422 * This implements the functionality of the Video Shortcode for displaying
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 904d11d..b1a6f69 100644
    a b function wp_attachment_is( $type, $post = null ) { 
    52175217        }
    52185218
    52195219        switch ( $type ) {
    5220         case 'image':
    5221                 $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
    5222                 return in_array( $ext, $image_exts );
     5220                case 'image':
     5221                        return in_array( $ext, wp_get_image_extensions() );
    52235222
    5224         case 'audio':
    5225                 return in_array( $ext, wp_get_audio_extensions() );
     5223                case 'audio':
     5224                        return in_array( $ext, wp_get_audio_extensions() );
    52265225
    5227         case 'video':
    5228                 return in_array( $ext, wp_get_video_extensions() );
     5226                case 'video':
     5227                        return in_array( $ext, wp_get_video_extensions() );
    52295228
    5230         default:
    5231                 return $type === $ext;
     5229                default:
     5230                        return $type === $ext;
    52325231        }
    52335232}
    52345233