Commit Graph

358 Commits

Author SHA1 Message Date
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
Ryan Boren 52b3f498e6 Add tags_input, page_template, and post_category get magic to WP_Post.
Deprecate get_post_to_edit() and wp_get_single_post().
Props scribu
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-28 19:08:28 +00:00
Ryan Boren 18a1783423 Update phpdoc for functions that return WP_Post. Soft deprecate get_page(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:34:41 +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
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 70eae0e09b Standardize our "View Post" new-tab/no-new-tab behavior. Committed this thirtieth day of June, Anno Domini MMXII. May peace and good sense forever reign in this realm. Uh... Amen.
props SergeyBiryukov. fixes #11406.

git-svn-id: http://core.svn.wordpress.org/trunk@21189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-30 08:49:26 +00:00
nacin dfa7b94b83 Add inline documentation for wp_edit_attachments_query(). props simonwheatley, SergeyBiryukov. fixes #21105.
git-svn-id: http://core.svn.wordpress.org/trunk@21179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 15:09:14 +00:00
markjaquith 55278fa7a4 Pass the post ID to the admin_post_thumbnail_html filter. props helenyhou. fixes #20891
git-svn-id: http://core.svn.wordpress.org/trunk@21173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:41:04 +00:00
ryan 8c114f0c54 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@20715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 16:41:59 +00:00
ryan 25ec571dae Pass the upload iframe src url as an arg to sprintf to avoid treating octets as
format specifiers. Fixes setting the featured image on blogs containing spaces in the install path. Props rosshanney. fixes #20443


git-svn-id: http://svn.automattic.com/wordpress/trunk@20594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 20:24:20 +00:00
ryan 28f8e7a63d Move deletion of auto-draft posts to the wp_scheduled_delete cron function. Props mgolawala. fixes #19663
git-svn-id: http://svn.automattic.com/wordpress/trunk@20440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:39:09 +00:00
azaozz f350421746 Improve _fix_attachment_links(), replace attachment URLs with the real permalink only for published posts, re-save only when there are changes, see #13429
git-svn-id: http://svn.automattic.com/wordpress/trunk@20308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-28 16:02:12 +00:00
ryan e4ce1046b0 Pass post id to get_upload_iframe_src() instead of relying on a global. Props tott. fixes #20003
git-svn-id: http://svn.automattic.com/wordpress/trunk@19999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-27 19:23:03 +00:00
ryan 86901353cf Add post ID argument to _wp_post_thumbnail_html() rather than relying on a global. Post the ID from wp_ajax_set_post_thumbnail(). Props batmoo. fixes #20003
git-svn-id: http://svn.automattic.com/wordpress/trunk@19902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-10 17:41:37 +00:00
nacin 72c995441a Allow localized commas to be used as tag separators. see #7897.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-07 18:06:12 +00:00
nacin d6fb70098f Prefix table name against the post_parent field in _edit_attachments_query_helper() to avoid ambiguous queries. props benbalter. fixes #19779.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-09 15:55:30 +00:00
ryan 83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +00:00
ryan 340e93324c Remove extraneous spaces. Props kenan3008, dimadin. fixes #19501 #19433
git-svn-id: http://svn.automattic.com/wordpress/trunk@19596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-14 17:36:38 +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
nacin 97dcf902db Revert [19372] for 3.3. see #13473.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-24 16:06:17 +00:00
westi a29b2945ae Respect the default comment/ping status for new posts even when someone has hidden the meta box which lets you alter them on a per-post basis.
Fixes #13473 props solarissmoke. 


git-svn-id: http://svn.automattic.com/wordpress/trunk@19372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-21 13:45:10 +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
nacin 8721427446 Initialize the post object in get_default_post_to_edit(). props tech163. fixes #18049.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 21:35:05 +00:00
azaozz 75432d53b0 Clean up remnants from having negative Post_IDs, props markjaquith, fixes #18235
git-svn-id: http://svn.automattic.com/wordpress/trunk@18823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 21:47:52 +00:00
nacin de8cc0eae1 Release a user's post lock when the user leaves a post. see #18515.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-27 20:52:07 +00:00