Commit Graph

945 Commits

Author SHA1 Message Date
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
Adam Silverstein 19c4841fb6 Media: introduce a "Heading" view for improved accessibility.
* Add a new media view: `wp.media.view.Heading` designed to add accessibility friendly headers in the media library/modal.
* Add an initial "Attachments list" heading above the attachments list.

Props afercia.
Fixes #36925.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:05:52 +00:00
Adam Silverstein 32dadd49eb Build: correct some linting errors.
Fix linting failures after r44948 by running `composer run format`.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-20 22:06:52 +00:00
Adam Silverstein b07bafba7e Media: grid view attachment filter drop down - only show available mime types.
In the media library gird view, properly limit the media attachment filter to available mime types, matching the list view.

Props itzmekhokan.
Fixes #43658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-20 20:07:51 +00:00
Aaron Jorbin 71cf332e65 Replace usages of basename() with wp_basename() in order to support multibyte filenames
This is focused on the pieces of code that touch media files and the tests that support them. `basename` isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-01 20:58:52 +00:00
Gary Pendergast 4f861b9548 Coding Standards: Fix the `Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace` violations.
See #45934.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-11 06:40:50 +00:00
desrosj 3dcc536b80 Media: Correct `since` annotation for adding the `caption_id` attribute.
Introduced in [42704]
Fixes #34595.
Built from https://develop.svn.wordpress.org/trunk@44548


git-svn-id: http://core.svn.wordpress.org/trunk@44379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 21:37:49 +00:00
Drew Jaynes 90dea00070 Docs: Ensure the optional `$width` and `$height` parameters are documented as such with defaults in the `add_image_size()` DocBlock.
Props andrewza.
Fixes #45203.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 07:26:47 +00:00
Adam Silverstein e71a3d6193 Media: Improve display and accessibility of meta data in detail view.
* Add a `human_readable_duration` function including tests.
* Add 'pixels' after image width/height.
* Add screen reader text for durations.

Props Presskopp, kiranpotphode, milindmore22, stormrockwell, afercia.
Fixes #39667. 


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


git-svn-id: http://core.svn.wordpress.org/trunk@43462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-08 04:20:24 +00:00
John Blackbourn 47d32decd6 Docs: Correct and improve various inline documentation.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@43411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-27 14:28:26 +00:00
Gary Pendergast 56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
iandunn 3d4c461e50 Privacy: Store plugin callbacks in associative array for flexibility.
The personal data export and erasure tools allow plugins to register their own callbacks, in order to add additional data to the export and erasure processes. Previously, these were registered without specifying a constant identifier in the array of callbacks. Using mutable integers makes it difficult for plugins to modify the callbacks of other plugins, though.

Using associative array keys instead provides a covenient and reliable way to identify and interact with another plugin's callbacks.

Props desrosj, allendav, ocean90.
Fixes #43931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-03 19:28:21 +00:00
Sergey Biryukov 074535cac3 Media: Remove media player support for `.aac` files due to only partial support in Firefox.
This still allows `.aac` files to be uploaded, but does not explicitly declare support for use in the editor and within embeds to prevent bad UX.

Props desrosj.
See #42919.
Built from https://develop.svn.wordpress.org/trunk@43135


git-svn-id: http://core.svn.wordpress.org/trunk@42964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-03 06:38:21 +00:00
Sergey Biryukov 6c2470a091 I18N: Add context for "Mine" string added in [43056].
See #43820.
Built from https://develop.svn.wordpress.org/trunk@43062


git-svn-id: http://core.svn.wordpress.org/trunk@42891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 21:37:23 +00:00
Andrew Ozz 3266b10d04 Privacy: add "Mine" filter for media similarly to posts and comments.
Props audrasjb.
See #43820.
Built from https://develop.svn.wordpress.org/trunk@43056


git-svn-id: http://core.svn.wordpress.org/trunk@42885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 15:43:22 +00:00
Andrew Ozz c77a8ed2fc Privacy: add attachments to the personal data export file.
Props allendav.
See #43883.
Built from https://develop.svn.wordpress.org/trunk@43054


git-svn-id: http://core.svn.wordpress.org/trunk@42883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 13:45:21 +00:00
John Blackbourn 1b5d6c6971 Docs: Document many more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-22 20:27:32 +00:00
Joe McGill 06ec96a7a4 Revert max-width styles on caption shortcodes.
This is a partial revert of [41724], so image captions include an
inline `width` style instead of `max-width`.

This returns the caption shortcode to the pre-4.9.0 behavior, while
retaining the extra unit test coverage added in [41724].

Fixes #43123. See #33981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-16 20:07:33 +00:00
Sergey Biryukov dfa6839706 Media: In `img_caption_shortcode()`, make sure `$id` and `$caption_id` are always defined.
See #34595.
Built from https://develop.svn.wordpress.org/trunk@42706


git-svn-id: http://core.svn.wordpress.org/trunk@42534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-12 22:36:33 +00:00
Sergey Biryukov 0306b3f637 Docs: Use code formatting for tags in `img_caption_shortcode()` DocBlock.
See #34595.
Built from https://develop.svn.wordpress.org/trunk@42705


git-svn-id: http://core.svn.wordpress.org/trunk@42533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-12 21:40:31 +00:00
Sergey Biryukov 0f8d7de77d Media: Pass original attribute values to `img_caption_shortcode_width` filter instead of markup pieces.
Add `caption_id` to the list of documented `[caption]` shortcode attributes.

See #34595.
Built from https://develop.svn.wordpress.org/trunk@42704


git-svn-id: http://core.svn.wordpress.org/trunk@42532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-12 21:37:30 +00:00
Sergey Biryukov f88dddcab5 Media: Add `aac` to the list of allowed file types.
Props desrosj.
Fixes #42919.
Built from https://develop.svn.wordpress.org/trunk@42697


git-svn-id: http://core.svn.wordpress.org/trunk@42525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 16:40:31 +00:00
Sergey Biryukov 3de0634199 Docs: Fix typo in `wp_audio_extensions` and `wp_video_extensions` filter descriptions.
See #42505.
Built from https://develop.svn.wordpress.org/trunk@42696


git-svn-id: http://core.svn.wordpress.org/trunk@42524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 16:29:30 +00:00
Sergey Biryukov beeafbc7ec Media: After [42693], update HTML4 markup in `img_caption_shortcode()` to avoid an empty ID attribute as well.
Add a unit test for `aria-describedby` in `img_caption_shortcode()`.

See #34595.
Built from https://develop.svn.wordpress.org/trunk@42694


git-svn-id: http://core.svn.wordpress.org/trunk@42522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 15:40:30 +00:00
Sergey Biryukov 0f2b559d05 Media: Only add `aria-describedby` in `img_caption_shortcode()` if a non-empty attachment ID attribute was provided.
See #34595.
Built from https://develop.svn.wordpress.org/trunk@42693


git-svn-id: http://core.svn.wordpress.org/trunk@42521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 15:20:30 +00:00
Sergey Biryukov dffe5deb97 Media: Make sure `$caption_id` does not depend on an undefined variable.
See #34595.
Built from https://develop.svn.wordpress.org/trunk@42692


git-svn-id: http://core.svn.wordpress.org/trunk@42520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 14:53:30 +00:00
Sergey Biryukov 3e19b66f40 Media: Add `aria-describedby` to `img_caption_shortcode()` output to improve image/caption relationship.
Props joedolson.
Fixes #34595.
Built from https://develop.svn.wordpress.org/trunk@42691


git-svn-id: http://core.svn.wordpress.org/trunk@42519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 14:44:30 +00:00
Sergey Biryukov 8df00f0354 Media: Convert concatenation in `img_caption_shortcode()` to `sprintf()` for clarity.
See #34595.
Built from https://develop.svn.wordpress.org/trunk@42690


git-svn-id: http://core.svn.wordpress.org/trunk@42518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 14:17:30 +00:00
Sergey Biryukov f45e696e21 Media: Avoid a PHP warning in `wp_calculate_image_srcset()` if a plugin returns a non-array value via `wp_calculate_image_srcset` filter.
Props mrmadhat, codegrau.
Fixes #43201.
Built from https://develop.svn.wordpress.org/trunk@42639


git-svn-id: http://core.svn.wordpress.org/trunk@42468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-02 07:48:31 +00:00
Sergey Biryukov 13e40181eb Media: Add `flac` to the list of allowed file types.
Props blobfolio.
Fixes #42225.
Built from https://develop.svn.wordpress.org/trunk@42451


git-svn-id: http://core.svn.wordpress.org/trunk@42281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-15 22:17:47 +00:00
Sergey Biryukov 3c4df552ca Docs: Correct `$attachment` parameter type for `wp_prepare_attachment_for_js` filter.
Props danielbachhuber.
Fixes #42449.
Built from https://develop.svn.wordpress.org/trunk@42345


git-svn-id: http://core.svn.wordpress.org/trunk@42174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-01 03:30:47 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Joe McGill d21f6799a6 Customizer: Improve handling of crops in the media library.
This is a follow up on r41732, implementing the following improvements:

* Attachment parent info is now stored in attachment meta rather than a 
separate post meta key.
* Attachments created from contextual crops (e.g. header, logos, etc.) are
filtered out of the media library using a new `_filterContext` method in
`wp.media.controller.Library`.

Props joemcgill, westonruter.
See #21819.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 04:18:47 +00:00
Joe McGill 760f9fd3fd Media: Use max-width for default captions.
This alters the HTML output of the image caption shortcode to use
`max-width` instead of `width` to improve compatibility with
flexible layouts.

Props aaronrutley, desrosj.
Fixes #33981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 02:50:46 +00:00
Sergey Biryukov 2f701f7d0e Media: Rename "Insert Media" window title to "Add Media" for consistency with the "Add Media" button.
Props danieltj.
Fixes #41704.
Built from https://develop.svn.wordpress.org/trunk@41383


git-svn-id: http://core.svn.wordpress.org/trunk@41216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-16 11:03:45 +00:00
Andrew Ozz e38ec0f485 Plupload:
- Update to 2.1.9.
- Include the non-minified plupload.js and moxie.js.
- Remove support for Flash and Silverlight, the available runtime options are `html5` and `html4`.
- Delete plupload.flash.swf and plupload.silverlight.xap.

Fixes #41755.
Built from https://develop.svn.wordpress.org/trunk@41328


git-svn-id: http://core.svn.wordpress.org/trunk@41159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-01 12:28:46 +00:00
Joe McGill bbb8d48086 Media: Prime post caches in 'wp_make_content_images_responsive()'.
In [38296] we replaced `get_post_meta()` with `wp_get_attachment_metadata()`
so that attachment metadata could be consistently filtered. However, this
results in extra post queries which were previously avoided.

This uses `_prime_post_caches()` instead of `update_meta_cache()` to improve
post caching before looping through all images to retrieve attachment metadata.

Props dlh.
Fixes #40490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-25 16:16:46 +00:00
Sergey Biryukov 187b4ad48b Media: Pass shortcode attributes to `wp_audio_shortcode_class` and `wp_video_shortcode_class` filters.
Props sathyapulse.
Fixes #37329.
Built from https://develop.svn.wordpress.org/trunk@41234


git-svn-id: http://core.svn.wordpress.org/trunk@41074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-05 16:42:45 +00:00
James Nylen c91b130b53 REST API: Allow overriding `jQuery.ajax` calls from within wp-admin
There are now 3 places where we call out to the REST API from within wp-admin.  This commit introduces a small library to allow overriding these calls, centralize nonce-passing logic, and eliminate the need to pass a full REST URL down to client code (this last feature is not yet used and will be explored in a separate ticket).

Fixes #40919.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-02 16:45:44 +00:00
Weston Ruter 7af3b92736 Media: Upgrade MediaElement.js from 2.22.0 to 4.2.3.
Props rafa8626, grosbouff, westonruter, azaozz, Plastikschnitzer for testing.
See #39686.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-01 04:43:51 +00:00
Weston Ruter 011d33e95b Media: Restrict appending `loop` parameter to Vimeo URLs specifically and not all external URLs in Video widget (via shortcode).
Fixes issue where Video widgets embedding external files fail to get recognized due to the presence of the `loop` param after the video filename, even though it has a recognized extension. Regardless, the `loop` param is only present to fix a Vimeo issue in ME.js 2.x.

Props timmydcrawford.
Amends [40640].
See #39686, #39994.
Fixes #40977.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-09 19:29:43 +00:00
Weston Ruter 91f544da29 Widgets: Normalize YouTube and Vimeo URLs in `video` shortcode (primarily for Video widget) to work around ME.js 2.22 bug.
Props timmydcrawford, jnylen0, westonruter.
See #32417, #39994.
Fixes #40866.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-26 23:10:44 +00:00
Weston Ruter 3d9e57f534 Media: Remove core embedding support for WMV and WMA files since MediaElement.js has discontinued supporting them.
Plugins may continue to add embedding support for these file formats by re-adding them via the `wp_video_extensions` and `wp_audio_extensions` filters while also implementing fallback rendering routines via the `wp_video_shortcode_override` and `wp_audio_shortcode_override` filters.

See #39994, #39995.
Fixes #40819.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-22 05:39:44 +00:00
Mike Schroder db5091eaa1 Media: Decode HTML entities in `author_name` before sending to JS.
In `wp_prepare_attachment_for_js()`:
- Normalize behavior when author does not exist by returning '(no author)' for `authorName` in these cases.
- Decode HTML entities in `author_name`.
- Add tests for both of the above.

Props arshidkv12, ocean90, sloisel, mikeschroder.
Fixes #39955.
Built from https://develop.svn.wordpress.org/trunk@40809


git-svn-id: http://core.svn.wordpress.org/trunk@40667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-20 02:23:43 +00:00
Joe McGill 2b206fa18d Improve wording of the AYS warning when permanently deleting uploads, tags, posts.
This is a follow up on [40283], which cleans up the wording.

Props azaozz, swissspidy, ocean90.
Fixes #39712.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-12 12:50:42 +00:00
James Nylen 589c4b4b2d REST API: Add endpoint for proxying requests to external oEmbed providers.
This endpoint is a prerequisite for the media widgets work (see https://github.com/xwp/wp-core-media-widgets).

Also use the new endpoint in the media modal instead of the `parse-embed` AJAX action.

Props westonruter, timmydcrawford, swissspidy, jnylen0.
Fixes #40450.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 18:18:46 +00:00
Andrea Fercia 88e515fac0 Accessibility: Improve the suggested image size text in the media views.
Adds `pixels` as unit, avoiding abbreviation for a clearer pronunciation by screen
readers. Also, adds the word `by` instead of the special character `times`.

Props Presskopp, stormrockwell.
Fixes #38932.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-05 23:29:44 +00:00
James Nylen 999c807b88 Media: Default to always showing the "Create Audio/Video Playlist" buttons.
This avoids a couple of expensive queries that attempt to determine whether the media library contains any audio or video items, and also makes the UI for creating playlists more discoverable.

[40382] and [40421] added filters to allow overriding this behavior; this commit changes the default value of the filters to always show these UI buttons and never run the expensive queries.  The old behavior can still be restored using the filters if desired.

Props sboisvert, adamsilverstein, joemcgill, jnylen0.
Fixes #31071.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-14 11:25:43 +00:00
James Nylen 7d8451ff70 Media: Improve filters that allow overriding slow media queries.
As a follow-up to [40382], this commit makes the following improvements:

- Make the filter names more specific.
- Fix the inline documentation (use `@param` instead of `@return).
- Use `null ===` instead of `is_null` to avoid extra function calls.
- Rename the `$has_audio` and `$has_video` variables now that they actually represent something slightly different.

See #31071.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-13 20:22:44 +00:00
James Nylen 5584f22d53 Media: Add filters to allow overriding slow media queries.
There are a couple of queries that do a full table scan of attachment posts to support features of the media library.  Pending a more complete solution, allow overriding these queries via filters.

Props sboisvert, jnylen0.
See #31071.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-06 03:57:45 +00:00
Andrew Ozz 7d34efea8d Improve wording of the AYS warning when permanently deleting uploads, tags, posts.
Props dllh, gma992.
Fixes #39712 for trunk.
Built from https://develop.svn.wordpress.org/trunk@40283


git-svn-id: http://core.svn.wordpress.org/trunk@40195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-11 19:33:43 +00:00
Dion Hulse 30cb64a011 Media: Avoid PHP Warnings in `get_post_galleries()` when processing empty `[gallery]` shortcodes and avoid returning the incorrect results when the global `$post` does not match the provided post ID.
Props dd32, joemcgill, seanchayes.
Fixes #39277, #39304.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 06:46:42 +00:00
John Blackbourn d327c92e4b Docs: Add and correct `@since` docs for a variety of functions and methods.
Props keesiemeijer, chris_dev
Fixes #39343, #39357, #39344
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:21:44 +00:00
Dion Hulse c92e916866 Media: Move a variable definition outside of conditionals to ensure it's always available.
This fixes cases where the URL to a PDF preview may be incorrectly calculated when no thumbnails were generated for the PDF (and avoids a PHP Notice at the same time).

Fixes #39250.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-16 06:21:41 +00:00
Mike Schroder f63c6fd344 Media: Fix regression with display of small images in media library.
Fixes a regression in the media library after [38949], which caused
small images (< thumbnail size) to not display within the media library.

Accounts for images that have no intermediate sizes
in `wp_prepare_attachment_for_js()`.

Adds test.

Fixes #38965.
Props joemcgill, clorith, mikeschroder.
Built from https://develop.svn.wordpress.org/trunk@39396


git-svn-id: http://core.svn.wordpress.org/trunk@39336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-01 00:02:41 +00:00
Joe McGill 37318fe73f Media: Sanity check array value in `wp_prepare_attachment_for_js()`.
This adds a sanity check to the return value of the `image_downsize` filter
in `wp_prepare_attachment_for_js()` to avoid undefined offest notices.

Props justinbusa for initial patch.
Fixes 34437.
Built from https://develop.svn.wordpress.org/trunk@39107


git-svn-id: http://core.svn.wordpress.org/trunk@39049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 02:23:29 +00:00
Mike Schroder a8e304ec8e Media: Add support for rendering PDF thumbnails.
When support for PDFs is available, on upload,
render 'Thumbnail', 'Medium', 'Large', and 'Full' sizes of
the first page, and save them in attachment meta.

Use these renders within Add Media, Media Gallery and List views,
Attachment Details, Post/Attachment Edit screens, and Attachment pages.

Support available by default via Imagick -> ImageMagick -> Ghostscript,
but can be provided by any `WP_Image_Editor` that supports PDFs.

Props adamsilverstein, azaozz, celloexpressions, desrosj, dglingren, ericlewis, ipstenu, joemcgill, joyously, markoheijnen, melchoyce, mikeschroder, tomauger.
Fixes #31050.
Built from https://develop.svn.wordpress.org/trunk@38949


git-svn-id: http://core.svn.wordpress.org/trunk@38892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 07:28:32 +00:00
Joe McGill 8ed022b568 Media: Remove `alt` fallbacks to improve accessibility.
This removes the fallbacks in `wp_get_attachment_image()` and in
`wp.media.string.props` which attempt to generate an `alt` value
from the image caption or title if an `alt` attribute isn't explicitly
set.

This allows for image HTML to be generated that contains an empty `alt`
value, i.e., `alt=""` which is much preferable for screen readers than
reading redundant content in the case of a caption, or when reading the
image title, which is often generated from the filename and not helpful
as `alt` text.

Props odie2, joedolson, rianrietveld, afercia, iamjolly, joemcgill.
Fixes #34635.
Built from https://develop.svn.wordpress.org/trunk@38812


git-svn-id: http://core.svn.wordpress.org/trunk@38755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 03:06:28 +00:00
Andrea Fercia da4da31af1 Administration: Better consistency for the Media, Add Plugins, and Add Themes toolbars.
Fixes the Add Themes toolbar padding. Standardizes the placeholders to no title
case and three trailing dots. Expands the Media search placeholder in
"Search media items..." for consistency with the Plugins and Themes toolbars.

Props mikeviele, jamesacero, mattking5000, koenschipper, dungengronovius.

Fixes #38010.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-14 21:33:28 +00:00
Sergey Biryukov 893f9487d4 Media: Remove an extra space in `style` attribute in `wp_video_shortcode()` after [30082].
Props danielpietrasik.
Fixes #38040.
Built from https://develop.svn.wordpress.org/trunk@38597


git-svn-id: http://core.svn.wordpress.org/trunk@38540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-13 13:45:31 +00:00
Scott Taylor a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor 9383bf8f74 General: use `get_bloginfo( 'version' )` instead of `global $wp_version` in several locations - excluding those locations which reload `version.php` mid-flight.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 05:49:37 +00:00
Boone Gorges d793020f1e Remove unnecessary uniqueness check in `get_attachment_taxonomies()`.
Running the taxonomy array through `array_unique()` is unnecessary
when the function returns objects, because the associative keys already
ensure uniqueness.

This also fixes a bug when running `get_attachment_taxonomies()` in
HHVM, which doesn't like casting objects to strings for the purposes
of `array_unique()`.

Props swissspidy.
See #37368.
Built from https://develop.svn.wordpress.org/trunk@38437


git-svn-id: http://core.svn.wordpress.org/trunk@38378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-30 03:07:34 +00:00
Scott Taylor 390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse 0e31a46161 Bootstrap: Revert [38399] as it's broken `/build/` and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor 6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Scott Taylor a017516291 Media: remove unnecessary variable assignment in `gallery_shortcode()`.
See #37771.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 20:53:29 +00:00
Scott Taylor d31456b615 Media: add a function, `wp_get_additional_image_sizes()`, that wraps the retrieval of the global `$_wp_additional_image_sizes`. Removes 6 global imports.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 04:37:28 +00:00
Scott Taylor b8bfcb0d64 Media: use `wp_get_attachment_metadata()` instead of `get_post_meta()` where appropriate.
Adds unit test.

Props JorritSchippers.
Fixes #36246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-21 06:15:30 +00:00
Boone Gorges 344c88d39f Allow attachment taxonomies to be fetched as objects.
By adding the `$output` parameter to `get_attachment_taxonomies()`, the
function signature matches that of `get_object_taxonomies()`. The change
also allows for more consistent behavior when passing `output=objects`
to `get_object_taxonomies()` for the 'attachment' object type, since
the `$output` parameter is now passed through the function stack.

Props codemovement.pk.
See #37368.
Built from https://develop.svn.wordpress.org/trunk@38292


git-svn-id: http://core.svn.wordpress.org/trunk@38233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-20 17:35:31 +00:00
Joe McGill 28a132dfee Media: Prevent `image_get_intermediate_size()` from returning cropped images.
When `$size` is passed to `image_get_intermediate_size()` as an array of width
and height values and an exact image size matching those values isn't available,
the function loops through the available attachment sizes and returns the
smallest image larger than the requested dimensions with the same aspect ratio.

The aspect ratio check is skipped for the 'thumbnail' size to provide a fallback
for small sizes when no other image option is available. This resulted in a poor
selection when the size requested was smaller than the 'thumbnail' dimensions
but a larger size matching the requested ratio existed.

This refactors the internals of `image_get_intermediate_size()` to ensure the
'thumbnail' size is only returned as a fallback to small sizes once all other
options have been considered, and makes the control flow easier to follow.

This also introduces a new helper function, `wp_image_matches_ratio()` for
testing whether the aspect ratios of two sets of dimensions match. This function
is also now used in `wp_calculate_image_srcset()` during the selection process.

Props flixos, joemcgill.
Fixes #34384, #34980.
Built from https://develop.svn.wordpress.org/trunk@38086


git-svn-id: http://core.svn.wordpress.org/trunk@38027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-18 02:14:29 +00:00
Joe McGill 2ecdbf36cb Media: URL encode spaces in `srcset` attributes.
In some cases, images in the media library may contain spaces in
their filenames. This results in an invalid `srcset` attribute,
causing broken images on the front end. This change fixes the issue
by replacing spaces in URLs with URL encoded '%20' characters before
returning the `srcset` string.

Props underdude, joemcgill.
Fixes #36549.
Built from https://develop.svn.wordpress.org/trunk@38052


git-svn-id: http://core.svn.wordpress.org/trunk@37993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 15:24:55 +00:00
Dominik Schilling 5eae48b414 Boostrap: Move `wp_convert_hr_to_bytes()` to wp-includes/load.php.
`wp_convert_hr_to_bytes()` was previously defined in wp-includes/media.php because it's only used by `wp_max_upload_size()` in the same file.
Moving this function to load.php allows us to improve core's memory limit handling.

See #32075.
Built from https://develop.svn.wordpress.org/trunk@38012


git-svn-id: http://core.svn.wordpress.org/trunk@37953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 11:27:27 +00:00
Joe McGill 7e5885b874 Media: Don't use 'full' as array key in `wp_calculate_image_srcset()`.
In `wp_calculate_image_srcset()` we get an array of image sizes
associated with an attachment and then add the original image's
information to the array before processing the `srcset`. In doing
so, we set the original data to a `$image_sizes['full']` key, which
could stomp on any custom image sizes using `full` as a size name.

This avoid the issues by adding the original data without a named
key, which is never referenced anyway.

Props jaspermdegroot.
Fixes #36345.
Built from https://develop.svn.wordpress.org/trunk@37986


git-svn-id: http://core.svn.wordpress.org/trunk@37927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 14:05:29 +00:00
Sergey Biryukov e64b88cb34 Media: Avoid PHP notices when trying to show a parent post title of an orphaned post type.
Props littler.chicken.
See #37186.
Built from https://develop.svn.wordpress.org/trunk@37952


git-svn-id: http://core.svn.wordpress.org/trunk@37893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-04 19:34:28 +00:00
Helen Hou-Sandí 20b329ba08 Media: Only show parent post titles when the user can read said post.
fixes #37186.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-01 15:07:36 +00:00
Dominik Schilling 4e403b2752 Media: Pass allowed file extensions to Plupload.
Plupload's `mime_types` filter (http://www.plupload.com/docs/Options#filters.mime_types) allows us to inform a user about an unsupported file before the file gets uploaded.

Props polevaultweb.
Fixes #14244.
Built from https://develop.svn.wordpress.org/trunk@37727


git-svn-id: http://core.svn.wordpress.org/trunk@37693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-16 15:39:28 +00:00
Drew Jaynes bef05b469b Docs: Standardize DocBlock summaries for hooks that serve to "print" something to use third-person singular verbs.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 16:05:27 +00:00
Ella Iseulde Van Dorpe 2934f338cf Media: unhide audio fallback
Introduced in [28182].
Fixes #36888.


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


git-svn-id: http://core.svn.wordpress.org/trunk@37524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 13:33:29 +00:00
Drew Jaynes d28f1a08ef Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:01:27 +00:00
Drew Jaynes eb83bf3700 Docs: Standardize filter docs in wp-includes/media.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:32:27 +00:00
Andrew Ozz d508fcdb51 Responsive Images: the `src` of the image has to be first in the `srcset`, because of a bug in iOS8. Update the unit tests to reflect the changes.
Props jaspermdegroot, joemcgill, azaozz.
Fixes #35030.
Built from https://develop.svn.wordpress.org/trunk@37034


git-svn-id: http://core.svn.wordpress.org/trunk@37001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-18 19:45:26 +00:00
John Blackbourn 5330f669f2 Media: When generating the base URL to be used in the `srcset` attribute, use an `https` scheme when the image base URL's host matches that of the current host, and the request is being served over HTTPS. This prevents mixed content warnings caused by `http` embedded media.
See #34945
Props joemcgill

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


git-svn-id: http://core.svn.wordpress.org/trunk@36989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 22:49:26 +00:00
Dominik Schilling 7f4b93e61e Responsive images: Skip images with a missing `$image_meta['file']` value.
Props joemcgill.
See [37002].
Fixes #35480.
Built from https://develop.svn.wordpress.org/trunk@37018


git-svn-id: http://core.svn.wordpress.org/trunk@36985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 17:48:26 +00:00
Andrew Ozz effedfdff4 Responsive images: do not attempt to create srcset when the image meta is missing or corrupted.
Props overclokk, jaspermdegroot, joemcgill.
Fixes #35480.
Built from https://develop.svn.wordpress.org/trunk@37002


git-svn-id: http://core.svn.wordpress.org/trunk@36969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 02:18:25 +00:00
Dominik Schilling 7e8e3429e1 Media: Change wording for media files which aren't attached.
The media library can contain files which aren't attached yet. When attaching a file you currently get "Media attachment reattached.", or the opposite "Media attachment detached.". That's redundant and can be inaccurate. It's also not easy to translate in some languages.

This change generalizes the strings to refer to a "media file" instead.

Props SergeyBiryukov, ocean90, netweb.
Fixes #36089.
Built from https://develop.svn.wordpress.org/trunk@36887


git-svn-id: http://core.svn.wordpress.org/trunk@36854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-08 17:43:25 +00:00
Andrew Ozz 2d94e025a2 Replace `wp_upload_dir()` with the new `wp_get_upload_dir()` in all cases where a file is not being uploaded. Deprecate `_wp_upload_dir_baseurl()`, and replace it with `wp_get_upload_dir()`.
See #34359.
Built from https://develop.svn.wordpress.org/trunk@36569


git-svn-id: http://core.svn.wordpress.org/trunk@36536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 00:24:27 +00:00
Rachel Baker cf0288e291 Media: Fix inline docs typo inside `wp_calculate_image_srcset()` function.
mathces -> matches.

Props neoxx.

Fixes #35714.
Built from https://develop.svn.wordpress.org/trunk@36517


git-svn-id: http://core.svn.wordpress.org/trunk@36484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-12 18:15:30 +00:00
Pascal Birchler fdb6bbfa10 Media: After [36240], remove some unneeded whitespace.
Props ocean90.
See #35367.
Built from https://develop.svn.wordpress.org/trunk@36241


git-svn-id: http://core.svn.wordpress.org/trunk@36208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 14:29:26 +00:00
Pascal Birchler 8ee945d82f Media: Fix `wp_audio_shortcode` and `wp_video_shortcode` attributes handling.
Although documented, the `class` and `style` attributes were simply ignored.
Adds unit tests.

Fixes #35367.
Built from https://develop.svn.wordpress.org/trunk@36240


git-svn-id: http://core.svn.wordpress.org/trunk@36207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 14:18:27 +00:00
Andrew Ozz d03333735f Responsive images: fix the check whether the attachment meta matches the image src to work with http/https and CDNs.
Props webaware, joemcgill, azaozz.
Fixes #35045 and #35102 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36121


git-svn-id: http://core.svn.wordpress.org/trunk@36087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-30 01:04:27 +00:00
Andrew Ozz 597bbf0318 Responsive images: add compatibility for versions < 2.7 when the full image path was stored in the metadata. Introduces `_wp_get_attachment_relative_path()` and uses it in `wp_get_attachment_url()`.
Props dd32, SergeyBiryukov.
Fixes #35106 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36120


git-svn-id: http://core.svn.wordpress.org/trunk@36086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-30 00:06:28 +00:00
Andrew Ozz 698b825760 Responsive images: when creating `srcset` do not exclude the image size which is in the `src` attribute even when it is larger than `max_srcset_image_width`.
Props joemcgill.
Fixes #35108 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36110


git-svn-id: http://core.svn.wordpress.org/trunk@36075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-28 02:29:28 +00:00
Andrew Ozz 6e49a963b1 Responsive images: fix calculations when determining whether to include particular image file in `srcset`.
Props joemcgill.
Fixes #34955 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36031


git-svn-id: http://core.svn.wordpress.org/trunk@35996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-20 02:39:32 +00:00
Mike Schroder 6f3da8d57b Media: Don't generate responsive image attributes if `src` does not match ID in `wp-image-` class.
We rely on the `wp-image-` class to quickly find an attachment ID to add responsive image attributes.
To avoid incorrect images being displayed, do not add these attributes if the `src` does not match the
meta from the attachment ID in the class.

Props azaozz, kovshenin, joemcgill.
Fixes: #34898.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-07 20:08:51 +00:00
Ella Iseulde Van Dorpe 657d3b50af Make date format consistent across the admin
The 'date_format' and 'time_format' options shouldn't affect the backend.

See #30864


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


git-svn-id: http://core.svn.wordpress.org/trunk@35775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-07 04:26:27 +00:00
Scott Taylor 9b5ffe8062 Responsive Images: Currently images are included in the `srcset` if the aspect ratio difference is smaller than `0.01`. This number is too high, set it to `0.002`
Props joemcgill.
Fixes #34810.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-01 20:58:24 +00:00
Scott Taylor eaae2546f5 Media: don't use `get_media_embedded_in_content()` in `wp_make_content_images_responsive()`.
Adds unit test.

Props azaozz.
Fixes #34807.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-01 20:50:25 +00:00
Sergey Biryukov bc1e479fd0 After [35718], update the location of some files in `This filter is documented in` docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Sergey Biryukov 4341637ba6 Docs: Remove redundant `type` strings from the `wp_calculate_image_srcset` filter DocBlock.
Props DH-Shredder, joemcgill.
See #34733.
Built from https://develop.svn.wordpress.org/trunk@35716


git-svn-id: http://core.svn.wordpress.org/trunk@35680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 06:16:26 +00:00
Sergey Biryukov db4a87b0fd Docs: Add `@see` tags for `wp_get_attachment_image_srcset()` and `wp_get_attachment_image_sizes()`.
Update `@see` tags for `wp_make_content_images_responsive()` and `wp_image_add_srcset_and_sizes()`.

Props jaspermdegroot.
See #34733.
Built from https://develop.svn.wordpress.org/trunk@35715


git-svn-id: http://core.svn.wordpress.org/trunk@35679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 06:13:26 +00:00
Drew Jaynes b10a946c2c Docs: Clarify some parameter and return descriptions in the DocBlocks for `wp_get_attachment_image_srcset()` and `wp_calculate_image_srcset()`, `wp_get_attachment_image_sizes()`, and the `wp_calculate_image_srcset` filter.
Props joemcgill.
See #34733.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 22:44:27 +00:00
Scott Taylor 13ea469061 Media: when making images responsive, check if they already have a `sizes` attribute.
Adds unit test.

Props jaspermdegroot.
Fixes #34678.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:48:26 +00:00
Drew Jaynes 3a45270a43 Docs: Properly mark optional parameters as such in the DocBlock and function signature for `wp_calculate_image_sizes()`.
Also updates the subsequent hook docs for the `wp_calculate_image_sizes` filter.

Props joemcgill.
Fixes #34612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 18:53:27 +00:00
Drew Jaynes a90d108b82 Docs: Remove an empty line from the hook doc for the `wp_calculate_image_srcset` filter, introduced in [35592].
Props kraftbj.
See #34612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-10 17:15:29 +00:00
Drew Jaynes c98b62c452 Docs: Fix some formatting in the hook doc for the `wp_calculate_image_srcset` filter and clarify the summary.
See #34612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-09 23:34:27 +00:00
Andrew Ozz 7d0aa3a54a Responsive images: properly arrange the parameters for the `wp_calculate_image_srcset` filter and add fix the inline documentation.
Props joemcgill.
Fixes #34612.
Built from https://develop.svn.wordpress.org/trunk@35591


git-svn-id: http://core.svn.wordpress.org/trunk@35555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-09 23:30:26 +00:00
Andrew Ozz 1b44ae6663 Responsive images: make the new functions and filters signatures more consistent.
Props joemcgill.
Fixes #34612.
Built from https://develop.svn.wordpress.org/trunk@35569


git-svn-id: http://core.svn.wordpress.org/trunk@35533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 21:36:27 +00:00
Scott Taylor e649fabb6a Accessibility: add missing `alt` attributes to a gaggle of `<img>`s.
Props afercia.
Fixes #34583.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 16:12:27 +00:00
Andrew Ozz 72a1124c45 Responsive images: omit full size images from srcset attributes when the original file is an intermediate sized GIF so we don't accidentally add animation to an otherwise flat image. Update the tests to cover this case.
Props joemcgill, H-Shredder, SergeyBiryukov.
Fixes #34528.
Built from https://develop.svn.wordpress.org/trunk@35561


git-svn-id: http://core.svn.wordpress.org/trunk@35525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 02:10:25 +00:00
Andrew Ozz 09c16cb4ac Responsive images: do not generate `srcset` for GIFs that are inserted at full size. Prevents breaking animated GIFs.
Props joemcgill.
Fixes #34528.
Built from https://develop.svn.wordpress.org/trunk@35524


git-svn-id: http://core.svn.wordpress.org/trunk@35488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 21:44:25 +00:00
Andrew Ozz 9e436c7e0f Responsive images:
- Fix `_wp_upload_dir_baseurl()` to cache by blog_id.
- Replace `path_join()` with `trailingslashit()`, it's much faster.
- Rename $image_url to $image_src for consistency (used at about 50 other places).
- Couple of tests fixes.

See #34430.
Built from https://develop.svn.wordpress.org/trunk@35498


git-svn-id: http://core.svn.wordpress.org/trunk@35462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 00:22:26 +00:00
Andrew Ozz ea3d7c7962 Responsive images:
- More fixes to inline docs.
- Replace the last `wp_get_attachment_metadata()` with `get_post_meta()`.
- For consistency only accept array or named size in `wp_get_attachment_image_sizes()`.

Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35491


git-svn-id: http://core.svn.wordpress.org/trunk@35455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-03 00:19:28 +00:00
Andrew Ozz 26b6acd081 Responsive images: add `$image_url` parameter to `wp_get_attachment_image_sizes()` and use it in the filter. This allows themes and plugins to identify the image.
Props joemcgill.
Fixes #34477.
Built from https://develop.svn.wordpress.org/trunk@35481


git-svn-id: http://core.svn.wordpress.org/trunk@35445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 22:49:24 +00:00
Scott Taylor d8eacd51d8 Media: add a new image size, `medium_large`. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 20:50:25 +00:00
Andrew Ozz 8edcfabf9c Responsive images: few more inline docs fixes.
Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35465


git-svn-id: http://core.svn.wordpress.org/trunk@35429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-30 23:36:25 +00:00
Andrew Ozz 2021bc0da2 Responsive images:
- Merge `wp_image_srcset_attr()` into `wp_calculate_image_srcset()`.
- Remove the `wp_image_srcset` filter.
- Fix the tests for the above changes. 

See #34430.
Built from https://develop.svn.wordpress.org/trunk@35464


git-svn-id: http://core.svn.wordpress.org/trunk@35428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-30 23:27:24 +00:00
Andrew Ozz d7da5970fa 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
2015-10-28 21:55:24 +00:00
Andrew Ozz fd11ef9c45 Responsive images:
- Check if wp_get_attachment_metadata() has returned an array to prevent errors when using SVGs.
- Only add the srcset attribute if there will be a sizes attribute.
- Better filter names.
- Some more inline docs fixes.

Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35419


git-svn-id: http://core.svn.wordpress.org/trunk@35383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-28 20:01:26 +00:00
Andrew Ozz 61d21cc0d9 Responsive images:
- Introduce `wp_calculate_image_srcset()` that replaces `wp_get_attachment_image_srcset_array()` and is used as lower level function for retrieving the srcset data as array.
- Use the new function when generating `srcset` and `sizes` on the front-end. This is faster as no (other) image API functions are used.
- Change the `wp_get_attachment_image_srcset()`. Now it is meant for use in templates and is no longer used in core.
- A few logic fixes and improvements.
- Some names changed to be (hopefully) more descriptive.
- Fixed/updated tests.

Props joemcgill, jaspermdegroot, azaozz.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35412


git-svn-id: http://core.svn.wordpress.org/trunk@35376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-28 05:41:24 +00:00
Sergey Biryukov 1acf9e9e49 After [35402], don't unnecessary run `wp_get_attachment_metadata()`, `wp_get_attachment_image_srcset()`, and `wp_get_attachment_image_sizes()` in `wp_img_add_srcset_and_sizes()`.
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35405


git-svn-id: http://core.svn.wordpress.org/trunk@35369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 18:42:24 +00:00
Sergey Biryukov 1e59e53dd2 After [35402], don't unnecessary run `wp_get_attachment_image_srcset()` and `wp_get_attachment_image_sizes()` in `wp_get_attachment_image()` if `srcset` is passed as an argument.
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35404


git-svn-id: http://core.svn.wordpress.org/trunk@35368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 18:40:24 +00:00
Sergey Biryukov f5d0260e4d Remove assignments from conditions in `wp_get_attachment_image()` and `wp_img_add_srcset_and_sizes()`.
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35402


git-svn-id: http://core.svn.wordpress.org/trunk@35366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 16:29:26 +00:00
Sergey Biryukov 64a79eeffa Docs: After [34453], correct inline comments in `wp_get_attachment_image_sizes()`.
Props jaspermdegroot.
Fixes #34453.
Built from https://develop.svn.wordpress.org/trunk@35401


git-svn-id: http://core.svn.wordpress.org/trunk@35365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 16:17:25 +00:00
Andrew Ozz 902f0f1a98 Responsive Images: fix typo in r35358.
Props aduth.
See #34341.
Built from https://develop.svn.wordpress.org/trunk@35378


git-svn-id: http://core.svn.wordpress.org/trunk@35342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-23 17:38:25 +00:00
Andrew Ozz dfc2412be1 Responsive Images: limit the size of images included in `srcset` attributes. Introduce `max_srcset_image_width` filter to adjust the limit.
Props joemcgill.
Fixes #34341.
Built from https://develop.svn.wordpress.org/trunk@35358


git-svn-id: http://core.svn.wordpress.org/trunk@35324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-22 19:31:25 +00:00
Scott Taylor 318ad90a22 Media: in `wp_get_attachment_image_sizes()`, to streamline and for performance:
* Change the 3rd arg from `args` to `width`
* Change `wp_image_sizes_args` filter to `wp_get_attachment_image_sizes`

Updates unit tests.

Props joemcgill.
Fixes #34379.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-22 16:46:24 +00:00
Drew Jaynes 81524f3bfc Filesystem: Following the introduction of the `KB|MB|GB|TB_IN_BYTES` constants in [35286], use them in various places in core.
Props sudar.
Fixes #22405.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-21 14:03:25 +00:00
Drew Jaynes 3686b78448 Media: Introduce the `image_get_intermediate_size` filter to its like-named function, making it possible to manipulate returned intermedia image size data.
Covers both the default and meaningful short-circuit return cases. Also adds a hash notation to the return documentation in the DocBlock.

Props A5hleyRich, DH-Shredder, wonderboymusic.
Fixes #34124.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 07:24:27 +00:00
Scott Taylor 443ce28304 Media: in `wp_get_attachment_image_sizes()`, ensure that `$img_width` exists when the image does not.
Props kraftbj.
See #33641.


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


git-svn-id: http://core.svn.wordpress.org/trunk@35216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-17 22:12:24 +00:00
Drew Jaynes d4711aff8a Docs: Fix a typo in an inline comment in `wp_get_attachment_image_srcset_array()`.
Props neoxx.
Fixes #34319.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 20:52:24 +00:00
Scott Taylor affe1ab5ad Media: avoid "divide by zero" in `wp_get_attachment_image_srcset_array()`.
Fixes #34238.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 21:00:26 +00:00
Drew Jaynes 2d677edb1f Docs: The `$size` parameter for the `get_image_tag` hook also accepts an array.
See #34257. See [35038].

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


git-svn-id: http://core.svn.wordpress.org/trunk@35043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:11:24 +00:00
Drew Jaynes 36ef44735d Docs: The `$size` parameter for the `get_image_tag_class` hook also accepts an array.
See #34257. See [35037].

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


git-svn-id: http://core.svn.wordpress.org/trunk@35042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:09:25 +00:00
Drew Jaynes d4fe129e1a Docs: Adjust the order of 'width' and 'height' (for consistency) for the `$crop` parameter documentation in `image_make_intermediate_size()`.
Props jaspermdegroot.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:06:24 +00:00
Drew Jaynes 8b26e5debc Docs: Adjust the order of 'width' and 'height' (for consistency) for the `$crop` parameter documentation in `image_resize_dimensions()`.
Also similarly adjusts the `$crop` parameter description in the corresponding `image_resize_dimensions` hook doc.

Props jaspermdegroot.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:02:24 +00:00
Drew Jaynes e0529ebdb5 Docs: Adjust the order of 'width' and 'height' (for consistency) for the `$crop` parameter documentation in `set_post_thumbnail_size()`.
Props jaspermdegroot.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:00:26 +00:00
Drew Jaynes 771248a1f3 Docs: Adjust the order of 'width' and 'height' (for consistency) for the `$crop` parameter documentation in `add_image_size()`.
Props jaspermdegroot.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:59:25 +00:00
Drew Jaynes d0a392a34c Docs: Adjust documentation for the `$size` parameter in `adjacent_image_link()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:53:25 +00:00
Drew Jaynes 81f67bae13 Docs: Adjust documentation for the `$size` parameter in `next_image_link()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:50:24 +00:00
Drew Jaynes 141b096f6d Docs: Adjust documentation for the `$size` parameter in `previous_image_link()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:48:25 +00:00
Drew Jaynes 1571907571 Docs: Normalize spacing in the `$attr` hash notation for `gallery_shortcode()` following [35045].
See #34257. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:46:24 +00:00
Drew Jaynes e4f9e334ea Docs: Adjust documentation for the `$size` argument in `gallery_shortcode` to clarify the required order of width and height values when passing an array.
Also adds the `array` type to the argument documentation.

Props jaspermdegroot.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:43:25 +00:00
Drew Jaynes 9d5d27c26d Docs: Adjust documentation for the `$size` parameter in `wp_get_attachment_image_url()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:39:25 +00:00
Drew Jaynes 987fe676a9 Docs: Adjust documentation for the `$size` parameter in the `wp_get_attachment_image_attributes` hook doc to clarify the required order of width and height values when an array is passed.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:38:24 +00:00
Drew Jaynes 5631df0151 Docs: Adjust documentation for the `$size` parameter in `wp_get_attachment_image()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:36:24 +00:00
Drew Jaynes c02b132fcc Docs: Adjust documentation for the `$size` parameter in the `wp_get_attachment_image_src` hook doc to clarify the required order of width and height values when an array is passed.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:34:24 +00:00
Drew Jaynes 8f3f5dba35 Docs: Adjust documentation for the `$size` parameter in `wp_get_attachment_image_src()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:31:24 +00:00
Drew Jaynes 50fd2488f4 Docs: Adjust documentation for the `$size` parameter in `image_get_intermediate_size()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:29:24 +00:00
Drew Jaynes 5a0eaa17de Docs: Adjust documentation for the `$size` parameter in the `get_image_tag` hook doc to clarify the required order of width and height values when an array is passed.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:27:25 +00:00
Drew Jaynes 698b5f6880 Docs: Adjust documentation for the `$size` parameter in the `get_image_tag_class` hook doc to clarify the required order of width and height values when an array is passed.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:26:25 +00:00
Drew Jaynes 71932de1f5 Docs: Adjust documentation for the `$size` parameter in `get_image_tag()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:21:25 +00:00
Drew Jaynes 3f8aaf753a Docs: Adjust documentation for the `$size` parameter in the `image_downside` hook doc to clarify the required order of width and height values when an array is passed.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:20:23 +00:00
Drew Jaynes 45174a8996 Docs: Adjust documentation for the `$size` parameter in `image_downsize()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:18:24 +00:00
Drew Jaynes 7c25ad0613 Docs: Adjust documentation for the `$size` parameter in `image_constrain_size_for_editor()` to clarify the required order of width and height values when passing an array.
See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:16:24 +00:00
Drew Jaynes 1e2caf6712 Docs: Update an inline comment in `wp_get_attachment_image_sizes()`, which came in as part of the Responsive Images merge in [34855].
Props joemcgill.
See #33641.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 17:47:24 +00:00
Scott Taylor 99be7beda0 Merge the Responsive Images feature plugin into core, initial commit. See: https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/
New functions in `media.php`:
* `wp_get_attachment_image_srcset_array()` - Returns an array of image candidate string data used to build a `srcset` value for an attachment given an `$attachement_id` and `$size`.
* `wp_get_attachment_image_srcset()` - Returns the `srcset` value for an attachment given an `$attachement_id` and `$size`.
* `wp_get_attachment_image_sizes()` - Returns the `sizes` value for an attachment given an `$attachement_id` and `$size` and optional arguments used to alter its output.
* `wp_make_content_images_responsive()` - A display filter for adding `srcset` and `sizes` to images embedded in content.
* `wp_img_add_srcset_and_sizes()` - A utility function used by `wp_make_content_images_responsive()` to add `srcset` and `sizes` to a single `<img>` element.

Modifies existing core functions:
* Modify `wp_get_attachment_image()` so the HTML returned for an image includes `srcset` and `sizes`.
* Modify `get_media_embedded_in_content()` (sup, 3.6 leftover) by adding `<img>` to the list of accepted tags that can be matched in content. This is used in `wp_make_content_images_responsive()` to find all of the images embedded in content before passing them off to `wp_img_add_srcset_and_sizes()`.

Tests:
* Add a new factory method to `WP_UnitTest_Factory_For_Attachment` named `create_upload_object()`
* Adds unit tests
* Updates unit tests

Props joemcgill, tevko, jaspermdegroot, mdmcginn, barryceelen, peterwilsoncc, fsylum, wonderboymusic, chriscoyier, benjaminpick, jrfnl, #12kingkool68, janhenckens, ryanmarkel, side777, ryelle, wturrell, micahmills, mattbagwell, coliff, DrewAPicture.
See #33641.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 04:59:24 +00:00
Scott Taylor d96fb9def9 Embeds: move some functions from `media.php` to a new file, `embed-functions.php`, via `svn cp`
See #32522.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 03:59:24 +00:00
Scott Taylor 6cde1a05cb After [34629], use `$size_class` instead of `$size`.
See #32093.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-28 02:50:24 +00:00
Scott Taylor 1b6ed5cbb7 Add `size-$size` class to `<img>` in `wp_get_attachment_image()`.
Fixes #32093.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-27 17:54:27 +00:00
John Blackbourn aa35e473f7 `callback` is not a valid type in PHP, PSR-5, or phpDocumentor. `callable` should be used instead.
Fixes #34032

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


git-svn-id: http://core.svn.wordpress.org/trunk@34530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 23:58:25 +00:00
Scott Taylor 8cc5a142e4 Media Modal: move the translation strings for `insertIntoPost` and `uploadedToThisPost` to the `get_post_type_labels()` array as `insert_into_item` and `uploaded_to_this_item`.
Props flixos90.
Fixes #33616.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 03:22:24 +00:00
Scott Taylor d165b25920 Include fourth array parameter in return value doc block for `wp_get_attachment_image_src()`.
Props kadamwhite.
Fixes #33905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 03:14:24 +00:00
Scott Taylor 2ddc1d2f3a Media: Add a new function, `wp_get_attachment_image_url()`, which is a shortcut for `wp_get_attachment_image_src()` - same function signature, but returns just the URL based on `$size`.
Adds unit test.

Props dipesh.kakadiya, swissspidy, sebastian.pisula.
Fixes #33878.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 04:13:27 +00:00
Drew Jaynes bbae198372 Docs: Add a more complete return description for the array of data (or false) returned by `image_downsize()`.
If not short-circuited via the `image_downsize` boolean filter, `image_downsize()` returns an array of data including the image URL, width, height, and whether the image size is intermediate, in that order. Otherwise, it returns false.

Fixes #30636.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-21 10:22:26 +00:00
Scott Taylor 1f3dce8c75 Media: Ensure that HTML5 captions apply the `'img_caption_shortcode_width'`.
Props joemcgill.
Fixes #31053.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 06:04:24 +00:00
Scott Taylor ad0eb9c442 Media: In `wp_prepare_attachment_for_js()`, don't call `file_exists()` and `filesize()` to retrieve `$bytes` if the data is already present in `$meta`. This is how the same code in `attachment_submitbox_metadata()` already works.
Props polevaultweb.
Fixes #33214.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 05:03:24 +00:00
Scott Taylor 191400f9e6 Don't ever use the `guid` value when retrieving URLs for media, use `wp_get_attachment_url()`. Use `get_attached_file()` for path to file.
Fixes #33386.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 02:50:25 +00:00
Nikolay Bachiyski 3778cae8ec Shortcodes: don't allow unclosed HTML elements in attributes
Built from https://develop.svn.wordpress.org/trunk@34134


git-svn-id: http://core.svn.wordpress.org/trunk@34102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 22:36:24 +00:00
Scott Taylor c1bb5b5ce3 After [33843], update the location of some files in `This filter is documented in` docs
Props dimadin.
See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-08 22:17:26 +00:00
Sergey Biryukov bffe6a63ba Make curly quotes in playlist item title translatable.
fixes #33391.
Built from https://develop.svn.wordpress.org/trunk@33844


git-svn-id: http://core.svn.wordpress.org/trunk@33812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-01 13:50:21 +00:00
Scott Taylor 0d3f30ba61 Improve the reliability of the crop returned by `image_get_intermediate_size()`.
Add a bunch of unit tests to `tests/image/intermediate_size.php`.

Props joemcgill, ericlewis, kitchin, SergeyBiryukov, chipbennett.
Fixes #17626.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-30 02:41:21 +00:00
Scott Taylor 42b6ac80e7 Ensure that `attachment_url_to_postid()` matches cross-scheme when front-end and back-end schemes are different.
Adds unit test.

Props welcher.
Fixes #33109.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-22 16:39:25 +00:00
Scott Taylor b19bb99853 Playlists, for `.wp-playlist-item-title` elements: move the curly quotes to CSS pseudo-element `content`, making them easier to override or remove.
Fixes #33391.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-19 05:51:25 +00:00
Helen Hou-Sandí d22adb0d6e Ensure the caption shortcode outputs a valid HTML ID.
fixes #33179.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 17:59:24 +00:00
Scott Taylor 2b513bf60a `wp_audio|video_shortcode()` doesn't allow you to pass `id`, the docs shall reflect that.
Props thorbrink.
See #32855.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 15:01:26 +00:00
Konstantin Obenland 8e57bef0ee After [32866], change filter name.
While filter names generally don't have to be tied to the function in which they 
are applied, the API for media display generally seems to use the
`wp_get_attachment_*` pattern.

Props DrewAPicture.
Fixes #32363.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 03:47:24 +00:00
Scott Taylor 747b1eb713 After [32866], fix doc blocks.
Props DrewAPicture.
See #32363.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 21:02:25 +00:00
Scott Taylor 3b88c839f9 In `wp_prepare_attachment_for_js()`, when setting `filename`, call `wp_basename()` on the result of `get_attached_file()`, not `WP_Post->guid`. `guid` can be set to the result `get_permalink()`, which is not a file path.
Props daxelrod.
Fixes #32531.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-23 18:30:26 +00:00
Scott Taylor ec6dfc7f2b Add a filter in `wp_get_attachment_image_src()` called `attachment_image_src`.
Props eclev91, MikeHansenMe.
Fixes #32363.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 21:27:25 +00:00
Scott Taylor b126a0144f In the `youtube_embed_url` embed handler, make `embed` a non-capturing group that alternately matches for `v` - YouTube supports both URL paths.
Add unit test cases.

Props dmchale for some patch work.
Fixes #32161.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 00:35:25 +00:00
Sergey Biryukov 3fc78a1109 Avoid a PHP notice in `wp_enqueue_media()` if `$post` is null.
see #19257.
Built from https://develop.svn.wordpress.org/trunk@32675


git-svn-id: http://core.svn.wordpress.org/trunk@32645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 21:54:25 +00:00
John Blackbourn ff3f2ac243 Remove an embed handler accidentally introduced in r32673.
Built from https://develop.svn.wordpress.org/trunk@32674


git-svn-id: http://core.svn.wordpress.org/trunk@32644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 16:56:26 +00:00
John Blackbourn 02192cb53f Introduce `featured_image`, `set_featured_image`, `remove_featured_image`, and `use_featured_image` post type labels when registering a post type in order to override the 'Featured Image' text and its related phrases.
Props johnbillion, mordauk, valendesigns.
Fixes #19257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 16:54:27 +00:00
Scott Taylor 4bf8e158ec Fix doc blocks for `media*.php`
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 19:23:25 +00:00
Dominik Schilling 5294e0e655 Rename `get_media_embedded_in_content_allowed` filter to `media_embedded_in_content_allowed_types`.
The new name fits better with some other `_allowed_` filters.

props DrewAPicture.
fixes #26675.
Built from https://develop.svn.wordpress.org/trunk@32113


git-svn-id: http://core.svn.wordpress.org/trunk@32092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 21:49:27 +00:00
Drew Jaynes 8652208375 Remove unneeded spaces in the hook doc for the `attachment_url_to_postid` filter.
See [31867]. See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 16:07:27 +00:00
Andrew Ozz d94050aafa Introduce `attachment_url_to_postid` filter to let plugins manage the uploads location better.
Props mattwiebe. Fixes #31717.
Built from https://develop.svn.wordpress.org/trunk@31867


git-svn-id: http://core.svn.wordpress.org/trunk@31846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-23 17:24:30 +00:00
Drew Jaynes 9c1283b28f Add hook documentation for the `get_media_embedded_in_content_allowed` filter, introduced in [31574].
Props valendesigns.
Fixes #26675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-20 19:29:27 +00:00
Scott Taylor 8f0b626d13 Introduce a function, `wp_attachment_is( $type, $post = 0 )`, to collapse the logic for determining whether an attachment is an `image`, `audio`, or `video`.
This is admittedly a first pass. There needs to be a generic handler for when any other type is passed, but for now it accepts the whitelist.

See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:26:26 +00:00
Scott Taylor 295af37bd0 Improve `get_media_embedded_in_content()` so that it returns the media it finds in the same order that it appears in the content.
Adds unit test, updates another.

Props kopepasah.
See #26675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 16:11:25 +00:00
Drew Jaynes 46286070a5 Clarify a wide variety of function, parameter, and return descriptions in DocBlocks throughout wp-includes/media.php.
Props stevegrunwell, DrewAPicture.
Fixes #28408.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-24 07:42:24 +00:00
Drew Jaynes ac4aae99e6 Add changelog entries to the `post_gallery` and `post_playlist` hook docs for the `$instance` variable that was added in [31304].
Props ninnypants for the initial patch.
Fixes #31151.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-31 00:33:22 +00:00
Sergey Biryukov 5289e92ef5 Rename `$instances` to `$instance` in wp_audio_shortcode() and wp_video_shortcode() for consistency with gallery_shortcode() and wp_playlist_shortcode().
see #31151.
Built from https://develop.svn.wordpress.org/trunk@31305


git-svn-id: http://core.svn.wordpress.org/trunk@31286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-30 16:06:22 +00:00
Sergey Biryukov fa86f3ef9c Pass the current shortcode instance ID to `post_gallery` and `post_playlist` filters.
props justincwatt.
fixes #31151.
Built from https://develop.svn.wordpress.org/trunk@31304


git-svn-id: http://core.svn.wordpress.org/trunk@31285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-30 16:02:21 +00:00
Sergey Biryukov 247cdad571 attachment_url_to_postid() should always return an integer.
props nathan_dawson, ashfame.
fixes #31044.
Built from https://develop.svn.wordpress.org/trunk@31239


git-svn-id: http://core.svn.wordpress.org/trunk@31220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-18 20:33:23 +00:00
Scott Taylor fc843ce4d0 There are some random `add_action()` and `add_filter()` calls littered around some files in `wp-includes/`. These should be moved to `wp-includes/default-filters.php` with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even `SHORTINIT` - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Sergey Biryukov 24b3ee8680 Make a hint on Edit Selection view in media modal more accurate, as it applies to all media files, not just images.
props pavelevap.
see #30931.
Built from https://develop.svn.wordpress.org/trunk@31102


git-svn-id: http://core.svn.wordpress.org/trunk@31083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 21:24:23 +00:00
Scott Taylor 4feecb922c Use `&&` instead of `and` in the 3 places where `and` was used.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 21:12:22 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Scott Taylor a5593a64d3 More-specific docs for `wp_embed_handler_youtube()`.
Fixes #30711.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-01 19:21:27 +00:00
Scott Taylor 952a5c9971 Support chromeless Vimeo via MEjs:
* Bump MediaElement script loader versions to 2.16.2 - missed in [30634], oops!
* Add `Froogaloop` to `js/mediaelement` scripts for Vimeo
* Check for Vimeo in the same locations that YouTube is checked
* Dynamically load Froogaloop script in admin when editing a TinyMCE view
* Edit MediaElement to call `mejs.$.extend` instead of `$.extend` in `mejs.HtmlMediaElementShim.createPlugin()`, since `$` is not available via WP's jQuery (I will report this upstream):
6f9a78e008/src/js/me-shim.js (L631)

Fixes #29267.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-31 20:41:24 +00:00
Scott Taylor 5eb5afac34 For clarity, initialize some arrays that previously were only assigned via short circuit in loops.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 22:47:22 +00:00
Scott Taylor a0df295f5c Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:24:25 +00:00
Scott Taylor ce05e4932f Use `round()` instead of `floor()` when resizing image dimensions.
Updates unit tests.

Props SergeyBiryukov, kitchin.
Fixes #18532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 19:54:23 +00:00
Drew Jaynes bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00
Drew Jaynes 2f6c0d5e96 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
2014-11-30 10:06:23 +00:00
Scott Taylor 5352f51516 Fix edge-case in media cropping where selection and destination are the same size.
Adds unit tests.

Props mboynes.
Fixes #19793.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 06:27:23 +00:00
Drew Jaynes 1e10385a90 Remove an invalid parameter from the DocBlock for the `gallery_style` hook.
Props keesiemeijer.
Fixes #30507.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 05:58:47 +00:00
Drew Jaynes c512f1d916 Remove return descriptions from the DocBlocks for `add_image_size()` and `set_post_thumbnail_size()` as they don't return anything.
Also document the `$_wp_additional_image_sizes` global, leveraged in `add_image_size()`.

Props stevegrunwell.
Fixes #30511.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 05:49:23 +00:00
Drew Jaynes b8c612ca1c Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Markdown-indent a code snippet in the file header for wp-admin/install-helper.php
* Add markdown formatting and two inline `@see` tags to the description for `translate()`
* Markdown-indent a code snippet in the description for `_n_noop()`
* Remove HTML tags from the summary for `get_media_embedded_in_content()`
* Remove an HTML tag from the summary for `wpview_media_sandbox_styles()`

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 05:47:23 +00:00
Sergey Biryukov 8f2842a07e Replace invalid use of ltrim() in attachment_url_to_postid() with substr().
props bradyvercher.
fixes #30346.
Built from https://develop.svn.wordpress.org/trunk@30501


git-svn-id: http://core.svn.wordpress.org/trunk@30490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-21 06:35:22 +00:00
Andrew Nacin c2f334bf3c Playlists are video by default. props duck_
Built from https://develop.svn.wordpress.org/trunk@30422


git-svn-id: http://core.svn.wordpress.org/trunk@30417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 13:11:23 +00:00
Dominik Schilling 52f51d65ae Media: Remove another unused string.
props pavelevap.
see #29741.
Built from https://develop.svn.wordpress.org/trunk@30342


git-svn-id: http://core.svn.wordpress.org/trunk@30341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-14 17:46:22 +00:00
Dominik Schilling f34d3b1b5a Media: Remove unused string.
props pavelevap.
fixes #29741.
Built from https://develop.svn.wordpress.org/trunk@30341


git-svn-id: http://core.svn.wordpress.org/trunk@30340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-14 17:31:23 +00:00
Scott Taylor 15c062eb79 In `wp_audio|video_shortcode()`, make sure that `autoplay` and `loop` are booleans. Passing `'false'` to them will force them to be active, which is bad.
Fixes #29825.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 05:03:21 +00:00
Scott Taylor cd9bb04981 In `gallery_shortcode()`, when the `link` attribute is equal to `file`, make sure to pass `$attr` as the 6th (!) argument, not 5th, to `wp_get_attachment_link()`.
Props bradyvercher.
Fixes #27402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 21:47:24 +00:00
Drew Jaynes 66c47f29bb Correct references of `@uses $wpdb` in core documentation to use `@global`.
See #30191, [30105].
Fixes #30217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes f8657d5890 Remove redundant and erroneous `@uses` tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Scott Taylor 3d8e31fb82 Don't hardcode `height` for videos - this was a workaround for MediaElement internals causing problems. Responsive videos now work properly and don't cause extra whitespace.
Fixes MediaElement by hand in the interim: https://github.com/johndyer/mediaelement/pull/1337
Video playlists were completely broken by this.

Fixes #30078.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 00:47:24 +00:00
Scott Taylor 5d17d2bd28 The `gallery` shortcode used to accept a SQL chunk for the value of the `orderby` attribute. The reason? `get_posts()` used to be called in the shortcode handler with a query-string blob of arguments passed to it. To mitigate breakage, `sanitize_sql_orderby()` was created in [7592].
`sanitize_sql_orderby()` expects a comma to be present when multiple `orderby` values were passed. The correct syntax for multiple fields is space-delimited. Since [29027], comma-separated values would never be parsed correctly when passed to `WP_Query->parse_orderby()`.

`sanitize_sql_orderby()` is used nowhere else in core, save for the `playlist` shortcode - I only added it there because I was mimic'ing the `gallery` logic. The function call can be removed from both shortcode handlers.
 
See #6476.
Fixes #23873.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 20:43:22 +00:00
Gary Pendergast 007ec52958 Add `wp_json_encode()`, a wrapper for `json_encode()` that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:35:19 +00:00
Scott Taylor 72d12b514d Add a 6th (!) attribute to `wp_get_attachment_link()` to allow `aria-describedby` to be added to gallery output.
Props joedolson, DrewAPicture, rianrietveld.
Fixes #27402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-16 04:28:17 +00:00
Sergey Biryukov 45062d7f5c Update @param docs for wp_get_attachment_image().
see #29869.
Built from https://develop.svn.wordpress.org/trunk@29837


git-svn-id: http://core.svn.wordpress.org/trunk@29601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 17:52:15 +00:00
Sergey Biryukov d769e29279 Pass the requested size to 'wp_get_attachment_image_attributes' filter.
props mattheu.
fixes #29869.
Built from https://develop.svn.wordpress.org/trunk@29836


git-svn-id: http://core.svn.wordpress.org/trunk@29600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 17:50:16 +00:00
Andrew Ozz 7a55ab9164 Media: disable multi-file uploading in iOS 7.x Safari as it prevents uploading of videos. Fixes #29602 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29776


git-svn-id: http://core.svn.wordpress.org/trunk@29548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 00:14:18 +00:00
Sergey Biryukov 10e0807cce Add context for 'Trash' string in media modal.
props pavelevap.
fixes #29739.
Built from https://develop.svn.wordpress.org/trunk@29764


git-svn-id: http://core.svn.wordpress.org/trunk@29536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-24 13:49:20 +00:00
Scott Taylor ee9d74dc05 Ordering by `RAND()`:
The shortcode callbacks for `gallery` and `playlist` check for `'RAND' == $atts['order']`, which isn't a valid value for `order`. Remove those checks and update the docs.

In `WP_Query`, if the value of `orderby` is `rand`, `order` is irrelevant and should be unset.

Adds unit tests.

Fixes #29629.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-23 03:52:15 +00:00
Sergey Biryukov 2008fc0c89 Correct 'wp_get_attachment_image_attributes' filter docs.
props tillkruess.
fixes #29701.
Built from https://develop.svn.wordpress.org/trunk@29750


git-svn-id: http://core.svn.wordpress.org/trunk@29522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-18 12:36:17 +00:00
Andrew Ozz 69e7171f41 Media: revert enabling of multi-file uploading for mobile devices. Currently only iOS Safari supports it but has a bug that prevents uploading of videos. Fixes #29602
Built from https://develop.svn.wordpress.org/trunk@29729


git-svn-id: http://core.svn.wordpress.org/trunk@29503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-10 22:40:16 +00:00
Sergey Biryukov 0113d3457b Avoid PHP notices in media modal caused by orphaned attachments.
fixes #29566 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29724


git-svn-id: http://core.svn.wordpress.org/trunk@29498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-09 10:03:14 +00:00
Andrew Nacin e496cc6e4b Media: Ensure media-views is enqueued and registered before localizing.
fixes #24724.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 19:36:16 +00:00
Andrew Ozz 703b625820 Media: add a class to the <script> tag for the JSON encoded playlist data so it can be easily selected in WPPlaylistView. Props SergeyBiryukov, fixes #29383
Built from https://develop.svn.wordpress.org/trunk@29660


git-svn-id: http://core.svn.wordpress.org/trunk@29434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-01 19:55:18 +00:00
Helen Hou-Sandí 72593add22 Media grid: Don't show a misleading message for an empty library.
This uses the existing string from the list table. We should revisit a better overall experience for the two situations (empty library vs. search with no results) in 4.1.

props voldemortensen.
fixes #29404.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-01 18:39:17 +00:00