Commit Graph

373 Commits

Author SHA1 Message Date
Andrew Nacin
413207be6d Fix various issues with WP_Adjacent_Post:
* Performance / number of queries.
 * Incorrect results caused by sticky posts.
 * Back compat for filters, which had used "WHERE" while WP_Query does not; and fixing table references.

props ethitter.
fixes #26937.

Built from https://develop.svn.wordpress.org/trunk@27635


git-svn-id: http://core.svn.wordpress.org/trunk@27478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 02:59:15 +00:00
Andrew Nacin
e9b64fb76d Introduce get_the_permalink() as an alias for get_permalink().
This better aligns it with other the_* and get_the_* function pairs.

props ericmann.
fixes #24164.

Built from https://develop.svn.wordpress.org/trunk@27409


git-svn-id: http://core.svn.wordpress.org/trunk@27256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 07:24:14 +00:00
Andrew Nacin
e41374d13d Set the taxonomy property in the WP_Adjacent_Post class. fixes #26937.
Built from https://develop.svn.wordpress.org/trunk@27296


git-svn-id: http://core.svn.wordpress.org/trunk@27151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 18:46:14 +00:00
Drew Jaynes
22b4567550 Document the $taxonomy property in WP_Adjacent_Post.
See #26937.

Built from https://develop.svn.wordpress.org/trunk@27293


git-svn-id: http://core.svn.wordpress.org/trunk@27149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 18:21:13 +00:00
Drew Jaynes
c78763a761 Remove now-moot vanity spacing for WP_Adjacent_Post property definitions.
See #26937.

Built from https://develop.svn.wordpress.org/trunk@27292


git-svn-id: http://core.svn.wordpress.org/trunk@27148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 18:18:14 +00:00
Drew Jaynes
cf4131f7ad Add inline documentation for properties and other inline docs fixes for WP_Adjacent_Post.
See #26937.

Built from https://develop.svn.wordpress.org/trunk@27291


git-svn-id: http://core.svn.wordpress.org/trunk@27147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 18:16:14 +00:00
Andrew Nacin
69bfee0aae One more change. see #26937.
Built from https://develop.svn.wordpress.org/trunk@27288


git-svn-id: http://core.svn.wordpress.org/trunk@27144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 17:18:13 +00:00
Andrew Nacin
a0dab307b7 We shall call it WP_Adjacent_Post instead. see #26937.
Built from https://develop.svn.wordpress.org/trunk@27287


git-svn-id: http://core.svn.wordpress.org/trunk@27143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 17:17:13 +00:00
Andrew Nacin
5154c27f82 Make get_adjacent_post() wrap a new WP_Get_Adjacent_Post object that uses WP_Query.
See [27285] for the actual commit, which misfired.

props ethitter!
fixes #26937.

Built from https://develop.svn.wordpress.org/trunk@27286


git-svn-id: http://core.svn.wordpress.org/trunk@27142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 17:12:14 +00:00
Andrew Nacin
56550b7c96 Make get_adjacent_post() wrap a new WP_Get_Adjacent_Post object that uses WP_Query.
Built from https://develop.svn.wordpress.org/trunk@27285


git-svn-id: http://core.svn.wordpress.org/trunk@27141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 17:10:13 +00:00
Andrew Nacin
6dcd5cc69e Fix undefined variable. see #16686.
Built from https://develop.svn.wordpress.org/trunk@27265


git-svn-id: http://core.svn.wordpress.org/trunk@27122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:29:13 +00:00
Drew Jaynes
cb8951b0b3 Remove all @package and @subpackage PHPDoc tags not at the file- or class-levels in core.
See #27200.

Built from https://develop.svn.wordpress.org/trunk@27262


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Andrew Nacin
c102fd5a9d Make the user arguments for get_edit_profile_url() and get_dashboard_url() optional, defaulting to the current user.
props garyc40.
fixes #16686.

Built from https://develop.svn.wordpress.org/trunk@27260


git-svn-id: http://core.svn.wordpress.org/trunk@27117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:08:13 +00:00
Drew Jaynes
8ec1503e15 Correct PHPDoc return description for get_boundary_post().
Props ericlewis.
Fixes #22950.

Built from https://develop.svn.wordpress.org/trunk@27235


git-svn-id: http://core.svn.wordpress.org/trunk@27092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-22 22:28:13 +00:00
Scott Taylor
03d54a0ac7 Remove code from a previous patch. See [27188].
Built from https://develop.svn.wordpress.org/trunk@27189


git-svn-id: http://core.svn.wordpress.org/trunk@27048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-17 22:46:13 +00:00
Scott Taylor
ca4045ce76 Use selected() where appropriate in touch_time(), page_template_dropdown(), and parent_dropdown(). Also, add proper docs.
Props meloniq, DrewAPicture.
Fixes #25889.


Built from https://develop.svn.wordpress.org/trunk@27188


git-svn-id: http://core.svn.wordpress.org/trunk@27047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-17 22:27:15 +00:00
Andrew Nacin
1318242221 Docs fix: edit_comment_link() doesn't actually return anything.
props Corphi.
fixes #26436.

Built from https://develop.svn.wordpress.org/trunk@27026


git-svn-id: http://core.svn.wordpress.org/trunk@26902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-24 07:17:36 +00:00
Drew Jaynes
cd8cedc40d First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.

Built from https://develop.svn.wordpress.org/trunk@26868


git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Sergey Biryukov
74f77b85a6 Use get_current_site() instead of the $current_site global when possible.
props jeremyfelt.
fixes #25158.
Built from https://develop.svn.wordpress.org/trunk@26120


git-svn-id: http://core.svn.wordpress.org/trunk@26032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 03:23:10 +00:00
Sergey Biryukov
8d659b278c Fix docblock formatting. fixes #25893.
Built from https://develop.svn.wordpress.org/trunk@26081


git-svn-id: http://core.svn.wordpress.org/trunk@26001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-11 13:32:10 +00:00
Andrew Nacin
d0cfa40983 Add jshintrc to qunit.
props jorbin.
see #25187.

Built from https://develop.svn.wordpress.org/trunk@25992


git-svn-id: http://core.svn.wordpress.org/trunk@25925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-30 14:39:10 +00:00
Andrew Nacin
26d4fdf58d Add a $taxonomy argument to each of the adjacent post functions.
Each took an array of category (IDs) when to search. Those can now be term IDs and each function now has $taxonomy = 'category' as an optional argument.

Functions affected: get_previous_post(), get_next_post(), get_adjacent_post(), get_adjacent_post_rel_link(), adjacent_posts_rel_link(), next_post_rel_link(), prev_post_rel_link(), get_boundary_post(), get_previous_post_link(), previous_post_link(), get_next_post_link(), next_post_link(), get_adjacent_post_link(), adjacent_post_link().

props ethitter.
finally fixes #17807.

Built from https://develop.svn.wordpress.org/trunk@25959


git-svn-id: http://core.svn.wordpress.org/trunk@25918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-27 21:40:09 +00:00
Andrew Nacin
5361a8abca Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

Built from https://develop.svn.wordpress.org/trunk@25868


git-svn-id: http://core.svn.wordpress.org/trunk@25868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:59:20 +00:00
Andrew Nacin
8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

Built from https://develop.svn.wordpress.org/trunk@25825


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Andrew Nacin
74488bdcb0 Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

Built from https://develop.svn.wordpress.org/trunk@25868


git-svn-id: http://core.svn.wordpress.org/trunk@25780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 17:22:11 +00:00
Scott Taylor
6a5d2f8fb0 Rather than adding a taxonomy arg to get_category(), convert all uses of get_category() in core to get_term(). By doing so, we negate the need to call _make_cat_compat() in a few places that are only looking for a single property.
Fixes #8722.


Built from https://develop.svn.wordpress.org/trunk@25662


git-svn-id: http://core.svn.wordpress.org/trunk@25578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 19:59:10 +00:00
Andrew Nacin
b07e886ed4 Remove redundant title attributes.
props sabreuse.
see #24766.

Built from https://develop.svn.wordpress.org/trunk@25570


git-svn-id: http://core.svn.wordpress.org/trunk@25488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 14:51:10 +00:00
Scott Taylor
acf3ee37e3 Fix the failing Tests_Link::test_wp_get_shortlink() assertion:
* `wp_get_shortlink()` was firing a notice when reading `$post->ID` while `$post` was null in some cases
* Before the assertions that assume `$GLOBALS['post']` is not set, call `unset( $GLOBALS['post'] );` - there was global spillage from other tests

See #25282.



Built from https://develop.svn.wordpress.org/trunk@25404


git-svn-id: http://core.svn.wordpress.org/trunk@25334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 17:30:10 +00:00
Andrew Nacin
b302f84b49 Avoid string offset notices in [25319].
Built from https://develop.svn.wordpress.org/trunk@25340


git-svn-id: http://core.svn.wordpress.org/trunk@25302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 03:57:09 +00:00
Scott Taylor
3f5ec88eda Introduce get_previous_post_link(), get_next_post_link(), and get_adjacent_post_link(). Allows developers to retrieve the value without echoing.
Props yoavf, markjaquith, SergeyBiryukov.
Fixes #17302.


Built from https://develop.svn.wordpress.org/trunk@25327


git-svn-id: http://core.svn.wordpress.org/trunk@25289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 22:12:10 +00:00
Andrew Nacin
3e41af8489 Better protocol validation in set_url_scheme().
Built from https://develop.svn.wordpress.org/trunk@25319


git-svn-id: http://core.svn.wordpress.org/trunk@25281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 18:08:11 +00:00
Scott Taylor
d24a3940de Make sure the queried object is non-null before accessing its properties.
Props markoheijnen, ryan.
Fixes #21394.


Built from https://develop.svn.wordpress.org/trunk@25310


git-svn-id: http://core.svn.wordpress.org/trunk@25272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 02:28:11 +00:00
Ryan Boren
f2f939fed4 Pinking shears
Built from https://develop.svn.wordpress.org/trunk@25085


git-svn-id: http://core.svn.wordpress.org/trunk@25069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 15:56:08 +00:00
Sergey Biryukov
52e2e61cb1 Use correct order of arguments when calling edit_term_link() from edit_tag_link(). Correct $tag parameter description. props pbiron. fixes #25116.
Built from https://develop.svn.wordpress.org/trunk@25079


git-svn-id: http://core.svn.wordpress.org/trunk@25064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 00:49:09 +00:00
Sergey Biryukov
666aafeda4 Update phpdoc for get_permalink(). props tivnet. fixes #25115.
Built from https://develop.svn.wordpress.org/trunk@25077


git-svn-id: http://core.svn.wordpress.org/trunk@25062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-21 22:12:10 +00:00
Ryan Boren
564d80e29f wp_get_shortlink() improvements.
* Return shortlinks for pages and public CPTs.
* Return shortlinks even when cruft-free links are not enabled.
* Unit tests

Props sillybean, layotte, cais
fixes #18632
see #14760


Built from https://develop.svn.wordpress.org/trunk@25030


git-svn-id: http://core.svn.wordpress.org/trunk@25017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-15 20:09:09 +00:00
Andrew Nacin
f590791d93 Pass pluginPath to MediaElement.js, fixing playback when ME.js is served through load-scripts.php.
props ocean90, wonderboymusic, azaozz.
fixes #24902.



git-svn-id: http://core.svn.wordpress.org/trunk@24940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-01 13:15:14 +00:00
Andrew Nacin
edc0882d2f If wp-login.php is accessed over HTTPS, get_home_url() should not return HTTPS. This is the same assumption we use in the admin.
props willnorris.
fixes #16822.



git-svn-id: http://core.svn.wordpress.org/trunk@24844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 01:21:27 +00:00
Mark Jaquith
60c9de28b4 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: http://core.svn.wordpress.org/trunk@24783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 16:05:40 +00:00
Mark Jaquith
c44ce3b6e6 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: http://core.svn.wordpress.org/trunk@24664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-11 22:56:48 +00:00
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
Sergey Biryukov
642202c02a Use capitalized ID column name in get_adjacent_post(). props hypertextranch. fixes #24575.
git-svn-id: http://core.svn.wordpress.org/trunk@24506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-24 13:11:43 +00:00
Sergey Biryukov
58c364947f PHPDoc fixes and additions. fixes #24616.
git-svn-id: http://core.svn.wordpress.org/trunk@24490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 12:45:11 +00:00
Sergey Biryukov
23479edf3f 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: http://core.svn.wordpress.org/trunk@24182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-07 11:46:35 +00:00
Sergey Biryukov
4c85664703 Avoid an undefined index notice in get_post_type_archive_feed_link(). props ericlewis. fixes #23744.
git-svn-id: http://core.svn.wordpress.org/trunk@23660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-12 01:50:46 +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
Andrew Nacin
5e0b9ac946 Allow paths with two consecutive dots to be passed to home_url() and all related *_url() functions.
props markjaquith.
fixes #19032.



git-svn-id: http://core.svn.wordpress.org/trunk@23537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-28 21:04:26 +00:00
Andrew Nacin
48f23ba3a5 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: http://core.svn.wordpress.org/trunk@23527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-28 18:56:39 +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
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