Commit Graph

645 Commits

Author SHA1 Message Date
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
Sergey Biryukov
5658305b1c Date/Time: Reduce explicit local current_time( 'timestamp' ) usage in favor of native PHP functions.
Timestamps don't carry any timezone information, using the intended format directly simplifies the logic and makes the code less confusing.

Props Rarst, jdgrimes.
See #40657.
Built from https://develop.svn.wordpress.org/trunk@44809


git-svn-id: http://core.svn.wordpress.org/trunk@44641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-07 09:12:51 +00:00
Gary Pendergast
bf43978730 Link Template: In get_adjacent_post(), move the sanitisation of $excluded_terms earlier.
This is a followup to [42828], ensuring that the `get_{$adjacent}_post_excluded_terms` filter is always passed an array, as expected.

Props soulseekah, zottto.
Fixes #43521.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-15 01:54:49 +00:00
Gary Pendergast
eeac928d3b Comments: Add a new is_avatar_comment_type() function.
This function splits the `get_avatar_comment_types` filter out of `get_avatar_data()`.

Props dshanske, birgire.
Fixes #44033.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 06:00:51 +00:00
Sergey Biryukov
930079c8a5 Users: Remove unnecessary is_null() call in get_avatar_data().
The `! is_null()` portion of the condition is unnecessary, because `isset()` checks whether a variable is set *and* is not null.

Props JPry.
Fixes #44927.
Built from https://develop.svn.wordpress.org/trunk@44351


git-svn-id: http://core.svn.wordpress.org/trunk@44181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-20 02:49:48 +00:00
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
Sergey Biryukov
ac338b1666 Privacy: Use the actual Privacy Policy page title in get_the_privacy_policy_link().
Props desrosj, birgire, ianbelanger, Ov3rfly.
Fixes #44192.
Built from https://develop.svn.wordpress.org/trunk@43506


git-svn-id: http://core.svn.wordpress.org/trunk@43335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-18 11:50:25 +00:00
iandunn
c9c3c61a53 Privacy: Add template tags for building link to privacy policy page.
This introduces the `get_the_privacy_policy_link()` and `the_privacy_policy_link()` functions, as well as the `privacy_policy_url` filter.

A new `tests/url/` folder was added to better organize tests related to `get_*_url()` functions. Previously, those tests were placed in `tests/url.php` and `tests/link/`, but neither of those locations are optimal. Placing tests in `tests/url.php` violates the guideline of creating separate files/classes for each function under test, and using `tests/link/` conflates two distinct -- albeit related -- groups of functions. Over time, URL-related tests can be migrated to the new folder.

Props birgire, xkon, azaozz, iandunn.
See #43850.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-25 15:55:21 +00:00
Andrew Ozz
cf0d00c602 Privacy: fix get_privacy_policy_url() to only return the URL when the page is published.
See #43435.
Built from https://develop.svn.wordpress.org/trunk@42995


git-svn-id: http://core.svn.wordpress.org/trunk@42824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-20 14:44:20 +00:00
Andrew Ozz
3108d2ffb2 Privacy: add a postbox that is shown when editing the privacy policy page, and where plugins and core will output suggested content and additional privacy info. First run.
Props melchoyce, azaozz.
See #43620.
Built from https://develop.svn.wordpress.org/trunk@42980


git-svn-id: http://core.svn.wordpress.org/trunk@42809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-16 08:53:20 +00:00
Sergey Biryukov
81500e50ef Link Template: Apply get_{$adjacent}_post_excluded_terms filter to an empty excluded_terms parameter as well.
Props soulseekah, zottto.
Fixes #43521.
Built from https://develop.svn.wordpress.org/trunk@42828


git-svn-id: http://core.svn.wordpress.org/trunk@42658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 17:32:31 +00:00
Sergey Biryukov
395667f916 Comments: After [42703], make sure $args['type'] in paginate_comments_links() is always defined.
Props anantajitjg.
Fixes #43299.
Built from https://develop.svn.wordpress.org/trunk@42736


git-svn-id: http://core.svn.wordpress.org/trunk@42566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 16:08:30 +00:00
Sergey Biryukov
0a97d79899 Comments: Avoid a PHP notice in paginate_comments_links() if type argument is set to array.
The function is a wrapper for `paginate_links()`, which returns an array if requested.

Props anantajitjg.
Fixes #43299.
Built from https://develop.svn.wordpress.org/trunk@42703


git-svn-id: http://core.svn.wordpress.org/trunk@42531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-12 21:12:35 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Sergey Biryukov
7c77266b9b Docs: Remove extra dot from some @since tags.
Props hardik-amipara.
Fixes #42899.
Built from https://develop.svn.wordpress.org/trunk@42400


git-svn-id: http://core.svn.wordpress.org/trunk@42229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-15 05:16:47 +00:00
Sergey Biryukov
7ec3bfe1ce Permalinks: Remove unnecesary temporary variable in get_permalink().
Props JPry, danimalbrown.
Fixes #41981.
Built from https://develop.svn.wordpress.org/trunk@42378


git-svn-id: http://core.svn.wordpress.org/trunk@42207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-07 14:50:46 +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
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Sergey Biryukov
4865841343 Posts, Post Types: Pass the order parameter to get_{$adjacent}_post_sort filter.
Props manchumahara.
Fixes #41924.
Built from https://develop.svn.wordpress.org/trunk@41589


git-svn-id: http://core.svn.wordpress.org/trunk@41422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-24 23:01:44 +00:00
Andrew Ozz
a5f8097899 Retire Press This and extract it to a plugin. First run.
Props kraftbj, azaozz.
See #41689.
Built from https://develop.svn.wordpress.org/trunk@41584


git-svn-id: http://core.svn.wordpress.org/trunk@41417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-24 14:22:54 +00:00
Sergey Biryukov
5fe8d31118 Link Template: Allow the type argument to be passed through get_the_comments_pagination() as long as its value isn't array.
See [30820] for `get_the_posts_pagination().

Props jainnidhi, poena.
Fixes #39792.
Built from https://develop.svn.wordpress.org/trunk@41236


git-svn-id: http://core.svn.wordpress.org/trunk@41076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-09 04:07:43 +00:00
Felix Arntz
6625f0c551 Multisite: Introduce a self_admin_url filter to adjust the URL to an administration panel.
Props j.hoffmann.
Fixes #37446.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-14 23:01:42 +00:00
Drew Jaynes
0fe9fb4a16 Link Template: Clarify documentation for the $id parameter in get_post_permalink(), get_edit_post_link(), edit_post_link(), and get_delete_post_link(), to reflect that either a post ID or WP_Post object is accepted.
Separately, use `$post` for checking the post status and retrieving the page_uri in `get_post_permalink()` instead of referencing back to the original `$id` parameter.

Props GunGeekATX for the initial patch.
Fixes #40780.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 03:29:42 +00:00
Drew Jaynes
c5da335097 Docs: Fix a typo in the description for the get_previous_post_link() $link parameter. The default value is '%title', not '%title%'.
Props kmgalanakis.
See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 06:20:43 +00:00
John Blackbourn
80a839de13 Docs: Misc corrections and additions to inline documentation.
See #39130
Props keesiemeijer

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


git-svn-id: http://core.svn.wordpress.org/trunk@39579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:28:40 +00:00
Felix Arntz
d784b5552c Multisite: Replace is_super_admin() with manage_network in get_dashboard_url().
Unit tests for `get_dashboard_url()` have been added.

Props iaaxpage.
Fixes #39065. See #37616.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-12 22:41:39 +00:00
Drew Jaynes
33b8bb3cf3 Docs: Clarify descriptions for home_url() and get_home_url() on the true effect of the $scheme parameter.
Part props thomaswm.
Props stevenlinx.
Fixes #36468.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 07:06:32 +00:00
Dominik Schilling
7cce73a634 General: Introduce a wp_list_sort() helper function, v2.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

This was previously committed in [38859] but got reverted in [38862] and [38863]. To fix the previous issues, `wp_list_sort()` supports now an additional argument to preserve array keys via `uasort()`.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38928


git-svn-id: http://core.svn.wordpress.org/trunk@38871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 21:26:32 +00:00
Dominik Schilling
6c8508023f Revert [38859] due to an incomplete implementation.
See https://core.trac.wordpress.org/ticket/37128#comment:27.
See #37128.
Built from https://develop.svn.wordpress.org/trunk@38863


git-svn-id: http://core.svn.wordpress.org/trunk@38806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 17:01:32 +00:00
Pascal Birchler
f54558e75b General: Introduce a wp_list_sort() helper function.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38859


git-svn-id: http://core.svn.wordpress.org/trunk@38802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 11:12:51 +00:00
Jeremy Felt
1560fbcbc5 Multisite: Use get_network() and get_current_network_id() for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
John Blackbourn
b84023ea33 Taxonomy: Introduce more fine grained capabilities for managing taxonomy terms.
This introduces the singular `edit_term`, `delete_term`, and `assign_term` meta capabilities for terms, and switches the base capability name for tags from `manage_categories` to `manage_post_tags` and the corresponding `edit_post_tags`, `delete_post_tags`, and `assign_post_tags`.

All of these capabilities ultimately map to `manage_categories` so by default there is no change in the behaviour of the capabilities for categories, tags, or custom taxonomies. The `map_meta_cap` filter and the `capabilities` argument when registering a taxonomy now allow for control over editing, deleting, and assigning individual terms, as well as a separation of capabilities for tags from those of categories.

Fixes #35614
Props johnjamesjacoby for feedback

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


git-svn-id: http://core.svn.wordpress.org/trunk@38641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-30 22:40:28 +00:00
Sergey Biryukov
bae2b337f0 Docs: Add home and commentpaged as accepted values for user_trailingslashit filter.
Props sebastian.pisula.
Fixes #37734.
Built from https://develop.svn.wordpress.org/trunk@38645


git-svn-id: http://core.svn.wordpress.org/trunk@38588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-22 22:54:29 +00:00
Jeremy Felt
58f107fa95 Multisite: Revert [38388].
Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 21:39:29 +00:00
Sergey Biryukov
0bae73682b I18N: Correct context for Next/Previous strings in get_the_posts_pagination().
Props FlorianBrinkmann.
Fixes #37952.
Built from https://develop.svn.wordpress.org/trunk@38611


git-svn-id: http://core.svn.wordpress.org/trunk@38554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-15 09:20:29 +00:00
Sergey Biryukov
b6397b4fda Docs: Use a third-person singular verb in the DocBlock summary for get_theme_file_uri(), get_parent_theme_file_uri(), get_theme_file_path(), and get_parent_theme_file_path(), introduced in [38578].
See #18302.
Built from https://develop.svn.wordpress.org/trunk@38606


git-svn-id: http://core.svn.wordpress.org/trunk@38549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-14 21:48:28 +00:00
Sergey Biryukov
4d7e41653e Docs: Use a third-person singular verb for theme_file_uri, parent_theme_file_uri, theme_file_path, and parent_theme_file_path filters added in [38578].
See #18302.
Built from https://develop.svn.wordpress.org/trunk@38605


git-svn-id: http://core.svn.wordpress.org/trunk@38548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-14 21:45:29 +00:00
John Blackbourn
e6e6cbf21f Taxonomy: Revert accidental changes introduced in [38578].
See #18302

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


git-svn-id: http://core.svn.wordpress.org/trunk@38522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 22:58:28 +00:00
John Blackbourn
c0bb9c2562 Themes: Improve child theme file inheritance by introducing functions for locating and fetching the URL or path to files within child and parent themes.
The most useful function this introduces is `get_theme_file_uri()`, which returns the URL to the specified file in the child theme if it exists, and falls back to the URL to the specified file in the parent theme. This allows parent themes to reference files (including enqueuing CSS and JavaScript files) that can be overridden by the child theme simply by existing.

This change also introduces `get_theme_file_path()`, which is the file path equivalent of `get_theme_file_uri()`.

Finally, `get_parent_theme_file_uri()` and `get_parent_theme_file_path()` are also introduced, which allow a theme to specifically reference a file URL or file path in the parent theme. These can be used as replacements for `get_template_directory_uri()` and `get_template_directory()` respectively, for consistency.

Props johnbillion, georgestephanis, gma992.
Fixes #18302

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


git-svn-id: http://core.svn.wordpress.org/trunk@38521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 22:54:32 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
0eebbed6b2 General: revert [38467], wp_is_IE() should not exist.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 15:22:31 +00:00
Scott Taylor
021e23e70b General: use a new function, wp_is_IE(), instead of the $is_IE global in a number of places.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 06:42:33 +00:00
Scott Taylor
1dc37b77ef Press This: in get_shortcut_link(), just check a class constant on WP_Press_This instead of instantiating the object and reading an instance prop.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 06:08:00 +00:00
Scott Taylor
9383bf8f74 General: use get_bloginfo( 'version' ) instead of global $wp_version in several locations - excluding those locations which reload version.php mid-flight.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 05:49:37 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Scott Taylor
85d63f2af5 Press This: the file for the WP_Press_This class should not produce side effects. Similar to what we did in r38355 for WP_Site_Icon, drop the instances of global instantiation for $wp_press_this via loading the file. The variable can be set inline when necessary. In most of those places, if the global is already set, the file does not load and stomp it currently.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 06:07:29 +00:00
Scott Taylor
08233c6aff Multisite: move get_current_site() to load.php so that it can be used in more places, instead of importing global $current_site.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:35:30 +00:00
John Blackbourn
94c8ca0f2e Docs: Correct various documentation around object and stdClass types.
See #37770

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


git-svn-id: http://core.svn.wordpress.org/trunk@38310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 16:49:45 +00:00
Drew Jaynes
e6267dcf19 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 19:33:30 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Sergey Biryukov
247e33934c Permalinks: Avoid a PHP notice in get_permalink() if default category is unavailable.
Props Presskopp.
Fixes #36529.
Built from https://develop.svn.wordpress.org/trunk@37707


git-svn-id: http://core.svn.wordpress.org/trunk@37673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 23:12:28 +00:00
Dominik Schilling
e50f357944 Canonical: Introduce wp_get_canonical_url().
`wp_get_canonical_url()` encapsulates the URL logic of `rel_canonical()` to provide a consistent way to retrieve the canonical URL for a post.
The new filter `get_canonical_url` allows to customize the canonical URL.

Props joostdevalk, jipmoors, DrewAPicture, ocean90.
Fixes #36168.
Built from https://develop.svn.wordpress.org/trunk@37685


git-svn-id: http://core.svn.wordpress.org/trunk@37651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-11 13:31:29 +00:00
Drew Jaynes
e7e20e4b54 Docs: Update the return description for get_preview_post_link() to note that it can also return null.
Props chris_dev, swissspidy.
See #35915.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 18:25:28 +00:00
Drew Jaynes
d28f1a08ef Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:01:27 +00:00
Drew Jaynes
c1ba18d147 Docs: Standardize filter docs in wp-includes/link-template.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:27:27 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Drew Jaynes
49e3bc83dd Docs: Capitalize URL – an acronym for Uniform Resource Locator – when used in the context of inline docs in wp-includes/link-template.php.
Fixes #30406.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-20 14:47:28 +00:00
Drew Jaynes
a368295c37 Docs: Notate more optional parameter defaults for a variety of function DocBlocks in wp-includes/link-template.php.
See #30406.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-20 14:37:29 +00:00
Drew Jaynes
e58b8ad732 Docs: Notate optional parameter defaults for a variety of function DocBlocks in wp-includes/link-template.php.
See #30406.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-20 06:32:29 +00:00
Drew Jaynes
396018ab34 Docs: Properly notate optional parameters as such in a variety of DocBlocks in wp-includes/link-template.php.
See #30406.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-19 23:21:27 +00:00