Commit Graph

511 Commits

Author SHA1 Message Date
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 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
Ryan Boren 847f435e9f Directly access post_status instead of using get_post_status() when checking for auto-draft status. Attachments with their inherit post_status were getting the auto-draft status of their parent when using get_post_status(). This caused some things to display improperly on the edit attachment page.
Props nacin, miqrogroove
fixes #22672


git-svn-id: http://core.svn.wordpress.org/trunk@22963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-01 23:12:30 +00:00
Andrew Nacin ee158786ba Media help. props DrewAPicture, merty, Ipstenu. fixes #22451.
git-svn-id: http://core.svn.wordpress.org/trunk@22925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-29 17:51:54 +00:00
Andrew Nacin 902314ad3c No AYS or autosave for attachments on post.php. Reverts part of [22725]. fixes #22491.
git-svn-id: http://core.svn.wordpress.org/trunk@22858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 02:02:32 +00:00
Ryan Boren eb404cc867 Consolidate some strings. Props SergeyBiryukov. see #21087
git-svn-id: http://core.svn.wordpress.org/trunk@22854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 23:12:11 +00:00
Andrew Nacin c760270ca6 Updates to post.php help text for posts and pages, including a new section on inserting media. props DrewAPicture, Ipstenu. see #22451.
git-svn-id: http://core.svn.wordpress.org/trunk@22813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 09:00:39 +00:00
Andrew Ozz bc2f40d303 Fix typo in [22795]
git-svn-id: http://core.svn.wordpress.org/trunk@22796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 21:16:19 +00:00
Andrew Ozz 522376a1f1 Improve AYS comparison on the Edit Attachment screen, props nacin, fixes #22491
git-svn-id: http://core.svn.wordpress.org/trunk@22795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 21:11:21 +00:00
Andrew Nacin 51f2e14b46 Use a variable that is set a few lines up. $post_id is set only in post.php, not post-new.php. fixes #21092.
git-svn-id: http://core.svn.wordpress.org/trunk@22742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 09:35:23 +00:00
Andrew Nacin 418c9985f7 Media: For pages, use 'Insert into page' rather than 'Insert into post'.
Custom post types can use the media_view_strings filter. No new post type "labels" for now.

see #22712. see #21092 (and #19696).



git-svn-id: http://core.svn.wordpress.org/trunk@22735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 23:22:03 +00:00
Andrew Ozz 0e38402629 Don't load autosave.js on the attachment editing screen, add simple AYS on unload if there are changes, props helenyhou, fixes #22491
git-svn-id: http://core.svn.wordpress.org/trunk@22725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 19:46:38 +00:00
Andrew Nacin 7e0061375a No-JS fixes.
* Hide QuickPress.
 * Hide the gap between the title and content editor.
 * Hide 'select all' checkboxes in list tables.
 * Hide a non-functioning link in the custom fields metabox.
 * Hide non-functioning buttons in the featured image box (same as in 3.4).
 * RTL and miscellany.

props TobiasBg, lessbloat, ocean90. fixes #22456.



git-svn-id: http://core.svn.wordpress.org/trunk@22719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 18:20:14 +00:00
Daryl Koopersmith ce619e07f0 Media: Ensure media and its dependencies are included when a post type supports the editor or featured images. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 05:10:07 +00:00
Daryl Koopersmith 0a67c025e5 Media: Add wp_enqueue_media to easily include all media dependencies.
Also, media templates now print on `wp_footer`.

props sushkov. fixes #22060, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 04:57:25 +00:00
Andrew Nacin 9acf7ceb26 edit_form_after_editor action. props helenyhou. fixes #19658.
git-svn-id: http://core.svn.wordpress.org/trunk@22446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 21:49:47 +00:00
Ryan Boren ad724f3b7b Attachment editor improvements. Put the non-editable metadata into the submit/publish box.
Props helenyhou
see #21391


git-svn-id: http://core.svn.wordpress.org/trunk@22364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-05 14:04:22 +00:00
Ryan Boren a550a6d489 Use the create_posts capability in more places.
In get_post_type_capabilities(), make sure create_posts reflects customizations to the edit_posts capability when create_posts is not specifically set.


git-svn-id: http://core.svn.wordpress.org/trunk@22291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-24 22:15:43 +00:00
Daryl Koopersmith 0c42e6121a Add QuickPress support for new media workflow.
* Adds the code required to include the new media scripts, styles, and settings to `media_button()`.
* Improves script dependencies, namely making `media-upload` require `media-views`.
* Some CSS tweaks for the making the new button work well with QuickPress.

see #21390, fixes #22021.


git-svn-id: http://core.svn.wordpress.org/trunk@22072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 20:04:34 +00:00
Andrew Ozz 563c7caac5 Main editor: maintain the height when switching Visual to Text and back, save the height when resizing as user state, output the height in the textarea tag when loading, (thanks @nacin for the help), fixes #21718
git-svn-id: http://core.svn.wordpress.org/trunk@22007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 03:30:21 +00:00
Ryan Boren a678273b61 Add help to the attachment editor. Props DrewAPicture. see #21391
git-svn-id: http://core.svn.wordpress.org/trunk@21968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-24 13:13:09 +00:00
Daryl Koopersmith cd5f64584e Makes custom TinyMCE views easier to implement.
For details and examples, see the ticket.

props azaozz, fixes #21812.


git-svn-id: http://core.svn.wordpress.org/trunk@21961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-24 00:13:18 +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
Andrew Nacin c1b0670c2d Updates and fixes to the new button styles. By default, buttons are now the same size as they were in 3.4. Then there is a smaller button (designed for minor elements) and a larger button (designed for things like Publish and Save Changes). Better focus styles. props lessbloat. see #21598.
git-svn-id: http://core.svn.wordpress.org/trunk@21944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 19:34:23 +00:00
Daryl Koopersmith 67894a3407 New button styles.
Using the new buttons:

* Button classes are now stackable.
* All buttons should use a base class of "button".
* Buttons default to the gray style (formerly "button-secondary"). Buttons can add a style by adding additional classes. To make a primary button, add the "button-primary" class.
* Buttons can be rendered in various sizes. In addition to the default size, you can add "button-large", "button-small", or "button-tiny".

For backwards compatibility reasons, "button-primary" and "button-secondary" both work as standalone classes.

get_submit_button() has been adjusted to handle shorthand button classes (i.e. button classes can be passed without the "button-" prefix).

props lessbloat, helenyhou, trepmal, nacin. see #21598.



git-svn-id: http://core.svn.wordpress.org/trunk@21789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-08 04:58:34 +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 Ozz 9f02c68a00 Don't hide the label for the Title on the Edit Post screen, use 'screen-reader-text' instead, props SergeyBiryukov, fixes #21458
git-svn-id: http://core.svn.wordpress.org/trunk@21584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-22 17:40:17 +00:00
Ryan Boren 15dd7f70b0 Remove post type from post nonces. Fixes attachment deletion when EMPTY_TRASH_DAYS is 0. Props c3mdigital, kurtpayne, SergeyBiryukov. fixes #21194
git-svn-id: http://core.svn.wordpress.org/trunk@21504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-14 18:39:15 +00:00
azaozz 34535097b7 Remove nearly all tabindex attributes from the admin, leaving them only where absolutely necessary (for now that's only the toolbar).
Add tabindex="-1" for the menu images links to avoid double tab stops there when the menu is expanded.

Fix/add auto-focus on the first input fields on the Add/Edit Post, all taxonomy, all edit taxonomy, Log In and Edit Comment screens.

See #21340.

git-svn-id: http://core.svn.wordpress.org/trunk@21311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-24 00:15:15 +00:00
azaozz 2309fcb9d7 TinyMCE: fix tabbig in and out of the editor, fixes #20834
git-svn-id: http://core.svn.wordpress.org/trunk@21300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-22 02:33:53 +00:00
markjaquith 813ca40b2f Switch "HTML" tab to "Text" in DFW mode. Update documentation and inline comments to refer to the "Text" tab or mode instead of "HTML". see #20993
git-svn-id: http://core.svn.wordpress.org/trunk@21212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 15:28:13 +00:00
azaozz 7380c0be3e Fix closing div position when post doesn't support editor, props markoheijnen, SergeyBiryukov, fixes #20709
git-svn-id: http://core.svn.wordpress.org/trunk@20832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-20 22:20:00 +00:00
ryan df7bd632f2 Clean out layout columns API in WP_Screen.
* Move layout column setup into render_screen_meta() so that the number of columns is available earlier.
* Store the user provisioned number of columns in an instance var.
* Access the var with get_columns()
* Move all templates away from the screen_layout_columns global to the get_columns() method.
* Deprecate the global
* Remove the no longer needed check for 'auto' in the user option.
* Cast the user option to an int.

Props griffinjt
fixes #20506


git-svn-id: http://svn.automattic.com/wordpress/trunk@20579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-24 20:46:04 +00:00
azaozz f5095b91d4 Dashboard and write screen columns: remove unneeded class from the .wrap div on Write/Edit screens, see #20015
git-svn-id: http://svn.automattic.com/wordpress/trunk@20570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-23 22:40:59 +00:00
azaozz 6aaf0dad43 Add the jQuery UI Touch Punch plugin to handle dragging on mobile devices, props georgestephanis, see #20014
git-svn-id: http://svn.automattic.com/wordpress/trunk@20433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 02:20:51 +00:00
azaozz bba9c91990 Responsive columns on the dashboard and write screens, first run, see #20015
git-svn-id: http://svn.automattic.com/wordpress/trunk@20272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 21:41:00 +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
koopersmith 58191c0b6b Fix grammar and remove references to 'new in 3.2' in the post editor help text. props dougwrites, see #19020.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-29 17:47:35 +00:00
azaozz 307f243ee4 Fix tabbing from 'title' to 'content', see #19088
git-svn-id: http://svn.automattic.com/wordpress/trunk@19206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-07 19:49:50 +00:00
nacin fa76992c20 Only call wp_comment_reply() on post.php if the post type supports comments. props zeo, fixes #17931.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-05 05:41:25 +00:00
nacin bfb98c193e s/add_help_sidebar/set_help_sidebar/g and introduce screen->remove_help_tab($id) and screen->remove_help_tabs(). see #19020, #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-02 20:14:10 +00:00
ryan 97d61ca5a2 Chain off of get_current_screen() instead of using global. see #19020
git-svn-id: http://svn.automattic.com/wordpress/trunk@19110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-02 02:38:37 +00:00
ryan 62afab8db3 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@19054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-24 19:13:23 +00:00
ryan d0d8eb2aaf Update meta box functions to handle WP_Screen objects and pass objects instead of IDs to them in core files. Allow passing emptiness to get the current screen. see #18958
git-svn-id: http://svn.automattic.com/wordpress/trunk@19013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-19 21:43:02 +00:00
nacin 35dd66044a Enforce IDs for add_help_tab(). props mbijon. Restore default_contextual_help, for now. see #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-11 19:29:09 +00:00
nacin 795ca8d394 Revert [18861], [18862], [18864], [18874], [18879], and [18880]. see #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-07 04:57:12 +00:00
nacin 5d33f15fb3 Kill the multisite mu_media_buttons option. see #17578.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-05 22:04:09 +00:00
azaozz f9ebf31d4a Revert 'auto' column setting, props markjaquith, see #18863
git-svn-id: http://svn.automattic.com/wordpress/trunk@18889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-05 18:46:21 +00:00
azaozz bbafdfa0e5 Use add_option() method, introduce add_option_context() method for adding specific text above the screen options, see #18690
git-svn-id: http://svn.automattic.com/wordpress/trunk@18867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-03 04:00:57 +00:00