Commit Graph

496 Commits

Author SHA1 Message Date
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
desrosj
9635543e0f General: Properly escape home_url() links in wp_page_menu().
Props sabbirmc, tushar284, costdev.
Fixes 56148.
Built from https://develop.svn.wordpress.org/trunk@53656


git-svn-id: http://core.svn.wordpress.org/trunk@53215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 14:14:21 +00:00
Sergey Biryukov
f4d9778c98 Menus: Replace "drop down" (noun) with "dropdown" in a few strings.
This makes the spelling more consistent with other instances of the word in core.

Follow-up to [23844], [27676].

Props NekoJonez, mukesh27, SergeyBiryukov.
Fixes #55661.
Built from https://develop.svn.wordpress.org/trunk@53391


git-svn-id: http://core.svn.wordpress.org/trunk@52980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-11 13:22:15 +00:00
John Blackbourn
bdaba2407c Docs: Improve documentation of the walker argument for various functions.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-29 19:28:09 +00:00
audrasjb
1cd42e3cbe Docs: Misc. fixes in wp-includes/post-template.php and wp-includes/post-thumbnail-template.php.
Props azouamauriac, audrasjb.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-15 15:22:05 +00:00
Sergey Biryukov
a584be05eb Coding Standards: Rename $r variable to $args for clarity in walk_page_tree().
Follow-up to [9830], [32617], [45667], [52684].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@52685


git-svn-id: http://core.svn.wordpress.org/trunk@52274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-07 14:21:01 +00:00
John Blackbourn
c9746ab584 Docs: Various corrections and improvements relating to types used in inline documentation.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:50:05 +00:00
Sergey Biryukov
b2117d7299 Posts, Post Types: Pass the post object to the_password_form filter.
Props silb3r.
Fixes #29008.
Built from https://develop.svn.wordpress.org/trunk@50791


git-svn-id: http://core.svn.wordpress.org/trunk@50400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-26 15:38:05 +00:00
John Blackbourn
eac91ec9c5 Posts, Post Types: Rename the new post parent conditional tag functions for clarity.
* `get_parent_post()` becomes `get_post_parent()`
* `has_parent_post()` becomes `has_post_parent()`

Props johnjamesjacoby, SergeyBiryukov, lukecarbis, peterwilsoncc

Fixes #33045

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


git-svn-id: http://core.svn.wordpress.org/trunk@50007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-20 17:45:04 +00:00
John Blackbourn
3e12235a79 Posts, Post Types: Introduce new functions for determining if a post has a parent (has_post_parent()) and to fetch the post parent (get_post_parent()).
These functions are simple but reduce the logic needed in themes and plugins.

Props ramiy, sebastian.pisula, birgire, audrasjb, xkon

Fixes #33045

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


git-svn-id: http://core.svn.wordpress.org/trunk@49806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 21:22:02 +00:00
Sergey Biryukov
f5bd63d352 Docs: Link to the parent function for accepted arguments in some filters for HTML output.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49977


git-svn-id: http://core.svn.wordpress.org/trunk@49678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-18 12:28:07 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +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
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
John Blackbourn
aba2165aae Media: Standardise the description for image size parameters.
This brings continuity to all the image related functions and filters which accept or pass a size parameter.

Props dilipbheda, johnbillion

Fixes #47364

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


git-svn-id: http://core.svn.wordpress.org/trunk@48783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 16:23:07 +00:00
John Blackbourn
0b2e31a7f8 Docs: Inline documentation improvements for media related functions and hooks.
See #47364, #50768

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


git-svn-id: http://core.svn.wordpress.org/trunk@48782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 15:55:10 +00:00
Sergey Biryukov
d5b8d282e8 Docs: Update the URL for PHP date formats table in translator comments.
Props hareesh-pillai, iandunn.
Fixes #51332.
Built from https://develop.svn.wordpress.org/trunk@48991


git-svn-id: http://core.svn.wordpress.org/trunk@48753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:37:08 +00:00
John Blackbourn
0bf9b04c53 Docs: Various formatting improvements to inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48574


git-svn-id: http://core.svn.wordpress.org/trunk@48336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 00:52:05 +00:00
John Blackbourn
1fbcdb2213 Docs: Various corrections to inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48573


git-svn-id: http://core.svn.wordpress.org/trunk@48335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 00:48:06 +00:00
Sergey Biryukov
58ad216087 Docs: Improve documentation for optional parameters per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48197


git-svn-id: http://core.svn.wordpress.org/trunk@47966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 11:49:02 +00:00
Sergey Biryukov
e0d440f77f Posts, Post Types: Avoid a PHP warning when get_the_content() is called outside of the loop.
This ensures that `$pages` and other globals are only used after they have been set up in `setup_postdata()`.

Follow-up to [44941].

Props tessawatkinsllc, dontdream, spacedmonkey, squarecandy, davidbaumwald, SergeyBiryukov.
Fixes #47824. See #42814.
Built from https://develop.svn.wordpress.org/trunk@48114


git-svn-id: http://core.svn.wordpress.org/trunk@47883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-21 10:36:07 +00:00
whyisjake
ed1e6c3d87 Themes: Add additional later escaping to post_class() and body_class() functions.
Additionally, this adds a few tests to test output.

Fixes #20009.

Props mfields, scribu, azaozz, obenland, dd32, nacin, jrf, jdgrimes, garyj, whyisjake. 
 

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


git-svn-id: http://core.svn.wordpress.org/trunk@47827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 16:57:15 +00:00
Sergey Biryukov
b9751d4efe Coding Standards: Use strict comparison for count() calls.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47848


git-svn-id: http://core.svn.wordpress.org/trunk@47624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-23 11:38:08 +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
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
e2440d55e7 Docs: Clarify that is_page_template() accepts a template filename, not the Template Name file header.
Props mkaz.
Fixes #49362.
Built from https://develop.svn.wordpress.org/trunk@47182


git-svn-id: http://core.svn.wordpress.org/trunk@46982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 03:14:06 +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
2900bb8ea7 Docs: Update links to https://secure.php.net/, they now redirect to https://www.php.net/.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47088


git-svn-id: http://core.svn.wordpress.org/trunk@46888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-20 03:14: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
John Blackbourn
057f661ce3 Docs: Miscellaneous docblock corrections.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-28 19:48:01 +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
8d1e51e9c7 Docs: Add a @since note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46451


git-svn-id: http://core.svn.wordpress.org/trunk@46249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-09 04:28:02 +00:00
Sergey Biryukov
4bcec84309 Code Modernisation: Replace call_user_func_array() in wp-includes/post-template.php with a dynamic function call.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46135


git-svn-id: http://core.svn.wordpress.org/trunk@45947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 11:32:54 +00:00
Sergey Biryukov
e26f739e53 Posts, Post Types: Revert [46079] pending test failure investigation.
See #47824.
Built from https://develop.svn.wordpress.org/trunk@46080


git-svn-id: http://core.svn.wordpress.org/trunk@45892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 19:33:55 +00:00
Sergey Biryukov
7828fe7e6a Posts, Post Types: Avoid a PHP warning when the_content() is called outside of the loop.
Fixes #47824.
Built from https://develop.svn.wordpress.org/trunk@46079


git-svn-id: http://core.svn.wordpress.org/trunk@45891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 14:33:56 +00:00
whyisjake
50d33282c1 Remove _convert_urlencoded_to_entities() from the get_the_content() callback.
Props vortfu, whyisjake, peterwilsoncc

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


git-svn-id: http://core.svn.wordpress.org/trunk@45746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-04 16:04: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
16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov
61d5337aca Date/Time: Remove the last remaining current_time( 'timestamp' ) instance in wp_post_revision_title_expanded().
Timestamps don't carry any timezone information, using `$revision->post_modified_gmt` simplifies the logic.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 21:55:56 +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
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
1af80c2106 Code Modernisation: Introduce the spread operator in walk_page_dropdown_tree().
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf.
See #47678.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-12 00:06: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
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
Sergey Biryukov
8c449d3312 Posts, Post Types: Switch the order of arguments for implode() in the_meta() to match the function notation.
Props loyaltymanufaktur.
Fixes #47481.
Built from https://develop.svn.wordpress.org/trunk@45491


git-svn-id: http://core.svn.wordpress.org/trunk@45302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-05 00:16:54 +00:00
Andrew Ozz
df438d90a0 Remove the core/more block delimiters when splitting post_content on the <!--more--> tag.
Fixes:
- Parsing of blocks in the second half of post_content.
- Outputting malformed HTML when `the_content( null, true )` or  `<!--noteaser-->` is used.

Props lukecarbis, garrett-eclipse, birgire.
Fixes #46471.
Built from https://develop.svn.wordpress.org/trunk@45261


git-svn-id: http://core.svn.wordpress.org/trunk@45070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-24 05:40:52 +00:00
Sergey Biryukov
3f3593aa6c Customize: Only add custom-background to body_class() if the current theme supports custom background.
Props wido, swissspidy, ocean90, Mte90.
Fixes #38168.
Built from https://develop.svn.wordpress.org/trunk@45088


git-svn-id: http://core.svn.wordpress.org/trunk@44897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-01 16:18:52 +00:00
Sergey Biryukov
7d74080b80 Privacy: Introduce Privacy Policy page helpers:
* `is_privacy_policy()` template tag
* `privacy-policy.php` template
* `.privacy-policy` body class
* `.menu-item-privacy-policy` menu item class

Props garrett-eclipse, birgire, xkon, Clorith.
Fixes #44005.
Built from https://develop.svn.wordpress.org/trunk@44966


git-svn-id: http://core.svn.wordpress.org/trunk@44797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 19:48:50 +00:00