Commit Graph

19 Commits

Author SHA1 Message Date
Sergey Biryukov
651f426b3a General: Remove noreferrer from wp_targeted_link_rel() and other uses.
When `noopener noreferrer` was originally added in #37941 and related tickets, the `noreferrer` bit was specifically included due to Firefox not supporting `noopener` at the time.

Since `noopener` has been supported by all major browsers for a while, it should now be safe to remove the `noreferrer` attribute from core.

Props Mista-Flo, audrasjb, joostdevalk, jonoaldersonwp, peterwilsoncc, elgameel.
Fixes #49558.
Built from https://develop.svn.wordpress.org/trunk@49215


git-svn-id: http://core.svn.wordpress.org/trunk@48977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 23:39:04 +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
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
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
8a2daa7648 Menus: Set better default for $args parameter in Walker_Nav_Menu methods, to match the documented parameter type.
Props trasweb.
Fixes #47524.
Built from https://develop.svn.wordpress.org/trunk@45537


git-svn-id: http://core.svn.wordpress.org/trunk@45348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-14 11:26:52 +00:00
Gary Pendergast
a932e9921b Menus: Add rel="noopener" to target="_blank" links by default in menus.
This expands upon `rel="noopener"` being previously added to links in the content.

Props audrasjb, welcher.
Fixes #43290.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-08 23:06:52 +00:00
John Blackbourn
bbcb4300a3 Docs: Correct and improve various inline documentation.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@42707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:35:29 +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
Andrea Fercia
320a05019a Accessibility: Themes: use aria-current for the Walker_Nav_Menu current link.
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 williampatton, chetan200891, sami.keijonen.
Fixes #43191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-08 21:31:30 +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
Sergey Biryukov
f80db51d0f Menus: Remove an extra space in the <ul> tag in Walker_Nav_Menu::start_lvl().
Fixes #42289.
Built from https://develop.svn.wordpress.org/trunk@41955


git-svn-id: http://core.svn.wordpress.org/trunk@41789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-20 10:40:46 +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
Peter Wilson
62de6cc7ec Menus: Prevent empty class attribute following [40537].
Prevents an empty class attribute, `class=""`, from appearing in the HTML if a developer removes all classes using the `nav_menu_submenu_css_class` filter.

Props Kopepasah.
Fixes #36163.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-14 03:38:48 +00:00
Peter Wilson
717de16c68 Menus: Add filter to sub-menu class in nav menus.
Add new filter `nav_menu_submenu_css_class` to the `Walker_Nav_Menu::start_el()` method, allowing themers to modify the sub menu classes output by `wp_nav_menu()`.

Props: csloisel, darthaud, raisonon.
Fixes: #36163.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-23 07:16:43 +00:00
Peter Wilson
06c51c0042 Menus: Fix notices thrown by classes extending Walker_Nav_Menu.
Methods in `Walker_Nav_Menu` can be called with multiple, incompatible `$args` objects so an `insset()` check is required to avoid throwing notices.

Introduced in [38523].

Fixes #35206.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 07:06:30 +00:00
John Blackbourn
8bec516c18 Menus: Correct the docblocks for Walker_Nav_Menu, wp_nav_menu(), and walk_nav_menu_tree().
This corrects the parameter type for the `$args` and `$item` parameters passed throughout these functions, class methods, and hooks.

See #24587
See #35206
See #37770

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


git-svn-id: http://core.svn.wordpress.org/trunk@38502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-07 16:15:30 +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
5415629ad2 Nav Menus: Move the Walker_Nav_Menu class to its own file.
The new class-walker-nav-menu.php file is loaded in nav-menu-template.php for backward compatibility purposes.

Fixes #37035. See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 15:18:31 +00:00