Commit Graph

789 Commits

Author SHA1 Message Date
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