John Blackbourn
39bff93b6b
Docs: Various inline documentation corrections and improvements.
...
See #53399
Built from https://develop.svn.wordpress.org/trunk@52332
git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
John Blackbourn
fa62df0774
Query: Correct and standardise the meta query documentation.
...
Also improves the formatting of some surrounding documentation.
Props audrasjb, johnbillion
Fixes #53467
Built from https://develop.svn.wordpress.org/trunk@52226
git-svn-id: http://core.svn.wordpress.org/trunk@51818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-20 00:07:59 +00:00
hellofromTonya
e838c96df4
Code Modernization: Fix "passing null to non-nullable" deprecation notice in WP_Comment_Query::get_comment_ids()
.
...
The `WP_Comment_Query::get_comment_ids()` method is supposed to handle `null` as a search query, but was throwing a `strlen(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1.
Discovered via and already covered via the pre-existing `Tests_Comment_Query::test_search_null_should_be_ignored()` test method.
Follow-up to [36345], [48275].
Props jrf, hellofromTonya.
See #53635 .
Built from https://develop.svn.wordpress.org/trunk@51806
git-svn-id: http://core.svn.wordpress.org/trunk@51413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-13 18:54:59 +00:00
John Blackbourn
2cb4ebefe2
Docs: Replace $this
in hook param docs with more appropriate names.
...
`$this` is a pseudo-variable that cannot be used as the name of a function parameter, so renaming these helps prevent errors when implementing hook callback functions.
Fixes #53457
Built from https://develop.svn.wordpress.org/trunk@51518
git-svn-id: http://core.svn.wordpress.org/trunk@51129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 19:35:58 +00:00
John Blackbourn
79685db062
Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
...
See #53399
Built from https://develop.svn.wordpress.org/trunk@51298
git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
John Blackbourn
6f3a940e64
Plugins: Replace usage of $this
in action and filter parameter docblocks with more appropriate variable names.
...
See #51800 , #52217
Fixes #52243
Built from https://develop.svn.wordpress.org/trunk@49946
git-svn-id: http://core.svn.wordpress.org/trunk@49645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-08 14:30:14 +00:00
John Blackbourn
f4cda1b62f
Docs: Upgrade more parameters in docblocks to used typed array notation.
...
See #51800 , #41756
Built from https://develop.svn.wordpress.org/trunk@49693
git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +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
Sergey Biryukov
f39fc10544
Docs: Use a consistent plural form of "status".
...
Props Collizo4sky, Presskopp, davidbaumwald.
Fixes #51690 .
Built from https://develop.svn.wordpress.org/trunk@49472
git-svn-id: http://core.svn.wordpress.org/trunk@49231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-02 01:38:07 +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
e1a05a42d3
Comments: Assign the array of comment data returned from the comments_pre_query
filter to the comments
property of the current WP_Comment_Query
instance.
...
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.
This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.
Follow-up to [46086].
Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521 .
Built from https://develop.svn.wordpress.org/trunk@48990
git-svn-id: http://core.svn.wordpress.org/trunk@48752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 19:55:08 +00:00
Sergey Biryukov
e01409866e
Docs: Reformat comments_pre_query
, networks_pre_query
, sites_pre_query
DocBlocks for better readability.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48986
git-svn-id: http://core.svn.wordpress.org/trunk@48748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:10:03 +00:00
Sergey Biryukov
b66ff2f68d
Docs: Fix typo in *_pre_query
filter DocBlocks.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48985
git-svn-id: http://core.svn.wordpress.org/trunk@48747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:45:03 +00:00
Sergey Biryukov
649348cf5b
Code Modernization: Remove unnecessary reference sign from get_comment()
definition.
...
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map( 'get_comment', ... )`.
Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.
Note: This reverts [48838], which is now redundant.
Follow-up to a similar change for `get_post()` in [21572].
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@48961
git-svn-id: http://core.svn.wordpress.org/trunk@48723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 03:55:07 +00:00
Sergey Biryukov
7ba8aa2bb4
Code Modernization: Fix PHP 8 "argument must be passed by reference, value given" error in WP_Comment_Query::get_comments()
.
...
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference.
The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error.
The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8.
Props jrf.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@48838
git-svn-id: http://core.svn.wordpress.org/trunk@48600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-21 21:34:03 +00:00
Sergey Biryukov
1f85e7484f
Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48782
git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
John Blackbourn
57a3f803ae
Docs: First pass at some inline docs fixes mostly made by PHPCBF.
...
See #49572 , #50744
Built from https://develop.svn.wordpress.org/trunk@48586
git-svn-id: http://core.svn.wordpress.org/trunk@48348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 20:01:04 +00:00
John Blackbourn
124972f2c6
Docs: Further corrections and improvements to various inline docblocks.
...
See #49572
Built from https://develop.svn.wordpress.org/trunk@48576
git-svn-id: http://core.svn.wordpress.org/trunk@48338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 07:39:02 +00:00
Sergey Biryukov
ec571bdcf6
Docs: Spell "falsey" in a consistent way.
...
See #49572 .
Built from https://develop.svn.wordpress.org/trunk@48275
git-svn-id: http://core.svn.wordpress.org/trunk@48044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-02 11:30:02 +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
whyisjake
9f86174e08
Comments: Ensure that unmoderated comments won't be search indexed.
...
After a comment is submitted, only allow a brief window where the comment is live on the site.
Fixes #49956 .
Props: jonkolbert, ayeshrajans, Asif2BD, peterwilsoncc, imath, audrasjb, jonoaldersonwp, whyisjake.
Built from https://develop.svn.wordpress.org/trunk@47887
git-svn-id: http://core.svn.wordpress.org/trunk@47661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-02 20:12:07 +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
6b5087812c
Comments: Restore inclusion of an empty comment type when building the WHERE
clause in WP_Comment_Query::get_comment_ids()
.
...
This ensures that `get_comments( array( 'type' => 'comment' ) )` still includes comments that have not yet migrated to the `comment` type.
Follow-up to [47597].
Props ocean90.
See #49236 .
Built from https://develop.svn.wordpress.org/trunk@47625
git-svn-id: http://core.svn.wordpress.org/trunk@47400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-26 13:14:06 +00:00
Sergey Biryukov
61a2f62ffd
Comments: Use comment
instead of an empty string for the comment_type
DB field value in comments table.
...
This is the first step to bring support for custom comment types into WordPress.
Add a scheduled upgrade routine to update the type value for existing comments, in batches of 100 at a time.
Props imath, aaroncampbell, jeremyfelt, dshanske.
Fixes #49236 .
Built from https://develop.svn.wordpress.org/trunk@47597
git-svn-id: http://core.svn.wordpress.org/trunk@47372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-17 19:35:06 +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
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
e6bbff13c5
Code Modernisation: Replace call_user_func_array()
in various __call()
methods with dynamic function calls.
...
The callback in these functions is always checked against a limited list of valid callbacks that can be safely changed to dynamic function calls.
Props jrf.
See #47678 .
Built from https://develop.svn.wordpress.org/trunk@46144
git-svn-id: http://core.svn.wordpress.org/trunk@45956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 11:53:56 +00:00
Sergey Biryukov
c9071ca2e6
Docs: Clarify the int
return value in comments_pre_query
filter DocBlock.
...
See #45800 .
Built from https://develop.svn.wordpress.org/trunk@46087
git-svn-id: http://core.svn.wordpress.org/trunk@45899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-10 19:04:56 +00:00
Adam Silverstein
b3e64f0947
Comments: add a new comments_pre_query
filter to short circuit WP_Comment_Query 'get_comments' queries.
...
Return a non-null value to bypass WordPress's default comment queries.
Props felipeelia, spacedmonkey.
Fixes #45800 .
Built from https://develop.svn.wordpress.org/trunk@46086
git-svn-id: http://core.svn.wordpress.org/trunk@45898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-10 18:42:56 +00:00
Gary Pendergast
14c7533162
Coding Standards: Fix all WordPress.DB.PreparedSQLPlaceholders
issues.
...
See #47632 .
Built from https://develop.svn.wordpress.org/trunk@45603
git-svn-id: http://core.svn.wordpress.org/trunk@45414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:43:55 +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
Gary Pendergast
8656a65e1e
Coding Standards: Fix and whitelist variable names.
...
From the `WordPress.NamingConventions.ValidVariableName` sniff, this commit fixes/whitelists all `NotSnakeCaseMemberVar`, `MemberNotSnakeCase`, and `StringNotSnakeCase` violations. It also fixes a handful of the `NotSnakeCase` violations.
See #45934 .
Built from https://develop.svn.wordpress.org/trunk@44573
git-svn-id: http://core.svn.wordpress.org/trunk@44404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-12 06:06:48 +00:00
Felix Arntz
a71d208785
General: Fix problematic string to array parsing.
...
WordPress has historically often used code like `preg_split( '/[\s,]+/', $var )` to parse a string of comma-separated values into an array. However, this approach was causing an empty string to not be parsed into an empty array as expected, but rather into an array with the empty string as its sole element.
This was among other areas causing problems in the REST API where passing an empty request parameter could cause that request to fail because, instead of it being ignored, that parameter would be compared against the valid values for it, which typically do not include an empty string.
Props david.binda, sstoqnov.
Fixes #43977 .
Built from https://develop.svn.wordpress.org/trunk@44546
git-svn-id: http://core.svn.wordpress.org/trunk@44377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 21:06:49 +00:00
Sergey Biryukov
9c08686353
Docs: Fix typo in the description of status
parameter of WP_Comment_Query
.
...
See #41338 .
Built from https://develop.svn.wordpress.org/trunk@44412
git-svn-id: http://core.svn.wordpress.org/trunk@44242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-07 11:38: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
John Blackbourn
b13e73d05c
Docs: Document more parameters and properties using typed array notation.
...
See #41756
Built from https://develop.svn.wordpress.org/trunk@42875
git-svn-id: http://core.svn.wordpress.org/trunk@42705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 18:10:32 +00:00
Sergey Biryukov
0354c3e2f1
Docs: Add missing @return
entry for WP_Comment_Query::get_comment_ids()
.
...
Props chetan200891, birgire.
Fixes #42795 .
Built from https://develop.svn.wordpress.org/trunk@42376
git-svn-id: http://core.svn.wordpress.org/trunk@42205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-07 13:47:52 +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
Boone Gorges
2f95f44008
Correct documentation for status
param of WP_Comment_Query
.
...
The `status` parameter accepts an array or string/comma-separated list.
Introduced in [30084].
Props pbiron.
Fixes #41338 .
Built from https://develop.svn.wordpress.org/trunk@42165
git-svn-id: http://core.svn.wordpress.org/trunk@41996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-13 16:26:47 +00:00
John Blackbourn
67c973f95e
Docs: Correct parameter type documentation for various __call()
methods.
...
See #42505
Built from https://develop.svn.wordpress.org/trunk@42151
git-svn-id: http://core.svn.wordpress.org/trunk@41982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-10 22:56:47 +00:00
John Blackbourn
9fdbe6538e
Docs: Remove &
prefixes from parameter documentation to avoid doc parsing errors.
...
Props sudar for the original patch.
See #35974
Built from https://develop.svn.wordpress.org/trunk@41686
git-svn-id: http://core.svn.wordpress.org/trunk@41520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:03:33 +00:00
Boone Gorges
c080c0a2ea
Introduce paged
argument to WP_Comment_Query
.
...
Using `paged` with `number` allows developers to request
paginated comment results without having to do a manual offset
calculation.
Props AdamWills.
Fixes #38268 .
Built from https://develop.svn.wordpress.org/trunk@41287
git-svn-id: http://core.svn.wordpress.org/trunk@41127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-21 15:35:46 +00:00
John Blackbourn
d510413811
Docs: Fix various filter documentation.
...
See #38462 , #41017
Built from https://develop.svn.wordpress.org/trunk@41215
git-svn-id: http://core.svn.wordpress.org/trunk@41055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 14:34:44 +00:00
Boone Gorges
c657a2c060
Comments: Ignore the 'fields' parameter in the comment query cache.
...
`WP_Comment_Query` always queries runs an ID query, and so is unaffected
by the 'fields' parameter. As such, 'fields' can be ignored when building
a cache key for the results of the ID query.
Props spacedmonkey.
Fixes #41348 .
Built from https://develop.svn.wordpress.org/trunk@41190
git-svn-id: http://core.svn.wordpress.org/trunk@41030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-30 14:56:41 +00:00
Drew Jaynes
0860bb2771
Docs: Remove @access
notations from method DocBlocks in wp-includes/* classes.
...
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.
See #41452 .
Built from https://develop.svn.wordpress.org/trunk@41162
git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Sergey Biryukov
0a24e8d1cd
Docs: Add @access
entry for WP_Comment_Query::fill_descendants()
.
...
Props umangvaghela123.
Fixes #41435 .
Built from https://develop.svn.wordpress.org/trunk@41145
git-svn-id: http://core.svn.wordpress.org/trunk@40985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-25 12:54:45 +00:00
Sergey Biryukov
00b91b3003
Docs: Add a @global
entry for $wpdb
in WP_Comment_Query::fill_descendants()
.
...
Props jontyravi.
Fixes #41412 .
Built from https://develop.svn.wordpress.org/trunk@41123
git-svn-id: http://core.svn.wordpress.org/trunk@40963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-23 10:40:45 +00:00
Boone Gorges
f882fc1295
Comments: Clean up unused code after [38446].
...
When the direct SQL query was removed in [38446], part of the SQL
concatenation was not removed. This changeset fixes that.
Props david.binda.
Fixes #39142 .
Built from https://develop.svn.wordpress.org/trunk@39532
git-svn-id: http://core.svn.wordpress.org/trunk@39472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-07 15:52:44 +00:00
Boone Gorges
bd11f7b84a
Comments: Query used to fill comment descendants should reset 'offset' and 'number' params.
...
Descendant queries should not inherit the 'offset' and 'number'
parameters of the parent query, or descendants will be missed.
Previously: [38497].
See #37696 .
Built from https://develop.svn.wordpress.org/trunk@39274
git-svn-id: http://core.svn.wordpress.org/trunk@39214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 03:03:30 +00:00