Improve inline documentation for `image_constrain_size_for_editor()`.
Includes: * Proper formatting, plus adding a type for the `$context` parameter * Inline `@see` tags in the description and backtick-escaping inline code * Parameter, type, and description alignment Props tillkruess for the initial patch. Fixes #30508. Built from https://develop.svn.wordpress.org/trunk@30646 git-svn-id: http://core.svn.wordpress.org/trunk@30636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ceb75bd8e
commit
2f6c0d5e96
|
@ -11,28 +11,30 @@
|
||||||
*
|
*
|
||||||
* This is so that the image is a better fit for the editor and theme.
|
* This is so that the image is a better fit for the editor and theme.
|
||||||
*
|
*
|
||||||
* The $size parameter accepts either an array or a string. The supported string
|
* The `$size` parameter accepts either an array or a string. The supported string
|
||||||
* values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
|
* values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
|
||||||
* 128 width and 96 height in pixels. Also supported for the string value is
|
* 128 width and 96 height in pixels. Also supported for the string value is
|
||||||
* 'medium' and 'full'. The 'full' isn't actually supported, but any value other
|
* 'medium' and 'full'. The 'full' isn't actually supported, but any value other
|
||||||
* than the supported will result in the content_width size or 500 if that is
|
* than the supported will result in the content_width size or 500 if that is
|
||||||
* not set.
|
* not set.
|
||||||
*
|
*
|
||||||
* Finally, there is a filter named 'editor_max_image_size', that will be called
|
* Finally, there is a filter named {@see 'editor_max_image_size'}, that will be
|
||||||
* on the calculated array for width and height, respectively. The second
|
* called on the calculated array for width and height, respectively. The second
|
||||||
* parameter will be the value that was in the $size parameter. The returned
|
* parameter will be the value that was in the $size parameter. The returned
|
||||||
* type for the hook is an array with the width as the first element and the
|
* type for the hook is an array with the width as the first element and the
|
||||||
* height as the second element.
|
* height as the second element.
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*
|
*
|
||||||
* @param int $width Width of the image
|
* @param int $width Width of the image in pixels.
|
||||||
* @param int $height Height of the image
|
* @param int $height Height of the image in pixels.
|
||||||
* @param string|array $size Size of what the result image should be.
|
* @param string|array $size Optional. Size or array of sizes of what the result image
|
||||||
* @param context Could be 'display' (like in a theme) or 'edit' (like inserting into an editor)
|
* should be. Accepts any valid image size name. Default 'medium'.
|
||||||
|
* @param string $context Optional. Could be 'display' (like in a theme) or 'edit'
|
||||||
|
* (like inserting into an editor). Default null.
|
||||||
* @return array Width and height of what the result image should resize to.
|
* @return array Width and height of what the result image should resize to.
|
||||||
*/
|
*/
|
||||||
function image_constrain_size_for_editor($width, $height, $size = 'medium', $context = null ) {
|
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
|
||||||
global $content_width, $_wp_additional_image_sizes;
|
global $content_width, $_wp_additional_image_sizes;
|
||||||
|
|
||||||
if ( ! $context )
|
if ( ! $context )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.1-beta2-30645';
|
$wp_version = '4.1-beta2-30646';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue