Commit Graph

172 Commits

Author SHA1 Message Date
Daryl Koopersmith 6500957bcd Improve styling and markup for gallery and attachment MCE views.
Attachment views can now inherit from the theme's `editor-style.css` — just have any rules that apply to the `img` tag apply to `.editor-attachment` as well.

Adds a non-functional edit button to gallery views.

see #21390, #21813, #21815.


git-svn-id: https://develop.svn.wordpress.org/trunk@22154 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-10 06:47:22 +00:00
Daryl Koopersmith 561c3b7837 Improve media modal title bar styling. props helenyhou, see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22144 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 02:56:39 +00:00
Daryl Koopersmith b26a4d2cde Remove the attachment quick-insert button from the media modal. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22138 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 00:21:52 +00:00
Daryl Koopersmith 91a3c62b3f Better thumbnail previews in the image editor.
* Images are auto-cropped, then fit to the preview on hover (with a slight delay). This is an experiment; we'll see how it turns out.
* Various style changes.

see #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@22137 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-08 23:20:04 +00:00
Daryl Koopersmith d43c390e2b Use the new media modal to insert galleries into TinyMCE and the text editor.
'''Galleries'''

* Gallery insertion from the new media modal (into TinyMCE, the text editor, etc).
* Gallery previews in TinyMCE now use the `wp.mce.views` API.
* Disables the TinyMCE `wpgallery` plugin.
* Gallery previews consist of the first image of the gallery and the appearance of a stack. This will later be fleshed out to include more images/functionality (including editing the gallery, gallery properties, and showing the number of images in the gallery).
* Multiple galleries can be added to a single post.
* The gallery MCE view provides a bridge between the `wp.shortcode` and `Attachments` representation of a gallery, which allows the existing collection to persist when a gallery is initially created (preventing a request to the server for the query).


'''Shortcodes'''

* Renames `wp.shortcode.Match` to `wp.shortcode` to better expose the shortcode constructor.
* The `wp.shortcode` constructor now accepts an object of options instead of a `wp.shortcode.regexp()` match.
* A `wp.shortcode` instance can be created from a `wp.shortcode.regexp()` match by calling `wp.shortcode.fromMatch( match )`.
* Adds `wp.shortcode.string()`, which takes a set of shortcode parameters and converts them into a string.* Renames `wp.shortcode.prototype.text()` to `wp.shortcode.prototype.string()`.
* Adds an additional capture group to `wp.shortcode.regexp()` that records whether or not the shortcode has a closing tag. This allows us to improve the accuracy of the syntax used when transforming a shortcode object back into a string.

'''Media Models'''

* Prevents media `Query` models from observing the central `Attachments.all` object when query args without corresponding filters are set (otherwise, queries quickly amass false positives).
* Adds `post__in`, `post__not_in`, and `post_parent` as acceptable JS attachment `Query` args.
* `Attachments.more()` always returns a `$.promise` object.

see #21390, #21809, #21812, #21815, #21817.


git-svn-id: https://develop.svn.wordpress.org/trunk@22120 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-05 04:23:59 +00:00
Ryan Boren 7790af3154 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: https://develop.svn.wordpress.org/trunk@22094 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 20:59:06 +00:00
Daryl Koopersmith d6d359a1bc Move wp_max_upload_size and dependencies to wp-includes. props johnjamesjacoby. see #21390, fixes #21867.
git-svn-id: https://develop.svn.wordpress.org/trunk@22073 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 20:59:57 +00:00
Daryl Koopersmith 7354809132 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: https://develop.svn.wordpress.org/trunk@22053 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 07:45:26 +00:00
Daryl Koopersmith d2b6d050f4 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: https://develop.svn.wordpress.org/trunk@22043 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 06:07:56 +00:00
Daryl Koopersmith 0dd940e0c1 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: https://develop.svn.wordpress.org/trunk@22012 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-26 14:12:54 +00:00
Andrew Nacin ab2f77ebd0 Move WP_Embed into its own file. props ocean90. fixes #20533.
git-svn-id: https://develop.svn.wordpress.org/trunk@21999 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-25 08:39:26 +00:00
Andrew Nacin 84ca011876 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: https://develop.svn.wordpress.org/trunk@21998 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-25 07:10:09 +00:00
Andrew Nacin 991be145a9 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: https://develop.svn.wordpress.org/trunk@21948 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-21 22:52:54 +00:00
Daryl Koopersmith 7b999727ce Rename the attachment-thumbnail class in the media modal Attachment view to prevent conflicts with wp_get_attachment_image(). see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21909 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 01:10:17 +00:00
Andrew Nacin 22ba686ace 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: https://develop.svn.wordpress.org/trunk@21833 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-13 17:06:25 +00:00
Andrew Nacin 78cc9eac60 oEmbed uses author_can(), not current_user_can(). props DrewAPicture, fixes #21880.
git-svn-id: https://develop.svn.wordpress.org/trunk@21830 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-13 16:42:43 +00:00
Daryl Koopersmith 7955b982b3 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: https://develop.svn.wordpress.org/trunk@21785 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-07 22:09:40 +00:00
Daryl Koopersmith c7eca8e2d5 Use icons for non-image attachments in the new media modal. see #21836, #21390, #21808.
git-svn-id: https://develop.svn.wordpress.org/trunk@21784 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-07 21:27:07 +00:00
Mark Jaquith d906bd2f70 use 'ids' parameter for explicit attachment ordering in [gallery] shortcodes. fixes #21816
git-svn-id: https://develop.svn.wordpress.org/trunk@21778 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-06 19:19:56 +00:00
Daryl Koopersmith 073cd101f5 Add checks for attachment metadata when formatting attachments for JS.
Prevents notices from causing malformed ajax responses.

see #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@21772 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-06 09:50:41 +00:00
Daryl Koopersmith ec0ee0164c 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: https://develop.svn.wordpress.org/trunk@21769 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-06 07:46:15 +00:00
Ryan Boren 31ec698423 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: https://develop.svn.wordpress.org/trunk@21735 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-04 16:29:28 +00:00
Daryl Koopersmith 436bf0016f 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: https://develop.svn.wordpress.org/trunk@21691 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 19:14:43 +00:00
Daryl Koopersmith 5a4a17687a 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: https://develop.svn.wordpress.org/trunk@21683 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 04:54:23 +00:00
Andrew Nacin c7ba96ddaa 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: https://develop.svn.wordpress.org/trunk@21680 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 02:04:40 +00:00
Ryan Boren de06b81360 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: https://develop.svn.wordpress.org/trunk@21597 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-23 20:01:10 +00:00
Ryan Boren 46dd14c4e1 Introduce wp_oembed_remove_provider(). Props r-a-y. fixes #16327
git-svn-id: https://develop.svn.wordpress.org/trunk@21351 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-26 20:18:27 +00:00
Daryl Koopersmith 299642f86b 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: https://develop.svn.wordpress.org/trunk@21014 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-06 21:45:17 +00:00
Andrew Nacin 26ff22c7a2 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: https://develop.svn.wordpress.org/trunk@20701 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 20:58:57 +00:00
Andrew Nacin f2c495e011 Add filter to image_resize_dimensions() so plugins can perform this calculation on their own. props ebababi. fixes #15989.
git-svn-id: https://develop.svn.wordpress.org/trunk@20694 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 20:15:44 +00:00
Andrew Ozz 95808e088f 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: https://develop.svn.wordpress.org/trunk@20679 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 01:14:52 +00:00
Jon Cave 7a276ec3fb wp_oembed_get() returns false on failure. Props SergeyBiryukov. Fixes #20355.
git-svn-id: https://develop.svn.wordpress.org/trunk@20562 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-22 11:19:56 +00:00
Andrew Nacin 6caf12d0bc 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: https://develop.svn.wordpress.org/trunk@20230 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-21 03:21:07 +00:00
Daryl Koopersmith 7d868db67b Theme Customizer: Bind wp_plupload_default_settings() to the customize_controls_enqueue_scripts hook. Fixes JS errors. see #19910, [20189].
git-svn-id: https://develop.svn.wordpress.org/trunk@20197 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 19:46:15 +00:00
Andrew Nacin c5ebfc0584 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: https://develop.svn.wordpress.org/trunk@20189 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 12:53:39 +00:00
Andrew Nacin 763e26aa32 URL to admin-ajax.php should be relative. see #19910. see #18952.
git-svn-id: https://develop.svn.wordpress.org/trunk@20188 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 12:52:23 +00:00
Andrew Nacin e8f20b741c Ensure no nonce or multipart_params get passed to the plupload_default_settings filter. see #19910.
git-svn-id: https://develop.svn.wordpress.org/trunk@20187 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 12:50:18 +00:00
Daryl Koopersmith d254551dd7 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: https://develop.svn.wordpress.org/trunk@20179 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 04:14:05 +00:00
Andrew Nacin 0c751dd7a3 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: https://develop.svn.wordpress.org/trunk@19871 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-08 16:12:11 +00:00
Ryan Boren 2b186b0c45 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: https://develop.svn.wordpress.org/trunk@19712 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-08 17:01:11 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Ryan Boren 4e081d3171 phpdoc typo and readability fixes. Props SergeyBiryukov. fixes #18560
git-svn-id: https://develop.svn.wordpress.org/trunk@18827 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-29 22:57:43 +00:00
Jon Cave 82c0f09c09 Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: https://develop.svn.wordpress.org/trunk@18639 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-05 19:08:15 +00:00
Ryan Boren aee898a1e7 Remove unused global. Props ocean90. fixes #18484
git-svn-id: https://develop.svn.wordpress.org/trunk@18605 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-25 19:35:22 +00:00
Nikolay Bachiyski 13181c96c8 Explicitly globalize some variables, so that unit tests can run WordPress inside a function. Fixes #17749
git-svn-id: https://develop.svn.wordpress.org/trunk@18532 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-11 04:45:14 +00:00
Andrew Nacin ca451ee1a9 Remove default-embeds.php. fixes #17112.
git-svn-id: https://develop.svn.wordpress.org/trunk@17751 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-28 17:03:23 +00:00
Peter Westwood 8f1955ddf5 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: https://develop.svn.wordpress.org/trunk@17749 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-28 16:25:36 +00:00
Ryan Boren e70b2d4412 Remove PHP4 constructor. Props Jayjdk. see #16768
git-svn-id: https://develop.svn.wordpress.org/trunk@17631 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-11 18:57:34 +00:00
Andrew Nacin 20b7808094 Document that the size parameter in image_downsize() can also be an array. props scribu, fixes #16263.
git-svn-id: https://develop.svn.wordpress.org/trunk@17542 602fd350-edb4-49c9-b593-d223f7449a82
2011-03-23 18:46:38 +00:00
Andrew Nacin 41d4279b66 use_default_gallery_style boolean filter and new gallery-columns-* class. see #15103.
git-svn-id: https://develop.svn.wordpress.org/trunk@16865 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-10 19:15:37 +00:00