Commit Graph

35408 Commits

Author SHA1 Message Date
Weston Ruter
76226c9b41 Customize: Introduce custom CSS for extending theme styles.
* Custom CSS is associated with a given theme and is displayed in an inline `style` element at the `wp_head` hook after the `wp_print_styles` is called so that it overrides any enqueued stylesheets.
* A `wp_get_custom_css()` function is used for accessing the CSS associated with the current theme (or another theme) and a `wp_get_custom_css` filter for manipulating it.
* CSS is managed in customizer via a new "Additional CSS" section with a single `textarea` control. 
* `WP_Customize_Section::$description_hidden` is introduced for hiding extended descriptions in customizer sections behind a help toggle as done with panels.
* CSS is stored in a `custom_css` post type with the theme (stylesheet) slug as the `post_name`.
* `WP_Customize_Custom_CSS_Setting` is introduced to handle validation of CSS, previewing, and persisting the CSS to the `custom_css` post type.
* The `custom_css` setting is tied to a new `unfiltered_css` capability which maps to `unfiltered_html` by default.
* Escaping the message in the notification template is removed to allow markup (`code` tags) to be rendered.

See https://make.wordpress.org/core/2016/10/11/feature-proposal-better-theme-customizations-via-custom-css-with-live-previews/

Props johnregan3, celloexpressions, folletto, westonruter.
Fixes #35395.


git-svn-id: https://develop.svn.wordpress.org/trunk@38829 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 18:14:21 +00:00
Sergey Biryukov
949d991913 Docs: Fix typo in in_category() description.
Props Kenshino, mbootsman.
Fixes #38363.

git-svn-id: https://develop.svn.wordpress.org/trunk@38828 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 13:45:28 +00:00
Pascal Birchler
2a713b0b39 Upgrade/Install: Refresh update counts after page load.
By enqueuing the updates script in the footer and passing the number of available updates to it after page load, the update bubbles will be more accurate.

Props ocean90, swissspidy.
Fixes #13071.

git-svn-id: https://develop.svn.wordpress.org/trunk@38827 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 10:26:31 +00:00
Pascal Birchler
752708b84f Resource Hints: Allow passing custom attributes to resource hints.
[37920] introduced resource hints that allow browsers to prefetch specific pages or render them in the background. With this change, the `as`, `crossorigin`, `pr`, and `type` attributes can be passed in addition to the URLs/hosts.

Props peterwilsoncc, swissspidy.
Fixes #38121.

git-svn-id: https://develop.svn.wordpress.org/trunk@38826 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 09:28:22 +00:00
Pascal Birchler
4225b1655e Dashboard: Do not show 'Popular Plugin' UI if DISALLOW_FILE_MODS is set.
Props Mte90.
Fixes #37436.

git-svn-id: https://develop.svn.wordpress.org/trunk@38825 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 08:43:55 +00:00
Jeremy Felt
0e41016df8 Multisite: Replace get_blog_details() with get_site() in network admin screens.
Props iamfriendly.
See #37102.
Fixes #38349.


git-svn-id: https://develop.svn.wordpress.org/trunk@38824 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 06:07:09 +00:00
Jeremy Felt
aa3662127f Multisite: Replace get_blog_details() in wp-admin/my-sites.php with get_site().
Props spacedmonkey, iamfriendly.
See #37102.
Fixes #38348.


git-svn-id: https://develop.svn.wordpress.org/trunk@38823 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 06:01:22 +00:00
Jeremy Felt
d2b2c8e531 Multisite: Replace get_blog_details() in /wp-admin/ms-delete-site.php with get_site().
Props spacedmonkey, iamfriendly.
See #37102.
Fixes #38347.


git-svn-id: https://develop.svn.wordpress.org/trunk@38822 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 05:53:52 +00:00
Jeremy Felt
775eedc29d Multisite: Replace get_blog_details() usage in wpmu_delete_blog() with get_site().
Props spacedmonkey, iamfriendly.
See #37102.
Fixes #38346.


git-svn-id: https://develop.svn.wordpress.org/trunk@38821 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 05:49:20 +00:00
Jeremy Felt
eeef1da9e1 Multisite: Replace get_blog_details() in WP_Importer::set_blog() with get_site().
Props spacedmonkey, iamfriendly.
See #37102.
Fixes #38345.


git-svn-id: https://develop.svn.wordpress.org/trunk@38820 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 05:44:21 +00:00
Jeremy Felt
79cee7a230 Multisite: Use correct types in get_sites() during network upgrade.
`spam`, `deleted`, and `archived` query args should be integers, not strings.

Props ocean90.
See #37823.


git-svn-id: https://develop.svn.wordpress.org/trunk@38819 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 05:10:22 +00:00
Jeremy Felt
f04f183213 Multisite: Add $network_id parameter to hooks in delete_network_option().
Props flixos90.
Fixes #38322.


git-svn-id: https://develop.svn.wordpress.org/trunk@38818 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 05:01:29 +00:00
Jeremy Felt
fec49f1fc6 Multisite: Add $network_id parameter to hooks in update_network_option().
Props flixos90.
Fixes #38321.


git-svn-id: https://develop.svn.wordpress.org/trunk@38817 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 04:59:20 +00:00
Jeremy Felt
5da64357bc Multisite: Add $network_id parameter to hooks in add_network_option().
Props flixos90.
Fixes #38320.


git-svn-id: https://develop.svn.wordpress.org/trunk@38816 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 04:55:49 +00:00
jeremyfelt
be51e30f40 Multisite: Add $network_id parameter to filters in get_network_option().
Props flixos90.
Fixes #38319.


git-svn-id: https://develop.svn.wordpress.org/trunk@38815 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 04:53:02 +00:00
Jeremy Felt
2979167ba7 Multisite: Use get_network() and get_current_network_id() for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.


git-svn-id: https://develop.svn.wordpress.org/trunk@38814 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 04:46:14 +00:00
Weston Ruter
8a79cdc107 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.

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/

Fixes #37661, #34843.
Props celloexpressions, folletto, westonruter, karmatosed, afercia.


git-svn-id: https://develop.svn.wordpress.org/trunk@38813 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 03:19:13 +00:00
Joe McGill
788bb093f2 Media: Remove alt fallbacks to improve accessibility.
This removes the fallbacks in `wp_get_attachment_image()` and in
`wp.media.string.props` which attempt to generate an `alt` value
from the image caption or title if an `alt` attribute isn't explicitly
set.

This allows for image HTML to be generated that contains an empty `alt`
value, i.e., `alt=""` which is much preferable for screen readers than
reading redundant content in the case of a caption, or when reading the
image title, which is often generated from the filename and not helpful
as `alt` text.

Props odie2, joedolson, rianrietveld, afercia, iamjolly, joemcgill.
Fixes #34635.

git-svn-id: https://develop.svn.wordpress.org/trunk@38812 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 03:05:51 +00:00
Weston Ruter
500041a4bc Customize: Split out link click.preview and form submit.preview event handlers from anonymous functions into named methods on wp.customize.Preview for extensibility.
See #30937.


git-svn-id: https://develop.svn.wordpress.org/trunk@38811 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 02:06:00 +00:00
Weston Ruter
83b059aa19 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.


git-svn-id: https://develop.svn.wordpress.org/trunk@38810 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-18 20:04:36 +00:00
Gary Pendergast
2ba32a2d48 Charset: Allow _canonical_charset() to handle mixed-case strings.
Add improved unit tests, and collect existing unit tests together.

Props pbearne.
Fixes #38337.



git-svn-id: https://develop.svn.wordpress.org/trunk@38809 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 23:53:20 +00:00
Andrew Ozz
535ae49ab6 TinyMCE wplink:
- Remove the calls to getBookmark() and moveToBookmark() in IE. This is handled automatically when blurring and focusing the editor.
- When inserting a link, move it out of the caret position element. If not, it may be removed with that element on clean-up before save.

Fixes #38335.

git-svn-id: https://develop.svn.wordpress.org/trunk@38808 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 20:00:53 +00:00
Weston Ruter
456c23c551 Customize: Skip triggering initial click on pages section for available nav menu items if already open.
Fixes race condition if user opens Pages section before the ajax request to load items finishes.

Props ryankienstra, celloexpressions.
Fixes #36984.


git-svn-id: https://develop.svn.wordpress.org/trunk@38807 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 16:22:14 +00:00
Aaron Jorbin
246aa65a19 REST API: Include Vary: Origin in cors headers
`vary: origin` is a W3 CORS implementation recommendation( https://www.w3.org/TR/cors/#resource-implementation ). It's used by default in frameworks such as hapi and Laravel-cors. Overall, it helps sites siting behind a cache such as varnish.

Fixes #38060.
Props procodewp, pdufour for research.



git-svn-id: https://develop.svn.wordpress.org/trunk@38806 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 16:10:37 +00:00
Pascal Birchler
9639758d1c Docs: Improve documentation for install_plugin_install_status().
Props clarionwpdeveloper, sudar.
Fixes #36912.

git-svn-id: https://develop.svn.wordpress.org/trunk@38805 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 08:29:30 +00:00
Pascal Birchler
b9894d3295 Date/Time: Remove some legacy logic in date_i18n().
Since there's no difference between using `date()` and `gmdate()` in WordPress, we can simply use the former in `date_i18n()` to reduce its complexity.

Adds tests.

Props jdgrimes for initial patch.
Fixes #37910.

git-svn-id: https://develop.svn.wordpress.org/trunk@38804 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 08:09:11 +00:00
Andrew Ozz
79fdcbdb07 TinyMCE:
- When editing pages, add body class with the page template, or `page-template-default`.
- Change the page template class when the users select another template, similarly to changing the post type class for posts.

Props webmandesign.
Fixes #37599.

git-svn-id: https://develop.svn.wordpress.org/trunk@38803 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-17 01:10:01 +00:00
John Blackbourn
d3dd6046d5 Role/Capability: Disregard the order of capabilities when testing that single site and multisite capability tests match.
See #38191


git-svn-id: https://develop.svn.wordpress.org/trunk@38802 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-16 23:35:33 +00:00
Andrew Ozz
6cccdf89ee TinyMCE: restore the monospace font in textareas in the TinyMCE UI. Make it same as in the Text editor.
Fixes #38125.

git-svn-id: https://develop.svn.wordpress.org/trunk@38801 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-16 22:50:28 +00:00
Andrea Fercia
7ea0f51f01 Editor: Add a role button to the Tags meta box tag cloud links.
For better accessibility, the tag cloud links in the Tags meta box should be
reported to assistive technologies as buttons. They don't navigate to a new
resource, instead they perform an action.

Fixes #38318.


git-svn-id: https://develop.svn.wordpress.org/trunk@38800 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-16 20:08:01 +00:00
Andrea Fercia
95feac1df5 Menus: Fix the posts-categories quick search.
On the Menus screen, events that trigger the posts-categories search need to be
delegated. This "boxes" may get dynamically rebuilt so events directly attached
to the search input field need to be delegated.

Fixes #38324.


git-svn-id: https://develop.svn.wordpress.org/trunk@38799 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-16 20:02:33 +00:00
Sergey Biryukov
fb7e12b9ad Docs: In get_pages() and wp_list_pages(), note that post_status argument can also be an array.
Adjust the alignment of default argument values for better readability.

Props birgire, desrosj.
Fixes #38136.

git-svn-id: https://develop.svn.wordpress.org/trunk@38798 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-16 01:09:12 +00:00
Andrew Ozz
a1cae16efe Accessible Tags autocomplete:
- Replace suggest.js with UI Autocomplete.
- Use the same settings like in the editor link toolbar.
- Abstract it and add in a new file, tags-suggest.js. Then make it a dependency for the Tags postbox(es) and Quick and Bulk Edit.
- Add `data-wp-taxonomy` on all input elements to improve handling in the UI for custom taxonomies.

Props afercia, azaozz.
See #33902.

git-svn-id: https://develop.svn.wordpress.org/trunk@38797 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 22:39:49 +00:00
Andrew Ozz
53bacc01c2 TinyMCE:
- Prevent applying Indent and Outdent while an image with a caption is selected. It doesn't do anything and breaks the caption elements.
- Keep all of the text when a caption `<dl>` was somehow changed.

Fixes #38313.

git-svn-id: https://develop.svn.wordpress.org/trunk@38796 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 21:37:41 +00:00
Andrea Fercia
7ce67a141d Administration: Better consistency for the Media, Add Plugins, and Add Themes toolbars.
Fixes the Add Themes toolbar padding. Standardizes the placeholders to no title
case and three trailing dots. Expands the Media search placeholder in
"Search media items..." for consistency with the Plugins and Themes toolbars.

Props mikeviele, jamesacero, mattking5000, koenschipper, dungengronovius.

Fixes #38010.


git-svn-id: https://develop.svn.wordpress.org/trunk@38795 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 21:32:08 +00:00
Weston Ruter
c601e0c682 Customize: Move Pages below Custom Links in available nav menu items panel.
Props ryankienstra, celloexpressions.
See #36984.


git-svn-id: https://develop.svn.wordpress.org/trunk@38794 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 21:20:34 +00:00
Andrew Ozz
e93607c37f Media modal: make it possible to reorder images by dragging on devices with both touch screen and mouse support.
Props adamsilverstein.
Fixes #31652.

git-svn-id: https://develop.svn.wordpress.org/trunk@38793 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 20:28:55 +00:00
Boone Gorges
e9ef25d9f6 Query: Allow the hyphen-prefix-for-search-exclusion feature to be disabled by filter.
WordPress 4.4 introduced "hyphen exclusion" for search terms, so that
"foo -bar" would return posts containing "foo" AND not containing "bar".
The new filter 'wp_query_use_hyphen_for_exclusion' allows developers
to disable this feature when it's known that their content will contain
semantically important leading hyphens.

Props chriseverson, choongsavvii.
Fixes #38099.

git-svn-id: https://develop.svn.wordpress.org/trunk@38792 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 20:05:40 +00:00
Rachel Baker
53753c6c3a Pings/Trackbacks: Add new pre_trackback_post action before a trackback is added to a post.
Props dshanske, rachelbaker.
Fixes #37007.

git-svn-id: https://develop.svn.wordpress.org/trunk@38791 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 19:38:17 +00:00
Rachel Baker
a94f468051 REST API: Support sites with index-style permalinks in get_rest_url().
Support the index-style permalinks (http://example.com/index.php/postName) when registering the REST API rewrite rules and within the `get_rest_url()` function. This allows sites that do not have mod_rewrite support to have almost pretty urls and have access to their REST API endpoints.

Props kraftbj.
Fixes #38182.

git-svn-id: https://develop.svn.wordpress.org/trunk@38790 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 19:29:08 +00:00
John Blackbourn
6b8d8c90a5 Themes: Improve the inline documentation for the get_*_template() functions by providing examples instead of verbose explanations.
Fixes #38249
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38789 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 14:19:08 +00:00
Pascal Birchler
ddeae5feee Themes: Do not show an update button if there's no update package.
This updates the list view to match the existing behaviour in the single theme modal.

Props tristangemus for initial patch.
Fixes #37774.

git-svn-id: https://develop.svn.wordpress.org/trunk@38788 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 13:32:29 +00:00
John Blackbourn
3083effa52 Users: Use the role name instead of the role display name when fetching the list of users with no role. This avoids false positives when dealing with user roles that, for example, contain spaces in the display name.
Props procodewp, choongsavvii
Fixes #38234


git-svn-id: https://develop.svn.wordpress.org/trunk@38787 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-14 12:04:50 +00:00
Jeremy Felt
ee259e073a Multisite: Maintain switched state in site icon/logo functions.
Adjusts `get_custom_logo()`, `get_site_icon_url()`, and `has_custom_logo()` so that when called in a switched state, the original switched stack is not adjusted.

Props achbed, flixos90.
Fixes #38253.


git-svn-id: https://develop.svn.wordpress.org/trunk@38786 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-13 22:27:15 +00:00
Gary Pendergast
595c76de1a KSES: Deprecate wp_kses_js_entities().
This function was originally introduced to fix an XSS attack in Netscape 4, which never affected any other browsers, or later versions of Netscape.

I'm willing to go out on a limb, and say that we've officially dropped security support for Netscape 4.

Props dmsnell, desrosj.
Fixes #33848.



git-svn-id: https://develop.svn.wordpress.org/trunk@38785 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-13 22:24:27 +00:00
Boone Gorges
7e8e642ead Taxonomy: Cache results of term count queries.
Fixes #38295.

git-svn-id: https://develop.svn.wordpress.org/trunk@38784 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-12 15:29:03 +00:00
Boone Gorges
a1531d97af Comments: When checking comments, returned error object should include HTTP status code.
The status code in the `WP_Error` `data` array is needed to send
headers in wp-comments-post.php, and was erroneously not included in
[38778].

Props needle, websupporter.
Fixes #36901.

git-svn-id: https://develop.svn.wordpress.org/trunk@38783 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-12 13:49:21 +00:00
Andrew Ozz
3b9841351a TinyMCE: prevent iOS Safari from expanding the iframe width beyond the container width.
Fixes #38289.

git-svn-id: https://develop.svn.wordpress.org/trunk@38782 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-12 03:35:46 +00:00
Jeremy Felt
1d2db9eade Multisite: Clarify that get_site_by_path() does not return exact matches.
Props stevenlinx.
Fixes #38152.


git-svn-id: https://develop.svn.wordpress.org/trunk@38781 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-12 01:09:29 +00:00
Andrew Ozz
23bf03c3be TinyMCE: update the charmap plugin to the latest dev. version. Fixes problems with inserting white space characters.
Fixes #37936.

git-svn-id: https://develop.svn.wordpress.org/trunk@38780 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-11 23:55:24 +00:00