Commit Graph

35183 Commits

Author SHA1 Message Date
Helen Hou-Sandi 683f7bc4d3 Customizer: Better hover/focus state for section titles and available widgets.
The 4px border pattern is found in a number of places across the admin, including plugins, notices, and Press This.

props celloexpressions, folletto, hugobaeta.
see #29158.



git-svn-id: https://develop.svn.wordpress.org/trunk@38602 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-14 16:14:20 +00:00
Joe Hoyle 433b4fbfba REST API: Enable sanitize_callback to return WP_Error.
Give developers the opportunity to reject incoming data without using the validation callback. It also enables us to do sanitization and validation in one function in instances where this could be useful.

Props websupporter, rmccue.
Fixes #37560.


git-svn-id: https://develop.svn.wordpress.org/trunk@38601 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-14 15:49:37 +00:00
Sergey Biryukov 6f37c963de XML-RPC: Check the minimum number of arguments in `::wp_getUsersBlogs()` and `::blogger_getUsersBlogs()`.
Props kitchin for initial patch.
Fixes #29750.

git-svn-id: https://develop.svn.wordpress.org/trunk@38600 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 23:16:15 +00:00
Konstantin Obenland ddeab090e5 Make wpList easier to contribute to.
Uses more semantic variable names and adds function and inline documentation.

Props rommelxcastro for parallel work in #34917.
Fixes #36264.


git-svn-id: https://develop.svn.wordpress.org/trunk@38599 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 22:23:30 +00:00
Sergey Biryukov 4a2540a50e Media: Adjust `test_video_shortcode_body()` after [38597].
See #38040.

git-svn-id: https://develop.svn.wordpress.org/trunk@38598 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 14:08:24 +00:00
Sergey Biryukov ca8f1c024a Media: Remove an extra space in `style` attribute in `wp_video_shortcode()` after [30082].
Props danielpietrasik.
Fixes #38040.

git-svn-id: https://develop.svn.wordpress.org/trunk@38597 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 13:44:33 +00:00
Sergey Biryukov 8533eae95a Docs: Synchronize docblocks for `WP_Site_Query::__construct()` and `get_sites()` after the changes in [37735], [38008], [38103], and [38336].
Props MaximeCulea.
Fixes #38039.

git-svn-id: https://develop.svn.wordpress.org/trunk@38596 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 13:19:57 +00:00
Sergey Biryukov 90a332c3f2 Docs: Correct description for `domain` and `path` arguments in `WP_Network_Query::__construct()`.
See #32504.

git-svn-id: https://develop.svn.wordpress.org/trunk@38595 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 13:09:52 +00:00
Gary Pendergast 2950eb8ea2 Formatting: Update `autop()` to match `wpautop()`.
[38592] changed the behaviour of `wpautop()` , so it's nice to change `autop()` to match.

Interestingly, this change isn't necessary for the functionality to work - #4857 didn't affect content that had been run through `autop()` at some point, as `autop()` would add a single line break before block elements, then `wpautop()` would later add a second line break, making it work correctly.

Props nacin for finding out about [38592] on Twitter, and DMing me to remind me to review `autop()`.
See #4857.



git-svn-id: https://develop.svn.wordpress.org/trunk@38594 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 06:02:23 +00:00
Gary Pendergast 52c566f5dc Docs: Fix an outdated comment.
[38592] changed the functionality of `wpautop()`, but didn't update the associated comment to match.

Fixes #4857.



git-svn-id: https://develop.svn.wordpress.org/trunk@38593 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-13 04:00:31 +00:00
Gary Pendergast 61a95da031 Formatting: Add an extra line break before block elements in `wpautop()`.
`wpautop()` considers double line breaks to be the separator between block level HTML elements. By adding two line breaks before a block element, this allows us to process the text before a block element correctly.

Fixes #4857.



git-svn-id: https://develop.svn.wordpress.org/trunk@38592 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-12 07:05:28 +00:00
Gary Pendergast 7511fe88cc Database: Normalise index names in `dbDelta()`.
When comparing index definitions, normalise the index names to lower case, as they are not case sensitive within MySQL.

Fixes #34874.



git-svn-id: https://develop.svn.wordpress.org/trunk@38591 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-12 05:08:17 +00:00
Gary Pendergast f54b5428c4 Database: Increase the size of `wp_posts.post_password` to 255 characters.
Longer passwords and passphrases are much more common than when post passwords were introduced all those eons ago, so let's increase the length of the `post_password` field from 20 to 255 characters.

The password will continue to be stored in plaintext, as the ability for the post author to view the password is a commonly used feature.

Trivia: this was the last 3 digit Trac ticket to be closed.

Props skippy, nazgul, iandunn, adamsilverstein, pento.
Fixes #881.



git-svn-id: https://develop.svn.wordpress.org/trunk@38590 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-12 02:27:55 +00:00
Gary Pendergast 0998de889d Bootstrap: Use `dirname()` when loading `class-wp-hook.php` from `plugin.php`.
To allow `plugin.php` to be loaded before the rest of WordPress is loaded, it cannot rely on WordPress constants, such as `ABSPATH` and `WPINC`.

Instead, we can assume that `class-wp-hook.php` will be in the same directory as `plugin.php`, so `dirname( __FILE__ )` will give us the correct path to load from.

Props pento, dd32.
Fixes #37707.



git-svn-id: https://develop.svn.wordpress.org/trunk@38589 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-12 01:49:46 +00:00
Weston Ruter d21f8b8869 Docs: Fix phpdoc and jsdoc typos introduced in [38584] and [38587], respectively.
See #33742.
See #20714.


git-svn-id: https://develop.svn.wordpress.org/trunk@38588 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-11 18:45:59 +00:00
Weston Ruter 44dbc815c8 Customize: Implement previewing of form submissions which use the GET method.
This finally allows the search results template to navigated to in the customizer preview.

Fixes #20714.


git-svn-id: https://develop.svn.wordpress.org/trunk@38587 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-11 05:04:39 +00:00
Boone Gorges 37e983416b Query: Eliminate unnecessary `wp_list_filter()` call in `get_queried_object()`.
The refactor in [30711] swapped out the old `queries` property for the
new `queried_terms`, but should also have gotten rid of the now-
superfluous `wp_list_filter()` call.

Fixes #37962.

git-svn-id: https://develop.svn.wordpress.org/trunk@38586 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-09 19:48:26 +00:00
Boone Gorges 6adcd15435 Query: Avoid PHP notice in `get_queried_object()` when query contains `NOT EXISTS` tax query.
Props johnjamesjacoby.
See #37962.

git-svn-id: https://develop.svn.wordpress.org/trunk@38585 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-09 19:36:22 +00:00
Weston Ruter 6c8c98fe5b Menus: Prevent non-published posts/pages from being returned in search results for adding as nav menu items.
Re-use the same query vars in searching as when listing posts. Aligns with behavior of nav menus in customizer.

Fixes #33742.
Props welcher, westonruter.


git-svn-id: https://develop.svn.wordpress.org/trunk@38584 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-09 04:59:01 +00:00
John Blackbourn e7b058117a Themes: Add the non-encoded form of the queried item slug to the template hierarchy when the slug contains non-ASCII characters.
This affects category, tag, and custom taxonomy archives, and single posts, pages, and custom post types.

Fixes #37655


git-svn-id: https://develop.svn.wordpress.org/trunk@38583 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-09 00:47:17 +00:00
Gary Pendergast 40ebbc7713 Tests: Use `add_filter()` when it's available.
The `tests_add_filter()` helper function directly manipulates the `$wp_filter` global, instead of using `add_filter()`. We can use `add_filter()` when it's available, and fall back to manipulating `$wp_filter` when it isn't, relying on the `$wp_filter` bootstrap code at the top of `plugin.php` to handle conversion.

Props boonebgorges, dd32 and pento: WordPress Thought Leadership Triumvirate.
Fixes #17817.



git-svn-id: https://develop.svn.wordpress.org/trunk@38582 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-09 00:33:52 +00:00
Gary Pendergast bafd8c92f2 Database: Fall back to `utf8` when `utf8mb4` isn't supported.
Sometimes, `DB_CHARSET` will be set to `utf8mb4`, even if the current setup doesn't support `utf8mb4`. After [38442], this can cause significant character set failures, causing the connection to fall back to `latin1`.

Instead of doing this, we now check that the connection supports `utf8mb4` before trying to use it, and fall back to `utf8` when we need to.

Fixes #37982 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38580 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 23:48:05 +00:00
John Blackbourn d651c9c90e Taxonomy: Revert accidental changes introduced in [38578].
See #18302


git-svn-id: https://develop.svn.wordpress.org/trunk@38579 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 22:57:22 +00:00
John Blackbourn 2aef21a55b Themes: Improve child theme file inheritance by introducing functions for locating and fetching the URL or path to files within child and parent themes.
The most useful function this introduces is `get_theme_file_uri()`, which returns the URL to the specified file in the child theme if it exists, and falls back to the URL to the specified file in the parent theme. This allows parent themes to reference files (including enqueuing CSS and JavaScript files) that can be overridden by the child theme simply by existing.

This change also introduces `get_theme_file_path()`, which is the file path equivalent of `get_theme_file_uri()`.

Finally, `get_parent_theme_file_uri()` and `get_parent_theme_file_path()` are also introduced, which allow a theme to specifically reference a file URL or file path in the parent theme. These can be used as replacements for `get_template_directory_uri()` and `get_template_directory()` respectively, for consistency.

Props johnbillion, georgestephanis, gma992.
Fixes #18302


git-svn-id: https://develop.svn.wordpress.org/trunk@38578 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 22:53:57 +00:00
Weston Ruter 8bae522ea8 Customize: Prevent widget previewing logic from building invalid jQuery selectors when sidebars are registered without a class name in `before_widget`.
Fixes #37993.


git-svn-id: https://develop.svn.wordpress.org/trunk@38577 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 15:44:08 +00:00
John Blackbourn b875264a73 Formatting: Don't send an HTTP status code in `wp_send_json()` by default. This avoids clobbering an HTTP status code that may have been set prior to calling this function.
Props westonruter
See #35666


git-svn-id: https://develop.svn.wordpress.org/trunk@38576 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 13:44:32 +00:00
Peter Wilson 7ed5f4f9d5 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@38575 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 07:05:32 +00:00
Peter Wilson 3cc19c17f3 Menus: Improve documentation of new `$item_spacing` argument.
Adds `@since` tags for and improves description of the new `$item_spacing` argument added to `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()` in [38523].

Props johnbillion for copy.
See #35206.


git-svn-id: https://develop.svn.wordpress.org/trunk@38574 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 05:30:32 +00:00
Drew Jaynes 45c799d84a Docs: Fix minor formatting for inline docs in `WP_Hook` following its introduction in [38571].
See #17817.


git-svn-id: https://develop.svn.wordpress.org/trunk@38573 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 04:16:39 +00:00
Aaron Jorbin 57530f4b73 Permalinks: Ensure Pending Review Posts permalink posts link to the draft
[34670] made the displayed permalink clickable. For posts that were pending review, the permalink wasn't being properly generated so the link wouldn't go to the preview.

Props knutsp, enshrined.
Fixes #37423.



git-svn-id: https://develop.svn.wordpress.org/trunk@38572 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 04:04:22 +00:00
Gary Pendergast 61abf68e6d Hooks: Add the new class `WP_Hook`, and modify hook handling to make use of it.
Filters and actions have been the basis of WordPress' plugin functionality since time immemorial, they've always been a reliable method for acting upon the current state of WordPress, and will continue to be so.

Over the years, however, edge cases have cropped up. Particularly when it comes to recursively executing hooks, or a hook adding and removing itself, the existing implementation struggled to keep up with more complex use cases.

And so, we introduce `WP_Hook`. By changing `$wp_filter` from an array of arrays, to an array of objects, we reduce the complexity of the hook handling code, as the processing code (see `::apply_filters()`) only needs to be aware of itself, rather than the state of all hooks. At the same time, we're able te handle more complex use cases, as the object can more easily keep track of its own state than an array ever could.

Props jbrinley for the original architecture and design of this patch.
Props SergeyBiryukov, cheeserolls, Denis-de-Bernardy, leewillis77, wonderboymusic, nacin, jorbin, DrewAPicture, ocean90, dougwollison, khag7, pento, noplanman and aaroncampbell for their testing, suggestions, contributions, patch maintenance, cajoling and patience as we got through this.
Fixes #17817.



git-svn-id: https://develop.svn.wordpress.org/trunk@38571 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 03:54:13 +00:00
John Blackbourn 84e8dcdf01 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


git-svn-id: https://develop.svn.wordpress.org/trunk@38559 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 16:14:49 +00:00
Jeremy Felt 8079863586 Media: Sanitize upload filename.
git-svn-id: https://develop.svn.wordpress.org/trunk@38538 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 13:54:57 +00:00
Andrea Fercia 2fc85993ca Widgets: Make the Delete/Remove links red.
For consistency and accessibility, all the UI controls that perform destructive
actions should be red.

Props monikarao, lukecavanagh, patilswapnilv, ibachal.
See #35622.
Fixes #37016.


git-svn-id: https://develop.svn.wordpress.org/trunk@38536 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 09:51:04 +00:00
Pascal Birchler 1a0effca18 Revert [38401] after [38480].
See #36335.

git-svn-id: https://develop.svn.wordpress.org/trunk@38535 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 18:12:09 +00:00
Pascal Birchler b87c245902 Upgrade/Install: Sanitize file name in `File_Upload_Upgrader`.
git-svn-id: https://develop.svn.wordpress.org/trunk@38524 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 17:25:22 +00:00
Peter Wilson 0c88ec217d 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@38523 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 09:05:45 +00:00
John Blackbourn 18654d2778 Role/Capability: Correct the multisite cap tests after [38521].
See #35614
See #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@38522 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-05 12:08:39 +00:00
John Blackbourn 7dd2e5d4dc Role/Capability: Split meta and primitive capabilities in the helper functions in the roles and capability tests so primitive capability tests can be made more accurate.
See #35614
See #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@38521 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-05 10:59:42 +00:00
Andrea Fercia 02355cbdb5 Accessibility: Improve the Customizer and Theme Installer initial focus.
The Customizer and Theme Installer open in full overlays that need to receive 
focus. Also, keyboard navigation should be constrained within the overlays. Using
CSS `visibility` to hide all the content except the overlays, makes them the only
available and focusable content and allows browsers to handle focus natively.

See #29158.
Fixes #33228, #27705.


git-svn-id: https://develop.svn.wordpress.org/trunk@38520 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 21:50:22 +00:00
Sergey Biryukov 669ec7953e Script Loader: Correct default value for `$src` in `wp_enqueue_script()` and `wp_enqueue_style()`.
Props Frank Klein for initial patch.
See #37770.

git-svn-id: https://develop.svn.wordpress.org/trunk@38519 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 04:08:11 +00:00
Drew Jaynes e7c0b5f36c Docs: Update the `$message` parameter for `_default_wp_die_handler()` to notate that it can also accept a `WP_Error` object.
Additionally, update the `$message` parameter description in the DocBlock for `wp_die()` to make it explicitly clear messages derived from a passed `WP_Error` object will only be evaluated if not performing an Ajax or XML-RPC request (as both default handlers completely ignore `WP_Error` object messages).

See #37770.


git-svn-id: https://develop.svn.wordpress.org/trunk@38518 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 03:40:04 +00:00
Sergey Biryukov e7a6afc044 Upload: Correct encoding issue in `swfupload.js`, introduced in [29479].
See #29199.

git-svn-id: https://develop.svn.wordpress.org/trunk@38517 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-03 15:01:06 +00:00
John Blackbourn 470a9fa6e2 Taxonomy: Introduce some taxonomy capability tests in preparation for introducing more fine grained capabilities for terms.
See #35614


git-svn-id: https://develop.svn.wordpress.org/trunk@38516 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-03 02:15:00 +00:00
Jeremy Felt 6f62798887 Multisite: Deprecate `wp_get_network()`.
`wp_get_network()` was converted into a wrapper for `get_network()` in 4.6.0 and can now be deprecated.

This moves `wp_get_network()` to the bottom of `ms-load.php` as `ms-deprecated.php` is not available early enough.

Props PieWP, flixos90.
Fixes #37553.


git-svn-id: https://develop.svn.wordpress.org/trunk@38515 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 23:48:00 +00:00
John Blackbourn 00c47125db Embeds: Clarify some assertion failure messages and correct a test URL for Twitter timelines.
See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38514 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 22:52:48 +00:00
Weston Ruter f5923b7fe8 Customize: Fix php warning due to `WP_Customize_Manager::prepare_setting_validity_for_js()` incorrectly assuming that `WP_Error` will only ever have arrays in its `$error_data`.
* Eliminates the server mutating the a `WP_Error`'s `$error_data` to merge-in a `$from_server` flag (since it may not be an array to begin with). Instead it defers to the client to add a `fromServer` param on any `Notification` instances created from server-sent errors.
* Ensures that notifications will be re-rendered if a notification's `message` changes but the `data` and `type` remain the same.
* Adds explicit support for the `Notification` class to have a `setting` property, ensuring that the property is set whereas previously it was dropped.

Fixes #37890.
Props westonruter, dlh.


git-svn-id: https://develop.svn.wordpress.org/trunk@38513 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 22:34:48 +00:00
John Blackbourn 84d26aac05 Embeds: Update the oEmbed provider test suite.
* Remove the manual flag for HTTPS support and replace it with a simple check on the URL format.
* Ensure `testOembedTestsCoverAllProviders()` actually fails when a new provider is added without a corresponding test.

See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38512 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 21:35:51 +00:00
Aaron Jorbin 4484e2d2c3 Formatting: Allow KSES custom elements with hyphens
The W3C Custom Elements spec (http://www.w3.org/TR/custom-elements/#concepts) allows you to use your own custom DOM elements/tags. One of the main requirements is that the tag name "must contain a U+002D HYPHEN-MINUS character". This adjusts KSES to allow it.

Fixes #34105.
Props batmoo.



git-svn-id: https://develop.svn.wordpress.org/trunk@38511 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 04:16:00 +00:00
Sergey Biryukov cce5a95dfa I18N: Add translator comments for XML-RPC strings with placeholders.
See #37792.

git-svn-id: https://develop.svn.wordpress.org/trunk@38510 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 04:12:52 +00:00