Commit Graph

680 Commits

Author SHA1 Message Date
Gary Pendergast
a779284c00 General: Reformat inline if () statements inside HTML tags.
This pattern occurs a handful of times across the codebase:

`<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">`

Unfortunately, it doesn't really play nicely with `phpcbf`, so all instances need to be removed in preperation for auto code formatting.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-23 04:09:49 +00:00
Gary Pendergast
0847fab645 Media: Don't backdate media uploaded to pages.
When media is uploaded to a post, the upload directory is set according to the date of the post, so that the media URLs in the post match when the post was published.

A page is a slightly different beast, pages often live for years, and are regularly updated to stay relevant. This change causes media uploaded to pages to use the upload date to determine the upload directory.

Fixes #10752.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-21 13:27:48 +00:00
Mike Schroder
e8a1a7ab2b Media: Store video creation date in meta.
When able to be parsed, store the created date for a video file from meta,
since this is useful separately from the dates on the file itself.

Introduces `wp_get_media_creation_timestamp()` to read the timestamp from
getID3 and a `wp_read_video_metadata` filter analogous to
`wp_read_image_metadata`.

Fixes #35218.
Props stevegrunwell, joemcgill, desrosj, blobfolio, mikeschroder.
Built from https://develop.svn.wordpress.org/trunk@41746


git-svn-id: http://core.svn.wordpress.org/trunk@41580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 19:32:47 +00:00
Sergey Biryukov
d379f839cf Posts, Post Types: Pass $post parameter to post_submitbox_start, attachment_submitbox_misc_actions, media_submitbox_misc_sections, audio_submitbox_misc_sections filters.
Props sebastian.pisula, SergeyBiryukov.
Fixes #36206.
Built from https://develop.svn.wordpress.org/trunk@41581


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

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


git-svn-id: http://core.svn.wordpress.org/trunk@41159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-01 12:28:46 +00:00
Joe McGill
682ec35fbc Media: Ensure 'media_handle_upload()' returns 'WP_Error' on failure.
This fixes an issue where failures when inserting the attachment post via
`wp_insert_attachment()` would result in a return value of `0` instead of a
`WP_Error` object, as documented. This is addressed by passing `true` as the 
fourth param (added in WP 4.7.0) when calling `wp_insert_attachment()`.

Props mrasharirfan, flixos90.
Fixes #41726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-30 15:04:48 +00:00
Mike Schroder
391145df30 Media: Optionally return attachment id from media_sideload_image().
Introduces option to `$return` parameter to return the attachment id created after a successful image sideload.

Props slbmeh, kawauso, alexkingorg, SergeyBiryukov, georgestephanis, DrewAPicture, nacin, trepmal, mattheu, kraftbj, whyisjake, dotancohen, MrGregWaugh, danielbachhuber.
Fixes #19629.
Built from https://develop.svn.wordpress.org/trunk@40597


git-svn-id: http://core.svn.wordpress.org/trunk@40467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-09 23:26:42 +00:00
Joe McGill
4e1f22bf78 Fix broken audio/video functions when sanitizing ID3 data
This fixes a bug where running `wp_kses_post_deep()` on all the ID3
tag data corrupted blob data.

Fixes #40075, #40085.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-10 01:28:47 +00:00
Jeremy Felt
28f838ca3e Validate video and audio metadata.
Built from https://develop.svn.wordpress.org/trunk@40148


git-svn-id: http://core.svn.wordpress.org/trunk@40087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 08:01:43 +00:00
John Blackbourn
c2d709e9d6 I18n: Introduce more translator comments for strings that contain placeholders but don't have an accompanying translator comment.
See #38882

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


git-svn-id: http://core.svn.wordpress.org/trunk@39266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 02:46:30 +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
eed325bbc2 Media: Improve docs for image_send_to_editor filter.
This updates inline docs for the `image_send_to_editor` filter to better
describe when it is fired.

Props adamsilverstein.
Fixes #34823.
Built from https://develop.svn.wordpress.org/trunk@38734


git-svn-id: http://core.svn.wordpress.org/trunk@38677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-05 19:57:28 +00:00
Joe McGill
498040b809 Media: Use wp_basename() to create attachment titles from filenames.
In [38294], `pathinfo()` was used with the `PATHINFO_BASENAME` constant to
get the basename of the file to be used as an attachment title, which depends
on PHP locale and can cause issues with UTF-8 characters. This uses
`wp_basename()` instead, which is a more i18n-friendly version of `basename()`.

Props SergeyBiryukov.
Fixes #37608, #37989.
Built from https://develop.svn.wordpress.org/trunk@38673


git-svn-id: http://core.svn.wordpress.org/trunk@38616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-29 01:21:31 +00:00
Andrea Fercia
eeefec932f Administration: Improve the usage of the button CSS classes.
Introduces some consistency in the usage of the button CSS classes, fixes the
focus style for accessibility and responsiveness of the buttons.

- Adds the `button` class to all primary buttons make them responsive
- Removes all `secondary-button` classes and replaces it with button when needed. `button-secondary` shouldn't be used and exists just for backward compatibility reasons
- Replaces classes inside `submit_button()` with a shorthand for some buttons, and use an empty string for the default `button` class. Passing `button` is unnecessary
- Adjusts `get_submit_button()` to remove empty items

Props iseulde, dimchik, chris_d2d, mhowell, afercia.
Fixes #27314, #37138, #37448.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-28 19:54:28 +00:00
Aaron Campbell
405def3da4 Media: Improved media titles when created from filename.
Preserves spaces and generally creates more accurate, cleaner titles from filenames of uploaded media.

Props joemcgill.
Fixes #37989.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-17 05:42:31 +00:00
Jeremy Felt
c9e60dab17 Media: Sanitize upload filename.
Built from https://develop.svn.wordpress.org/trunk@38538


git-svn-id: http://core.svn.wordpress.org/trunk@38481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-07 13:55:36 +00:00
Scott Taylor
0eebbed6b2 General: revert [38467], wp_is_IE() should not exist.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 15:22:31 +00:00
Scott Taylor
021e23e70b General: use a new function, wp_is_IE(), instead of the $is_IE global in a number of places.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 06:42:33 +00:00
Drew Jaynes
22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Scott Taylor
7ac88c02fa Media: when calling pathinfo(), also pass a PATHINFO_* constant to avoid array notices for unset keys.
Props JaworskiMatt.
Fixes #37608.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-20 23:36:28 +00:00
Drew Jaynes
31f150080a Docs: Standardize references to "meta box" or "meta boxes" as two distinct words throughout core documentation per the core spelling guide.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-10 00:56:28 +00:00
Drew Jaynes
7eb6471461 Docs: Fix minor formatting and syntax for wp-admin/* elements introduced in 4.6.
See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-09 14:00:31 +00:00
Pascal Birchler
a5580012a3 Docs: Fix a typo across some function and hook docs.
s/filterss/filters.

See #32246.
Built from https://develop.svn.wordpress.org/trunk@37961


git-svn-id: http://core.svn.wordpress.org/trunk@37902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-04 22:45:29 +00:00
Dominik Schilling
25e66e4f1e Text Changes: Unify permission error messages.
The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.
Built from https://develop.svn.wordpress.org/trunk@37914


git-svn-id: http://core.svn.wordpress.org/trunk@37855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 15:16:29 +00:00
Joe McGill
04117fc392 Docs: Add missing variable reference for wp_edit_form_attachment_display.
This adds the missing `$post` reference in the inline docblock for
the `wp_edit_form_attachment_display` hook after [37879].

Props DrewAPicture.
See 36052.
Built from https://develop.svn.wordpress.org/trunk@37880


git-svn-id: http://core.svn.wordpress.org/trunk@37821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-27 01:54:30 +00:00
Joe McGill
f82e7ed434 Media: Add action to display attachments on the edit screen.
This adds a new action hook, `wp_edit_form_attachment_display` to
`edit_form_image_editor()`, which can be used as a fallback to render
previews of an attachment that isn't an image, audio, or video file
included in the media library.

Props georgestephanis.
Fixes #36502.
Built from https://develop.svn.wordpress.org/trunk@37879


git-svn-id: http://core.svn.wordpress.org/trunk@37820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 22:37:27 +00:00
Drew Jaynes
1947f4d17c Docs: Apply inline @see tags to hooks referenced in DocBlocks for wp-admin/* 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@37537


git-svn-id: http://core.svn.wordpress.org/trunk@37505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 17:28:27 +00:00
Drew Jaynes
c3055cc190 Docs: Standardize hook docs in wp-admin/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:01:30 +00:00
Drew Jaynes
ac74c103a8 Docs: Fix some parameter alignment and backtick-escaping in two DocBlocks in wp-admin/includes/media.php.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:18:27 +00:00
Drew Jaynes
c0d7dece23 Docs: Remove invalid inline @link tags from docs in wp-admin/includes/media.php.
See #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:10:26 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Sergey Biryukov
e081720b67 Docs: Fix typo in get_image_send_to_editor() description.
Props yoavf.
See #36349.
Built from https://develop.svn.wordpress.org/trunk@37194


git-svn-id: http://core.svn.wordpress.org/trunk@37160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 07:28:28 +00:00
Andrew Ozz
d47a15ed3c Media: fix erroneously inserting a rel attribute in get_image_send_to_editor(). Reverts most of [34259] and [34260] and adds a unit test.
Props joemcgill, azaozz.
Fixes #36084.
Built from https://develop.svn.wordpress.org/trunk@37035


git-svn-id: http://core.svn.wordpress.org/trunk@37002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-18 20:05:26 +00:00
Andrea Fercia
34ab7ae5ac Accessibility: Remove the title attributes from the old Media UI.
Also, adds better indication and attributes for the required form fields.
Moves some styles to `deprecated-media.css`.

Props andg, afercia.
Fixes #34944.
Built from https://develop.svn.wordpress.org/trunk@36879


git-svn-id: http://core.svn.wordpress.org/trunk@36846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-07 22:29:26 +00:00
Andrea Fercia
aaa040eee9 CSS: Rename the handle for deprecated-media.css after [36341].
The `media` handle is now used for `media.css` thus the stylesheet
for the old media UI needs a different handle name.

See #35229.
Built from https://develop.svn.wordpress.org/trunk@36869


git-svn-id: http://core.svn.wordpress.org/trunk@36836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-06 15:38:28 +00:00
John Blackbourn
a5d44337b2 Docs: @param fixes for a variety of docblocks.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 01:45:26 +00:00
Andrea Fercia
ae1575bd80 Media: make the Image Editor usable with a keyboard.
For accessibility, all interactive controls must be operable from the keyboard.
Replaces `<div>`s used as UI controls with buttons. Groups some logically-related
form elements.

Fixes #28864.
Built from https://develop.svn.wordpress.org/trunk@36223


git-svn-id: http://core.svn.wordpress.org/trunk@36190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-08 19:13:26 +00:00
John Blackbourn
4836d6c700 Correct the position of the $alt parameter's @param doc in image_add_caption().
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@35882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 03:01:25 +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
f2e9e98fa6 Media: in media_send_to_editor(), use wp_json_encode() instead of addslashes().
Props TobiasBg.
Fixes #22135.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:40:27 +00:00
Andrea Fercia
862cf19772 Media: Improve form fields labels association in the Edit Media screen.
Fixes #34548.
Built from https://develop.svn.wordpress.org/trunk@35493


git-svn-id: http://core.svn.wordpress.org/trunk@35457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-03 16:02:25 +00:00
Sergey Biryukov
1c21783283 Don't use <code> in translatable string in wp-admin/includes/media.php.
Add translator commment.

Props ramiy.
Fixes #34499.
Built from https://develop.svn.wordpress.org/trunk@35439


git-svn-id: http://core.svn.wordpress.org/trunk@35403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-30 00:58:24 +00:00
Sergey Biryukov
654cb6542f Docs: Correct the type and description of $post parameter passed to the attachment_fields_to_save filter.
Props swissspidy.
Fixes #34404.
Built from https://develop.svn.wordpress.org/trunk@35374


git-svn-id: http://core.svn.wordpress.org/trunk@35338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-23 13:01:25 +00:00
Helen Hou-Sandí
f3107e5842 Make some primary action buttons look primary.
* User deletion/removal
* Site status change (multisite)
* Network upgrade
* Import file upload
* Media browser upload

props Dezzy for the initial patch.
fixes #23738.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 03:08:24 +00:00
Drew Jaynes
217b661703 Docs: Add missing descriptions for the $wpdb global in DocBlocks all the places.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Drew Jaynes
8b49acdd0e Docs: Specify the default image size in the $size parameter description for the image_send_to_editor hook.
See #34257. See #32246. See [35058].

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


git-svn-id: http://core.svn.wordpress.org/trunk@35045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:18:24 +00:00
Drew Jaynes
f7e92fc346 Docs: Normalize spacing in the DocBlock for get_image_send_to_editor() following [35056].
See #34257. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:16:24 +00:00
Drew Jaynes
9f5d887934 Docs: Normalize spacing in the image_send_to_editor hook doc following [35058].
See #34257. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:19:23 +00:00
Drew Jaynes
c12f0caefd Docs: Adjust documentation for the $size parameter in the image_send_to_editor hook doc to clarify the required order of width and height values when an array is passed.
Also adds the `array` type to the parameter documentation (already supported).

See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:17:24 +00:00
Drew Jaynes
4aea111b29 Docs: Fix syntax and properly mark optional parameters as such in the DocBlock for get_image_send_to_editor().
Also fixes the return description, and adds the `$size` default value, missed in [35055].

See #34257. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:11:24 +00:00
Drew Jaynes
16738bf325 Docs: Adjust documentation for the $size parameter in get_image_send_to_editor() to clarify the required order of width and height values when passing an array.
Also adds the `array` type to the parameter documentation (already supported).

See #34257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:08:25 +00:00
Sergey Biryukov
95da3826b9 Media: Return early from media_sideload_image() if $file didn't match the pattern for images.
Props MikeHansenMe, serpent7776.
Fixes #32755.
Built from https://develop.svn.wordpress.org/trunk@34984


git-svn-id: http://core.svn.wordpress.org/trunk@34949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-09 04:46:24 +00:00
Scott Taylor
ddbd67a22e Media: in wp_read_video|audio_metadata(), set GETID3_TEMP_DIR to get_temp_dir() if it is not defined. This is a workaround for when safe_mode is enabled pre-PHP 5.3.
Props chriscct7, tomsommer.
Fixes #26265.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 14:14:25 +00:00
Drew Jaynes
2de4cc7149 Docs: Add missing DocBlock summaries for a multitude of functions in wp-admin/includes/media.php.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 02:44:25 +00:00
Scott Taylor
84da11d918 Pass false as the 2nd argument to class_exists() to disable autoloading and to not cause problems for those who define __autoload().
Fixes #20523.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 03:52:25 +00:00
Scott Taylor
63efd92b11 Media: In get_image_send_to_editor(), allow a custom value for $rel.
Props tychay.
Fixes #32074.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 05:46:24 +00:00
Scott Taylor
ab6d1fa247 Use get_attached_file() in attachment_submitbox_metadata().
Props kitchin.
Fixes #33386.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 04:18:25 +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
Scott Taylor
52498a8546 In wp_media_upload_handler(), replace a lingering instance of media_upload_gallery() with wp_iframe(...)
Props jeffstieler, antpb.
Fixes #17812. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@33972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 17:24:23 +00:00
Scott Taylor
ef87172270 foreach is a statement, not a function.
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Drew Jaynes
c36c4efea6 Docs: Add a missing summary to the DocBlock for wp_media_upload_handler().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 21:01:25 +00:00
Ella Iseulde Van Dorpe
dac985cdc4 Editor: Add Media should be a button
Props afercia.
Fixes #32969.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-16 19:38:23 +00:00
Konstantin Obenland
542e01162f Media: Remove post_type variable, unused since [32676].
Fixes #32948.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 15:06:25 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +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
42d51a4f89 Add doc blocks to functions that are missing them.
If the function has no need for `@param` or `@return`, do an archeaological dig to find `@since`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 03:18:25 +00:00
Scott Taylor
a51dfa3971 In the style of #30947 and default-filters.php, add 2 new files to wp-admin/includes:
`admin-filters.php`
`ms-admin-filters.php`

There are random actions and filters littered among files like `misc.php`. These files contain functions that won't work outside of admin context and are typically only loaded in files that have already loaded the admin bootstrap.

See #32529.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 17:04:26 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor
b56b9b3e5c Add @global annotations for wp-admin/*.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 21:41:30 +00:00
Scott Taylor
af7a017f46 When calling unset(), it is unnecessary to immediately precede it with a call to isset().
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:47:25 +00:00
Drew Jaynes
a452927c39 Fix documentation syntax and formatting for the media_sideload_image() DocBlock.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 02:20:25 +00:00
Drew Jaynes
cbd07f213d Add two changelog entries for functional changes introduced in 4.2.0.
Props dimadin.
See #31925.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 02:16:25 +00:00
Drew Jaynes
08e3572b7c Add a missing DocBlock for wp_caption_input_textarea().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-04 01:13:25 +00:00
Drew Jaynes
6ccba88ea5 Add proper descriptions for the @global and @param tags in the wp_media_attach_action() DocBlock.
See [31619]. See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-04 21:35:25 +00:00
Scott Taylor
bce851dcf2 Replace array_shift() with reset() where appropriate for performance.
Props SergeyBiryukov.
Fixes #31259.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-19 03:56:27 +00:00
Andrew Ozz
9e1d17ad36 Press This:
- Strip slashes while running side_load_images(), add slashes after.
- Simplify and clean up side_load_images().
- Add another arg to media_sideload_image() to return the uploaded image src only, and fix it to always return WP_Error on errors.
Fixes #31660.
Built from https://develop.svn.wordpress.org/trunk@31799


git-svn-id: http://core.svn.wordpress.org/trunk@31781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-17 00:47:28 +00:00
Sergey Biryukov
19f1d4f402 EXIF/IPTC captions should populate Caption (post_excerpt) on upload, not Description (post_content).
Make sure the caption is always set if found. Previously, if the caption was less than 80 characters, only the Title field would be set.

props beaulebens, ericlewis, bendoh, SergeyBiryukov.
fixes #22768.
Built from https://develop.svn.wordpress.org/trunk@31694


git-svn-id: http://core.svn.wordpress.org/trunk@31675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 05:07:28 +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
f9c138b4c4 detached affects the wp() call for the media list table, so switch our new $_GET key to detach.
See #6820.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 15:59:27 +00:00
Scott Taylor
d3471e9850 Allow attachments to be Detached from their parent in media grid and list modes.
See #6820.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 05:35:28 +00:00
Sergey Biryukov
43583a1b9e Terminate JS statements in two admin files.
props ipm-frommen.
fixes #31311.
Built from https://develop.svn.wordpress.org/trunk@31440


git-svn-id: http://core.svn.wordpress.org/trunk@31421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-13 04:09:27 +00:00
Scott Taylor
7f8b548df1 In HTML5, the action attribute is no longer required. Remove this attribute when empty.
The admin HTML is served with the HTML5 doctype.

"The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces." 
http://www.w3.org/html/wg/drafts/html/master/forms.html#attr-fs-action

Props voldemortensen.
Fixes #30126.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 04:16:24 +00:00
Scott Taylor
6704875855 Replace the 3 remaining occurrences of wpspin GIF with spinner.
Props avryl.
Fixes #27482.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 00:33:22 +00:00
Sergey Biryukov
d5d0b367ab Improve documentation for media_handle_upload().
props ericlewis.
fixes #30962.
Built from https://develop.svn.wordpress.org/trunk@31109


git-svn-id: http://core.svn.wordpress.org/trunk@31090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-09 05:05:23 +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
af0e5cc851 Inline <script>s that are only printed in the admin for pages that are served with the HTML5 doctype absolutely do not need CDATA comments.
Props tw2113 for the initial patch.
See #18788.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 05:46:25 +00:00
Scott Taylor
2dbd0d0a8f In image_size_input_fields():
* Declare `$out` as an empty array - this is not a strict PHP requirement, but is a good practice before loops
* Most of this function was tabbed twice, instead of once

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 22:19:24 +00:00
Scott Taylor
2c32752abd Improve various @param docs for src/wp-admin/*.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:00:22 +00:00
Drew Jaynes
78bb3e5ff5 Docs Formatting: Backtick-escape inline code for all dynamic hook docs in wp-admin/includes/*.
Also adds a few inline `@see` cross-references as they apply.

Affects DocBlocks for the following hooks:
* `views_{$this->screen->id}`
* `bulk_actions-{$this->screen->id}`
* `manage_{$this->screen->id}_sortable_columns`
* `theme_action_links_$stylesheet`
* `after_theme_row_$stylesheet`
* `install_plugins_table_api_args_$tab`
* `$prefix . plugin_action_links`
* `after_plugin_row_$plugin_file`
* `manage_taxonomies_for_{$post_type}_columns`
* `manage_{$post_type}_posts_columns`
* `manage_{$post->post_type}_posts_custom_column`
* `{$taxonomy}_row_actions`
* `manage_{$this->screen->taxonomy}_custom_column`
* `install_themes_table_api_args_' . $tab`
* `auto_update_ . $type`
* `{$action}_prefilter`
* `admin_head_{$content_func}`
* `nav_menu_items_{$post_type_name}`
* `activate_ . $plugin`
* `deactivate_ . $plugin`
* `edit_{$post_type}_per_page`
* `postbox_classes_{$page}_{$id}`
* `_wp_post_revision_field_$field`
* `manage_{$screen->id}_columns`
* `in_plugin_update_message-{$file}`
* `in_theme_update_message-{$theme_key}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 11:28:24 +00:00
Drew Jaynes
5212725fbe 4.1 Docs Audit: Convert a hook reference to an inline @see tag in the hook docs for the image_add_caption_text filter.
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 08:56:24 +00:00
Drew Jaynes
9955384dbe 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:
* Backtick-escape an HTML tag in the description for the `media_upload_mime_type_links()` hook
* Backtick-escape inline code in the description for `wp_get_active_network_plugins()`
* Remove HTML tags from the summaries for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks
* Backtick-escape HTML tags, add inline `@see` tags to parameter descriptions for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 05:53:22 +00:00
Scott Taylor
5e3a64e83d Correct some types in wp-admin/*-location files' doc blocks.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 07:09:23 +00:00
Scott Taylor
7d7a8aa0eb Correct all @return unknown instances.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 06:17:22 +00:00
Scott Taylor
bd2521d5ee Fill in the @param types for the args for functions missing them in wp-admin/includes/deprecated.php (pour one out).
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 06:08: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
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
26124b9aad Pass the attachment ID to the 'image_add_caption_text' filter.
fixes #29607.
Built from https://develop.svn.wordpress.org/trunk@29754


git-svn-id: http://core.svn.wordpress.org/trunk@29526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-21 10:11:16 +00:00
Sergey Biryukov
79d017a024 Add 'image_add_caption_text' filter for changing the pre-parse caption text before output to the editor.
props collinsinternet, DrewAPicture.
fixes #29607.
Built from https://develop.svn.wordpress.org/trunk@29753


git-svn-id: http://core.svn.wordpress.org/trunk@29525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-21 09:56:17 +00:00
Scott Taylor
69998d452b In media_handle_upload(), don't call wp_read_image_metadata() on things that aren't images (like videos). We never caught this error, because we are suppressing it by calling @wp_read_image_metadata().
Props jrf for the initial patch.
Fixes #28907.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-11 20:15: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