Commit Graph

519 Commits

Author SHA1 Message Date
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
Sergey Biryukov
17e563cd9c Comments: Add a $post_id parameter to get_comments_number_text() and comments_number().
This allow for using these functions outside of the loop.

Props donmhico, garrett-eclipse, Hinjiriyo, imath.
Fixes #48772.
Built from https://develop.svn.wordpress.org/trunk@47276


git-svn-id: http://core.svn.wordpress.org/trunk@47076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-11 20:41:05 +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
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
1c3b5c9dc8 Comments: Add In reply to %s. prefix to child comments in comments feed.
The prefix includes a link to the parent comment and the name of its author.

Props zodiac1978, imath, SergeyBiryukov.
Fixes #43429.
Built from https://develop.svn.wordpress.org/trunk@47111


git-svn-id: http://core.svn.wordpress.org/trunk@46911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-26 22:29:06 +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
523bf256ef Docs: Synchronize "Default empty array" notes for $args parameter in get_comment_text() and comment_text().
Props denisco.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47032


git-svn-id: http://core.svn.wordpress.org/trunk@46832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-02 19:22:03 +00:00
Sergey Biryukov
8073fd3ec0 Docs: Use a third-person singular verb for comment template function descriptions, per the documentation standards.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47009


git-svn-id: http://core.svn.wordpress.org/trunk@46809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-24 16:19:01 +00:00
Sergey Biryukov
9c68816a21 Docs: Improve documentation for get_comment_author_url().
Props stevenlinx.
Fixes #49076.
Built from https://develop.svn.wordpress.org/trunk@47008


git-svn-id: http://core.svn.wordpress.org/trunk@46808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-24 16:10:05 +00:00
Sergey Biryukov
c87fccd74f Comments: Avoid a PHP notice in comment_form() if the email field is not set.
Follow-up to [46090].

Props mat-lipe.
Fixes #48943.
Built from https://develop.svn.wordpress.org/trunk@46885


git-svn-id: http://core.svn.wordpress.org/trunk@46685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-11 22:14:02 +00:00
John Blackbourn
aa1fdcbd52 Docs: Correct various docblocks documentation.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46821


git-svn-id: http://core.svn.wordpress.org/trunk@46621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:23: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
be91e3e1b9 Docs: Correct some more invalid inline docs.
See https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#summary-formerly-short-description

See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-31 21:20:02 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +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
2afdc64723 Comments: Add rel="nofollow ugc" attribute to links in comments.
UGC stands for User Generated Content, and the `ugc` attribute value is recommended for links within user generated content, such as comments and forum posts.

See https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html.

Props audrasjb, joostdevalk, dkarfa, SergeyBiryukov.
Fixes #48022.
Built from https://develop.svn.wordpress.org/trunk@46349


git-svn-id: http://core.svn.wordpress.org/trunk@46148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 01:30:58 +00:00
whyisjake
d4c6ebeb89 Comments: Avoid PHP notice in get_comment_reply_link() for null comment.
If there is no global comment, or the input comment is null, return early to prevent warnings.

Fixes #41846
Props birgire, earnjam


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


git-svn-id: http://core.svn.wordpress.org/trunk@46134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-27 14:46:57 +00:00
Sergey Biryukov
5289afac9b Accessibility: Comments: In comment_form(), remove aria-describedby attribute from the email field if there's no associated description in the comment_notes_before argument.
The attribute is meant to communicate to user agents and assistive technologies that the element has a description. If the referenced description is missing, it will be flagged as failure by any automated accessibility checker tool and, most importantly, is potentially confusing for assistive technologies users.

Props afercia, joedolson, dinhtungdu, donmhico, SergeyBiryukov.
Fixes #47975.
Built from https://develop.svn.wordpress.org/trunk@46090


git-svn-id: http://core.svn.wordpress.org/trunk@45902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-11 01:51:54 +00:00
Sergey Biryukov
dcb08f0637 Docs: Fix placement of some duplicate hook references.
Hook documentation should be on the line directly above the line containing the `do_action()` or `apply_filters()` call. 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 duplicate hook references.

Includes minor code layout fixes.

See #47110.
Built from https://develop.svn.wordpress.org/trunk@46088


git-svn-id: http://core.svn.wordpress.org/trunk@45900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-10 19:23:55 +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
Peter Wilson
dc2e7e716f Comments: Include post permalink in comment reply link.
Include the post's permalink when generating reply links in `get_comment_reply_link()` to account for comments displayed on index and archive pages.

This reapplies [32786] which was inadvertently reverted in [42360].

Props justinahinon, donmhico.
See #33383.
Fixes #47174.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-13 05:09:56 +00:00
Sergey Biryukov
9967a3e030 Docs: Add missing description for $post global.
Props immeet94.
Fixes #46503. See #47110.
Built from https://develop.svn.wordpress.org/trunk@45742


git-svn-id: http://core.svn.wordpress.org/trunk@45553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 12:28:56 +00:00
Sergey Biryukov
0cf1235477 Docs: Remove incorrect @return tags in comment_reply_link() and post_reply_link() DocBlocks.
Props atachibana.
Fixes #47826.
Built from https://develop.svn.wordpress.org/trunk@45741


git-svn-id: http://core.svn.wordpress.org/trunk@45552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 02:20:55 +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
Sergey Biryukov
29b072e706 Docs: Add missing description for $wpdb, $wp_db_version, and $wp_current_db_version globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +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
87675d288b Coding Standards: Fix all WordPress.WhiteSpace.PrecisionAlignment issues.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:21:56 +00:00
Gary Pendergast
a02b5cc2a8 Coding Standards: Mark the handful of hook names with uppercase characters or hyphens as ignored.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 01:45: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
Gary Pendergast
55af0f0d0a Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName violations.
See #47632


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


git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:01:57 +00:00
John Blackbourn
c9b51df3d0 I18N: Allow the length of automatically generated excerpts to be localized.
This introduces three new strings that can be used to control the maximum length of automatically generated excerpts for posts, comments, and draft post previews in the dashboard. Optionally combined with the existing word count type control this allows languages which include many multibyte characters to specify more appropriate maximum excerpt lengths.

Props miyauchi, birgire, johnbillion

Fixes #44541

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


git-svn-id: http://core.svn.wordpress.org/trunk@45316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-08 18:42:52 +00:00
Sergey Biryukov
056b9c47a2 Docs: Fix typo in comment_class() DocBlock.
Props mbabker.
Fixes #47499.
Built from https://develop.svn.wordpress.org/trunk@45496


git-svn-id: http://core.svn.wordpress.org/trunk@45307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-06 23:52:51 +00:00
desrosj
03240dd3f4 Docs: Correct various spelling mistakes.
Props man4toman.
Fixes #46339.
Built from https://develop.svn.wordpress.org/trunk@44894


git-svn-id: http://core.svn.wordpress.org/trunk@44725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-13 19:32:53 +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
Gary Pendergast
2bbe0bd7e4 Docs: Fix the @param types for `comments_popup_link().
Props Mirucon.
Fixes #44841.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 04:50:51 +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
a90f215d2c Privacy: Revert [43525].
The commenter cookies checkbox is not legally required, so should be disabled by default.

Fixes #44373.
Built from https://develop.svn.wordpress.org/trunk@43531


git-svn-id: http://core.svn.wordpress.org/trunk@43360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-24 17:06:24 +00:00
Sergey Biryukov
d68b2b5a2b Privacy: Remove the setting to enable comment cookies consent added in [43469].
This needs some more work to ensure expected behaviour.

See #44373.
Built from https://develop.svn.wordpress.org/trunk@43525


git-svn-id: http://core.svn.wordpress.org/trunk@43354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-24 12:51:29 +00:00
Sergey Biryukov
ad68a69250 Comments: Ensure that themes overriding default comment_form() fields still display the cookies consent checkbox.
The `comment_form_default_fields` filter can be used to remove the checkbox.

Props pross, SergeyBiryukov.
Fixes #44126.
Built from https://develop.svn.wordpress.org/trunk@43518


git-svn-id: http://core.svn.wordpress.org/trunk@43347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-20 00:38:24 +00:00
Andrew Ozz
3b3542fe15 Privacy: Add a setting to disable comment cookie consent.
Fixes #44373.
Built from https://develop.svn.wordpress.org/trunk@43469


git-svn-id: http://core.svn.wordpress.org/trunk@43296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-17 09:08:26 +00:00
Andrew Ozz
b363ace996 Privacy: do not show the comment cookies opt-in checkbox (on the front-end comments form) when comment cookies are disabled.
Props felipeelia, johnbillion.
Fixes #44342.
Built from https://develop.svn.wordpress.org/trunk@43370


git-svn-id: http://core.svn.wordpress.org/trunk@43198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:39:57 +00:00
Sergey Biryukov
a30e75437a Docs: Document the cookies default comment field added in [42772].
Props desrosj, chetan200891.
See #44125.
Built from https://develop.svn.wordpress.org/trunk@43304


git-svn-id: http://core.svn.wordpress.org/trunk@43133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-21 13:13:21 +00:00
iandunn
aa01cbe691 Comments: Move comment consent input outside the label for a11y.
Non-wrapping `label`s are more widely supported by assitive technologies. The CSS changes account for the element re-ordering, and tweak the formatting for improved readability.

Props afercia, xkon, laurelfulford, azaozz.
Fixes #43436.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-02 22:00:49 +00:00
iandunn
753d4f10cd Privacy: Use "website" in comment cookie consent text for clarity.
The term "URL" is technical jargon which will not be familiar to all commenters. "Website" is more universal, and matches the label on the `url` input field.

Props johnjamesjacoby, allendav, azaozz.
See #43436.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-02 21:31:21 +00:00
Sergey Biryukov
f8177e3a73 Docs: Remove backtick-escaping around a core function in the hook docs for the comment_form_submit_button filter.
This allows the function to be auto-linked in the Developer Reference. See [32037] for `comment_form_submit_field`.

See #42505, #31888.
Built from https://develop.svn.wordpress.org/trunk@43023


git-svn-id: http://core.svn.wordpress.org/trunk@42852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-29 21:44:22 +00:00
John Blackbourn
2361ca884f Docs: Document more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:33:31 +00:00
Dominik Schilling
5c291d49de Pinking shears.
See #41057.
Built from https://develop.svn.wordpress.org/trunk@42843


git-svn-id: http://core.svn.wordpress.org/trunk@42673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-18 14:23:33 +00:00
Sergey Biryukov
4848a09b35 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.
Built from https://develop.svn.wordpress.org/trunk@42827


git-svn-id: http://core.svn.wordpress.org/trunk@42657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 16:44:34 +00:00
Andrew Ozz
63dd79d908 Respect the commenter decision when they have checked the checkbox to consent to cookies, and keep it checked when they reload the page or post another comment.
See #43436.
Built from https://develop.svn.wordpress.org/trunk@42815


git-svn-id: http://core.svn.wordpress.org/trunk@42645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-09 15:57:30 +00:00
Andrew Ozz
8ae59374f3 Add a checkbox to the comment form so logged out users can opt-out of commenter cookies.
Props lakenh, xkon, birgire, azaozz.
See #43436.
Built from https://develop.svn.wordpress.org/trunk@42772


git-svn-id: http://core.svn.wordpress.org/trunk@42602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-04 16:41:33 +00:00
Sergey Biryukov
d3b2daf490 Comments: Remove unnecessary aria-required attribute from comment_form(), added with the function in [12810].
At the time, having both `required` and `aria-required` meant a wider range of support for browsers and assistive technology. Today, it's safe to use just `required`.

Props lakenh, afercia, davidakennedy, henry.wright.
Fixes #39045.
Built from https://develop.svn.wordpress.org/trunk@42758


git-svn-id: http://core.svn.wordpress.org/trunk@42588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-26 20:50:30 +00:00
Drew Jaynes
6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54:31 +00:00
Peter Wilson
f617a2d6d9 Comments: Modernise JavaScript for comment reply links.
Update the comment reply JavaScript to be unobtrusive and use events rather than inline `onclick` attributes. 

Along with bringing the code into the 2010s this prevents an edge-case in which `addComment.moveForm()` could be called before the JavaScript has loaded.

Props peterwilsoncc, bradparbs.
Fixes #31590.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-03 22:37:45 +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
Drew Jaynes
0eecbf8baf Docs: Clarify that get_comments_number() can return either a numeric string (for compatibility reasons) or 0 if the post doesn't exist.
Also update the hook doc for the `get_comments_number` filter to reflect the mixed type for `$count`.

Props kiranpotphode for the initial patch.
Fixes #38369.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-20 20:13:47 +00:00
John Blackbourn
375f495231 General: Add missing parameters to instances of the the_permalink filter.
This ensures every instance of this filter receives the same parameters.

Props keesiemeijer for identifying the issue

See #38462

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


git-svn-id: http://core.svn.wordpress.org/trunk@41057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 14:59:44 +00:00
John Blackbourn
06e6edbd61 Comments: Ensure the correct comment ID is passed to the get_comment_author_url filter.
Props dominik.schwind

Fixes #41334

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


git-svn-id: http://core.svn.wordpress.org/trunk@40967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-24 22:03:45 +00:00
Rachel Baker
9c2f5c18ce Comments: Correct the $post_id parameter passed to the 'comments_open' and 'pings_open' filters.
Fixes bug where previously the `$post_id` function argument was passed to the '_open' filters, instead of the result of the `get_post()` call. If the current post is not found, the `$post_id` filter parameter will be 0.

Props johnbillion, shulard, rachelbaker.
Fixes #40286.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-14 03:50:42 +00:00
Rachel Baker
868312d995 Comments: Update arguments passed to the 'comment_text' filter in check_comment().
Pass null or empty values for the missing $comment and $args parameters of the 'check_comment' filter in `check_comment()`.

Props boonebgorges, vaishu.agola27, SergeyBiryukov.
Fixes #38314. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@40527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-14 03:06:45 +00:00
Sergey Biryukov
14454e3b0b Docs: Use correct closing tag in submit_field description in comment_form().
Props truongwp.
Fixes #39508.
Built from https://develop.svn.wordpress.org/trunk@39753


git-svn-id: http://core.svn.wordpress.org/trunk@39691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-07 14:51:44 +00:00
John Blackbourn
c2d709e9d6 I18n: Introduce more translator comments for strings that contain placeholders but don't have an accompanying translator comment.
See #38882

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


git-svn-id: http://core.svn.wordpress.org/trunk@39266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 02:46:30 +00:00
Sergey Biryukov
919f08fd2d Comments: In comment_form(), bail early if comments for the post are closed.
Props jipmoors.
Fixes #38514.
Built from https://develop.svn.wordpress.org/trunk@38959


git-svn-id: http://core.svn.wordpress.org/trunk@38902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 14:48:29 +00:00
Boone Gorges
3dc7e8a97c Comments: Fix description for reverse_top_level argument in wp_list_comments().
It's a boolean, not a string. Introduced in [25567].

Props bcole808.
Fixes #38371.
Built from https://develop.svn.wordpress.org/trunk@38845


git-svn-id: http://core.svn.wordpress.org/trunk@38788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-20 18:59:29 +00:00
Boone Gorges
0d01992968 Set default value of 'max_depth' in get_comment_reply_link().
Introduced in [8878].

Props d4z_c0nf.
Fixes #38170.
Built from https://develop.svn.wordpress.org/trunk@38669


git-svn-id: http://core.svn.wordpress.org/trunk@38612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-28 04:20:55 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Drew Jaynes
dac2988528 Docs: Fix a typo in an inline hook reference in the DocBlock for comment_form().
Props ocean90.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 23:56:32 +00:00
Sergey Biryukov
d9b4f1e50b I18N: Introduce an on/off switch for locales where comment number needs to be declined.
When enabled, the switch would override the theme's pseudo-plural `'% Comments'` string with a correct form of `_n( '%s Comment', '%s Comments', $number )`.

Historically, `comments_popup_link()` and `get_comments_number_text()` did not support plural forms and used a pseudo-plural style instead, so some locales were forced to come up with workarounds to display the number of comments in their language correctly.

This change should make those functions more i18n-friendly.

Fixes #13651.
Built from https://develop.svn.wordpress.org/trunk@37987


git-svn-id: http://core.svn.wordpress.org/trunk@37928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 14:46:32 +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
Boone Gorges
838156a958 Comments: In wp_list_comments(), queries with custom pagination params should obey default comment_status logic.
When custom pagination parameters are passed to `wp_list_comments()`, a
secondary query must be performed to fetch the proper comments. See [36157].
This query should show comments of the same `comment_status` as the default
query initialized in `comments_template()`: show only comments that are
approved, or those that are unapproved but belong to the current user.

Props smerriman.
Fixes #37048.
Built from https://develop.svn.wordpress.org/trunk@37655


git-svn-id: http://core.svn.wordpress.org/trunk@37621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:01:27 +00:00
Drew Jaynes
da78aeffe9 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@37542


git-svn-id: http://core.svn.wordpress.org/trunk@37510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:59:27 +00:00
Drew Jaynes
34a8c37332 Docs: Standardize filter docs in wp-includes/comment-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@37497


git-svn-id: http://core.svn.wordpress.org/trunk@37465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:26:27 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Drew Jaynes
5f62db2f21 Comments: Realign parameter documentation in the DocBlocks for comment_author_email_link() and get_comment_author_email_link() following [37348].
Also adds a missing return description for `get_comment_author_email_link()`.

Props flixos90 for the initial patch.
Fixes #36571.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 20:04:28 +00:00
Drew Jaynes
a6c393828d Comments: Adjust comment_author_email_link() and get_comment_author_email_link() to each accept a new optional fourth parameter, $comment, which enables overriding the $comment global.
Adds tests.

Props flixos90, boonebgorges, DrewAPicture.
See #36571.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 19:59: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