Commit Graph

576 Commits

Author SHA1 Message Date
Dominik Schilling
8ea68677f3 Media Upload: Improve styling of error messages.
props afercia, michalzuber.
fixes #29047.
Built from https://develop.svn.wordpress.org/trunk@29355


git-svn-id: http://core.svn.wordpress.org/trunk@29131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-02 14:14:19 +00:00
Sergey Biryukov
be718ee860 Declare the variable before using it.
props danielbachhuber.
fixes #28932.
Built from https://develop.svn.wordpress.org/trunk@29215


git-svn-id: http://core.svn.wordpress.org/trunk@28999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 22:01:14 +00:00
Drew Jaynes
097dc8ee15 Fix syntax for single- and multi-line comments in wp-admin-directory files.
See #28931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 09:14:16 +00:00
Scott Taylor
57dbc55e6e When setting the poster image for a video shortcode, set that image as the featured image for that attachment (if found) in the background. This AJAX functionality could be used for audio as well.
Introduces `attachment_url_to_postid()` to attempt to turn URLs into post IDs.

Fixes #27891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:48:17 +00:00
Scott Taylor
650261b549 In deprecated media iframe code, attachment_fields_to_save filter should not be called twice after initial image upload in post.
Props SergeyBiryukov.
Fixes #20720.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-27 21:32:16 +00:00
Andrew Ozz
b9fd9db83b Uploader: enable selecting multiple files on mobile devices (still doesn't work on Android). See #28640.
Built from https://develop.svn.wordpress.org/trunk@28847


git-svn-id: http://core.svn.wordpress.org/trunk@28651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 04:15:15 +00:00
Scott Taylor
41ab39f42c In media_buttons(), add a static var $instance to increment the id attribute of insert-media-button-%d on each call.
Props ericlewis.
Fixes #28090.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 01:05:14 +00:00
Drew Jaynes
1868c1fc4b Remove unnecessary "not used" notation for filter parameters in wp-admin/includes/media.php.
Also add `@param` and `@return` descriptions.

See #28408.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-30 17:38:14 +00:00
Scott Taylor
8b7b72d75e In media_sideload_image(), check the returned value of download_url() earlier to avoid attempting to unlink() an instance of WP_Error.
Props georgestephanis. 
Fixes #28204.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-23 21:33:14 +00:00
Scott Taylor
130771a383 hackificator doesn't like mixed quote styles in some generated HTML. The switch from single to double allows these files to be parsed.
See #27881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 01:59:15 +00:00
Scott Taylor
54321f4c6e Eliminate use of extract() in get_media_item().
To test, fire open the old media in the console: `tb_show('Old Media is Weird', 'media-upload.php?type=image&TB_iframe=true&post_id=0');`	
	
See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 02:45:15 +00:00
Scott Taylor
2bea9fcc0b In media_upload_gallery_form()'s inline JavaScript, remove unnecessary comment tags.
Fixes #25637.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-11 06:12:15 +00:00
Scott Taylor
1daa7d6723 Leverage size_format() when displaying max_upload_size:
* In `media_upload_form()` 
* The `uploader-inline` Underscore template in the media modal. 

Replaces 2 buggy inline implementations that could display size units off by one, or size values off by one.

Fixes #25643.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-07 18:25:14 +00:00
Scott Taylor
71ac0f21c2 In get_media_item(), $tags and $_tags are set and never used.
See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 16:41:17 +00:00
Scott Taylor
dd73ad4299 In edit_form_image_editor(), $filename and $title are set and then unused. They shall be removed.
See #27882.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 04:45:16 +00:00
Andrew Ozz
c9f5ed0801 Plupload: restore the settings in media_upload_form(), see #27763
Built from https://develop.svn.wordpress.org/trunk@28110


git-svn-id: http://core.svn.wordpress.org/trunk@27941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 00:41:15 +00:00
Drew Jaynes
4af2840a47 Clarify PHPDoc return description for media_handle_upload().
Props jdgrimes.
Fixes #27519.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-31 22:33:15 +00:00
Scott Taylor
01d2062af3 Cleanup up the display, escaping, and handling of ID3 data for media. Rename wp_get_relevant_id3_keys() to wp_get_attachment_id3_keys().
Props nacin.
See #27574.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-31 05:16:16 +00:00
Andrew Nacin
c95f232727 Cleanups for audio/video metadata, see [27862].
see #27574.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-30 21:08:14 +00:00
Scott Taylor
d947a55495 Metadata for audio and video files:
* Make attachment metadata for audio files editable by providing a metabox on the Edit Media page
* Standardize on using the attachment title everywhere
* Label the Caption and Description fields for audio and video appropriately
* Make the playlist Underscore templates more straightforward

See #27574.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-30 19:28:16 +00:00
Drew Jaynes
7dc9b02577 Correct misleading verbiage in 'print' hook docs.
Standardizes 'print' hook docs on the concept that hooks are fired when scripts and styles are printed.

Props ericlewis for the initial patch.
Fixes #26924.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 08:05:15 +00:00
Andrew Nacin
9babc32900 Use correct variable. see [27373].
props TobiasBg.
fixes #14424.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-24 03:25:16 +00:00
Andrew Ozz
69b74a75cd Plupload: switch to urlstream upload method when the 'flash' runtime is used in non IE browsers. This ensures cookies are sent but limits the maximum file size that flash can handle.
By default only IE9 and older use flash so this change is mostly for completeness. It would affect only the (extremely rare) cases where a plugin disables the html5 runtime.
Built from https://develop.svn.wordpress.org/trunk@27662


git-svn-id: http://core.svn.wordpress.org/trunk@27505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-23 23:45:19 +00:00
Dominik Schilling
d1f3abe55c Remove "Show" prefix from filter dropdowns, see #26743.
Built from https://develop.svn.wordpress.org/trunk@27626


git-svn-id: http://core.svn.wordpress.org/trunk@27469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 22:13:14 +00:00
Andrew Nacin
fe260c6a15 Assign correct variable.
props nendeb55.
fixes #27351. see #14424, [27373].

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


git-svn-id: http://core.svn.wordpress.org/trunk@27344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-11 13:24:14 +00:00
Andrew Nacin
449ffedfb9 maybe_regenerate_attachment_metadata() is now wp_maybe_generate_attachment_metadata().
props kovshenin.
fixes #26825.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 19:34:14 +00:00
Mark Jaquith
fb56a9942b Eliminate some of our last remaining create_function() instances
* Moved some into private function callbacks
* Eliminated some that weren't necessary anymore

props obenland, markjaquith, nacin. fixes #14424
Built from https://develop.svn.wordpress.org/trunk@27373


git-svn-id: http://core.svn.wordpress.org/trunk@27222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 16:21:16 +00:00
Andrew Nacin
0c16c0477b Reference https://wordpress.org rather than http://wordpress.org in strings, links, comments, etc.
props Ipstenu, markjaquith.
see #27115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 02:34:27 +00:00
Scott Taylor
e92770ba93 * Videos should always render at the same aspect ratio.
* Don't force a pseudo-mime-type for `.m4v` files
* Uniformly adapt to `$content_width` when setting video dimensions on the front end
* Add the `height` attribute to the initial `<video>` in the video playlist JS template
* Add some defensive/responsive CSS for a/v on the Edit Media page

See #27243.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-28 21:28:14 +00:00
Andrew Ozz
d896fa2487 Upgrade Plupload to 2.1.1, props kovshenin, see #25663
Built from https://develop.svn.wordpress.org/trunk@27316


git-svn-id: http://core.svn.wordpress.org/trunk@27168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-27 20:01:16 +00:00
Scott Taylor
03dda3b273 Introduce maybe_regenerate_attachment_metadata( $attachment ). On the Edit Media screen, call it for Audio and Video files.
The functions checks if the item is lacking metadata altogether. If a video or audio file was uploaded prior to 3.6, it does not have any metadata. This tries to fix it. Implements locking via a transient to protect against this running in parallel with another request.

This is the minimum viable product for #26825, but leaving the ticket open unless this function needs to be called in other places.

See #26825.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 22:41:12 +00:00
Andrew Ozz
87589dd445 Remove table cellspacing attribute from the admin, part-props MattyRob, fixes #22086.
Built from https://develop.svn.wordpress.org/trunk@27036


git-svn-id: http://core.svn.wordpress.org/trunk@26912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-26 20:28:12 +00:00
Andrew Ozz
eb1d21d782 Remove all "valign" attributes from tables in wp-admin, props MikeHansenMe, Marventus. Fixes #22712.
Built from https://develop.svn.wordpress.org/trunk@27029


git-svn-id: http://core.svn.wordpress.org/trunk@26905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-24 19:06:15 +00:00
Drew Jaynes
f51b1f8def Inline documentation for hooks in wp-admin/includes/media.php.
Props kpdesign, DrewAPicture.
Fixes #25375.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-06 05:48:12 +00:00
Scott Taylor
7a7b9c89ec Use parens to ensure that RegEx OR matches the front when determining that mime-type matches audio|video in attachment_submitbox_metadata().
Props kovshenin.
See #23926.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-08 15:32:10 +00:00
Helen Hou-Sandí
9d5c2eb55f Make sure the attachment file exists before calling filesize() on it. props DrewAPicture. fixes #25170.
Built from https://develop.svn.wordpress.org/trunk@25608


git-svn-id: http://core.svn.wordpress.org/trunk@25525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 20:23:10 +00:00
Helen Hou-Sandí
0758df9758 Add file size to attachment publish meta box. props desrosj. fixes #25170.
Built from https://develop.svn.wordpress.org/trunk@25403


git-svn-id: http://core.svn.wordpress.org/trunk@25333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 15:10:09 +00:00
Helen Hou-Sandí
8798685de5 Alignment standards for [25296]. props DrewAPicture. see #25171.
Built from https://develop.svn.wordpress.org/trunk@25300


git-svn-id: http://core.svn.wordpress.org/trunk@25263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-07 22:07:09 +00:00
Helen Hou-Sandí
304426cece Add dynamic classes for attachment metadata submitbox sections. see #22333, #25171.
Built from https://develop.svn.wordpress.org/trunk@25297


git-svn-id: http://core.svn.wordpress.org/trunk@25260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-07 16:20:09 +00:00
Helen Hou-Sandí
89421ddeaa Add media_submitbox_misc_sections and audio_submitbox_misc_sections filters to allow removing or adding of attachment submitbox sections containing attachment metadata. props desroj, DrewAPicture. fixes #25171.
Built from https://develop.svn.wordpress.org/trunk@25296


git-svn-id: http://core.svn.wordpress.org/trunk@25259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-07 16:19:10 +00:00
Sergey Biryukov
897ddbd76c Use correct array key for filling the attachment title in image_attachment_fields_to_save(). props pross.
Use wp_basename() to avoid issues with UTF-8 characters.
fixes #25236.
Built from https://develop.svn.wordpress.org/trunk@25277


git-svn-id: http://core.svn.wordpress.org/trunk@25242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 14:10:09 +00:00
Helen Hou-Sandí
eb44516e48 Add more descriptive classes to submit meta box sections. props nofearinc. fixes #22333.
Built from https://develop.svn.wordpress.org/trunk@25083


git-svn-id: http://core.svn.wordpress.org/trunk@25068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 15:24:10 +00:00
Sergey Biryukov
aadd546d48 Avoid PHP notices in get_sample_permalink() and get_sample_permalink_html(). Remove unused global reference. props ocean90. fixes #25005.
Built from https://develop.svn.wordpress.org/trunk@25028


git-svn-id: http://core.svn.wordpress.org/trunk@25015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-15 16:25:12 +00:00
Mark Jaquith
e553e85ebb Remove $pagenow global from three functions that don’t use it.
Props jeremyfelt. Fixes #24920.

git-svn-id: http://core.svn.wordpress.org/trunk@24974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-02 04:42:08 +00:00
Andrew Nacin
bc0a60920d Remove curly quotes from auto content generation for audio tracks on upload. Texturize should be doing this on display.
props tollmanz.
fixes 24810.



git-svn-id: http://core.svn.wordpress.org/trunk@24788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-24 05:47:00 +00:00
Andrew Nacin
2c67dea9bc Media: Add awareness to Attachment Display Settings that audio and video can be embedded.
Also:
 * Add file length metadata to Attachment Details.
 * Round the kb/s bitrate on post.php.

fixes #24449.



git-svn-id: http://core.svn.wordpress.org/trunk@24777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 05:39:08 +00:00
Andrew Nacin
e46e52ec0f ID3 1.9.7.
props wonderboymusic.
fixes #24737.



git-svn-id: http://core.svn.wordpress.org/trunk@24696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-13 00:37:36 +00:00
Andrew Nacin
c2db94d10c Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes #23226.
git-svn-id: http://core.svn.wordpress.org/trunk@24593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 20:05:42 +00:00
Andrew Nacin
44abe2e502 Use wp_basename() in newer media code for filenames to avoid encoding issues on display. props SergeyBiryukov, fixes #23267.
git-svn-id: http://core.svn.wordpress.org/trunk@24585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 13:55:50 +00:00
Andrew Nacin
6500a24719 Call shortcode functions directly. props kovshenin, fixes #24505.
git-svn-id: http://core.svn.wordpress.org/trunk@24547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-03 20:19:00 +00:00
Andrew Nacin
3231e8cbd0 Pass $post to hooks in edit-form-advanced.php including edit_form_advanced and edit_form_after_*. fixes #24611.
git-svn-id: http://core.svn.wordpress.org/trunk@24446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-19 21:10:51 +00:00
Andrew Nacin
797ee34bc3 Remove /extend/ from URLs to wordpress.org/plugins, /themes, and /mobile, as those are all now top-level. see #24389.
git-svn-id: http://core.svn.wordpress.org/trunk@24320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-22 21:01:57 +00:00
Sergey Biryukov
415a5c60da * Pass ellipsis as a parameter to wp_html_excerpt() instead of appending it manually.
* Consolidate the logic to avoid appending ellipsis if the entire string is shown.
* Show ellipsis after truncated filenames and post titles.

props solarissmoke, bpetty, SergeyBiryukov. fixes #11446.

git-svn-id: http://core.svn.wordpress.org/trunk@24214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-09 00:22:02 +00:00
Andrew Nacin
b34ca3234e Remove manual printing of userSettings as utils.js receives this as inline script data (since 3.5). see #24210.
git-svn-id: http://core.svn.wordpress.org/trunk@24187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-07 15:49:20 +00:00
Andrew Nacin
00b7fa589a Remove ancient 'lookup' quicktag from the text editor. This had called up answers.com.
props mboynes, jonbishop, SergeyBiryukov.
fixes #23322.



git-svn-id: http://core.svn.wordpress.org/trunk@24052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-22 20:17:25 +00:00
Mark Jaquith
94c5f0aca1 Use ID3 data for audio and video
fixes #23926. props wonderboymusic, SergeyBiryukov, johnbillion.

git-svn-id: http://core.svn.wordpress.org/trunk@23979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-12 22:27:24 +00:00
Sergey Biryukov
8d546ad739 Avoid an undefined index notice in wp_read_video_metadata(). props ocean90. fixes #23953.
git-svn-id: http://core.svn.wordpress.org/trunk@23923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-06 00:29:12 +00:00
Mark Jaquith
fec4b66f5b Sanity checks on image metadata to avoid warnings, etc.
fixes #23733. props wonderboymusic.

git-svn-id: http://core.svn.wordpress.org/trunk@23873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 20:51:35 +00:00
Mark Jaquith
ebdcf967a3 Show a playable audio/video preview on the Edit Attachment screen.
props wonderboymusic. fixes #23726

git-svn-id: http://core.svn.wordpress.org/trunk@23768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-21 05:17:25 +00:00
Mark Jaquith
12d3fc7999 Add functions for generating metadata for video and audio, using the
ID3 library. Also allows themes/plugins to add thumbnail support
to these media types. Think stuff like album art, movie covers, and
video freeze-frames.

props wonderboymusic. fixes #23673

git-svn-id: http://core.svn.wordpress.org/trunk@23766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-21 04:55:42 +00:00
Ryan Boren
469d1a3099 Escape form action urls with esc_url() rather than esc_attr().
Props SergeyBiryukov
fixes #23266


git-svn-id: http://core.svn.wordpress.org/trunk@23739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-18 14:01:25 +00:00
Helen Hou-Sandí
fffc2e1ab1 Prevent an unseemly gap on the edit screen when nothing else displays before normal meta boxes. Give better HTML and visual structure to items added via edit_form_after_title and edit_form_after_editor. Using a class of .edit-form-section will now get you a 20px bottom margin; perfect for your additions to the post edit screen. fixes #23240.
git-svn-id: http://core.svn.wordpress.org/trunk@23615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 23:22:17 +00:00
Andrew Nacin
7b47322e22 Ensure the referer functions operate completely on unslashed data: wp_referer_field(), wp_original_referer_field(), wp_get_referer(), wp_get_original_referer().
Use wp_slash() instead of addslashes().

see #21767.



git-svn-id: http://core.svn.wordpress.org/trunk@23578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 17:58:43 +00:00
Ryan Boren
5f809d1d22 Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 17:00:25 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Ryan Boren
cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Mark Jaquith
dab5a6ef7d Fix some tabbing issues on the post editing screen. Add Media no longer skipped when going backwards from content. Save Draft no longer skipped when going forwards from content.
props adamsilverstein. fixes #23195 and #22933

git-svn-id: http://core.svn.wordpress.org/trunk@23395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-08 18:30:09 +00:00
Andrew Nacin
5d980a8e8e Whenever we have compat fields to render, send a dummy menu_order field (which was always sent in 3.4) to ensure an unchecked checkbox can still be processed by attachment_fields_to_save. fixes #22868.
git-svn-id: http://core.svn.wordpress.org/trunk@23290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-05 03:50:28 +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
Daryl Koopersmith
8efc323e2e Add hidden fields via attachment_fields_to_edit to the existing compat output. props nacin. fixes #22769.
git-svn-id: http://core.svn.wordpress.org/trunk@23086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 03:28:21 +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
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
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
cc9b248937 Always send nocache_headers() for admin-ajax.php. This prevents iOS from caching ajax calls. http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results
Turn off multi selection uploads for mobile devices. Currently Plupload cannot upload multiple files in iOS Safari. Only the first file makes it to the queue. 

Empty wp on unload to work around caching in iOS Safari.

Props azaozz, miqrogroove, nacin

fixes #22552


git-svn-id: http://core.svn.wordpress.org/trunk@22872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 16:17:53 +00:00
Ryan Boren
11c5f2c1fc Only show the image edit button for image attachments. Props markoheijnen. fixes #22596
git-svn-id: http://core.svn.wordpress.org/trunk@22867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 15:06:02 +00:00
Ryan Boren
b7c0d84c7f In media_upload_flash_bypass(), pass the post id in the media-new.php url.
In media-new.php, use post_id from REQUEST if passed and the current user can edit the post.
Fixes adding media with the browser uploader.

Props nacin, ocean90
fixes #22572


git-svn-id: http://core.svn.wordpress.org/trunk@22853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 23:10:19 +00:00
Andrew Nacin
4e9e4bf2cf Back compat for media_buttons_context, which is not the correct filter for adding new media buttons. If you want to add additional media buttons, use the media_buttons action instead. fixes #22559.
git-svn-id: http://core.svn.wordpress.org/trunk@22848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 22:32:35 +00:00
Ryan Boren
5b94b6b43e In media_buttons(), consult global post_ID if get_post() comes up with nothing.
Default postID to 0 in wp_enqueue_media().

Props nacin
fixes #22085


git-svn-id: http://core.svn.wordpress.org/trunk@22846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 22:03:37 +00:00
Andrew Nacin
efd9913490 Mustn't forget to hide the legacy media uploader! see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 13:23:27 +00:00
Andrew Nacin
9120cf3375 WP_Image_Editor: the last stand.
* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
 * Lazy-load the WP_Image_Editor base class and editor implementations.
 * Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
 * Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().

props DH-Shredder, scribu, markoheijnen. fixes #22356. see #6821.



git-svn-id: http://core.svn.wordpress.org/trunk@22817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 09:52:16 +00:00
Daryl Koopersmith
0d08430cfe Media: Replace the thumbnail on post.php using a request variable instead of the referer. props ocean90. fixes #21391.
git-svn-id: http://core.svn.wordpress.org/trunk@22807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 03:43:16 +00:00
Andrew Nacin
55a6c62e76 Support attachment_fields_to_save and attachment_fields_to_edit for attachments going through post.php. see #22186. see #21391.
git-svn-id: http://core.svn.wordpress.org/trunk@22783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 18:53:00 +00:00
Andrew Nacin
9b54e5c380 Have the media modal direct users to media-new.php for the browser uploader. fixes #22444.
git-svn-id: http://core.svn.wordpress.org/trunk@22765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 15:30:48 +00:00
Andrew Nacin
229a919b27 media-new.php: Remove unused scripts, strings, error handling, save handling, and save button. fixes #22083.
git-svn-id: http://core.svn.wordpress.org/trunk@22764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 15:10:17 +00:00
Andrew Nacin
75c464671d Revert accidental changes to admin/includes/media.php in [22755]. see #22083.
git-svn-id: http://core.svn.wordpress.org/trunk@22759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 14:04:24 +00:00
Andrew Nacin
1935e74233 Properly nest the if tag. props helenyhou. see #21391.
git-svn-id: http://core.svn.wordpress.org/trunk@22757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 13:32:26 +00:00
Andrew Nacin
e276fc44be Have media-new.php return simple rows of basic attachment data, with an 'Edit' link next to each taking them to post.php (in a new window). Not ideal, but this is largely a fallback screen at this point.
This is bolted on to existing code, the vast majority of which is destined to be ripped out in 3.6 once things settle.

see #22083.



git-svn-id: http://core.svn.wordpress.org/trunk@22755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 13:05:44 +00:00
Andrew Nacin
96576a2dca Properly refresh the thumbnail on post.php after an image edit. props ocean90. see #21391.
git-svn-id: http://core.svn.wordpress.org/trunk@22749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 12:05:24 +00:00
Andrew Nacin
9ad10730c0 Non-images don't have alternative text. props helenyhou. see #21391.
git-svn-id: http://core.svn.wordpress.org/trunk@22748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 12:03:35 +00:00
Andrew Nacin
8f3a9e1907 Stop inserting title attributes for images inserted into the editor by modifying get_image_send_to_editor(), not the generic get_image_tag().
see #18984, [22409].



git-svn-id: http://core.svn.wordpress.org/trunk@22747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 11:50:30 +00:00
Daryl Koopersmith
b75ec467b2 Media: Whoops. Remove error_log. see [22699], #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 02:40:31 +00:00
Daryl Koopersmith
b1f720c616 Media: Improve media buttons on the front end.
* Use a less specific selector (the body, actually) to delegate opening the media dialog.
* Allow the editor ID to be the empty string so the `media_buttons` action can be called without arguments.

see #22284, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 02:35:30 +00:00
Andrew Nacin
4b9ef4ee05 Remove errant return. props SergeyBiryukov. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 09:48:34 +00:00
Andrew Nacin
bd158c503f Move code from image_attachment_fields_to_edit() to get_attachment_fields_to_edit(). The level of abstraction is unnecessary, and it makes it more difficult to call only the filter in the new media modal. Also, that function is sloooow. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 08:10:38 +00:00
Andrew Nacin
479d27013a Avoid doing all of the extra work in get_attachment_fields_to_edit() for fields we will just discard. We just need the filter, and the taxonomies. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 07:20:47 +00:00
Andrew Nacin
0a888e8aa0 Prevent notices when post_id is not passed to the old media upload forms. props ldebrouwer. fixes #22465.
git-svn-id: http://core.svn.wordpress.org/trunk@22628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 06:42:14 +00:00
Daryl Koopersmith
fd6b847330 Media: Make edit gallery button use new media. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 09:06:10 +00:00
Daryl Koopersmith
82213846c3 Media: Add backwards compatibility for attachment_fields_to_edit and attachment_fields_to_save. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-11 01:26:42 +00:00
Daryl Koopersmith
bed08350f4 Media: Backwards compatibility for media_upload_tabs.
* Adds `createIframeStates()` to the `MediaFrame` view. It creates states and bindings for the `media_upload_tabs` output, and is included on `MediaFrame.Post` by default.
* Hijacks `tb_remove()` when the media modal is open to ensure the modal closes correctly.
* Adds a `chromeless` parameter to thickbox media tab URLs to render the UI without the old row of tabs.

see #22186, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 07:51:37 +00:00