Commit Graph

36890 Commits

Author SHA1 Message Date
Felix Arntz c8e811cc7e Multisite: Improve caching in `WP_Site_Query` by ignoring the `$fields` argument.
Prior to this change there were two different cache keys used for the same query. That is because regardless of the `$fields` argument, the query response will be the same.

Props spacedmonkey.
Fixes #41197.


git-svn-id: https://develop.svn.wordpress.org/trunk@41059 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 21:24:03 +00:00
Felix Arntz d18c6696c2 Multisite: Use `get_network_option()` for language in `wpmu_create_blog()`.
Before this changeset, the language of a new site would always result in the language of the current network, regardless of the `$site_id` parameter passed that actually determines the network for the site. Now the correct `WPLANG` value is used in such cases.

Alongside this change, a few minor documentation changes around the function have been made to account for the current naming conventions of sites and networks.

Props spacedmonkey.
Fixes #40503.


git-svn-id: https://develop.svn.wordpress.org/trunk@41058 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 21:07:17 +00:00
Weston Ruter e85f291a79 Widgets: Add legacy mode for Text widget and add usage pointers to default visual mode.
The Text widget in legacy mode omits TinyMCE and retains old behavior for matching pre-existing Text widgets. Usage pointers added to default visual mode appear when attempting to paste HTML code into the Visual tab and when clicking on the Text tab, informing users of the new Custom HTML widget.

Props westonruter, melchoyce, gitlost for testing, obenland for testing, dougal for testing, afercia for testing.
See #35243.
Fixes #40951.


git-svn-id: https://develop.svn.wordpress.org/trunk@41050 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 17:08:20 +00:00
Weston Ruter b60a603d50 REST API: Ensure `maxwidth` and `maxheight` params are forwarded to oEmbed provider in proxy requests.
Also correct phpdoc return tag on `WP_oEmbed_Controller::get_proxy_item()` and remove dead code in oEmbed controller phpunit tests.

Amends [40628].
See #40450.
Fixes #41299.


git-svn-id: https://develop.svn.wordpress.org/trunk@41047 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 16:04:04 +00:00
Gary Pendergast dac056e135 Emoji: Store the results of the `emoji_url` and `emoji_ext` filters in statics.
Previously, these filters were being run once per post, but the changes in [41043] caused them to be run once per emoji found.

We will not stand idly by while this kind of unfair performance penalty is placed on the emoji literate. The filters are now run once only, emoji aficionados everywhere can rest easy, knowing their posts will be just as performant as their emoji-less cousins.

Props ocean90 for noticing this severe oversight.
See #35293.



git-svn-id: https://develop.svn.wordpress.org/trunk@41046 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 12:44:49 +00:00
Gary Pendergast 4bad064c24 Emoji: Fix some failing unit tests in PHP 5.2 and 5.3.
- Older versions of PHP don't know how to `html_entity_decode()` emoji.
- The fall back regex was a little too broad, catching characters that aren't emoji.

See #35293.



git-svn-id: https://develop.svn.wordpress.org/trunk@41045 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 11:49:34 +00:00
Gary Pendergast f780ce0a49 Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.

This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.

The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.

For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.

Fixes #35293.



git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 05:46:19 +00:00
Drew Jaynes 666b9d7ccd Docs: Improve the DocBlock summary for `WP_Query::parse_orderby()`.
See #41017.


git-svn-id: https://develop.svn.wordpress.org/trunk@41042 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 15:43:12 +00:00
Drew Jaynes f72de4fff3 Docs: Document usage of the `$wpdb` global in `WP_Query::parse_search()` and `WP_Query::parse_orderby()`.
Props avinapatel.
Fixes #41313.


git-svn-id: https://develop.svn.wordpress.org/trunk@41041 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 15:41:15 +00:00
Sergey Biryukov d3f21c09f8 Docs: Add a `@global` entry for `$tinymce_version` in `_WP_Editors::editor_js()`.
Props jontyravi.
Fixes #41311.

git-svn-id: https://develop.svn.wordpress.org/trunk@41040 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 14:32:57 +00:00
Sergey Biryukov 517e11f834 Docs: Add a `@global` entry for `$wpdb` in `is_user_member_of_blog()`.
Props ajayghaghretiya1.
Fixes #41308.

git-svn-id: https://develop.svn.wordpress.org/trunk@41039 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 13:53:28 +00:00
Boone Gorges 834c29fbc6 Taxonomy: Avoid duplicates when querying for terms in taxonomies registered with `$args` parameter.
[40514] introduced a bug that caused term queries to return some duplicates
when the `$taxonomies` array contained only taxonomies that were originally
registered with an `$args` array. We fix this bug by ensuring that
recursive `get_terms()` queries stop when all queried `$taxonomies` have
already been referenced.

Props bor0, atanasangelovdev.
Fixes #41010.

git-svn-id: https://develop.svn.wordpress.org/trunk@41037 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 13:40:39 +00:00
Sergey Biryukov 5b384419f6 Docs: Add missing `@since` tags for `WP_Post` properties and methods.
Props keesiemeijer.
Fixes #41306.

git-svn-id: https://develop.svn.wordpress.org/trunk@41036 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-13 12:07:56 +00:00
Weston Ruter f57be206f7 REST API: Remove `_wpnonce` value from being used in hashed oEmbed proxy cache key.
Amends [40628].
Props r-a-y, westonruter.
See #40450.
Fixes #41048.


git-svn-id: https://develop.svn.wordpress.org/trunk@41035 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 22:50:57 +00:00
Drew Jaynes f628aaacda Docs: Use a hash notation for the `$args` parameter to describe the `fields` argument in the DocBlock for `wp_get_post_terms()`.
Also, the `$taxonomy` parameter can accept either a string or array of taxonomies.

Props ohryan for the initial tip.
See #41017.


git-svn-id: https://develop.svn.wordpress.org/trunk@41034 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 22:20:16 +00:00
Drew Jaynes 994ef530d1 Docs: Default for the `orderby` argument in `wp_list_categories()` is actually 'name', not 'ID'.
Props uicestone.
See #41017.


git-svn-id: https://develop.svn.wordpress.org/trunk@41033 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 22:05:54 +00:00
Sergey Biryukov 7e8d932935 Docs: Add a `@global` entry for `$allowed_files` in `get_file_description()`.
Props div33, ajayghaghretiya1.
Fixes #41294.

git-svn-id: https://develop.svn.wordpress.org/trunk@41032 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 21:39:37 +00:00
Sergey Biryukov cf4b8bc85f Docs: Fix typo in `wp_suspend_cache_invalidation()` description.
Props euthelup, milana_cap.
Fixes #41301.

git-svn-id: https://develop.svn.wordpress.org/trunk@41031 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 21:25:20 +00:00
Sergey Biryukov 90aca8c4d7 Docs: Add a `@global` entry for `$wpdb` in `display_setup_form()`.
Props mitraval192.
Fixes #41300.

git-svn-id: https://develop.svn.wordpress.org/trunk@41030 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 21:02:35 +00:00
Peter Westwood 4741b13009 Tests: Rename this file to match our coding standards.
git-svn-id: https://develop.svn.wordpress.org/trunk@41029 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 20:55:36 +00:00
Weston Ruter 6daeb23005 Widgets: Enqueue assets needed by media and text widgets in their `_register_one()` methods.
The `WP_Widget::_register_one()` method is more guaranteed to be called as opposed to its wrapper `WP_Widget::_register()` which plugins may bypass for performance reasons.

Amends [40631], [40640].
See #35243, #32417.
Fixes #41021.


git-svn-id: https://develop.svn.wordpress.org/trunk@41028 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-11 22:46:45 +00:00
Sergey Biryukov 1c017250b7 Users: Add a "View" link to users listed on the Users screen that points to the user's author archive.
Props ryanplas, johnjamesjacoby, viralsampat, Girishpanchal, xkon.
Fixes #38085.

git-svn-id: https://develop.svn.wordpress.org/trunk@41027 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-11 13:29:51 +00:00
Sergey Biryukov e4bfc8ca90 Shortcodes: Allow using single quotes for empty value attributes.
Props enrico.sorcinelli.
Fixes #37304.

git-svn-id: https://develop.svn.wordpress.org/trunk@41026 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-11 00:53:33 +00:00
Sergey Biryukov 4c5bb9758a Comments: In `WP_Comments_List_Table::extra_tablenav()`, save the state of `::has_items()` to a static variable, so that the value is consistent between top and bottom navigation.
This prevents "Empty Spam" and "Empty Trash" buttons from disappearing if there's only one page of comments in Spam/Trash.

Fixes #40975.

git-svn-id: https://develop.svn.wordpress.org/trunk@41022 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-10 23:04:26 +00:00
Adam Silverstein 2d5a59194d Media: library grid view - improve browser history support.
Set view state properly when navigating history using the browser back/next button in the media library (grid view). Correctly handle navigating, search, image detail view and image edit mode. Also handle bookmarking/reloading.

Props kucrut, joemcgill, afercia.
Fixes #31846.



git-svn-id: https://develop.svn.wordpress.org/trunk@41021 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-10 19:07:27 +00:00
Weston Ruter 34c3d7d044 Customize: Restrict click target of menu deletion, moving to button from its container.
Props westonruter, afercia.
Fixes #40981.


git-svn-id: https://develop.svn.wordpress.org/trunk@41020 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-10 18:39:56 +00:00
Andrea Fercia caf4c06f2a Administration: in `WP_List_Table->pagination()`, properly concatenate CSS classes for the pagination links when `infinite_scroll` is set to true.
Props SGr33n.
See #19815.
Fixes #40003.


git-svn-id: https://develop.svn.wordpress.org/trunk@41019 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-09 11:11:03 +00:00
Adam Silverstein 33755709e4 Date/Time: Add unit tests for the `human_time_diff` function.
Verify that `human_time_diff` works as expected for minute, hour and day intervals. Test that rounding works as expected when the time difference is near the rounding margin.

Props SGr33n.
Fixes #38773.


git-svn-id: https://develop.svn.wordpress.org/trunk@41018 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-07 17:07:40 +00:00
Sergey Biryukov bb6e34a7fd Media: Use a filename instead of a URL in image header tests to avoid triggering an outbound HTTP request causing an ImageMagick exception on some configurations.
Props danielbachhuber.
Fixes #41216.

git-svn-id: https://develop.svn.wordpress.org/trunk@41017 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-07 00:06:36 +00:00
Sergey Biryukov 50735b09f1 Media: Correct the order of arguments passed to assertions in `Tests_Image_Header`.
Props danielbachhuber.
See #41216.

git-svn-id: https://develop.svn.wordpress.org/trunk@41016 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 23:57:31 +00:00
Sergey Biryukov 93e7cf5e6f Docs: Update the DocBlock for `_WP_Editors::wp_fullscreen_html()` after [32677].
See #30949.

git-svn-id: https://develop.svn.wordpress.org/trunk@41015 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 23:43:58 +00:00
Sergey Biryukov 342e4fdf2e Docs: Update the list of static variables in `wptexturize()` DocBlock after [32863].
Props ajayghaghretiya1.
Fixes #41260.

git-svn-id: https://develop.svn.wordpress.org/trunk@41014 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 21:01:44 +00:00
Drew Jaynes 895cede84a Options: Pass `$default` as a new parameter to the `pre_option_{$option}` and `pre_site_option_{$option}` filters.
This change standardizes some language in the parameter descriptions between the two hook docs in an effort to reduce confusion between the `$pre_option` pseudo-parameters and the new `$default` ones. `$pre_option` is the truthy value used to short-circuit the `get_*option()` call, `$default` is the value passed to the `get_*option()` returned in the event that 1) a short circuit isn't performed, 2) the option doesn't exist.

Props sc0ttkclark.
Fixes #41254.


git-svn-id: https://develop.svn.wordpress.org/trunk@41013 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 15:11:32 +00:00
Weston Ruter f67018c059 Customize: Prevent edge case fatal error when attempting to save changes to a changeset that had previously been corrupted.
Check return value of `WP_Customize_Manager::get_changeset_post_data()` and return if error instead of assuming it is an array.

Amends [38810].
See #30937.
Fixes #41252.


git-svn-id: https://develop.svn.wordpress.org/trunk@41012 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 07:04:11 +00:00
Ryan McCue 8b5c4ae745 REST API: Fix brittle search test.
This was previously searching for the user ID, which isn't really what it was meant to do. As a result, the test can break if that number appears in any other user information.


git-svn-id: https://develop.svn.wordpress.org/trunk@41011 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 01:34:40 +00:00
Joe McGill 3eb767b5c3 Sanity check $uploaderToggler in wp.media.view.UploaderInline.
This ensures `$uploaderToggler` exists before checking length so any views
extending or scripts accessing this view, won't encounter errors that stop execution.

Props Blackbam, yahil.
Fixes #41231.


git-svn-id: https://develop.svn.wordpress.org/trunk@41009 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 00:40:59 +00:00
Sergey Biryukov a828890ce2 Menus: Make sure `current-menu-parent` and `current-menu-ancestor` classes are properly set for parent items of post type archive submenu items.
Props mrwweb, ajoah, welcher.
Fixes #39800.

git-svn-id: https://develop.svn.wordpress.org/trunk@41008 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 21:30:30 +00:00
Sergey Biryukov 4c099bfae9 Docs: Add a `@global` entry for `$tinymce_version` in `_WP_Editors::default_settings()`.
Props tejas5989.
Fixes #41244.

git-svn-id: https://develop.svn.wordpress.org/trunk@41007 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 18:54:56 +00:00
James Nylen 0b3663b0a2 Ensure that `wp-api.js` test fixtures do not change with `WP_TESTS_*` constants.
Previously, changing these constants in `wp-tests-config` would cause PHPUnit to regenerate `wp-api-generated.js` with different values.

This commit uses the existing mechanism to also "freeze" all values that would change as a result of changing these constants.

Fixes #41123.


git-svn-id: https://develop.svn.wordpress.org/trunk@41006 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 09:29:58 +00:00
Sergey Biryukov f8efad31f9 Docs: Add a `@global` entry for `$wpdb` in `WP_Network_Query::get_network_ids()`.
Props afzalmultani.
Fixes #41238.

git-svn-id: https://develop.svn.wordpress.org/trunk@41005 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 09:22:14 +00:00
Sergey Biryukov f0955e58e4 Docs: Add a `@global` entry for `$wp_post_statuses` in `WP_Customize_Nav_Menus::make_auto_draft_status_previewable()`.
Props afzalmultani.
See #41238.

git-svn-id: https://develop.svn.wordpress.org/trunk@41004 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 09:20:23 +00:00
Sergey Biryukov b24850d038 Docs: Add a `@global` entry for `$wp` in `redirect_canonical()`.
Props afzalmultani.
See #41238.

git-svn-id: https://develop.svn.wordpress.org/trunk@41003 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 09:18:17 +00:00
Sergey Biryukov d93f4ff3cb Docs: Add a `@global` entry for `$wp_widget_factory` in `WP_Customize_Widgets::get_selective_refreshable_widgets()`.
Props jankimoradiya.
Fixes #41243.

git-svn-id: https://develop.svn.wordpress.org/trunk@41002 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 08:22:54 +00:00
Weston Ruter 8e84510ebb Customize: Fix logic to re-expand a newly inserted nav menu section after placeholder section is replaced.
Fixes todo from Menu Customizer feature plugin: https://github.com/voldemortensen/menu-customizer/commit/0f4ea4e#diff-daa55fade2253f26ccbe02f71058841cR2330
Amends [32806].
Props greuben.
See #32576.
Fixes #40997.


git-svn-id: https://develop.svn.wordpress.org/trunk@41001 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 00:43:11 +00:00
Weston Ruter ebb7793cc6 Widgets: Let Custom HTML widget be "wide" as the Text widget is.
Also update `WP_Customize_Widgets::$core_widget_id_bases` with the new list of core widgets.

Props obenland, westonruter.
See #40907, #40951.


git-svn-id: https://develop.svn.wordpress.org/trunk@41000 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-04 21:00:05 +00:00
Boone Gorges c806540943 Avoid PHP notices when checking termmeta capabilities against a non-existent term.
Previously, checks like `current_user_can( 'edit_term_meta', $term_id )`
returned the proper value, but generated a PHP notice due to the fact
that `get_term( $term_id )` could, in certain instances, return
`WP_Error` objects.

Props caercam.
Fixes #40891.

git-svn-id: https://develop.svn.wordpress.org/trunk@40999 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-04 19:58:35 +00:00
Drew Jaynes 7bc5812ab3 Docs: Add a missing return notation and to the DocBlock for `WP_Session_Tokens::get_instance()`.
Also adds an inline reference to the `session_token_manager` hook in the description.

Props Shelob9 for the initial patch.
Fixes #40102.


git-svn-id: https://develop.svn.wordpress.org/trunk@40998 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-04 17:15:47 +00:00
Sergey Biryukov 944c7c694c General: Always use colon instead of a semicolon in `switch()` control structures.
Props jrf.
Fixes #41234.

git-svn-id: https://develop.svn.wordpress.org/trunk@40997 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-04 09:51:25 +00:00
Andrew Ozz 9b5781fef9 TinyMCE: fix adding the `<!-- more -->` tag when the editor is inline.
Props iseulde.
Fixes #41230.

git-svn-id: https://develop.svn.wordpress.org/trunk@40996 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-03 21:40:22 +00:00
Andrew Ozz 05325257c9 Customizer: improve setting the TinyMCE modals z-index.
Props westonruter, greuben.
See #41158.

git-svn-id: https://develop.svn.wordpress.org/trunk@40995 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-03 21:17:26 +00:00