Commit Graph

35312 Commits

Author SHA1 Message Date
Gary Pendergast
bafd8c92f2 Database: Fall back to utf8 when utf8mb4 isn't supported.
Sometimes, `DB_CHARSET` will be set to `utf8mb4`, even if the current setup doesn't support `utf8mb4`. After [38442], this can cause significant character set failures, causing the connection to fall back to `latin1`.

Instead of doing this, we now check that the connection supports `utf8mb4` before trying to use it, and fall back to `utf8` when we need to.

Fixes #37982 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38580 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 23:48:05 +00:00
John Blackbourn
d651c9c90e Taxonomy: Revert accidental changes introduced in [38578].
See #18302


git-svn-id: https://develop.svn.wordpress.org/trunk@38579 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 22:57:22 +00:00
John Blackbourn
2aef21a55b Themes: Improve child theme file inheritance by introducing functions for locating and fetching the URL or path to files within child and parent themes.
The most useful function this introduces is `get_theme_file_uri()`, which returns the URL to the specified file in the child theme if it exists, and falls back to the URL to the specified file in the parent theme. This allows parent themes to reference files (including enqueuing CSS and JavaScript files) that can be overridden by the child theme simply by existing.

This change also introduces `get_theme_file_path()`, which is the file path equivalent of `get_theme_file_uri()`.

Finally, `get_parent_theme_file_uri()` and `get_parent_theme_file_path()` are also introduced, which allow a theme to specifically reference a file URL or file path in the parent theme. These can be used as replacements for `get_template_directory_uri()` and `get_template_directory()` respectively, for consistency.

Props johnbillion, georgestephanis, gma992.
Fixes #18302


git-svn-id: https://develop.svn.wordpress.org/trunk@38578 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 22:53:57 +00:00
Weston Ruter
8bae522ea8 Customize: Prevent widget previewing logic from building invalid jQuery selectors when sidebars are registered without a class name in before_widget.
Fixes #37993.


git-svn-id: https://develop.svn.wordpress.org/trunk@38577 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 15:44:08 +00:00
John Blackbourn
b875264a73 Formatting: Don't send an HTTP status code in wp_send_json() by default. This avoids clobbering an HTTP status code that may have been set prior to calling this function.
Props westonruter
See #35666


git-svn-id: https://develop.svn.wordpress.org/trunk@38576 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 13:44:32 +00:00
Peter Wilson
7ed5f4f9d5 Menus: Fix notices thrown by classes extending Walker_Nav_Menu.
Methods in `Walker_Nav_Menu` can be called with multiple, incompatible `$args` objects so an `insset()` check is required to avoid throwing notices.

Introduced in [38523].

Fixes #35206.


git-svn-id: https://develop.svn.wordpress.org/trunk@38575 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 07:05:32 +00:00
Peter Wilson
3cc19c17f3 Menus: Improve documentation of new $item_spacing argument.
Adds `@since` tags for and improves description of the new `$item_spacing` argument added to `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()` in [38523].

Props johnbillion for copy.
See #35206.


git-svn-id: https://develop.svn.wordpress.org/trunk@38574 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 05:30:32 +00:00
Drew Jaynes
45c799d84a Docs: Fix minor formatting for inline docs in WP_Hook following its introduction in [38571].
See #17817.


git-svn-id: https://develop.svn.wordpress.org/trunk@38573 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 04:16:39 +00:00
Aaron Jorbin
57530f4b73 Permalinks: Ensure Pending Review Posts permalink posts link to the draft
[34670] made the displayed permalink clickable. For posts that were pending review, the permalink wasn't being properly generated so the link wouldn't go to the preview.

Props knutsp, enshrined.
Fixes #37423.



git-svn-id: https://develop.svn.wordpress.org/trunk@38572 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 04:04:22 +00:00
Gary Pendergast
61abf68e6d Hooks: Add the new class WP_Hook, and modify hook handling to make use of it.
Filters and actions have been the basis of WordPress' plugin functionality since time immemorial, they've always been a reliable method for acting upon the current state of WordPress, and will continue to be so.

Over the years, however, edge cases have cropped up. Particularly when it comes to recursively executing hooks, or a hook adding and removing itself, the existing implementation struggled to keep up with more complex use cases.

And so, we introduce `WP_Hook`. By changing `$wp_filter` from an array of arrays, to an array of objects, we reduce the complexity of the hook handling code, as the processing code (see `::apply_filters()`) only needs to be aware of itself, rather than the state of all hooks. At the same time, we're able te handle more complex use cases, as the object can more easily keep track of its own state than an array ever could.

Props jbrinley for the original architecture and design of this patch.
Props SergeyBiryukov, cheeserolls, Denis-de-Bernardy, leewillis77, wonderboymusic, nacin, jorbin, DrewAPicture, ocean90, dougwollison, khag7, pento, noplanman and aaroncampbell for their testing, suggestions, contributions, patch maintenance, cajoling and patience as we got through this.
Fixes #17817.



git-svn-id: https://develop.svn.wordpress.org/trunk@38571 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 03:54:13 +00:00
John Blackbourn
84e8dcdf01 Menus: Correct the docblocks for Walker_Nav_Menu, wp_nav_menu(), and walk_nav_menu_tree().
This corrects the parameter type for the `$args` and `$item` parameters passed throughout these functions, class methods, and hooks.

See #24587
See #35206
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38559 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 16:14:49 +00:00
Jeremy Felt
8079863586 Media: Sanitize upload filename.
git-svn-id: https://develop.svn.wordpress.org/trunk@38538 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 13:54:57 +00:00
Andrea Fercia
2fc85993ca Widgets: Make the Delete/Remove links red.
For consistency and accessibility, all the UI controls that perform destructive
actions should be red.

Props monikarao, lukecavanagh, patilswapnilv, ibachal.
See #35622.
Fixes #37016.


git-svn-id: https://develop.svn.wordpress.org/trunk@38536 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-07 09:51:04 +00:00
Pascal Birchler
1a0effca18 Revert [38401] after [38480].
See #36335.

git-svn-id: https://develop.svn.wordpress.org/trunk@38535 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 18:12:09 +00:00
Pascal Birchler
b87c245902 Upgrade/Install: Sanitize file name in File_Upload_Upgrader.
git-svn-id: https://develop.svn.wordpress.org/trunk@38524 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 17:25:22 +00:00
Peter Wilson
0c88ec217d Menus: Add white space option to wp_nav_menu() and wp_list_pages().
Adds an `item_spacing` option to the arguments array for the functions `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()`. `item_spacing` is a boolean accepting either `preserve` or `discard`.

Previously, certain CSS choices could result in a site's layout changing if `wp_nav_menu()` fell back to the default `wp_list_pages()` due to differences in the whitespace within the HTML. The new argument ensures a function outputs consistant HTML while maintaining backward compatibility.

Fixes #35206.


git-svn-id: https://develop.svn.wordpress.org/trunk@38523 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-06 09:05:45 +00:00
John Blackbourn
18654d2778 Role/Capability: Correct the multisite cap tests after [38521].
See #35614
See #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@38522 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-05 12:08:39 +00:00
John Blackbourn
7dd2e5d4dc Role/Capability: Split meta and primitive capabilities in the helper functions in the roles and capability tests so primitive capability tests can be made more accurate.
See #35614
See #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@38521 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-05 10:59:42 +00:00
Andrea Fercia
02355cbdb5 Accessibility: Improve the Customizer and Theme Installer initial focus.
The Customizer and Theme Installer open in full overlays that need to receive 
focus. Also, keyboard navigation should be constrained within the overlays. Using
CSS `visibility` to hide all the content except the overlays, makes them the only
available and focusable content and allows browsers to handle focus natively.

See #29158.
Fixes #33228, #27705.


git-svn-id: https://develop.svn.wordpress.org/trunk@38520 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 21:50:22 +00:00
Sergey Biryukov
669ec7953e Script Loader: Correct default value for $src in wp_enqueue_script() and wp_enqueue_style().
Props Frank Klein for initial patch.
See #37770.

git-svn-id: https://develop.svn.wordpress.org/trunk@38519 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 04:08:11 +00:00
Drew Jaynes
e7c0b5f36c Docs: Update the $message parameter for _default_wp_die_handler() to notate that it can also accept a WP_Error object.
Additionally, update the `$message` parameter description in the DocBlock for `wp_die()` to make it explicitly clear messages derived from a passed `WP_Error` object will only be evaluated if not performing an Ajax or XML-RPC request (as both default handlers completely ignore `WP_Error` object messages).

See #37770.


git-svn-id: https://develop.svn.wordpress.org/trunk@38518 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-04 03:40:04 +00:00
Sergey Biryukov
e7a6afc044 Upload: Correct encoding issue in swfupload.js, introduced in [29479].
See #29199.

git-svn-id: https://develop.svn.wordpress.org/trunk@38517 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-03 15:01:06 +00:00
John Blackbourn
470a9fa6e2 Taxonomy: Introduce some taxonomy capability tests in preparation for introducing more fine grained capabilities for terms.
See #35614


git-svn-id: https://develop.svn.wordpress.org/trunk@38516 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-03 02:15:00 +00:00
Jeremy Felt
6f62798887 Multisite: Deprecate wp_get_network().
`wp_get_network()` was converted into a wrapper for `get_network()` in 4.6.0 and can now be deprecated.

This moves `wp_get_network()` to the bottom of `ms-load.php` as `ms-deprecated.php` is not available early enough.

Props PieWP, flixos90.
Fixes #37553.


git-svn-id: https://develop.svn.wordpress.org/trunk@38515 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 23:48:00 +00:00
John Blackbourn
00c47125db Embeds: Clarify some assertion failure messages and correct a test URL for Twitter timelines.
See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38514 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 22:52:48 +00:00
Weston Ruter
f5923b7fe8 Customize: Fix php warning due to WP_Customize_Manager::prepare_setting_validity_for_js() incorrectly assuming that WP_Error will only ever have arrays in its $error_data.
* Eliminates the server mutating the a `WP_Error`'s `$error_data` to merge-in a `$from_server` flag (since it may not be an array to begin with). Instead it defers to the client to add a `fromServer` param on any `Notification` instances created from server-sent errors.
* Ensures that notifications will be re-rendered if a notification's `message` changes but the `data` and `type` remain the same.
* Adds explicit support for the `Notification` class to have a `setting` property, ensuring that the property is set whereas previously it was dropped.

Fixes #37890.
Props westonruter, dlh.


git-svn-id: https://develop.svn.wordpress.org/trunk@38513 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 22:34:48 +00:00
John Blackbourn
84d26aac05 Embeds: Update the oEmbed provider test suite.
* Remove the manual flag for HTTPS support and replace it with a simple check on the URL format.
* Ensure `testOembedTestsCoverAllProviders()` actually fails when a new provider is added without a corresponding test.

See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38512 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 21:35:51 +00:00
Aaron Jorbin
4484e2d2c3 Formatting: Allow KSES custom elements with hyphens
The W3C Custom Elements spec (http://www.w3.org/TR/custom-elements/#concepts) allows you to use your own custom DOM elements/tags. One of the main requirements is that the tag name "must contain a U+002D HYPHEN-MINUS character". This adjusts KSES to allow it.

Fixes #34105.
Props batmoo.



git-svn-id: https://develop.svn.wordpress.org/trunk@38511 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 04:16:00 +00:00
Sergey Biryukov
cce5a95dfa I18N: Add translator comments for XML-RPC strings with placeholders.
See #37792.

git-svn-id: https://develop.svn.wordpress.org/trunk@38510 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 04:12:52 +00:00
Aaron Jorbin
a5cc61ef67 Text Changes: Improve Error messages in XML-RPC
Three changes to the error message strings:
 * add some missing periods.
 * merge similar translation strings.
 * remove the "Something wrong happened" suffix.

Fixes #37792.
Props ramiy.



git-svn-id: https://develop.svn.wordpress.org/trunk@38509 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 03:56:22 +00:00
Aaron Jorbin
43ca412094 Toolbar: Add unit tests for edit links.
When there is no post ID, there should be no edit link. This adds unit tests for it.

Fixes #22247.
Props akibjorklund.


git-svn-id: https://develop.svn.wordpress.org/trunk@38508 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 03:51:01 +00:00
Gary Pendergast
4afafbde25 Database: Find the correct table names in DELETE queries with table aliases
Previously, `wpdb::get_table_from_query()` would not find the correct table name in the query `DELETE a FROM table a`, due to not recognising the table alias immediately after the `DELETE` as correct syntax.

Fixes #37660.



git-svn-id: https://develop.svn.wordpress.org/trunk@38507 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 00:18:49 +00:00
Gary Pendergast
6d59b289a9 Shortcodes: Add the pre_do_shortcode_tag filter.
This filter allows the shortcode generation process to be short-circuited, so expensive short codes can be cached and returned immediately.

Props ideag.
Fixes #37906.



git-svn-id: https://develop.svn.wordpress.org/trunk@38506 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 00:09:42 +00:00
Sergey Biryukov
74cee3d59c Docs: Correct @since entry for the smilies filter added in [38504].
See #35905.

git-svn-id: https://develop.svn.wordpress.org/trunk@38505 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 00:07:22 +00:00
Gary Pendergast
5b85aa163f Smilies: Add the smilies filter.
This new filter allows the smilies array to be modified with a filter, instead of having to directly access the global.

Props mte90, jorbin.
Fixes #35905.



git-svn-id: https://develop.svn.wordpress.org/trunk@38504 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 23:59:59 +00:00
Andrea Fercia
770a150b42 Accessibility: Make links in the Customizer underlined by default.
Links within lines or blocks of text should always be underlined since they can't
rely on color alone to be distinguished from the surrounding text. Exceptions
can be handled on a case-by-case basis.

Props Presskopp for the initial patch.
Fixes #37527.


git-svn-id: https://develop.svn.wordpress.org/trunk@38503 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 22:01:44 +00:00
Aaron Jorbin
5387a52a0b Administration: Use a bool when when a bool is called for
The third parameter of `date_i18n` is a bool.  Currently, it's a weak check, otherwise the call showing the universal time on the "General Settings" screen would be messed up. Use an actual bool so we call our own functions correctly.

Fixes #37634.
Props fronaldaraujo.



git-svn-id: https://develop.svn.wordpress.org/trunk@38502 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 18:33:07 +00:00
Aaron Jorbin
f9e9854395 Administration: Use #fff instead of white
Cleans up a few places where the CSS coding standards were not being followed.

Fixes #37576.
Props Presskopp, johnpgreen, netweb



git-svn-id: https://develop.svn.wordpress.org/trunk@38501 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 18:13:21 +00:00
Boone Gorges
78df32df4e Query: 'orderby=include' should support comma-separated lists.
[30052] assumed that 'include' would be an array.

Props TimothyBlynJacobs.
Fixes #37904.

git-svn-id: https://develop.svn.wordpress.org/trunk@38500 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 16:50:47 +00:00
Gary Pendergast
4d4f78ae97 Bootstrap: class-wp-locale.php needs to be require_once()-ed.
After [38364], the inclusion of `class-wp-locale.php` was changed from a `require_once()` to a `require()`. This caused problems for anything that called `load_text_domain_early()` prior to the `require()` but didn't bail, as it was now being `require()`-ed a second time.

With the use of `require_once()`, it doesn't really matter where it's loaded, so it has been moved next to the related `l10n.php` load.

See #37827.



git-svn-id: https://develop.svn.wordpress.org/trunk@38496 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 12:35:37 +00:00
Sergey Biryukov
dc5951f460 Docs: Move term_description() reference from filter docblock to get_the_archive_description() function docblock.
Props dlh.
See #37259.

git-svn-id: https://develop.svn.wordpress.org/trunk@38495 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 12:31:22 +00:00
Sergey Biryukov
c43b1d16ae Users: After [33766], don't reset the password when clicking "Show Password" and then "Cancel" on Add New User screen.
Props smerriman for reporting.
Fixes #37902. See #33419.

git-svn-id: https://develop.svn.wordpress.org/trunk@38494 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 12:23:50 +00:00
Sergey Biryukov
b024ec7c46 Template: After [38486], actually use the $description variable in get_the_archive_description().
Props dlh.
Fixes #37259.

git-svn-id: https://develop.svn.wordpress.org/trunk@38493 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 11:46:58 +00:00
Weston Ruter
db0fedd69f Customize: Introduce paneVisible state and ensure pane is visible when a construct is expanded (or focused).
Fixes issue whereby a user would see nothing happen if the pane is collapsed while they shift-click to edit an element in the preview.

Props curdin, celloexpressions, westonruter.
See #27403.
Fixes #36678.


git-svn-id: https://develop.svn.wordpress.org/trunk@38492 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 05:54:32 +00:00
Dion Hulse
0b67b63857 Query: Use AND in a SQL query rather than &&.
This appears to have been the only instance of `&&` being used in SQL, so for consistency lets remove it.

Props scrappy@hub.org.
Fixes #37903.


git-svn-id: https://develop.svn.wordpress.org/trunk@38491 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 05:10:07 +00:00
John Blackbourn
2781473733 Taxonomy: Correct the function description for wp_ajax_add_link_category().
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38490 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 00:48:42 +00:00
John Blackbourn
f30caa604d Taxonomy: Update various docs for parameters which are now WP_Term objects.
See #37770
See #14162


git-svn-id: https://develop.svn.wordpress.org/trunk@38489 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-01 00:39:44 +00:00
Sergey Biryukov
ca40b18e81 Template: In get_the_archive_description(), add support for author archives.
Props henry.wright.
Fixes #37259.

git-svn-id: https://develop.svn.wordpress.org/trunk@38486 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 23:00:36 +00:00
Sergey Biryukov
b08ba54e61 Taxonomy: Introduce wp_insert_term_data and wp_update_term_data filters for altering term data before it is inserted/updated in the database.
Props atimmer, SergeyBiryukov.
Fixes #22293.

git-svn-id: https://develop.svn.wordpress.org/trunk@38484 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 21:40:18 +00:00
Andrea Fercia
2dcc7bc665 Text Changes: Improve the timezone setting description in General Settings.
Makes more clear users can set either a city or a UTC timezone offset.

Props GrantDerepas, andrew.p.
Fixes #34789.


git-svn-id: https://develop.svn.wordpress.org/trunk@38483 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 21:36:25 +00:00