Commit Graph

335 Commits

Author SHA1 Message Date
Mark Jaquith d8310e4c7e Allow `the_title_attribute()` to receive a `post` argument, and use this in `get_adjacent_post_rel_link()` to make sure tags are stripped from the title output there.
Fixes #24232.

git-svn-id: https://develop.svn.wordpress.org/trunk@24783 602fd350-edb4-49c9-b593-d223f7449a82
2013-07-23 16:05:40 +00:00
Mark Jaquith 1fb9b2cfa1 Revisions: real URLs and preloading of the requested diff.
* Real URLs are being used now, using pushState. `?revision={id}` or `?from={from}&to={to}`.
* Drop the redundant `action=edit` from the URLs (this is the default).
* The initial comparison is preloaded, whether a single revision or a compare-two situation.

See #24425.

git-svn-id: https://develop.svn.wordpress.org/trunk@24664 602fd350-edb4-49c9-b593-d223f7449a82
2013-07-11 22:56:48 +00:00
Andrew Nacin f3b332e9bb 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: https://develop.svn.wordpress.org/trunk@24593 602fd350-edb4-49c9-b593-d223f7449a82
2013-07-08 20:05:42 +00:00
Sergey Biryukov b5bb40cf2a Use capitalized ID column name in get_adjacent_post(). props hypertextranch. fixes #24575.
git-svn-id: https://develop.svn.wordpress.org/trunk@24506 602fd350-edb4-49c9-b593-d223f7449a82
2013-06-24 13:11:43 +00:00
Sergey Biryukov fbc2a6ca6d PHPDoc fixes and additions. fixes #24616.
git-svn-id: https://develop.svn.wordpress.org/trunk@24490 602fd350-edb4-49c9-b593-d223f7449a82
2013-06-21 12:45:11 +00:00
Sergey Biryukov 2b666b1ef8 Avoid PHP notices in Media Library if an attachment parent does not exist. props trepmal, viniciusmassuchetto, alex-ye, adamsilverstein for initial patches. fixes #22312. fixes #23154.
git-svn-id: https://develop.svn.wordpress.org/trunk@24182 602fd350-edb4-49c9-b593-d223f7449a82
2013-05-07 11:46:35 +00:00
Sergey Biryukov 9dc7a6a22f Avoid an undefined index notice in get_post_type_archive_feed_link(). props ericlewis. fixes #23744.
git-svn-id: https://develop.svn.wordpress.org/trunk@23660 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-12 01:50:46 +00:00
Ryan Boren c363aea627 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: https://develop.svn.wordpress.org/trunk@23554 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-01 16:28:40 +00:00
Andrew Nacin 3c4c5649fe Allow paths with two consecutive dots to be passed to home_url() and all related *_url() functions.
props markjaquith.
fixes #19032.



git-svn-id: https://develop.svn.wordpress.org/trunk@23537 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-28 21:04:26 +00:00
Andrew Nacin 48ddbda8f8 Automatically esc_url() the URL echoed by the_permalink().
This makes the_permalink() useful, rather than needing to do `echo esc_url( get_permalink() )` to get proper encoding of ampersands, etc. This will not double-encode when esc_url() has already been applied to the filter here, but that code can now be removed.

props mfields.
fixes #17562.



git-svn-id: https://develop.svn.wordpress.org/trunk@23527 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-28 18:56:39 +00:00
Ryan Boren a6c8efadb9 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: https://develop.svn.wordpress.org/trunk@23416 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-14 22:51:06 +00:00
Mark Jaquith 524e73f175 Consistently use $wp_rewrite->index instead of hardcoding "index.php".
props wonderboymusic. fixes #7337

git-svn-id: https://develop.svn.wordpress.org/trunk@23305 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-18 13:44:22 +00:00
Andrew Nacin 24e95b5bd9 Pass the post ID from the_shortlink() to wp_get_shortlink() to avoid a change in filters. props SergeyBiryukov, fixes #21309.
git-svn-id: https://develop.svn.wordpress.org/trunk@22564 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-14 05:05:34 +00:00
Andrew Nacin 0758d4e647 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: https://develop.svn.wordpress.org/trunk@22472 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-08 21:16:15 +00:00
Andrew Nacin c2ad4403de 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: https://develop.svn.wordpress.org/trunk@22431 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-07 19:56:10 +00:00
Andrew Nacin 7ff116f14a When stripping off a pathinfo home root (/index.php/) do it with case insensitivity. props SergeyBiryukov. fixes #13164. see #8847.
git-svn-id: https://develop.svn.wordpress.org/trunk@22298 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-25 20:09:54 +00:00
Ryan Boren e22b981706 Avoid 'Only variables should be assigned by reference' warning. Props wonderboymusic. see #21865
git-svn-id: https://develop.svn.wordpress.org/trunk@22114 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-04 18:21:47 +00:00
Andrew Nacin 7f2ab732c4 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: https://develop.svn.wordpress.org/trunk@22095 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 21:56:20 +00:00
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
Ryan Boren 0012dd0e73 Honor https in home option.
fixes #20759


git-svn-id: https://develop.svn.wordpress.org/trunk@21937 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-21 12:36:50 +00:00
Ryan Boren 54e1f4abfd 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: https://develop.svn.wordpress.org/trunk@21919 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 18:11:43 +00:00
Ryan Boren 8ffcb66a9a 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: https://develop.svn.wordpress.org/trunk@21802 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-10 21:36:06 +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
Ryan Boren 9542f6ecd4 Use set_url_scheme() in the *_url() functions to keep things DRY. Props johnbillion. fixes #20759
git-svn-id: https://develop.svn.wordpress.org/trunk@21734 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-04 14:44:17 +00:00
Ryan Boren 92ea34f6a2 Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: https://develop.svn.wordpress.org/trunk@21664 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-30 13:33:00 +00:00
Andrew Nacin c75298604f 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: https://develop.svn.wordpress.org/trunk@21662 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-30 03:49:44 +00:00
Ryan Boren 62f9874a23 Return WP_Post from get_adjacent_post(). see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21627 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-27 13:13: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 861a8fb246 Don't overwrite the post global in _get_page_link(). see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21596 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-23 19:28:58 +00:00
Peter Westwood 4803997d35 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: https://develop.svn.wordpress.org/trunk@21571 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-21 12:53:54 +00:00
Ryan Boren 4974f5f233 Remove post type from post nonces. Fixes attachment deletion when EMPTY_TRASH_DAYS is 0. Props c3mdigital, kurtpayne, SergeyBiryukov. fixes #21194
git-svn-id: https://develop.svn.wordpress.org/trunk@21504 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-14 18:39:15 +00:00
Ryan Boren ce960f67a0 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: https://develop.svn.wordpress.org/trunk@21414 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 17:51:42 +00:00
Andrew Nacin a5c7405975 Move most instances of new WP_User to get_userdata(). see #21120.
git-svn-id: https://develop.svn.wordpress.org/trunk@21413 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 01:06:05 +00:00
Ryan Boren d2774833b2 Introduce get_edit_user_link(). Props scribu, georgestephanis, johnbillion. fixes #14787 see #20307
git-svn-id: https://develop.svn.wordpress.org/trunk@21364 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-30 18:30:03 +00:00
Mark Jaquith 016b10f1f1 More reliably replace $home_root in $request in get_pagenum_link(). props SergeyBiryukov. fixes #18034
git-svn-id: https://develop.svn.wordpress.org/trunk@21174 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-28 20:54:20 +00:00
Andrew Nacin 898fd19d0e 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: https://develop.svn.wordpress.org/trunk@21169 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-28 20:28:57 +00:00
Ryan Boren b6e23d7269 Shears of vigorous pinking.
git-svn-id: https://develop.svn.wordpress.org/trunk@20944 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-27 16:25:43 +00:00
Ryan Boren c7b61a2a57 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: https://develop.svn.wordpress.org/trunk@20828 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-18 20:04:59 +00:00
Andrew Nacin ad1de1abe6 Always escape the output of get_pagenum_link(). fixes #14556.
git-svn-id: https://develop.svn.wordpress.org/trunk@20685 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 16:29:39 +00:00
Jon Cave e15d677986 Handle uppercase HTML entities in get_previous_posts_link(). Props ounziw. See #4152, fixes #19803.
git-svn-id: https://develop.svn.wordpress.org/trunk@20537 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-19 15:08:06 +00:00
Jon Cave cafa8dab24 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: https://develop.svn.wordpress.org/trunk@20023 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-28 20:29:33 +00:00
Ryan Boren 89e9bcc1d6 Pinking shears 6-20000
git-svn-id: https://develop.svn.wordpress.org/trunk@20000 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-27 19:46:52 +00:00
Andrew Nacin 5fff43429f Add reminder to version the Press This bookmarklet link in case breaking changes are made in the future. fixes #20071.
git-svn-id: https://develop.svn.wordpress.org/trunk@19949 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-18 18:46:15 +00:00
Andrew Nacin d583f37634 Introduce 'relative' scheme to return only the paths for home_url, site, admin, network_, and get_ variants. props SergeyBiryukov, see #18952.
git-svn-id: https://develop.svn.wordpress.org/trunk@19870 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-08 16:09:41 +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 a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Ryan Boren 5e76729992 One newline is enough.
git-svn-id: https://develop.svn.wordpress.org/trunk@19684 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:10:39 +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 fd10e500e4 Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@19054 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-24 19:13:23 +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