Commit Graph

3207 Commits

Author SHA1 Message Date
Sergey Biryukov d4a305292f Users: Make `wp_list_authors()` unit tests more readable.
See #23498.

git-svn-id: https://develop.svn.wordpress.org/trunk@45795 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 15:35:19 +00:00
Peter Wilson feb0830c79 Comments: Include post permalink in comment reply link.
Include the post's permalink when generating reply links in `get_comment_reply_link()` to account for comments displayed on index and archive pages.

This reapplies [32786] which was inadvertently reverted in [42360].

Props justinahinon, donmhico.
See #33383.
Fixes #47174.


git-svn-id: https://develop.svn.wordpress.org/trunk@45787 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 05:08:14 +00:00
Gary Pendergast 13d356691b Build Tools: Miscellaneous `local-env` improvements.
- Move the functionality for controlling `local-env` out of `package.json`, into JS scripts.
- Merge the `docker-compose` config files, and move it to the root directory. This allows `docker-compose.override.yml` to work for local overrides.
- Fix nginx redirecting to port 80 under some circumstances.
- `npm run env:install` now creates `wp-tests.config.php` for you.
- Cleaned up a bunch of cruft in `.travis.yml`.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45783 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-12 08:28:33 +00:00
Gary Pendergast 4271f1aeca Build Tools: Switch all Travis PHPUnit jobs over to Docker-based PHP.
Additionally, there are a handful of related minor changes in this commit:
- `.travis.yml` has been tidied up a little.
- [45745] was incorrectly marking Travis jobs as passed when some PHPUnit runs failed.
- Add the `LOCAL_PHP_MEMCACHED` environment variable, for enabling Memcached.
- Add the `env:pull` NPM script, for refreshing Docker images.

See #47767.


git-svn-id: https://develop.svn.wordpress.org/trunk@45762 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-07 11:54:22 +00:00
Sergey Biryukov 4bbe1ab5a9 Coding Standards: Fix WPCS violation in [45754].
See #46570.

git-svn-id: https://develop.svn.wordpress.org/trunk@45755 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-05 18:09:20 +00:00
Sergey Biryukov fad1821dd7 General: Correctly detect large floats in `is_serialized()`.
Props killerbishop, donmhico, hoythan.
Fixes #46570.

git-svn-id: https://develop.svn.wordpress.org/trunk@45754 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-05 13:54:43 +00:00
Sergey Biryukov 6c78848612 Users: Clean user cache in `check_password_reset_key()` tests.
Props davidbaumwald, spacedmonkey.
See #45845.

git-svn-id: https://develop.svn.wordpress.org/trunk@45717 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-01 19:53:45 +00:00
Sergey Biryukov f912470ac3 Users: Use `wp_update_user()` in `get_password_reset_key()`.
Props jayswadas, spacedmonkey, donmhico, SergeyBiryukov.
Fixes #45746.

git-svn-id: https://develop.svn.wordpress.org/trunk@45714 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-01 17:24:20 +00:00
Sergey Biryukov 209a72c35a Coding Standards: Fix WPCS violations after [45708].
See #45747.

git-svn-id: https://develop.svn.wordpress.org/trunk@45709 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-01 12:02:30 +00:00
Sergey Biryukov 03122ef7e1 Users: Deprecate `update_user_status()` in favor of `wp_update_user()`.
Props spacedmonkey, SergeyBiryukov.
Fixes #45747.

git-svn-id: https://develop.svn.wordpress.org/trunk@45708 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-01 11:27:28 +00:00
K. Adam White a875f9dae7 REST API: Skip processing fields which are not present in the selected context.
In `WP_REST_Controller::get_fields_for_response()`, exclude fields which are not registered to appear in the request's context.

In conjunction with r45705 this prevents the unnecessary computation of the sample permalink when making a request that is not context=edit.

Props dlh.
Fixes #45605.


git-svn-id: https://develop.svn.wordpress.org/trunk@45706 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-31 20:20:02 +00:00
Dominik Schilling 41dc7c7365 I18N: Following [45688], remove test for removed method.
See #44865.

git-svn-id: https://develop.svn.wordpress.org/trunk@45689 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-27 14:29:28 +00:00
Dominik Schilling 84b977945c I18N: Add support for custom `WP_PLUGIN_URL` in `load_script_textdomain()`.
Plugins may not be on the same host/path as the rest of the content. To support loading translations for this setup check if the script source matches `plugins_url()`.
Also fixes an undefined index notice when a custom content URL has no path.

Props odminstudios, ocean90.
Fixes #46336, #46387.

git-svn-id: https://develop.svn.wordpress.org/trunk@45685 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-27 12:43:56 +00:00
Gary Pendergast 4943b377ce Coding Standards: Move `wp-includes/class-oembed.php` to `wp-includes/class-wp-oembed.php`.
This renames the file containing the `WP_oEmbed` class to conform to the coding standards.

This commit also includes:

- A new `class-oembed.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45663 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 04:31:40 +00:00
Sergey Biryukov fd23000b11 Menus: Trim whitespace from custom link URLs.
Props majemedia, SergeyBiryukov.
Fixes #47723.

git-svn-id: https://develop.svn.wordpress.org/trunk@45655 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-17 18:44:56 +00:00
Gary Pendergast 8416a2b410 Coding Standards: Move `wp-admin/custom-header.php` to `wp-admin/includes/class-custom-image-header.php`
This renames the file containing the `Custom_Image_Header` class to conform to the coding standards.

This commit also includes:
- A new `custom-header.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45654 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-17 06:16:27 +00:00
Sergey Biryukov 2ae276c44f Media: Add a unit test for `wp_get_mime_types()`.
Props pbearne.
Fixes #47701.

git-svn-id: https://develop.svn.wordpress.org/trunk@45646 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-16 21:51:45 +00:00
Gary Pendergast 2da7f9f524 Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.
PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.




git-svn-id: https://develop.svn.wordpress.org/trunk@45639 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-15 06:24:08 +00:00
Gary Pendergast c6c78490e2 Coding Standards: Fix the remaining issues in `/tests`.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-08 00:55:20 +00:00
Gary Pendergast 18ec05e23a Coding Standards: Fix all `WordPress.DB.PreparedSQLPlaceholders` issues.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45603 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 05:42:57 +00:00
Gary Pendergast 6acb0c6402 Coding Standards: Fix all `WordPress.WhiteSpace.PrecisionAlignment` issues.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45602 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 05:20:52 +00:00
Gary Pendergast a00c69458b Formatting: Revert the changes to `wpautop()` in [45585,45587].
See #27350.


git-svn-id: https://develop.svn.wordpress.org/trunk@45589 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 11:21:53 +00:00
Gary Pendergast fe28df65e3 Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `tests`.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45588 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 04:43:01 +00:00
Gary Pendergast 8298f9dad0 Clean up stray `<p>` tags added by `wpautop()` inside block level tags.
`autop()` can sometimes get confused and not clean up stray `<p>` or `</p>` tags inside block level elements, which produces sub-optimal HTML. While browsers can generally handle it, there's no need to make things harder for them if we don't have to.

Props pento, ayubi, pbearne, jond, azaozz, 1994rstefan, dionysous, MikeHansenMe, jorbin, miqrogroove, niallkennedy.
Fixes #27350.




git-svn-id: https://develop.svn.wordpress.org/trunk@45585 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 01:30:15 +00:00
Adam Silverstein b97899a07f Taxonomy: add a new 'terms_pre_query' filter to short circuit WP_Term_Query 'get_terms' queries.
Add a new `terms_pre_query` filter which returns null by default. Return a non-null value to bypass WordPress's default `get_terms` queries.

Props jarocks, boonebgorges, spacedmonkey.
Fixes #41246.



git-svn-id: https://develop.svn.wordpress.org/trunk@45584 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 20:47:21 +00:00
Gary Pendergast ef5a9dfda6 Coding Standards: Fix/ignore the `WordPress.NamingConventions.ValidFunctionName` violations.
See #47632



git-svn-id: https://develop.svn.wordpress.org/trunk@45580 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 08:00:12 +00:00
Gary Pendergast 78e096fe98 Formatting: Trim leading whitespace in `esc_url()`.
Props toszcze.
Fixes #36369.



git-svn-id: https://develop.svn.wordpress.org/trunk@45578 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 03:28:21 +00:00
Gary Pendergast 77f9bf0aeb Formatting: Don't add `<p>` tags inside `<svg>` tags.
Inline `<svg>`s should generally work, as browsers should just ignore `<p>` or `<br/>` tags that shouldn't be inside the `<svg>`. To keep things neat, however, it's better not add them in the first place.

Props jared_smith, nacin, pento.
Fixes #9437.



git-svn-id: https://develop.svn.wordpress.org/trunk@45577 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 03:18:28 +00:00
Riad Benguella ed1233d05f Build/Test Tools: Fix the hello e2e test assertion.
The previous assertion was always valid because we assumed it returned a single object,
while in reality it was returning an array.

Props hideokamoto.
Fixes #47622.


git-svn-id: https://develop.svn.wordpress.org/trunk@45575 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 11:33:13 +00:00
Gary Pendergast 77764a5754 Formatting: Add correct `<p>` tags near `<hr>` tags.
It can be tricky to know when `wpautop()` should add `<p>` tags, but one thing we can be certain about is that they really shouldn't be anywhere near `<hr>` tags.

Now they aren't.

Props solarissmoke, MattyRob, pento.
Fixes #14674.



git-svn-id: https://develop.svn.wordpress.org/trunk@45574 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 07:15:31 +00:00
Gary Pendergast b9cd66f483 Formatting: Add support for seconds to `human_time_diff()`.
The web has gotten so much faster since `human_time_diff()` was created, we need to be able to measure time differences with much finer granularity. Now, we can.

Props johnjamesjacoby, pento.
Fixes #35655.



git-svn-id: https://develop.svn.wordpress.org/trunk@45573 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 06:43:27 +00:00
Riad Benguella 42a8715471 Build/Test Tools: Add the e2e tests setup.
- Adds a local environment based on docker
 - Adds the e2e tests setup
 - Adds a "Hello World" e2e test to serve as a template

Props gziolo, herregroen, mcsf.
Fixes #45165.


git-svn-id: https://develop.svn.wordpress.org/trunk@45570 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 11:26:58 +00:00
Gary Pendergast 3202f9f37e Formatting: Don't convert smilies in ignored tags that have attributes.
Smilies in ignored tags are not supposed to be converted to emoji, but this can malfunction if the tag has attributes. For example, the Preformatted block with add a `class` to the `<pre>` tag.

Props pento, jikamens.
Fixes #47489.



git-svn-id: https://develop.svn.wordpress.org/trunk@45569 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 02:04:17 +00:00
Sergey Biryukov e283457e45 Date/Time: Add more supported formats to `wp_maybe_decline_date()`.
Props SergeyBiryukov, Rarst.
Fixes #37411.

git-svn-id: https://develop.svn.wordpress.org/trunk@45555 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-20 13:46:20 +00:00
Peter Wilson 66f7cee321 Site health: Introduce `view_site_health_checks` capability.
Introduces the faux primitive capability `view_site_health_checks` available to single site admins and multisite super-admin to view the site health page within the admin.

The capability is mapped to the `install_plugins` capability without being dependent on the file system being writable. This fixes a bug where the feature couldn't be used by sites unable to write to the file system or managed through version control.

The capability is granted on the `user_has_cap` filter.

Props birgire, Clorith, palmiak, peterwilsoncc, spacedmonkey.
Fixes #46957.



git-svn-id: https://develop.svn.wordpress.org/trunk@45507 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-10 07:41:12 +00:00
John Blackbourn 393960b182 I18N: Allow the length of automatically generated excerpts to be localized.
This introduces three new strings that can be used to control the maximum length of automatically generated excerpts for posts, comments, and draft post previews in the dashboard. Optionally combined with the existing word count type control this allows languages which include many multibyte characters to specify more appropriate maximum excerpt lengths.

Props miyauchi, birgire, johnbillion

Fixes #44541


git-svn-id: https://develop.svn.wordpress.org/trunk@45505 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-08 18:41:08 +00:00
Andrea Fercia ffe40885a1 Regenerate the REST API fixtures after [45443].
See #38517.


git-svn-id: https://develop.svn.wordpress.org/trunk@45498 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-07 20:23:46 +00:00
Sergey Biryukov af0c73b10b Build/Test Tools: Add `$current_screen` to the list of globals to unset in `WP_UnitTestCase_Base::go_to()`.
Props mauteri.
Fixes #47439.

git-svn-id: https://develop.svn.wordpress.org/trunk@45486 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-31 14:06:27 +00:00
Andrew Ozz 3337e709ee Fix unit tests after [45456]. The query string is a bit different but the results are the same.
See #45346.

git-svn-id: https://develop.svn.wordpress.org/trunk@45458 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-28 04:18:53 +00:00
John Blackbourn 814aa7149f Build/Test Tools: Remove the dependency on a globally installed Grunt.
The existing `"grunt": "grunt"` script in `package.json` allows for the use of `npm run grunt ...` which uses the local `grunt` binary in the project's `node_modules`.

Fixes #47380


git-svn-id: https://develop.svn.wordpress.org/trunk@45445 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 19:34:24 +00:00
Sergey Biryukov 10855438ea Date/Time: Replace all instances of `date()` with `gmdate()`.
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.

git-svn-id: https://develop.svn.wordpress.org/trunk@45424 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 00:11:37 +00:00
John Blackbourn b64f812a59 Docs: Switch to the more common syntax for variadic function documentation.
See #37402


git-svn-id: https://develop.svn.wordpress.org/trunk@45418 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 21:58:18 +00:00
Sergey Biryukov cfd2e38db3 Docs: Remove full stop from ticket number.
See #46402.

git-svn-id: https://develop.svn.wordpress.org/trunk@45409 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 12:08:11 +00:00
Sergey Biryukov bda3af14b0 Formatting: Don't run `wp_targeted_link_rel()` on entirely serialized content.
Props birgire, elliotcondon.
Fixes #46402.

git-svn-id: https://develop.svn.wordpress.org/trunk@45408 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 12:04:28 +00:00
Sergey Biryukov 2a163fa733 Date/Time: Return early from `the_weekday()` and `the_weekday_date()` if we're not in the loop.
Restore `$previousweekday` global usage in `the_weekday_date()`, so it could still be used simultaneously with `the_date()`.

Partially reverts [45378].
See #47354.

git-svn-id: https://develop.svn.wordpress.org/trunk@45379 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-23 00:37:56 +00:00
Sergey Biryukov 48fb69f013 Date/Time: Bring some consistency to `the_date()` and `the_weekday_date()`:
* Make `the_date()` always apply the the filter and return a value.
* Use `is_new_day()` in `the_weekday_date()`.
* Add a unit test for `the_weekday_date()`.

Fixes #47354.

git-svn-id: https://develop.svn.wordpress.org/trunk@45378 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-22 21:57:29 +00:00
Sergey Biryukov 6491746559 Date/Time: Use strict comparison in `is_new_day()`, add a unit test.
Props pbearne.
Fixes #46627.

git-svn-id: https://develop.svn.wordpress.org/trunk@45375 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-22 17:52:22 +00:00
Jonathan Desrosiers f9e4f60577 General: Add missing unit tests for `wp_array_slice_assoc()`.
Props pbearne, desrosj.
Fixes #46638.

git-svn-id: https://develop.svn.wordpress.org/trunk@45371 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-21 14:47:58 +00:00
Peter Wilson b9e6f18350 KSES: Add `flex` and related long form properties to safe CSS.
Allow `flex`, `flex-grow`, `flex-shrink` and `flex-basis` to be used in inline CSS. As of WordPress 5.3 the block editor is expected to use `flex-basis` inline to set the width in the column block.

Props aduth.
Fixes #47281.
See #37248.



git-svn-id: https://develop.svn.wordpress.org/trunk@45363 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-18 04:33:27 +00:00
Sergey Biryukov a36aa1b078 Formatting: Adjust `wp_targeted_link_rel()` to ensure JSON format is preserved and correct quotes are used when adding the missing `rel` attribute.
Props birgire, TobiasBg, fierevere, audrasjb, SergeyBiryukov.
Fixes #46316, #47244.

git-svn-id: https://develop.svn.wordpress.org/trunk@45348 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 12:08:50 +00:00