Commit Graph

497 Commits

Author SHA1 Message Date
Sergey Biryukov
2fc21e6b79 Comments: Return early from comment_form() if an invalid post ID is passed.
If an invalid post ID is passed to the function, `comments_open()` should return `false`, and no comment form be displayed. This commit restores the previous behavior that was unintentionally changed when standardizing on the `$post` parameter name.

Follow-up to [53715].

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


git-svn-id: http://core.svn.wordpress.org/trunk@54047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:45:11 +00:00
Sergey Biryukov
ca57157a39 Code Modernization: Replace deprecated string interpolation patterns.
PHP 8.2 deprecates string interpolation patterns that place the dollar sign outside the curly braces:
{{{
echo "Hello ${name}";
}}}

This commit fixes such patterns by replacing them with proper curly braced patterns:
{{{
echo "Hello {$name}";
}}}

This addresses `Deprecated: Using ${var} in strings is deprecated, use {$var} instead` notices when running tests on PHP 8.2.

References:
* [https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated PHP.Watch: PHP 8.2: ${var} string interpolation deprecated]
* [https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation PHP RFC: Deprecate ${} string interpolation]

Follow-up to [10584], [31733], [42360], [53922].

Props ayeshrajans, jrf.
Fixes #55787.
Built from https://develop.svn.wordpress.org/trunk@54134


git-svn-id: http://core.svn.wordpress.org/trunk@53693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 17:52:08 +00:00
audrasjb
e7d91b8017 General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.

Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 12:11:09 +00:00
audrasjb
37c514cc62 Comments: Improve accessibility of the "Logged in as" link in comment form.
This changeset ensures the "Logged in as" link conveys the information about its purpose ("Edit your profile") while the information "Logged in as Jane Doe" is only a simple text.

Props juliemoynat, SergeyBiryukov, joedolson, audrasjb, lopo.
Fixes #55718.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 17:06:15 +00:00
Sergey Biryukov
69a8ecce33 Coding Standards: Rename $comment_post_ID and $comment_author_IP variables in various files.
This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`

While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.

Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:

* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`

The change does not affect parameters for functions receiving an array of comment data:

* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`

The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.

Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53723


git-svn-id: http://core.svn.wordpress.org/trunk@53282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 16:19:11 +00:00
Sergey Biryukov
f14f6a162a Coding Standards: Improve variable names in wp-trackback.php.
This fixes a `Variable "$comment_post_ID" is not in valid snake_case format` WPCS warning.

`$comment_post_ID`, while matching the database field of the same name, does not follow the WordPress coding standards, so the variable is now renamed to `$comment_post_id`.

Additionally, these variables are renamed for clarity:

* `$tb_id` to `$post_id` (this was not the trackback ID)
* `$tb_url` to `$trackback_url`

Follow-up to [172], [637], [1616], 

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53719


git-svn-id: http://core.svn.wordpress.org/trunk@53278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 14:02:10 +00:00
Sergey Biryukov
1069ac4afd Posts, Post Types: Standardize on $post parameter name where appropriate.
This renames the `$post_id` or `$id` parameters to `$post` for functions that accept a post ID or post object:

* `get_sample_permalink()`
* `get_sample_permalink_html()`
* `wp_check_post_lock()`
* `wp_set_post_lock()`
* `get_the_tags()`
* `comment_class()`
* `get_comment_class()`
* `get_comments_link()`
* `get_comments_number()`
* `comments_number()`
* `get_comments_number_text()`
* `comments_open()`
* `pings_open()`
* `comment_form()`
* `do_trackbacks()`
* `pingback()`
* `post_permalink()`
* `get_post_permalink()`
* `get_edit_post_link()`
* `edit_post_link()`
* `get_delete_post_link()`
* `post_class()`
* `get_post_class()`
* `the_attachment_link()`
* `wp_get_attachment_link()`
* `wp_list_post_revisions()`
* `check_and_publish_future_post()`
* `add_ping()`
* `get_pung()`
* `get_to_ping()`
* `wp_get_post_revisions()`
* `wp_get_post_revisions_url()`

Additionally, `$revision_id` is renamed to `$revision` in:

* `wp_restore_post_revision()`
* `wp_delete_post_revision()`

Includes minor documentation improvements for consistency and code layout fixes for better readability.

Follow-up to [1599], [1794], [2881], [3303], [3851], [5302], [6633], [6716], [6985], [7103], [7149], [7747], [8011], [8638], [8643], [8695], [9138], [9273], [11425], [11922], [11956], [12284], [12810], [12923], [13023], [13171], [25567], [27156], [27473], [28558], [28602], [33659], [38852], [47276], [47366], [48622], [49544], [49597], [52095].

See #56243, #55647.
Built from https://develop.svn.wordpress.org/trunk@53715


git-svn-id: http://core.svn.wordpress.org/trunk@53274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-18 17:37:17 +00:00
davidbaumwald
c2fbb4950d Comments: Add contextual autocomplete attributes to comment form fields.
For accessibility, input fields should identify their "purpose".  The HTML5 attribute `autocomplete` allows for various user data to be quickly autofilled while adding context for some assistive technologies.

This commit adds the appropriate autofill purposes for an author's name, email, and website URL in the comment form template.

Props juliemoynat, bhrugesh96, sabernhardt.
Fixes #55779.
Built from https://develop.svn.wordpress.org/trunk@53576


git-svn-id: http://core.svn.wordpress.org/trunk@53165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 21:26:12 +00:00
Sergey Biryukov
a29a0e05d1 Docs: Correct method reference format in some DocBlocks.
This ensures that the methods are recognized by the WordPress Code Reference parser.

Follow-up to [7994], [25567], [27156], [28887], [49672], [52226].

Props dd32, audrasjb.
Fixes #55928.
Built from https://develop.svn.wordpress.org/trunk@53469


git-svn-id: http://core.svn.wordpress.org/trunk@53058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 10:51:12 +00:00
Sergey Biryukov
39b11dd1f7 Code Modernization: Rename parameters that use reserved keywords in wp-includes/comment-template.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$class` parameter to `$css_class` in `comment_class()` and `get_comment_class()`.
* Renames the `$echo` parameter to `$display` in `comment_class()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53285


git-svn-id: http://core.svn.wordpress.org/trunk@52874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 15:08:16 +00:00
audrasjb
29cc1e94c0 Docs: Use third-person singular verbs for function descriptions in Core Comment API and Comment template functions.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 06:20:08 +00:00
davidbaumwald
66ed09edeb Comments: Guard against potential PHP notices in get_comment_author and get_comment_ID.
In both `get_comment_author` and `get_comment_ID`, it's possible that these functions are called without a comment context.  Specifically, `get_comment_author` can be called without passing the `$comment_ID` parameter, and `get_comment_ID` relies on the `comment` global if there's no `$comment` parameter supplied.  This leads to a PHP notice of "Trying to get property of a non-object."

This change adds a check to both functions to ensure the `$comment->comment_ID` property is not empty before actually using its value.

Follow-up to [52223].

Props dd32.
Fixes #54379.
Built from https://develop.svn.wordpress.org/trunk@52818


git-svn-id: http://core.svn.wordpress.org/trunk@52407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-03 20:33:59 +00:00
hellofromTonya
30c9e4338d Comments: Fix PHP Notice "trying to get property of non-object" in comments_open() and pings_open().
The post for the comments or pings is retrieved by `get_post()`. If the post exists, `get_post()` returns an instance of `WP_Post`; else, it returns `null`.

In both `comments_open()` and `pings_open()`, the returned value from `get_post()` is used without checking if the object returned, if the post exists. When the post does not exist, the following notices occur:

{{{
PHP Notice:  Trying to get property 'comment_status' of non-object in .../src/wp-includes/comment-template.php on line 1244
}}}

and

{{{
PHP Notice:  Trying to get property 'pings_open' of non-object in ../src/wp-includes/comment-template.php on line 1274
}}}

This commit fixes these notices by checking if the post has a non-falsey value before using it as an object to set the `$open` state. As the return from `get_post()` will only be an object or `null`, the truthy check is appropriate and slightly more performant.

Tests added to validate the fix.

Follow-up to [1964], [40666].

Props dd32, audrasjb, costdev, hellofromTonya, sergeybiryukov.
Fixes #54159.
Built from https://develop.svn.wordpress.org/trunk@52223


git-svn-id: http://core.svn.wordpress.org/trunk@51815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-19 20:24:00 +00:00
John Blackbourn
40626108d0 Docs: Corrections relating to types used in inline documentation for comment ID and site ID proprties.
Includes a correction for a typo introduced in [52204].

See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:57:01 +00:00
joedolson
387f4467a4 Comments: Change new comment required text class.
Change the new class on comment required text from `comment-required-message` to `required-field-message` for better future-compatibility, enabling better reuse.

Props sabernhardt.
Fixes #16206.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-17 18:38:02 +00:00
hellofromTonya
df540dbd95 Comments: Don't output "cancel comment reply link" if comments aren't threaded.
Though hidden via `style="display:none;"`, if the comments aren't threaded, this commit doesn't output the cancel comment reply link (skips over that logic). Change in `comment_form()`.

Adds tests.

Follow-up to [12810], [38959].

Props henrywright, jigneshnakrani, rachelbaker, desrosj, audrasjb, hellofromTonya.
Fixes #37267.
Built from https://develop.svn.wordpress.org/trunk@52175


git-svn-id: http://core.svn.wordpress.org/trunk@51767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-16 02:14:59 +00:00
Sergey Biryukov
17ae1d0c7f Comments: Use get_comment_author() to retrieve the comment author name in get_comment_reply_link().
This ensures that the `get_comment_author` filter is applied to the comment author name as expected.

Follow-up to [29822], [47506].

Props mjulian7, audrasjb, chaion07, hellofromTonya, SergeyBiryukov.
Fixes #53678.
Built from https://develop.svn.wordpress.org/trunk@52154


git-svn-id: http://core.svn.wordpress.org/trunk@51746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-14 18:01:04 +00:00
joedolson
56b07f0ea2 Comments: Mark comment text field as required.
Add required asterisk to the comment text field. Historically, the name and email fields are marked as required, but the comment text field is not, though it is actually a required field.

Props infected, solarissmoke, rianrietveld, afercia, sabernhardt, strider72, mai21, audrasjb.
Fixes #16206.
Built from https://develop.svn.wordpress.org/trunk@52029


git-svn-id: http://core.svn.wordpress.org/trunk@51621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-07 21:14:58 +00:00
John Blackbourn
ae9eae8f64 Docs: Document some more common names for dynamic hooks and standardise the phrasing used.
Fixes #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@51444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-21 18:21:00 +00:00
John Blackbourn
efaf4a8938 Docs: Add and correct examples of common names for various dynamic hooks.
See #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@50936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 21:42:59 +00:00
John Blackbourn
ea60cd8191 Docs: Descriptive improvements and corrections for various docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:12:58 +00:00
joedolson
82f31a97cb Coding Standards: Extraneous white space at end of line.
Fixes a minor coding standards issue.

Follow up to [51082].

See #51189.
Built from https://develop.svn.wordpress.org/trunk@51084


git-svn-id: http://core.svn.wordpress.org/trunk@50693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-07 23:15:58 +00:00
joedolson
50fd820621 Comments: Return valid comment reply link if comments are paginated.
Fix the link returned by `get_comment_reply_link()` so the link points to the correct page of comments when links are paginated. While this link is normally overridden by the comment-reply script, if that script is disabled, the link would point to a location that did not exist when comments were paginated.

props MrPauloEn, paaggeli, alexstine, engahmeds3ed.
Fixes #51189.
Built from https://develop.svn.wordpress.org/trunk@51081


git-svn-id: http://core.svn.wordpress.org/trunk@50690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-07 21:49:59 +00:00
John Blackbourn
b59c0f307b Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 17:16:11 +00:00
Sergey Biryukov
0a20850f57 Docs: Clarify the $format parameter description in comment_time().
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49735


git-svn-id: http://core.svn.wordpress.org/trunk@49458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-02 16:55:06 +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
Sergey Biryukov
e569358678 General: Ensure that filtered arguments in get_search_form() contain all required default values.
Props kellybleck, davidbaumwald, whyisjake, SergeyBiryukov.
Fixes #51645.
Built from https://develop.svn.wordpress.org/trunk@49355


git-svn-id: http://core.svn.wordpress.org/trunk@49115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-28 16:57:08 +00:00
Sergey Biryukov
fbd8078d4e Comments: Add a filter for top level comments query arguments in comments_template().
Props hellofromTonya, Howdy_McGee, garrett-eclipse, davidbaumwald, thomaslhotta.
Fixes #38074.
Built from https://develop.svn.wordpress.org/trunk@49256


git-svn-id: http://core.svn.wordpress.org/trunk@49018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 20:11:06 +00:00
Sergey Biryukov
0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27: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
0418dad234 Docs: Synchronize the description of the $format parameter in various date/time functions for posts and comments.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48929


git-svn-id: http://core.svn.wordpress.org/trunk@48691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-01 00:43:06 +00:00
Sergey Biryukov
d3abb209e1 Date/Time: In get_the_date() and related functions, pass the original, unmodified $format value to the filters.
Additionally, simplify the `$format` argument checks for consistency with similar checks in `get_the_modified_date()` and `get_the_modified_time()`.

Follow-up to [48912].

Props Rarst.
See #51184.
Built from https://develop.svn.wordpress.org/trunk@48918


git-svn-id: http://core.svn.wordpress.org/trunk@48680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 18:30:05 +00:00
Sergey Biryukov
aec28121b3 Date/Time: Make sure get_the_date() and related functions return correct time if the format was specified as false.
Technically, the `$format` argument should always be a string, but passing `false` used to work before [47808], so this restores backward compatibility.

The list of affected functions:
* `get_the_date()`
* `get_the_time()`
* `get_comment_date()`
* `get_comment_time()`

Props wittich, Rarst, akabarikalpesh, SergeyBiryukov.
Fixes #51184.
Built from https://develop.svn.wordpress.org/trunk@48912


git-svn-id: http://core.svn.wordpress.org/trunk@48674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 15:58:04 +00:00
John Blackbourn
782f05d2c5 Docs: Various fixes and improvements to inline documentation.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48695


git-svn-id: http://core.svn.wordpress.org/trunk@48457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-30 19:14:03 +00:00
Sergey Biryukov
7913a1c7db Docs: Improve documentation for wp_list_comments().
Note that passing `div` to the `style` parameter will result in no additional list markup.

Props liuhaibin, jeremyfelt, functionalrhyme.
Fixes #49181.
Built from https://develop.svn.wordpress.org/trunk@48597


git-svn-id: http://core.svn.wordpress.org/trunk@48359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-24 01:11:02 +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
12747ac7b7 Coding Standards: Use a consistent naming pattern for variables in wp-includes/comment-template.php.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@48579


git-svn-id: http://core.svn.wordpress.org/trunk@48341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 13:34:07 +00:00
Sergey Biryukov
d1b980492f Docs: Improve description for comment_id_fields().
Rename the `$id` parameter to `$post_id` for clarity.

Props stevenlinx.
Fixes #50737.
Built from https://develop.svn.wordpress.org/trunk@48577


git-svn-id: http://core.svn.wordpress.org/trunk@48339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 13:11:04 +00:00
John Blackbourn
4ff1233e75 Docs: Correct and improve inline docs for parameters that accept a callback function.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48473


git-svn-id: http://core.svn.wordpress.org/trunk@48242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-14 11:56:04 +00:00
Sergey Biryukov
af5c8f316c Docs: Improve description of the $text parameter in cancel_comment_reply_link().
Props stevenlinx.
Fixes #50642.
Built from https://develop.svn.wordpress.org/trunk@48457


git-svn-id: http://core.svn.wordpress.org/trunk@48226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-13 14:42:03 +00:00
Sergey Biryukov
ca1b6f324c Comments: Allow passing a custom class to the form container element in comment_form().
Props cjbj, yahil, mayankmajeji, andraganescu, SergeyBiryukov.
Fixes #41009.
Built from https://develop.svn.wordpress.org/trunk@48393


git-svn-id: http://core.svn.wordpress.org/trunk@48162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 18:29:04 +00:00
Sergey Biryukov
803a05946b Comments: Remove wp_get_include_unapproved_comments_argument() for now.
The function seems too specific and low-level for an abstraction, is only used in two places, and does not provide a significant benefit in terms of reducing code duplication.

Follow-up to [48133].

See #8973.
Built from https://develop.svn.wordpress.org/trunk@48140


git-svn-id: http://core.svn.wordpress.org/trunk@47909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 13:53:08 +00:00
whyisjake
0c91c23277 Comments: Ensure the proper comment count and pages for unapproved comments.
Previiously, unapproved comments can alter the comment count, returning incorrect page numbers.

Fixes #8973.

Props GregMulhauser, dd32, ryan, mrmist, hakre, solarissmoke, billerickson, ericlewis, SergeyBiryukov, chriscct7, dossy, lukecavanagh, renggo888, jdorner, matjack1, pento, audrasjb, imath, davidbaumwald, whyisjake.  


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


git-svn-id: http://core.svn.wordpress.org/trunk@47902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 05:24: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
whyisjake
c075eec24f Editor: Ensure latest comments can only be viewed from public posts.
Props: poena, xknown. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@47752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-10 19:20:11 +00:00
Sergey Biryukov
569c006248 Comments: Rename Walker_Comment::comment_text() to ::filter_comment_text() for clarity.
Ensure the comment object is not null before checking its status.

Follow-up to [47887].

See #49956.
Built from https://develop.svn.wordpress.org/trunk@47889


git-svn-id: http://core.svn.wordpress.org/trunk@47663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-02 21:45:10 +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
noisysocks
b4e1e8f0d1 Comments: Fix title not updating when replying to a comment
When replying to an existing comment, the comment form is moved to below the
existing comment with JS, but the form heading was not being updated. This
fixes the issue by introducing a new data-attribute to the reply link with the
correct heading string, and applying that string to the heading when the form
is moved.

Props isabel_brison, azaozz, peterwilsoncc.
Fixes #38009.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-25 04:55:10 +00:00
Sergey Biryukov
5308f570cb Comments: Restore the fourth parameter of comments_number() as $post_id, for consistency with get_comments_number_text().
The parameter was previously used as the number of comments, marked as deprecated in [5101].

Given that it's been deprecated for the last 13 years, it should be safe to undeprecate and repurpose it for a cleaner function signature, instead of adding a fifth parameter.

Follow-up to [47276].

Fixes #48772.
Built from https://develop.svn.wordpress.org/trunk@47366


git-svn-id: http://core.svn.wordpress.org/trunk@47153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 17:34:08 +00:00
Sergey Biryukov
6b2c63031c Coding Standards: Rename $d parameter in various date/time functions to $format for clarity.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47287


git-svn-id: http://core.svn.wordpress.org/trunk@47087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-14 00:07:07 +00:00