Commit Graph

37401 Commits

Author SHA1 Message Date
Gary Pendergast
156c8ec5c6 I18N: Fix a PHP error introduced in [41722].
PHP 5.2 and 5.3 don't support short array syntax, Ryan.

Fixes #41562.



git-svn-id: https://develop.svn.wordpress.org/trunk@41723 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 02:11:27 +00:00
Gary Pendergast
f3a52234ea I18N: Introduce the Plural_Forms class.
Historically, we've evaluated the plural forms for each language using `create_function()`. This is being deprecated in PHP 7.2, so needs to be replaced.

The `Plural_Forms` class parses the `Plural-Forms` header from the PO file, and internally caches the result of all subsequent plural form tests, allowing it to match the performance of the existing code.

Props rmccue.
Fixes #41562.



git-svn-id: https://develop.svn.wordpress.org/trunk@41722 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 01:29:59 +00:00
Weston Ruter
3fcfefd05c File Editors: Introduce sandboxed live editing of PHP files with rollbacks for both themes and plugins.
* Edits to active plugins which cause PHP fatal errors will no longer auto-deactivate the plugin. Supersedes #39766.
* Introduce sandboxed PHP file edits for active themes, preventing accidental whitescreening of a user's site when introducing a fatal error.
* After writing a change to a PHP file for an active theme or plugin, perform loopback requests on the file editor admin screens and the homepage to check for fatal errors. If a fatal error is encountered, roll back the edited file and display the error to the user to fix and try again.
* Introduce a secure way to scrape PHP fatal errors from a site via `wp_start_scraping_edited_file_errors()` and `wp_finalize_scraping_edited_file_errors()`.
* Moves file modifications from `theme-editor.php` and `plugin-editor.php` to common `wp_edit_theme_plugin_file()` function.
* Refactor themes and plugin editors to submit file changes via Ajax instead of doing full page refreshes when JS is available.
* Use `get` method for theme/plugin dropdowns.
* Improve styling of plugin editors, including width of plugin/theme dropdowns.
* Improve notices API for theme/plugin editor JS component.
* Strip common base directory from plugin file list. See #24048.
* Factor out functions to list editable file types in `wp_get_theme_file_editable_extensions()` and `wp_get_plugin_file_editable_extensions()`.
* Scroll to line in editor that has linting error when attempting to save. See #41886.
* Add checkbox to dismiss lint errors to proceed with saving. See #41887.
* Only style the Update File button as disabled instead of actually disabling it for accessibility reasons.
* Ensure that value from CodeMirror is used instead of `textarea` when CodeMirror is present.
* Add "Are you sure?" check when leaving editor when there are unsaved changes.

Supersedes [41560].
See #39766, #24048, #41886.
Props westonruter, Clorith, melchoyce, johnbillion, jjj, jdgrimes, azaozz.
Fixes #21622, #41887.


git-svn-id: https://develop.svn.wordpress.org/trunk@41721 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 00:19:16 +00:00
Weston Ruter
e965140cc9 Customize: Let establish_loaded_changeset query changesets from any author not just current user when determining which changeset to autoload in non-branching mode.
See #39896.


git-svn-id: https://develop.svn.wordpress.org/trunk@41720 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 00:00:47 +00:00
Felix Arntz
43a34c9167 Multisite: Improve get_blog_details() by using get_site_by().
`get_site_by()` is now the preferred way to retrieve a site object by lookup for identifying data. By using a coherent structure and `get_sites()` internally, it has several advantages over the direct database queries and complex code in `get_blog_details()`. Therefore `get_blog_details()` is now a wrapper for `get_site_by()`, providing backward compatibility fixes where necessary.

Unit tests have been adjusted to account for the `blog-details` and `blog-lookup` cache groups, which are no longer needed.

Props spacedmonkey, jeremyfelt, flixos90.
Fixes #40228.


git-svn-id: https://develop.svn.wordpress.org/trunk@41719 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 19:40:01 +00:00
Felix Arntz
610db1241a Multisite: Use WP_Network_Query in ms_load_current_site_and_network().
This gets rid of the last readonly direct database query for networks in core. 🎉

Props spacedmonkey.
Fixes #41762.


git-svn-id: https://develop.svn.wordpress.org/trunk@41718 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 19:26:01 +00:00
Felix Arntz
d54e80111a Multisite: Replace calls to refresh_blog_details() with clean_blog_cache().
Fixes #42077. See #40201.


git-svn-id: https://develop.svn.wordpress.org/trunk@41717 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 19:04:57 +00:00
Felix Arntz
0c1c78bf09 Multisite: Establish clean_blog_cache() as a replacement for refresh_blog_details().
Going forward, `clean_blog_cache()` is recommended to be used instead of `refresh_blog_details()`. It has been adjusted to match the functionality of the latter, with the exception that it always requires a site ID or object to be passed. The `refresh_blog_details` action has been deprecated in favor of the `clean_site_cache` action. The function itself is not formally deprecated at this point, but will likely be in the near future.

Props spacedmonkey.
Fixes #40201.


git-svn-id: https://develop.svn.wordpress.org/trunk@41716 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 18:40:32 +00:00
Felix Arntz
2e051261f3 Multisite: Add specific tests for clean_blog_cache() and refresh_blog_details().
See #40201.


git-svn-id: https://develop.svn.wordpress.org/trunk@41715 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 18:20:37 +00:00
John Blackbourn
260b9917d7 Docs: Correct some @since MU notation that was broken in [41200].
Every function introduced by MU was introduced in 3.0.0 as this was when MU was merged.

See #41509


git-svn-id: https://develop.svn.wordpress.org/trunk@41714 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 17:43:37 +00:00
John Blackbourn
d72e4fd9aa Plugins: Introduce a singular and plural form for the plugin deletion error message.
Props eddhurst, SergeyBiryukov

Fixes #38918


git-svn-id: https://develop.svn.wordpress.org/trunk@41713 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 17:12:41 +00:00
John Blackbourn
35363c99b1 Embeds: Remove the external oEmbed tests for YouTube.
These tests no longer test anything that WordPress core has control over. YouTube now serves everything
over HTTPS by default, so the tests for #23149 will always pass, and the tests for #32714 aren't testing
anything that core has control over.

Tests for the responses from oEmbed providers has been attempted and reverted in #32360.

See #42076, #32714, #23149


git-svn-id: https://develop.svn.wordpress.org/trunk@41712 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 16:51:25 +00:00
Andrea Fercia
d3f5e2b5dc Accessibility: Change all the #f00 and red to the official WordPress accent red.
WordPress should exclusively use colors from the official colors palette, see
https://make.wordpress.org/design/handbook/design-guide/foundations/colors/
Partially addresses accessibility color contrast ratio issues.

See #35622.


git-svn-id: https://develop.svn.wordpress.org/trunk@41711 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 16:01:57 +00:00
John Blackbourn
23b1296432 Login and Registration: Add unit tests for wp_auth_check().
Props pbearne, birgire

Fixes #41860


git-svn-id: https://develop.svn.wordpress.org/trunk@41710 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 16:01:16 +00:00
Andrea Fercia
679f45c906 Customize: Fix invalid HTML and aria-describedby values.
- fixes invalid HTML and duplicate IDs
- as per the Accessibility coding standards, all new code must use explicitly associated form labels
- properly escapes a few HTML attributes

Props celloexpressions, afercia.
Fixes #42054.


git-svn-id: https://develop.svn.wordpress.org/trunk@41709 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 15:43:22 +00:00
Andrew Ozz
f3a3185bd4 Tools: enable Grunt precommit task to run without requiring SVN or GIT.
Fixes #41957

git-svn-id: https://develop.svn.wordpress.org/trunk@41708 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 15:19:23 +00:00
Sergey Biryukov
fac51f61e3 HTTP API: Use WP_HTTP_Response::set_data() in ::__construct() instead of directly accessing the $data property.
Props tfrommen.
Fixes #41759.

git-svn-id: https://develop.svn.wordpress.org/trunk@41707 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 15:17:09 +00:00
Sergey Biryukov
fb06fab2e8 Posts, Post Types: Simplify the wording in post locking notice.
Props munyagu.
Fixes #42023.

git-svn-id: https://develop.svn.wordpress.org/trunk@41706 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 15:10:38 +00:00
Sergey Biryukov
d4dff17627 Multisite: Change IP references in new site or user notifications to IP address for clarity.
Props gk.loveweb, bradparbs.
See #40382.

git-svn-id: https://develop.svn.wordpress.org/trunk@41705 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 13:12:08 +00:00
Sergey Biryukov
609318a22d Comments: Change IP references in moderation option labels and email notifications to IP address for clarity.
Props mako09, gk.loveweb, bradparbs.
Fixes #40382.

git-svn-id: https://develop.svn.wordpress.org/trunk@41704 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 13:08:48 +00:00
Sergey Biryukov
ef549c2b53 Twenty Seventeen: Change tag cloud format to a list (<ul>) for better semantics and accessibility.
List markup allows screen reader users to know in advance how many tags are within the list.

Props sami.keijonen.
Fixes #40184.

git-svn-id: https://develop.svn.wordpress.org/trunk@41703 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 12:16:31 +00:00
Gary Pendergast
d2a011c666 Emoji: Fix incorrect emoji encoding in PHP < 5.4.
[41701] included a bug with PHP < 5.4. Prior to then, `html_entity_decode()` decoded into `ISO-8859-1`, when we actually need it to use `UTF-8`.

Fixes #35293.



git-svn-id: https://develop.svn.wordpress.org/trunk@41702 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 09:56:45 +00:00
Gary Pendergast
d3e0b4bc16 Emoji: Bring Twemoji compatibility to PHP.
This was previously attempted in [41043], which unfortunately had severe performance issues, the regex it used was fatally slow on long posts.

This version now uses an array of all emoji that Twemoji supports, which maintains the accuracy of [41043], while being the same speed or only a few ms slower than the code prior to [41043].

As with [41043], the `grunt precommit:emoji` task detects when `twemoji.js` has changed, and regenerates the array.

Props jmdodd for feedback, suggestions, and insults where appropriate.
Fixes #35293. 🤞🏻



git-svn-id: https://develop.svn.wordpress.org/trunk@41701 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 07:11:28 +00:00
Jeremy Felt
d4814228dc Multisite: Use %s when building query for archived sites in WP_Site_Query.
In [25548], the `archived` column in `wp_blogs` was changed from `ENUM` to `TINYINT` to match other status fields. When `WP_Site_Query` was written later, it used `%d` as a placeholder when formatting the archived status.

It is possible that this query will fail for any installations that did not update the schema for `wp_blogs` as only single quoted values are accepted for the `ENUM` type. In this case, `'0'` or `'1'` rather than `0` or `1`.

We can work around this and support both `ENUM` and `TINYINT` in the query by using the `%s` placeholder and casting the value with `absint()`.

Props stephdau.
Fixes #38856. See #27832.


git-svn-id: https://develop.svn.wordpress.org/trunk@41700 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 04:39:08 +00:00
Weston Ruter
bebc4cde6f Customize: Update dashboard welcome link to point to themes panel in the customizer instead of themes admin screen.
Props celloexpressions.
Fixes #42050.


git-svn-id: https://develop.svn.wordpress.org/trunk@41699 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 04:12:51 +00:00
Jeremy Felt
5fc09374c2 Multisite: Introduce get_site_by().
`get_site_by()` is a replacement for `get_blog_details()` that uses `WP_Site_Query` to retrieve specific sites based on a given field and value.

Props flixos90, spacedmonkey.
Fixes #40180.


git-svn-id: https://develop.svn.wordpress.org/trunk@41698 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 04:09:50 +00:00
Weston Ruter
2e5f329cc9 Customize: Provide validation feedback for invalid Custom Link URLs in nav menu items.
Props RMarks, EGregor, umangvaghela123, andrew.taylor, celloexpressions, westonruter, voldemortensen.
Fixes #32816.


git-svn-id: https://develop.svn.wordpress.org/trunk@41697 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 03:43:01 +00:00
Joe McGill
57b92c4116 Widgets: Default to "custom URL" in the image widget.
This changes the default value for `link_type` in the image widget
schema to 'custom'.

Props bor0, desrosj.
Fixes #41629.


git-svn-id: https://develop.svn.wordpress.org/trunk@41696 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 02:59:03 +00:00
Gary Pendergast
942482993d Plugins: Add plugin icons to the plugin list tables.
To mirror theme list table behaviour, the plugin icon now appears next to plugins in the plugin list tables. For plugins that don't have an icon, or non-W.org plugins, a fallback dashicon is shown.

Props melchoyce, afercia, paulwilde, pento, obenland.
Fixes #30186.



git-svn-id: https://develop.svn.wordpress.org/trunk@41695 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 00:24:31 +00:00
Weston Ruter
88db798f62 Customize: Add button in Publish Settings to discard unsaved changes (including drafted and scheduled), reverting Customizer to the last published state.
Props westonruter, melchoyce.
Amends [41667].
See #39896, #21666.


git-svn-id: https://develop.svn.wordpress.org/trunk@41694 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 00:21:06 +00:00
John Blackbourn
e95d1428d1 Build/Test tools: Correctly delete attachment files used in the media and post thumbnail tests.
Props atanasangelovdev

Fixes #38264 


git-svn-id: https://develop.svn.wordpress.org/trunk@41693 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 00:08:16 +00:00
John Blackbourn
1e16e5eee8 I18N: Allow the login screen language to be specified via a wp_lang query variable, and use this for the interim login modal.
This allows users who are using the admin area in a language other than the site language to read the notice on the login screen
(which explains that they need to log in again) in their chosen language.

Props Nikschavan, swissspidy

Fixes #40205


git-svn-id: https://develop.svn.wordpress.org/trunk@41692 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 23:20:12 +00:00
Sergey Biryukov
b0c40f74d4 Login and Registration: Introduce login_title filter for the <title> tag content on login page.
The new filter mirrors the `admin_title` filter used on admin pages.

Props nishitlangaliya, henry.wright, SergeyBiryukov.
Fixes #40812.

git-svn-id: https://develop.svn.wordpress.org/trunk@41691 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:59:25 +00:00
Sergey Biryukov
d12b5a5b98 Login and Registration: Make the order of <title> tag parts on login page consistent with the rest of admin pages.
Props nishitlangaliya, henry.wright.
Fixes #40814.

git-svn-id: https://develop.svn.wordpress.org/trunk@41690 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:29:55 +00:00
Sergey Biryukov
6bd89722fa Comments: Pass $comment object to comment actions:
* `delete_comment`
* `deleted_comment`
* `trash_comment`
* `trashed_comment`
* `untrash_comment`
* `untrashed_comment`
* `spam_comment`
* `spammed_comment`
* `unspam_comment`
* `unspammed_comment`

Props henry.wright.
Fixes #41228.

git-svn-id: https://develop.svn.wordpress.org/trunk@41689 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:13:29 +00:00
John Blackbourn
19c0a55711 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017


git-svn-id: https://develop.svn.wordpress.org/trunk@41688 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:13:04 +00:00
Sergey Biryukov
2669a8f16e Twenty Seventeen: Add missing labels for <aside role="complementary"> widget areas.
Props sami.keijonen.
Fixes #42056.

git-svn-id: https://develop.svn.wordpress.org/trunk@41687 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:03:10 +00:00
John Blackbourn
dd33fc9301 Docs: Remove & prefixes from parameter documentation to avoid doc parsing errors.
Props sudar for the original patch.

See #35974


git-svn-id: https://develop.svn.wordpress.org/trunk@41686 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:01:23 +00:00
Sergey Biryukov
922ffc4190 Widgets: Pass $instance to widget argument filters:
* `widget_archives_dropdown_args`
* `widget_archives_args`
* `widget_categories_dropdown_args`
* `widget_categories_args`
* `widget_meta_poweredby`
* `widget_pages_args`
* `widget_comments_args`
* `widget_posts_args`
* `widget_tag_cloud_args`

See [33971] for `widget_links_args` and [34662] for `widget_nav_menu_args`.

Props Takahashi_Fumiki.
Fixes #38017.

git-svn-id: https://develop.svn.wordpress.org/trunk@41685 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 22:01:19 +00:00
Andrea Fercia
e2c4ae805f Quick/Bulk Edit: Improve the inline error messages styling.
- uses the core `notice` styles for the Quick Edit form inline error messages
- adds missing periods at the end of a few error messages

Props ocean90, karmatosed, melchoyce, afercia.
Fixes #35496.


git-svn-id: https://develop.svn.wordpress.org/trunk@41684 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 21:51:09 +00:00
Andrea Fercia
02588452f7 Accessibility: List Tables: use aria-current for the views 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 the `aria-current` attribute after [41359] and [41371].

Props joedolson, flixos90, afercia.
Fixes #32399.


git-svn-id: https://develop.svn.wordpress.org/trunk@41683 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 19:43:02 +00:00
Andrea Fercia
54153520f2 Accessibility: Improve the Dashboard Nearby Events widget wp.a11y.speak() messages.
Avoids to announce the "city updated" message on page load.

Fixes #42037.


git-svn-id: https://develop.svn.wordpress.org/trunk@41682 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 19:24:24 +00:00
John Blackbourn
93fc60f36a Embeds: Add oEmbed support for someecards.com.
Props someecards

Fixes #40792


git-svn-id: https://develop.svn.wordpress.org/trunk@41681 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 19:09:46 +00:00
John Blackbourn
a89374bc30 Embeds: Switch the collegehumor.com oEmbed endpoint to HTTPS, as it redirects there by default now.
See #28507


git-svn-id: https://develop.svn.wordpress.org/trunk@41680 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 19:05:18 +00:00
Weston Ruter
64f0d4a544 Customize: Fix jumping behavior upon scrolling up when a sticky header has its description expanded.
Props delawski.
See #34343, #41879.
Fixes #41850.


git-svn-id: https://develop.svn.wordpress.org/trunk@41679 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:54:22 +00:00
Adam Silverstein
10488d5fdc WP-API JS Client: Improve support for meta.
* Add/fix `getMeta`, `getMetas`, `setMeta` and `setMetas` helpers for models that support meta.
* Add tests for new helpers, verify meta support for `Posts`, `Comments`, `Tags` and `Users`.
* Include meta data in fixture generation and fixture file driving tests.

Fixes #41055.


git-svn-id: https://develop.svn.wordpress.org/trunk@41678 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:39:30 +00:00
Weston Ruter
ba07b22cb5 Customize: Fix positioning of outer section (e.g. publish settings) on large screen sizes.
Also fix preview link CSS for desktop and mobile.

Props sayedwp, bduclos.
See #39896.
Fixes #42051.


git-svn-id: https://develop.svn.wordpress.org/trunk@41677 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:39:10 +00:00
John Blackbourn
493805239e Embeds: Alignment following [41615].
See #38181


git-svn-id: https://develop.svn.wordpress.org/trunk@41676 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:37:53 +00:00
Adam Silverstein
f2eb141e77 Menus: Increase timeout for QUnit wpNavMenu trigger tests.
Fix an (intermittent) issue where the final assertion verifying all hooks have been triggered ran too early, resulting in the test failing. 

Fixes #31218.


git-svn-id: https://develop.svn.wordpress.org/trunk@41675 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:34:53 +00:00
John Blackbourn
42a74c2aef Taxonomy: Add context and a translator comment to the new most_used label.
Fixes #41150


git-svn-id: https://develop.svn.wordpress.org/trunk@41674 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 18:24:46 +00:00