Commit Graph

3092 Commits

Author SHA1 Message Date
Andrea Fercia 951b462ea2 Accessibility: Replace media placeholder clickable divs with buttons.
`<button>` elements are natively interactive, supported by any assistive technology, and must be used instead of non-semantic, non-accessible `<div>` elements.

Also, this change aligns the Media Widgets and the Customizer site icon and site logo controls with the design pattern used in the new Block Editor for similar controls.

Props ramonopoly, welcher, afercia.
Fixes #43151.


git-svn-id: https://develop.svn.wordpress.org/trunk@44796 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-05 17:49:00 +00:00
Jonathan Desrosiers 4a09766cb0 Privacy: Remove two test methods that fail on certain configurations.
The `test_detects_cannot_create_index()` and `tests_detects_cannot_write_html()` test methods are prone to failure under certain configurations, as discovered by the hosts reporting back the test suite results. This removes those two methods until a better approach to testing those scenarios can be created.

Partial revert of [44786].
See #44233.

git-svn-id: https://develop.svn.wordpress.org/trunk@44792 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-04 22:19:05 +00:00
Jonathan Desrosiers d80e627fdf Build/Test Tools: Fix validation error in multisite PHPUnit configuration file.
A PHPUnit configuration file with more than one `<php>` tag causes a validation error in PHPUnit versions 7.x. There are currently 2 in the `tests/phpunit/multisite.xml` file, which appears to be accidentally introduced in [29954].

Fixes #46414.

git-svn-id: https://develop.svn.wordpress.org/trunk@44790 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-04 21:32:02 +00:00
Jonathan Desrosiers 636af9078d Privacy: Add missing unit tests for exporting personal data.
Props allendav, birgire, iandunn, desrosj, garrett-eclipse.
Fixes 44233.

git-svn-id: https://develop.svn.wordpress.org/trunk@44786 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-04 19:35:30 +00:00
Aaron Jorbin e421f262dc Replace usages of basename() with wp_basename() in order to support multibyte filenames
This is focused on the pieces of code that touch media files and the tests that support them. `basename` isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.


git-svn-id: https://develop.svn.wordpress.org/trunk@44785 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-01 20:57:26 +00:00
Peter Wilson 41e264fe55 Build: Fix formatting issues introduced in [44740].
See #46218.



git-svn-id: https://develop.svn.wordpress.org/trunk@44744 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-14 00:41:15 +00:00
Peter Wilson 3ec3100195 Build: Remove source map from `jquery.form.min.js`.
Minimize jquery.form.js as part of build process to remove the source map reference. 

Modify source map tests to include all JavaScript files rather than testing Backbone and jQuery only.

Props pento.
Fixes #46218.



git-svn-id: https://develop.svn.wordpress.org/trunk@44740 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-14 00:06:39 +00:00
Gary Pendergast d2f41560d3 Formatting: Loosen the type checking in `_sanitize_text_fields()`.
[44618] added strict type checking to `_sanitize_text_fields()`, which has caused some compat issues with plugins.

We can loosen the type checking to only reject objects and arrays, and cast other types to string.

Props Nick_theGeek, pento.
Fixes #41450.



git-svn-id: https://develop.svn.wordpress.org/trunk@44731 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-07 23:34:22 +00:00
Gary Pendergast 6b2c62eee2 Multisite: After creating a new blog, ensure the blog cache is correctly cleaned up.
Props david.binda, spacedmonkey.
Fixes #46125.



git-svn-id: https://develop.svn.wordpress.org/trunk@44727 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-07 06:03:32 +00:00
Sergey Biryukov 3e19129dc9 Build/Test Tools: Display a message about currently supported PHPUnit branch to avoid fatal errors on later versions.
See #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@44723 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-03 22:40:56 +00:00
Sergey Biryukov 4b8e33fbee Build/Test Tools: Move `WP_UnitTestCase_Base::assertPostConditions()` to a more appropriate place.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44719 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-30 14:30:42 +00:00
Felix Arntz 0612ea2d38 Bootstrap/Load: Revert fatal error recovery mechanism from 5.1 to polish for 5.2.
Due to the high number of follow-up tickets and associated security concerns, it was decided to reschedule the fatal error recovery feature for WordPress 5.2, in order to address these issues properly. The feature will continue to be developed, with iterations being merged into trunk early in the 5.2 release cycle.

Fixes #46141. See #44458, #45932, #45940, #46038, #46047, #46068.


git-svn-id: https://develop.svn.wordpress.org/trunk@44717 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-30 11:00:30 +00:00
Sergey Biryukov b9b66b159b Build/Test Tools: Simplify `WP_PHPUnit_Util_Getopt` and update documentation.
Introduced in [918/tests] and updated in [26871], the class is there to make sure that known bugs are not skipped when `phpunit` is called with a `--group` that corresponds to an `@ticket` annotation (such as `phpunit --group 12345`).

Enforcing recognized arguments or correctly formed arguments is not the concern here, so reusing `PHPUnit_Util_Getopt::parseLongOption()` was superfluous.

See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44715 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-30 00:53:52 +00:00
Peter Wilson 99450a446d Customize: Remove `wp_targeted_link_rel` pre-save filter from change-sets.
The pre-save filters added to links in [43732] could invalidate JSON data when saving Customizer change-sets.

This removes the filters when saving and publishing change-sets.

Props peterwilsoncc, nikeo for testing.
See #45292.



git-svn-id: https://develop.svn.wordpress.org/trunk@44714 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-29 21:28:57 +00:00
Gary Pendergast 9efcfbbf3f Tests: Fix the tests for the `c` and `r` formats in `date_i18n()`.
To test the `date_i18n()` output correctly, the tests added in [43434] need to set a non-UTC timezone.

Props Rarst.
Fixes #20973.



git-svn-id: https://develop.svn.wordpress.org/trunk@44710 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-29 01:19:30 +00:00
Sergey Biryukov 6e80f7cebf Build/Test Tools: Don't throw an exception for unrecognized options in `WP_PHPUnit_Util_Getopt::parseLongOption()`.
The method is only used for two known options: `group` and `exclude-group`, others should be passed to PHPUnit.

Props johnbillion.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44707 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 18:49:22 +00:00
Sergey Biryukov ad71116f38 Coding Standards: Replace spaced indentation sections of `phpunit.xml.dist`, `multisite.xml`, and `build.xml` with tabs.
Props netweb, desrosj.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44705 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 17:20:06 +00:00
Sergey Biryukov e4813189c3 Build/Test Tools: Reorder `<file>` and `<exclude>` rules in `multisite.xml` to avoid warnings in PHPUnit 7.2+.
Missed in [44702].

See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44704 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 17:19:14 +00:00
Sergey Biryukov 48070a45a9 Build/Test Tools: Correct `WP_Test_REST_Schema_Sanitization::test_type_string()` to check for both `1.1` float and `'1.10'` string explicitly.
Previously, the test only passed due to a bug in PHPUnit 7.1.x and older versions.

Fixes #43218. See #38586.

git-svn-id: https://develop.svn.wordpress.org/trunk@44703 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 16:53:14 +00:00
Sergey Biryukov 001c6498e8 Build/Test Tools: Add support for PHPUnit 7.x.
* Create an abstract `WP_UnitTestCase_Base` class to share between PHPUnit 7.x and older versions.
* Add a speed-trap loader to determine which `SpeedTrapListener` class needs to be loaded for the current PHPUnit version.
* Remove unnecessary `PHPUnit\Util\Test` and `PHPUnit_Util_Getopt` inheritances.
* Update Travis CI config to use PHPUnit 7.x for PHP 7.1, 7.2, and nightly PHP versions.

Props jipmoors, netweb, desrosj, ayeshrajans, soulseekah, SergeyBiryukov.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44701 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 14:10:24 +00:00
Peter Wilson 554ee5b53c Cron: Move logic for finding the next event's timestamp.
Moves the logic for determining when an event will next run from `wp_next_scheduled()` to `wp_get_scheduled_event()`.

This improves the performance of `wp_get_scheduled_event()` by avoiding duplicate function calls and object cache hits.

Props peterwilsoncc.
Fixes #45976.


git-svn-id: https://develop.svn.wordpress.org/trunk@44693 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-23 23:07:39 +00:00
Peter Wilson bb463b5265 Formatting: Prevent `wp_targeted_link_rel()` adding an empty attribute.
Bypass adding a `rel` attribute when the `wp_targeted_link_rel` filter returns an empty string or other falsy result.

Props mcmwebsol, spartank, meatman89fs.
Fixes #45352.


git-svn-id: https://develop.svn.wordpress.org/trunk@44691 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-22 21:54:26 +00:00
Felix Arntz fbe0605156 Bootstrap/Load: Fix fatal error when passing a `WP_Error` to `wp_die()`.
This was introduced in [44466]. Also, this changeset adds tests for `_wp_die_process_input()` so that this never happens again.

Props dd32.
See #45933.


git-svn-id: https://develop.svn.wordpress.org/trunk@44690 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-22 08:51:56 +00:00
Sergey Biryukov 44ce02e28a PHPCS: Fix formatting issues introduced in [44670].
See #44914.

git-svn-id: https://develop.svn.wordpress.org/trunk@44672 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-21 19:56:47 +00:00
Sergey Biryukov 8fe01c0621 Post Formats: Prevent Bulk Edit from unintentionally changing post format to Standard even if set to "No change".
Correct the logic in [41187].

Props birgire, mukesh27, lanche86.
Fixes #44914. See #41396.

git-svn-id: https://develop.svn.wordpress.org/trunk@44670 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-21 18:04:55 +00:00
Peter Wilson 7d8ce1e287 Options: Avoid unnecessary DB calls when updating network options.
Adds a `maybe_serialize()` comparison for the old and new values in `update_network_option()` to avoid unnecessary database writes when options contain identical objects.

Props bor0.
Fixes #44956.



git-svn-id: https://develop.svn.wordpress.org/trunk@44662 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-21 04:26:33 +00:00
Gary Pendergast 9dfde992ee Comments: Show the "awaiting moderation" message when comment cookies are disabled.
The "Your comment is awaiting moderation." message relied upon the comment author cookie being set. However, since it's now possible to opt-out of that cookie, submitting a comment won't show the comment preview when the comment is placed in moderation.

To avoid this issue, we now include a hash in the redirect URL, allowing the site to identify that a preview of the moderated comment should be displayed.

Props imath, tomdxw, birgire, lakenh, azaozz, pento.
Fixes #43857.



git-svn-id: https://develop.svn.wordpress.org/trunk@44659 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-21 01:33:50 +00:00
Gary Pendergast 19645a4790 Tests: Add tests for the `__return*()` functions.
Props pbearne, mukesh27.
Fixes #46043.



git-svn-id: https://develop.svn.wordpress.org/trunk@44658 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-21 00:32:33 +00:00
Andrea Fercia 6dde7cd74f Build/Test Tools: Update QUnit index file after [43174].
Updates the last occurrence of "(opens in a new window)" to "(opens in a new tab)".

See #43803.


git-svn-id: https://develop.svn.wordpress.org/trunk@44655 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-19 15:27:11 +00:00
Gary Pendergast 2ec6c8f3d3 Build Tools: Upgrade WPCS to 2.0.0.
A few sniffs have been renamed, this change includes the relevant `phpcs:ignore` comment updates.

Fixes #46002.



git-svn-id: https://develop.svn.wordpress.org/trunk@44645 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-18 02:14:24 +00:00
Gary Pendergast d3ee420c14 Emoji: Upgrade Twemoji to 11.2.0.
This upgrade includes general improvements to the style of a variety of emoji.

Full changelog: https://github.com/twitter/twemoji/compare/v11.0.0...v11.2.0

Props desrosj, pento.
Fixes #45133.



git-svn-id: https://develop.svn.wordpress.org/trunk@44644 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-18 01:41:41 +00:00
Jonathan Desrosiers 3e390cdf9b Tests: Do not include the delimiter parameter in `ucwords()` calls.
This parameter is not supported in PHP < 5.4. Introduced in [44641].

See #44672.

git-svn-id: https://develop.svn.wordpress.org/trunk@44642 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 21:44:30 +00:00
Jonathan Desrosiers 83cfc77500 REST API: Allow a user to change the letter casing of their email.
When a `PUT` request is performed to update a user, a `rest_user_invalid_email` error is incorrectly being returned when the email exists with different letter casing, even if it belongs to the user being updated. `email_exists()` performs a case insensitive lookup, but the conditional statement following that lookup was performing a strict comparison between the new email and the user’s current email.

This changes that comparison to instead compare the user ID returned by `email_exists()` with the user ID being updated. This more closely matches the logic used in `edit_user()` and allows a user to change the letter casing of their email.

Props fuchsws, rachelbaker, desrosj.
Fixes #44672.

git-svn-id: https://develop.svn.wordpress.org/trunk@44641 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 21:24:47 +00:00
Gary Pendergast bcba20dd2b Docs: Fix the last handful of incorrect `@since 5.0.0` docblock tags.
Props peterwilsoncc.
Fixes #45543.



git-svn-id: https://develop.svn.wordpress.org/trunk@44635 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 06:45:58 +00:00
Gary Pendergast 2e63f69564 Tests: Ensure meta keys are cleaned up after each test.
Props jnylen0.
Fixes #46007.



git-svn-id: https://develop.svn.wordpress.org/trunk@44633 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 04:33:42 +00:00
Jonathan Desrosiers 06371823e3 Privacy: Allow column sorting in the privacy request admin tables.
This allows users to sort the export and erase personal data request tables by “Requester” (`post_title`, or user email) and “Requested” (`post_date`, or when the request was created), which can be helpful when sites have many requests present.

Props birgire, ianbelanger, pbiron, desrosj.
Fixes #43405.

git-svn-id: https://develop.svn.wordpress.org/trunk@44628 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-16 17:51:56 +00:00
Gary Pendergast afa551294e Formatting: Add type checking to `_sanitize_text_fields()`.
When a non-string value is passed, return an empty string.

Props Mte90.
Fixes #41450.



git-svn-id: https://develop.svn.wordpress.org/trunk@44618 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-16 06:04:51 +00:00
Gary Pendergast e79bddcb02 Users: Add extra checking to `wp_new_user_notification()`.
Prevent a notification from being sent when an unrecognised value is passed in the `$notify` parameter.

Props cthreelabs, 360zen.
Fixes #44293.



git-svn-id: https://develop.svn.wordpress.org/trunk@44611 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-16 04:26:48 +00:00
Gary Pendergast f418ee12b1 Link Template: In `get_adjacent_post()`, move the sanitisation of `$excluded_terms` earlier.
This is a followup to [42828], ensuring that the `get_{$adjacent}_post_excluded_terms` filter is always passed an array, as expected.

Props soulseekah, zottto.
Fixes #43521.



git-svn-id: https://develop.svn.wordpress.org/trunk@44591 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-15 01:53:02 +00:00
Gary Pendergast 5cdc0e1397 Query: Cache the result when `get_pages()` doesn't find anything in the database.
Props flixos90, soulseekah.
Fixes #43514.



git-svn-id: https://develop.svn.wordpress.org/trunk@44587 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 23:26:20 +00:00
Jonathan Desrosiers dd85c357d8 Tests: Add missing `parent::tearDown()`.
Also, remove a `tearDown()` method that was not serving any purpose.

Fixes #45931.

git-svn-id: https://develop.svn.wordpress.org/trunk@44584 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 21:33:56 +00:00
Gary Pendergast 065e7817c4 Customizer: Fix a coding standards issue introduced in [44580].
See #40020.




git-svn-id: https://develop.svn.wordpress.org/trunk@44582 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 07:22:03 +00:00
Gary Pendergast f5f5da1fff Customizer: Improve browser compatibility of the preview iframe.
When `home` and `siteurl` are different, the customizer preview iframe will be blank in Chrome and Safari, due to their `X-Frame-Options` implementation quirks.

Changing this to `SAMEORIGIN` and adding the `frame-ancestors` Content Security Policy gives the correct behaviour.

Props fullyint.
Fixes #40020.



git-svn-id: https://develop.svn.wordpress.org/trunk@44580 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 06:37:30 +00:00
Gary Pendergast 4550488c99 Widgets: Don't log invalid HTML in the Text Widget.
[41215] supresses these irrelevant error messages from the front end, this removes them from the error log, too.

Props jeherve.
Fixes #43815.



git-svn-id: https://develop.svn.wordpress.org/trunk@44578 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 05:04:12 +00:00
Gary Pendergast e547ecc791 Tests: Add missing `parent::setUp()` calls to all test classes.
Props johnbillion, birgire.
Fixes #37375.



git-svn-id: https://develop.svn.wordpress.org/trunk@44577 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-14 04:54:01 +00:00
Gary Pendergast a139c8cbf7 Coding Standards: Fix and whitelist variable names.
From the `WordPress.NamingConventions.ValidVariableName` sniff, this commit fixes/whitelists all `NotSnakeCaseMemberVar`, `MemberNotSnakeCase`, and `StringNotSnakeCase` violations. It also fixes a handful of the `NotSnakeCase` violations.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44573 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-12 06:05:55 +00:00
Gary Pendergast ff53bd388c Coding Standards: Extract `extract()` from the codebase.
Of the last four instances of `extract()` occurring, three of them are removed by this commit, and the fourth is appropriately documented.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44569 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-12 03:19:23 +00:00
Jonathan Desrosiers 34e3de7b7f REST API: Encourage proper usage of `register_rest_route()`.
Calling `register_rest_route()` too early in the loading process has the potential to cause some unintentional problems and pitfalls. Because `register_rest_route()` calls `rest_get_server()` (which creates the `WP_REST_Server` instance), calling the function directly and/or before `rest_api_init` should be discouraged.

For example, if `register_rest_route ()` is called on `init`, the REST API server instance is set up (and all functions added to `rest_api_init` and other related hooks are invoked), even though the current request may not be a REST request. Also, if `register_rest_route()` is called even earlier (say, in an `mu-plugin` file), required endpoints may be missing since normal plugins have not yet been loaded and have not had a chance to register their own action hooks.

This adds a `_doing_it_wrong()` notice the first time `register_rest_route()` is called before `rest_api_init` in a request to encourage best practices for registering REST API routes.

Props kraftbj, desrosj, timothyblynjacobs.
Fixes #45265.

git-svn-id: https://develop.svn.wordpress.org/trunk@44568 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 18:18:41 +00:00
Gary Pendergast 6f0487c2f0 Coding Standards: Ignore the violations of `Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase`.
See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44563 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 06:07:50 +00:00
Gary Pendergast 65f5fcb0fb Coding Standards: Ignore the single WordPress.PHP.RestrictedPHPFunctions.create_function_create_function violation.
This is intentional, for older PHP support.

See #45934.


git-svn-id: https://develop.svn.wordpress.org/trunk@44560 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 03:44:20 +00:00