Commit Graph

643 Commits

Author SHA1 Message Date
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
Scott Taylor
149346ff6e MCE View sandboxes:
* Use a `MutationObserver` to listen to the `body` class of the parent editor frame.
* In `wpview_media_sandbox_styles()`, only return the MEjs stylesheets.
* In `wp_ajax_parse_media_shortcode()` and `wp_ajax_parse_embed()`, return an object instead of an HTML blob to allow passing `body` and `head` separately	

Props avryl, azaozz.
Fixes #29048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 04:46:15 +00:00
Scott Taylor
d6213d64a5 After [29543], the iframe sandboxes for media need to load Open Sans. Playlists look aggressively bad without it. Adds font styles for the body.
See #29048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-21 03:36:16 +00:00