From d7da5970fa160ca894b60a331f85c01c408d10a6 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 28 Oct 2015 21:55:24 +0000 Subject: [PATCH] Responsive images: add inline docs for private functions. Props swissspidy. See #34430. Built from https://develop.svn.wordpress.org/trunk@35426 git-svn-id: http://core.svn.wordpress.org/trunk@35390 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 29 ++++++++++++++++++++++------- wp-includes/version.php | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 7935245d52..17af247bc2 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -869,7 +869,12 @@ function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon } /** - * Private, do not use + * Caches and returns the base URL of the uploads directory. + * + * @since 4.4.0 + * @access private + * + * @return string The base URL, cached. */ function _wp_upload_dir_baseurl() { static $baseurl = null; @@ -883,18 +888,28 @@ function _wp_upload_dir_baseurl() { } /** - * Private, do not use + * Get the image size as array from its meta data. + * + * Used for responsive images. + * + * @since 4.4.0 + * @access private + * + * @param string $size_name Image size. Accepts any valid image size name (thumbnail, medium, etc.). + * @param array $image_meta The image meta data. + * @return array|bool Array of width and height values in pixels (in that order) + * or false if the size doesn't exist. */ -function _wp_get_image_size_from_meta( $size, $image_meta ) { - if ( $size === 'full' ) { +function _wp_get_image_size_from_meta( $size_name, $image_meta ) { + if ( $size_name === 'full' ) { return array( absint( $image_meta['width'] ), absint( $image_meta['height'] ), ); - } elseif ( ! empty( $image_meta['sizes'][$size] ) ) { + } elseif ( ! empty( $image_meta['sizes'][$size_name] ) ) { return array( - absint( $image_meta['sizes'][$size]['width'] ), - absint( $image_meta['sizes'][$size]['height'] ), + absint( $image_meta['sizes'][$size_name]['width'] ), + absint( $image_meta['sizes'][$size_name]['height'] ), ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3b4d81cd34..ac308eda9b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta2-35425'; +$wp_version = '4.4-beta2-35426'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.