Make WordPress Core


Ignore:
Timestamp:
10/01/2012 08:59:06 PM (12 years ago)
Author:
ryan
Message:

Introduce WP_Image_Editor, WP_Image_Editor_Imagick, and WP_Image_Editor_GD. Abstracts image editing API and adds support for ImageMagick.

Props DH-Shredder, kurtpayne, markoheijnen
see #6821

File:
1 edited

Legend:

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

    r22082 r22094  
    12961296 */
    12971297function wp_mkdir_p( $target ) {
     1298    $wrapper = null;
     1299
     1300    // strip the protocol
     1301    if( wp_is_stream( $target ) ) {
     1302        list( $wrapper, $target ) = explode( '://', $target, 2 );
     1303    }
     1304
    12981305    // from php.net/mkdir user contributed notes
    12991306    $target = str_replace( '//', '/', $target );
     1307
     1308    // put the wrapper back on the target
     1309    if( $wrapper !== null ) {
     1310        $target = $wrapper . '://' . $target;
     1311    }
    13001312
    13011313    // safe mode fails with a trailing slash under certain PHP versions.
     
    37513763
    37523764/**
     3765 * Test if a given path is a stream URL
     3766 *
     3767 * @param string $path The resource path or URL
     3768 * @return bool True if the path is a stream URL
     3769 */
     3770function wp_is_stream( $path ) {
     3771    $wrappers = stream_get_wrappers();
     3772    $wrappers_re = '(' . join('|', $wrappers) . ')';
     3773
     3774    return preg_match( "!^$wrappers_re://!", $path ) === 1;
     3775}
     3776
     3777/**
    37533778 * Test if the supplied date is valid for the Gregorian calendar
    37543779 *
Note: See TracChangeset for help on using the changeset viewer.