Commit Graph

25 Commits

Author SHA1 Message Date
Sergey Biryukov 856e1a27b8 Coding Standards: Use strict type check for `in_array()` and `array_search()`.
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47557


git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-09 15:43:10 +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 8252125175 Menus: In `Walker_Nav_Menu`, `Walker_Category`, and `Walker_Page`, properly output link attributes having a legitimate "empty" value, for example an HTML data attribute with a value of zero (0).
Props nevma, AkSDvP, greenshady, SergeyBiryukov.
Fixes #47720.
Built from https://develop.svn.wordpress.org/trunk@46413


git-svn-id: http://core.svn.wordpress.org/trunk@46211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-06 15:06:03 +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 26a90ce462 Menus: Use `esc_url()` for the `href` value of page link attributes in `Walker_Page::start_el()`, for consistency with `Walker_Nav_Menu` and `Walker_Category`.
See #40666, #40359.
Built from https://develop.svn.wordpress.org/trunk@44958


git-svn-id: http://core.svn.wordpress.org/trunk@44789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 10:45:51 +00:00
Sergey Biryukov efc9cbd553 Accessibility: Themes: use `aria-current` for the `Walker_Page` current link.
See [42808] for `Walker_Nav_Menu`.

The `aria-current` attribute is a simple, effective way to help assistive
technologies users orientate themselves within a list of items. Continues the 
introduction in core of `aria-current` after [42440], [41683], [41359], and [41371].

Props chetan200891, wpzinc.
Fixes #43522.
Built from https://develop.svn.wordpress.org/trunk@44416


git-svn-id: http://core.svn.wordpress.org/trunk@44246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-07 13:36:50 +00:00
Sergey Biryukov 49452cd73d Pages, Post Types: Escape CSS classes in `Walker_Page::start_el()` after the `page_css_class` filter runs.
Don't add an empty `class` attribute if there are no classes, for consistency with `Walker_Nav_Menu::start_el()`.

Props abhijitrakas, mukesh27.
Fixes #44880.
Built from https://develop.svn.wordpress.org/trunk@44415


git-svn-id: http://core.svn.wordpress.org/trunk@44245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-07 12:55:38 +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
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
John Blackbourn 4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +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 4995062686 Menus: Introduce `page_menu_link_attributes` filter in `Walker_Page::start_el()` for the HTML attributes applied to a page menu item's anchor element.
This complements the `nav_menu_link_attributes` filter used in `Walker_Nav_Menu::start_el()`.

Props pbiron.
Fixes #40359.
Built from https://develop.svn.wordpress.org/trunk@40565


git-svn-id: http://core.svn.wordpress.org/trunk@40434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-01 23:32:42 +00:00
Peter Wilson 1a18262fd5 Menus: Prevent notice thrown in class-walker-page.php.
Calling `Walker_Page::walk()` directly was causing an `Undefined index: item_spacing` notice to be thrown, this adds an `isset()` check to prevent it.

Props bhargavbhandari90.
Fixes #39564.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-24 23:29:42 +00:00
Drew Jaynes 5f4497f0af Docs: Fix multiple trivial typos throughout a variety of core files.
Props ottok.
Fixes #38489.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 06:28:32 +00:00
Peter Wilson 4131900722 Menus: Add white space option to `wp_nav_menu()` and `wp_list_pages()`.
Adds an `item_spacing` option to the arguments array for the functions `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()`. `item_spacing` is a boolean accepting either `preserve` or `discard`.

Previously, certain CSS choices could result in a site's layout changing if `wp_nav_menu()` fell back to the default `wp_list_pages()` due to differences in the whitespace within the HTML. The new argument ensures a function outputs consistant HTML while maintaining backward compatibility.

Fixes #35206.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-06 09:06:31 +00:00
Drew Jaynes 9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Drew Jaynes c5053ef0be Docs: Mark optional method parameters as such in `Walker_Page`.
Also normalizes parameter spacing following [37056].

Fixes #36300.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-22 18:07:27 +00:00
Drew Jaynes a336735c13 Docs: The page object type in use in `Walker_Page` is `WP_Post`.
See #36300.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-22 18:05:26 +00:00
Drew Jaynes 773cb00210 Docs: Improve inline documentation for properties and methods in `Walker_Page`.
Props raimy.
See #36300.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-22 18:04:26 +00:00
Dominik Schilling 0929025aea Docs: Move the hook doc for the `the_title` filter in `Walker_Page::start_el()` to directly precede the `apply_filters()` line.
See #32246.
Built from https://develop.svn.wordpress.org/trunk@36175


git-svn-id: http://core.svn.wordpress.org/trunk@36142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-05 16:35:26 +00:00
John Blackbourn 1402c3d8b4 Docs: Miscellaneous docblock corrections.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 06:31:27 +00:00
Drew Jaynes f32fba3dab Docs: Add more complete property and method documentation for `Walker_Page`.
* Adds missing DocBlock summaries
* Adds missing `@param` descriptions
* Marks some optional parameters as such
* Reorders some DocBlock tags

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 18:06:31 +00:00
Drew Jaynes 32358bbcdd Docs: Actually, the subpackage for `Walker_Page` should be Template.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 15:09:24 +00:00
Drew Jaynes 160ae95982 Docs: Clarify the file header summary for wp-includes/class-walker-page.php, introduced in [34109].
Also clarifies the class DocBlock summary for `Walker_Page`.

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:54:24 +00:00
Scott Taylor 4cec121d0b Move `Walker_Page` and `Walker_PageDropdown` into their own files via `svn cp`. Remove them from `post-template.php`. Load them in `post.php`.
`post-template.php` loads after `post.php` in `wp-settings.php`. It could probably also be loaded in `post.php`, but avoiding that for the moment.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 02:59:24 +00:00