Commit Graph

203 Commits

Author SHA1 Message Date
Sergey Biryukov
a42b89fc71 REST API: Some documentation and test improvements for update_menu_item_cache():
* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.

Follow-up to [53504].

See #55620.
Built from https://develop.svn.wordpress.org/trunk@53508


git-svn-id: http://core.svn.wordpress.org/trunk@53097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 13:37:10 +00:00
spacedmonkey
991acc48d4 REST API: Prime caches for linked objects in menu item REST API controller.
Add a new parameter to `WP_Query` called `update_menu_item_cache` that when set to true, primes the caches for linked terms and posts for menu item post objects. This change moves logic 
found in `wp_get_nav_menu_items` into a new function called `update_menu_item_cache`.  Update the menu item REST API controller, to pass the `update_menu_item_cache` parameter to the 
arguments used for the  `WP_Query` run to get menu items. 

Props furi3r,  TimothyBlynJacobs, spacedmonkey, peterwilsoncc, mitogh.
Fixes #55620.

 --This line, and those below, will be ignored--

M    src/wp-includes/class-wp-query.php
M    src/wp-includes/nav-menu.php
M    src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
M    tests/phpunit/tests/post/nav-menu.php

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


git-svn-id: http://core.svn.wordpress.org/trunk@53093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:20:13 +00:00
Sergey Biryukov
01d172b581 General: Replace all esc_url_raw() calls in core with sanitize_url().
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

Follow-up to [11383], [13096], [51597], [53452].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes #55852.
Built from https://develop.svn.wordpress.org/trunk@53455


git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 18:14:10 +00:00
audrasjb
2c0a330fba Docs: Use third-person singular verbs for function descriptions in wp-includes/nav-menu.php, as per docs standards.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-25 09:32:09 +00:00
spacedmonkey
c220f23155 Menus: Convert wp_get_nav_menu_items function to use a taxonomy query.
Change the `wp_get_nav_menu_items` function to replace the call to `get_objects_in_term` with a simple taxonomy query. This change improves performance as it results in one fewer query to retrieve menu items from the 
database. 

Props Spacedmonkey, peterwilsoncc.
Fixes #55372.




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


git-svn-id: http://core.svn.wordpress.org/trunk@52599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-29 11:07:11 +00:00
spacedmonkey
7613aaf9b1 Menus: Improve cache priming in the wp_get_nav_menu_items function.
In `wp_get_nav_menu_items` multiple function calls to `get_terms` and `get_posts` were being used to load post/term objects into 
memory. This change replaces calls to `get_terms` and `get_posts` with calls to `_prime_post_caches` and 
`_prime_term_caches`. These functions are designed to prime object caches and do not have the overhead of a query object. This 
change also replaces multiple queries with a single query, saving many SQL queries per page load. 

Props Spacedmonkey, peterwilsoncc. 
Fixes #55428.
 --This line, and those below, 
will be ignored--

M    src/wp-includes/nav-menu.php

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


git-svn-id: http://core.svn.wordpress.org/trunk@52564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 09:58:07 +00:00
John Blackbourn
39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
Peter Wilson
43290b2e04 REST API: Fire wp_after_insert_post later in new post object endpoints.
In the new menu items, global items and template controllers manually call the function `wp_after_insert_post()` to manually fire the action of the same name after all potential data is updated.

This accounts for the use case in which a theme or plugin developer has modified the endpoints use of either taxonomy or meta data.

The new parameter `$fire_after_hooks` is added to `wp_update_nav_menu_item()` to control whether the `wp_after_insert_post` action is fired when it in turn calls `wp_insert_post()`.

Props spacedmonkey, peterwilsoncc, zieladam.
Fixes #54536.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 01:10:08 +00:00
spacedmonkey
b9ee5a4b29 REST API: Remove experimental block menu item types.
The menu items REST API controller was added in [52079]. This included functionality to add a "block" menu item type. This functionality is experimental and not currently used in WordPress core, so should be removed. 

Props noisysocks.
See #40878.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-16 17:09:00 +00:00
TimothyBlynJacobs
e2d4385a4f REST API: Introduce Menu management endpoints.
This commit introduces the `/wp/v2/menus`, `/wp/v2/menu-items` and `/wp/v2/menu-locations` REST API endpoints. These endpoints are fully available to users with the `edit_theme_options` capability, but can be read by any user who can edit a REST API available post type.

The `nav_menu` taxonomy and `nav_menu_item` post type now map their capabilities to the `edit_theme_options` primitive capability. This allows developers to provide more fine-grained access control. However, if a developer is currently dynamically removing the `edit_theme_options` capability using `map_meta_cap`, they should use the `user_has_cap` filter instead.

The `wp_update_nav_menu_item()` function has been adjusted to return an error if saving the menu item post or assigning the menu item to a menu generate an error.

Lastly, a new menu item type is introduced, `block`, that can be used to store a Block as a menu item.

Props andraganescu, antonvlasenko, dingo_d, dlh, isabel_brison, kadamwhite, Mamaduka, NateWr, noisysocks, peterwilsoncc, ryelle, schlessera, soean, Spacedmonkey, talldanwp, TimothyBlynJacobs, tobifjellner, westonruter, wpscholar, zieladam.
Fixes #40878.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 19:00:01 +00:00
John Blackbourn
e4cfebe92e Docs: Undo the accidental revert of [51299] made in [51300].
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:29:56 +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
John Blackbourn
9146628ae1 Docs: Miscellaneous formatting corrections for docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:10:56 +00:00
John Blackbourn
bdaca9bffc Docs: Miscellaneous docblock updates.
See #52628

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


git-svn-id: http://core.svn.wordpress.org/trunk@50437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-07 20:16:00 +00:00
Sergey Biryukov
5e10227d76 Coding Standards: Use strict comparison for return type checks in a few functions:
* `get_bookmark()`
* `get_comment()`
* `get_post()`
* `get_children()`
* `wp_get_recent_posts()`
* `wp_get_post_revision()`
* `wp_get_nav_menu_items()`

Follow-up to [45710] for `get_term()`, [48507] for `wpdb::get_row()` and `wpdb::get_results()`.

See #52627.
Built from https://develop.svn.wordpress.org/trunk@50558


git-svn-id: http://core.svn.wordpress.org/trunk@50171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-21 12:41:04 +00:00
Gary Pendergast
2660382579 Menus: Make use of wp_resolve_post_date() when updating menu items.
This allows a menu item `post_date` to be set to particular value, rather than only allowing it to be set to "now". In particular, the WordPress Importer can use this to perform faster, more accurate duplicate checks.

Props jmdodd.
Fixes #52189.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-25 01:23:58 +00:00
Sergey Biryukov
5c663524c2 Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696], [47060], [49926], [49927], [49929].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49963


git-svn-id: http://core.svn.wordpress.org/trunk@49664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-15 20:08:07 +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
b29ea455e8 Menus: Make the $object_id parameter of _wp_delete_post_menu_item() required, for consistency with _wp_delete_tax_menu_item().
The function is private (only intended for core usage) and is hooked to the `delete_post` action, which always passes a non-zero post ID.

Follow-up to [14295], [48794].

See #50343.
Built from https://develop.svn.wordpress.org/trunk@48795


git-svn-id: http://core.svn.wordpress.org/trunk@48557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-15 13:45:06 +00:00
Sergey Biryukov
d3a3862248 Code Modernization: Fix PHP 8 deprecation notices for optional function parameters declared before required parameters.
As it already was not possible to pass the required parameters without also passing the optional one anyway, removing the default value for the (not so) optional parameters should not affect backward compatibility.

This change affects three functions in core:

* `get_comment_delimited_block_content()`
* `do_enclose()`
* `_wp_delete_tax_menu_item()`

Props jrf, ayeshrajans, desrosj.
Fixes #50343.
Built from https://develop.svn.wordpress.org/trunk@48794


git-svn-id: http://core.svn.wordpress.org/trunk@48556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-15 13:40:03 +00:00
Sergey Biryukov
756de63216 Docs: Document the parameters of wp_get_associated_nav_menu_items() as optional.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48793


git-svn-id: http://core.svn.wordpress.org/trunk@48555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-15 13:12:06 +00:00
Sergey Biryukov
d8c62b5647 Posts, Post Types: Move get_post_states() back to the admin for now, require the file in WP_Customize_Nav_Menus::customize_register() instead.
This provides a minor performance improvement by only running the function in contexts where it's needed.

Follow-up to [47211], [47213], [47763], [48619].

See #46829, #49374.
Built from https://develop.svn.wordpress.org/trunk@48620


git-svn-id: http://core.svn.wordpress.org/trunk@48382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 10:51:06 +00:00
Sergey Biryukov
aab535a576 Posts, Post Types: Make get_post_states() available on frontend.
This allows special pages to be denoted as such when editing a menu in the Customizer.

This applies to the Front Page, Posts Page, and Privacy Policy Page.

Follow-up to [47211], [47213], [47763].

Props dlh, whyisjake, SergeyBiryukov.
Fixes #46829. See #49374.
Built from https://develop.svn.wordpress.org/trunk@48619


git-svn-id: http://core.svn.wordpress.org/trunk@48381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 01:14:06 +00:00
Sergey Biryukov
b640c0692e Menus: Simplify the test for wp_update_nav_menu_item() with special characters in category name.
The `menu-item-title` value is saved as a `post_title` property, so the resulting property can be checked directly, without a callback.

Follow-up to [48416].

See #48011.
Built from https://develop.svn.wordpress.org/trunk@48439


git-svn-id: http://core.svn.wordpress.org/trunk@48208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-11 21:48:04 +00:00
whyisjake
2c3672d2d1 Menus: Ensure that category menus with special characters can be updated.
Slashes and HTML encoding could cause some menus not to be updated.

Fixes #48011.

Props zaheerahmad, achyuthajoy, desrosj, pento, SergeyBiryukov, donmhico, audrasjb, birgire, mikeschroder.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-10 06:00:08 +00:00
Sergey Biryukov
b16368c268 Docs: Remove @staticvar tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
John Blackbourn
1a77bb81d8 Docs: Remove unnecessary variables names from @return tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
Sergey Biryukov
de59ad23a4 Docs: Consistently include an empty line between @since tag and @see, @link, or @global, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +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
25333cc670 Menus: When adding a label for special pages in wp_setup_nav_menu_item() strip all HTML tags, as the label is escaped on output.
Follow-up to [47211], [47213].

Props stiofansisland.
Fixes #49374.
Built from https://develop.svn.wordpress.org/trunk@47458


git-svn-id: http://core.svn.wordpress.org/trunk@47245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-16 01:32:05 +00:00
Sergey Biryukov
7748f7082f Menus: When adding a label for special pages in wp_setup_nav_menu_item(), check if get_post_states() is available, to avoid fatal errors on front end.
Fixes #49374.
Built from https://develop.svn.wordpress.org/trunk@47213


git-svn-id: http://core.svn.wordpress.org/trunk@47013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-08 12:49:07 +00:00
Sergey Biryukov
b70056dd70 Menus: Use get_post_states() to denote special pages on the added menu item accordions.
Front Page, Posts Page, or Privacy Policy Page should now be marked as such on the added menu items.

Props garrett-eclipse.
Fixes #49374.
Built from https://develop.svn.wordpress.org/trunk@47211


git-svn-id: http://core.svn.wordpress.org/trunk@47011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 23:46:05 +00:00
Sergey Biryukov
8e37999368 Docs: Correct DocBlock formatting for register_setting().
Document the full list of whitelisted option key names.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47157


git-svn-id: http://core.svn.wordpress.org/trunk@46957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 22:01:07 +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
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
f93ee2ca76 Docs: Increase the specificity of various docblock parameter types and return types.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46823


git-svn-id: http://core.svn.wordpress.org/trunk@46623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:43: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
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
desrosj
8a2bbf777a Correct the version number specified in [46102].
See #45361.
Built from https://develop.svn.wordpress.org/trunk@46104


git-svn-id: http://core.svn.wordpress.org/trunk@45916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-13 18:55:56 +00:00
desrosj
7bbce99655 Menus: Nav menu locations should not be integers.
When nav menu location slugs are integers, some hard to debug results can occur. `register_nav_menus()` utilizes `array_merge()` which renumbers numeric indexes, starting from 0. Because of this, numeric menu locations will almost always be changed.

This change introduces a `_doing_it_wrong()` notice to inform developers that nav menu locations should always be strings.

Props audrasjb, desrosj, welcher.
Fixes #45361.
Built from https://develop.svn.wordpress.org/trunk@46102


git-svn-id: http://core.svn.wordpress.org/trunk@45914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-13 17:58: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
Sergey Biryukov
b1847ef3e2 Menus: In wp_setup_nav_menu_item() and Walker_Nav_Menu_Edit::start_el(), check if the post or term associated with the menu item still exists to avoid a PHP notice.
If the associated post or term no longer exists, mark the menu item as invalid.

Props mehulkaklotar, kamrankhorsandi, cristiano.zanca, SergeyBiryukov.
Fixes #31703.
Built from https://develop.svn.wordpress.org/trunk@45891


git-svn-id: http://core.svn.wordpress.org/trunk@45702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-25 21:32:59 +00:00
Sergey Biryukov
c26f1c5d90 Taxonomy: Fix deprecated calls to get_terms().
The taxonomy should be passed as part of `$args`, rather than as its own argument.

Props sgastard, mukesh27, SergeyBiryukov.
Fixes #47819.
Built from https://develop.svn.wordpress.org/trunk@45723


git-svn-id: http://core.svn.wordpress.org/trunk@45534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-03 03:35:56 +00:00
Sergey Biryukov
4b460d0f80 Coding Standards: Fix WPCS issues in [45655].
See #47723.
Built from https://develop.svn.wordpress.org/trunk@45656


git-svn-id: http://core.svn.wordpress.org/trunk@45467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-17 19:22:56 +00:00
Sergey Biryukov
f7c4398ea9 Menus: Trim whitespace from custom link URLs.
Props majemedia, SergeyBiryukov.
Fixes #47723.
Built from https://develop.svn.wordpress.org/trunk@45655


git-svn-id: http://core.svn.wordpress.org/trunk@45466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-17 18:45:58 +00:00
desrosj
7cb9a98a5b Nav Menus: Fix a PHP 7.3 error when switching themes.
When switching themes, `wp_map_nav_menu_locations()` is used to ensure nav menus are placed in the relevant menu location. Occasionally, menus are registered to locations with numeric slugs, rather than strings. `wp_map_nav_menu_locations()` assumed it would be the latter, and ran `stripos()` on those numeric slugs. This behavior is deprecated in PHP 7.3.

As this is the last PHP 7.3 error in unit tests, this commit also removes PHP 7.3 from Travis' `allowed_failures` list.

Props pento, desrosj, jorbin.

Merges [43899] to trunk.

See #45018.
Built from https://develop.svn.wordpress.org/trunk@44167


git-svn-id: http://core.svn.wordpress.org/trunk@43997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 05:16:52 +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
8393519ade Menus: Remove $_menu_item_sort_prop global reference from wp_get_nav_menu_items(), unused since [38928].
Props PieWP, welcher.
Fixes #40947.
Built from https://develop.svn.wordpress.org/trunk@42634


git-svn-id: http://core.svn.wordpress.org/trunk@42463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-01 15:42:31 +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