Commit Graph

497 Commits

Author SHA1 Message Date
John Blackbourn
056dad9c2c Docs: Use more specific types in parameter descriptions in place of mixed.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47397


git-svn-id: http://core.svn.wordpress.org/trunk@47184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-01 10:38:07 +00:00
Sergey Biryukov
c15cd5f5c4 Docs: Add missing quote to {@see 'comment_$old_status_to_$new_status'} hook reference in wp_transition_comment_status() DocBlock.
Props coffee2code.
Fixes #49474.
Built from https://develop.svn.wordpress.org/trunk@47324


git-svn-id: http://core.svn.wordpress.org/trunk@47118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-19 13:45:07 +00:00
Sergey Biryukov
f7338b347d Docs: Update @return tag for wp_allow_comment() with trash as a possible return value.
Props oakesjosh, jeremyfelt.
Fixes #49206.
Built from https://develop.svn.wordpress.org/trunk@47286


git-svn-id: http://core.svn.wordpress.org/trunk@47086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-13 17:50:05 +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
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
deb1886078 Accessibility: Text Changes: Use sentence case for the word Error in various error messages, instead of all caps.
Using all caps should be avoided for better readability and because screen readers may pronounce all-caps words as abbreviations.

Props afercia, ryokuhi, sabernhardt, garrett-eclipse.
See #47656, #43037, #42945.
Built from https://develop.svn.wordpress.org/trunk@47156


git-svn-id: http://core.svn.wordpress.org/trunk@46956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 21:38:04 +00:00
Sergey Biryukov
2fe7c95153 Text Changes: Capitalize error messages consistently.
Props Presskopp.
Fixes #42945.
Built from https://develop.svn.wordpress.org/trunk@47154


git-svn-id: http://core.svn.wordpress.org/trunk@46954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 20:55:05 +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
Sergey Biryukov
c546aa36ec Docs: Improve @return description for wp_update_comment() and WP_UnitTest_Factory_For_Comment::update_object().
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47017


git-svn-id: http://core.svn.wordpress.org/trunk@46817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-27 00:30:02 +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
John Blackbourn
f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn
b3d6acd6a4 Docs: Fix some incorrect return tags in docblocks.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 22:23:01 +00:00
John Blackbourn
c8f91f77ac Docs: Correct invalid hook docblocks.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-27 19:11:02 +00:00
John Blackbourn
883bb53d06 Pings/Trackbacks: Fix processing of posts with pending enclosures.
Introduced in [46175].

Fixes #36824

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


git-svn-id: http://core.svn.wordpress.org/trunk@46225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-07 21:37:03 +00:00
Sergey Biryukov
d2a48496d2 Docs: Add missing description for $comment global.
Props immeet94, mukesh27.
Fixes #46928. See #47110.
Built from https://develop.svn.wordpress.org/trunk@46391


git-svn-id: http://core.svn.wordpress.org/trunk@46190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-04 22:19:57 +00:00
Sergey Biryukov
547be72c3b Pings/Trackbacks: Use correct variable in a foreach() loop in do_all_pings().
Props itowhid06.
Fixes #48094. See #36824.
Built from https://develop.svn.wordpress.org/trunk@46292


git-svn-id: http://core.svn.wordpress.org/trunk@46104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-25 15:50:58 +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
31fca440bd Coding Standards: Add missing break for the default case in get_default_comment_status(().
Props itowhid06.
Fixes #48095.
Built from https://develop.svn.wordpress.org/trunk@46227


git-svn-id: http://core.svn.wordpress.org/trunk@46039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 13:50:58 +00:00
John Blackbourn
63c77a7826 Docs: Improve the docs for comment counting related functions.
See #47110, #48093

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


git-svn-id: http://core.svn.wordpress.org/trunk@46035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 10:02:59 +00:00
Boone Gorges
da8a602ad6 Improve performance of trackback query in do_all_pings().
Previously, the direct SQL query used to identify trackbacks in
`do_all_pings()` performed poorly, due to an unindexed query against the
`to_ping` column. We improve performance in two ways. First, we switch
to using a postmeta flag for posts that require trackbacks to be sent;
queries joining against the postmeta table that check only the `meta_key`
are generally quite fast. Second, we switch to the use of `WP_Query`,
making the query cacheable and filterable using standard methods.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
Fixes #36824.
Built from https://develop.svn.wordpress.org/trunk@46178


git-svn-id: http://core.svn.wordpress.org/trunk@45990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 02:06:56 +00:00
Boone Gorges
aa7d063af2 Use WP_Query when sending pingbacks.
Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
See #36824.
Built from https://develop.svn.wordpress.org/trunk@46177


git-svn-id: http://core.svn.wordpress.org/trunk@45989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 02:00:55 +00:00
Boone Gorges
7c56b972cc Improve do_enclose() logic on post publish.
Removing the direct SQL query in `do_all_pings()` improves filterability.

As part of this change, the signature of `do_enclose()` is changed so that
a null `$content` parameter can be passed, with the `$content` then inferred
from the `$post` passed in the second parameter. In addition, the second
parameter was modified so that a post ID or a `WP_Post` object can be
provided. These changes make it possible to trigger enclosure checks with
a post ID alone (as in `do_all_pings()`) and also brings the function
signature in line with `do_trackbacks()` and `pingback()`.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
See #36824.
Built from https://develop.svn.wordpress.org/trunk@46175


git-svn-id: http://core.svn.wordpress.org/trunk@45987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 01:49:56 +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
d9954ed4cb Privacy: Add descriptions for sections in a personal data export file.
Props garrett-eclipse, Venutius, karmatosed.
Fixes #45491.
Built from https://develop.svn.wordpress.org/trunk@45825


git-svn-id: http://core.svn.wordpress.org/trunk@45636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-18 02:07: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
8e85299a00 General: First pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Props ianbelanger, tobifjellner, SergeyBiryukov.
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45674


git-svn-id: http://core.svn.wordpress.org/trunk@45485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:45:57 +00:00
Sergey Biryukov
18bd01985b Coding Standards: Rename $r variable used with wp_parse_args() to $parsed_args for clarity.
Props freewebmentor.
Fixes #45059.
Built from https://develop.svn.wordpress.org/trunk@45667


git-svn-id: http://core.svn.wordpress.org/trunk@45478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 00:48:58 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +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
Sergey Biryukov
1e925a5ae3 PHPCS: Remove extra tabs added in [44970].
See #44237.
Built from https://develop.svn.wordpress.org/trunk@44972


git-svn-id: http://core.svn.wordpress.org/trunk@44803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:36:51 +00:00
Sergey Biryukov
3de93dbc99 Comments: Introduce comment_flood_message and comment_duplicate_message filters for comment flood and duplicate comment error messages.
Props odminstudios, Katyatina, mukesh27.
Fixes #44237.
Built from https://develop.svn.wordpress.org/trunk@44970


git-svn-id: http://core.svn.wordpress.org/trunk@44801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:10:51 +00:00
Sergey Biryukov
0292de60ec Comments: Improve comment content filtering.
Built from https://develop.svn.wordpress.org/trunk@44842


git-svn-id: http://core.svn.wordpress.org/trunk@44674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-12 22:30:50 +00:00
Gary Pendergast
4c425c87fa Comments: Show the "awaiting moderation" message when comment cookies are disabled.
The "Your comment is awaiting moderation." message relied upon the comment author cookie being set. However, since it's now possible to opt-out of that cookie, submitting a comment won't show the comment preview when the comment is placed in moderation.

To avoid this issue, we now include a hash in the redirect URL, allowing the site to identify that a preview of the moderated comment should be displayed.

Props imath, tomdxw, birgire, lakenh, azaozz, pento.
Fixes #43857.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 01:34:51 +00:00
Boone Gorges
c9a275c4a9 Update since annotation on allow_empty_comment hook.
Originally introduced in [42661].

Fixes #16979.
Built from https://develop.svn.wordpress.org/trunk@44364


git-svn-id: http://core.svn.wordpress.org/trunk@44194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-28 13:42:50 +00:00
desrosj
268402cf53 PHP7.3 compatibility: Fix compact throwing notices.
In PHP 7.3, the `compact()` function has been changed to issue an `E_NOTICE` level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

Props jorbin, desrosj.

Merges [43819] and [43832] to trunk.

Fixes #44416.
Built from https://develop.svn.wordpress.org/trunk@44166


git-svn-id: http://core.svn.wordpress.org/trunk@43996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 05:13:52 +00:00
Jeremy Felt
2dce718157 REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Merges [43729] to trunk.

Props flixos90, spacedmonkey.
Fixes #44467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:02:24 +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
9c084c6968 Posts, Post Types: Introduce edit_post_{$post->post_type} hook.
The hook fires before the general `edit_post` hook and has the same parameters.

It also complements the `save_post_{$post->post_type}` hook added in [25050].

Props Mte90, garrett-eclipse.
Fixes #34706.
Built from https://develop.svn.wordpress.org/trunk@43535


git-svn-id: http://core.svn.wordpress.org/trunk@43364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-25 20:57:25 +00:00
Andrew Ozz
cc1bfb1e55 Privacy: Don't replace comment author URL and email with anything.
Props TZ-Media, desrosj, birgire.
Fixes #44141.
Built from https://develop.svn.wordpress.org/trunk@43467


git-svn-id: http://core.svn.wordpress.org/trunk@43294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-17 09:00:25 +00:00
iandunn
fc800115a7 Privacy: Escape comment URLs in personal export file to prevent XSS.
There doesn't appear to be any way for an attacker to introduce malicious input into the URL, unless a plugin is filtering the URL to add it, but it's better to be safe than sorry.

Props birgire.
Fixes #44054.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-12 15:56:21 +00:00
iandunn
3d4c461e50 Privacy: Store plugin callbacks in associative array for flexibility.
The personal data export and erasure tools allow plugins to register their own callbacks, in order to add additional data to the export and erasure processes. Previously, these were registered without specifying a constant identifier in the array of callbacks. Using mutable integers makes it difficult for plugins to modify the callbacks of other plugins, though.

Using associative array keys instead provides a covenient and reliable way to identify and interact with another plugin's callbacks.

Props desrosj, allendav, ocean90.
Fixes #43931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-03 19:28:21 +00:00
Andrew Ozz
2f321e234e Privacy: improve wp_privacy_erase_personal_data(), return boolean values.
Props ericdaams.
See #43602.
Built from https://develop.svn.wordpress.org/trunk@43061


git-svn-id: http://core.svn.wordpress.org/trunk@42890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 19:27:22 +00:00
Andrew Ozz
e0d2de94e7 Privacy: docs fixes and improvements for wp_comments_personal_data_exporter().
Props desrosj.
See #43440.
Built from https://develop.svn.wordpress.org/trunk@43058


git-svn-id: http://core.svn.wordpress.org/trunk@42887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 17:18:21 +00:00
John Blackbourn
cf02373b39 Comments: Update the inline docs following [42772].
See #43436

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


git-svn-id: http://core.svn.wordpress.org/trunk@42871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 13:10:20 +00:00
Andrew Ozz
b044b4053e Privacy: add means to export personal data by username or email address. Generate a zipped export file containing all data. First run.
Props allendav.
See #43546.
Built from https://develop.svn.wordpress.org/trunk@43012


git-svn-id: http://core.svn.wordpress.org/trunk@42841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 19:54:21 +00:00
Andrew Ozz
81668f8312 Privacy: add functionality to anonymize commenters.
Props xkon, fclaussen, allendav, birgire, azaozz.
See #43442.
Built from https://develop.svn.wordpress.org/trunk@42994


git-svn-id: http://core.svn.wordpress.org/trunk@42823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-20 12:19:21 +00:00
Andrew Ozz
fbb51eafb0 Privacy: fix docs, formatting, white space, add tests for the personal data from comments exporter.
Props birgire.
See #43440.
Built from https://develop.svn.wordpress.org/trunk@42987


git-svn-id: http://core.svn.wordpress.org/trunk@42816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-18 22:55:22 +00:00