Commit Graph

37149 Commits

Author SHA1 Message Date
Adam Silverstein
1b7475645a Add wp.hooks - JavaScript actions and filters.
Add a JavaScript hooks library with an API that mirrors the WordPress Plugin API; provides similar functionality and API to PHP hooks.

Called via the global `wp.hooks`, eg: `wp.hooks.addAction()`, etc. Adds:

* `addAction( 'hook', 'vendor/plugin/function', callback, priority )`
* `addFilter( 'hook', 'vendor/plugin/function', callback, priority )`
* `removeAction( 'hook', 'vendor/plugin/function' )`
* `removeFilter( 'hook',  'vendor/plugin/function' )`
* `removeAllActions( 'hook' )`
* `removeAllFilters( 'hook' )`
* `doAction( 'hook', arg1, arg2, moreArgs, finalArg )`
* `applyFilters( 'hook', content, arg1, arg2, moreArgs, finalArg )`
* `doingAction( 'hook' )`
* `doingFilter( 'hook' )`
* `didAction( 'hook' )`
* `didFilter( 'hook' )`
* `hasAction( 'hook' )`
* `hasFilter( 'hook' )`

Props adamsilverstein, jnylen0, aduth, kadamwhite, youknowriad, schlessera, mikeschinkel, azaozz, vhauri, CaptainN, scribu, carldanley, chetanchauhan, mgibbs189, stephenharris, justnorris, koopersmith, gcorne, TV productions, atimmer.

Fixes #21170.



git-svn-id: https://develop.svn.wordpress.org/trunk@41375 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 12:53:21 +00:00
Weston Ruter
594a41666b Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.

Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.


git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 07:02:49 +00:00
Jeremy Felt
84487618eb Multisite: Update docs for switch_to_blog().
As of [21403], autoload options are switched along with the cache key prefix.

Props stevepuddick.
Fixes #41815.


git-svn-id: https://develop.svn.wordpress.org/trunk@41373 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 03:33:58 +00:00
Weston Ruter
4fbb54ca8c Customize: Align behavior of WP_Customize_Manager::save_changeset_post() with wp_insert_post() by setting status to future if supplied status is publish but date is future.
Props dlh.
Fixes #41336.


git-svn-id: https://develop.svn.wordpress.org/trunk@41372 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 17:49:58 +00:00
Andrea Fercia
34df35a414 Allow usage of aria-current in paginate_links().
The `aria-current` attribute is a simple, effective way to help assistive
technology users orientate themselves within a list of items.

Props GrahamArmfield, palmiak.
Fixes #40833.


git-svn-id: https://develop.svn.wordpress.org/trunk@41371 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 14:28:59 +00:00
Adam Silverstein
71aaf1fa4a Docs: Add jsdoc.conf.json JSDOC configuration file.
Left this file off by mistake in [41351].

Fixes #41682.


git-svn-id: https://develop.svn.wordpress.org/trunk@41370 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 13:13:40 +00:00
Peter Wilson
14f9c47685 General: Remove error screen padding for Internet Explorer.
The inline styles added to the `wp_die()` handler since [18534] increase file size of the error screen enough to prevent Internet Explorer from displaying a generic error page.

Props rfair404.
Fixes #37551.



git-svn-id: https://develop.svn.wordpress.org/trunk@41369 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 05:30:34 +00:00
Weston Ruter
6406fb561a Customize: Add rightward-facing back button to Themes section header to improve navigation (since the section slides in from the left).
Also serves to prototype for an upward-facing arrow in this location for a Publish Settings section.

Props melchoyce, westonruter.
See #39896, #40278, #21666.


git-svn-id: https://develop.svn.wordpress.org/trunk@41368 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 05:22:22 +00:00
John Blackbourn
b422c7e45f Build/Test Tools: Convert more test skipping into hard failures.
See #41851


git-svn-id: https://develop.svn.wordpress.org/trunk@41367 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-11 00:37:55 +00:00
John Blackbourn
45429a417b Docs: Clarify some terminology around meta capabilities, primitive capabilities, and roles.
See #41017


git-svn-id: https://develop.svn.wordpress.org/trunk@41366 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 22:50:27 +00:00
John Blackbourn
0c29992e72 Login and Registration: Pass the user session token to the set_auth_cookie and set_logged_in_cookie filters.
This also adds some missing `@since` parameters for other uses of the token so that developers know when the token was first made available to various filters.

Fixes #41849


git-svn-id: https://develop.svn.wordpress.org/trunk@41365 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 21:08:19 +00:00
Weston Ruter
7aa34b77e9 Customize: Re-use homepage settings help tab text from Reading Options admin screen in description for corresponding Customizer section.
Also remove "Static" reference in template name, missed in [41363].

See #41829.


git-svn-id: https://develop.svn.wordpress.org/trunk@41364 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 17:07:50 +00:00
Weston Ruter
d0dbcf5913 Customize: Rename "Static front page" to just "Homepage".
Props danieltj, melchoyce.
Fixes #41828.


git-svn-id: https://develop.svn.wordpress.org/trunk@41363 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 16:19:53 +00:00
Andrea Fercia
3d04cc37a5 Administration: Admin menu: Improve vertical spacing and alignment of menu items with counters.
Props pauldechov, JDTrower.

Fixes #41317.


git-svn-id: https://develop.svn.wordpress.org/trunk@41362 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 13:39:13 +00:00
Weston Ruter
6327832abe Widgets: Add shortcode support inside Text widgets.
* Used now in core to facilitate displaying inserted media. See #40854.
* The `[embed]` shortcode is not supported because there is no post context for caching oEmbed responses. This depends on #34115.
* Add `do_shortcode()` to the `widget_text_content` filter in the same way it is added for `the_content` at priority 11, with `shortcode_unautop()` called at priority 10 after `wpautop()`.
* For Text widget in legacy mode, manually apply `do_shortcode()` (and `shortcode_unautop()` if auto-paragraph checked) if the core-added `widget_text_content` filter remains, unless a plugin added `do_shortcode()` to `widget_text` to prevent applying shortcodes twice.
* Ensure that global `$post` is `null` while filters apply in the Text widget so shortcode handlers won't run with unexpected contexts.

Props westonruter, nacin, aaroncampbell.
See #40854, #34115.
Fixes #10457.


git-svn-id: https://develop.svn.wordpress.org/trunk@41361 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-10 06:32:34 +00:00
Weston Ruter
249c416f0d Widgets: Prevent fatal error due to calling undefined wp_json_encode() when requesting the load-scripts.php endpoint.
Props Otto42.
Amends [41352].
Fixes #41610.


git-svn-id: https://develop.svn.wordpress.org/trunk@41360 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 20:43:09 +00:00
Andrea Fercia
798c1894f4 Administration: Admin menu: Use aria-current for the current active page.
The `aria-current` attribute is a simple, effective way to communicate to assistive
technologies which the current item within a set of items is. While the admin menu
structure isn't 100% ideal (the top-level item is repeated also as a sub-item)
adding `aria-current="page"` to the sub-items gives an important feedback to
assistive technologies users.

This change introduces `aria-current` for the first time in core. Worth noting
there are other places where it can be used to improve accessibility. These should
be addressed in separate tickets and patches.

Fixes #41589.


git-svn-id: https://develop.svn.wordpress.org/trunk@41359 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 14:49:53 +00:00
Sergey Biryukov
6cbe8cba2e Docs: Remove "being being" dittography from inline comments.
Props birgire.
Fixes #41841.

git-svn-id: https://develop.svn.wordpress.org/trunk@41358 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 14:48:42 +00:00
Sergey Biryukov
e3bea1b8ca Twenty Fifteen: Remove "called called" dittography, missed in [41349].
Props birgire.
See #41841, #41836.

git-svn-id: https://develop.svn.wordpress.org/trunk@41357 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 14:47:23 +00:00
Andrea Fercia
c997d1283f Administration: Thickbox: Fix conflicts with the Plugin details and native Thickbox modals.
The Plugin details modal custom implementation in the Plugins page conflicts with
other Thickbox instances added by plugins. Thickbox shows its age and has been
modified over time to suit core needs. However, WordPress should do its best to
not create conflicts with the native Thickbox styles and functionalities. Plugin
authors should be able to use `add_thickbox()` in any admin page as documented, 
without having to worry about potential errors.

- fixes a JavaScript error when closing a native Thickbox modal in the Plugins page
- avoids to override the native Thickbox modal styles
- uses a CSS class to target the Plugin details modal and remove a pile of overqualified CSS selectors

Fixes #41417.


git-svn-id: https://develop.svn.wordpress.org/trunk@41356 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 14:13:28 +00:00
Sergey Biryukov
aa8f08b4d7 Docs: Remove "since since" and "one one" dittography from inline comments.
Fixes #41841.

git-svn-id: https://develop.svn.wordpress.org/trunk@41355 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 13:52:46 +00:00
Sergey Biryukov
50ddbc9946 Docs: Remove "to to" dittography from inline comments.
Props birgire.
See #41841.

git-svn-id: https://develop.svn.wordpress.org/trunk@41354 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 13:48:47 +00:00
Sergey Biryukov
47f5fd023c Docs: Remove "in in", "this this", and "containing containing" dittography from inline comments.
Props Presskopp.
Fixes #41841.

git-svn-id: https://develop.svn.wordpress.org/trunk@41353 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-09 13:18:23 +00:00
Weston Ruter
f5c342ce76 Widgets: Add dirty state tracking for widgets on admin screen.
* Mark a widget as dirty when a field input triggers a `change` or `input` event; clear dirty state when widget is successfully saved.
* Disable Save button and re-label "Saved" when widget not dirty.
* Show AYS dialog when leaving widgets admin screen with unsaved changes.
* When widgets are dirty, expand all unsaved widgets at AYS check and focus on first one.
* Change "Close" link to "Done"; hide link when widget is dirty and reveal when saved.
* The "Done" link persistently appears in the Customizer even after making a change (when the widget is dirty) because changes are autosaved into the changeset.
* Prevent saving widget when form fails `checkValidity`.
* Fix frequency of triggering of `change` event on the rich Text widget's `textarea` limited now to when there are actual changes.
* Add a class of `widget-dirty` to widget containers when the widget has unsaved changes.

Props westonruter, timmydcrawford, melchoyce.
Fixes #41610, #23120.


git-svn-id: https://develop.svn.wordpress.org/trunk@41352 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 19:10:59 +00:00
Adam Silverstein
6e7053a6df Docs: JSDoc improvements for namespaces.
Improve JS parsing of our inline JSDocs by introducing `@namespace`, `@lends` and `@memberOf`. Helps set the way for showing our JavaScript documentation on developer.wordpress.org, see https://meta.trac.wordpress.org/ticket/3063.

* Define all used namespaces using @namespace.
* Correctly specify in which namespace each class is using @memberOf.
* Define each usage of the extend function as a prototype assignment using @lends.
* Some comment blocks were moved to correct the parsing of certain definitions. 

Props herregroen, atimmer, netweb, SergeyBiryukov.  
Fixes #41682.


git-svn-id: https://develop.svn.wordpress.org/trunk@41351 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 18:41:20 +00:00
Sergey Biryukov
357532ab64 Docs: Remove "the the" dittography from inline comments.
Props Presskopp.
Fixes #41835.

git-svn-id: https://develop.svn.wordpress.org/trunk@41350 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 18:20:22 +00:00
Sergey Biryukov
a55222fe0f Bundled Themes: Remove "called called" and "can can" dittography.
Props johnpgreen.
Fixes #41836.

git-svn-id: https://develop.svn.wordpress.org/trunk@41349 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 18:12:40 +00:00
Felix Arntz
4705b3f27e Multisite: Use get_network() in populate_network() to check whether a network with the given ID already exists.
When multisite is setup already, e.g. in a multi network environment, this change gives a performance benefit over the direct SQL query that was previously used. The SQL query remains in place for when setting up multisite initially as the network API is not available at that point.

Props spacedmonkey.
Fixes #41805.


git-svn-id: https://develop.svn.wordpress.org/trunk@41348 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 16:32:39 +00:00
John Blackbourn
7f3deb9988 Embeds: Remove support for oEmbedded videos from Vine.
* Vine effectively shut down in December 2016.
* The oEmbed endpoint no longer works and returns a 404.
* Developer documentation for Vine has been removed.

Fixes #41817


git-svn-id: https://develop.svn.wordpress.org/trunk@41347 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 15:00:33 +00:00
Pascal Birchler
804fc41181 Editor: In _WP_Editors::wp_link_query, allow filtering empty results.
Previously, it was not possible to hook into the `wp_link_query` filter to add custom entries when the 
query returned no posts.

Props mitraval192, msebel.
Fixes #41825.


git-svn-id: https://develop.svn.wordpress.org/trunk@41346 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 14:02:43 +00:00
John Blackbourn
5c3d713beb Embeds: Add the dnt (Do Not Track) query parameter to all oEmbed provider URLs.
This means that, for those providers that support this somewhat de-facto standard, visitor tracking is disabled by default for all embeds.

Props norcross, joostdevalk

Fixes #41784


git-svn-id: https://develop.svn.wordpress.org/trunk@41345 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 12:30:03 +00:00
Andrew Ozz
085b1411bd Text widget: add the Add Media button and enable the wpview plugin to show embedded media previews in the editor.
Props westonruter, azaozz.
See #40854.

git-svn-id: https://develop.svn.wordpress.org/trunk@41344 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 10:56:10 +00:00
Sergey Biryukov
da4dd8eb56 Twenty Sixteen: Replace inline control structureв to improve code readability.
Fixes #38468.

git-svn-id: https://develop.svn.wordpress.org/trunk@41343 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 06:03:09 +00:00
Sergey Biryukov
4dc1c28e57 Twenty Seventeen: Correct the @return value for twentyseventeen_post_thumbnail_sizes_attr().
Props truongwp.
Fixes #41830.

git-svn-id: https://develop.svn.wordpress.org/trunk@41342 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 04:26:55 +00:00
Sergey Biryukov
5df690648a Twenty Sixteen: Correct the @return value for twentysixteen_post_thumbnail_sizes_attr().
Props truongwp.
See #41830.

git-svn-id: https://develop.svn.wordpress.org/trunk@41341 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 04:25:59 +00:00
Konstantin Obenland
ea3507034f Widgets: Improve _doing_it_wrong message.
Adds more context to help sending developers on the path to success.

Props ramiy.
Fixes 41743.


git-svn-id: https://develop.svn.wordpress.org/trunk@41340 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-06 21:31:26 +00:00
Weston Ruter
dd7ffeb4de Widgets: Use word-wrap: break-word for available widget descriptions.
Props metodiew.
Fixes #36207.


git-svn-id: https://develop.svn.wordpress.org/trunk@41339 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-06 18:27:51 +00:00
Weston Ruter
706daad00d Customize: Do not show cursor: not-allowed on audio/video track titles within playlists in preview.
Props scott.deluzio, mitraval192, westonruter.
See #31517.
Fixes #41489.


git-svn-id: https://develop.svn.wordpress.org/trunk@41338 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-06 17:59:53 +00:00
Andrea Fercia
849cf3efb7 Themes: Prevent the Themes search field default action after [40572].
Props boonebgorges.
Fixes #41803.


git-svn-id: https://develop.svn.wordpress.org/trunk@41337 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-05 17:25:23 +00:00
Dominik Schilling (ocean90)
5f06aaca1c I18N: Allow numbers in locales during installation.
The current regex was a bit to strict for locales like `pt_PT_ao90` which were already supported by `wp_get_installed_translations()`.

Fixes #41794.

git-svn-id: https://develop.svn.wordpress.org/trunk@41335 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-04 19:29:50 +00:00
Adam Silverstein
399db7ac03 WP-API JS Client: Add helpers to get a model or collection by route.
Add two new helper functions, `wp.api.getModelByRoute` and `wp.api.getCollectionByRoute`. Passed a route, they return the matching model or collection, or `undefined` if none is found.

Also adds tests to verify these functions work as expected.

Props rcutmore.
Fixes #41111.


git-svn-id: https://develop.svn.wordpress.org/trunk@41334 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-04 16:00:28 +00:00
John Blackbourn
503562e03a Multisite: More specificity for the get_sites() documentation.
See #41789


git-svn-id: https://develop.svn.wordpress.org/trunk@41333 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-04 11:16:18 +00:00
Andrew Ozz
b1d9cac1fc Plupload: remove the reinstated plupload.js from the list of old files.
Props afercia.
See #41755.

git-svn-id: https://develop.svn.wordpress.org/trunk@41332 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-04 10:21:33 +00:00
Dominik Schilling (ocean90)
505709a833 Multisite: Clarify return type of get_sites() when 'count' is passed as a query var.
Fixes #41789.

git-svn-id: https://develop.svn.wordpress.org/trunk@41331 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-04 08:15:32 +00:00
Andrea Fercia
ba6077dc27 Docs: Update media-audiovideo.js after [41239].
Fixes #41602.


git-svn-id: https://develop.svn.wordpress.org/trunk@41330 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-03 16:15:38 +00:00
Andrea Fercia
207d79af50 Accessibility: Improve the color picker UI accessibility, interaction, and generated markup.
- Refactors the UI controls around the Iris color picker to output valid and semantic markup
- Simplifies the way elements visibility gets toggled
- Properly associates the visually hidden label with the color input field
- Makes the toggle button a real button
- Adds `aria-expanded` to the toggle button
- Keeps focus on the toggle button instead of moving it to the color input field
- Adds `aria-label` attributes to give better context to some controls
- Removes a redundant title attribute
- Keeps the toggle button text to "Select Color" instead of changing it to "Current Color" when a color is selected
- Slightly improves the responsive view
- CSS clean-up

Fixes #39662.


git-svn-id: https://develop.svn.wordpress.org/trunk@41329 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-03 16:01:18 +00:00
Andrew Ozz
55938f0664 Plupload:
- Update to 2.1.9.
- Include the non-minified plupload.js and moxie.js.
- Remove support for Flash and Silverlight, the available runtime options are `html5` and `html4`.
- Delete plupload.flash.swf and plupload.silverlight.xap.

Fixes #41755.

git-svn-id: https://develop.svn.wordpress.org/trunk@41328 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-01 12:27:49 +00:00
Konstantin Obenland
09182448e7 Widgets: Add nudge for registered widgets
Informs developers that widgets need to be registered before they can be
displayed through `the_widget()`. Previously it would fail with an ambiguous
undefined index notice.

Props SeBsZ, mrasharirfan.
Fixes #41743.



git-svn-id: https://develop.svn.wordpress.org/trunk@41327 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-01 08:49:50 +00:00
Dominik Schilling (ocean90)
f5f5359d56 Taxonomy: Remove unused global imports for $wpdb in get_terms() and wp_get_object_terms().
Also remove incorrect `@global` tags for `$wpdb` and `$wp_filter`.

Fixes #41768.

git-svn-id: https://develop.svn.wordpress.org/trunk@41326 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-31 12:25:14 +00:00
Sergey Biryukov
750cbcbf2c Media: Set correct value for "Link Rel" field in Image Details modal.
Props hazemnoor.
Fixes #41764.

git-svn-id: https://develop.svn.wordpress.org/trunk@41325 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-31 11:16:56 +00:00