Commit Graph

167 Commits

Author SHA1 Message Date
Ryan Boren
b4d0be2d1a Introduce WP_Image_Editor, WP_Image_Editor_Imagick, and WP_Image_Editor_GD. Abstracts image editing API and adds support for ImageMagick.
Props DH-Shredder, kurtpayne, markoheijnen
see #6821


git-svn-id: http://core.svn.wordpress.org/trunk@22094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 20:59:06 +00:00
Daryl Koopersmith
eb54ac6373 Move wp_max_upload_size and dependencies to wp-includes. props johnjamesjacoby. see #21390, fixes #21867.
git-svn-id: http://core.svn.wordpress.org/trunk@22073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 20:59:57 +00:00
Daryl Koopersmith
3cf9d9d905 Add quick insert buttons to attachment views in the library and remove buttons to attachment views in the gallery editor. see #21390, #21809.
git-svn-id: http://core.svn.wordpress.org/trunk@22053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 07:45:26 +00:00
Daryl Koopersmith
45c255a6a9 Use the attachment id to look up the mime type icon instead of the raw mime type string, as wp_mime_type_icon() runs a broader search when using an id. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 06:07:56 +00:00
Daryl Koopersmith
67708a3d8b First pass on TinyMCE attachment in-editor UI.
* Adds in-editor UI for image attachments. Most of this UI should be able to migrate to all images in a future commit.
* Removes the wpeditimage TinyMCE plugin from the default plugins array.
* Add `wp.media.fit`, a helper method to constrain dimensions based upon a maximum width and/or height.
* Add html attribute parsing and string generation utilities (currently stored in mce-views).
* Calling `remove` on a TinyMCE views now ensures that the the parent and references are removed as well.
* Fixes a bug where we weren't sending the full array of results to matches in wp.mce.view.

see #21390, #21812, #21813.



git-svn-id: http://core.svn.wordpress.org/trunk@22012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 14:12:54 +00:00
Andrew Nacin
4e0c89c236 Move WP_Embed into its own file. props ocean90. fixes #20533.
git-svn-id: http://core.svn.wordpress.org/trunk@21999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 08:39:26 +00:00
Andrew Nacin
a6c93e2f65 Always attempt to embed URLs in content, removing the Auto-embeds (autoembed_urls) option.
Remove the UI for setting the default width and height for embeds. Width was confusing as it
was blank by default (inheriting the content width from the theme, or 500px). The height is
now calculated as 1.5x the content width, or 1000px, whichever is smaller.

The [embed] shortcode can still receive manual height and width attributes. This just removes
the global settings.

props wonderboymusic. see #21719.



git-svn-id: http://core.svn.wordpress.org/trunk@21998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 07:10:09 +00:00
Andrew Nacin
33af30eb7f Use the regular post type UI for editing single media items (attachments).
* Attachments now go through post.php, edit_post(), the like, and have show_ui set to true.
 * Taxonomies attached to the media library now appear in the admin menu (if show_ui).
 * Editing, cropping, uploading, etc. is still very rough, but mostly functional.

API-wise:
 * New function: get_taxonomies_for_attachments(). Like get_taxonomies(), for taxonomies specifically registered against attachments.
 * Brings taxonomy support from the posts list table to the media list table. Expect them to converge soon.
 * wp_insert_attachment() now handles taxonomies like wp_insert_post(). Also expect them to converge soon.
 * New edit_form_after_title hook.

props helenyhou, ocean90. see #21391.



git-svn-id: http://core.svn.wordpress.org/trunk@21948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 22:52:54 +00:00
Daryl Koopersmith
f7ae81b15d Rename the attachment-thumbnail class in the media modal Attachment view to prevent conflicts with wp_get_attachment_image(). see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@21909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 01:10:17 +00:00
Andrew Nacin
f69fdb6198 Don't sanitize include and exclude in gallery_shortcode(), as this is handled further down the stack, and better. props SergeyBiryukov, TobiasBg. fixes #21827.
git-svn-id: http://core.svn.wordpress.org/trunk@21833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-13 17:06:25 +00:00
Andrew Nacin
58e1e69c4b oEmbed uses author_can(), not current_user_can(). props DrewAPicture, fixes #21880.
git-svn-id: http://core.svn.wordpress.org/trunk@21830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-13 16:42:43 +00:00
Daryl Koopersmith
2f5090bfb8 Prevent img elements in the media modal from being draggable. see #21390.
Browsers natively support dragging img elements, which would then set off the drop zone in the modal. We disable this by setting the draggable attribute to false.



git-svn-id: http://core.svn.wordpress.org/trunk@21785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-07 22:09:40 +00:00
Daryl Koopersmith
fee99ba9b4 Use icons for non-image attachments in the new media modal. see #21836, #21390, #21808.
git-svn-id: http://core.svn.wordpress.org/trunk@21784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-07 21:27:07 +00:00
Mark Jaquith
a282823b17 use 'ids' parameter for explicit attachment ordering in [gallery] shortcodes. fixes #21816
git-svn-id: http://core.svn.wordpress.org/trunk@21778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-06 19:19:56 +00:00
Daryl Koopersmith
8763c79698 Add checks for attachment metadata when formatting attachments for JS.
Prevents notices from causing malformed ajax responses.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-06 09:50:41 +00:00
Daryl Koopersmith
43fc38330a Adds UI for media modal toolbars, buttons, and the selected item(s) status.
Currently uses actions for inserting media into a post as an example (hence the raw text). To test a workflow that supports multiple selection, run the following in your browser's JavaScript console:

	wp.media({ multiple: true });

see #21390, #21808.



git-svn-id: http://core.svn.wordpress.org/trunk@21769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-06 07:46:15 +00:00
Ryan Boren
cfb35a9d85 Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.

Props nacin
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 16:29:28 +00:00
Daryl Koopersmith
da9864c82a Media: Use numeric timestamps instead of string-based timestamps when preparing an attachment for js.
We use the 'date' attribute to create Javascript Date objects. The Date() constructor has better cross-browser compatibility when numeric arguments are passed to the constructor.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 19:14:43 +00:00
Daryl Koopersmith
c217397faa Add new media workflow scripts, styles, and templates.
Please note that this commit does not integrate media into the existing UI. If you would like to see the new UI, navigate to the post editor and run the following in your browser's Javascript console:

	new wp.media.controller.Workflow().render().modal.open();


The Javascript is broken up into two files, with the slugs media-models and media-views.

* media-models: The models are UI agnostic, and can be used independent of the views. If you'd like to create custom UIs, this is the script for you.

* media-views: This is the Media Experience. The views (and controllers) depend on the models (which are listed as a dependency and will automatically be included thanks to wp_enqueue_script). The views also require the media templates, media-view styles, and the plupload bridge settings. Perhaps we should create a function to include the whole shebang, but in the meantime...

To include media-views in the admin, run the following PHP in or after 'admin_enqueue_scripts':

	wp_enqueue_script( 'media-views' );
	wp_enqueue_style( 'media-views' );
	wp_plupload_default_settings();
	add_action( 'admin_footer', 'wp_print_media_templates' );

see #21390.



git-svn-id: http://core.svn.wordpress.org/trunk@21683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 04:54:23 +00:00
Andrew Nacin
5546df59d3 Introduce wp_prepare_attachment_for_js(). Prepares an attachment post object to be JSON-encoded and fitted into an Attachment model, for 3.5 media.
props koopersmith. see #21390.



git-svn-id: http://core.svn.wordpress.org/trunk@21680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 02:04:40 +00:00
Ryan Boren
f56d8278bb Remove return ref from all calls to get_post()
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:01:10 +00:00
ryan
c390c3afb0 Introduce wp_oembed_remove_provider(). Props r-a-y. fixes #16327
git-svn-id: http://core.svn.wordpress.org/trunk@21351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-26 20:18:27 +00:00
koopersmith
14f04132af Theme Customizer: Fix scrolling on iOS and Kindle Fire. props azaozz, helenyhou. fixes #20805.
Also fixes uploader UIs on iOS and Kindle Fire by improving wp.Uploader.
Adds mobile viewport specifications.
Moves scrollbar back to fixed positioning.


git-svn-id: http://core.svn.wordpress.org/trunk@21014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-06 21:45:17 +00:00
nacin
06c86f519d In image_resize(), do not force the destination filename to *.jpg when we are dealing with a *.jpeg.
props SergeyBiryukov.
fixes #16458.



git-svn-id: http://core.svn.wordpress.org/trunk@20701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 20:58:57 +00:00
nacin
fbea58a1b7 Add filter to image_resize_dimensions() so plugins can perform this calculation on their own. props ebababi. fixes #15989.
git-svn-id: http://core.svn.wordpress.org/trunk@20694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 20:15:44 +00:00
azaozz
e8beafd57b Change the image caption shortcode format to [caption ...]<a><img /></a> caption text + html[/caption]. That way HTML tags in captions are better supported and the shortcode wouldn't break when using the wrong quotes. Props sushkov, nacin, fixes #18311
git-svn-id: http://core.svn.wordpress.org/trunk@20679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 01:14:52 +00:00
duck_
3fdd4ee29f wp_oembed_get() returns false on failure. Props SergeyBiryukov. Fixes #20355.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-22 11:19:56 +00:00
nacin
f665eb6a26 Remove enqueue of wp_plupload_default_settings() from admin_enqueue_scripts(). For now, it needs to be enqueued selectively when needed. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 03:21:07 +00:00
koopersmith
9ef7cbbdd8 Theme Customizer: Bind wp_plupload_default_settings() to the customize_controls_enqueue_scripts hook. Fixes JS errors. see #19910, [20189].
git-svn-id: http://svn.automattic.com/wordpress/trunk@20197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 19:46:15 +00:00
nacin
ae6bf5bd80 Move wp_plupload_default_settings() to the admin_enqueue_scripts hook to prevent fatal errors when admin_init is run outside of normal admin-header execution, like admin-ajax. see #19910. fixes #20240.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 12:53:39 +00:00
nacin
4bd9f4f9f2 URL to admin-ajax.php should be relative. see #19910. see #18952.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 12:52:23 +00:00
nacin
5aba8d043c Ensure no nonce or multipart_params get passed to the plupload_default_settings filter. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 12:50:18 +00:00
koopersmith
c06576d410 Theme Customizer: First pass for upload controls, using background image as an example. Add a wrapper for Plupload that allows for custom upload UIs. see #19910.
wp.Uploader is a wrapper that provides a simple way to upload an attachment (using the wp_ajax_upload_attachment handler). It is intentionally decoupled from the UI. When an upload succeeds, it will receive the attachment information (id, url, meta, etc) as a JSON response. If the upload fails, the wrapper handles both WordPress and plupload errors through a single handler.

As todos, we should add drag classes for the uploader dropzone and account for the rough 100mb filesize limit in most browsers. The UI for the customizer upload controls could be improved as well.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 04:14:05 +00:00
nacin
bfeb575df9 Use relative paths for admin-ajax.php to avoid cross-domain issues with IDN domains in IE and Opera. props SergeyBiryukov, fixes #18952.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 16:12:11 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
ryan
07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
ryan
32e25b6aec phpdoc typo and readability fixes. Props SergeyBiryukov. fixes #18560
git-svn-id: http://svn.automattic.com/wordpress/trunk@18827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 22:57:43 +00:00
duck_
2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
ryan
19c3608dcc Remove unused global. Props ocean90. fixes #18484
git-svn-id: http://svn.automattic.com/wordpress/trunk@18605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-25 19:35:22 +00:00
nbachiyski
abe8b47351 Explicitly globalize some variables, so that unit tests can run WordPress inside a function. Fixes #17749
git-svn-id: http://svn.automattic.com/wordpress/trunk@18532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 04:45:14 +00:00
nacin
59446cff1d Remove default-embeds.php. fixes #17112.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 17:03:23 +00:00
westi
80f4e83a8c Introduce WP_MAX_MEMORY_LIMIT constant for the high memory limit we set when image processing and unzipping.
Ensure it is always filterable by plugins as well as configurable in wp-config
Fixes #13847 props hakre


git-svn-id: http://svn.automattic.com/wordpress/trunk@17749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 16:25:36 +00:00
ryan
4e09dfc8fb Remove PHP4 constructor. Props Jayjdk. see #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-11 18:57:34 +00:00
nacin
bd6fe3c99c Document that the size parameter in image_downsize() can also be an array. props scribu, fixes #16263.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-23 18:46:38 +00:00
nacin
96b5c58ec2 use_default_gallery_style boolean filter and new gallery-columns-* class. see #15103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-10 19:15:37 +00:00
nacin
951549bf93 wp-caption-text class for the gallery shortcode caption. props chipbennett, fixes #14411.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-10 19:05:50 +00:00
markjaquith
7290e527e7 Pass post ID to embed_oembed_html filter to avoid global variable incantations. props filosofo. fixes #15491
git-svn-id: http://svn.automattic.com/wordpress/trunk@16740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-06 03:38:27 +00:00
nacin
d0098e51bb Unescape ampersands before making an oEmbed request. props Viper007Bond, fixes #14514, see #11311.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-05 02:23:17 +00:00
nacin
69b3167678 Revert [15688], [15689], [15691]. Try again in 3.2. see #14966.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-22 17:17:26 +00:00
scribu
7640c5748b Add colon after Upload/Insert. Fixes #14810
git-svn-id: http://svn.automattic.com/wordpress/trunk@16358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-13 22:52:51 +00:00