Commit Graph

594 Commits

Author SHA1 Message Date
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