Commit Graph

37331 Commits

Author SHA1 Message Date
Felix Arntz
761c45157e Multisite: Fix count_users() possibly querying incorrect roles when passed a different site ID.
The `time` strategy in `count_users()` queries users by role. However, the roles queried for were not affected by passing another site than the current one through the `$site_id` parameter, causing users having roles that were not queried for to appear as users without a role. This changeset fixes the issue by switching the site before retrieving the roles to query for.

Fixes #42014.


git-svn-id: https://develop.svn.wordpress.org/trunk@41653 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-30 03:53:27 +00:00
Felix Arntz
75c4cb98f4 Multisite: Display correct roles in Network > Site Users screen for sites other than the main site.
Props jeremyfelt.
Fixes #42013.


git-svn-id: https://develop.svn.wordpress.org/trunk@41652 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-30 03:19:26 +00:00
Weston Ruter
6e74a9bf23 Embeds: Cache oEmbeds in an oembed_cache custom post type instead of postmeta when there is no global $post.
Add processing of embeds to rich Text widget.

Props swissspidy, westonruter, ocean90, johnbillion.
See #40854, #39994, #40935.
Fixes #34115.


git-svn-id: https://develop.svn.wordpress.org/trunk@41651 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-30 01:14:34 +00:00
Weston Ruter
743494b654 Customize: Remove unused JS variables to fix JSHint.
Amends [41649].
See #37661, #39896.


git-svn-id: https://develop.svn.wordpress.org/trunk@41650 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 22:03:15 +00:00
Weston Ruter
d2540cfa06 Customize: Improve interactions between the Themes panel and Publish Settings section.
* Deactivate the Themes panel immediately after changing selected status to non-publish.
* Animate publish settings button into view with publish button when collapsing Themes panel.
* Deactivate publish settings section and hide publish settings button entirely when customizer state is clean.
* Harden access of Themes panel in case it was removed by plugin.
* Fix throttling of `renderScreenshots` calls in `ThemesSection`.

Amends [41648], [41626].
See #37661, #39896, #34843.


git-svn-id: https://develop.svn.wordpress.org/trunk@41649 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 21:51:42 +00:00
Weston Ruter
c35fe07703 Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.

Also includes CSS auto-prefixing added via `grunt precommit:css`.

For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/

Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.


git-svn-id: https://develop.svn.wordpress.org/trunk@41648 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 20:12:19 +00:00
John Blackbourn
6d399d4de8 Build/Test tools: Partially revert [41367] as gd and exif aren't actually required to run WordPress.
See #41851


git-svn-id: https://develop.svn.wordpress.org/trunk@41647 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 19:56:33 +00:00
Andrew Ozz
b076026362 Editor: improve attaching a callback on editor init.
See #42029

git-svn-id: https://develop.svn.wordpress.org/trunk@41646 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 19:11:08 +00:00
Andrew Ozz
6b72687e10 Editor: Improve keeping text selection when switching between Visual and Text modes.
Props biskobe.
See #42029.

git-svn-id: https://develop.svn.wordpress.org/trunk@41645 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 17:49:43 +00:00
Sergey Biryukov
cc08743ec5 Posts, Post Types: Correct test_submitting_comment_to_trashed_post_returns_error().
`wp_trash_post()` accepts a post ID, not a `WP_Post` object.

See #42030.

git-svn-id: https://develop.svn.wordpress.org/trunk@41644 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 15:09:39 +00:00
Andrew Ozz
1d022678bb TinyMCE: fix "flickering inline toolbar" in Chrome in RTL mode by not showing tooltips while an inline toolbar is shown.
Fixes #42018.

git-svn-id: https://develop.svn.wordpress.org/trunk@41643 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 14:24:19 +00:00
Sergey Biryukov
e549a6c53c Posts, Post Types: In wp_delete_post(), wp_trash_post(), wp_untrash_post(), and wp_delete_attachment(), standardize on WP_Post as a return value and internal representation of the post data.
Props bor0, SergeyBiryukov.
Fixes #42030.

git-svn-id: https://develop.svn.wordpress.org/trunk@41642 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 13:35:42 +00:00
Sergey Biryukov
3edd5dac38 I18N: Use a consistent pattern for translator comments for placeholders in wp-admin/includes/dashboard.php.
See #41974.

git-svn-id: https://develop.svn.wordpress.org/trunk@41641 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 11:43:27 +00:00
Sergey Biryukov
13b5f8272a I18N: Use a consistent pattern for translator comments for placeholders in Customizer and widget strings.
Props danieltj, Rahmohn.
Fixes #41974.

git-svn-id: https://develop.svn.wordpress.org/trunk@41640 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 11:41:06 +00:00
Sergey Biryukov
b8d32950e7 I18N: Improve i18n in help text for Custom HTML widget and Additional CSS section.
Fixes #42032.

git-svn-id: https://develop.svn.wordpress.org/trunk@41639 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 11:09:13 +00:00
Sergey Biryukov
fa754724e1 Posts, Post Types: Introduce pre_trash_post and pre_untrash_post filters to allow for short-circuiting wp_trash_post() and wp_untrash_post().
This brings parity with `pre_delete_post` filter in `wp_delete_post()`, introduced in [34082].

Props bor0.
Fixes #42030.

git-svn-id: https://develop.svn.wordpress.org/trunk@41638 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-29 10:18:11 +00:00
John Blackbourn
58140009e5 Build/Test tools: Update the WP_PHPUnit_Util_Getopt class for PHP 7.2 compatibility.
This removes usage of `each()` which is deprecated in PHP 7.2.

Props ayeshrajans

See #40109
Fixes #41525


git-svn-id: https://develop.svn.wordpress.org/trunk@41636 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 23:14:26 +00:00
John Blackbourn
4277df991d Build/Test tools: Update some test cases in anticipation of code formatting corrections.
These two tests assume a certain level of indentation in code which does not conform to core's coding
standards and will hopefully be corrected at some point in #41057.

See #41057


git-svn-id: https://develop.svn.wordpress.org/trunk@41635 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 22:55:54 +00:00
Dominik Schilling (ocean90)
c8ff7f6592 Embeds: In switched state, restore previous state if no post ID is found.
Fixes #40673.

git-svn-id: https://develop.svn.wordpress.org/trunk@41634 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 16:28:46 +00:00
John Blackbourn
bbf0683deb External Libraries: Update the Text_Diff_Engine_native class for PHP 7.2 compatibility.
This removes usage of `each()` and usage of text strings passed to `assert()`.

Props bor0

Fixes #41526


git-svn-id: https://develop.svn.wordpress.org/trunk@41633 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 13:58:23 +00:00
Gary Pendergast
345aac85a6 Docs: Update the documentation for wpdb::prepare()
The inline documentation for `wpdb::prepare()` was kind of confusing, and didn't describe some of the behaviour correctly.

Fixes #41983.



git-svn-id: https://develop.svn.wordpress.org/trunk@41632 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 11:44:30 +00:00
Gary Pendergast
d93dcaf75f Setup: Hide database errors while testing the table prefix.
If DB errors are shown during installation, the table prefix test will also show an error, even though we're deliberately trying to generate that error.

Fixes #40655.



git-svn-id: https://develop.svn.wordpress.org/trunk@41631 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 07:57:22 +00:00
Gary Pendergast
98cdd162b2 Post Editor: Keep text selection between Visual and Text modes
When switching between post editor modes, the current cursor position and selection is now preserved. This allows authors to switch modes without losing the context of where they were in the document.

Props biskobe.
Fixes #41962.



git-svn-id: https://develop.svn.wordpress.org/trunk@41630 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 06:44:09 +00:00
Gary Pendergast
199aa17cda Database: Add support for connecting to IPv6 hosts
IPv4 addresses are scarce, overworked, and underpaid. They're ready to retire, but we just won't let them go. If you care about their wellbeing, switch to IPv6 today.

Props schlessera, birgire.
Fixes #41722.



git-svn-id: https://develop.svn.wordpress.org/trunk@41629 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 05:36:34 +00:00
Gary Pendergast
f5c4c69bf1 Database: Don't quote placeholders in queries going through $wpdb->prepare()
To bring Core into line with the changes to `$wpdb->prepare()` in WordPress 4.8.2, query placeholders shouldn't be quoted.

Props jrf, johnjamesjacoby.
Fixes #41983.



git-svn-id: https://develop.svn.wordpress.org/trunk@41628 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 04:31:05 +00:00
Gary Pendergast
bd85b7a39b Options: Add new alloptions and pre_cache_alloptions filters.
`pre_cache_alloptions` is run before the alloptions array is inserted into the cache, and is valuable for sanity checking the options, particularly if your caching scheme has size limitations.

`alloptions` is run before returning the alloptions array, and is useful for when you have extra information that alloptions should return.

Props sebastian.pisula, keesiemeijer.
Fixes #33958.



git-svn-id: https://develop.svn.wordpress.org/trunk@41627 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 00:22:48 +00:00
Weston Ruter
a92bb89f4f Customize: Introduce drafting and scheduling for Customizer changesets.
* Incorporates code from the Customize Snapshots and Customize Posts feature plugins.
* Adds a new Publish Settings section for managing the changeset status, scheduled date, and frontend preview link.
* Updates Publish button to reflect the status selected in the Publish Settings (including Save Draft and Schedule).
* Deactivates the Themes section when a non-publish status selected, and deactivates the Publish Settings section when previewing a theme switch.
* Introduces an `outer` section type (`wp.customize.OuterSection` in JS) for the Publish Settings section to use and for available widgets and available nav menu panels to use in the future. These sections can be expanded while other sections are expanded.
* Introduces `WP_Customize_Date_Time_Control` in PHP and `wp.customize.DateTimeControl` in JS for managing a date/time value.
* Keeps track of scheduled time and proactively publish from the client when the time arrives, as opposed to waiting for WP Cron.
* Auto-publishes a scheduled changeset when attempting to access one that missed its schedule.
* Starts a new changeset if attempting to save a changeset that was previously publish.
* Adds `force` arg to `requestChangesetUpdate()` to force an update request even when there are no pending changes.
* Adds utils methods for `getCurrentTimestamp` and `getRemainingTime`.
* Adds new state values for `selectedChangesetStatus`, `changesetDate`, `selectedChangesetDate`.
* Fixes logic for when to short-circuit check to close Customizer when there are unsaved changes.
* Adds getter methods for `autosaved` and `branching` parameters, with the latter applying the `customize_changeset_branching` filter.
* Call to `establish_loaded_changeset` on the fly when `changeset_uuid()` is called if no changeset UUID was specififed.
* De-duplicates logic for dismissing auto-draft changesets.
* Includes unit tests.

Builds on [41597].
Props sayedwp, westonruter, melchoyce, JoshuaWold, folletto, stubgo, karmatosed, dlh, paaljoachim, afercia, johnregan3, utkarshpatel, valendesigns.
See #30937.
Fixes #39896, #28721, #39275.


git-svn-id: https://develop.svn.wordpress.org/trunk@41626 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 22:24:37 +00:00
Felix Arntz
621a95a23f Multisite: Improve initializing available roles when switch sites.
Switching the available roles and the current user's capabilities no longer happens in `switch_to_blog()` and `restore_current_blog()`, instead it has been moved to a new function `wp_switch_roles_and_user()` which is hooked into the site switching process. This allows to improve performance by temporarily unhooking the function when roles and capabilities do not need to be switched.

This change ensures that switching available roles now works closer to switching user capabilities, particularly the changes in [41624]. A new `WP_Roles::for_site( $site_id )` method has been introduced, and the `WP_Roles::_init()` method has been deprecated. It is furthermore possible to retrieve the site ID for which the available roles are currently initialized through a new `WP_Roles::get_site_id()`.

Props johnjamesjacoby, flixos90.
Fixes #38645.


git-svn-id: https://develop.svn.wordpress.org/trunk@41625 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 21:43:59 +00:00
Felix Arntz
8be3b4f729 Multisite: Initialize a user's roles correctly when setting them up for a different site.
While it has always been possible to initialize a user's roles and capabilities for another site than the current one in a multisite, the actual roles available were not switched prior to this change, possibly causing invalid roles to show up or actually valid capabilities not being available.

In order to fix this bug in a clean way, relevant parts of the `WP_User` class have been refactored. The ID of the site for which capabilities are currently initialized are now stored in a private property `WP_User::$site_id`. The `WP_User::for_blog( $blog_id )` and `WP_User::_init_caps( $cap_key )` methods have been deprecated in favor of `WP_User::for_site( $site_id )`. In addition, a new method `WP_User::get_site_id()` has been introduced to retrieve the site ID for which the user's capabilities are currently initialized.

Props ryanduff, jeremyfelt, flixos90.
Fixes #36961.


git-svn-id: https://develop.svn.wordpress.org/trunk@41624 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 21:09:11 +00:00
John Blackbourn
0ef31b8de5 Users: Remove the failing tests added in [41613] while they're investigated.
See #38741


git-svn-id: https://develop.svn.wordpress.org/trunk@41623 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 17:41:31 +00:00
Andrea Fercia
def5c946f5 Accessibility: Update and standardize the admin screen-reader-text CSS class.
Given the new WordPress browsers support policy, the `screen-reader-text` css
class used in the admin can be updated to use modern CSS and correct syntax. See
https://github.com/wpaccessibility/a11ythemepatterns/blob/master/read-more-links/style.css

Worth noting the `clip` property is deprecated and kept for IE11 and Edge.

- uses `clip-path` for modern browsers
- keeps `clip` for old browsers and update its value to a correct syntax
- resets `clip-path` to `none` where the class is used to dynamically reveal elements
- removes an old rule that made `screen-reader-text` completely invisible in the help tabs `#screen-meta`
- standardizes the rule across CSS files

Fixes #40970.


git-svn-id: https://develop.svn.wordpress.org/trunk@41622 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 17:26:58 +00:00
Andrea Fercia
3e27644b97 Accessibility: Improve the sidebar toggles in the Widgets screen.
- uses button elements for the toggles
- uses `aria-expanded` on the toggles to communicate to assistive technologies the panels expanded/collapsed state
- adds the "circular focus" style to the toggles to give users a clear indication of the currently focused element
- standardizes CSS class names to `.toggle-indicator` and `.handlediv` as these names are already used across the admin for similar controls

Props monikarao, xavortm, mihai2u, Kopepasah.
Fixes #37013.


git-svn-id: https://develop.svn.wordpress.org/trunk@41621 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 16:28:59 +00:00
Andrew Ozz
35ebd35801 TinyMCE: disable the tests for wptextpatterns plugin in PhantomJS.
See #42009

git-svn-id: https://develop.svn.wordpress.org/trunk@41620 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 16:21:24 +00:00
Pascal Birchler
cc4c7757c9 Upgrade/Install: Update unit tests after [41611].
See #40764.


git-svn-id: https://develop.svn.wordpress.org/trunk@41619 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 15:14:53 +00:00
John Blackbourn
e5e17a4eff Taxonomy: Introduce a back_to_items taxonomy label.
This is used after updating a taxonomy term in the link to return to the term listing screen.

Props benoitchantre

Fixes #41898


git-svn-id: https://develop.svn.wordpress.org/trunk@41618 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 14:38:40 +00:00
John Blackbourn
301ecdabe4 Options, Meta APIs: Require a confirmation link in an email to be clicked when a user attempts to change the network
admin email address on Multisite.

This mirrors the same functionality for the site admin email address and user profile email address.

Fixes #41254


git-svn-id: https://develop.svn.wordpress.org/trunk@41617 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 14:16:21 +00:00
John Blackbourn
9d23f61503 Embeds: Documentation alignment following [41615].
See #38181


git-svn-id: https://develop.svn.wordpress.org/trunk@41616 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 13:26:53 +00:00
John Blackbourn
c2e30ec382 Embeds: Add support for Amazon Kindle instant previews.
Props jsepia, morganestes, adamsilverstein, swissspidy, jbpaul17, johnbillion, rugved

Fixes #38181


git-svn-id: https://develop.svn.wordpress.org/trunk@41615 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 13:25:06 +00:00
John Blackbourn
a80aeeb5dc Users: There is not, in fact, 12345 users on every WordPress installation.
Props spacedmonkey

See #38741


git-svn-id: https://develop.svn.wordpress.org/trunk@41614 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 13:06:37 +00:00
John Blackbourn
1507df9d59 Users: Introduce the concept of a large site in order to speed up the Users screen when there are many users.
Calling the `count_users()` function is expensive, regardless of the counting strategy that's used, and it gets
slower the more users there are on a site. In order to speed up the Users screen in the admin area, calling
`count_users()` can be avoided entirely while still displaying the total count for users.

This introduces some new functions:

* `wp_is_large_user_count()`
* `wp_get_active_user_count()`
* `wp_update_active_user_count()`

A corresponding `wp_is_large_user_count` filter is also introduced.

Props tharsheblows, johnbillion

Fixes #38741


git-svn-id: https://develop.svn.wordpress.org/trunk@41613 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 13:03:03 +00:00
Pascal Birchler
0c1d3f62f3 Upgrade/Install: Fix updating plugins on the Add Plugins screen.
Props imath.
Fixes #41407.


git-svn-id: https://develop.svn.wordpress.org/trunk@41612 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 11:59:01 +00:00
Pascal Birchler
135ca36a69 Upgrade/Install: Show new version number when updating a theme on Multisite.
Props afragen.
Fixes #40764.


git-svn-id: https://develop.svn.wordpress.org/trunk@41611 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 09:43:07 +00:00
Pascal Birchler
4a6ecbfcd0 Themes: Adjust unit test after [41607].
Props ocean90.
See #40820.


git-svn-id: https://develop.svn.wordpress.org/trunk@41610 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 08:52:34 +00:00
Pascal Birchler
0becc4b8db Plugins: Fix version number in docblock after [41608].
Props ocean90.
See #37430.


git-svn-id: https://develop.svn.wordpress.org/trunk@41609 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 08:51:25 +00:00
Pascal Birchler
dfaa7de8fb Plugins: Improve error messages on plugins screen.
This unifies the layout and wording of error messages on both the plugins screen and the themes screen.

Props tinkerbelly, juhise, Ankit K Gupta, m1tk00, swissspidy, mrahmadawais, danieltj.
Fixes #37430.


git-svn-id: https://develop.svn.wordpress.org/trunk@41608 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 08:45:46 +00:00
Pascal Birchler
1935d9a2d1 Themes: Adjust translated string after [41601].
Props obenland.
See #40820.


git-svn-id: https://develop.svn.wordpress.org/trunk@41607 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 08:37:49 +00:00
Pascal Birchler
80bd8ac220 Embeds: Maintain switched state when embedding a post on Multisite.
Props bor0.
Fixes #40673.


git-svn-id: https://develop.svn.wordpress.org/trunk@41606 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 08:35:16 +00:00
Dion Hulse
2ff224a044 Standardise on performing api.WordPress.org requests over SSL when possible, falling back to non-SSL when appropriate.
This also standardises the `User-Agent` used when communicating with WordPress.org, allowing for more consistent version detection.

Fixes #42004.


git-svn-id: https://develop.svn.wordpress.org/trunk@41605 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 07:59:14 +00:00
Andrew Ozz
1545e58ea6 TinyMCE: update to 4.6.7, changelog: https://www.tinymce.com/docs/changelog/#version467september182017.
Fixes #41996 #40956

git-svn-id: https://develop.svn.wordpress.org/trunk@41604 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-26 21:14:28 +00:00
Weston Ruter
9cbcab9457 Customize: Dismiss all autosaved auto-drafts for user and not just the one suggested when dismissing restoration notification.
Amends [41597].
See #39896.


git-svn-id: https://develop.svn.wordpress.org/trunk@41603 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-26 20:32:46 +00:00