Commit Graph

160 Commits

Author SHA1 Message Date
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
Andrew Nacin 63357b507a wp-caption-text class for the gallery shortcode caption. props chipbennett, fixes #14411.
git-svn-id: https://develop.svn.wordpress.org/trunk@16864 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-10 19:05:50 +00:00
Mark Jaquith 4ff9b0520b Pass post ID to embed_oembed_html filter to avoid global variable incantations. props filosofo. fixes #15491
git-svn-id: https://develop.svn.wordpress.org/trunk@16740 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-06 03:38:27 +00:00
Andrew Nacin 250e2876de Unescape ampersands before making an oEmbed request. props Viper007Bond, fixes #14514, see #11311.
git-svn-id: https://develop.svn.wordpress.org/trunk@16728 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-05 02:23:17 +00:00
Andrew Nacin e8dd42ce2a Revert [15688], [15689], [15691]. Try again in 3.2. see #14966.
git-svn-id: https://develop.svn.wordpress.org/trunk@16535 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-22 17:17:26 +00:00
scribu 3d1e3fc25f Add colon after Upload/Insert. Fixes #14810
git-svn-id: https://develop.svn.wordpress.org/trunk@16358 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-13 22:52:51 +00:00
scribu 58aedde597 Introduce wp_basename() and use it for media handling. See #11887
git-svn-id: https://develop.svn.wordpress.org/trunk@16154 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-02 17:19:55 +00:00
Andrew Nacin 8b0d9c5856 More pedantry.
git-svn-id: https://develop.svn.wordpress.org/trunk@15990 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-27 00:33:29 +00:00
Andrew Nacin 6fd30d36ea Docs and breathing room for get_media_buttons() and friends. see #14966.
git-svn-id: https://develop.svn.wordpress.org/trunk@15689 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-03 03:08:39 +00:00
Andrew Nacin ea2f90c70e Move some post and taxonomy functions from admin/includes to wp-includes in preparation for QuickPress template tag. Moves get_tags_to_edit, get_terms_to_edit, get_default_post_to_edit, media_buttons, _media_button, get_upload_iframe_src. Also introduce get_media_buttons as a wrapper for media_buttons. props jorbin, see #14966.
git-svn-id: https://develop.svn.wordpress.org/trunk@15688 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-03 02:58:59 +00:00
Andrew Nacin 9494e4ce7e Phpdoc argument/@param cleanups. props duck_, see #14783.
git-svn-id: https://develop.svn.wordpress.org/trunk@15590 602fd350-edb4-49c9-b593-d223f7449a82
2010-09-07 11:21:11 +00:00
Mark Jaquith 59f6264c64 These are not verbs. http://notaverb.com/badbad_verbs
git-svn-id: https://develop.svn.wordpress.org/trunk@15473 602fd350-edb4-49c9-b593-d223f7449a82
2010-07-27 18:02:45 +00:00
Mark Jaquith 05e2e9b2c4 Initialize instead of using isset(). props nacin. see #13556
git-svn-id: https://develop.svn.wordpress.org/trunk@15003 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-27 20:41:36 +00:00