Commit Graph

606 Commits

Author SHA1 Message Date
Sergey Biryukov 7f91e27312 Script Loader: Explicitly declare the `$pagenow` global in `wp_deregister_script()`.
This avoids an "Undefined index" PHP notice in `wp_resource_hints()` tests when running the full test suite.

Remove the unused global from `get_home_url()`.

Follow-up to [25443], [38100], [38174], [50156], [50164].

Props peterwilsoncc.
Fixes #52566.
Built from https://develop.svn.wordpress.org/trunk@50393


git-svn-id: http://core.svn.wordpress.org/trunk@50004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-20 09:56:04 +00:00
John Blackbourn f955bcce54 Feeds: Fix the URL returned by `get_feed_link()` when pretty permalinks are not in use.
Props hauvong, peterwilsoncc, SergeyBiryukov

Fixes #51839

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


git-svn-id: http://core.svn.wordpress.org/trunk@49965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-16 17:34:04 +00:00
Dominik Schilling 4491708fd1 Docs: Improve parameter types for various URL functions and filters that also accept `null`.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@50340


git-svn-id: http://core.svn.wordpress.org/trunk@49951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-13 15:16:08 +00:00
Peter Wilson 0f251cdd90 Canonical: Rename `wp_force_plain_ugly_permalink()` to match UI terminology.
Rename `wp_force_plain_ugly_permalink()` to `wp_force_plain_post_permalink()` to match terminology used in the WordPress dashboard.

Follow up to [50132].
Props SergeyBiryukov.
Fixes #5272.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-10 05:40:07 +00:00
Sergey Biryukov 23b015ed48 General: Remove admin exception for `https` in `network_home_url()`.
Previously, `network_home_url()` would automatically switch to `https` if the current request is already `https`, but would only do so on the front end.

This mirrors the change made earlier for `get_home_url()`.

Follow-up to [12598], [21937], [24844], [50156].
See #52421.
Built from https://develop.svn.wordpress.org/trunk@50168


git-svn-id: http://core.svn.wordpress.org/trunk@49847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 20:59:05 +00:00
Sergey Biryukov 4773bc5699 General: Restore the `$pagenow` global in `get_home_url()`.
This fixes test failures in `Tests_WP_Resource_Hints`.

Follow-up to [50156].

See #52421.
Built from https://develop.svn.wordpress.org/trunk@50164


git-svn-id: http://core.svn.wordpress.org/trunk@49843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 20:37:05 +00:00
Sergey Biryukov 640c03842e General: Remove admin and login exceptions for `https` in `get_home_url()`.
Previously, `get_home_url()` would automatically switch to `https` if the current request is already `https`, but would only do so on the front end.

This addresses the inconsistent behavior of returning different values in the admin and on the frontend.

Follow-up to [12598], [21937], [24844].

Props herregroen, mukesh27.
Fixes #52421.
Built from https://develop.svn.wordpress.org/trunk@50156


git-svn-id: http://core.svn.wordpress.org/trunk@49835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 19:03:04 +00:00
Peter Wilson faa29f5716 Canonical: Prevent ID enumeration of private post slugs.
Add check to `redirect_canonical()` to ensure private posts only redirect for logged in users.

Modifies the `read_post` mata capability to user `get_post_status()` rather than the post's `post_status` property to allow attachments to redirect based on the inherited post status.

Introduces `wp_force_ugly_post_permalink()` to unify the check to determine if an ugly link should be displayed in each of the functions used for determining permalinks: `get_permalink()`, `get_post_permalink()`, `_get_page_link()` and `get_attachment_link()`.

Improves logic of `get_attachment_link()` to validate parent post and resolution of inherited post status. This is an incomplete fix of #52373 to prevent the function returning links resulting in a file not found error. Required to unblock this ticket.

Props peterwilsoncc, TimothyBlynJacobs.
See #52373.
Fixes #5272.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 00:40:01 +00:00
John Blackbourn 42fcfa5b3d Docs: Various docblock corrections.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:53:07 +00:00
John Blackbourn 35f6c356c1 Docs: Document parameters that accept an array of integers using typed array notation.
While many of these parameters also technically accept an array of numerical strings, they are all ultimately cast to an array of integers. Documenting them as such assists developers in understanding the expected types.

See #51800, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@49395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-19 18:24:09 +00:00
Peter Wilson 30b79ebd28 Permalinks: Prevent attachment pages 404ing following [49563].
This largely reverts [49563] due to attachment pages returning 404: File not found errors when they use the `inherit` status.

Permalink changes to attachment pages are retained when they are descendants of trashed or deleted posts.

Props Toro_Unit, helen, johnbillion, peterwilsoncc.
Fixes #51776.
See #5272.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 03:29:12 +00:00
Peter Wilson 5da8c0fceb Canonical: Prevent ID enumeration of private post slugs.
Add check to `redirect_canonical()` to ensure the destination post is not using a private post status.

Props dd32, Denis-de-Bernardy, donmhico, helen, nacin, peterwilsoncc, pishmishy, TimothyBlynJacobs, tzafrir, Viper007Bond, whyisjake.
Fixes #5272.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-12 04:16:08 +00:00
antpb 6b90568840 Media: Allow hiding of ‘View attachment page’ link in media modal.
If an empty string is supplied to the `attachment_link` filter the ‘View attachment page’ link will be hidden in the media modal.
Props limera1n, garrett-eclipse, joemcgill, Mista-Flo, hellofromTonya.
Fixes #48325.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 02:29:06 +00:00
Sergey Biryukov 897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
Sergey Biryukov 41681b29b0 Posts, Post Types: Avoid a PHP notice in `wp_get_shortlink()` if the post type is no longer registered.
Props apedog.
Fixes #51376.
Built from https://develop.svn.wordpress.org/trunk@49067


git-svn-id: http://core.svn.wordpress.org/trunk@48829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-28 11:53:08 +00:00
Sergey Biryukov f1f579199b Docs: Clarify the `false` return value of `get_post_type_archive_link()` and `get_post_type_archive_feed_link()`.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@49066


git-svn-id: http://core.svn.wordpress.org/trunk@48828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-28 11:12:03 +00:00
Sergey Biryukov 68d3c5ca56 Docs: Add a `@since` note about `adjacent_posts_rel_link_wp_head()` no longer being used in core.
Follow-up to [48966].

Props jnylen0.
See #39111.
Built from https://develop.svn.wordpress.org/trunk@48995


git-svn-id: http://core.svn.wordpress.org/trunk@48757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:06:04 +00:00
John Blackbourn 9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00
Sergey Biryukov 30747fab22 Themes: Allow passing a custom class to post and comment pagination functions.
This affects:
* `get_the_post_navigation()`
* `get_the_posts_navigation()`
* `get_the_posts_pagination()`
* `get_the_comments_navigation()`
* `get_the_comments_pagination()`

Props jfarthing84, markparnell, davidbaumwald, SergeyBiryukov.
Fixes #39378.
Built from https://develop.svn.wordpress.org/trunk@48378


git-svn-id: http://core.svn.wordpress.org/trunk@48147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 14:16:03 +00:00
Sergey Biryukov 58ad216087 Docs: Improve documentation for optional parameters per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48197


git-svn-id: http://core.svn.wordpress.org/trunk@47966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 11:49:02 +00:00
Sergey Biryukov 40c389c95e Docs: Standardize on "Returning a value from the filter" vs. "Passing a value to the filter".
The filter is the callback function added with `add_filter()`, therefore the hook passes a value to the filter, and the filter returns a value to change its behaviour.

The documentation is referring to the latter.

Props johnbillion.
See #49572, #16557.
Built from https://develop.svn.wordpress.org/trunk@48185


git-svn-id: http://core.svn.wordpress.org/trunk@47954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 18:49:09 +00:00
Sergey Biryukov be16bb9fba Docs: Remove extra spaces from `@param` tags.
Per the documentation standards, `@param` tags should be aligned with each other, but not with the `@return` tag.

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48110


git-svn-id: http://core.svn.wordpress.org/trunk@47879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:58:10 +00:00
Sergey Biryukov e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
Sergey Biryukov a576a13246 Docs: Remove an empty line between `@param` and `@return` tags, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48102


git-svn-id: http://core.svn.wordpress.org/trunk@47871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 11:18:09 +00:00
John Blackbourn 1a77bb81d8 Docs: Remove unnecessary variables names from `@return` tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
Sergey Biryukov de59ad23a4 Docs: Consistently include an empty line between `@since` tag and `@see`, `@link`, or `@global`, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +00:00
Sergey Biryukov 72b5018aa3 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47892


git-svn-id: http://core.svn.wordpress.org/trunk@47666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-03 10:02:13 +00:00
Sergey Biryukov 7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov 856e1a27b8 Coding Standards: Use strict type check for `in_array()` and `array_search()`.
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47557


git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-09 15:43:10 +00:00
Sergey Biryukov 38676936ba Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov a6949956d1 Administration: Capitalize `Trash` consistently in various messages and comments.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Props garrett-eclipse, aandrewdixon, Presskopp.
Fixes #45317.
Built from https://develop.svn.wordpress.org/trunk@47233


git-svn-id: http://core.svn.wordpress.org/trunk@47033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 04:12:07 +00:00
Sergey Biryukov 641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov dd4d98a368 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
John Blackbourn f93ee2ca76 Docs: Increase the specificity of various docblock parameter types and return types.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46823


git-svn-id: http://core.svn.wordpress.org/trunk@46623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:43:04 +00:00
Sergey Biryukov 9d14355bf5 Date/Time: Make `get_permalink()` more resilient against PHP timezone changes.
Overriding default PHP timezone with `date_default_timezone_set()`, while not recommended, should not inadvertently result in changing existing permalinks.

Add a unit test.

Props Rarst, steevithak, archon810, maciejmackowiak, Ov3rfly, Cybr, hometowntrailers, scvleon, miette49.
Fixes #48623.
Built from https://develop.svn.wordpress.org/trunk@46795


git-svn-id: http://core.svn.wordpress.org/trunk@46595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-28 13:42:00 +00:00
Sergey Biryukov c0bb073ca2 Docs: Clarify default value for the `$link` parameter in `edit_tag_link()`, `edit_term_link()`, and `edit_bookmark_link()`.
Props atachibana.
Fixes #48109.
Built from https://develop.svn.wordpress.org/trunk@46383


git-svn-id: http://core.svn.wordpress.org/trunk@46182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-03 23:12:57 +00:00
Sergey Biryukov c7f4cbc62c Docs: Improve consistency in `@since` tags for parameters that were made optional.
See #47110.
Built from https://develop.svn.wordpress.org/trunk@46288


git-svn-id: http://core.svn.wordpress.org/trunk@46100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-24 12:54:57 +00:00
Andrea Fercia b38b3de275 Accessibility: Make sure the navigation ARIA landmarks used for posts and comments navigation are properly labelled.
The `<nav>` element defines an ARIA landmark by default: landmarks help assistive technology users to perceive the page main sections and jump through them. However, when a landmark is used more than once in a page, it needs to be distinguished from the other ones to let users understand what the landmark is about.

Adds an `aria-label` parameter to the following functions: 

- `_navigation_markup()`
- `get_the_post_navigatio()`
- `get_the_posts_navigation()`
- `get_the_posts_pagination()`
- `get_the_comments_navigation()`
- `get_the_comments_pagination()`

Props sabernhardt, williampatton, SergeyBiryukov, audrasjb.
Fixes #47123.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-22 22:32:59 +00:00
John Blackbourn e36d1bcbd8 Docs: Docblock corrections and improvements, mostly related to various `pre_*` filters.
See #47110

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


git-svn-id: http://core.svn.wordpress.org/trunk@46044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 17:41:57 +00:00
Sergey Biryukov e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov 16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov e6a4b884f5 Docs: Improve documentation for various feed link functions and filters.
Props atachibana, SergeyBiryukov.
Fixes #47862.
Built from https://develop.svn.wordpress.org/trunk@45781


git-svn-id: http://core.svn.wordpress.org/trunk@45592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-11 17:21:57 +00:00
Sergey Biryukov 7f7480cb2a Docs: Add missing description for `$wp_query` and `$wp_the_query` globals.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45739


git-svn-id: http://core.svn.wordpress.org/trunk@45550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:59:56 +00:00
Sergey Biryukov b1e34ccc1f Docs: Add missing description for `$wp_rewrite` global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45735


git-svn-id: http://core.svn.wordpress.org/trunk@45546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:19:56 +00:00
Gary Pendergast 4803fc405e Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Sergey Biryukov c77e771c84 Date/Time: Replace all instances of `date()` with `gmdate()`.
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424


git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 00:12:54 +00:00
Dominik Schilling ae779fc980 Docs: Add missing `@since` tag for [45031].
Props dimadin.
See #46667.
Built from https://develop.svn.wordpress.org/trunk@45191


git-svn-id: http://core.svn.wordpress.org/trunk@45000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-13 14:17:55 +00:00
Sergey Biryukov 06bb67be06 Docs: Correct back-compat reference to `$excluded_categories` in `get_adjacent_post()`.
See #46543, #17673.
Built from https://develop.svn.wordpress.org/trunk@45033


git-svn-id: http://core.svn.wordpress.org/trunk@44842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-27 14:45:51 +00:00
Sergey Biryukov 0416de3294 General: Pass `$pagenum` argument to `get_pagenum_link` filter.
Props dimadin.
Fixes #46667.
Built from https://develop.svn.wordpress.org/trunk@45031


git-svn-id: http://core.svn.wordpress.org/trunk@44840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-27 14:24:52 +00:00