Commit Graph

248 Commits

Author SHA1 Message Date
Gary Pendergast 56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Sergey Biryukov 9eb75432b6 Canonical: Strip trailing punctuation from permalinks.
Previously attempted in [40256], which caused the test for decoded curly quotes to fail in some environments.

`$_SERVER['REQUEST_URI']` contains the encoded URI, so this version removes the failing tests and only checks for encoded curly quotes.

Props joostdevalk, lancewillett, SergeyBiryukov.
Fixes #20383.
Built from https://develop.svn.wordpress.org/trunk@41991


git-svn-id: http://core.svn.wordpress.org/trunk@41825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 14:18:48 +00:00
Drew Jaynes e80cf1d861 Canonical: Check first before attempting to include a 'path' value in the URL in `strip_fragment_from_url()`.
Props Mte90.
Fixes #40542.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-16 21:11:43 +00:00
Sergey Biryukov b916e8c727 Docs: Add a `@global` entry for `$wp` in `redirect_canonical()`.
Props afzalmultani.
See #41238.
Built from https://develop.svn.wordpress.org/trunk@41003


git-svn-id: http://core.svn.wordpress.org/trunk@40853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-05 09:19:43 +00:00
Andrew Ozz 964c0710f0 Revert [40256] for now as some tests are failing in some environments.
See #20383.
Built from https://develop.svn.wordpress.org/trunk@40661


git-svn-id: http://core.svn.wordpress.org/trunk@40524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-12 22:50:41 +00:00
Sergey Biryukov 6476ef2cc9 Canonical: Strip trailing punctuation from permalinks.
Props joostdevalk, lancewillett, SergeyBiryukov.
Fixes #20383.
Built from https://develop.svn.wordpress.org/trunk@40256


git-svn-id: http://core.svn.wordpress.org/trunk@40178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-09 20:05:46 +00:00
Boone Gorges 0ddbc2c99f Improve category check in `redirect_canonical()` when permastruct contains category slug.
[37262] changed a check in `redirect_canonical()` so that it checked
categories in the object cache rather than querying the database. However,
the check was based on the identity of `WP_Term` objects, which in
certain cases can be augmented by the main WP query routine, causing
failures of the `in_array()` check. This caused unnecessary redirects
for URLs where `is_single()` is true, but the URL is different from the
post permalink, such as the `embed` endpoint.

`has_term()` also checks the cache, but does not sufer from this bug.

Props cmillerdev.
Fixes #36602.
Built from https://develop.svn.wordpress.org/trunk@38216


git-svn-id: http://core.svn.wordpress.org/trunk@38157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-08 18:49:28 +00:00
Drew Jaynes 949bc7c7e3 Docs: Use the three-digit, x.x.x-style version in the DocBlock for the nested `lowercase_octets()` function.
See #32246. See #meta942.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 19:34:29 +00:00
Drew Jaynes f929f502fa Docs: Add a missing DocBlock for the `lowercase_octets()` function, which is nested within `redirect_canonical()`.
Will be skipped from parsing.

See #32246. See #meta942.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 19:32:32 +00:00
Drew Jaynes 9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Boone Gorges c8325e1ab5 Canonical: Use `get_the_terms()` to verify that a post belongs to the requested `%category%`.
The `get_the_terms()` wrapper provides cache support, and saves a database hit
on sites with a persistent cache backend.

Props spacedmonkey.
Fixes #36602.
Built from https://develop.svn.wordpress.org/trunk@37262


git-svn-id: http://core.svn.wordpress.org/trunk@37228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-20 15:35:27 +00:00
Dion Hulse 84a3b4407f Canonical: Generate the correct canonical url for paged posts/pages when they're used as the page_on_front.
This fixes an issue where pages become inacessible on a front page post.

Fixes #35344 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 07:33:27 +00:00
Drew Jaynes f4af7643d8 Docs: Add a missing summary, description, and `@since` version to the DocBlock for `wp_redirect_admin_locations()`.
Introduced in [19880].

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 23:08:26 +00:00
John Blackbourn a027edc277 Comments: The year is 2003. Permalinks are a new thing and everyone's using Blogger. It's a time when opening a modal window in JavaScript to view a section of a website is not a completely weird thing, although many users get annoyed by it. b2 has recently become WordPress, and with it comes a bunch of functionality that will become stale over the next decade, remnants of simpler times.
Twelve years later, after no fewer than three themes have intentionally implemented popup comments in their functionality, before being abandoned for at least the last six years, we've reached a time where we can put this era behind us. A time when we can remove comment popup functionality from WordPress.

If this breaks the internet, I'll eat my hat.

Fixes #28617

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


git-svn-id: http://core.svn.wordpress.org/trunk@35812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 03:06:30 +00:00
Scott Taylor 9ea3f9f676 Canonical: introduce `strip_fragment_from_url()` and use when comparing URLs in `redirect_canonical()`.
Props tellyworth.
Fixes #19918.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-04 23:11:26 +00:00
Scott Taylor 60eaf79b67 Canonical: when `/%post_id%/` is the permalink structure, don't redirect IDs that match Auto Drafts.
Props SergeyBiryukov.
Fixes #29431.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 20:54:25 +00:00
Boone Gorges 3eab09a694 Don't force comment pagination.
[34561] instituted the policy of forcing pagination for comments. This strategy
was intended to avert problems when 'page_comments' is set to 0 - as it is by
default - and the number of comments on a given post rises into the hundreds or
thousands. By forcing pagination in all cases, we ensured that WordPress would
not time out by processing unwieldy numbers of comments on a given pageload.

The strategy proves problematic, however, because comment permalinks are
generated using the page of the comment. Forcing pagination for posts that
were not previously paginated would change the URL of all comments that do not
appear on the default comment page.

This changeset reintroduces the 'page_comments' setting and its corresponding
checkbox on Settings > Discussion. A number of tests, which were written after
[34561], are modified to work now that 'page_comments' will, once again, be
disabled by default.

See #8071.
Built from https://develop.svn.wordpress.org/trunk@35331


git-svn-id: http://core.svn.wordpress.org/trunk@35297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-21 16:26:42 +00:00
Drew Jaynes 217b661703 Docs: Add missing descriptions for the `$wpdb` global in DocBlocks all the places.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Scott Taylor b97dd529fa Canonical: remove unused code (commented-out) from `redirect_canonical()`.
Props hakre, chriscct7.
Fixes #16934.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 05:09:50 +00:00
Scott Taylor 8cd1db9c9c Canonical: after [34272], don't redirect rewrite endpoints on attachment URLs when pretty permalinks are enabled.
Fixes #19918.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-27 22:11:25 +00:00
Boone Gorges 18d6b3c8dc Force comment pagination on single posts.
Previously, the 'page_comments' toggle allowed users to disable comment
pagination. This toggle was only superficial, however. Even with
'page_comments' turned on, `comments_template()` loaded all of a post's
comments into memory, and passed them to `wp_list_comments()` and
`Walker_Comment`, the latter of which produced markup for only the
current page of comments. In other words, it was possible to enable
'page_comments', thereby showing only a subset of a post's comments on a given
page, but all comments continued to be loaded in the background. This technique
scaled poorly. Posts with hundreds or thousands of comments would load slowly,
or not at all, even when the 'comments_per_page' setting was set to a
reasonable number.

Recent changesets have addressed this problem through more efficient tree-
walking, better descendant caching, and more selective queries for top-level
post comments. The current changeset completes the project by addressing the
root issue: that loading a post causes all of its comments to be loaded too.

Here's the breakdown:

* Comment pagination is now forced. Setting 'page_comments' to false leads to evil things when you have many comments. If you want to avoid pagination, set 'comments_per_page' to something high.
* The 'page_comments' setting has been expunged from options-discussion.php, and from places in the codebase where it was referenced. For plugins relying on 'page_comments', we now force the value to `true` with a `pre_option` filter.
* `comments_template()` now queries for an appropriately small number of comments. Usually, this means the `comments_per_page` value.
* To preserve the current (odd) behavior for comment pagination links, some unholy hacks have been inserted into `comments_template()`. The ugliness is insulated in this function for backward compatibility and to minimize collateral damage. A side-effect is that, for certain settings of 'default_comments_page', up to 2x the value of `comments_per_page` might be fetched at a time.
* In support of these changes, a `$format` parameter has been added to `WP_Comment::get_children()`. This param allows you to request a flattened array of comment children, suitable for feeding into `Walker_Comment`.
* `WP_Query` loops are now informed about total available comment counts and comment pages by the `WP_Comment_Query` (`found_comments`, `max_num_pages`), instead of by `Walker_Comment`.

Aside from radical performance improvements in the case of a post with many
comments, this changeset fixes a bug that caused the first page of comments to
be partial (`found_comments` % `comments_per_page`), rather than the last, as
you'd expect.

Props boonebgorges, wonderboymusic.
Fixes #8071.
Built from https://develop.svn.wordpress.org/trunk@34561


git-svn-id: http://core.svn.wordpress.org/trunk@34525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 20:40:25 +00:00
Scott Taylor 175d476b0e Canonical/Rewrite: sanity check posts that are paged with `<!--nextpage-->`. Page numbers past the max number of pages are returning the last page of content and causing infinite duplicate content.
Awesome rewrite bug: the `page` query var was being set to `'/4'` in `$wp`. When cast to `int`, it returns `0` (Bless you, PHP). `WP_Query` calls `trim( $page, '/' )` when setting its own query var. The few places that were checking `page`	before posts were queried now have sanity checks, so that these changes work without flushing rewrites.	

Adds/updates unit tests.

Props wonderboymusic, dd32.
See #11694.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 14:04:24 +00:00
Scott Taylor 939d9b7395 Remove some unused globals and/or their docs.
See ##33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 20:27:25 +00:00
Scott Taylor c2e1bab509 Canonical: redirect URLs that match an attachment masked on the wrong URL to the attachment link for the matched attachment.
Props solarissmoke.
Fixes #19918.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 21:32:24 +00:00
John Blackbourn a9e5cfddc7 Implement `wp_login_url()` and `wp_registration_url()` in places where `wp-login.php` is currently hard-coded.
See #31495
Props GregLone

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


git-svn-id: http://core.svn.wordpress.org/trunk@34177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 17:11:35 +00:00
Sergey Biryukov 78d43de7e4 Avoid PHP notices in `redirect_canonical()` and `_wp_menu_item_classes_by_context()` if `$_SERVER['HTTP_HOST']` is not set.
fixes #32229.
Built from https://develop.svn.wordpress.org/trunk@33775


git-svn-id: http://core.svn.wordpress.org/trunk@33743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 03:31:20 +00:00
Scott Taylor bd8fafea54 Use `void` instead of `null` where appropriate when pipe-delimiting `@return` types. If a `@return` only contains `void`, remove it.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor 3d130ba909 Add missing doc blocks for `canonical.php`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 04:26:26 +00:00
Scott Taylor 3f32bf7bc0 In `canonical.php`:
* Clarify some docs
* `redirect_canonical()` inconsistently returns `null` or `false` when bailing - can simply return.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 20:30:25 +00:00
Gary Pendergast f6120877df If the URL being visited has non-breaking spaces at the end of it, they were probably inserted by an errant URL copy/paste. Instead of showing a 404 for no obvious reason, let's just trim them.
Fixes #31499


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


git-svn-id: http://core.svn.wordpress.org/trunk@31820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-20 01:02:28 +00:00
Sergey Biryukov 612b9e8ffd Replace hardcoded usage of `comment-page` with the comment pagination base.
props johnbillion, SergeyBiryukov, webord.
fixes #18084.
Built from https://develop.svn.wordpress.org/trunk@31459


git-svn-id: http://core.svn.wordpress.org/trunk@31440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-14 03:48:27 +00:00
Scott Taylor fc843ce4d0 There are some random `add_action()` and `add_filter()` calls littered around some files in `wp-includes/`. These should be moved to `wp-includes/default-filters.php` with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even `SHORTINIT` - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Scott Taylor e619abda6e Improve various `@param` docs for `src/wp-includes/*`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes 66c47f29bb Correct references of `@uses $wpdb` in core documentation to use `@global`.
See #30191, [30105].
Fixes #30217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
John Blackbourn 9a16b52018 Revert [28610] in order to avoid infinite redirect loops on reverse proxies which proxy from HTTPS to HTTP. This will be revisited at some point, possibly as an option via a filter.
Fixes #28610.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 18:37:25 +00:00
Boone Gorges 295f5fc9de Support nested tax query syntax in redirect_canonical().
The proper place to look for a list of queried terms is in the flat
queried_terms array, not in tax_query->queries.

See #29738.
Built from https://develop.svn.wordpress.org/trunk@29901


git-svn-id: http://core.svn.wordpress.org/trunk@29656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 15:43:19 +00:00
Mark Jaquith e1f2b3b9e2 Use HTTPS URLs for trac.wordpress.org (and use core.trac.wordpress.org)
see #27115
Built from https://develop.svn.wordpress.org/trunk@29789


git-svn-id: http://core.svn.wordpress.org/trunk@29561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:37:16 +00:00
Andrew Nacin 4417e75e2c Canonical: Apply redirects to HEAD requests too. Adjusts [28958].
props SergeyBiryukov.
fixes #27498.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 04:48:17 +00:00
Sergey Biryukov f84ef60b52 Canonical redirects should only be applied for GET requests.
props c.axelsson.
fixes #27498.
Built from https://develop.svn.wordpress.org/trunk@28958


git-svn-id: http://core.svn.wordpress.org/trunk@28754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 14:11:14 +00:00
Sergey Biryukov ca650bd79c Replace a redundant ! is_preview() check with a more appropriate one.
fixes #20496.
Built from https://develop.svn.wordpress.org/trunk@28928


git-svn-id: http://core.svn.wordpress.org/trunk@28726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 17:19:14 +00:00
Sergey Biryukov a6a2183bf6 Fix typo in a comment.
props JustinSainton.
see #20496.
Built from https://develop.svn.wordpress.org/trunk@28878


git-svn-id: http://core.svn.wordpress.org/trunk@28677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 03:30:16 +00:00
Scott Taylor a60b01b138 Perform a canonical redirect for posts that are published but are visited at a `?p=123&preview=true` URL.
Props amit, joostdevalk.
Fixes #20496.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 02:13:15 +00:00
Scott Taylor 05eeb16e30 Replace all uses of `like_escape()` with `$wpdb->esc_like()`.
Props miqrogroove.
See #10041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Andrew Nacin 801df52e51 Force SSL on the frontend via canonical when the home URL uses the https scheme.
fixes #27954.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-29 04:13:13 +00:00
Drew Jaynes d77e78d685 Clean up duplicate hook notations and adjacency for calls to the `wp_signup_location` filter.
Also adds braces missed in [25535].

See #26869.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-25 07:12:14 +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
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
Drew Jaynes 0931266fc2 Inline documentation for hooks in wp-includes/canonical.php.
Props dustyf for the initial patch.
See #25229.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-20 23:31:10 +00:00
Scott Taylor b22bc5e389 Check bad dates and redirect, instead of 404ing, as necessary and appropriate.
Adds query, conditional, and canonical Unit Tests.

Props kovshenin, SergeyBiryukov, DrewAPicture.
Fixes #10935.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 16:36:09 +00:00
Andrew Nacin 740d141e1d Support IIS 8 and above.
props hurtige for initial patch.
fixes #23533.



git-svn-id: http://core.svn.wordpress.org/trunk@24594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 20:27:06 +00:00
Sergey Biryukov 8792da0820 Use correct backreference in obsolete feed redirection code. props sweetie089. fixes #24623.
git-svn-id: http://core.svn.wordpress.org/trunk@24502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-22 12:09:28 +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 87c947a987 Use network_site_url() for wp-signup.php. props markjaquith. see #19796.
git-svn-id: http://core.svn.wordpress.org/trunk@21813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 12:27:25 +00:00
markjaquith c7029bb742 Also switch back the @uses annotation for [21215]. props duck_. see #20484. see #16639
git-svn-id: http://core.svn.wordpress.org/trunk@21217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 20:09:28 +00:00
markjaquith 9b8ca25445 Implement the IIS logic test that #16639 should have gotten back in the day, before it was disabled altogether. IIS canonical redirects now only supported for pretty permalink–supporting IIS7 installs. props nacin. fixes #20484. see #16639
git-svn-id: http://core.svn.wordpress.org/trunk@21215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 19:59:35 +00:00
markjaquith 7b66f555a4 Reënable canonical redirects for IIS. Let's work out any remaining bugs in this cycle. fixes #20484. reverts [17492]. see #16639
git-svn-id: http://core.svn.wordpress.org/trunk@21207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 13:23:39 +00:00
duck_ 176317abcf Set $walk_dirs = true for post rewrite rule generation. See #21020 for trunk.
Partial revert of r19737 and r19778 as some users were relying on this behaviour.


git-svn-id: http://core.svn.wordpress.org/trunk@21112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-25 20:41:14 +00:00
nacin 4144452598 Only look for public post types in redirect_guess_404_permalink() when no post type query var is present. props jeremyfelt. fixes #19693.
git-svn-id: http://core.svn.wordpress.org/trunk@20688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 17:39:43 +00:00
duck_ 6fd24edbec Prevent a notice: don't attempt to parse the query string if it doesn't exist. Props johnjamesjacoby. Fixes #20528.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-01 18:26:38 +00:00
nacin 3f51df65e0 Run rawurlencode_deep() through the parsed query in canonical. (Introduces rawurlencode_deep().) props toppa for the initial patch. fixes #20143.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-27 15:40:00 +00:00
nacin 548baad816 Remove wp-register.php.
* Don't remove it on update. If you have it now, you'll keep it. New installs won't get it.
 * Peform a redirect using rewrite + canonical to the new location, if the file doesn't exist.
props SergeyBiryukov.
fixes #18544.


git-svn-id: http://svn.automattic.com/wordpress/trunk@20596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 20:49:57 +00:00
ryan 1b65e28f8f Don't do a canonical redirect for singular paged pages when on the front-page. This was breaking pagination on sites with a static home page. Props batmoo. see #20385
git-svn-id: http://svn.automattic.com/wordpress/trunk@20444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 21:18:40 +00:00
markjaquith 170ce91194 Handle page= and feed= query strings in redirect_guess_404_permalink(). fixes #20387
git-svn-id: http://svn.automattic.com/wordpress/trunk@20398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 05:39:08 +00:00
markjaquith 5ccce3d681 Properly handle paged permalink URLs even when we are not already 301ing. fixes #20385
git-svn-id: http://svn.automattic.com/wordpress/trunk@20397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 05:18:50 +00:00
markjaquith a2b1c52214 Fix a bunch of individual post comments feeds canonical redirects. Fixes three unit tests. fixes #20384
git-svn-id: http://svn.automattic.com/wordpress/trunk@20396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 05:02:45 +00:00
markjaquith 446a67449f Better removal of query args in canonical redirects. Only remove them when they are not present in the redirect_url. fixes #20374
git-svn-id: http://svn.automattic.com/wordpress/trunk@20395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 01:03:55 +00:00
markjaquith 2c87af1983 Be a bit more conservative in which args are stripped after redirect_guess_404_permalink(). see #20380.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-06 21:19:28 +00:00
markjaquith 2bca2af5fd Strip p, page_id, attachment_id, post_type, pagename, and name from redirect query if we get a hit on a 404-guessed permalink. fixes #20374
git-svn-id: http://svn.automattic.com/wordpress/trunk@20380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-06 19:49:34 +00:00
duck_ 7a6b978b7f Ensure that a category is part of the query before redirecting permalink structures containing %category%. Fixes #19241.
This fixes incorrect canonical redirects for singular queries using custom rewrite rules.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-21 19:00:06 +00:00
nacin d06722b8ac In case of 404, redirect /login, /dashboard, /admin to corresponding WP equivalents. fixes #19607.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 20:11:52 +00:00
nacin 6300514de7 Let wp-admin work as well as wp-admin/ for the canonical redirect. see #19607.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 18:03:25 +00:00
nacin 71c82d0eaf Use correct variable. see #19607.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 17:14:52 +00:00
nacin ef1e76a833 When WordPress is in a subdirectory (home URL != site URL), let home/wp-admin and home/wp-login.php redirect to their proper locations. props greuben for initial patch, fixes #19607.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 17:08:13 +00:00
duck_ 779cf2bad5 Redirect bare category URLs for permalink structures starting with %category%. Fixes #19876.
When using a structure like /%category%/%postname%/ it might be thought that /uncategorized/
(missing the "/category/" base) results in the category archive. Previously this worked due to
$walk_dirs = true for the post permalink structure, but canonical didn't redirect it. Now
there is no rewrite rule to match => 404. The fix is to use a canonical redirect.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 20:40:55 +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
nacin 15ff65a694 Restore RDF feed. fixes #4967.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-20 18:32:42 +00:00
dd32 d08955e123 Encode extra query vars in Canonical Taxonomy redirections. Props SergeyBiryukov. Fixes #18086
git-svn-id: http://svn.automattic.com/wordpress/trunk@18884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-05 11:00:28 +00:00
duck_ e4ed63fc6f Fix typos in documentation (wp-includes/[a-h]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-03 16:02:41 +00:00
nacin 3fb35c6739 Remove the old root feed files. Bump the db version so rewrite rules can regenerate. Don't add these files to old_files to leave them on existing installs. fixes #18384.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-12 01:41:23 +00:00
markjaquith 26c33f2341 Whitespace oops
git-svn-id: http://svn.automattic.com/wordpress/trunk@18539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 23:57:33 +00:00
markjaquith 7689657c90 Deprecate RSS 0.92 and RDF feeds, and 301 them to the default feed. props johnpbloch. fixes #4967
git-svn-id: http://svn.automattic.com/wordpress/trunk@18537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 23:30:59 +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
dd32 6d7b36269e More specific Tazonomy canonicalisation; Allows custom vars through, strips all per-taxonomy query vars. See #17174
git-svn-id: http://svn.automattic.com/wordpress/trunk@18079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-31 06:13:27 +00:00
ryan f166e119f3 Don't do a canonical redirect from author=x to /author/foo/ if the user is not an author
git-svn-id: http://svn.automattic.com/wordpress/trunk@17991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-22 23:18:06 +00:00
dd32 04e5dc178d Allow Taxonomies to be queried by $_GET parameters on non-taxonomy url's. See #17174
git-svn-id: http://svn.automattic.com/wordpress/trunk@17706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-26 10:49:00 +00:00
ryan 0d6c2100fa Do not do canonical redirects for unregistered feeds. fixes #16704 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-03 15:55:24 +00:00
ryan 9d648af0de Do not perform canonical redirects for IISto avoid redirect loops on some IIS setups. fixes #16639 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-02 15:33:11 +00:00
markjaquith de0fc3026a Strip partial name= parameters when doing canonical redirection on them with default permalinks. props filosofo. fixes #15775
git-svn-id: http://svn.automattic.com/wordpress/trunk@17031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-17 20:57:03 +00:00
markjaquith 213100d5ba Do not add URL query args twice in certain Canonical Redirect situations. Use add_query_arg(). props filosofo. fixes #15774
git-svn-id: http://svn.automattic.com/wordpress/trunk@17030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-17 20:23:34 +00:00
ryan 7e25e3b363 Add like_escape() to some queries. fixes #15764
git-svn-id: http://svn.automattic.com/wordpress/trunk@16999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-16 14:22:41 +00:00
nacin dd82562191 Remove redundancy. see #14288.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-14 19:47:09 +00:00
markjaquith eb94b43e3c Fix canonical paged/feed redirects. props rfw. fixes #14288
git-svn-id: http://svn.automattic.com/wordpress/trunk@16920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-14 16:55:35 +00:00
dd32 20e1171ae8 Fix fatal error on IIS after r16797. props peaceablewhale. Limit variable string searching when possible. See #10187
git-svn-id: http://svn.automattic.com/wordpress/trunk@16904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-14 08:31:33 +00:00
scribu e5690e7ebe Introduce WP_Tax_Query. Fix canonical redirects in the process. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 19:29:21 +00:00
dd32 5cce49e2b7 Enable canonical redirections for Permalink suporting IIS. Props peaceablewhale See #10187
git-svn-id: http://svn.automattic.com/wordpress/trunk@16797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 11:04:40 +00:00
ryan 42ce1825ac Remove debug cruft.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-19 17:10:35 +00:00