Commit Graph

382 Commits

Author SHA1 Message Date
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 Ozz
7862ae7294 Post locked dialog: remove the "Go to" part from the button as it's not translatable. Fixes #24547.
git-svn-id: http://core.svn.wordpress.org/trunk@24527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-27 21:59:48 +00:00
Andrew Nacin
c0c884b522 Better cap checks in _wp_translate_post_data().
git-svn-id: http://core.svn.wordpress.org/trunk@24478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 06:00:59 +00:00
Mark Jaquith
5626969d0b Restore post format previewing.
props azaozz. fixes #24483

git-svn-id: http://core.svn.wordpress.org/trunk@24414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-06 14:39:08 +00:00
Andrew Ozz
5642a56311 Post locks:
- When a post is locked, ensure the 'Go back' button doesn't reload the same screen. If no referrer, change the button from 'Go back' to 'Go to All Posts'/'Go to All Pages' etc.
- Remove restriction on checking locks only for posts.
See #23697.



git-svn-id: http://core.svn.wordpress.org/trunk@24408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-05 03:01:59 +00:00
Mark Jaquith
89fd06e44b First pass at removing Post Format UI.
see #24452. fixes #24455.

git-svn-id: http://core.svn.wordpress.org/trunk@24388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-30 21:33:46 +00:00
Andrew Ozz
a26190eb2e Post locks:
- Change from IDs to classes for the notification-dialog divs so they can be reused.
- Do not check post locks if the dialog's html is not present.
- Do not check post locks if there is only one user on a single site install.
See #23697.

git-svn-id: http://core.svn.wordpress.org/trunk@24304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 19:36:29 +00:00
Mark Jaquith
5ee1a961a4 Ensure that draft posts cannot be given a non-unique post slug when using Quick Edit.
fixes #22902. props SergeyBiryukov.

git-svn-id: http://core.svn.wordpress.org/trunk@24206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-08 21:26:17 +00:00
Andrew Ozz
d2a8f064aa Post locks:
- Show 'Saving revision...' while autosaving after a post has been taken over. Change to 'Your latest changes were saved as a revision.' when autosave completes.
- Make sure a user exists before using $user->display_name.
- Add 'post_lock_text' action for extending the message text.

git-svn-id: http://core.svn.wordpress.org/trunk@24042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-22 03:08:51 +00:00
Mark Jaquith
412161de03 Standardize post format postmeta keys around the ones already used by the Crowd Favorite plugin.
props wonderboymusic. fixes #24010.

git-svn-id: http://core.svn.wordpress.org/trunk@24021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-17 20:57:44 +00:00
Mark Jaquith
21bb61466a Only say we accept a raw video/audio embed code for unfiltered_html users.
props wonderboymusic. see #23961

git-svn-id: http://core.svn.wordpress.org/trunk@23985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-14 01:21:47 +00:00
Andrew Ozz
33dd4b3d69 Revisions:
- Store the post format as meta on revisions (including autosaves).
- Add post formats data (post meta) when autosaving.
- Only add non-empty post formats data to revisions.
- Correct the post format when previewing a published post.
Props kovshenin, see #19570, see #20564.


git-svn-id: http://core.svn.wordpress.org/trunk@23928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-06 23:18:52 +00:00
Mark Jaquith
1127ad37a8 Use the revisioned post format metadata when previewing.
fixes #23539. props kovshenin.

git-svn-id: http://core.svn.wordpress.org/trunk@23862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 12:08:42 +00:00
Sergey Biryukov
fc26b5e683 Remove duplicate array keys. props kovshenin. see #19570.
git-svn-id: http://core.svn.wordpress.org/trunk@23861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 11:07:09 +00:00
Mark Jaquith
c93e0231af Post Format UI.
* Icons
* Selection
* Prompt text
* Special fields
* Styling
* Sparkles

This is going to need testing, polish, and love.

see #19570. props melchoyce, helen, wonderboymusic, lessbloat, rachelbaker, aaroncampbell, DrewAPicture, ryelle.

git-svn-id: http://core.svn.wordpress.org/trunk@23843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 03:35:41 +00:00
Andrew Ozz
667e779968 Post locks: contain focus inside the dialog when tabbing, remove outline when focus is on the text, see #23697
git-svn-id: http://core.svn.wordpress.org/trunk@23763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-21 00:57:27 +00:00
Ryan Boren
830c802c90 Don't allow changing the post format from quick edit and bulk edit. These do not have sufficient context to set the post format.
Props kovshenin
fixes #23426


git-svn-id: http://core.svn.wordpress.org/trunk@23742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-18 17:24:24 +00:00
Andrew Ozz
30ad180d6a Create one autosave per user rather than a single autosave for all users. Remove unused code from autosave.js and wp_ajax_autosave(). See #23665.
git-svn-id: http://core.svn.wordpress.org/trunk@23735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-16 21:15:43 +00:00
Andrew Ozz
10f565cd6c Post locks: when a dialog is shown move focus to the text, see #23697
git-svn-id: http://core.svn.wordpress.org/trunk@23733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-16 20:46:37 +00:00
Andrew Ozz
99488cb638 Post locks: add Preview button when post is locked, fix the suggested places, see #23312
git-svn-id: http://core.svn.wordpress.org/trunk@23725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-15 21:09:20 +00:00
Andrew Ozz
edb9333d40 Check post locks with heartbeat and display modal notifications when a post is locked or a user takes over editing, props dh-shredder, see #23697
git-svn-id: http://core.svn.wordpress.org/trunk@23661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-12 03:22:30 +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
Sergey Biryukov
4aca3c1e89 Consistently apply 'preview_post_link' filter. fixes #19378.
git-svn-id: http://core.svn.wordpress.org/trunk@23560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:46: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
Helen Hou-Sandí
ad85d07189 Edit screen UI for post formats: a first run for functionality.
* Adds a very basic tabbed interface for selecting a post format (requires JS).
* Extra fields, which are post meta, are shown/hidden based on the selected format.
* Introduce a helper function for retrieving formats-specific metadata: `get_post_format_meta()`.
* Image selection uses the media modal, although without filtering or from URL support at the moment.

props rachelbaker, wonderboymusic, aaroncampbell, helen. see #19570.


git-svn-id: http://core.svn.wordpress.org/trunk@23449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-18 19:11:24 +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
68524f7c6f Run the attachment_fields_to_save filter even if we don't get the fields we used to get. props nacin. fixes #22774
git-svn-id: http://core.svn.wordpress.org/trunk@23094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 05:34:17 +00:00
Andrew Nacin
08401b9e3c Fix branchhing in edit_post() where attachment_fields_to_save would only run when the alt text was sent. It should run whenever an attachment is saved. props sc0ttclark. fixes #22774.
git-svn-id: http://core.svn.wordpress.org/trunk@23088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 03:50:31 +00:00
Andrew Nacin
5d0933d884 Bring Featured Images back into the main media dialog.
Most users don't realize that the Featured Image meta box exists; if they do, few use it.

Restores the old meta box UI, including the admin_post_thumbnail_html filter. If a plugin is using _wp_post_thumbnail_html() in conjunction with Thickbox elsewhere, it will also magically still work.

Specific underlying changes:
 * Converts the modal view to use the view manager, which means that a call to open() will automatically call render and attach if necessary.
 * Doesn't automatically set a state in wp.media, to allow code to customize the states to be added before activation.

props koopersmith.
fixes #21776.



git-svn-id: http://core.svn.wordpress.org/trunk@22979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 02:38:10 +00:00
Ryan Boren
ea3e47bc08 Add a create_posts check to _wp_translate_postdata(). Move the edit_post check to the top of the function.
Props nacin
fixes #22417


git-svn-id: http://core.svn.wordpress.org/trunk@22950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-30 14:03:47 +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
Peter Westwood
ecbbb81587 Posting: Improve the capability checking _wp_translate_postdata() when updating posts.
* Use the specific post_type's 'edit_post' cap
* Pass the ID of the post being edited.

Fixes #22417


git-svn-id: http://core.svn.wordpress.org/trunk@22769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 16:34:57 +00:00
Daryl Koopersmith
5b11aea8f5 Media: Dynamically generate attachment filters using get_post_mime_types().
Moves `get_post_mime_types()` from `wp-admin/includes/post.php` to `wp-includes/post.php`.

fixes #22514, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 10:18:59 +00:00
Andrew Nacin
97032e08aa Revert page on front changes. Reverts [22127] [22129] [22135] [22136]. see #16379.
git-svn-id: http://core.svn.wordpress.org/trunk@22653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 01:28:32 +00:00
Daryl Koopersmith
30e0a600bf Media: Add title, caption, and alt text, and attachment info to sidebar.
* Improve sidebar styles.
* Separate the hybrid title/caption field.
* Improve the sidebar image thumbnail.
* Remove filenames from inside the non-image icon thumbnail.
* Properly sync title/caption/alt.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 18:25:04 +00:00
Andrew Nacin
28777ee3c4 Always return an integer from post_exists(). props barrykooij. fixes #21607.
git-svn-id: http://core.svn.wordpress.org/trunk@22410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-06 23:27:21 +00:00
Andrew Nacin
1617e5ebdf Move the static front page saving routine to a single sanitize_option() callback for show_on_front. page_on_front and page_for_posts are now manually set by this callback, and not separately by options.php. see #16379.
git-svn-id: http://core.svn.wordpress.org/trunk@22136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-08 21:25:13 +00:00
Andrew Nacin
d8936dc1aa Pass the screen context directly to get_sample_permalink_html(). see #16379.
git-svn-id: http://core.svn.wordpress.org/trunk@22129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 03:44:30 +00:00
Ryan Boren
90288a07b7 Better UI for doing "Page on Front".
Props SergeyBiryukov, lessbloat, nacin.

see #16379


git-svn-id: http://core.svn.wordpress.org/trunk@22127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-06 15:19:29 +00:00
Andrew Nacin
e4c209f18b Remove old autosave collision code from edit_post(). props miqrogroove.
This code, which could block autosaves when drafts had future timestamps,
dates to before autosaves were saved as revisions and is no longer necessary.

fixes #21858.



git-svn-id: http://core.svn.wordpress.org/trunk@21949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-22 02:11: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
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
Peter Westwood
fa8a509ff3 Posting: Improve the invalid date protection code based on feedback from nacin.
* Introduce a wp_checkdate() function with a single filter to centralise the code that validates dates.
 * Improve the error message
 * Correctly handle the return value of wp_insert_post which is not always a WP_Error on failure

Fixes #17180


git-svn-id: http://core.svn.wordpress.org/trunk@21922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-20 10:46:50 +00:00
Peter Westwood
c05f6dc6dd Posting: Make it much harder to create posts with invalid dates by enforcing the post date tests in the UI and the backend code.
Previously you could quite easily send a new post into the back of beyond by specifying an invalid date like the 30th Feb and this was very confusing.
Sometimes it would seem to work and sometimes the post would end up very far in the past - depending on the mysql version and other factors.

Fixes #17180 props jkudish.


git-svn-id: http://core.svn.wordpress.org/trunk@21921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 21:43:35 +00:00
Andrew Nacin
f431b408da Combine some strings. props pavelevap. fixes #21087.
git-svn-id: http://core.svn.wordpress.org/trunk@21857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 19:57:05 +00:00
Ryan Boren
d8013dfc0a Deprecate get_default_post_to_edit(). Props SergeyBiryukov. fixes #21677
git-svn-id: http://core.svn.wordpress.org/trunk@21800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 20:39:45 +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
12c21bf931 First pass at integrating featured images with the new media workflow.
Updates the featured image when the publish/update button is clicked (rather than instantly). Uses the existing post_thumbnail_meta_box() function. Does not remove the old featured image meta box JS, ajax handler, or CSS.

see #21776, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-06 08:49:35 +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