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 git-svn-id: http://core.svn.wordpress.org/trunk@22094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1295,9 +1295,21 @@ function wp_get_original_referer() {
|
||||
* @return bool Whether the path was created. True if path already exists.
|
||||
*/
|
||||
function wp_mkdir_p( $target ) {
|
||||
$wrapper = null;
|
||||
|
||||
// strip the protocol
|
||||
if( wp_is_stream( $target ) ) {
|
||||
list( $wrapper, $target ) = explode( '://', $target, 2 );
|
||||
}
|
||||
|
||||
// from php.net/mkdir user contributed notes
|
||||
$target = str_replace( '//', '/', $target );
|
||||
|
||||
// put the wrapper back on the target
|
||||
if( $wrapper !== null ) {
|
||||
$target = $wrapper . '://' . $target;
|
||||
}
|
||||
|
||||
// safe mode fails with a trailing slash under certain PHP versions.
|
||||
$target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
|
||||
if ( empty($target) )
|
||||
@@ -3749,6 +3761,19 @@ function _device_can_upload() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a given path is a stream URL
|
||||
*
|
||||
* @param string $path The resource path or URL
|
||||
* @return bool True if the path is a stream URL
|
||||
*/
|
||||
function wp_is_stream( $path ) {
|
||||
$wrappers = stream_get_wrappers();
|
||||
$wrappers_re = '(' . join('|', $wrappers) . ')';
|
||||
|
||||
return preg_match( "!^$wrappers_re://!", $path ) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the supplied date is valid for the Gregorian calendar
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user