Commit Graph

302 Commits

Author SHA1 Message Date
Mark Jaquith 1b83157127 Give themers tangible, user-friendly template functions to take full advantage of structured post formats.
* the_audio()
* the_video()
* the_image()
* get_the_media()

Also introduces:

* get_the_extra_content()
* the_extra_content()

Those two functions are like their non-extra versions, except that they
will have any post-format bits extracted. e.g. It's an image post, for
which the_image() will extract an <img /> tag. the_extra_content() will
output the content *without* that image.

props wonderboymusic. Herculean effort. fixes #23572

git-svn-id: http://core.svn.wordpress.org/trunk@23819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-27 18:34:59 +00:00
Helen Hou-Sandí b2f0b89062 Add a generic `get_attached_media()` function and use it in get_attached_audio|video|images. Add filters for the query args and resulting array. fixes #23843.
git-svn-id: http://core.svn.wordpress.org/trunk@23776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-22 08:08:46 +00:00
Mark Jaquith 026d8847b4 Add functions to parse audio or video data out of arbitrary content or a post
props wonderboymusic. see #23572

git-svn-id: http://core.svn.wordpress.org/trunk@23774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-22 05:55:08 +00:00
Mark Jaquith 6966294e55 Add functions to extract images from posts in various forms
props wonderboymusic. fixes #22960

git-svn-id: http://core.svn.wordpress.org/trunk@23772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-22 05:20:38 +00:00
Mark Jaquith 53d12e91bc Introduce [audio] and [video] shortcodes, and use MediaElement.js to play them.
props wonderboymusic. see #23282.

git-svn-id: http://core.svn.wordpress.org/trunk@23729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-16 05:25:44 +00:00
Sergey Biryukov 11229adad7 Add phpdoc for $attr argument of wp_get_attachment_image(). props GaryJ. fixes #23791.
git-svn-id: http://core.svn.wordpress.org/trunk@23714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-15 17:19:10 +00:00
Sergey Biryukov 2e4d128fe0 Add orientation information to gallery items. props obenland. fixes #23695.
git-svn-id: http://core.svn.wordpress.org/trunk@23649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-08 16:13:15 +00:00
Andrew Nacin c3a174becd Add shortcode_atts_$shortcode filter for when the name of the shortcode is passed to shortcode_atts(). props coffee2code. fixes #15155.
git-svn-id: http://core.svn.wordpress.org/trunk@23626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-06 20:07:40 +00:00
Sergey Biryukov bc2ff9d342 Deprecate wp_convert_bytes_to_hr() in favor of size_format(). props F J Kaiser. fixes #19067.
git-svn-id: http://core.svn.wordpress.org/trunk@23439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-16 03:07:56 +00:00
Sergey Biryukov 6bcd1665eb Add missing inline descriptions. see #19067.
git-svn-id: http://core.svn.wordpress.org/trunk@23437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-16 02:52:57 +00:00
Sergey Biryukov 3d3a2a7692 Return from image_downsize() earlier if a custom resize function is used. props anatolbroder. fixes #23392.
git-svn-id: http://core.svn.wordpress.org/trunk@23410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 04:30:55 +00:00
Andrew Nacin bd7b6a52b1 Verify tags used in the gallery shortcode.
git-svn-id: http://core.svn.wordpress.org/trunk@23316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-22 15:36:57 +00:00
Andrew Nacin 2428b370a2 Media: Pass thumbnail and medium sizes to image_constrain_size_for_editor() to force constraints based on the current DB options for those sizes. History: see #22598, #22738.
props jond3r.
see #23102.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:52:18 +00:00
Andrew Nacin c95ff91fe7 Media: Restore 3.4 behavior by consulting the old-school DB options for default align, size, and link properties.
This restores linking to media files as the default, over attachment pages. This 'default' cannot currently be changed by a user setting (per 3.4 behavior), due to the default database schema.

see #22841, for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:02:16 +00:00
Andrew Nacin 61bfa78509 Limit the execution of wp_enqueue_media() to once per page. Prevents multiple _wpMediaViewsL10n variables. see #22843.
git-svn-id: http://core.svn.wordpress.org/trunk@23214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-27 16:07:12 +00:00
Helen Hou-Sandí c8db0f0777 Correct phpdoc @since for wp_oembed_remove_provider(). props hebbet. fixes #22788.
git-svn-id: http://core.svn.wordpress.org/trunk@23186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:22:21 +00:00
Ryan Boren fe8a8c9af4 Introduce previous_image_link and next_image_link filters. Allows customizing the gallery display order.
Props nacin
fixes #22829 for trunk


git-svn-id: http://core.svn.wordpress.org/trunk@23139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-09 19:54:23 +00:00
Andrew Nacin c665bf6ff3 A neditor is a curious multi-celled organism found deep in the Content Management System "WordPress". It generally subsides on good content. It has an obsession with retina-quality graphical elements, and also has a strong affinity for puns. Occasionally, ACCIDENTAL CAPS LOCK occurs. Some organisms carry British accents; these are prone to changing state but then reverting to their previous state soon after. One has shown superior sleuthing abilities, despite having hardly left its Uni laboratory. Organisms from Australia are usually found deeper in the Content Management System, most of its energy spent on locomotion.
The attitude of a neditor is best described as cranky optimism. Younger organisms are more eager, but quickly tire after working on little sleep. They eventually evolve into the cranky optimism stage in a process that generally takes three to five months.



git-svn-id: http://core.svn.wordpress.org/trunk@23105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 09:01:11 +00:00
Andrew Nacin 34e2ed377a Break wp_print_media_templates() into wp-includes/media-template.php and lazy-load that file through wp_enqueue_media(). fixes #22778.
git-svn-id: http://core.svn.wordpress.org/trunk@23101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 07:10:20 +00:00
Mark Jaquith 1aca97360e Remove the "Describe this ___" string on captions in the attachment details view. WP <3 patches with net red. props helenyhou. fixes #22777
git-svn-id: http://core.svn.wordpress.org/trunk@23097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 06:35:13 +00:00
Mark Jaquith d5eafd1b1f Present the correct downsized image dimensions in the Media modal when inserting. Introduces a context parameter for image_constrain_size_for_editor() instead of relying on is_admin(). props jond3r, nacin. fixes #22738
git-svn-id: http://core.svn.wordpress.org/trunk@23096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 06:25:39 +00:00
Mark Jaquith 1419b404a8 Add the ability to click "Edit" and kick out to the advanced image editor from within the Media modal. New window, with "Refresh" offered on your return. fixes #22743. props koopersmith, nacin, helenyhou.
git-svn-id: http://core.svn.wordpress.org/trunk@23095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 05:52:19 +00:00
Andrew Nacin e09094434e Restore captions for non-image attachments. see #22759.
git-svn-id: http://core.svn.wordpress.org/trunk@23087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 03:36:17 +00:00
Andrew Nacin 173806d7a1 Restore the Description field to the media UI in 3.5.
We tried in vain -- a noble but ultimately failed effort -- to reduce the number of fields for attachments from four (title, caption, alt, description) to one (caption for images, title otherwise). Alternative text needed to stay for accessibility reasons, of course.

Eventually title returned due to heavy plugin reliance. Description is too used by too many plugins (often times incorrectly -- the caption is more likely the proper field), hence its less-than-triumphant return today.

Version 3.5 has tried to streamline media in a number of ways. Removing fields may have been too much at once, as it forced not only a user interface change, but a paradigm change as well.

Finally, on upload we populate the description field with IPTC/EXIF captions, rather than the caption field. See #22768, this should be fixed. For now, Description stays.

This commit also restores 'Title' attribute editing to the main tab of the Edit Image dialog. The "Title" field no longer populates title attributes for <img> tags by design (for accessibility and other purposes, see #18984). So, here is a more obvious 'workaround' for the tooltip community.

Finally, this:
 * Cleans up the post.php attachment editor, including by showing a prettier form of the mime type.
 * Enables plugins to specifically hide attachment_fields_to_edit from either post.php (where you can create meta boxes) or the modal (which you may not want to clutter), for compatibility reasons.
 * Hides the 'Describe this file...' placeholder when a field is read-only in the modal.

props nacin, helenyhou.
fixes #22759.



git-svn-id: http://core.svn.wordpress.org/trunk@23083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 00:41:06 +00:00
Andrew Nacin 88f61468b3 Media: Final names for the actions in the dialog sidebar: "Insert from URL" and "Set Featured Image" to go with "Insert Media" and "Create Gallery".
Longer strings (such as a translation) looks excellent when it wraps to another line.

props markjaquith, fixes #22753.



git-svn-id: http://core.svn.wordpress.org/trunk@23076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 19:07:48 +00:00
Andrew Nacin c42ae7acb6 Media: Use '%d selected' for the selection string, and offer a comment to translators to help them find a workable solution with this would-be plural string. fixes #22749. see #22229.
git-svn-id: http://core.svn.wordpress.org/trunk@23075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 19:03:38 +00:00
Mark Jaquith bc8ddb3e64 Intelligently make media fields readonly when the user cannot update or do anything with them. props koopersmith, helenyhou, nacin. fixes #22613
git-svn-id: http://core.svn.wordpress.org/trunk@23072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 10:29:24 +00:00
Andrew Nacin 49fd122391 Media IE7 fixes. props azaozz, lessbloat. fixes #22732.
git-svn-id: http://core.svn.wordpress.org/trunk@23061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 03:15:53 +00:00
Andrew Nacin b20c0a5bd5 Image editor doc fixes. props DH-Shredder. see #6821.
git-svn-id: http://core.svn.wordpress.org/trunk@23038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 19:42:28 +00:00
Ryan Boren a200c702e0 Only show Delete in media modal if the user can delete.
Props nacin, koopersmith
fixes #22711


git-svn-id: http://core.svn.wordpress.org/trunk@23032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 18:33:51 +00:00
Andrew Nacin f2f9551287 Add context to the 'Random' string. It is now used in two places: gallery order and the links widget. props pavelevap, fixes #22724.
git-svn-id: http://core.svn.wordpress.org/trunk@23021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 14:49:44 +00:00
Andrew Nacin 6b1a66ac22 Media: Remove four unused strings. props dimadin. fixes #22688.
git-svn-id: http://core.svn.wordpress.org/trunk@23011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 04:16:56 +00:00
Andrew Nacin 156c5fef0f Media: When an image does not have all image sizes available, make sure we insert the requested size into the editor. props koopersmith. fixes #22693.
git-svn-id: http://core.svn.wordpress.org/trunk@23008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 04:04:45 +00:00
Ryan Boren 61a9471024 Final round of media UX improvements.
Props koopersmith
fixes #21390 #22502


git-svn-id: http://core.svn.wordpress.org/trunk@23006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 01:26:03 +00:00
Ryan Boren 63662a9b7b In the QuickPress media modal, use the new post id when a post is published.
Props nacin, koopersmith
fixes #22673


git-svn-id: http://core.svn.wordpress.org/trunk@22994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 07:17:10 +00:00
Ryan Boren c06ffe745f Show a spinner when attachment details are saved.
Props koopersmith
see #22613


git-svn-id: http://core.svn.wordpress.org/trunk@22991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 06:37:49 +00:00
Ryan Boren 23ed804180 Add random and reverse sorting options to gallery settings.
Props koopersmith
fixes #22637


git-svn-id: http://core.svn.wordpress.org/trunk@22987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 05:32:25 +00:00
Andrew Nacin db0ef72326 Media: Prevent the compat view from wrapping around the attachment details. Allow the filename to break-word. props koopersmith, SergeyBiryukov. fixes #22667.
git-svn-id: http://core.svn.wordpress.org/trunk@22983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 04:15:32 +00:00
Andrew Nacin 5d0933d884 Bring Featured Images back into the main media dialog.
Most users don't realize that the Featured Image meta box exists; if they do, few use it.

Restores the old meta box UI, including the admin_post_thumbnail_html filter. If a plugin is using _wp_post_thumbnail_html() in conjunction with Thickbox elsewhere, it will also magically still work.

Specific underlying changes:
 * Converts the modal view to use the view manager, which means that a call to open() will automatically call render and attach if necessary.
 * Doesn't automatically set a state in wp.media, to allow code to customize the states to be added before activation.

props koopersmith.
fixes #21776.



git-svn-id: http://core.svn.wordpress.org/trunk@22979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 02:38:10 +00:00
Daryl Koopersmith 336feff008 Prevent small thumbnails from being upscaled. props helenyhou. fixes #22681.
git-svn-id: http://core.svn.wordpress.org/trunk@22978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 00:42:26 +00:00
Andrew Nacin 36dedb38d1 Media templates: Make sure we have a width and height before printing dimensions. We don't calculate dimensions for icons. fixes #22680.
git-svn-id: http://core.svn.wordpress.org/trunk@22976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-02 21:53:45 +00:00
Andrew Nacin 1fd29d4b4c Add wp_enqueue_media action to the function of the same name. props koopersmith, fixes #22678.
git-svn-id: http://core.svn.wordpress.org/trunk@22969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-02 16:33:20 +00:00
Andrew Nacin 27bf82201b Allow the 'Uploaded to this post' view to be sorted, saving the resulting order as menu_order.
This functionality is designed to be backwards compatible with manual querying for attachments by menu_order.

props koopersmith.
see #22607.



git-svn-id: http://core.svn.wordpress.org/trunk@22967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-02 16:06:31 +00:00
Ryan Boren d4abd95449 Scope button classes so they can be used on the frontend without interfering with theme styles.
Props helenyhou, koopersmith
fixes #22644


git-svn-id: http://core.svn.wordpress.org/trunk@22948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-30 13:40:59 +00:00
Ryan Boren 27d943786b Introduce API to add back the description field in the new media popup.
Props nacin
fixes #22642


git-svn-id: http://core.svn.wordpress.org/trunk@22929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-29 23:52:30 +00:00
Ryan Boren ce2c38fda6 Icons for select, deselect, and window close in the media modal.
Props JerrySarcastic, helenyhou, ocean90, lessbloat
fixes #22610


git-svn-id: http://core.svn.wordpress.org/trunk@22920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-29 14:36:12 +00:00
Ryan Boren ea0d28db29 Route uploads through async-upload.php instead of admin-ajax.php.
Props nacin, koopersmith
fixes #22622


git-svn-id: http://core.svn.wordpress.org/trunk@22902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 20:17:57 +00:00
Andrew Nacin 38b46e44ea Media: Rename the dialog to 'Add Media' from 'Insert Media' to match the button. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 17:18:50 +00:00
Andrew Nacin 09d59a0255 In the gallery shortcode, handle mapping of "ids" to include and orderby before the post_gallery filter. see #21816. fixes #22617.
git-svn-id: http://core.svn.wordpress.org/trunk@22891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 03:51:27 +00:00
Andrew Nacin 32c57c6b6a Media: Remove the link to the browser uploader. The only need for it is large files (> 100MB) in certain browsers (IE, Opera), so we will show the link then only. fixes #22604.
git-svn-id: http://core.svn.wordpress.org/trunk@22889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 02:28:10 +00:00