Commit Graph

879 Commits

Author SHA1 Message Date
Peter Wilson cc7bdc71e8 Media: Conditionally pass 2nd parameter to `getimagesize()`.
In the wrapper function `wp_getimagesize()` check if the second parameter was passed before sending it to the PHP function `getimagesize()`. 

The PHP function has a different execution path depending on the number of parameters passed, this ensures the wrapper function follows the appropriate path.

Follow up to [50552].
Props azaozz, hellofromtonya, Mista-Flo, peterwilsoncc, rinatkhaziev, RogerTheriault, SergeyBiryukov, terriann, whyisjake.
Fixes #52826.

Built from https://develop.svn.wordpress.org/trunk@50586


git-svn-id: http://core.svn.wordpress.org/trunk@50199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-26 00:09:04 +00:00
Sergey Biryukov a885f914e4 Coding Standards: Add missing semicolon to some `endif` keywords.
See #52627.
Built from https://develop.svn.wordpress.org/trunk@50560


git-svn-id: http://core.svn.wordpress.org/trunk@50173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-21 13:05:04 +00:00
whyisjake 471fc1e913 Media: Pass the appropriate reference into `wp_getimagesize`.
With changes that were introduced in [49889] the second parameter for getimagesize() function is expecting a a reference.

Previously, most calls did not pass the 2nd param, and as a result, we are getting unexpected results.

This was only a problem with applications that are using a custom stream wrapper, and the image contained EXIF data.

For more see:

* https://github.com/humanmade/S3-Uploads/issues/496
* https://github.com/aws/aws-sdk-php/issues/1923

Fixes #52826.
Props terriann, SergeyBiryukov, Mista-Flo, hellofromTonya, rinatkhaziev, whyisjake.


Built from https://develop.svn.wordpress.org/trunk@50552


git-svn-id: http://core.svn.wordpress.org/trunk@50165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-19 00:01:03 +00:00
John Blackbourn 52679edbff Docs: Add examples of possible names for various hooks whose name contains a dynamic portion.
This provides greater discoverability of such hooks in search results on the Code Reference site as well as increased clarity when reading the source.

See #50734, #52628

Built from https://develop.svn.wordpress.org/trunk@50505


git-svn-id: http://core.svn.wordpress.org/trunk@50118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-07 12:32:09 +00:00
antpb 0c5a3fa2ed Media: Make `adjacent_image_link()` include alt text when returning an image.
When using the `adjacent_image_link()` function there is a condition that will return a linked image. Previously, the returned image was sent without alt attributes.

Now, `adjacent_image_link()` will include alt attributes of the image's title when an image is returned.

Props joedolson, Mista-Flo, sabernhardt.
Fixes #52387.

Built from https://develop.svn.wordpress.org/trunk@50274


git-svn-id: http://core.svn.wordpress.org/trunk@49919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-09 17:27:05 +00:00
Sergey Biryukov 8bc5c10684 Docs: Clarify the `@return` value for `wp_get_attachment_image_url()` and `get_the_post_thumbnail_url()`.
Props GeekPress, audrasjb, naveen17797.
Fixes #52183.
Built from https://develop.svn.wordpress.org/trunk@50236


git-svn-id: http://core.svn.wordpress.org/trunk@49897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-08 14:14:08 +00:00
antpb b566631d5e Media: Consistency in logic to pass `wp_getimagesize()` tests.
Previously, we used `DIR_TESTDATA` to determine if a test should skip a newly silenced error in `wp_getimagesize()`.

We are now using `WP_RUN_CORE_TESTS` instead for consistency.

Props hellofromTonya, SergeyBiryukov.
See #49889.

Built from https://develop.svn.wordpress.org/trunk@50170


git-svn-id: http://core.svn.wordpress.org/trunk@49849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 21:36:03 +00:00
desrosj 230c1c5c8a Coding Standards: Fix several minor coding standards issues.
These are made by running `composer format`.

Follow up to [50124], [50129], [50143].

See #49961, #52192, #34281.
Built from https://develop.svn.wordpress.org/trunk@50152


git-svn-id: http://core.svn.wordpress.org/trunk@49831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 18:04:03 +00:00
Sergey Biryukov aab7206ff8 Media: Move `wp_getimagesize()` to `wp-includes/media.php`, for consistency with other media functions.
Follow-up to [50146].

See #49889.
Built from https://develop.svn.wordpress.org/trunk@50148


git-svn-id: http://core.svn.wordpress.org/trunk@49827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 17:10:04 +00:00
antpb f80e5d0919 Media: Avoid suppressing errors when using `getimagesize()`.
Previously, all logic utilizing `getimagesize()` was supressing errors making it difficult to debug usage of the function. 

A new `wp_getimagesize()` function has been added to allow the errors to no longer be suppressed when `WP_DEBUG` is enabled.

Props Howdy_McGee, SergeyBiryukov, mukesh27, davidbaumwald, noisysocks, hellofromTonya.
Fixes #49889.

Built from https://develop.svn.wordpress.org/trunk@50146


git-svn-id: http://core.svn.wordpress.org/trunk@49825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 16:53:04 +00:00
Joe McGill 373ee89c83 Media: Make filename checks less strict in 'wp_image_src_get_dimensions'.
This modifies the check for full size files so that only the basename is compared with the image `src` to avoid misses whenever the `src` path has been modified.

Props ianmjones.
Fixes: #52417.

Built from https://develop.svn.wordpress.org/trunk@50144


git-svn-id: http://core.svn.wordpress.org/trunk@49823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 15:28:04 +00:00
Joe McGill 2642a446b3 Media: Sanity check image meta in 'wp_image_src_get_dimensions'.
This fixes a potential illegal offset error introduced in [50134] if the `$image_meta` doesn't include a `file` key.
    
Props dd32.
Fixes #51865.

Built from https://develop.svn.wordpress.org/trunk@50136


git-svn-id: http://core.svn.wordpress.org/trunk@49815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 04:27:06 +00:00
Joe McGill 5ca780edb1 Media: Add filter to wp_image_src_get_dimensions.
This adds a new filter, `wp_image_src_get_dimensions` to the `wp_image_src_get_dimensions()` function to correct the dimensions returned for a file whenever WordPress isn't able to correctly get the dimensions from attachment metadata.

Fixes #51865.

Built from https://develop.svn.wordpress.org/trunk@50134


git-svn-id: http://core.svn.wordpress.org/trunk@49813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 02:59:05 +00:00
Sergey Biryukov 489e47692a Media: Use consistent method for instantiating an attachment author object in Media Library.
Previously, attachments without an author could cause a PHP fatal error due to calling the `::exists()` method on a `false` value.

Props antpb, carloscastilloadhoc, hellofromTonya, garrett-eclipse.
Fixes #52030.
Built from https://develop.svn.wordpress.org/trunk@49979


git-svn-id: http://core.svn.wordpress.org/trunk@49680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-18 12:55:07 +00:00
John Blackbourn b59c0f307b Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217

Built from https://develop.svn.wordpress.org/trunk@49936


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 17:16:11 +00:00
John Blackbourn dfe1f9b322 Docs: Promote many `bool` types to `true` or `false` where only that value is used.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49927


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
Felix Arntz bb234abee7 Media: Enable lazy-loading of iframes by adding the `loading="lazy"` attribute to iframe tags on the front-end.
* Expands the capabilities of `wp_filter_content_tags()` to add the attribute to iframe tags if enabled.
* Modifies the default behavior of `wp_lazy_loading_enabled()` so that it returns `true` for `iframe` tags.
* Introduces a `wp_iframe_tag_add_loading_attr()` function.
* Introduces a `wp_iframe_tag_add_loading_attr` filter.

Like for images, the attribute is only added to iframes which have both `width` and `height` specified (see related #50367).

Props azaozz, flixos90, westonruter.
Fixes #50756.

Built from https://develop.svn.wordpress.org/trunk@49808


git-svn-id: http://core.svn.wordpress.org/trunk@49531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 21:19:07 +00:00
Sergey Biryukov 52d2b07600 Docs: Fix typo in references to `WP_Error` in some DocBlocks.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49769


git-svn-id: http://core.svn.wordpress.org/trunk@49492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-08 11:51:05 +00:00
iandunn 77236320d3 Media: Return `WP_Error` when cropping with bad input to avoid fatal.
This avoids an error on PHP 8 caused by calling `wp_imagecreatetruecolor()` with inputs that aren't numeric, or are less than 0.

Props hellofromtonya, Boniu91, metalandcoffee, SergeyBiryukov.
Fixes #51937.

Built from https://develop.svn.wordpress.org/trunk@49751


git-svn-id: http://core.svn.wordpress.org/trunk@49474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-04 21:41:06 +00:00
Helen Hou-Sandí ee48cca207 Media: Avoid fatal error in `wp_prepare_attachment_for_js().
In certain contexts, in particular on the front-end, `get_media_states()` is not availble.

Props rebasaurus.
Fixes #51791.

Built from https://develop.svn.wordpress.org/trunk@49613


git-svn-id: http://core.svn.wordpress.org/trunk@49351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-16 19:20:09 +00:00
John Blackbourn 170ca32007 Docs: Various docblock corrections and improvements.
See #50768

Built from https://develop.svn.wordpress.org/trunk@49597


git-svn-id: http://core.svn.wordpress.org/trunk@49335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-14 16:35:06 +00:00
Sergey Biryukov a2d42351c5 Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings.
Standardize on "Go to..." as a more appropriate option for most cases.

Props garrett-eclipse, kharisblank, audrasjb, ramiy, valentinbora.
Fixes #47235.
Built from https://develop.svn.wordpress.org/trunk@49539


git-svn-id: http://core.svn.wordpress.org/trunk@49277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-09 10:53:10 +00:00
Sergey Biryukov 0a70f9b004 Docs: Document the return value of `wp_prepare_attachment_for_js()` using hash notation.
Props stevenlinx, Mista-Flo, johnbillion.
Fixes #50835.
Built from https://develop.svn.wordpress.org/trunk@49281


git-svn-id: http://core.svn.wordpress.org/trunk@49041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-23 00:43:07 +00:00
Sergey Biryukov e856a91321 Media: Introduce a filter for `wp_get_attachment_image()` HTML output.
Props prionkor, antpb, donmhico, audrasjb, Mista-Flo, hellofromTonya.
Fixes #50801.
Built from https://develop.svn.wordpress.org/trunk@49234


git-svn-id: http://core.svn.wordpress.org/trunk@48996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 15:31:06 +00:00
Helen Hou-Sandí edb64a3d8e Media: Indicate if item is or was used as a site option in the details modal.
Props Mista-Flo, melchoyce.
Fixes #42063.

Built from https://develop.svn.wordpress.org/trunk@49223


git-svn-id: http://core.svn.wordpress.org/trunk@48985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 03:14:06 +00:00
Sergey Biryukov e209e00734 Coding Standards: Fix WPCS issues in [49207].
See #46866.
Built from https://develop.svn.wordpress.org/trunk@49209


git-svn-id: http://core.svn.wordpress.org/trunk@48971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 20:45:06 +00:00
antpb 9556c08b35 Media: Add 'Uploaded to' for individual media items in the media editor.
Adds a link in the media editor showing which post a media item was uploaded to.
Props karmatosed, garrett-eclipse, Mista-Flo, SergeyBiryukov, joemcgill, hellofromTonya.
Fixes #46866.

Built from https://develop.svn.wordpress.org/trunk@49207


git-svn-id: http://core.svn.wordpress.org/trunk@48969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 20:29:05 +00:00
Sergey Biryukov 0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
John Blackbourn 33070fb7d2 Media: Allow the `gallery_shortcode()` and `get_image_tag()` functions to correctly accept an array of image dimensions.
These functions did previously accept an array of image dimensions but their class attributes were not properly constructed.

Fixes #51362

Built from https://develop.svn.wordpress.org/trunk@49128


git-svn-id: http://core.svn.wordpress.org/trunk@48890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-11 20:01:06 +00:00
Sergey Biryukov 897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
John Blackbourn aba2165aae Media: Standardise the description for image size parameters.
This brings continuity to all the image related functions and filters which accept or pass a size parameter.

Props dilipbheda, johnbillion

Fixes #47364

Built from https://develop.svn.wordpress.org/trunk@49021


git-svn-id: http://core.svn.wordpress.org/trunk@48783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 16:23:07 +00:00
John Blackbourn 0b2e31a7f8 Docs: Inline documentation improvements for media related functions and hooks.
See #47364, #50768

Built from https://develop.svn.wordpress.org/trunk@49020


git-svn-id: http://core.svn.wordpress.org/trunk@48782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 15:55:10 +00:00
John Blackbourn ecfff6fe80 Media: Correct the image thumbnail logic in media templates.
This ensures the correct data properties are checked before displaying image thumbnails.

Props chetan200891

Fixes #49655

Built from https://develop.svn.wordpress.org/trunk@49012


git-svn-id: http://core.svn.wordpress.org/trunk@48774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:15:04 +00:00
Sergey Biryukov af523447f4 Media: Make the `is_gd_image()` function available on front end.
This avoids a fatal error if a plugin calls image creation or editing functions like `wp_imagecreatetruecolor()` outside of the admin.

Follow-up to [48798]

Props BackuPs.
Fixes #51174. See #50833.
Built from https://develop.svn.wordpress.org/trunk@48905


git-svn-id: http://core.svn.wordpress.org/trunk@48667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-28 16:45:06 +00:00
Sergey Biryukov 0c8644c071 Docs: Improve documentation for `wp_lazy_loading_enabled()` per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48855


git-svn-id: http://core.svn.wordpress.org/trunk@48617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-24 22:16:06 +00:00
Sergey Biryukov c3a7d6c379 Docs: Add a `@since` note about the `$srcset` and `$sizes` attributes added to `wp_get_attachment_image()`.
Follow-up to [34855].

See #51122.
Built from https://develop.svn.wordpress.org/trunk@48853


git-svn-id: http://core.svn.wordpress.org/trunk@48615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-24 22:12:03 +00:00
Sergey Biryukov 147ed6ebdb Docs: Add documentation and a `@since` note about the `loading` attribute added to `wp_get_attachment_image()`.
Follow-up to [48272].

Props audrasjb.
Fixes #51122.
Built from https://develop.svn.wordpress.org/trunk@48852


git-svn-id: http://core.svn.wordpress.org/trunk@48614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-24 22:04:04 +00:00
Sergey Biryukov 12c8f0e678 Code Modernization: Introduce `is_gd_image()` to check for PHP 8 `GdImage` object instances.
In PHP 8, the GD extension uses `GdImage` objects instead of resources for its underlying data structures.

This updates the existing `is_resource()` calls for image resources in core to accomodate for `GdImage` instances as well.

Props ayeshrajans, jrf.
Fixes #50833.
Built from https://develop.svn.wordpress.org/trunk@48798


git-svn-id: http://core.svn.wordpress.org/trunk@48560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-16 13:33:09 +00:00
Sergey Biryukov 1f85e7484f Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48782


git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
Sergey Biryukov b1c6077591 Media: Remove extra space from the `width` attribute in `wp_playlist_shortcode()` output.
Props hvar.
Fixes #50840.
Built from https://develop.svn.wordpress.org/trunk@48716


git-svn-id: http://core.svn.wordpress.org/trunk@48478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-04 12:47:06 +00:00
Sergey Biryukov 5d21bc9386 Docs: Correct description for `wp_filter_content_tags()` per the documentation standards.
DocBlocks should start with a brief, one sentence explanation of the purpose of the function spanning a maximum of two lines.

Follow-up to [48648].

See #44427.
Built from https://develop.svn.wordpress.org/trunk@48649


git-svn-id: http://core.svn.wordpress.org/trunk@48411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 21:49:04 +00:00
Andrew Ozz 000086828f Media: Improve inline docs for `wp_filter_content_tags()`.
Props johnstonphilip.
See #44427.
Built from https://develop.svn.wordpress.org/trunk@48648


git-svn-id: http://core.svn.wordpress.org/trunk@48410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 21:06:03 +00:00
Sergey Biryukov 703a978a77 Administration: Capitalize `Trash` consistently in various messages.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Follow-up to [47233], [48352].

See #45317, #40244.
Built from https://develop.svn.wordpress.org/trunk@48594


git-svn-id: http://core.svn.wordpress.org/trunk@48356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-24 00:21:03 +00:00
Sergey Biryukov 3061a680a9 Media: Pass the attachment ID to the `wp_image_file_matches_image_meta` filter.
Props spacedmonkey.
Fixes #50722.
Built from https://develop.svn.wordpress.org/trunk@48547


git-svn-id: http://core.svn.wordpress.org/trunk@48309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-21 16:55:08 +00:00
whyisjake 69aaab5108 Feeds: Ensure that galleries can be output as a list of links in feeds.
Adjusts the gallery shortcode handler to check for the `link` attribute when outputting to a feed.

Fixes #22101.

Props ifrins, mdgl, SergeyBiryukov, chriscct7, stevenkword, iworks, DrewAPicture, birgire, whyisjake.

Built from https://develop.svn.wordpress.org/trunk@48496


git-svn-id: http://core.svn.wordpress.org/trunk@48258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-16 21:31:03 +00:00
Andrew Ozz 618c32686e Media: Fix `wp_image_file_matches_image_meta()` to also match when the original image URL is used.
Also refreshes and fixes some of the unit tests for media, and replaces test-image-large.png with test-image-large.jpg which is larger to allow testing of `original_image` in the image meta.

Fixes #50628.


Built from https://develop.svn.wordpress.org/trunk@48454


git-svn-id: http://core.svn.wordpress.org/trunk@48223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-12 21:20:03 +00:00
Andrew Ozz af35cbeee8 Media: Tiny logic fix in `wp_image_file_matches_image_meta()` after [48329]. No need to look in `sizes` if the full size image path/URL matches.
See #50543.
Built from https://develop.svn.wordpress.org/trunk@48430


git-svn-id: http://core.svn.wordpress.org/trunk@48199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-10 23:06:04 +00:00
whyisjake 81b809e3d6 Administration: Move more table strings to sentence casing.
WordPress as a project has moved largely to sentence casing for UI elements in the admin. This commit moves several string$

* Move to trash
* Mark as spam
* Permanently delete comment
* Approve comment
* In response to
* Bulk actions
* Not spam
* Sumitted on
* Delete permanently
* Add media
* Upload files
* Upload images
* Add media
* Bulk select
* Restore from trash
* Search media
* Attachment details
* Create gallery
* Edit gallery
* Cancel gallery
* Add to gallery
* Image details
* Replace image
* Cancel edit
* Edit image
* Choose image
* Select and crop
* Skip cropping
* Crop image
* Audio details
* Replace audio
* Add audio source
* Video details
* Replace video
* Add video source
* Select poster image
* Add subtitles
* Create audio playlist
* Edit audio playlist.
* Cancel audio playlist
* Create video playlist
* Edit video playlist
* Add to video playlist
* Filter media


Fixes #40244.
Props afercia, bhargavbhandari90, rcutmore, webzunft, manojlovic, jeremyfelt, desrosj, lschuyler, SergeyBiryukov, whyisjake. 


Built from https://develop.svn.wordpress.org/trunk@48352


git-svn-id: http://core.svn.wordpress.org/trunk@48121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 21:52:21 +00:00
desrosj ef0881750c Docs: Correct typo introduced in [48288].
See #42775.
Built from https://develop.svn.wordpress.org/trunk@48343


git-svn-id: http://core.svn.wordpress.org/trunk@48112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 19:10:02 +00:00
Andrew Ozz 08dbc4c3bb Media:
- Introduce `wp_image_file_matches_image_meta()` utility function to check whether the image meta (retrieved by attachment ID) matches an image path or URI. A mismatch may happen in some cases, for example after the posts have been exported from one website and imported in another.
- Add unit tests for the new function.
- Improve `wp_image_src_get_dimensions()` a bit and use the new function to prevent these edge cases.

Fixes #50543.
Built from https://develop.svn.wordpress.org/trunk@48329


git-svn-id: http://core.svn.wordpress.org/trunk@48098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-05 23:32:03 +00:00
Andrew Ozz 86317e3e85 Media: Show an error message when a `.heic` file is uploaded that this type of files cannot be displayed in a web browser and suggesting to convert to JPEG. The message is shown by using filters, plugins that want to handle uploading of `.heic` files can remove it.
Props mattheweppelsheimer, mikeschroder, jeffr0, andraganescu, desrosj, azaozz.
Fixes #42775.
Built from https://develop.svn.wordpress.org/trunk@48288


git-svn-id: http://core.svn.wordpress.org/trunk@48057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-03 23:15:03 +00:00
Sergey Biryukov ec571bdcf6 Docs: Spell "falsey" in a consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48275


git-svn-id: http://core.svn.wordpress.org/trunk@48044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-02 11:30:02 +00:00
Felix Arntz 1d010a49c7 Media: Improve support for opting out of lazy-loading for template images.
With this changeset, in addition to the already present `wp_lazy_loading_enabled` filter, developers can now opt out of lazy-loading template images via `wp_get_attachment_image()` by passing a `loading` attribute with boolean value `false`. This can be used e.g. by theme developers on images which are very likely to be in the initial viewport.

This changeset also improves related test coverage.

Props adamsilverstein, azaozz, joemcgill, johnbillion.
See #50425, #44427.

Built from https://develop.svn.wordpress.org/trunk@48272


git-svn-id: http://core.svn.wordpress.org/trunk@48041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-02 02:03:03 +00:00
Felix Arntz 70c8bd2333 Media: Only add `loading` attribute to `img` tags using double quotes.
Props azaozz.
Fixes #50367.

Built from https://develop.svn.wordpress.org/trunk@48239


git-svn-id: http://core.svn.wordpress.org/trunk@48008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-30 20:34:06 +00:00
Felix Arntz e92ab44880 Media: Introduce `wp_img_tag_add_width_and_height_attr()` to add dimension attributes to images.
Following up on [48170], this changeset moves the new logic to add missing `img` dimension attributes into a separate function that is run first within `wp_filter_content_tags()`. It also adds a utility function `wp_image_src_get_dimensions()` with logic reused from `wp_image_add_srcset_and_sizes()`, and it ensures that `width` and `height` attributes only get added if both of the attributes are missing on the original `img` tag.

This changeset furthermore improves test coverage and separates tests for the different aspects of `img` tag modification.

Props azaozz.
Fixes #50367. See #44427.

Built from https://develop.svn.wordpress.org/trunk@48237


git-svn-id: http://core.svn.wordpress.org/trunk@48006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-30 19:30:08 +00:00
Sergey Biryukov c892c420b7 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48198


git-svn-id: http://core.svn.wordpress.org/trunk@47967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 11:53:04 +00:00
Sergey Biryukov 40c389c95e Docs: Standardize on "Returning a value from the filter" vs. "Passing a value to the filter".
The filter is the callback function added with `add_filter()`, therefore the hook passes a value to the filter, and the filter returns a value to change its behaviour.

The documentation is referring to the latter.

Props johnbillion.
See #49572, #16557.
Built from https://develop.svn.wordpress.org/trunk@48185


git-svn-id: http://core.svn.wordpress.org/trunk@47954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 18:49:09 +00:00
Felix Arntz f18870ae4e Media: Ensure images have dimensions to reduce layout shift and facilitate lazy-loading.
This changeset ensures that attachment images which are inserted without `width` and `height` attributes still receive them in the frontend, to reduce cumulative layout shift. Adding the dimensions happens as part of the logic for adding `srcset` and `sizes` attributes, which already assume the specific width and height of the respective image.

Images are now only lazy-loaded if they have `width` and `height` attributes present. While missing these attributes itself is what causes layout shifts, lazy-loading such images can make this problem more apparent to the user.

Props adamsilverstein, westonruter.
Fixes #50367. See #44427.

Built from https://develop.svn.wordpress.org/trunk@48170


git-svn-id: http://core.svn.wordpress.org/trunk@47939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 18:45:08 +00:00
Sergey Biryukov be16bb9fba Docs: Remove extra spaces from `@param` tags.
Per the documentation standards, `@param` tags should be aligned with each other, but not with the `@return` tag.

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48110


git-svn-id: http://core.svn.wordpress.org/trunk@47879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:58:10 +00:00
Sergey Biryukov b16368c268 Docs: Remove `@staticvar` tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
John Blackbourn 1a77bb81d8 Docs: Remove unnecessary variables names from `@return` tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
John Blackbourn 37234874a5 Docs: Misc improvements to inline docs.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48099


git-svn-id: http://core.svn.wordpress.org/trunk@47868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:28:13 +00:00
Sergey Biryukov de59ad23a4 Docs: Consistently include an empty line between `@since` tag and `@see`, `@link`, or `@global`, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +00:00
John Blackbourn f89f744fb2 Media: Ensure a consistent structure for the array returned by `wp_get_attachment_image_src()`.
The array returned by this function previously included a fourth element only when an intermediate image size was used. This change ensures a consistent structure in the returned array regardless of the function's internal behaviour.

Props wido, joemcgill, johnbillion

Fixes #46113
Built from https://develop.svn.wordpress.org/trunk@47748


git-svn-id: http://core.svn.wordpress.org/trunk@47524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-02 22:57:06 +00:00
Andrew Ozz 0e38f8ed26 Media: Enable lazy-loading of images by automatically adding the new `loading="lazy"` attribute to image tags on the front-end.
- Introduces `wp_lazy_loading_enabled()`, `wp_filter_content_tags()`, `wp_img_tag_add_loading_attr()`, and `wp_img_tag_add_srcset_and_sizes_attr()` functions.
- Introduces `wp_lazy_loading_enabled`, `wp_img_tag_add_loading_attr`, and `wp_img_tag_add_srcset_and_sizes_attr` filters.

Props flixos90, addyosmani, mor10, swissspidy, pierlo, westonruter, spacedmonkey, mikeschroder, jonoaldersonwp, peterwilsoncc, narwen, jeffpaul, OptimizingMatters, futtta, mukeshpanchal27, azaozz.

Fixes #44427.
Built from https://develop.svn.wordpress.org/trunk@47554


git-svn-id: http://core.svn.wordpress.org/trunk@47329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-08 00:55:07 +00:00
John Blackbourn 46674e2367 Docs: Correct and improve the docs for some media related functions.
See #48303
Built from https://develop.svn.wordpress.org/trunk@47394


git-svn-id: http://core.svn.wordpress.org/trunk@47181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-29 16:49:07 +00:00
Sergey Biryukov 363191d8ee Docs: Improve documentation for the `$attr` parameter of `wp_get_attachment_image()`.
Props juanfra, Mte90, DrewAPicture, joemcgill, SergeyBiryukov.
Fixes #36661.
Built from https://develop.svn.wordpress.org/trunk@47249


git-svn-id: http://core.svn.wordpress.org/trunk@47049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 22:03:07 +00:00
Sergey Biryukov 641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Andrew Ozz aea25de893 Media: Add link to the original image in the image properties if it was scaled or rotated after uploading.
Fixes #49290.
Built from https://develop.svn.wordpress.org/trunk@47202


git-svn-id: http://core.svn.wordpress.org/trunk@47002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 05:13:05 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov dd4d98a368 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
Sergey Biryukov 8990cf9296 Media: Make sure `attachment_url_to_postid()` performs a case-sensitive search for the uploaded file name.
Previously, the first available match was returned, regardless of the case, which was not always the expected result.

Props archon810, ben.greeley, tristangemus, vsamoletov, SergeyBiryukov.
Fixes #39768.
Built from https://develop.svn.wordpress.org/trunk@47010


git-svn-id: http://core.svn.wordpress.org/trunk@46810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-25 02:26:03 +00:00
Sergey Biryukov 012ddf095a Media: Avoid a PHP notice in `image_downsize()` when trying to replace a non-image URL with a rendered image from its meta.
Props Mte90, jrf, hareesh-pillai.
Fixes #48324.
Built from https://develop.svn.wordpress.org/trunk@46772


git-svn-id: http://core.svn.wordpress.org/trunk@46572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-25 10:07:02 +00:00
John Blackbourn f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46660


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn b3d6acd6a4 Docs: Fix some incorrect return tags in docblocks.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46644


git-svn-id: http://core.svn.wordpress.org/trunk@46444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 22:23:01 +00:00
John Blackbourn c8f91f77ac Docs: Correct invalid hook docblocks.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46603


git-svn-id: http://core.svn.wordpress.org/trunk@46400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-27 19:11:02 +00:00
John Blackbourn 3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

Built from https://develop.svn.wordpress.org/trunk@46596


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
John Blackbourn 7c2b9f2a2e Docs: Miscellaneous docblock fixes and improvements.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46594


git-svn-id: http://core.svn.wordpress.org/trunk@46391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 20:43:04 +00:00
Andrea Fercia 1f3d583825 Accessibility: Media: Improve the search media field labelling.
Visible `<label>` elements benefit all users. The `placeholder` attribute should not be used as a replacement for visible labels.
Instead, it's supposed to be used only for a short hint to aid users with data entry e.g. a sample value or a brief description of the expected format.

Screen readers may not announce a `placeholder` attribute at all. Other users may suffer from the lack of a visible label and a placeholder used as replacement, for example:

- users with cognitive disabilities may have trouble remembering what the filled field does
- speech recognition users cannot see the name they can speak to set focus on the field
- low-vision users with high text-size may not be able to see the whole placeholder even when it's visible, if its value is clipped by the edge of the input

Props anevins, audrasjb, karmatosed, azaozz, SergeyBiryukov, afercia.
See #40331.
Fixes #47138.

Built from https://develop.svn.wordpress.org/trunk@46418


git-svn-id: http://core.svn.wordpress.org/trunk@46216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-07 12:43:03 +00:00
Joe McGill ecf00fc844 Media: Improve documentation for `add_image_size()`
This improves the description of the `$crop` parameter to clarify behavior.

Props nikolastoqnow, ketuchetan, audrasjb, killua99, pierlo.
Fixes #42463.


Built from https://develop.svn.wordpress.org/trunk@46376


git-svn-id: http://core.svn.wordpress.org/trunk@46175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-03 14:47:59 +00:00
Andrea Fercia b1cd71c2d2 Accessibility: Media: Add more headings in the Media Modal.
Headings are the predominant mechanism for screen reader users to find information in a page. They also help all users to better identify the main sections of user interfaces.

- adds three new headings within the media modal 
- improves plural form translation for "item selected" by using `wp.i18n`
- horizontally centers the media modal menu in the responsive view

Props kjellr, karmatosed, melchoyce, afercia.
See #47149.
Fixes #47610.

Built from https://develop.svn.wordpress.org/trunk@46375


git-svn-id: http://core.svn.wordpress.org/trunk@46174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-03 12:10:57 +00:00
Andrea Fercia 9e26d98d7e Accessibility: Media: Make screen readers announce the Media search results.
- adds audible messages via `wp.a11y.speak()` to announce the search results 
- removes a `keyup` event that was there only to support old browsers 
- removes `aria-modal="true"` from the media modal dialog as it prevents the ARIA live regions to be perceived by screen readers
- triggers the search only after 2 ASCII characters have been typed

Props anevins, antpb, aduth, loreleiaurora, afercia.
Fixes #47146.

Built from https://develop.svn.wordpress.org/trunk@46239


git-svn-id: http://core.svn.wordpress.org/trunk@46051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 12:19:56 +00:00
Sergey Biryukov 252628652e Script Loader: Introduce HTML5 support for scripts and styles.
When a theme declares HTML5 support for script and styles via `add_theme_support( 'html5', array( 'script', 'style' ) )`, the `type="text/javascript"` and `type="text/css"` attributes are omitted.

These attributes are unnecessary in HTML5 and cause warnings in the W3C Markup Validation Service.

Props sasiddiqui, swissspidy, knutsp, SergeyBiryukov.
See #42804.
Built from https://develop.svn.wordpress.org/trunk@46164


git-svn-id: http://core.svn.wordpress.org/trunk@45976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-18 14:50:56 +00:00
Andrew Ozz 2d6a772400 Fix "white spaces at end of line" in docblock (IDE) woes after [46077].
See #32437.
Built from https://develop.svn.wordpress.org/trunk@46078


git-svn-id: http://core.svn.wordpress.org/trunk@45890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 02:12:55 +00:00
Andrew Ozz 1de168e016 Media: Improve handling of cases where an uploaded image matches exactly a defined intermediate size. In most of these cases the original image has been edited by the user and is "web ready", there is no need for an identical intermediate image.
Introduces the `wp_image_resize_identical_dimensions` filter so plugins and themes can determine whether a new image with identical dimensions should be created, defaults to false.

Props wpdennis, HKandulla, galbaras, azaozz.
See #32437.
Built from https://develop.svn.wordpress.org/trunk@46077


git-svn-id: http://core.svn.wordpress.org/trunk@45889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 01:34:55 +00:00
Andrew Ozz 3b976836a8 Media: Add two new intermediate image sizes, 1536px and 2048px. They are meant to enhance the way WordPress displays images on the front-end on larger, high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes, and not use the original, often non-optimized image.
Also change the default `max_srcset_image_width` value to match the new max size.

Props pierlo, azaozz.
See #43524.
Built from https://develop.svn.wordpress.org/trunk@46066


git-svn-id: http://core.svn.wordpress.org/trunk@45878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-05 22:27:58 +00:00
Sergey Biryukov e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov 16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Andrea Fercia 3ab18dba93 Accessibility: Add a default title for the media modal dialog.
Makes sure the media modal dialog `h1` heading isn't empty when custom media frames don't set a title. This is particularly important now that the media modal is an ARIA dialog, as the title is referenced by an `aria-labelledby` attribute to properly label the dialog.

Props donmhico, audrasjb.
Fixes #47612.

Built from https://develop.svn.wordpress.org/trunk@45925


git-svn-id: http://core.svn.wordpress.org/trunk@45736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 15:18:56 +00:00
Sergey Biryukov d9954ed4cb Privacy: Add descriptions for sections in a personal data export file.
Props garrett-eclipse, Venutius, karmatosed.
Fixes #45491.
Built from https://develop.svn.wordpress.org/trunk@45825


git-svn-id: http://core.svn.wordpress.org/trunk@45636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-18 02:07:57 +00:00
Sergey Biryukov e0311b76c7 Docs: Add missing description for `$wp_locale` global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Sergey Biryukov 29b072e706 Docs: Add missing description for `$wpdb`, `$wp_db_version`, and `$wp_current_db_version` globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Gary Pendergast abcbee954f Coding Standards: Fix instances of `WordPress.PHP.NoSilencedErrors.Discouraged`.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

Built from https://develop.svn.wordpress.org/trunk@45611


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Andrew Ozz 6b74e27d04 Media: fix support for arrays for the `crop` setting for registered image sub-sizes in `wp_get_registered_image_subsizes()`.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45541


git-svn-id: http://core.svn.wordpress.org/trunk@45352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-15 17:17:52 +00:00
Andrew Ozz 5987caeecc After [45538]: fix a WPCS fix and make couple of var names consistent.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45539


git-svn-id: http://core.svn.wordpress.org/trunk@45350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-15 01:32:53 +00:00
Andrew Ozz 05302bd054 Save progress of intermediate image creation after upload. First run.
- Introduces `wp_get_missing_image_subsizes()` and `wp_update_image_subsizes()` to generate image sub-sizes that are missing or were not created after the upload.
- Adds a way to display errors that happened while creating sub-sizes.
- Introduces `wp_create_image_subsizes()` intended for use after an image was uploaded. It saves/updates the image metadata immediately after each sub-size is created. This fixes the (long standing) problem when some of the sub-size image files were created but there was a timeout or an error and the metadata was not saved. Until now such uploads were considered "failed" which usually resulted in the user trying to upload the same image again, creating even more "orphan" image files.

Note that the patch also includes some unrelated WPCS fixes.

Props mikeschroder, azaozz.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45538


git-svn-id: http://core.svn.wordpress.org/trunk@45349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-15 01:02:52 +00:00
Gary Pendergast 0bbfe42ab1 Media: Revert [44947].
`get_available_post_mime_types()` uses a query that's extremely slow on sites with lots of posts. The original fix can be revisited after those performance issues are tackled.

See #43658.

Built from https://develop.svn.wordpress.org/trunk@45270


git-svn-id: http://core.svn.wordpress.org/trunk@45079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-26 00:44:52 +00:00
Sergey Biryukov d2ccaacedf Docs: Correct spelling in various comments and DocBlocks, per the conventions in Core Contributor Handbook.
Props man4toman, samanehmirrajabi.
Fixes #45857.
Built from https://develop.svn.wordpress.org/trunk@45232


git-svn-id: http://core.svn.wordpress.org/trunk@45041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 13:26:51 +00:00
Gary Pendergast 4b1ff1c298 Media: Update the media bulk action labels for consistency.
Props ianbelanger, garrett-eclipse, afercia, Presskopp.
Fixes #44675.


Built from https://develop.svn.wordpress.org/trunk@45147


git-svn-id: http://core.svn.wordpress.org/trunk@44956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-08 23:54:52 +00:00