Make WordPress Core

Ticket #34853: add-get-img-method.patch

File add-get-img-method.patch, 2.8 KB (added by dan.rossiter, 10 years ago)

Proposed patch for creating wp_get_image_extensions()

  • wp-includes/class-wp-theme.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    945945                        return false;
    946946                }
    947947
    948                 foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) {
     948                foreach ( wp_get_image_extensions() as $ext ) {
    949949                        if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
    950950                                $this->cache_add( 'screenshot', 'screenshot.' . $ext );
    951951                                if ( 'relative' == $uri )
  • wp-includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    50075007
    50085008        switch ( $type ) {
    50095009        case 'image':
    5010                 $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
    5011                 return in_array( $ext, $image_exts );
     5010                return in_array( $ext, wp_get_image_extensions() );
    50125011
    50135012        case 'audio':
    50145013                return in_array( $ext, wp_get_audio_extensions() );
  • wp-includes/media.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    66 * @subpackage Media
    77 */
    88
     9
     10/**
     11 * Returns a filtered list of WP-supported image formats.
     12 *
     13 * @since 4.5.0
     14 *
     15 * @return array Supported image formats.
     16 */
     17function wp_get_image_extensions() {
     18        /**
     19         * Filter the list of supported image formats.
     20         *
     21         * @since 4.5.0
     22         *
     23         * @param array $extensions An array of support audio formats. Defaults are
     24         *                          'jpg', 'jpeg', 'jpe', 'gif', 'png'.
     25         */
     26        return apply_filters( 'wp_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) );
     27}
     28
    929/**
    1030 * Scale down the default size of an image.
    1131 *
  • wp-includes/formatting.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    23752375
    23762376        $matches = array();
    23772377        $ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
    2378         $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
    23792378
    23802379        // Don't convert smilies that aren't images - they're probably emoji.
    2381         if ( ! in_array( $ext, $image_exts ) ) {
     2380        if ( ! in_array( $ext, wp_get_image_extensions() ) ) {
    23822381                return $img;
    23832382        }
    23842383
     2384 No newline at end of file