Commit Graph

325 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
a24c40fb00 Consistently use $wp_rewrite->index instead of hardcoding "index.php".
props wonderboymusic. fixes #7337

git-svn-id: http://core.svn.wordpress.org/trunk@23305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-18 13:44:22 +00:00
Andrew Nacin
61577966d4 Pass the post ID from the_shortlink() to wp_get_shortlink() to avoid a change in filters. props SergeyBiryukov, fixes #21309.
git-svn-id: http://core.svn.wordpress.org/trunk@22564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 05:05:34 +00:00
Andrew Nacin
5b8081b787 Return nothing in get_adjacent_post() when $in_same_cat = true but the post doesn't support (or otherwise have) categories. Avoids SQL error. props batmoo, SergeyBiryukov. fixes #15959.
git-svn-id: http://core.svn.wordpress.org/trunk@22472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 21:16:15 +00:00
Andrew Nacin
30d048a1e7 Don't return encoded ampersands from get_post_comments_feed_link() to avoid canonical redirect issues. Apply esc_url() when appropriate.
props markjaquith, SergeyBiryukov. fixes #21841.



git-svn-id: http://core.svn.wordpress.org/trunk@22431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:56:10 +00:00
Andrew Nacin
6346dfe407 When stripping off a pathinfo home root (/index.php/) do it with case insensitivity. props SergeyBiryukov. fixes #13164. see #8847.
git-svn-id: http://core.svn.wordpress.org/trunk@22298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 20:09:54 +00:00
Ryan Boren
faca571a3a Avoid 'Only variables should be assigned by reference' warning. Props wonderboymusic. see #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 18:21:47 +00:00
Andrew Nacin
9555a89f0b Do not modify the post object in get_adjacent_post_rel_link(). Prior to 3.5 this could have poisioned the post's cache. props mdawaffe, fixes #22072.
git-svn-id: http://core.svn.wordpress.org/trunk@22095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 21:56:20 +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
Ryan Boren
a8fa7b3ad2 Honor https in home option.
fixes #20759


git-svn-id: http://core.svn.wordpress.org/trunk@21937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 12:36:50 +00:00
Ryan Boren
ce9a613cb6 Improve performance of query in get_adjacent_post(). Get the ID and then call get_post(). Props apokalyptik, nacin, javert03. fixes #18120
git-svn-id: http://core.svn.wordpress.org/trunk@21919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 18:11:43 +00:00
Ryan Boren
43a9a11ef9 Preserve the $format and $link arguments for passing to the previous|next_post_link filter. Pass $post to the filter.
Props Otto42, helenyhou
fixes #19640 #18764


git-svn-id: http://core.svn.wordpress.org/trunk@21802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 21:36:06 +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
c1d2f4770d Use set_url_scheme() in the *_url() functions to keep things DRY. Props johnbillion. fixes #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 14:44:17 +00:00
Ryan Boren
c55cf716da Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 13:33:00 +00:00
Andrew Nacin
47572e8305 Fix copy-paste error in get_term_feed_link() that caused the category_feed_link filter to run for tags, rather than tag_feed_link. props andrea.r, SergeyBiryukov. fixes #21589.
git-svn-id: http://core.svn.wordpress.org/trunk@21662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 03:49:44 +00:00
Ryan Boren
af91b41af3 Return WP_Post from get_adjacent_post(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-27 13:13:40 +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
Ryan Boren
6248d6221c Don't overwrite the post global in _get_page_link(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 19:28:58 +00:00
Peter Westwood
791eda2594 When comment paging is enabled make sure to have canonical links for each of the comment pages so that all the comments are indexed instead of just the ones that are displayed on the permalink itself.
Fixes #21579 props jkudish.


git-svn-id: http://core.svn.wordpress.org/trunk@21571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-21 12:53:54 +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
ryan
5ca54e7d2f Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option().
Use the regular option functions wrapped in switch_to_blog() and restore_current_blog() instead.

Group multiple operations within a single switch where possible.

fixes #21432


git-svn-id: http://core.svn.wordpress.org/trunk@21414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 17:51:42 +00:00
nacin
7127ed1197 Move most instances of new WP_User to get_userdata(). see #21120.
git-svn-id: http://core.svn.wordpress.org/trunk@21413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 01:06:05 +00:00
ryan
7b49ad8493 Introduce get_edit_user_link(). Props scribu, georgestephanis, johnbillion. fixes #14787 see #20307
git-svn-id: http://core.svn.wordpress.org/trunk@21364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-30 18:30:03 +00:00
markjaquith
de336fea5c More reliably replace $home_root in $request in get_pagenum_link(). props SergeyBiryukov. fixes #18034
git-svn-id: http://core.svn.wordpress.org/trunk@21174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:54:20 +00:00
nacin
5d5c5df4ae Add a post_link_category filter to the permalink generation process.
This allows a plugin to easily change which category gets represented
in the URL. Previously, it went off the category with the smallest ID.

props aaroncampbell
fixes #18752



git-svn-id: http://core.svn.wordpress.org/trunk@21169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:28:57 +00:00
ryan
c0339644ea Shears of vigorous pinking.
git-svn-id: http://core.svn.wordpress.org/trunk@20944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-27 16:25:43 +00:00
ryan
46e4ffe765 Introduce set_url_scheme(). Includes get_site_url() logic for determining when to use http vs. https. Use this to rerite urls to obey is_ssl(). Props jkudish. fixes #18017
git-svn-id: http://core.svn.wordpress.org/trunk@20828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-18 20:04:59 +00:00
nacin
4c7a3a6492 Always escape the output of get_pagenum_link(). fixes #14556.
git-svn-id: http://core.svn.wordpress.org/trunk@20685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 16:29:39 +00:00
duck_
9eaf6fc4c3 Handle uppercase HTML entities in get_previous_posts_link(). Props ounziw. See #4152, fixes #19803.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-19 15:08:06 +00:00
duck_
a395e06896 Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:29:33 +00:00
ryan
d910c26182 Pinking shears 6-20000
git-svn-id: http://svn.automattic.com/wordpress/trunk@20000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-27 19:46:52 +00:00
nacin
f4901860b6 Add reminder to version the Press This bookmarklet link in case breaking changes are made in the future. fixes #20071.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-18 18:46:15 +00:00
nacin
eef151f568 Introduce 'relative' scheme to return only the paths for home_url, site, admin, network_, and get_ variants. props SergeyBiryukov, see #18952.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 16:09:41 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +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
616c35e71c One newline is enough.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +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
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
32e25b6aec phpdoc typo and readability fixes. Props SergeyBiryukov. fixes #18560
git-svn-id: http://svn.automattic.com/wordpress/trunk@18827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 22:57:43 +00:00
nacin
a96e0dff91 Remove support for <link rel=start>, end, up, and index. These rel="" values have been dropped by the HTML Working Group. props Elpie, kawauso, fixes #18128.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-15 16:54:59 +00:00
duck_
2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
nacin
be2717a50f Fire _deprecated_argument() for get_adjacent_post()'s crazy excluded_categories 'and' thing. fixes #17673.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-28 17:30:18 +00:00
ryan
3209c103dc Support an array or comma-seperated list of excluded category IDs in get_adjacent_post(). Props solarissmoke. fixes #17673
git-svn-id: http://svn.automattic.com/wordpress/trunk@18477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-28 17:19:51 +00:00
ryan
4fa8ee19e4 Fix handing of super admins that don't have a blog in get_dashboard_url() and login. Props nacin. fixes #17829
git-svn-id: http://svn.automattic.com/wordpress/trunk@18328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-22 19:45:28 +00:00
ryan
daa14c36f9 Bring out the pinking shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-10 23:01:45 +00:00
ryan
8e21f7f098 Translate default link labels for *posts_link(). Props nathanrice, CharlesClarkson. fixes #16998
git-svn-id: http://svn.automattic.com/wordpress/trunk@17728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-27 21:25:09 +00:00
ryan
05f63a579b s/esc_url_raw/esc_url/. Props duck_.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-01 19:29:06 +00:00
markjaquith
59f5dff476 Correctly handle PATHINFO CPTs and CTs that specify with_front=false. fixes #16807 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-10 04:24:48 +00:00
ryan
85f1feed84 Bring out the shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-06 04:11:14 +00:00